diff --git a/.changelog/en.md b/.changelog/en.md index fc11c53688..01b65b4cd4 100644 --- a/.changelog/en.md +++ b/.changelog/en.md @@ -1,11 +1,21 @@ -# v2.0.19 +# v2.0.20 -2026-03-06 +2026-03-26 + +**🐛 Bug Fixes** + +- **@visactor/vchart**: fix theme config of spec and option +- **@visactor/vchart**: datazoom update domain after data change. fix#4186 **🔨 Chores** -- **@visactor/vchart**: remove unused GitHub Actions workflows +- **@visactor/vchart**: update changes for 008-fix-size-legend-handler-text: Allow size legend handlerText.style to accept function-based values in the same way other legend style hooks already do, and add regression coverage proving the style callback is preserved through continuous legend attribute transformation. +- **@visactor/vchart**: update changes for 009-fix-heatmap-scrollbar-axis-direction: Align ScrollBar with DataZoom by using the shared reverse-axis detection when converting scrollbar state percentages back into domain values. +- **@visactor/vchart**: update changes for 009-fix-issue-of-mark-state-when-updateSpec: Fix an issue where mark states were not properly cleared when updateSpec was called, causing incorrect state persistence. +- **@visactor/vchart**: update changes for 010-hide-empty-axes: Add an opt-in hideWhenEmpty axis option for cartesian axes. +- **@visactor/vchart**: update changes for 009-fix-issue-of-mark-state-when-updateSpec: Fix an issue where mark states were not properly cleared when updateSpec was called, causing incorrect state persistence. +- **@visactor/vchart**: upgrade vutils, vdataset, vscale, vlayouts to ~1.0.23 -**Full Changelog**: https://github.com/VisActor/VChart/compare/v2.0.18...v2.0.19 +**Full Changelog**: https://github.com/VisActor/VChart/compare/v2.0.19...v2.0.20 -[more detail about v2.0.19](https://github.com/VisActor/VChart/releases/tag/v2.0.19) +[more detail about v2.0.20](https://github.com/VisActor/VChart/releases/tag/v2.0.20) diff --git a/.changelog/harmony.md b/.changelog/harmony.md index fc11c53688..01b65b4cd4 100644 --- a/.changelog/harmony.md +++ b/.changelog/harmony.md @@ -1,11 +1,21 @@ -# v2.0.19 +# v2.0.20 -2026-03-06 +2026-03-26 + +**🐛 Bug Fixes** + +- **@visactor/vchart**: fix theme config of spec and option +- **@visactor/vchart**: datazoom update domain after data change. fix#4186 **🔨 Chores** -- **@visactor/vchart**: remove unused GitHub Actions workflows +- **@visactor/vchart**: update changes for 008-fix-size-legend-handler-text: Allow size legend handlerText.style to accept function-based values in the same way other legend style hooks already do, and add regression coverage proving the style callback is preserved through continuous legend attribute transformation. +- **@visactor/vchart**: update changes for 009-fix-heatmap-scrollbar-axis-direction: Align ScrollBar with DataZoom by using the shared reverse-axis detection when converting scrollbar state percentages back into domain values. +- **@visactor/vchart**: update changes for 009-fix-issue-of-mark-state-when-updateSpec: Fix an issue where mark states were not properly cleared when updateSpec was called, causing incorrect state persistence. +- **@visactor/vchart**: update changes for 010-hide-empty-axes: Add an opt-in hideWhenEmpty axis option for cartesian axes. +- **@visactor/vchart**: update changes for 009-fix-issue-of-mark-state-when-updateSpec: Fix an issue where mark states were not properly cleared when updateSpec was called, causing incorrect state persistence. +- **@visactor/vchart**: upgrade vutils, vdataset, vscale, vlayouts to ~1.0.23 -**Full Changelog**: https://github.com/VisActor/VChart/compare/v2.0.18...v2.0.19 +**Full Changelog**: https://github.com/VisActor/VChart/compare/v2.0.19...v2.0.20 -[more detail about v2.0.19](https://github.com/VisActor/VChart/releases/tag/v2.0.19) +[more detail about v2.0.20](https://github.com/VisActor/VChart/releases/tag/v2.0.20) diff --git a/.changelog/zh.md b/.changelog/zh.md index 77d7a2de79..c18d064705 100644 --- a/.changelog/zh.md +++ b/.changelog/zh.md @@ -1,11 +1,21 @@ -# v2.0.19 +# v2.0.20 -2026-03-06 +2026-03-26 + +**🐛 问题修复** + +- **@visactor/vchart**: 修复 theme config of spec and option +- **@visactor/vchart**: datazoom update domain after data change. fix#4186 **🔨 维护与杂项** -- **@visactor/vchart**: remove unused GitHub Actions workflows +- **@visactor/vchart**: 更新 changes for 008-fix-size-图例-handler-text: Allow size 图例 handlerText.style accept function-based values in the same way other 图例 style hooks already do, and add regression coverage proving the style callback is preserved through continuous 图例 attribute transformation. +- **@visactor/vchart**: 更新 changes for 009-fix-heatmap-scrollbar-axis-direction: Align ScrollBar with DataZoom by using the shared reverse-axis detection when converting scrollbar state percentages back into domain values. +- **@visactor/vchart**: 更新 changes for 009-fix-问题-of-mark-state-when-updateSpec: Fix an 问题 where mark states were not properly cleared when updateSpec was called, causing incorrect state persistence. +- **@visactor/vchart**: 更新 changes for 010-hide-empty-axes: Add an opt-in hideWhenEmpty axis option for cartesian axes. +- **@visactor/vchart**: 更新 changes for 009-fix-问题-of-mark-state-when-updateSpec: Fix an 问题 where mark states were not properly cleared when updateSpec was called, causing incorrect state persistence. +- **@visactor/vchart**: 升级 vutils, vdataset, vscale, vlayouts ~1.0.23 -**Full Changelog**: https://github.com/VisActor/VChart/compare/v2.0.18...v2.0.19 +**Full Changelog**: https://github.com/VisActor/VChart/compare/v2.0.19...v2.0.20 -[更多详情请查看 v2.0.19](https://github.com/VisActor/VChart/releases/tag/v2.0.19) +[更多详情请查看 v2.0.20](https://github.com/VisActor/VChart/releases/tag/v2.0.20) diff --git a/.cursor/commands/speckit.prgenerate.md b/.cursor/commands/speckit.prgenerate.md index 5bd34b0114..217960279a 100755 --- a/.cursor/commands/speckit.prgenerate.md +++ b/.cursor/commands/speckit.prgenerate.md @@ -1,5 +1,5 @@ --- -description: 'Generate a PR body using the GitHub pull request template and specs//plan.md; default to the English template and write to specs//PR_BODY.md.' +description: 'Generate a PR body using the GitHub pull request template and specs//plan.md; default to the English template and write to .trae/output/pr.body.local.md.' handoffs: - label: 'Create Pull Request' agent: 'speckit.prcreate' @@ -22,7 +22,7 @@ You **MUST** consider the user input before proceeding (if not empty), but treat - Parse `$ARGUMENTS` only for CLI-style options (for example, `--lang`, `--out`): - If `--lang zh` is present, use the Chinese template at `.github/PULL_REQUEST_TEMPLATE/pr_cn.md`. - Otherwise, use the English template at `.github/PULL_REQUEST_TEMPLATE.md` (the default; **do not** auto-detect language). - - If an explicit output path is provided (for example, `--out specs/001-foo/PR_BODY.md`), respect it; otherwise, default to `specs//PR_BODY.md`. + - If an explicit output path is provided (for example, `--out specs/001-foo/PR_BODY.md`), respect it; otherwise, default to `.trae/output/pr.body.local.md`. - Resolve `specs//` by deriving the numeric prefix from the current branch name and matching it to a directory under `specs/` whose name starts with that prefix. - From that directory, resolve `plan.md` as the primary context source for the PR. @@ -61,7 +61,7 @@ You **MUST** consider the user input before proceeding (if not empty), but treat 6. **Write PR body file without touching templates**: - Render the updated markdown content (with checklist, background, and Changelog injected) into a single PR body string. - - Write this string to the resolved output path (default `specs//PR_BODY.md`), creating parent directories if needed. + - Write this string to the resolved output path (default `.trae/output/pr.body.local.md`), creating parent directories if needed. - Do **not** modify the original template files under `.github/`. 7. **Validation checklist**: diff --git a/.cursor/rules/specify-rules.mdc b/.cursor/rules/specify-rules.mdc index f4448e2042..56092a6035 100644 --- a/.cursor/rules/specify-rules.mdc +++ b/.cursor/rules/specify-rules.mdc @@ -6,6 +6,7 @@ Auto-generated from all feature plans. Last updated: 2026-01-15 - TypeScript 4.x+ (Project uses TS) + `@visactor/vchart` (Core logic), `@visactor/react-vchart` (React wrapper) (007-fix-datazoom-react) - N/A (In-memory chart state) (007-fix-datazoom-react) - Markdown + JSON(文档内容与菜单配置) + `@internal/docs` 文档构建体系、`docs/assets/guide/menu.json` 导航配置、现有教程目录结构 (001-vchart-skill-tutorial) +- TypeScript 4.9.5 + `@visactor/vchart`, `@visactor/vutils`, `@visactor/vrender-components` (010-hide-empty-axes) - TypeScript/React 18 + @visactor/react-vchart, @visactor/vchar (001-react-vchart-demo) @@ -27,9 +28,9 @@ npm test && npm run lint TypeScript 4.9.5: Follow standard conventions ## Recent Changes +- 010-hide-empty-axes: Added TypeScript 4.9.5 + `@visactor/vchart`, `@visactor/vutils`, `@visactor/vrender-components` - 001-vchart-skill-tutorial: Added Markdown + JSON(文档内容与菜单配置) + `@internal/docs` 文档构建体系、`docs/assets/guide/menu.json` 导航配置、现有教程目录结构 - 007-fix-datazoom-react: Added TypeScript 4.x+ (Project uses TS) + `@visactor/vchart` (Core logic), `@visactor/react-vchart` (React wrapper) -- 007-fix-datazoom-react: Added [if applicable, e.g., PostgreSQL, CoreData, files or N/A] diff --git a/.github/workflows/post-release.yml b/.github/workflows/post-release.yml index c64de57548..a51fd1bcaf 100644 --- a/.github/workflows/post-release.yml +++ b/.github/workflows/post-release.yml @@ -1,8 +1,12 @@ name: Post release after develop synced on: - repository_dispatch: - types: [develop-synced] + workflow_dispatch: + inputs: + version: + description: 'Release version, e.g. 1.2.3' + required: true + type: string jobs: post_release: @@ -12,19 +16,19 @@ jobs: contents: write steps: - - name: Read version from repository_dispatch payload + - name: Read version from workflow_dispatch input id: meta env: - PAYLOAD_VERSION: ${{ github.event.client_payload.version }} + INPUT_VERSION: ${{ github.event.inputs.version }} run: | set -euo pipefail - if [ -z "${PAYLOAD_VERSION}" ]; then - echo "No version in client_payload, skip post-release." + if [ -z "${INPUT_VERSION}" ]; then + echo "No version in workflow_dispatch input, skip post-release." echo "skip=true" >> "$GITHUB_OUTPUT" exit 0 fi - echo "Using version from payload: ${PAYLOAD_VERSION}" - echo "version=${PAYLOAD_VERSION}" >> "$GITHUB_OUTPUT" + echo "Using version from input: ${INPUT_VERSION}" + echo "version=${INPUT_VERSION}" >> "$GITHUB_OUTPUT" echo "skip=false" >> "$GITHUB_OUTPUT" - name: Checkout main diff --git a/.github/workflows/sync-main-to-develop.yml b/.github/workflows/sync-main-to-develop.yml index 00cdbbcfbf..940f4ec334 100644 --- a/.github/workflows/sync-main-to-develop.yml +++ b/.github/workflows/sync-main-to-develop.yml @@ -1,4 +1,4 @@ -name: Sync main to develop after release (Scheme A) +name: Sync main to develop after release on: pull_request: @@ -102,11 +102,20 @@ jobs: - name: Create Pull Request to develop if: steps.sync_branch.outputs.exists == 'false' - uses: dustinirving/create-pr@v1.0.2 - with: - token: ${{ secrets.GITHUB_TOKEN }} - title: '[Auto Sync] Sync the code from branch main to branch develop after release ${{ steps.package_version.outputs.current_version }}' - base: develop - head: ${{ steps.sync_branch.outputs.sync_branch }} - reviewers: xile611 - body: 'Sync the code from branch main to branch develop after release ${{ steps.package_version.outputs.current_version }}' + env: + GH_TOKEN: ${{ github.token }} + run: | + set -euo pipefail + BRANCH="${{ steps.sync_branch.outputs.sync_branch }}" + echo "Source branch: $BRANCH" + + # Check if PR already exists + if gh pr list --base develop --head "$BRANCH" --state open --json number --limit 1 | grep -q '"number"'; then + echo "PR from $BRANCH to develop already exists, skip creating." + exit 0 + fi + + TITLE="[Auto Sync] Sync the code from branch main to branch develop after release ${{ steps.package_version.outputs.current_version }}" + BODY="Sync the code from branch main to branch develop after release ${{ steps.package_version.outputs.current_version }}" + + gh pr create --base develop --head "$BRANCH" --title "$TITLE" --body "$BODY" --reviewer xuefei1313 diff --git a/.vscode/launch.json b/.vscode/launch.json index ee7aafab14..22bdbd0d0e 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -16,11 +16,27 @@ "skipFiles": ["/**"], "type": "pwa-node" }, + { + "name": "Debug Jest-Electron Current File", + "type": "node", + "request": "launch", + "cwd": "${workspaceFolder}/packages/vchart", + "program": "${workspaceFolder}/packages/vchart/node_modules/jest/bin/jest.js", + "args": [ + "${file}", + "--watch" + ], + "env": { + "DEBUG_MODE": "1" + }, + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen" + }, { "name": "unit test", "type": "pwa-node", "request": "launch", - "program": "${workspaceFolder}/packages/vchart/node_modules/.bin/jest", + "program": "${workspaceFolder}/packages/vchart/node_modules/jest/bin/jest.js", "args": ["${file}"], "console": "integratedTerminal", "internalConsoleOptions": "neverOpen" diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index acff09fa49..5cde2a118b 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -19,16 +19,16 @@ importers: specifier: 2.46.1 version: 2.46.1(@types/react@18.3.27)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@visactor/openinula-vchart': - specifier: workspace:2.0.19 + specifier: workspace:2.0.20 version: link:../packages/openinula-vchart '@visactor/react-vchart': - specifier: workspace:2.0.19 + specifier: workspace:2.0.20 version: link:../packages/react-vchart '@visactor/vchart': - specifier: workspace:2.0.19 + specifier: workspace:2.0.20 version: link:../packages/vchart '@visactor/vchart-extension': - specifier: workspace:2.0.19 + specifier: workspace:2.0.20 version: link:../packages/vchart-extension '@visactor/vchart-theme': specifier: ~1.6.6 @@ -37,11 +37,11 @@ importers: specifier: 1.2.4-alpha.5 version: 1.2.4-alpha.5 '@visactor/vrender': - specifier: ~1.0.41 - version: 1.0.41 + specifier: 1.0.44 + version: 1.0.44 '@visactor/vrender-kits': - specifier: ~1.0.41 - version: 1.0.41 + specifier: 1.0.44 + version: 1.0.44 '@visactor/vtable': specifier: 1.19.0-alpha.0 version: 1.19.0-alpha.0 @@ -55,8 +55,8 @@ importers: specifier: 1.19.0-alpha.0 version: 1.19.0-alpha.0 '@visactor/vutils': - specifier: ~1.0.22 - version: 1.0.22 + specifier: ~1.0.23 + version: 1.0.23 axios: specifier: ^1.4.0 version: 1.13.2 @@ -200,17 +200,17 @@ importers: ../../packages/openinula-vchart: dependencies: '@visactor/vchart': - specifier: workspace:2.0.19 + specifier: workspace:2.0.20 version: link:../vchart '@visactor/vrender-core': - specifier: ~1.0.41 - version: 1.0.41 + specifier: 1.0.44 + version: 1.0.44 '@visactor/vrender-kits': - specifier: ~1.0.41 - version: 1.0.41 + specifier: 1.0.44 + version: 1.0.44 '@visactor/vutils': - specifier: ~1.0.22 - version: 1.0.22 + specifier: ~1.0.23 + version: 1.0.23 react-is: specifier: ^18.2.0 version: 18.3.1 @@ -288,20 +288,20 @@ importers: ../../packages/react-vchart: dependencies: '@visactor/vchart': - specifier: workspace:2.0.19 + specifier: workspace:2.0.20 version: link:../vchart '@visactor/vchart-extension': - specifier: workspace:2.0.19 + specifier: workspace:2.0.20 version: link:../vchart-extension '@visactor/vrender-core': - specifier: ~1.0.41 - version: 1.0.41 + specifier: 1.0.44 + version: 1.0.44 '@visactor/vrender-kits': - specifier: ~1.0.41 - version: 1.0.41 + specifier: 1.0.44 + version: 1.0.44 '@visactor/vutils': - specifier: ~1.0.22 - version: 1.0.22 + specifier: ~1.0.23 + version: 1.0.23 react-is: specifier: ^18.2.0 version: 18.3.1 @@ -388,10 +388,10 @@ importers: ../../packages/taro-vchart: dependencies: '@visactor/vchart': - specifier: workspace:2.0.19 + specifier: workspace:2.0.20 version: link:../vchart '@visactor/vchart-extension': - specifier: workspace:2.0.19 + specifier: workspace:2.0.20 version: link:../vchart-extension devDependencies: '@babel/core': @@ -523,31 +523,31 @@ importers: ../../packages/vchart: dependencies: '@visactor/vdataset': - specifier: ~1.0.22 - version: 1.0.22 + specifier: ~1.0.23 + version: 1.0.23 '@visactor/vlayouts': - specifier: ~1.0.22 - version: 1.0.22 + specifier: ~1.0.23 + version: 1.0.23 '@visactor/vrender-animate': - specifier: ~1.0.41 - version: 1.0.41 + specifier: 1.0.44 + version: 1.0.44 '@visactor/vrender-components': - specifier: ~1.0.41 - version: 1.0.41 + specifier: 1.0.44 + version: 1.0.44 '@visactor/vrender-core': - specifier: ~1.0.41 - version: 1.0.41 + specifier: 1.0.44 + version: 1.0.44 '@visactor/vrender-kits': - specifier: ~1.0.41 - version: 1.0.41 + specifier: 1.0.44 + version: 1.0.44 '@visactor/vscale': - specifier: ~1.0.22 - version: 1.0.22 + specifier: ~1.0.23 + version: 1.0.23 '@visactor/vutils': - specifier: ~1.0.22 - version: 1.0.22 + specifier: ~1.0.23 + version: 1.0.23 '@visactor/vutils-extension': - specifier: workspace:2.0.19 + specifier: workspace:2.0.20 version: link:../vutils-extension devDependencies: '@esbuild-plugins/node-globals-polyfill': @@ -683,29 +683,29 @@ importers: ../../packages/vchart-extension: dependencies: '@visactor/vchart': - specifier: workspace:2.0.19 + specifier: workspace:2.0.20 version: link:../vchart '@visactor/vdataset': - specifier: ~1.0.22 - version: 1.0.22 + specifier: ~1.0.23 + version: 1.0.23 '@visactor/vlayouts': - specifier: ~1.0.22 - version: 1.0.22 + specifier: ~1.0.23 + version: 1.0.23 '@visactor/vrender-animate': - specifier: ~1.0.41 - version: 1.0.41 + specifier: 1.0.44 + version: 1.0.44 '@visactor/vrender-components': - specifier: ~1.0.41 - version: 1.0.41 + specifier: 1.0.44 + version: 1.0.44 '@visactor/vrender-core': - specifier: ~1.0.41 - version: 1.0.41 + specifier: 1.0.44 + version: 1.0.44 '@visactor/vrender-kits': - specifier: ~1.0.41 - version: 1.0.41 + specifier: 1.0.44 + version: 1.0.44 '@visactor/vutils': - specifier: ~1.0.22 - version: 1.0.22 + specifier: ~1.0.23 + version: 1.0.23 devDependencies: '@internal/bundler': specifier: workspace:* @@ -834,11 +834,11 @@ importers: ../../packages/vutils-extension: dependencies: '@visactor/vdataset': - specifier: ~1.0.22 - version: 1.0.22 + specifier: ~1.0.23 + version: 1.0.23 '@visactor/vutils': - specifier: ~1.0.22 - version: 1.0.22 + specifier: ~1.0.23 + version: 1.0.23 devDependencies: '@internal/bundler': specifier: workspace:* @@ -991,10 +991,10 @@ importers: ../../tools/bugserver-trigger: dependencies: '@visactor/vchart': - specifier: workspace:2.0.19 + specifier: workspace:2.0.20 version: link:../../packages/vchart '@visactor/vchart-extension': - specifier: workspace:2.0.19 + specifier: workspace:2.0.20 version: link:../../packages/vchart-extension devDependencies: '@internal/bundler': @@ -1257,20 +1257,20 @@ importers: ../../tools/story-player: dependencies: '@visactor/vchart': - specifier: workspace:2.0.19 + specifier: workspace:2.0.20 version: link:../../packages/vchart '@visactor/vrender': - specifier: ~1.0.41 - version: 1.0.41 + specifier: 1.0.44 + version: 1.0.44 '@visactor/vrender-core': - specifier: ~1.0.41 - version: 1.0.41 + specifier: 1.0.44 + version: 1.0.44 '@visactor/vrender-kits': - specifier: ~1.0.41 - version: 1.0.41 + specifier: 1.0.44 + version: 1.0.44 '@visactor/vutils': - specifier: ~1.0.22 - version: 1.0.22 + specifier: ~1.0.23 + version: 1.0.23 devDependencies: '@internal/bundler': specifier: workspace:* @@ -3061,11 +3061,11 @@ packages: '@visactor/vdataset@0.18.18': resolution: {integrity: sha512-lye23zpineMKV42JmuJaOY3fgl7aWhyDIwK9dWooqZzP14AFukPoK7ZvUeuKZihLrHxqtCg2VWEjovnh9O1RUg==} - '@visactor/vdataset@1.0.22': - resolution: {integrity: sha512-B+Xd7UuXNNLWRsH0ySd9LsvFFBz/S+lFN7ha7GU7SdTYr9P0ZExYyumQPntaa5iOMLxKysFxJw7t/Or70ZA6hQ==} + '@visactor/vdataset@1.0.23': + resolution: {integrity: sha512-zrLk9FBUWJoW6b30XnPKzXwAXl8USdLDfed6QZLsmdkylRU8V7yZeXE2aKwU8Lg1U4HmQngqmqOx7/QlbX44Tg==} - '@visactor/vlayouts@1.0.22': - resolution: {integrity: sha512-iTPJeROqmwBOBDoewDHYdEAe6MlDPgJ/1V1j+FcWr3zWGPDOSduoIDyjhB/FpkLaUQyhYCTCfCH3p2BDs3Wy4g==} + '@visactor/vlayouts@1.0.23': + resolution: {integrity: sha512-fK1f5LmuumhYanLArk5yrT4BZxu4IAmdc8WMwfB/KAvV+2dTPFuBUMWbWnDl0siQoU9SX9l/bLozUnI9n7BwBQ==} '@visactor/vmind@1.2.4-alpha.5': resolution: {integrity: sha512-8Z/MFLN0bMLUMofurQ4175AHA5+Yln9CwA6ub1pMzsa+xTjGKALj3D7SseHUi4LSKSB3UGFwckqhKlKynrOfsA==} @@ -3073,35 +3073,35 @@ packages: '@visactor/vrender-animate@1.0.0-alpha.18': resolution: {integrity: sha512-9kTtvp1ef+1t+AtUiza6A7qBQP7SmvOu3/ILGrqs/HGdZVj1XGjbYvD/X/zwKJ3LEb7gGV5fa8x95e4czTvRSA==} - '@visactor/vrender-animate@1.0.41': - resolution: {integrity: sha512-kdMoIh7OEo6z4rZfnJHX7d+izBhGVWq6MR22uppk0LPilfdBd/1hSNAEKO6C9JWAy5uROGFpEkh+kk+ar/zSZg==} + '@visactor/vrender-animate@1.0.44': + resolution: {integrity: sha512-MKtoaucmbQNJnuff5F6ws+c8+mRBz1gXVY/bHw38nfvSTZcsJcXYug2aDPf4V9XaUSValDnkx9TyLLbKJ0o0TA==} '@visactor/vrender-components@1.0.0-alpha.18': resolution: {integrity: sha512-7Euq+ZfswL74n2pgkaqZSsPxoSa5SPIGyXatN1eUrdzM2Z0kX6U0RcJg01fctvRs4op6WhcecRLqGvnHcBeb9Q==} - '@visactor/vrender-components@1.0.41': - resolution: {integrity: sha512-B7iXJE1TdkYapPZN6DNxoaErY4FzGf5AbcbG/z6Q0hnzO4Iw1hKdtlTGOIYA1+JXhehDWcyy+D0bnoNQNf+rgw==} + '@visactor/vrender-components@1.0.44': + resolution: {integrity: sha512-vbCa/eME1UJL2iy0l4JHYJh1m6SG3rR5jt5umblLVRQjjBEWPAnhnPwQAA2TNiyO5eHG6qnyvcjgV5aeCeuJYw==} '@visactor/vrender-core@1.0.0-alpha.18': resolution: {integrity: sha512-0ihtNvCyNkOsWPFgRqowHzq0IcQgS2Wl/nPpKbVtxWKveenwlhA+ZKoQvam6VJyBY7jeNe1pROy0mJMDyVAJQw==} - '@visactor/vrender-core@1.0.41': - resolution: {integrity: sha512-P7YVUJ45vwqPA460W6JJjg201ThvxBrjEgTBJ4tHKaHZPP/nVyF8rPyUOCL8QesEFDB+R0e/sUJUVs+ckHhd2w==} + '@visactor/vrender-core@1.0.44': + resolution: {integrity: sha512-DrB+cg9//RkCZjchWConeXGOC99xwvEDdPfY7eEqajjPxUooJpSQ+pt51uD0VIwQCYtpsc2jVspefqdBh/e2Cg==} '@visactor/vrender-kits@1.0.0-alpha.18': resolution: {integrity: sha512-Tvolkq+4G8qiPFZo0Aj8M//Yr6jR2h8FNkFEyWM9gbQbEiTkjpmHAJOYnoSsaPtPrcMSlG4EhJSFDk6ymANHVg==} - '@visactor/vrender-kits@1.0.41': - resolution: {integrity: sha512-ffJlKkNseOsnRjvBmxKxQ9dsQXu+K288NFCtB0ZZ2N/mtcTsZUlH5SDCcsAvDhPGEvJ22Ye4MFKcXSEDctpGzA==} + '@visactor/vrender-kits@1.0.44': + resolution: {integrity: sha512-B28zr+aTWlFIziH3b/ufUlpKQMv1Ie9ck8kTkHIGdBM/ES+CO6//GHMa/5OxuId19a9UhJxzj8cpeE/9mZLIoQ==} - '@visactor/vrender@1.0.41': - resolution: {integrity: sha512-FUpN89qavMUZBVobiF9OmvGgJv3t8mBy2FZyTaybgTl2msqjQzVF2CnlxjKzvv3daLusniok3T+bdo0AoQGzLw==} + '@visactor/vrender@1.0.44': + resolution: {integrity: sha512-ozYCl57YxY5MVGFS3Pmwu2Q4+h3y6z1tLVu6fVaan6YDZEc1eFIhvVjskGBRd3lFdbTLdL8xRJh+LdMMoIRodQ==} '@visactor/vscale@0.18.18': resolution: {integrity: sha512-iRG4kv+5Fv4KX3AxEfV95XU3I6OmF0QizyAhqHxKa7L1MaT+MRvDDk5zHWf1E8gialLbL2xDe3GnT6g/4u5jhA==} - '@visactor/vscale@1.0.22': - resolution: {integrity: sha512-DCCqBA9gBZexCsfYmUjRZM1OBp2Qr8dRIGOqWcFerINIDtpQatSS4c8Ah2r8pqkgiizSNeKgDoXOtsiPe9zqBQ==} + '@visactor/vscale@1.0.23': + resolution: {integrity: sha512-XePhYuRoNAp+8MeSMuEOOvhVAlOwvM1sDT2yFxE6zdwVB2GjZk8mH+5N2xQGQWk75YmGJjlJASFtgwjlb1yWxw==} '@visactor/vscale@1.0.4': resolution: {integrity: sha512-mXuX0gbQ5dmsU+dOfrDfFT45ijTZrFh1wYeIY44cdMhFo4v+tVdeihN0F+3CEI7oSZiZENbpJ7dXvxnu04xG/g==} @@ -3130,8 +3130,8 @@ packages: '@visactor/vutils@0.19.7': resolution: {integrity: sha512-1SSnkZgX1p/rSVIFEibrpN6rDdLfdETSI6lJI5JwV8I2paluM1mqz3jEeT3McmWygd/wyUVKAyoRxGXFKAsKEw==} - '@visactor/vutils@1.0.22': - resolution: {integrity: sha512-n+lKEeSQl1wGqRG829oQ4SwU6UysUiP9rpp0K87TwmERVMupSy6C0KcM2SGXGBLvnp1Cyjjciw5ZtYQXv3ZfKQ==} + '@visactor/vutils@1.0.23': + resolution: {integrity: sha512-M8SLqgdHhKN8QmQKTWD1gzEaHptpIV9pvMYvC6+VeOsqYvZZ6UdhSCAAczTYVo+m/uwcEC2JHSUspbrs8rzlRQ==} '@visactor/vutils@1.0.4': resolution: {integrity: sha512-GE149SM5WAc9DMNV7bGtPD4xHP68vbHMRuxGPJ3ndzAGLC/KuXpClteMw6bTY1fRX1vDLY/tQ/GVthgeOx4kDw==} @@ -14977,12 +14977,12 @@ snapshots: simplify-geojson: 1.0.5 topojson-client: 3.1.0 - '@visactor/vdataset@1.0.22': + '@visactor/vdataset@1.0.23': dependencies: '@turf/flatten': 6.5.0 '@turf/helpers': 6.5.0 '@turf/rewind': 6.5.0 - '@visactor/vutils': 1.0.22 + '@visactor/vutils': 1.0.23 d3-dsv: 2.0.0 d3-geo: 1.12.1 d3-hexbin: 0.2.2 @@ -14997,12 +14997,12 @@ snapshots: simplify-geojson: 1.0.5 topojson-client: 3.1.0 - '@visactor/vlayouts@1.0.22': + '@visactor/vlayouts@1.0.23': dependencies: '@turf/helpers': 6.5.0 '@turf/invariant': 6.5.0 - '@visactor/vscale': 1.0.22 - '@visactor/vutils': 1.0.22 + '@visactor/vscale': 1.0.23 + '@visactor/vutils': 1.0.23 eventemitter3: 4.0.7 '@visactor/vmind@1.2.4-alpha.5': @@ -15026,10 +15026,10 @@ snapshots: '@visactor/vrender-core': 1.0.0-alpha.18 '@visactor/vutils': 1.0.4 - '@visactor/vrender-animate@1.0.41': + '@visactor/vrender-animate@1.0.44': dependencies: - '@visactor/vrender-core': 1.0.41 - '@visactor/vutils': 1.0.22 + '@visactor/vrender-core': 1.0.44 + '@visactor/vutils': 1.0.23 '@visactor/vrender-components@1.0.0-alpha.18': dependencies: @@ -15039,22 +15039,22 @@ snapshots: '@visactor/vscale': 1.0.4 '@visactor/vutils': 1.0.4 - '@visactor/vrender-components@1.0.41': + '@visactor/vrender-components@1.0.44': dependencies: - '@visactor/vrender-animate': 1.0.41 - '@visactor/vrender-core': 1.0.41 - '@visactor/vrender-kits': 1.0.41 - '@visactor/vscale': 1.0.22 - '@visactor/vutils': 1.0.22 + '@visactor/vrender-animate': 1.0.44 + '@visactor/vrender-core': 1.0.44 + '@visactor/vrender-kits': 1.0.44 + '@visactor/vscale': 1.0.23 + '@visactor/vutils': 1.0.23 '@visactor/vrender-core@1.0.0-alpha.18': dependencies: '@visactor/vutils': 1.0.4 color-convert: 2.0.1 - '@visactor/vrender-core@1.0.41': + '@visactor/vrender-core@1.0.44': dependencies: - '@visactor/vutils': 1.0.22 + '@visactor/vutils': 1.0.23 color-convert: 2.0.1 '@visactor/vrender-kits@1.0.0-alpha.18': @@ -15066,29 +15066,29 @@ snapshots: lottie-web: 5.13.0 roughjs: 4.5.2 - '@visactor/vrender-kits@1.0.41': + '@visactor/vrender-kits@1.0.44': dependencies: '@resvg/resvg-js': 2.4.1 - '@visactor/vrender-core': 1.0.41 - '@visactor/vutils': 1.0.22 + '@visactor/vrender-core': 1.0.44 + '@visactor/vutils': 1.0.23 gifuct-js: 2.1.2 lottie-web: 5.13.0 roughjs: 4.6.6 - '@visactor/vrender@1.0.41': + '@visactor/vrender@1.0.44': dependencies: - '@visactor/vrender-animate': 1.0.41 - '@visactor/vrender-components': 1.0.41 - '@visactor/vrender-core': 1.0.41 - '@visactor/vrender-kits': 1.0.41 + '@visactor/vrender-animate': 1.0.44 + '@visactor/vrender-components': 1.0.44 + '@visactor/vrender-core': 1.0.44 + '@visactor/vrender-kits': 1.0.44 '@visactor/vscale@0.18.18': dependencies: '@visactor/vutils': 0.18.18 - '@visactor/vscale@1.0.22': + '@visactor/vscale@1.0.23': dependencies: - '@visactor/vutils': 1.0.22 + '@visactor/vutils': 1.0.23 '@visactor/vscale@1.0.4': dependencies: @@ -15149,7 +15149,7 @@ snapshots: '@turf/invariant': 6.5.0 eventemitter3: 4.0.7 - '@visactor/vutils@1.0.22': + '@visactor/vutils@1.0.23': dependencies: '@turf/helpers': 6.5.0 '@turf/invariant': 6.5.0 diff --git a/common/config/rush/version-policies.json b/common/config/rush/version-policies.json index 9153cdef26..a1e6d27bba 100644 --- a/common/config/rush/version-policies.json +++ b/common/config/rush/version-policies.json @@ -2,7 +2,7 @@ { "definitionName": "lockStepVersion", "policyName": "vchartMain", - "version": "2.0.18", + "version": "2.0.19", "mainProject": "@visactor/vchart", "nextBump": "patch" } diff --git a/docs/assets/changelog/en/release.md b/docs/assets/changelog/en/release.md index 963ad61da9..3492ad84c7 100644 --- a/docs/assets/changelog/en/release.md +++ b/docs/assets/changelog/en/release.md @@ -1,3 +1,24 @@ +# v2.0.20 + +2026-03-26 + +**🐛 Bug Fixes** + +- **@visactor/vchart**: fix theme config of spec and option +- **@visactor/vchart**: datazoom update domain after data change. fix#4186 + +**🔨 Chores** + +- **@visactor/vchart**: update changes for 008-fix-size-legend-handler-text: Allow size legend handlerText.style to accept function-based values in the same way other legend style hooks already do, and add regression coverage proving the style callback is preserved through continuous legend attribute transformation. +- **@visactor/vchart**: update changes for 009-fix-heatmap-scrollbar-axis-direction: Align ScrollBar with DataZoom by using the shared reverse-axis detection when converting scrollbar state percentages back into domain values. +- **@visactor/vchart**: update changes for 009-fix-issue-of-mark-state-when-updateSpec: Fix an issue where mark states were not properly cleared when updateSpec was called, causing incorrect state persistence. +- **@visactor/vchart**: update changes for 010-hide-empty-axes: Add an opt-in hideWhenEmpty axis option for cartesian axes. +- **@visactor/vchart**: update changes for 009-fix-issue-of-mark-state-when-updateSpec: Fix an issue where mark states were not properly cleared when updateSpec was called, causing incorrect state persistence. +- **@visactor/vchart**: upgrade vutils, vdataset, vscale, vlayouts to ~1.0.23 + +**Full Changelog**: https://github.com/VisActor/VChart/compare/v2.0.19...v2.0.20 + +[more detail about v2.0.20](https://github.com/VisActor/VChart/releases/tag/v2.0.20) # v2.0.19 2026-03-06 diff --git a/docs/assets/changelog/en/release.md.bak b/docs/assets/changelog/en/release.md.bak index eee3d31570..963ad61da9 100644 --- a/docs/assets/changelog/en/release.md.bak +++ b/docs/assets/changelog/en/release.md.bak @@ -1,3 +1,14 @@ +# v2.0.19 + +2026-03-06 + +**🔨 Chores** + +- **@visactor/vchart**: remove unused GitHub Actions workflows + +**Full Changelog**: https://github.com/VisActor/VChart/compare/v2.0.18...v2.0.19 + +[more detail about v2.0.19](https://github.com/VisActor/VChart/releases/tag/v2.0.19) # v2.0.18 2026-03-05 diff --git a/docs/assets/changelog/zh/release.md b/docs/assets/changelog/zh/release.md index c0ccce6e13..51d41cb7a0 100644 --- a/docs/assets/changelog/zh/release.md +++ b/docs/assets/changelog/zh/release.md @@ -1,3 +1,24 @@ +# v2.0.20 + +2026-03-26 + +**🐛 问题修复** + +- **@visactor/vchart**: 修复 theme config of spec and option +- **@visactor/vchart**: datazoom update domain after data change. fix#4186 + +**🔨 维护与杂项** + +- **@visactor/vchart**: 更新 changes for 008-fix-size-图例-handler-text: Allow size 图例 handlerText.style accept function-based values in the same way other 图例 style hooks already do, and add regression coverage proving the style callback is preserved through continuous 图例 attribute transformation. +- **@visactor/vchart**: 更新 changes for 009-fix-heatmap-scrollbar-axis-direction: Align ScrollBar with DataZoom by using the shared reverse-axis detection when converting scrollbar state percentages back into domain values. +- **@visactor/vchart**: 更新 changes for 009-fix-问题-of-mark-state-when-updateSpec: Fix an 问题 where mark states were not properly cleared when updateSpec was called, causing incorrect state persistence. +- **@visactor/vchart**: 更新 changes for 010-hide-empty-axes: Add an opt-in hideWhenEmpty axis option for cartesian axes. +- **@visactor/vchart**: 更新 changes for 009-fix-问题-of-mark-state-when-updateSpec: Fix an 问题 where mark states were not properly cleared when updateSpec was called, causing incorrect state persistence. +- **@visactor/vchart**: 升级 vutils, vdataset, vscale, vlayouts ~1.0.23 + +**Full Changelog**: https://github.com/VisActor/VChart/compare/v2.0.19...v2.0.20 + +[更多详情请查看 v2.0.20](https://github.com/VisActor/VChart/releases/tag/v2.0.20) # v2.0.19 2026-03-06 diff --git a/docs/assets/changelog/zh/release.md.bak b/docs/assets/changelog/zh/release.md.bak index d422a79c73..c0ccce6e13 100644 --- a/docs/assets/changelog/zh/release.md.bak +++ b/docs/assets/changelog/zh/release.md.bak @@ -1,3 +1,14 @@ +# v2.0.19 + +2026-03-06 + +**🔨 维护与杂项** + +- **@visactor/vchart**: remove unused GitHub Actions workflows + +**Full Changelog**: https://github.com/VisActor/VChart/compare/v2.0.18...v2.0.19 + +[更多详情请查看 v2.0.19](https://github.com/VisActor/VChart/releases/tag/v2.0.19) # v2.0.18 2026-03-05 diff --git a/docs/assets/contributing/en/sourcecode/10.1-animation-concepts-and-types.md b/docs/assets/contributing/en/sourcecode/10.1-animation-concepts-and-types.md index e3486a4cb0..4403cae682 100644 --- a/docs/assets/contributing/en/sourcecode/10.1-animation-concepts-and-types.md +++ b/docs/assets/contributing/en/sourcecode/10.1-animation-concepts-and-types.md @@ -1,233 +1,223 @@ --- -title: 10.1 Concepts and Types of Animation +title: 10.1 Concepts and Types of Animation key words: VisActor,VChart,VTable,VStrory,VMind,VGrammar,VRender,Visualization,Chart,Data,Table,Graph,Gis,LLM --- -> 10.1 Concepts and Types of Animation -> Score: 4 -> 1. Concepts and Types of Animation: -> 1. Other Reference Documents: -> https://www.visactor.io/vchart/guide/tutorial_docs/Animation/Animation_Types -> -> [Magic Frame (Part 2): VChart Animation Programming Practice In this article, we will start with some common chart animations and introduce in detail the compilation in VChart - Juejin](https://juejin.cn/post/7314829865633595443) -1. Code Entry: `packages/vchart/src/animation/` +> 10.1 Concepts and Types of Animation +> Score: 4 +> +> 1. Concepts and Types of Animation: +> 1. Other Reference Documents: +> https://www.visactor.io/vchart/guide/tutorial_docs/Animation/Animation_Types +> +> [Magic Frame (Part 2): VChart Animation Programming Practice In this article, we will start with some common chart animations and introduce in detail the compilation in VChart - Juejin](https://juejin.cn/post/7314829865633595443) -`packages/vchart/src/series/line/animation` +1. Code Entry: `packages/vchart/src/animation/` -`packages/vchart/src/core/vchart` +`packages/vchart/src/series/line/animation` -`packages/vchart/src/core/interface` +`packages/vchart/src/core/vchart` -`packages/vchart/src/complie/mark` +`packages/vchart/src/core/interface` -1. Key Points Interpretation: +`packages/vchart/src/complie/mark` -1. Animation Classification (by execution timing, by effect) +1. Key Points Interpretation: -1. Overall Design of the Animation System +1. Animation Classification (by execution timing, by effect) + +1. Overall Design of the Animation System # Concept of Animation +In VChart, animation refers to enhancing the dynamism and interactivity of data presentation through visual effects during the chart rendering process. The animation system allows developers to configure and control the transition effects of chart elements (such as bar charts, pie charts, line charts, etc.) in different states. + +In VisActor, animation is regarded as an embellishment of the rendering stage: animation configuration, together with the visual channels of the graphic elements obtained from the execution of the graphic grammar process, determines the result of the rendering stage. The performance of animation is the interpolation calculation or special calculation logic of the visual channel attributes of specific graphic elements within a certain time period, and the animation configuration describes the trigger timing and execution duration of this calculation. + + + +## Types of Animation + +#### Lifecycle Demonstration + +![](https://cdn.jsdelivr.net/gh/xuanhun/articles/visactor/sourcecode/img/OgJ0wqt4khXJtrbwW3Zc2521nOc.gif) + +### Classified by Execution Timing + +Chart animations in VChart are categorized based on state scenarios (execution timing) into: **Chart Entrance Animation**, **Data Update Animation**, and **Chart Exit Animation**. + +1. **Chart Entrance Animation:** Refers to the animation effect when the chart is created. + +1. **Data Update Animation:** When we update the chart data, the attribute animation of the graphic elements is called data update animation. It is divided into: **New Element Animation**, **Element Update Animation**, and **Exit Element Animation, State Change Animation, Animation Triggered at Any Time**. Usually, you don't need to worry about how to control these three update animations, as VChart will identify the association between the new data and the previous data during data updates, thus correctly executing the update animation. + +1. **Chart Exit Animation:** In some scenarios, we may need to remove the chart. At this time, we can set an exit animation for the chart to provide a smooth transition animation effect before removal. +![](https://cdn.jsdelivr.net/gh/xuanhun/articles/visactor/sourcecode/img/Ddzewl0jjhq1ksbmUlbc2WPSnig.gif) + +https://visactor.io/vchart/guide/tutorial_docs/Animation/Animation_Types Animation tutorial documentation + +https://www.visactor.io/vchart/option/barChart#animationState Animation configuration documentation + +#### Chart **Entrance Animation (**`**animationAppear**`**)**: + +- The transition effect of elements from nothing to something when the chart is first rendered. + +- Example code: The `animationAppear` configuration item is used to define the chart entrance animation. + + -In VChart, animation refers to enhancing the dynamism and interactivity of data presentation through visual effects during the chart rendering process. The animation system allows developers to configure and control the transition effects of chart elements (such as bar charts, pie charts, line charts, etc.) in different states. - -In VisActor, animation is regarded as an embellishment of the rendering stage: animation configuration, together with the visual channels of the graphic elements obtained from the execution of the graphic grammar process, determines the result of the rendering stage. The performance of animation is the interpolation calculation or special calculation logic of the visual channel attributes of specific graphic elements within a certain time period, and the animation configuration describes the trigger timing and execution duration of this calculation. - - - -## Types of Animation - -#### Lifecycle Demonstration - - -![](https://cdn.jsdelivr.net/gh/xuanhun/articles/visactor/sourcecode/img/OgJ0wqt4khXJtrbwW3Zc2521nOc.gif) - - - -### Classified by Execution Timing - -Chart animations in VChart are categorized based on state scenarios (execution timing) into: **Chart Entrance Animation**, **Data Update Animation**, and **Chart Exit Animation**. - -1. **Chart Entrance Animation:** Refers to the animation effect when the chart is created. - -1. **Data Update Animation:** When we update the chart data, the attribute animation of the graphic elements is called data update animation. It is divided into: **New Element Animation**, **Element Update Animation**, and **Exit Element Animation, State Change Animation, Animation Triggered at Any Time**. Usually, you don't need to worry about how to control these three update animations, as VChart will identify the association between the new data and the previous data during data updates, thus correctly executing the update animation. - -1. **Chart Exit Animation:** In some scenarios, we may need to remove the chart. At this time, we can set an exit animation for the chart to provide a smooth transition animation effect before removal. - -![](https://cdn.jsdelivr.net/gh/xuanhun/articles/visactor/sourcecode/img/Ddzewl0jjhq1ksbmUlbc2WPSnig.gif) - -https://visactor.io/vchart/guide/tutorial_docs/Animation/Animation_Types Animation tutorial documentation - -https://www.visactor.io/vchart/option/barChart#animationState Animation configuration documentation - -#### Chart **Entrance Animation (**`**animationAppear**`**)**: - -* The transition effect of elements from nothing to something when the chart is first rendered. - -* Example code: The `animationAppear` configuration item is used to define the chart entrance animation. - - - ```html - -
- - - -``` + +
+ + +``` + ```xml -animationAppear?: boolean | IStateAnimateSpec | IMarkAnimateSpec; - -``` -#### Data Update Animation - -When we update chart data, the attribute animation of the graphic elements is called update animation. In VChart, manually calling the `updateData` interface will trigger a chart data update. Additionally, clicking the legend also updates the chart data. Update animations are divided into three categories: new graphic element animation, graphic element update animation, and exit graphic element animation. - -1. **New Graphic Element Animation (**`**animationEnter**`**): - -* New graphic element animation refers to the animation effect of newly added data's graphic elements when the chart data is updated. - -* We can use the `animationEnter` configuration to set the new graphic element animation. - +animationAppear?: boolean | IStateAnimateSpec | IMarkAnimateSpec; + +``` + +#### Data Update Animation + +When we update chart data, the attribute animation of the graphic elements is called update animation. In VChart, manually calling the `updateData` interface will trigger a chart data update. Additionally, clicking the legend also updates the chart data. Update animations are divided into three categories: new graphic element animation, graphic element update animation, and exit graphic element animation. + +1. **New Graphic Element Animation (**`**animationEnter**`\*\*): + +- New graphic element animation refers to the animation effect of newly added data's graphic elements when the chart data is updated. + +- We can use the `animationEnter` configuration to set the new graphic element animation. + ```xml -animationEnter?: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec; - -``` - - -1. **Primitive Update Animation ( **`**animationUpdate**`**)**: - -* Primitive update animation refers to the update animation effect of the primitives corresponding to the original data when the chart data is updated. - -* We can use the `animationUpdate` configuration to set the primitive update animation. - +animationEnter?: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec; + +``` + +1. **Primitive Update Animation ( **`**animationUpdate**`**)**: + +- Primitive update animation refers to the update animation effect of the primitives corresponding to the original data when the chart data is updated. + +- We can use the `animationUpdate` configuration to set the primitive update animation. + ```xml -animationUpdate?: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec; - -``` - - -1. **Exit Element Animation (**`**animationExit**`** )**: - -* Exit element animation refers to the animation effect of elements corresponding to deleted data when the chart data is updated. We can use the `animationExit` configuration to set the exit element animation. - +animationUpdate?: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec; + +``` + +1. **Exit Element Animation (**`**animationExit**`** )**: + +- Exit element animation refers to the animation effect of elements corresponding to deleted data when the chart data is updated. We can use the `animationExit` configuration to set the exit element animation. + ```xml -animationExit?: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec; - -``` - - -1. Primitive **State Transition Animation (State)**: - -* The transition effect when the chart state changes. - -* Example code: The `animationState` configuration item is used to define state transition animations. - +animationExit?: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec; + +``` + +1. Primitive **State Transition Animation (State)**: + +- The transition effect when the chart state changes. + +- Example code: The `animationState` configuration item is used to define state transition animations. + ```xml -animationState?: boolean | IStateAnimationConfig; - -``` - - -1. Normal **Animation (Normal)**: Commonly used for loops - -* Used to define continuous animation effects. - -* Example code: `animationNormal` configuration item is used to define loop animation. - +animationState?: boolean | IStateAnimationConfig; + +``` + +1. Normal **Animation (Normal)**: Commonly used for loops + +- Used to define continuous animation effects. + +- Example code: `animationNormal` configuration item is used to define loop animation. + ```xml -animationNormal?: IMarkAnimateSpec; +animationNormal?: IMarkAnimateSpec; + +``` + +#### Chart **Exit Animation (**`**animationDisappear**`**)**: -``` - - -#### Chart **Exit Animation (**`**animationDisappear**`**)**: - -* The exit effect of elements when the chart is destroyed or hidden. - +- The exit effect of elements when the chart is destroyed or hidden. ```xml - animationDisappear?: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec; - -``` -### Classified by Effect - -Type Primitive Atomization - -* Animation Effects: Animation effects describe how primitives execute rendering changes at a specific stage of animation. Animation effects include ordinary visual channel interpolation, such as changes in the color, width, and position of bars in a racing bar chart; animation effects also include some special changes, such as the deformation of primitives in the figure below. - -1. **FadeIn/FadeOut**: - -* The change in element opacity from 0 to 1 or from 1 to 0. - -* Example code: `Appear_FadeIn` and `Disappear_FadeOut`. - + animationDisappear?: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec; + +``` + +### Classified by Effect + +Type Primitive Atomization + +- Animation Effects: Animation effects describe how primitives execute rendering changes at a specific stage of animation. Animation effects include ordinary visual channel interpolation, such as changes in the color, width, and position of bars in a racing bar chart; animation effects also include some special changes, such as the deformation of primitives in the figure below. + +1. **FadeIn/FadeOut**: + +- The change in element opacity from 0 to 1 or from 1 to 0. + +- Example code: `Appear_FadeIn` and `Disappear_FadeOut`. + ```xml const Appear_FadeIn: IAnimationTypeConfig = { type: 'fadeIn' -}; - -``` - - -1. **Grow**: - -* The element gradually grows from an initial size to a final size. - -* Example code: `barGrowOption` and `pieGrowOption`. - +}; + +``` + +1. **Grow**: + +- The element gradually grows from an initial size to a final size. + +- Example code: `barGrowOption` and `pieGrowOption`. + ```xml -function barGrowOption(barParams: IBarAnimationParams, isOverall = true) {/***/} +function barGrowOption(barParams: IBarAnimationParams, isOverall = true) {/***/} + +``` -``` - - -1. **Clip**: - -* Display the gradual appearance or disappearance of elements by clipping the area. - -* Example code: `registerCartesianGroupClipAnimation`. +1. **Clip**: + +- Display the gradual appearance or disappearance of elements by clipping the area. + +- Example code: `registerCartesianGroupClipAnimation`. ```xml const registerCartesianGroupClipAnimation = () => { Factory.registerAnimation('cartesianGroupClip', (params?: ICartesianGroupAnimationParams) => {/***/}); -}; +}; + +``` + +1. **Wave**: + +- Special effects, such as wave effects in liquid graphics. -``` - - -1. **Wave**: - -* Special effects, such as wave effects in liquid graphics. - -* Example code: `Appear_Wave`. +- Example code: `Appear_Wave`. ```xml const Appear_Wave: IAnimationTypeConfig = { @@ -236,80 +226,74 @@ const Appear_Wave: IAnimationTypeConfig = { channel: { wave: { from: 0, to: 1 } } -}; - -``` - - -1. **Scale**: - -* The size of the element scales from one ratio to another. - -* Example code: `Appear_ScaleIn`. - +}; + +``` + +1. **Scale**: + +- The size of the element scales from one ratio to another. + +- Example code: `Appear_ScaleIn`. + ```xml const Appear_ScaleIn: IAnimationTypeConfig = { type: 'growCenterIn' -}; - -``` -More animation effects attributes and configurations can be found at https://visactor.com/vchart/guide/tutorial_docs/Animation/Animation_Attributes_and_Settings - -## Design of the Animation System - -### Simple Bar Chart Animation Configuration - - - -Below is an example of creating a simple bar chart to illustrate how to use VChart's animation system to achieve basic animation effects. - - - - - - +}; + +``` + +More animation effects attributes and configurations can be found at https://visactor.com/vchart/guide/tutorial_docs/Animation/Animation_Attributes_and_Settings + +## Design of the Animation System + +### Simple Bar Chart Animation Configuration + +Below is an example of creating a simple bar chart to illustrate how to use VChart's animation system to achieve basic animation effects. + + + ```html - - -
- - - -``` + + +
+ + +``` + > How to create a basic VChart can be referred to in the following documents > https://www.visactor.io/vchart/guide/tutorial_docs/Getting_Started Quick Start > https://www.visactor.io/vchart/guide/tutorial_docs/Basic/How_to_Import_VChart Import VChart > https://www.visactor.io/vchart/guide/tutorial_docs/Basic/A_Basic_Spec Basic Configuration -> https://www.visactor.io/vchart/guide/tutorial_docs/Basic/DeepSeek_With_Cursor DeepSeek+Cursor Assistance - +> https://www.visactor.io/vchart/guide/tutorial_docs/VChart_Skill_Usage VChart Skill Usage In the `VChart` class, the `animation` configuration item in `spec` (chart configuration) is used to control the animation behavior of the chart. Specifically, the `animation` configuration item can define the animation effects of the chart in different states, such as entrance animation, update animation, exit animation, etc. @@ -317,50 +301,50 @@ In the `VChart` class, the `animation` configuration item in `spec` (chart confi 1. **Define animation behavior**: -* The `animation` configuration item can contain multiple sub-properties, such as `appear`, `enter`, `update`, `exit`, and `disappear`, corresponding to different animation scenarios. +- The `animation` configuration item can contain multiple sub-properties, such as `appear`, `enter`, `update`, `exit`, and `disappear`, corresponding to different animation scenarios. -* Each sub-property can further configure parameters such as animation duration (`duration`), easing function (`easing`), whether to execute one by one (`oneByOne`), etc. +- Each sub-property can further configure parameters such as animation duration (`duration`), easing function (`easing`), whether to execute one by one (`oneByOne`), etc. 1. **Control animation switch**: -* If `animation` is set to `false`, all animation effects are disabled. +- If `animation` is set to `false`, all animation effects are disabled. -* If set to `true` or a specific configuration object is provided, the corresponding animation effects are enabled. +- If set to `true` or a specific configuration object is provided, the corresponding animation effects are enabled. 1. **Pass to underlying components**: -* The `VChart` class will pass the `animation` configuration to the internal `Compiler` and `Chart` instances, which will decide whether and how to apply animations based on the configuration. +- The `VChart` class will pass the `animation` configuration to the internal `Compiler` and `Chart` instances, which will decide whether and how to apply animations based on the configuration. ### Example explanation of bar chart animation execution - - -
#### Example Code + + +
#### Example Code ```xml import { isMobile } from 'react-device-detect'; import { default as VChart } from '../../../../src/index'; // 1. 创建图表配置项与数据 const initialSpec = { - type: 'bar', - data: [ - { - id: 'barData', - values: [ - { month: 'January', sales: 22 }, - { month: 'February', sales: 13 }, - { month: 'March', sales: 25 }, - { month: 'April', sales: 29 }, - { month: 'May', sales: 38 } - ] - } - ], - xField: 'month', - yField: 'sales', - crosshair: { - xField: { visible: true } - }, - animation: true // 开启动画 +type: 'bar', +data: [ +{ +id: 'barData', +values: [ +{ month: 'January', sales: 22 }, +{ month: 'February', sales: 13 }, +{ month: 'March', sales: 25 }, +{ month: 'April', sales: 29 }, +{ month: 'May', sales: 38 } +] +} +], +xField: 'month', +yField: 'sales', +crosshair: { +xField: { visible: true } +}, +animation: true // 开启动画 }; // 2. 创建 VChart 实例 @@ -368,146 +352,147 @@ const vchart = new VChart(initialSpec, { dom: 'chart' }); // 3. 渲染图表 vchart.renderAsync().then(() => { - console.log('图表渲染完成'); +console.log('图表渲染完成'); }); // 4. 动画入场 setTimeout(() => { - console.log('动画入场'); +console.log('动画入场'); }, 1000); // 5. 数据更新(新增图元) setTimeout(() => { - const newData = [ - { month: 'June', sales: 45 }, - { month: 'July', sales: 50 } - ]; - vchart.updateDataSync('barData', newData, undefined, { reAnimate: true }); - console.log('新增图元'); +const newData = [ +{ month: 'June', sales: 45 }, +{ month: 'July', sales: 50 } +]; +vchart.updateDataSync('barData', newData, undefined, { reAnimate: true }); +console.log('新增图元'); }, 3000); // 6. 数据更新(图元更新) setTimeout(() => { - const updatedData = [ - { month: 'January', sales: 30 }, - { month: 'February', sales: 20 }, - { month: 'March', sales: 35 }, - { month: 'April', sales: 39 }, - { month: 'May', sales: 48 }, - { month: 'June', sales: 55 }, - { month: 'July', sales: 60 } - ]; - vchart.updateDataSync('barData', updatedData, undefined, { reAnimate: true }); - console.log('图元更新'); +const updatedData = [ +{ month: 'January', sales: 30 }, +{ month: 'February', sales: 20 }, +{ month: 'March', sales: 35 }, +{ month: 'April', sales: 39 }, +{ month: 'May', sales: 48 }, +{ month: 'June', sales: 55 }, +{ month: 'July', sales: 60 } +]; +vchart.updateDataSync('barData', updatedData, undefined, { reAnimate: true }); +console.log('图元更新'); }, 6000); // 7. 数据更新(图元退出) setTimeout(() => { - const remainingData = [ - { month: 'January', sales: 30 }, - { month: 'February', sales: 20 }, - { month: 'March', sales: 35 }, - { month: 'April', sales: 39 }, - { month: 'May', sales: 48 } - ]; - vchart.updateDataSync('barData', remainingData, undefined, { reAnimate: true }); - console.log('图元退出'); +const remainingData = [ +{ month: 'January', sales: 30 }, +{ month: 'February', sales: 20 }, +{ month: 'March', sales: 35 }, +{ month: 'April', sales: 39 }, +{ month: 'May', sales: 48 } +]; +vchart.updateDataSync('barData', remainingData, undefined, { reAnimate: true }); +console.log('图元退出'); }, 9000); // 8. 图元状态(state)的使用 setTimeout(() => { - vchart.updateState( - { - selected: { - style: { - fill: 'red' - } - } - }, - (series, mark, stateKey) => { - return mark.datum.sales > 40; - } - ); - console.log('图元状态更新'); +vchart.updateState( +{ +selected: { +style: { +fill: 'red' +} +} +}, +(series, mark, stateKey) => { +return mark.datum.sales > 40; +} +); +console.log('图元状态更新'); }, 12000); // 9. 图表退场 setTimeout(() => { - vchart.release(); - console.log('图表退场'); -}, 15000); - -```
#### 创建逻辑说明 -1. **Create Chart Configuration and Data**: -1. **Create VChart Instance**: -1. **Render Chart**: -1. **Animation Entrance**: -1. **Data Update (Add Elements)**: -1. **Data Update (Update Elements)**: -1. **Data Update (Remove Elements)**: -1. **Use of Element State**: -1. **Chart Exit**: - -
-* Defined an initial chart configuration `initialSpec`, which includes chart type, data, axis fields, and animation configuration. - -* The data section includes a dataset `barData`, initially containing sales data for 5 months. - -* Create a VChart instance using `initialSpec` and the DOM container `chart`. - -* Call the `renderAsync` method to asynchronously render the chart. Once the chart is rendered, the animation entrance effect is triggered. - -* After rendering, simulate the animation entrance using `setTimeout`. The actual animation effect is handled internally by VChart. - -* After 3 seconds, add two months of sales data using the `updateDataSync` method. The `reAnimate: true` parameter ensures an animation effect when adding data. - -* After 6 seconds, update all elements' data using the `updateDataSync` method. The `reAnimate: true` parameter ensures an animation effect when updating data. - -* After 9 seconds, remove two months of sales data using the `updateDataSync` method. The `reAnimate: true` parameter ensures an animation effect when removing data. - -* After 12 seconds, update the state of elements using the `updateState` method. Here, a `selected` state is set, changing the fill color of elements to red when their `sales` value is greater than 40. - -* After 15 seconds, destroy the chart instance using the `release` method, exiting the chart. - ---- - - -
#### Animation Flowchart -
#### Process Description -1. **Create Chart Configuration and Data**: Define initial chart configuration and data. -1. **Create VChart Instance**: Create a VChart instance using the configuration and DOM container. -1. **Render Chart**: Call the `renderAsync` method to render the chart, triggering the animation entrance effect. -1. **Animation Entrance**: Automatically trigger entrance animation after the chart is rendered. -1. **Data Update (Add Elements)**: Add data using the `updateDataSync` method, triggering add animation. -1. **Data Update (Update Elements)**: Update data using the `updateDataSync` method, triggering update animation. -1. **Data Update (Remove Elements)**: Remove data using the `updateDataSync` method, triggering exit animation. -1. **Use of Element State**: Update element state using the `updateState` method, setting styles under specific conditions. -1. **Chart Exit**: Destroy the chart instance using the `release` method, exiting the chart. - -
-### Source Code Implementation Process - -1. **Initialize VChart Instance** - -When you create a `VChart` instance and pass in `spec`, the constructor handles the `animation` configuration: - -File: `vchart.ts` Method: `constructor` - +vchart.release(); +console.log('图表退场'); +}, 15000); + +````
#### 创建逻辑说明 +1. **Create Chart Configuration and Data**: +1. **Create VChart Instance**: +1. **Render Chart**: +1. **Animation Entrance**: +1. **Data Update (Add Elements)**: +1. **Data Update (Update Elements)**: +1. **Data Update (Remove Elements)**: +1. **Use of Element State**: +1. **Chart Exit**: + +
+* Defined an initial chart configuration `initialSpec`, which includes chart type, data, axis fields, and animation configuration. + +* The data section includes a dataset `barData`, initially containing sales data for 5 months. + +* Create a VChart instance using `initialSpec` and the DOM container `chart`. + +* Call the `renderAsync` method to asynchronously render the chart. Once the chart is rendered, the animation entrance effect is triggered. + +* After rendering, simulate the animation entrance using `setTimeout`. The actual animation effect is handled internally by VChart. + +* After 3 seconds, add two months of sales data using the `updateDataSync` method. The `reAnimate: true` parameter ensures an animation effect when adding data. + +* After 6 seconds, update all elements' data using the `updateDataSync` method. The `reAnimate: true` parameter ensures an animation effect when updating data. + +* After 9 seconds, remove two months of sales data using the `updateDataSync` method. The `reAnimate: true` parameter ensures an animation effect when removing data. + +* After 12 seconds, update the state of elements using the `updateState` method. Here, a `selected` state is set, changing the fill color of elements to red when their `sales` value is greater than 40. + +* After 15 seconds, destroy the chart instance using the `release` method, exiting the chart. + +--- + + +
#### Animation Flowchart +
#### Process Description +1. **Create Chart Configuration and Data**: Define initial chart configuration and data. +1. **Create VChart Instance**: Create a VChart instance using the configuration and DOM container. +1. **Render Chart**: Call the `renderAsync` method to render the chart, triggering the animation entrance effect. +1. **Animation Entrance**: Automatically trigger entrance animation after the chart is rendered. +1. **Data Update (Add Elements)**: Add data using the `updateDataSync` method, triggering add animation. +1. **Data Update (Update Elements)**: Update data using the `updateDataSync` method, triggering update animation. +1. **Data Update (Remove Elements)**: Remove data using the `updateDataSync` method, triggering exit animation. +1. **Use of Element State**: Update element state using the `updateState` method, setting styles under specific conditions. +1. **Chart Exit**: Destroy the chart instance using the `release` method, exiting the chart. + +
+### Source Code Implementation Process + +1. **Initialize VChart Instance** + +When you create a `VChart` instance and pass in `spec`, the constructor handles the `animation` configuration: + +File: `vchart.ts` Method: `constructor` + ```xml constructor(spec: ISpec, options: IInitOption) { this._option = mergeOrigin(this._option, { animation: (spec as any).animation !== false }, options); *// ...* -} - -``` -This code ensures that if animation is not explicitly disabled in `spec` (i.e., `animation !== false`), then animation is enabled. - -1. Set a new spec and initialize the chart - -In the `VChart` class, the `_setNewSpec` method is used to set a new `spec` and convert it to a format used internally: - -File: `vchart.ts` Method: `_setNewSpec` - +} + +```` + +This code ensures that if animation is not explicitly disabled in `spec` (i.e., `animation !== false`), then animation is enabled. + +1. Set a new spec and initialize the chart + +In the `VChart` class, the `_setNewSpec` method is used to set a new `spec` and convert it to a format used internally: + +File: `vchart.ts` Method: `_setNewSpec` + ```xml private _setNewSpec(spec: any, forceMerge?: boolean): boolean { if (!spec) { @@ -522,13 +507,14 @@ private _setNewSpec(spec: any, forceMerge?: boolean): boolean { this._originalSpec = spec; this._spec = this._getSpecFromOriginalSpec(); return true; -} +} + +``` + +Next, the `initChartSpec` method initializes the chart specifications based on `spec`: + +File: `vchart.ts` Method: `initChartSpec` -``` -Next, the `initChartSpec` method initializes the chart specifications based on `spec`: - -File: `vchart.ts` Method: `initChartSpec` - ```xml private _initChartSpec(spec: any, actionSource: VChartRenderActionSource) { *// 如果用户注册了函数,在配置中替换相应函数名为函数内容* @@ -548,15 +534,16 @@ private _initChartSpec(spec: any, actionSource: VChartRenderActionSource) { this._specInfo = this._chartSpecTransformer?.transformModelSpec(this._spec); *// 插件生命周期* this._chartPluginApply('onAfterModelSpecTransform', this._spec, this._specInfo, actionSource); -} - -``` -1. Create and initialize Chart instance - -In the `_initChart` method, create and initialize the chart instance: - -File: `vchart.ts` Method: `_initChart` - +} + +``` + +1. Create and initialize Chart instance + +In the `_initChart` method, create and initialize the chart instance: + +File: `vchart.ts` Method: `_initChart` + ```xml private _initChart(spec: any) { if (!this._compiler) { @@ -580,15 +567,16 @@ private _initChart(spec: any) { chart, vchart: this }); -} - -``` -1. Update Animation State - -When the chart needs to be re-rendered or updated, the `_updateAnimateState` method is called to update the animation state: - -File: `vchart.ts` Method: `_updateAnimateState` - +} + +``` + +1. Update Animation State + +When the chart needs to be re-rendered or updated, the `_updateAnimateState` method is called to update the animation state: + +File: `vchart.ts` Method: `_updateAnimateState` + ```xml private _updateAnimateState(initial?: boolean) { if (this._option.animation) { @@ -600,19 +588,20 @@ private _updateAnimateState(initial?: boolean) { component.animate?.updateAnimateState(animationState, true); }); } -} - -``` -* **Initial State**: If `initial` is `true`, set the animation state to `AnimationStateEnum.appear` (entrance animation). - -* **Update State**: Otherwise, set it to `AnimationStateEnum.update` (update animation). - -1. Render the chart - -In the `renderSync` and `renderAsync` methods, the `animation` configuration is passed to the compiler for rendering: - -File: `vchart.ts` Method: `_renderSync` - +} + +``` + +- **Initial State**: If `initial` is `true`, set the animation state to `AnimationStateEnum.appear` (entrance animation). + +- **Update State**: Otherwise, set it to `AnimationStateEnum.update` (update animation). + +1. Render the chart + +In the `renderSync` and `renderAsync` methods, the `animation` configuration is passed to the compiler for rendering: + +File: `vchart.ts` Method: `_renderSync` + ```xml protected _renderSync = (option: IVChartRenderOption = {}) => { const self = this as unknown as IVChart; @@ -623,390 +612,360 @@ protected _renderSync = (option: IVChartRenderOption = {}) => { this._compiler?.render(option.morphConfig); this._afterRender(); return self; -}; - -``` -1. Update of Animation State - -In the `updateSpec` and `updateCustomConfigAndRerender` methods, the `reAnimate` flag is used to decide whether to re-trigger the animation: - -File: `vchart.ts` Methods: `updateSpec` and `updateCustomConfigAndRerender` - +}; + +``` + +1. Update of Animation State + +In the `updateSpec` and `updateCustomConfigAndRerender` methods, the `reAnimate` flag is used to decide whether to re-trigger the animation: + +File: `vchart.ts` Methods: `updateSpec` and `updateCustomConfigAndRerender` + ```xml if (userUpdateOptions?.reAnimate) { this.stopAnimation(); this._updateAnimateState(true); -} - -``` - - -### Overview of Animation System Design - - - -The animation system design of VChart follows the principles of modularity, extensibility, and easy configuration, aiming to provide developers with a flexible and powerful tool to create rich animation effects. Below are the key components of the system and their working principles: - -### Principles - -#### 1. Animation Interface and Abstraction - - - -* **IAnimate Interface**: Defines the methods and properties that all animations must implement, including obtaining a unique ID, updating animation state, and getting the state signal name. - -* - -* **IAnimationSpec Interface**: Specifies the structure of animation configuration, covering various animation settings from entrance to exit. - - - -classDiagram - - class AnimationStateEnum { - - --Enum-- - - appear: AnimationStateEnum - - disappear: AnimationStateEnum - - enter: AnimationStateEnum - - update: AnimationStateEnum - - exit: AnimationStateEnum - - state: AnimationStateEnum - - normal: AnimationStateEnum - - none: AnimationStateEnum - - } - - - - class IAnimate { - - <> - - +updateAnimateState(state: AnimationStateEnum, noRender?: boolean): void - - +getAnimationStateSignalName(): string - - +id: number - - } - - - - class ICartesianGroupAnimationParams { - - <> - - +direction(): "x" | "y" - - +orient(): "positive" | "negative" - - +width(): number - - +height(): number - - } - - - - class AnimateManager { - - --Attributes-- - - -_stateMap: IAnimateState & StateMap - - +id: number - - --Methods-- - - +updateAnimateState(state: AnimationStateEnum, noRender?: boolean): void - - +getAnimationStateSignalName(): string - - +constructor() - - } - - - - class MarkAnimationSpec { - - --Attributes-- - - appear: IAnimationConfig - - enter: IAnimationConfig - - update: IAnimationConfig[] - - exit: IAnimationConfig - - disappear: IAnimationConfig - - } - - - - class IAnimationSpec { - - --Attributes-- - - animationAppear: boolean | IStateAnimateSpec | IMarkAnimateSpec - - animationEnter: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec - - animationUpdate: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec - - animationExit: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec - - animationDisappear: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec - - animationState: boolean | IStateAnimationConfig - - animationNormal: IMarkAnimateSpec - - } - - - - class IStateAnimateSpec { - - --Attributes-- - - duration?: number - - delay?: number - - easing?: EasingType - - oneByOne?: boolean - - preset?: Preset | false - - } - - - - class ICommonStateAnimateSpec { - - --Attributes-- - - duration?: number - - delay?: number - - easing?: EasingType - - oneByOne?: boolean - - } - - - - class IMorphSeriesSpec { - - --Attributes-- - - enable?: boolean - - morphKey?: string - - morphElementKey?: string - - } - - - - class IAnimateState { - - --Attributes-- - - animationState: { callback: (datum: any, element: IElement) => AnimationStateEnum } - - } - - - - class IAnimationConfig { - - --Attributes-- - - type?: string - - channel?: string - - custom?: Function - - customParameters?: Function - - oneByOne?: boolean | number - - duration?: number - - easing?: EasingType - - delay?: number - - delayAfter?: number - - } - - - - % Relationships - - AnimationStateEnum "1" --|> "many" AnimateManager: Uses - - AnimateManager "1" --|> "1" IAnimate: Implements - - AnimateManager "1" -- "1" ICartesianGroupAnimationParams: Depends - - IAnimationSpec "1" -- "many" spec.ts: Defined in - - MarkAnimationSpec "1" -- "1" config.ts: Used by config.ts - - IAnimationConfig "1" -- "many" utils.ts: Processed by utils.ts - - IStateAnimateSpec "1" -- "1" ICommonStateAnimateSpec: Inherits - - IAnimationSpec "1" -- "1" IStateAnimateSpec: Associates - - IAnimationSpec "1" -- "1" IMorphSeriesSpec: Associates - - IAnimateState "1" -- "1" AnimateManager: Internally used - - IAnimationConfig "1" -- "1" ICommonStateAnimateSpec: Inherits - - - -#### 2. Animation Manager - - - -* **AnimateManager Class**: Inherits from `StateManager` and implements the `IAnimate` interface, responsible for managing the state of animations and providing methods to update animations based on the incoming state. It handles the update and retrieval of animation states and updates animation states based on different states. - - - -#### 3. Factory Pattern - - - -* **Factory Class**: Used to register new animation types, allowing custom animation logic to be added to chart components. Through the static method `registerAnimation`, specific types of animations can be associated with their configurations for easy subsequent calls. - - - -#### 4. Animation Configuration Generation - - - -* **animationConfig Function**: Generates the final animation configuration based on default and user-provided configurations. This function traverses all animation states (such as appear, enter, update, etc.) and constructs a complete animation configuration object based on user or default configurations. - - - -#### 5. Animation Task Interface - - - -* **IAnimationTask Interface**: Defines the data structure of an animation task, which is crucial for understanding complex animation sequences. Each task contains time offsets, action queues, and successor task lists, forming a chain-like animation execution mechanism. - - - -#### 6. Specific Implementation of Animation - - - -* Each specific chart series (such as bar chart, pie chart, scatter plot, etc.) has its own animation implementation files, which contain preset animation functions for that series. For example, a bar chart may have growth animations, fade-in animations, etc.; a pie chart may have sector expansion animations, etc. - - - - -Through the above steps, we have completed a simple yet complete animation process creation. In this process, we utilized the modular design of the VChart animation system to handle chart configuration, animation registration, chart instantiation, data updates, and animation state management separately. This design not only makes the code clearer and more readable but also enhances the system's flexibility and maintainability. Developers can easily customize different types of animation effects according to actual needs, thereby enhancing user experience. - - - -To better understand and interpret these source files, it is recommended to read them in the following order: - -1. `**interface.ts**` - -* **Reason**: This file defines the core types and interfaces in the animation module, such as `AnimationStateEnum`, `IAnimateState`, and `IAnimate`. Understanding these types and interfaces is the foundation for subsequent code. - -* **Key Content**: - -* Animation state enumeration `AnimationStateEnum` - -* Animation state interface `IAnimateState` - -* Animation interface `IAnimate` - -1. `**spec.ts**` - -* **Reason**: This file defines the specifications for animation configuration, including `ICommonStateAnimateSpec`, `IStateAnimateSpec`, and `IAnimationSpec`. These specifications are used in actual animation configurations, so it is necessary to understand their structure first. - -* **Key Content**: - -* Common properties of animation configuration `ICommonStateAnimateSpec` - -* Animation state configuration `IStateAnimateSpec` - -* Animation specification `IAnimationSpec` - -1. `**config.ts**` - -* **Reason**: This file provides default animation configurations and some preset animation registration functions. Understanding these default configurations helps in understanding how to customize animation configurations. - -* **Key Content**: - -* Default animation configuration `DEFAULT_ANIMATION_CONFIG` - -* Preset animation registration functions (such as `registerScaleInOutAnimation`, `registerFadeInOutAnimation`, etc.) - -1. `**utils.ts**` - -* **Reason**: This file contains many utility functions for generating and processing animation configurations. Understanding how these functions work can help you better understand how animation configurations are applied. - -* **Key Content**: - -* Function to generate animation configuration `animationConfig` - -* Function to process user animation configuration `userAnimationConfig` - -* Utility functions (such as `produceOneByOne`, `shouldMarkDoMorph`, etc.) - -1. `**animate-manager.ts**` - -* **Reason**: This file implements the `AnimateManager` class, which is the core class for managing animations. Understanding the implementation of this class can let you know how animations are managed and updated. - -* **Key Content**: - -* Implementation of the `AnimateManager` class - -* Method to update animation state `updateAnimateState` - -* Method to get animation state signal name `getAnimationStateSignalName` - -### Summary - -Reading these files in the above order can gradually build an understanding of the entire animation module. Start from the basic types and interfaces, gradually delve into specific configurations and implementation details, and finally understand how animations are managed and applied. - -### Reading Order Summary - -* `**interface.ts**` Core types and interfaces - -* `**spec.ts**` Animation configuration specifications - -* `**config.ts**` Default configurations and preset animations - -* `**utils.ts**` Utility functions and configuration generation - -* `**animate-manager.ts**` Animation management class implementation - - # This document was revised and organized by the following personnel - [玄魂](https://github.com/xuanhun) \ No newline at end of file +} + +``` + +### Overview of Animation System Design + +The animation system design of VChart follows the principles of modularity, extensibility, and easy configuration, aiming to provide developers with a flexible and powerful tool to create rich animation effects. Below are the key components of the system and their working principles: + +### Principles + +#### 1. Animation Interface and Abstraction + +- **IAnimate Interface**: Defines the methods and properties that all animations must implement, including obtaining a unique ID, updating animation state, and getting the state signal name. + +- + +- **IAnimationSpec Interface**: Specifies the structure of animation configuration, covering various animation settings from entrance to exit. + +classDiagram + + class AnimationStateEnum { + + --Enum-- + + appear: AnimationStateEnum + + disappear: AnimationStateEnum + + enter: AnimationStateEnum + + update: AnimationStateEnum + + exit: AnimationStateEnum + + state: AnimationStateEnum + + normal: AnimationStateEnum + + none: AnimationStateEnum + + } + + + + class IAnimate { + + <> + + +updateAnimateState(state: AnimationStateEnum, noRender?: boolean): void + + +getAnimationStateSignalName(): string + + +id: number + + } + + + + class ICartesianGroupAnimationParams { + + <> + + +direction(): "x" | "y" + + +orient(): "positive" | "negative" + + +width(): number + + +height(): number + + } + + + + class AnimateManager { + + --Attributes-- + + -_stateMap: IAnimateState & StateMap + + +id: number + + --Methods-- + + +updateAnimateState(state: AnimationStateEnum, noRender?: boolean): void + + +getAnimationStateSignalName(): string + + +constructor() + + } + + + + class MarkAnimationSpec { + + --Attributes-- + + appear: IAnimationConfig + + enter: IAnimationConfig + + update: IAnimationConfig[] + + exit: IAnimationConfig + + disappear: IAnimationConfig + + } + + + + class IAnimationSpec { + + --Attributes-- + + animationAppear: boolean | IStateAnimateSpec | IMarkAnimateSpec + + animationEnter: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec + + animationUpdate: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec + + animationExit: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec + + animationDisappear: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec + + animationState: boolean | IStateAnimationConfig + + animationNormal: IMarkAnimateSpec + + } + + + + class IStateAnimateSpec { + + --Attributes-- + + duration?: number + + delay?: number + + easing?: EasingType + + oneByOne?: boolean + + preset?: Preset | false + + } + + + + class ICommonStateAnimateSpec { + + --Attributes-- + + duration?: number + + delay?: number + + easing?: EasingType + + oneByOne?: boolean + + } + + + + class IMorphSeriesSpec { + + --Attributes-- + + enable?: boolean + + morphKey?: string + + morphElementKey?: string + + } + + + + class IAnimateState { + + --Attributes-- + + animationState: { callback: (datum: any, element: IElement) => AnimationStateEnum } + + } + + + + class IAnimationConfig { + + --Attributes-- + + type?: string + + channel?: string + + custom?: Function + + customParameters?: Function + + oneByOne?: boolean | number + + duration?: number + + easing?: EasingType + + delay?: number + + delayAfter?: number + + } + + + + % Relationships + + AnimationStateEnum "1" --|> "many" AnimateManager: Uses + + AnimateManager "1" --|> "1" IAnimate: Implements + + AnimateManager "1" -- "1" ICartesianGroupAnimationParams: Depends + + IAnimationSpec "1" -- "many" spec.ts: Defined in + + MarkAnimationSpec "1" -- "1" config.ts: Used by config.ts + + IAnimationConfig "1" -- "many" utils.ts: Processed by utils.ts + + IStateAnimateSpec "1" -- "1" ICommonStateAnimateSpec: Inherits + + IAnimationSpec "1" -- "1" IStateAnimateSpec: Associates + + IAnimationSpec "1" -- "1" IMorphSeriesSpec: Associates + + IAnimateState "1" -- "1" AnimateManager: Internally used + + IAnimationConfig "1" -- "1" ICommonStateAnimateSpec: Inherits + +#### 2. Animation Manager + +- **AnimateManager Class**: Inherits from `StateManager` and implements the `IAnimate` interface, responsible for managing the state of animations and providing methods to update animations based on the incoming state. It handles the update and retrieval of animation states and updates animation states based on different states. + +#### 3. Factory Pattern + +- **Factory Class**: Used to register new animation types, allowing custom animation logic to be added to chart components. Through the static method `registerAnimation`, specific types of animations can be associated with their configurations for easy subsequent calls. + +#### 4. Animation Configuration Generation + +- **animationConfig Function**: Generates the final animation configuration based on default and user-provided configurations. This function traverses all animation states (such as appear, enter, update, etc.) and constructs a complete animation configuration object based on user or default configurations. + +#### 5. Animation Task Interface + +- **IAnimationTask Interface**: Defines the data structure of an animation task, which is crucial for understanding complex animation sequences. Each task contains time offsets, action queues, and successor task lists, forming a chain-like animation execution mechanism. + +#### 6. Specific Implementation of Animation + +- Each specific chart series (such as bar chart, pie chart, scatter plot, etc.) has its own animation implementation files, which contain preset animation functions for that series. For example, a bar chart may have growth animations, fade-in animations, etc.; a pie chart may have sector expansion animations, etc. + +Through the above steps, we have completed a simple yet complete animation process creation. In this process, we utilized the modular design of the VChart animation system to handle chart configuration, animation registration, chart instantiation, data updates, and animation state management separately. This design not only makes the code clearer and more readable but also enhances the system's flexibility and maintainability. Developers can easily customize different types of animation effects according to actual needs, thereby enhancing user experience. + +To better understand and interpret these source files, it is recommended to read them in the following order: + +1. `**interface.ts**` + +- **Reason**: This file defines the core types and interfaces in the animation module, such as `AnimationStateEnum`, `IAnimateState`, and `IAnimate`. Understanding these types and interfaces is the foundation for subsequent code. + +- **Key Content**: + +- Animation state enumeration `AnimationStateEnum` + +- Animation state interface `IAnimateState` + +- Animation interface `IAnimate` + +1. `**spec.ts**` + +- **Reason**: This file defines the specifications for animation configuration, including `ICommonStateAnimateSpec`, `IStateAnimateSpec`, and `IAnimationSpec`. These specifications are used in actual animation configurations, so it is necessary to understand their structure first. + +- **Key Content**: + +- Common properties of animation configuration `ICommonStateAnimateSpec` + +- Animation state configuration `IStateAnimateSpec` + +- Animation specification `IAnimationSpec` + +1. `**config.ts**` + +- **Reason**: This file provides default animation configurations and some preset animation registration functions. Understanding these default configurations helps in understanding how to customize animation configurations. + +- **Key Content**: + +- Default animation configuration `DEFAULT_ANIMATION_CONFIG` + +- Preset animation registration functions (such as `registerScaleInOutAnimation`, `registerFadeInOutAnimation`, etc.) + +1. `**utils.ts**` + +- **Reason**: This file contains many utility functions for generating and processing animation configurations. Understanding how these functions work can help you better understand how animation configurations are applied. + +- **Key Content**: + +- Function to generate animation configuration `animationConfig` + +- Function to process user animation configuration `userAnimationConfig` + +- Utility functions (such as `produceOneByOne`, `shouldMarkDoMorph`, etc.) + +1. `**animate-manager.ts**` + +- **Reason**: This file implements the `AnimateManager` class, which is the core class for managing animations. Understanding the implementation of this class can let you know how animations are managed and updated. + +- **Key Content**: + +- Implementation of the `AnimateManager` class + +- Method to update animation state `updateAnimateState` + +- Method to get animation state signal name `getAnimationStateSignalName` + +### Summary + +Reading these files in the above order can gradually build an understanding of the entire animation module. Start from the basic types and interfaces, gradually delve into specific configurations and implementation details, and finally understand how animations are managed and applied. + +### Reading Order Summary + +- `**interface.ts**` Core types and interfaces + +- `**spec.ts**` Animation configuration specifications + +- `**config.ts**` Default configurations and preset animations + +- `**utils.ts**` Utility functions and configuration generation + +- `**animate-manager.ts**` Animation management class implementation + +# This document was revised and organized by the following personnel + +[玄魂](https://github.com/xuanhun) diff --git a/docs/assets/contributing/zh/sourcecode/10.1-animation-concepts-and-types.md b/docs/assets/contributing/zh/sourcecode/10.1-animation-concepts-and-types.md index bb93e38cb6..18eb91d949 100644 --- a/docs/assets/contributing/zh/sourcecode/10.1-animation-concepts-and-types.md +++ b/docs/assets/contributing/zh/sourcecode/10.1-animation-concepts-and-types.md @@ -1,232 +1,224 @@ --- -title: 10.1 动画的概念和类型 +title: 10.1 动画的概念和类型 key words: VisActor,VChart,VTable,VStrory,VMind,VGrammar,VRender,Visualization,Chart,Data,Table,Graph,Gis,LLM ---- -> 10.1 动画的概念和类型 -> 分数:4 -> 1. 动画的概念和类型: -> 1. 其他参考文档: -> https://www.visactor.io/vchart/guide/tutorial_docs/Animation/Animation_Types -> -> [魔力之帧(下):VChart 动画编程实践在这篇文章中,我们将从一些常见的图表动画入手,详细介绍在 VChart 中的编 - 掘金](https://juejin.cn/post/7314829865633595443) - -1. 代码入口:`packages/vchart/src/animation/` - -`packages/vchart/src/series/line/animation` - -`packages/vchart/src/core/vchart` - -`packages/vchart/src/core/interface` - -`packages/vchart/src/complie/mark` - -1. 解读重点: - -1. 动画分类(按执行时机,按效果) - -1. 动画系统的整体设计 - -# 动画的概念 - - - -在VChart中,动画是指在图表渲染过程中,通过视觉效果来增强数据展示的动态性和交互性。动画系统允许开发者配置和控制图表元素(如柱状图、饼图、折线图等)在不同状态下的过渡效果。 - -在 VisActor 中动画被视作为渲染阶段的修饰:动画配置与图形语法流程执行得到的图元视觉通道一起决定了渲染阶段的结果。动画的表现是具体图形元素在某一时间段内视觉通道属性的插值计算或者特殊计算逻辑,而动画配置描述了这一计算的触发时机以及执行时长。 - - - -## 动画的分类 - -#### 生命周期示范 - -![](https://cdn.jsdelivr.net/gh/xuanhun/articles/visactor/sourcecode/img/OgJ0wqt4khXJtrbwW3Zc2521nOc.gif) - - - -### 按执行时机分类 - -图表动画在 VChart 中根据状态场景(执行时机)会被区分为:**图表入场动画**、**数据更新动画**和**图表退场动画**。 - -1. **图表入场动画:**是指图表创建时的动画效果。 - -1. **数据更新动画:**当我们更新图表数据时,图元发生的属性动画则称为数据更新动画。分为:**新增图元动画**、**图元更新动画**和**退场图元动画、状态变更动画、任意时机触发的动画**。通常情况下,你不需要考虑如何控制这三种更新动画,因为 VChart 会在数据更新时,识别出新数据与上一次数据间的关联,从而正确执行更新动画。 - -1. **图表退场动画**:在某些场景下,我们可能需要移除图表。此时,我们可以为图表设置退场动画,让图表在除之前有一个平滑过渡的动画效果。 - -![](https://cdn.jsdelivr.net/gh/xuanhun/articles/visactor/sourcecode/img/Ddzewl0jjhq1ksbmUlbc2WPSnig.gif) - -https://visactor.io/vchart/guide/tutorial_docs/Animation/Animation_Types 动画教程文档 - -https://www.visactor.io/vchart/option/barChart#animationState 动画配置文档 - -#### 图表**入场动画 (**`**animationAppear**`**)**: - -* 在图表首次渲染时,元素从无到有的过渡效果。 - -* 示例代码:`animationAppear` 配置项用于定义图表入场动画。 - - - +--- + +> 10.1 动画的概念和类型 +> 分数:4 +> +> 1. 动画的概念和类型: +> 1. 其他参考文档: +> https://www.visactor.io/vchart/guide/tutorial_docs/Animation/Animation_Types +> +> [魔力之帧(下):VChart 动画编程实践在这篇文章中,我们将从一些常见的图表动画入手,详细介绍在 VChart 中的编 - 掘金](https://juejin.cn/post/7314829865633595443) + +1. 代码入口:`packages/vchart/src/animation/` + +`packages/vchart/src/series/line/animation` + +`packages/vchart/src/core/vchart` + +`packages/vchart/src/core/interface` + +`packages/vchart/src/complie/mark` + +1. 解读重点: + +1. 动画分类(按执行时机,按效果) + +1. 动画系统的整体设计 + +# 动画的概念 + +在VChart中,动画是指在图表渲染过程中,通过视觉效果来增强数据展示的动态性和交互性。动画系统允许开发者配置和控制图表元素(如柱状图、饼图、折线图等)在不同状态下的过渡效果。 + +在 VisActor 中动画被视作为渲染阶段的修饰:动画配置与图形语法流程执行得到的图元视觉通道一起决定了渲染阶段的结果。动画的表现是具体图形元素在某一时间段内视觉通道属性的插值计算或者特殊计算逻辑,而动画配置描述了这一计算的触发时机以及执行时长。 + + + +## 动画的分类 + +#### 生命周期示范 + +![](https://cdn.jsdelivr.net/gh/xuanhun/articles/visactor/sourcecode/img/OgJ0wqt4khXJtrbwW3Zc2521nOc.gif) + +### 按执行时机分类 + +图表动画在 VChart 中根据状态场景(执行时机)会被区分为:**图表入场动画**、**数据更新动画**和**图表退场动画**。 + +1. **图表入场动画:**是指图表创建时的动画效果。 + +1. **数据更新动画:**当我们更新图表数据时,图元发生的属性动画则称为数据更新动画。分为:**新增图元动画**、**图元更新动画**和**退场图元动画、状态变更动画、任意时机触发的动画**。通常情况下,你不需要考虑如何控制这三种更新动画,因为 VChart 会在数据更新时,识别出新数据与上一次数据间的关联,从而正确执行更新动画。 + +1. **图表退场动画**:在某些场景下,我们可能需要移除图表。此时,我们可以为图表设置退场动画,让图表在除之前有一个平滑过渡的动画效果。 + +![](https://cdn.jsdelivr.net/gh/xuanhun/articles/visactor/sourcecode/img/Ddzewl0jjhq1ksbmUlbc2WPSnig.gif) + +https://visactor.io/vchart/guide/tutorial_docs/Animation/Animation_Types 动画教程文档 + +https://www.visactor.io/vchart/option/barChart#animationState 动画配置文档 + +#### 图表**入场动画 (**`**animationAppear**`**)**: + +- 在图表首次渲染时,元素从无到有的过渡效果。 + +- 示例代码:`animationAppear` 配置项用于定义图表入场动画。 + + + ```html - -
- - - -``` + +
+ + +``` + ```xml -animationAppear?: boolean | IStateAnimateSpec | IMarkAnimateSpec; - -``` -#### 数据更新动画 - -当我们更新图表数据时,图元发生的属性动画则称为更新动画。在 VChart 中,用户手动调用 `updateData` 接口会触发图表数据更新,另外,点击图例时也更新图表数据。更新动画分为三类:新增图元动画、图元更新动画和退场图元动画。 - -1. **新增图元动画 (**`**animationEnter**`**)**: - -* 新增图元动画是指当图表数据更新时,新添加数据应的图元的动画效果。 - -* 我们可以使用 `animationEnter` 配置来设置新增图元动画。 - +animationAppear?: boolean | IStateAnimateSpec | IMarkAnimateSpec; + +``` + +#### 数据更新动画 + +当我们更新图表数据时,图元发生的属性动画则称为更新动画。在 VChart 中,用户手动调用 `updateData` 接口会触发图表数据更新,另外,点击图例时也更新图表数据。更新动画分为三类:新增图元动画、图元更新动画和退场图元动画。 + +1. **新增图元动画 (**`**animationEnter**`**)**: + +- 新增图元动画是指当图表数据更新时,新添加数据应的图元的动画效果。 + +- 我们可以使用 `animationEnter` 配置来设置新增图元动画。 + ```xml -animationEnter?: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec; - -``` - - -1. **图元更新动画 ( **`**animationUpdate**`**)**: - -* 图元更新动画是指当图表数据更新,原有数据对应的图元的更新动画效果。 - -* 我们可以使用 `animationUpdate` 配置来设置图元更新动画。 - +animationEnter?: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec; + +``` + +1. **图元更新动画 ( **`**animationUpdate**`**)**: + +- 图元更新动画是指当图表数据更新,原有数据对应的图元的更新动画效果。 + +- 我们可以使用 `animationUpdate` 配置来设置图元更新动画。 + ```xml -animationUpdate?: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec; - -``` - - -1. **退场图元动画 (**`**animationExit**`** )**: - -* 退图元动画是指当图表数据更新时,被删除数据所对应图元的动画效果。我们可以使用 `animationExit` 配置来设置退场图元动画。 - +animationUpdate?: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec; + +``` + +1. **退场图元动画 (**`**animationExit**`** )**: + +- 退图元动画是指当图表数据更新时,被删除数据所对应图元的动画效果。我们可以使用 `animationExit` 配置来设置退场图元动画。 + ```xml -animationExit?: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec; - -``` - - -1. 图元**状态切换动画 (State)**: - -* 当图表状态发生改变时的过渡效果。 - -* 示例代码:`animationState` 配置项用于定义状态切换动画。 - +animationExit?: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec; + +``` + +1. 图元**状态切换动画 (State)**: + +- 当图表状态发生改变时的过渡效果。 + +- 示例代码:`animationState` 配置项用于定义状态切换动画。 + ```xml -animationState?: boolean | IStateAnimationConfig; - -``` - - -1. 常态**动画 (Normal)**:常用于循环 - -* 用于定义持续不断的动画效果。 - -* 示例代码:`animationNormal` 配置项用于定义循环动画。 - +animationState?: boolean | IStateAnimationConfig; + +``` + +1. 常态**动画 (Normal)**:常用于循环 + +- 用于定义持续不断的动画效果。 + +- 示例代码:`animationNormal` 配置项用于定义循环动画。 + ```xml -animationNormal?: IMarkAnimateSpec; - -``` - - -#### 图表**退场动画 (**`**animationDisappear**`**)**: - -* 在图表销毁或隐藏时,元素的退场效果。 - +animationNormal?: IMarkAnimateSpec; + +``` + +#### 图表**退场动画 (**`**animationDisappear**`**)**: + +- 在图表销毁或隐藏时,元素的退场效果。 + ```xml - animationDisappear?: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec; - -``` -### 按效果分类 - -type 图元原子化 - -* 动画效果:动画效果描述了在某一特定的动画阶段中图元以怎样的方式执行渲染的变化。动画效果包括普通的视觉通道插值,例如竞速条形图中柱子颜色、宽度、位置的变化;同时动画效果也包含一些特殊的变化,例如下图中的图元形变。 - -1. **渐入渐出 (FadeIn/FadeOut)**: - -* 元素透明度从0到1或从1到0的变化。 - -* 示例代码:`Appear_FadeIn` 和 `Disappear_FadeOut`。 - + animationDisappear?: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec; + +``` + +### 按效果分类 + +type 图元原子化 + +- 动画效果:动画效果描述了在某一特定的动画阶段中图元以怎样的方式执行渲染的变化。动画效果包括普通的视觉通道插值,例如竞速条形图中柱子颜色、宽度、位置的变化;同时动画效果也包含一些特殊的变化,例如下图中的图元形变。 + +1. **渐入渐出 (FadeIn/FadeOut)**: + +- 元素透明度从0到1或从1到0的变化。 + +- 示例代码:`Appear_FadeIn` 和 `Disappear_FadeOut`。 + ```xml const Appear_FadeIn: IAnimationTypeConfig = { type: 'fadeIn' -}; - -``` - - -1. **生长 (Grow)**: - -* 元素从某个初始尺寸逐渐增长到最终尺寸。 - -* 示例代码:`barGrowOption` 和 `pieGrowOption`。 - +}; + +``` + +1. **生长 (Grow)**: + +- 元素从某个初始尺寸逐渐增长到最终尺寸。 + +- 示例代码:`barGrowOption` 和 `pieGrowOption`。 + ```xml -function barGrowOption(barParams: IBarAnimationParams, isOverall = true) {/***/} - -``` - - -1. **裁剪 (Clip)**: - -* 通过裁剪区域来显示元素的逐步出现或消失。 - -* 示例代码:`registerCartesianGroupClipAnimation`。 - +function barGrowOption(barParams: IBarAnimationParams, isOverall = true) {/***/} + +``` + +1. **裁剪 (Clip)**: + +- 通过裁剪区域来显示元素的逐步出现或消失。 + +- 示例代码:`registerCartesianGroupClipAnimation`。 + ```xml const registerCartesianGroupClipAnimation = () => { Factory.registerAnimation('cartesianGroupClip', (params?: ICartesianGroupAnimationParams) => {/***/}); -}; - -``` - - -1. **波浪 (Wave)**: - -* 特殊效果,如液态图中的波浪效果。 - -* 示例代码:`Appear_Wave`。 - +}; + +``` + +1. **波浪 (Wave)**: + +- 特殊效果,如液态图中的波浪效果。 + +- 示例代码:`Appear_Wave`。 + ```xml const Appear_Wave: IAnimationTypeConfig = { duration: 2000, @@ -234,131 +226,125 @@ const Appear_Wave: IAnimationTypeConfig = { channel: { wave: { from: 0, to: 1 } } -}; - -``` - - -1. **缩放 (Scale)**: - -* 元素大小从一个比例缩放到另一个比例。 - -* 示例代码:`Appear_ScaleIn`。 - +}; + +``` + +1. **缩放 (Scale)**: + +- 元素大小从一个比例缩放到另一个比例。 + +- 示例代码:`Appear_ScaleIn`。 + ```xml const Appear_ScaleIn: IAnimationTypeConfig = { type: 'growCenterIn' -}; - -``` -更多动画效果的属性和配置可参考https://visactor.com/vchart/guide/tutorial_docs/Animation/Animation_Attributes_and_Settings - -## 动画系统的设计 - -### 简单柱状图动画配置 - - - -下面以创建一个简单的柱状图为例,说明如何使用VChart的动画系统来实现基本动画效果的原理。 - - - - - +}; + +``` + +更多动画效果的属性和配置可参考https://visactor.com/vchart/guide/tutorial_docs/Animation/Animation_Attributes_and_Settings + +## 动画系统的设计 + +### 简单柱状图动画配置 + +下面以创建一个简单的柱状图为例,说明如何使用VChart的动画系统来实现基本动画效果的原理。 + + + ```html - - -
- - - -``` -> 如何创建一个基础VChart可以参考以下文档 -> https://www.visactor.io/vchart/guide/tutorial_docs/Getting_Started 快速上手 -> https://www.visactor.io/vchart/guide/tutorial_docs/Basic/How_to_Import_VChart 导入VChart -> https://www.visactor.io/vchart/guide/tutorial_docs/Basic/A_Basic_Spec 基础配置 -> https://www.visactor.io/vchart/guide/tutorial_docs/Basic/DeepSeek_With_Cursor DeepSeek+Cursor助力 - - - -在 `VChart` 类中,`spec`(图表配置)中的 `animation` 配置项用于控制图表的动画行为。具体来说,`animation` 配置项可以定义图表在不同状态下的动画效果,例如入场动画、更新动画、退出动画等。 - -#### `animation` 配置的作用 - -1. **定义动画行为**: - -* `animation` 配置项可以包含多个子属性,如 `appear`、`enter`、`update`、`exit` 和 `disappear`,分别对应不同的动画场景。 - -* 每个子属性可以进一步配置动画的持续时间 (`duration`)、缓动函数 (`easing`)、是否逐个执行 (`oneByOne`) 等参数。 - -1. **控制动画开关**: - -* 如果将 `animation` 设置为 `false`,则禁用所有动画效果。 - -* 如果设置为 `true` 或者提供具体的配置对象,则启用相应的动画效果。 - -1. **传递给底层组件**: - -* `VChart` 类会将 `animation` 配置传递给内部的 `Compiler` 和 `Chart` 实例,这些实例会根据配置来决定是否应用动画以及如何应用动画。 - -### 柱状图执行动画示例说明 - - - -
#### 示例代码 + + +
+ + +``` + +> 如何创建一个基础VChart可以参考以下文档 +> https://www.visactor.io/vchart/guide/tutorial_docs/Getting_Started 快速上手 +> https://www.visactor.io/vchart/guide/tutorial_docs/Basic/How_to_Import_VChart 导入VChart +> https://www.visactor.io/vchart/guide/tutorial_docs/Basic/A_Basic_Spec 基础配置 +> https://www.visactor.io/vchart/guide/tutorial_docs/VChart_Skill_Usage VChart Skill 使用 + +在 `VChart` 类中,`spec`(图表配置)中的 `animation` 配置项用于控制图表的动画行为。具体来说,`animation` 配置项可以定义图表在不同状态下的动画效果,例如入场动画、更新动画、退出动画等。 + +#### `animation` 配置的作用 + +1. **定义动画行为**: + +- `animation` 配置项可以包含多个子属性,如 `appear`、`enter`、`update`、`exit` 和 `disappear`,分别对应不同的动画场景。 + +- 每个子属性可以进一步配置动画的持续时间 (`duration`)、缓动函数 (`easing`)、是否逐个执行 (`oneByOne`) 等参数。 + +1. **控制动画开关**: + +- 如果将 `animation` 设置为 `false`,则禁用所有动画效果。 + +- 如果设置为 `true` 或者提供具体的配置对象,则启用相应的动画效果。 + +1. **传递给底层组件**: + +- `VChart` 类会将 `animation` 配置传递给内部的 `Compiler` 和 `Chart` 实例,这些实例会根据配置来决定是否应用动画以及如何应用动画。 + +### 柱状图执行动画示例说明 + + + +
#### 示例代码 ```xml import { isMobile } from 'react-device-detect'; import { default as VChart } from '../../../../src/index'; // 1. 创建图表配置项与数据 const initialSpec = { - type: 'bar', - data: [ - { - id: 'barData', - values: [ - { month: 'January', sales: 22 }, - { month: 'February', sales: 13 }, - { month: 'March', sales: 25 }, - { month: 'April', sales: 29 }, - { month: 'May', sales: 38 } - ] - } - ], - xField: 'month', - yField: 'sales', - crosshair: { - xField: { visible: true } - }, - animation: true // 开启动画 +type: 'bar', +data: [ +{ +id: 'barData', +values: [ +{ month: 'January', sales: 22 }, +{ month: 'February', sales: 13 }, +{ month: 'March', sales: 25 }, +{ month: 'April', sales: 29 }, +{ month: 'May', sales: 38 } +] +} +], +xField: 'month', +yField: 'sales', +crosshair: { +xField: { visible: true } +}, +animation: true // 开启动画 }; // 2. 创建 VChart 实例 @@ -366,146 +352,147 @@ const vchart = new VChart(initialSpec, { dom: 'chart' }); // 3. 渲染图表 vchart.renderAsync().then(() => { - console.log('图表渲染完成'); +console.log('图表渲染完成'); }); // 4. 动画入场 setTimeout(() => { - console.log('动画入场'); +console.log('动画入场'); }, 1000); // 5. 数据更新(新增图元) setTimeout(() => { - const newData = [ - { month: 'June', sales: 45 }, - { month: 'July', sales: 50 } - ]; - vchart.updateDataSync('barData', newData, undefined, { reAnimate: true }); - console.log('新增图元'); +const newData = [ +{ month: 'June', sales: 45 }, +{ month: 'July', sales: 50 } +]; +vchart.updateDataSync('barData', newData, undefined, { reAnimate: true }); +console.log('新增图元'); }, 3000); // 6. 数据更新(图元更新) setTimeout(() => { - const updatedData = [ - { month: 'January', sales: 30 }, - { month: 'February', sales: 20 }, - { month: 'March', sales: 35 }, - { month: 'April', sales: 39 }, - { month: 'May', sales: 48 }, - { month: 'June', sales: 55 }, - { month: 'July', sales: 60 } - ]; - vchart.updateDataSync('barData', updatedData, undefined, { reAnimate: true }); - console.log('图元更新'); +const updatedData = [ +{ month: 'January', sales: 30 }, +{ month: 'February', sales: 20 }, +{ month: 'March', sales: 35 }, +{ month: 'April', sales: 39 }, +{ month: 'May', sales: 48 }, +{ month: 'June', sales: 55 }, +{ month: 'July', sales: 60 } +]; +vchart.updateDataSync('barData', updatedData, undefined, { reAnimate: true }); +console.log('图元更新'); }, 6000); // 7. 数据更新(图元退出) setTimeout(() => { - const remainingData = [ - { month: 'January', sales: 30 }, - { month: 'February', sales: 20 }, - { month: 'March', sales: 35 }, - { month: 'April', sales: 39 }, - { month: 'May', sales: 48 } - ]; - vchart.updateDataSync('barData', remainingData, undefined, { reAnimate: true }); - console.log('图元退出'); +const remainingData = [ +{ month: 'January', sales: 30 }, +{ month: 'February', sales: 20 }, +{ month: 'March', sales: 35 }, +{ month: 'April', sales: 39 }, +{ month: 'May', sales: 48 } +]; +vchart.updateDataSync('barData', remainingData, undefined, { reAnimate: true }); +console.log('图元退出'); }, 9000); // 8. 图元状态(state)的使用 setTimeout(() => { - vchart.updateState( - { - selected: { - style: { - fill: 'red' - } - } - }, - (series, mark, stateKey) => { - return mark.datum.sales > 40; - } - ); - console.log('图元状态更新'); +vchart.updateState( +{ +selected: { +style: { +fill: 'red' +} +} +}, +(series, mark, stateKey) => { +return mark.datum.sales > 40; +} +); +console.log('图元状态更新'); }, 12000); // 9. 图表退场 setTimeout(() => { - vchart.release(); - console.log('图表退场'); -}, 15000); - -```
#### 创建逻辑说明 -1. **创建图表配置项与数据**: -1. **创建 VChart 实例**: -1. **渲染图表**: -1. **动画入场**: -1. **数据更新(新增图元)**: -1. **数据更新(图元更新)**: -1. **数据更新(图元退出)**: -1. **图元状态(state)的使用**: -1. **图表退场**: - -
-* 定义了一个初始的图表配置项`initialSpec`,其中包含图表类型、数据、坐标轴字段和动画配置。 - -* 数据部分包含了一个`barData`的数据集,初始包含5个月的销售数据。 - -* 使用`initialSpec`和DOM容器`chart`创建一个VChart实例。 - -* 调用`renderAsync`方法异步渲染图表。图表渲染完成后,会触发动画入场效果。 - -* 在渲染完成后,通过`setTimeout`模拟动画入场。实际动画效果由VChart内部处理。 - -* 在3秒后,通过`updateDataSync`方法新增两个月的销售数据。`reAnimate: true`参数确保新增数据时有动画效果。 - -* 在6秒后,通过`updateDataSync`方法更新所有图元的数据。`reAnimate: true`参数确保更新数据时有动画效果。 - -* 在9秒后,通过`updateDataSync`方法移除两个月的销售数据。`reAnimate: true`参数确保移除数据时有动画效果。 - -* 在12秒后,通过`updateState`方法更新图元的状态。这里设置了一个`selected`状态,当图元的`sales`值大于40时,图元的填充颜色变为红色。 - -* 在15秒后,通过`release`方法销毁图表实例,图表退场。 - ---- - - -
#### 动画流程图 -
#### 流程说明 -1. **创建图表配置项与数据**:定义初始图表配置和数据。 -1. **创建 VChart 实例**:使用配置和DOM容器创建VChart实例。 -1. **渲染图表**:调用`renderAsync`方法渲染图表,触发动画入场效果。 -1. **动画入场**:图表渲染完成后,自动触发入场动画。 -1. **数据更新(新增图元)**:通过`updateDataSync`方法新增数据,触发新增动画。 -1. **数据更新(图元更新)**:通过`updateDataSync`方法更新数据,触发更新动画。 -1. **数据更新(图元退出)**:通过`updateDataSync`方法移除数据,触发退出动画。 -1. **图元状态(state)的使用**:通过`updateState`方法更新图元状态,设置特定条件下的样式。 -1. **图表退场**:通过`release`方法销毁图表实例,图表退场。 - -
-### 源码实现流程 - -1. **初始化 VChart 实例** - -当你创建一个 `VChart` 实例并传入 `spec` 时,构造函数会处理 `animation` 配置: - -文件:`vchart.ts` 方法:`constructor` - +vchart.release(); +console.log('图表退场'); +}, 15000); + +````
#### 创建逻辑说明 +1. **创建图表配置项与数据**: +1. **创建 VChart 实例**: +1. **渲染图表**: +1. **动画入场**: +1. **数据更新(新增图元)**: +1. **数据更新(图元更新)**: +1. **数据更新(图元退出)**: +1. **图元状态(state)的使用**: +1. **图表退场**: + +
+* 定义了一个初始的图表配置项`initialSpec`,其中包含图表类型、数据、坐标轴字段和动画配置。 + +* 数据部分包含了一个`barData`的数据集,初始包含5个月的销售数据。 + +* 使用`initialSpec`和DOM容器`chart`创建一个VChart实例。 + +* 调用`renderAsync`方法异步渲染图表。图表渲染完成后,会触发动画入场效果。 + +* 在渲染完成后,通过`setTimeout`模拟动画入场。实际动画效果由VChart内部处理。 + +* 在3秒后,通过`updateDataSync`方法新增两个月的销售数据。`reAnimate: true`参数确保新增数据时有动画效果。 + +* 在6秒后,通过`updateDataSync`方法更新所有图元的数据。`reAnimate: true`参数确保更新数据时有动画效果。 + +* 在9秒后,通过`updateDataSync`方法移除两个月的销售数据。`reAnimate: true`参数确保移除数据时有动画效果。 + +* 在12秒后,通过`updateState`方法更新图元的状态。这里设置了一个`selected`状态,当图元的`sales`值大于40时,图元的填充颜色变为红色。 + +* 在15秒后,通过`release`方法销毁图表实例,图表退场。 + +--- + + +
#### 动画流程图 +
#### 流程说明 +1. **创建图表配置项与数据**:定义初始图表配置和数据。 +1. **创建 VChart 实例**:使用配置和DOM容器创建VChart实例。 +1. **渲染图表**:调用`renderAsync`方法渲染图表,触发动画入场效果。 +1. **动画入场**:图表渲染完成后,自动触发入场动画。 +1. **数据更新(新增图元)**:通过`updateDataSync`方法新增数据,触发新增动画。 +1. **数据更新(图元更新)**:通过`updateDataSync`方法更新数据,触发更新动画。 +1. **数据更新(图元退出)**:通过`updateDataSync`方法移除数据,触发退出动画。 +1. **图元状态(state)的使用**:通过`updateState`方法更新图元状态,设置特定条件下的样式。 +1. **图表退场**:通过`release`方法销毁图表实例,图表退场。 + +
+### 源码实现流程 + +1. **初始化 VChart 实例** + +当你创建一个 `VChart` 实例并传入 `spec` 时,构造函数会处理 `animation` 配置: + +文件:`vchart.ts` 方法:`constructor` + ```xml constructor(spec: ISpec, options: IInitOption) { this._option = mergeOrigin(this._option, { animation: (spec as any).animation !== false }, options); *// ...* -} - -``` -这段代码确保了如果 `spec` 中没有显式禁用动画(即 `animation !== false`),则启用动画。 - -1. 设置新 spec 并初始化图表 - -在 `VChart` 类中,`_setNewSpec` 方法用于设置新的 `spec`,并将其转换为内部使用的格式: - -文件:`vchart.ts` 方法:`_setNewSpec` - +} + +```` + +这段代码确保了如果 `spec` 中没有显式禁用动画(即 `animation !== false`),则启用动画。 + +1. 设置新 spec 并初始化图表 + +在 `VChart` 类中,`_setNewSpec` 方法用于设置新的 `spec`,并将其转换为内部使用的格式: + +文件:`vchart.ts` 方法:`_setNewSpec` + ```xml private _setNewSpec(spec: any, forceMerge?: boolean): boolean { if (!spec) { @@ -520,13 +507,14 @@ private _setNewSpec(spec: any, forceMerge?: boolean): boolean { this._originalSpec = spec; this._spec = this._getSpecFromOriginalSpec(); return true; -} +} + +``` + +接着,`_initChartSpec` 方法会根据 `spec` 初始化图表规格: + +文件:`vchart.ts` 方法:`_initChartSpec` -``` -接着,`_initChartSpec` 方法会根据 `spec` 初始化图表规格: - -文件:`vchart.ts` 方法:`_initChartSpec` - ```xml private _initChartSpec(spec: any, actionSource: VChartRenderActionSource) { *// 如果用户注册了函数,在配置中替换相应函数名为函数内容* @@ -546,15 +534,16 @@ private _initChartSpec(spec: any, actionSource: VChartRenderActionSource) { this._specInfo = this._chartSpecTransformer?.transformModelSpec(this._spec); *// 插件生命周期* this._chartPluginApply('onAfterModelSpecTransform', this._spec, this._specInfo, actionSource); -} - -``` -1. 创建和初始化 Chart 实例 - -在 `_initChart` 方法中,创建并初始化图表实例: - -文件:`vchart.ts` 方法:`_initChart` - +} + +``` + +1. 创建和初始化 Chart 实例 + +在 `_initChart` 方法中,创建并初始化图表实例: + +文件:`vchart.ts` 方法:`_initChart` + ```xml private _initChart(spec: any) { if (!this._compiler) { @@ -578,15 +567,16 @@ private _initChart(spec: any) { chart, vchart: this }); -} - -``` -1. 更新动画状态 - -当图表需要重新渲染或更新时,`_updateAnimateState` 方法会被调用来更新动画状态: - -文件:`vchart.ts` 方法:`_updateAnimateState` - +} + +``` + +1. 更新动画状态 + +当图表需要重新渲染或更新时,`_updateAnimateState` 方法会被调用来更新动画状态: + +文件:`vchart.ts` 方法:`_updateAnimateState` + ```xml private _updateAnimateState(initial?: boolean) { if (this._option.animation) { @@ -598,19 +588,20 @@ private _updateAnimateState(initial?: boolean) { component.animate?.updateAnimateState(animationState, true); }); } -} - -``` -* **初始状态**:如果 `initial` 为 `true`,则设置动画状态为 `AnimationStateEnum.appear`(入场动画)。 - -* **更新状态**:否则,设置为 `AnimationStateEnum.update`(更新动画)。 - -1. 渲染图表 - -在 `renderSync` 和 `renderAsync` 方法中,`animation` 配置会被传递给编译器进行渲染: - -文件:`vchart.ts` 方法:`_renderSync` - +} + +``` + +- **初始状态**:如果 `initial` 为 `true`,则设置动画状态为 `AnimationStateEnum.appear`(入场动画)。 + +- **更新状态**:否则,设置为 `AnimationStateEnum.update`(更新动画)。 + +1. 渲染图表 + +在 `renderSync` 和 `renderAsync` 方法中,`animation` 配置会被传递给编译器进行渲染: + +文件:`vchart.ts` 方法:`_renderSync` + ```xml protected _renderSync = (option: IVChartRenderOption = {}) => { const self = this as unknown as IVChart; @@ -621,391 +612,360 @@ protected _renderSync = (option: IVChartRenderOption = {}) => { this._compiler?.render(option.morphConfig); this._afterRender(); return self; -}; - -``` -1. 动画状态的更新 - -在 `updateSpec` 和 `updateCustomConfigAndRerender` 方法中,`reAnimate` 标志用于决定是否重新触发动画: - -文件:`vchart.ts` 方法:`updateSpec` 和 `updateCustomConfigAndRerender` - +}; + +``` + +1. 动画状态的更新 + +在 `updateSpec` 和 `updateCustomConfigAndRerender` 方法中,`reAnimate` 标志用于决定是否重新触发动画: + +文件:`vchart.ts` 方法:`updateSpec` 和 `updateCustomConfigAndRerender` + ```xml if (userUpdateOptions?.reAnimate) { this.stopAnimation(); this._updateAnimateState(true); -} - -``` - - -### 动画系统设计概述 - - - -VChart的动画系统设计遵循模块化、可扩展和易于配置的原则,旨在为开发者提供一个灵活且强大的工具来创建丰富的动画效果。以下是该系统的几个关键组成部分及其工作原理: - -### 原理 - -#### 1. 动画接口与抽象 - - - -* **IAnimate 接口**:定义了所有动画必须实现的方法和属性,包括获取唯一的ID、更新动画状态以及获取状态信号名称。 - -* - -* **IAnimationSpec 接口**:规定了动画配置的结构,涵盖了从入场到退场的各种动画设置。 - - - -classDiagram - - class AnimationStateEnum { - - --枚举-- - - appear: AnimationStateEnum - - disappear: AnimationStateEnum - - enter: AnimationStateEnum - - update: AnimationStateEnum - - exit: AnimationStateEnum - - state: AnimationStateEnum - - normal: AnimationStateEnum - - none: AnimationStateEnum - - } - - - - class IAnimate { - - <> - - +updateAnimateState(state: AnimationStateEnum, noRender?: boolean): void - - +getAnimationStateSignalName(): string - - +id: number - - } - - - - class ICartesianGroupAnimationParams { - - <> - - +direction(): "x" | "y" - - +orient(): "positive" | "negative" - - +width(): number - - +height(): number - - } - - - - class AnimateManager { - - --属性-- - - -_stateMap: IAnimateState & StateMap - - +id: number - - --方法-- - - +updateAnimateState(state: AnimationStateEnum, noRender?: boolean): void - - +getAnimationStateSignalName(): string - - +constructor() - - } - - - - class MarkAnimationSpec { - - --属性-- - - appear: IAnimationConfig - - enter: IAnimationConfig - - update: IAnimationConfig[] - - exit: IAnimationConfig - - disappear: IAnimationConfig - - } - - - - class IAnimationSpec { - - --属性-- - - animationAppear: boolean | IStateAnimateSpec | IMarkAnimateSpec - - animationEnter: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec - - animationUpdate: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec - - animationExit: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec - - animationDisappear: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec - - animationState: boolean | IStateAnimationConfig - - animationNormal: IMarkAnimateSpec - - } - - - - class IStateAnimateSpec { - - --属性-- - - duration?: number - - delay?: number - - easing?: EasingType - - oneByOne?: boolean - - preset?: Preset | false - - } - - - - class ICommonStateAnimateSpec { - - --属性-- - - duration?: number - - delay?: number - - easing?: EasingType - - oneByOne?: boolean - - } - - - - class IMorphSeriesSpec { - - --属性-- - - enable?: boolean - - morphKey?: string - - morphElementKey?: string - - } - - - - class IAnimateState { - - --属性-- - - animationState: { callback: (datum: any, element: IElement) => AnimationStateEnum } - - } - - - - class IAnimationConfig { - - --属性-- - - type?: string - - channel?: string - - custom?: Function - - customParameters?: Function - - oneByOne?: boolean | number - - duration?: number - - easing?: EasingType - - delay?: number - - delayAfter?: number - - } - - - - % 关系 - - AnimationStateEnum "1" --|> "多" AnimateManager: 使用 - - AnimateManager "1" --|> "1" IAnimate: 实现 - - AnimateManager "1" -- "1" ICartesianGroupAnimationParams: 依赖 - - IAnimationSpec "1" -- "多" spec.ts: 定义于 - - MarkAnimationSpec "1" -- "1" config.ts: 由 config.ts 使用 - - IAnimationConfig "1" -- "多" utils.ts: 由 utils.ts 处理 - - IStateAnimateSpec "1" -- "1" ICommonStateAnimateSpec: 继承 - - IAnimationSpec "1" -- "1" IStateAnimateSpec: 关联 - - IAnimationSpec "1" -- "1" IMorphSeriesSpec: 关联 - - IAnimateState "1" -- "1" AnimateManager: 内部使用 - - IAnimationConfig "1" -- "1" ICommonStateAnimateSpec: 继承 - - - -#### 2. 动画管理器 - - - -* **AnimateManager 类**:继承自 `StateManager` 并实现了 `IAnimate` 接口,负责管理动画的状态,并提供方法来根据传入的状态更新动画。它处理动画状态的更新和检索,并根据不同状态更新动画状态。 - - - -#### 3. 工厂模式 - - - -* **Factory 类**:用于注册新的动画类型,允许将自定义动画逻辑添加到图表组件中。通过静态方法 `registerAnimation`,可以将特定类型的动画与其配置关联起来,方便后续调用。 - - - -#### 4. 动画配置生成 - - - -* **animationConfig 函数**:根据默认配置和用户提供的配置生成最终的动画配置。这个函数遍历所有的动画状态(如出现、进入、更新等),并根据用户配置或默认配置构建出完整的动画配置对象。 - - - -#### 5. 动画任务接口 - - - -* **IAnimationTask 接口**:定义了一个动画任务的数据结构,这对于理解复杂的动画序列非常重要。每个任务包含时间偏移、动作队列和后继任务列表,形成了一种链式动画执行机制。 - - - -#### 6. 动画的具体实现 - - - -* 每个具体的图表系列(如柱状图、饼图、散点图等)都有各自的动画实现文件,这些文件中包含了针对该系列的预设动画函数。例如,柱状图可能有生长动画、淡入动画等;饼图则可能有扇区展开动画等。 - - - - - -通过上述步骤,我们已经完成了一个简单但完整的动画流程创建。在这个过程中,我们利用了VChart动画系统的模块化设计,分别对图表配置、动画注册、实例化图表、数据更新以及动画状态管理进行了处理。这种设计不仅让代码更加清晰易读,同时也提高了系统的灵活性和可维护性。开发者可以根据实际需求轻松地定制不同类型的动画效果,从而提升用户体验。 - - - -为了更好地理解和解读这些源码文件,建议按照以下顺序阅读: - -1. `**interface.ts**` - -* **原因**:该文件定义了动画模块中的核心类型和接口,如 `AnimationStateEnum`、`IAnimateState` 和 `IAnimate` 等。理解这些类型和接口是后续代码的基础。 - -* **重点内容**: - -* 动画状态枚举 `AnimationStateEnum` - -* 动画状态接口 `IAnimateState` - -* 动画接口 `IAnimate` - -1. `**spec.ts**` - -* **原因**:该文件定义了动画配置的规范,包括 `ICommonStateAnimateSpec`、`IStateAnimateSpec` 和 `IAnimationSpec` 等。这些规范在实际动画配置中会被使用,因此需要先了解它们的结构。 - -* **重点内容**: - -* 动画配置的通用属性 `ICommonStateAnimateSpec` - -* 动画状态配置 `IStateAnimateSpec` - -* 动画规范 `IAnimationSpec` - -1. `**config.ts**` - -* **原因**:该文件提供了默认的动画配置和一些预设的动画注册函数。理解这些默认配置有助于理解如何自定义动画配置。 - -* **重点内容**: - -* 默认动画配置 `DEFAULT_ANIMATION_CONFIG` - -* 预设动画注册函数(如 `registerScaleInOutAnimation`、`registerFadeInOutAnimation` 等) - -1. `**utils.ts**` - -* **原因**:该文件包含了许多辅助函数,用于生成和处理动画配置。理解这些函数的工作原理可以帮助你更好地理解动画配置是如何被应用的。 - -* **重点内容**: - -* 生成动画配置的函数 `animationConfig` - -* 处理用户动画配置的函数 `userAnimationConfig` - -* 辅助函数(如 `produceOneByOne`、`shouldMarkDoMorph` 等) - -1. `**animate-manager.ts**` - -* **原因**:该文件实现了 `AnimateManager` 类,它是管理动画的核心类。理解这个类的实现可以让你知道动画是如何被管理和更新的。 - -* **重点内容**: - -* `AnimateManager` 类的实现 - -* 更新动画状态的方法 `updateAnimateState` - -* 获取动画状态信号名称的方法 `getAnimationStateSignalName` - -### 总结 - -按照上述顺序阅读这些文件,可以逐步建立起对整个动画模块的理解。从基础的类型和接口开始,逐步深入到具体的配置和实现细节,最终理解动画是如何被管理和应用的。 - -### 阅读顺序总结 - -* `**interface.ts**` 核心类型和接口 - -* `**spec.ts**` 动画配置规范 - -* `**config.ts**` 默认配置和预设动画 - -* `**utils.ts**` 辅助函数和配置生成 - -* `**animate-manager.ts**`动画管理类实现 - - # 本文档由以下人员修正整理 - [玄魂](https://github.com/xuanhun) \ No newline at end of file +} + +``` + +### 动画系统设计概述 + +VChart的动画系统设计遵循模块化、可扩展和易于配置的原则,旨在为开发者提供一个灵活且强大的工具来创建丰富的动画效果。以下是该系统的几个关键组成部分及其工作原理: + +### 原理 + +#### 1. 动画接口与抽象 + +- **IAnimate 接口**:定义了所有动画必须实现的方法和属性,包括获取唯一的ID、更新动画状态以及获取状态信号名称。 + +- + +- **IAnimationSpec 接口**:规定了动画配置的结构,涵盖了从入场到退场的各种动画设置。 + +classDiagram + + class AnimationStateEnum { + + --枚举-- + + appear: AnimationStateEnum + + disappear: AnimationStateEnum + + enter: AnimationStateEnum + + update: AnimationStateEnum + + exit: AnimationStateEnum + + state: AnimationStateEnum + + normal: AnimationStateEnum + + none: AnimationStateEnum + + } + + + + class IAnimate { + + <> + + +updateAnimateState(state: AnimationStateEnum, noRender?: boolean): void + + +getAnimationStateSignalName(): string + + +id: number + + } + + + + class ICartesianGroupAnimationParams { + + <> + + +direction(): "x" | "y" + + +orient(): "positive" | "negative" + + +width(): number + + +height(): number + + } + + + + class AnimateManager { + + --属性-- + + -_stateMap: IAnimateState & StateMap + + +id: number + + --方法-- + + +updateAnimateState(state: AnimationStateEnum, noRender?: boolean): void + + +getAnimationStateSignalName(): string + + +constructor() + + } + + + + class MarkAnimationSpec { + + --属性-- + + appear: IAnimationConfig + + enter: IAnimationConfig + + update: IAnimationConfig[] + + exit: IAnimationConfig + + disappear: IAnimationConfig + + } + + + + class IAnimationSpec { + + --属性-- + + animationAppear: boolean | IStateAnimateSpec | IMarkAnimateSpec + + animationEnter: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec + + animationUpdate: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec + + animationExit: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec + + animationDisappear: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec + + animationState: boolean | IStateAnimationConfig + + animationNormal: IMarkAnimateSpec + + } + + + + class IStateAnimateSpec { + + --属性-- + + duration?: number + + delay?: number + + easing?: EasingType + + oneByOne?: boolean + + preset?: Preset | false + + } + + + + class ICommonStateAnimateSpec { + + --属性-- + + duration?: number + + delay?: number + + easing?: EasingType + + oneByOne?: boolean + + } + + + + class IMorphSeriesSpec { + + --属性-- + + enable?: boolean + + morphKey?: string + + morphElementKey?: string + + } + + + + class IAnimateState { + + --属性-- + + animationState: { callback: (datum: any, element: IElement) => AnimationStateEnum } + + } + + + + class IAnimationConfig { + + --属性-- + + type?: string + + channel?: string + + custom?: Function + + customParameters?: Function + + oneByOne?: boolean | number + + duration?: number + + easing?: EasingType + + delay?: number + + delayAfter?: number + + } + + + + % 关系 + + AnimationStateEnum "1" --|> "多" AnimateManager: 使用 + + AnimateManager "1" --|> "1" IAnimate: 实现 + + AnimateManager "1" -- "1" ICartesianGroupAnimationParams: 依赖 + + IAnimationSpec "1" -- "多" spec.ts: 定义于 + + MarkAnimationSpec "1" -- "1" config.ts: 由 config.ts 使用 + + IAnimationConfig "1" -- "多" utils.ts: 由 utils.ts 处理 + + IStateAnimateSpec "1" -- "1" ICommonStateAnimateSpec: 继承 + + IAnimationSpec "1" -- "1" IStateAnimateSpec: 关联 + + IAnimationSpec "1" -- "1" IMorphSeriesSpec: 关联 + + IAnimateState "1" -- "1" AnimateManager: 内部使用 + + IAnimationConfig "1" -- "1" ICommonStateAnimateSpec: 继承 + +#### 2. 动画管理器 + +- **AnimateManager 类**:继承自 `StateManager` 并实现了 `IAnimate` 接口,负责管理动画的状态,并提供方法来根据传入的状态更新动画。它处理动画状态的更新和检索,并根据不同状态更新动画状态。 + +#### 3. 工厂模式 + +- **Factory 类**:用于注册新的动画类型,允许将自定义动画逻辑添加到图表组件中。通过静态方法 `registerAnimation`,可以将特定类型的动画与其配置关联起来,方便后续调用。 + +#### 4. 动画配置生成 + +- **animationConfig 函数**:根据默认配置和用户提供的配置生成最终的动画配置。这个函数遍历所有的动画状态(如出现、进入、更新等),并根据用户配置或默认配置构建出完整的动画配置对象。 + +#### 5. 动画任务接口 + +- **IAnimationTask 接口**:定义了一个动画任务的数据结构,这对于理解复杂的动画序列非常重要。每个任务包含时间偏移、动作队列和后继任务列表,形成了一种链式动画执行机制。 + +#### 6. 动画的具体实现 + +- 每个具体的图表系列(如柱状图、饼图、散点图等)都有各自的动画实现文件,这些文件中包含了针对该系列的预设动画函数。例如,柱状图可能有生长动画、淡入动画等;饼图则可能有扇区展开动画等。 + +通过上述步骤,我们已经完成了一个简单但完整的动画流程创建。在这个过程中,我们利用了VChart动画系统的模块化设计,分别对图表配置、动画注册、实例化图表、数据更新以及动画状态管理进行了处理。这种设计不仅让代码更加清晰易读,同时也提高了系统的灵活性和可维护性。开发者可以根据实际需求轻松地定制不同类型的动画效果,从而提升用户体验。 + +为了更好地理解和解读这些源码文件,建议按照以下顺序阅读: + +1. `**interface.ts**` + +- **原因**:该文件定义了动画模块中的核心类型和接口,如 `AnimationStateEnum`、`IAnimateState` 和 `IAnimate` 等。理解这些类型和接口是后续代码的基础。 + +- **重点内容**: + +- 动画状态枚举 `AnimationStateEnum` + +- 动画状态接口 `IAnimateState` + +- 动画接口 `IAnimate` + +1. `**spec.ts**` + +- **原因**:该文件定义了动画配置的规范,包括 `ICommonStateAnimateSpec`、`IStateAnimateSpec` 和 `IAnimationSpec` 等。这些规范在实际动画配置中会被使用,因此需要先了解它们的结构。 + +- **重点内容**: + +- 动画配置的通用属性 `ICommonStateAnimateSpec` + +- 动画状态配置 `IStateAnimateSpec` + +- 动画规范 `IAnimationSpec` + +1. `**config.ts**` + +- **原因**:该文件提供了默认的动画配置和一些预设的动画注册函数。理解这些默认配置有助于理解如何自定义动画配置。 + +- **重点内容**: + +- 默认动画配置 `DEFAULT_ANIMATION_CONFIG` + +- 预设动画注册函数(如 `registerScaleInOutAnimation`、`registerFadeInOutAnimation` 等) + +1. `**utils.ts**` + +- **原因**:该文件包含了许多辅助函数,用于生成和处理动画配置。理解这些函数的工作原理可以帮助你更好地理解动画配置是如何被应用的。 + +- **重点内容**: + +- 生成动画配置的函数 `animationConfig` + +- 处理用户动画配置的函数 `userAnimationConfig` + +- 辅助函数(如 `produceOneByOne`、`shouldMarkDoMorph` 等) + +1. `**animate-manager.ts**` + +- **原因**:该文件实现了 `AnimateManager` 类,它是管理动画的核心类。理解这个类的实现可以让你知道动画是如何被管理和更新的。 + +- **重点内容**: + +- `AnimateManager` 类的实现 + +- 更新动画状态的方法 `updateAnimateState` + +- 获取动画状态信号名称的方法 `getAnimationStateSignalName` + +### 总结 + +按照上述顺序阅读这些文件,可以逐步建立起对整个动画模块的理解。从基础的类型和接口开始,逐步深入到具体的配置和实现细节,最终理解动画是如何被管理和应用的。 + +### 阅读顺序总结 + +- `**interface.ts**` 核心类型和接口 + +- `**spec.ts**` 动画配置规范 + +- `**config.ts**` 默认配置和预设动画 + +- `**utils.ts**` 辅助函数和配置生成 + +- `**animate-manager.ts**`动画管理类实现 + +# 本文档由以下人员修正整理 + +[玄魂](https://github.com/xuanhun) diff --git a/docs/assets/contributing/zh/sourcesode/10.1-animation-concepts-and-types.md b/docs/assets/contributing/zh/sourcesode/10.1-animation-concepts-and-types.md index bb93e38cb6..18eb91d949 100644 --- a/docs/assets/contributing/zh/sourcesode/10.1-animation-concepts-and-types.md +++ b/docs/assets/contributing/zh/sourcesode/10.1-animation-concepts-and-types.md @@ -1,232 +1,224 @@ --- -title: 10.1 动画的概念和类型 +title: 10.1 动画的概念和类型 key words: VisActor,VChart,VTable,VStrory,VMind,VGrammar,VRender,Visualization,Chart,Data,Table,Graph,Gis,LLM ---- -> 10.1 动画的概念和类型 -> 分数:4 -> 1. 动画的概念和类型: -> 1. 其他参考文档: -> https://www.visactor.io/vchart/guide/tutorial_docs/Animation/Animation_Types -> -> [魔力之帧(下):VChart 动画编程实践在这篇文章中,我们将从一些常见的图表动画入手,详细介绍在 VChart 中的编 - 掘金](https://juejin.cn/post/7314829865633595443) - -1. 代码入口:`packages/vchart/src/animation/` - -`packages/vchart/src/series/line/animation` - -`packages/vchart/src/core/vchart` - -`packages/vchart/src/core/interface` - -`packages/vchart/src/complie/mark` - -1. 解读重点: - -1. 动画分类(按执行时机,按效果) - -1. 动画系统的整体设计 - -# 动画的概念 - - - -在VChart中,动画是指在图表渲染过程中,通过视觉效果来增强数据展示的动态性和交互性。动画系统允许开发者配置和控制图表元素(如柱状图、饼图、折线图等)在不同状态下的过渡效果。 - -在 VisActor 中动画被视作为渲染阶段的修饰:动画配置与图形语法流程执行得到的图元视觉通道一起决定了渲染阶段的结果。动画的表现是具体图形元素在某一时间段内视觉通道属性的插值计算或者特殊计算逻辑,而动画配置描述了这一计算的触发时机以及执行时长。 - - - -## 动画的分类 - -#### 生命周期示范 - -![](https://cdn.jsdelivr.net/gh/xuanhun/articles/visactor/sourcecode/img/OgJ0wqt4khXJtrbwW3Zc2521nOc.gif) - - - -### 按执行时机分类 - -图表动画在 VChart 中根据状态场景(执行时机)会被区分为:**图表入场动画**、**数据更新动画**和**图表退场动画**。 - -1. **图表入场动画:**是指图表创建时的动画效果。 - -1. **数据更新动画:**当我们更新图表数据时,图元发生的属性动画则称为数据更新动画。分为:**新增图元动画**、**图元更新动画**和**退场图元动画、状态变更动画、任意时机触发的动画**。通常情况下,你不需要考虑如何控制这三种更新动画,因为 VChart 会在数据更新时,识别出新数据与上一次数据间的关联,从而正确执行更新动画。 - -1. **图表退场动画**:在某些场景下,我们可能需要移除图表。此时,我们可以为图表设置退场动画,让图表在除之前有一个平滑过渡的动画效果。 - -![](https://cdn.jsdelivr.net/gh/xuanhun/articles/visactor/sourcecode/img/Ddzewl0jjhq1ksbmUlbc2WPSnig.gif) - -https://visactor.io/vchart/guide/tutorial_docs/Animation/Animation_Types 动画教程文档 - -https://www.visactor.io/vchart/option/barChart#animationState 动画配置文档 - -#### 图表**入场动画 (**`**animationAppear**`**)**: - -* 在图表首次渲染时,元素从无到有的过渡效果。 - -* 示例代码:`animationAppear` 配置项用于定义图表入场动画。 - - - +--- + +> 10.1 动画的概念和类型 +> 分数:4 +> +> 1. 动画的概念和类型: +> 1. 其他参考文档: +> https://www.visactor.io/vchart/guide/tutorial_docs/Animation/Animation_Types +> +> [魔力之帧(下):VChart 动画编程实践在这篇文章中,我们将从一些常见的图表动画入手,详细介绍在 VChart 中的编 - 掘金](https://juejin.cn/post/7314829865633595443) + +1. 代码入口:`packages/vchart/src/animation/` + +`packages/vchart/src/series/line/animation` + +`packages/vchart/src/core/vchart` + +`packages/vchart/src/core/interface` + +`packages/vchart/src/complie/mark` + +1. 解读重点: + +1. 动画分类(按执行时机,按效果) + +1. 动画系统的整体设计 + +# 动画的概念 + +在VChart中,动画是指在图表渲染过程中,通过视觉效果来增强数据展示的动态性和交互性。动画系统允许开发者配置和控制图表元素(如柱状图、饼图、折线图等)在不同状态下的过渡效果。 + +在 VisActor 中动画被视作为渲染阶段的修饰:动画配置与图形语法流程执行得到的图元视觉通道一起决定了渲染阶段的结果。动画的表现是具体图形元素在某一时间段内视觉通道属性的插值计算或者特殊计算逻辑,而动画配置描述了这一计算的触发时机以及执行时长。 + + + +## 动画的分类 + +#### 生命周期示范 + +![](https://cdn.jsdelivr.net/gh/xuanhun/articles/visactor/sourcecode/img/OgJ0wqt4khXJtrbwW3Zc2521nOc.gif) + +### 按执行时机分类 + +图表动画在 VChart 中根据状态场景(执行时机)会被区分为:**图表入场动画**、**数据更新动画**和**图表退场动画**。 + +1. **图表入场动画:**是指图表创建时的动画效果。 + +1. **数据更新动画:**当我们更新图表数据时,图元发生的属性动画则称为数据更新动画。分为:**新增图元动画**、**图元更新动画**和**退场图元动画、状态变更动画、任意时机触发的动画**。通常情况下,你不需要考虑如何控制这三种更新动画,因为 VChart 会在数据更新时,识别出新数据与上一次数据间的关联,从而正确执行更新动画。 + +1. **图表退场动画**:在某些场景下,我们可能需要移除图表。此时,我们可以为图表设置退场动画,让图表在除之前有一个平滑过渡的动画效果。 + +![](https://cdn.jsdelivr.net/gh/xuanhun/articles/visactor/sourcecode/img/Ddzewl0jjhq1ksbmUlbc2WPSnig.gif) + +https://visactor.io/vchart/guide/tutorial_docs/Animation/Animation_Types 动画教程文档 + +https://www.visactor.io/vchart/option/barChart#animationState 动画配置文档 + +#### 图表**入场动画 (**`**animationAppear**`**)**: + +- 在图表首次渲染时,元素从无到有的过渡效果。 + +- 示例代码:`animationAppear` 配置项用于定义图表入场动画。 + + + ```html - -
- - - -``` + +
+ + +``` + ```xml -animationAppear?: boolean | IStateAnimateSpec | IMarkAnimateSpec; - -``` -#### 数据更新动画 - -当我们更新图表数据时,图元发生的属性动画则称为更新动画。在 VChart 中,用户手动调用 `updateData` 接口会触发图表数据更新,另外,点击图例时也更新图表数据。更新动画分为三类:新增图元动画、图元更新动画和退场图元动画。 - -1. **新增图元动画 (**`**animationEnter**`**)**: - -* 新增图元动画是指当图表数据更新时,新添加数据应的图元的动画效果。 - -* 我们可以使用 `animationEnter` 配置来设置新增图元动画。 - +animationAppear?: boolean | IStateAnimateSpec | IMarkAnimateSpec; + +``` + +#### 数据更新动画 + +当我们更新图表数据时,图元发生的属性动画则称为更新动画。在 VChart 中,用户手动调用 `updateData` 接口会触发图表数据更新,另外,点击图例时也更新图表数据。更新动画分为三类:新增图元动画、图元更新动画和退场图元动画。 + +1. **新增图元动画 (**`**animationEnter**`**)**: + +- 新增图元动画是指当图表数据更新时,新添加数据应的图元的动画效果。 + +- 我们可以使用 `animationEnter` 配置来设置新增图元动画。 + ```xml -animationEnter?: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec; - -``` - - -1. **图元更新动画 ( **`**animationUpdate**`**)**: - -* 图元更新动画是指当图表数据更新,原有数据对应的图元的更新动画效果。 - -* 我们可以使用 `animationUpdate` 配置来设置图元更新动画。 - +animationEnter?: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec; + +``` + +1. **图元更新动画 ( **`**animationUpdate**`**)**: + +- 图元更新动画是指当图表数据更新,原有数据对应的图元的更新动画效果。 + +- 我们可以使用 `animationUpdate` 配置来设置图元更新动画。 + ```xml -animationUpdate?: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec; - -``` - - -1. **退场图元动画 (**`**animationExit**`** )**: - -* 退图元动画是指当图表数据更新时,被删除数据所对应图元的动画效果。我们可以使用 `animationExit` 配置来设置退场图元动画。 - +animationUpdate?: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec; + +``` + +1. **退场图元动画 (**`**animationExit**`** )**: + +- 退图元动画是指当图表数据更新时,被删除数据所对应图元的动画效果。我们可以使用 `animationExit` 配置来设置退场图元动画。 + ```xml -animationExit?: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec; - -``` - - -1. 图元**状态切换动画 (State)**: - -* 当图表状态发生改变时的过渡效果。 - -* 示例代码:`animationState` 配置项用于定义状态切换动画。 - +animationExit?: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec; + +``` + +1. 图元**状态切换动画 (State)**: + +- 当图表状态发生改变时的过渡效果。 + +- 示例代码:`animationState` 配置项用于定义状态切换动画。 + ```xml -animationState?: boolean | IStateAnimationConfig; - -``` - - -1. 常态**动画 (Normal)**:常用于循环 - -* 用于定义持续不断的动画效果。 - -* 示例代码:`animationNormal` 配置项用于定义循环动画。 - +animationState?: boolean | IStateAnimationConfig; + +``` + +1. 常态**动画 (Normal)**:常用于循环 + +- 用于定义持续不断的动画效果。 + +- 示例代码:`animationNormal` 配置项用于定义循环动画。 + ```xml -animationNormal?: IMarkAnimateSpec; - -``` - - -#### 图表**退场动画 (**`**animationDisappear**`**)**: - -* 在图表销毁或隐藏时,元素的退场效果。 - +animationNormal?: IMarkAnimateSpec; + +``` + +#### 图表**退场动画 (**`**animationDisappear**`**)**: + +- 在图表销毁或隐藏时,元素的退场效果。 + ```xml - animationDisappear?: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec; - -``` -### 按效果分类 - -type 图元原子化 - -* 动画效果:动画效果描述了在某一特定的动画阶段中图元以怎样的方式执行渲染的变化。动画效果包括普通的视觉通道插值,例如竞速条形图中柱子颜色、宽度、位置的变化;同时动画效果也包含一些特殊的变化,例如下图中的图元形变。 - -1. **渐入渐出 (FadeIn/FadeOut)**: - -* 元素透明度从0到1或从1到0的变化。 - -* 示例代码:`Appear_FadeIn` 和 `Disappear_FadeOut`。 - + animationDisappear?: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec; + +``` + +### 按效果分类 + +type 图元原子化 + +- 动画效果:动画效果描述了在某一特定的动画阶段中图元以怎样的方式执行渲染的变化。动画效果包括普通的视觉通道插值,例如竞速条形图中柱子颜色、宽度、位置的变化;同时动画效果也包含一些特殊的变化,例如下图中的图元形变。 + +1. **渐入渐出 (FadeIn/FadeOut)**: + +- 元素透明度从0到1或从1到0的变化。 + +- 示例代码:`Appear_FadeIn` 和 `Disappear_FadeOut`。 + ```xml const Appear_FadeIn: IAnimationTypeConfig = { type: 'fadeIn' -}; - -``` - - -1. **生长 (Grow)**: - -* 元素从某个初始尺寸逐渐增长到最终尺寸。 - -* 示例代码:`barGrowOption` 和 `pieGrowOption`。 - +}; + +``` + +1. **生长 (Grow)**: + +- 元素从某个初始尺寸逐渐增长到最终尺寸。 + +- 示例代码:`barGrowOption` 和 `pieGrowOption`。 + ```xml -function barGrowOption(barParams: IBarAnimationParams, isOverall = true) {/***/} - -``` - - -1. **裁剪 (Clip)**: - -* 通过裁剪区域来显示元素的逐步出现或消失。 - -* 示例代码:`registerCartesianGroupClipAnimation`。 - +function barGrowOption(barParams: IBarAnimationParams, isOverall = true) {/***/} + +``` + +1. **裁剪 (Clip)**: + +- 通过裁剪区域来显示元素的逐步出现或消失。 + +- 示例代码:`registerCartesianGroupClipAnimation`。 + ```xml const registerCartesianGroupClipAnimation = () => { Factory.registerAnimation('cartesianGroupClip', (params?: ICartesianGroupAnimationParams) => {/***/}); -}; - -``` - - -1. **波浪 (Wave)**: - -* 特殊效果,如液态图中的波浪效果。 - -* 示例代码:`Appear_Wave`。 - +}; + +``` + +1. **波浪 (Wave)**: + +- 特殊效果,如液态图中的波浪效果。 + +- 示例代码:`Appear_Wave`。 + ```xml const Appear_Wave: IAnimationTypeConfig = { duration: 2000, @@ -234,131 +226,125 @@ const Appear_Wave: IAnimationTypeConfig = { channel: { wave: { from: 0, to: 1 } } -}; - -``` - - -1. **缩放 (Scale)**: - -* 元素大小从一个比例缩放到另一个比例。 - -* 示例代码:`Appear_ScaleIn`。 - +}; + +``` + +1. **缩放 (Scale)**: + +- 元素大小从一个比例缩放到另一个比例。 + +- 示例代码:`Appear_ScaleIn`。 + ```xml const Appear_ScaleIn: IAnimationTypeConfig = { type: 'growCenterIn' -}; - -``` -更多动画效果的属性和配置可参考https://visactor.com/vchart/guide/tutorial_docs/Animation/Animation_Attributes_and_Settings - -## 动画系统的设计 - -### 简单柱状图动画配置 - - - -下面以创建一个简单的柱状图为例,说明如何使用VChart的动画系统来实现基本动画效果的原理。 - - - - - +}; + +``` + +更多动画效果的属性和配置可参考https://visactor.com/vchart/guide/tutorial_docs/Animation/Animation_Attributes_and_Settings + +## 动画系统的设计 + +### 简单柱状图动画配置 + +下面以创建一个简单的柱状图为例,说明如何使用VChart的动画系统来实现基本动画效果的原理。 + + + ```html - - -
- - - -``` -> 如何创建一个基础VChart可以参考以下文档 -> https://www.visactor.io/vchart/guide/tutorial_docs/Getting_Started 快速上手 -> https://www.visactor.io/vchart/guide/tutorial_docs/Basic/How_to_Import_VChart 导入VChart -> https://www.visactor.io/vchart/guide/tutorial_docs/Basic/A_Basic_Spec 基础配置 -> https://www.visactor.io/vchart/guide/tutorial_docs/Basic/DeepSeek_With_Cursor DeepSeek+Cursor助力 - - - -在 `VChart` 类中,`spec`(图表配置)中的 `animation` 配置项用于控制图表的动画行为。具体来说,`animation` 配置项可以定义图表在不同状态下的动画效果,例如入场动画、更新动画、退出动画等。 - -#### `animation` 配置的作用 - -1. **定义动画行为**: - -* `animation` 配置项可以包含多个子属性,如 `appear`、`enter`、`update`、`exit` 和 `disappear`,分别对应不同的动画场景。 - -* 每个子属性可以进一步配置动画的持续时间 (`duration`)、缓动函数 (`easing`)、是否逐个执行 (`oneByOne`) 等参数。 - -1. **控制动画开关**: - -* 如果将 `animation` 设置为 `false`,则禁用所有动画效果。 - -* 如果设置为 `true` 或者提供具体的配置对象,则启用相应的动画效果。 - -1. **传递给底层组件**: - -* `VChart` 类会将 `animation` 配置传递给内部的 `Compiler` 和 `Chart` 实例,这些实例会根据配置来决定是否应用动画以及如何应用动画。 - -### 柱状图执行动画示例说明 - - - -
#### 示例代码 + + +
+ + +``` + +> 如何创建一个基础VChart可以参考以下文档 +> https://www.visactor.io/vchart/guide/tutorial_docs/Getting_Started 快速上手 +> https://www.visactor.io/vchart/guide/tutorial_docs/Basic/How_to_Import_VChart 导入VChart +> https://www.visactor.io/vchart/guide/tutorial_docs/Basic/A_Basic_Spec 基础配置 +> https://www.visactor.io/vchart/guide/tutorial_docs/VChart_Skill_Usage VChart Skill 使用 + +在 `VChart` 类中,`spec`(图表配置)中的 `animation` 配置项用于控制图表的动画行为。具体来说,`animation` 配置项可以定义图表在不同状态下的动画效果,例如入场动画、更新动画、退出动画等。 + +#### `animation` 配置的作用 + +1. **定义动画行为**: + +- `animation` 配置项可以包含多个子属性,如 `appear`、`enter`、`update`、`exit` 和 `disappear`,分别对应不同的动画场景。 + +- 每个子属性可以进一步配置动画的持续时间 (`duration`)、缓动函数 (`easing`)、是否逐个执行 (`oneByOne`) 等参数。 + +1. **控制动画开关**: + +- 如果将 `animation` 设置为 `false`,则禁用所有动画效果。 + +- 如果设置为 `true` 或者提供具体的配置对象,则启用相应的动画效果。 + +1. **传递给底层组件**: + +- `VChart` 类会将 `animation` 配置传递给内部的 `Compiler` 和 `Chart` 实例,这些实例会根据配置来决定是否应用动画以及如何应用动画。 + +### 柱状图执行动画示例说明 + + + +
#### 示例代码 ```xml import { isMobile } from 'react-device-detect'; import { default as VChart } from '../../../../src/index'; // 1. 创建图表配置项与数据 const initialSpec = { - type: 'bar', - data: [ - { - id: 'barData', - values: [ - { month: 'January', sales: 22 }, - { month: 'February', sales: 13 }, - { month: 'March', sales: 25 }, - { month: 'April', sales: 29 }, - { month: 'May', sales: 38 } - ] - } - ], - xField: 'month', - yField: 'sales', - crosshair: { - xField: { visible: true } - }, - animation: true // 开启动画 +type: 'bar', +data: [ +{ +id: 'barData', +values: [ +{ month: 'January', sales: 22 }, +{ month: 'February', sales: 13 }, +{ month: 'March', sales: 25 }, +{ month: 'April', sales: 29 }, +{ month: 'May', sales: 38 } +] +} +], +xField: 'month', +yField: 'sales', +crosshair: { +xField: { visible: true } +}, +animation: true // 开启动画 }; // 2. 创建 VChart 实例 @@ -366,146 +352,147 @@ const vchart = new VChart(initialSpec, { dom: 'chart' }); // 3. 渲染图表 vchart.renderAsync().then(() => { - console.log('图表渲染完成'); +console.log('图表渲染完成'); }); // 4. 动画入场 setTimeout(() => { - console.log('动画入场'); +console.log('动画入场'); }, 1000); // 5. 数据更新(新增图元) setTimeout(() => { - const newData = [ - { month: 'June', sales: 45 }, - { month: 'July', sales: 50 } - ]; - vchart.updateDataSync('barData', newData, undefined, { reAnimate: true }); - console.log('新增图元'); +const newData = [ +{ month: 'June', sales: 45 }, +{ month: 'July', sales: 50 } +]; +vchart.updateDataSync('barData', newData, undefined, { reAnimate: true }); +console.log('新增图元'); }, 3000); // 6. 数据更新(图元更新) setTimeout(() => { - const updatedData = [ - { month: 'January', sales: 30 }, - { month: 'February', sales: 20 }, - { month: 'March', sales: 35 }, - { month: 'April', sales: 39 }, - { month: 'May', sales: 48 }, - { month: 'June', sales: 55 }, - { month: 'July', sales: 60 } - ]; - vchart.updateDataSync('barData', updatedData, undefined, { reAnimate: true }); - console.log('图元更新'); +const updatedData = [ +{ month: 'January', sales: 30 }, +{ month: 'February', sales: 20 }, +{ month: 'March', sales: 35 }, +{ month: 'April', sales: 39 }, +{ month: 'May', sales: 48 }, +{ month: 'June', sales: 55 }, +{ month: 'July', sales: 60 } +]; +vchart.updateDataSync('barData', updatedData, undefined, { reAnimate: true }); +console.log('图元更新'); }, 6000); // 7. 数据更新(图元退出) setTimeout(() => { - const remainingData = [ - { month: 'January', sales: 30 }, - { month: 'February', sales: 20 }, - { month: 'March', sales: 35 }, - { month: 'April', sales: 39 }, - { month: 'May', sales: 48 } - ]; - vchart.updateDataSync('barData', remainingData, undefined, { reAnimate: true }); - console.log('图元退出'); +const remainingData = [ +{ month: 'January', sales: 30 }, +{ month: 'February', sales: 20 }, +{ month: 'March', sales: 35 }, +{ month: 'April', sales: 39 }, +{ month: 'May', sales: 48 } +]; +vchart.updateDataSync('barData', remainingData, undefined, { reAnimate: true }); +console.log('图元退出'); }, 9000); // 8. 图元状态(state)的使用 setTimeout(() => { - vchart.updateState( - { - selected: { - style: { - fill: 'red' - } - } - }, - (series, mark, stateKey) => { - return mark.datum.sales > 40; - } - ); - console.log('图元状态更新'); +vchart.updateState( +{ +selected: { +style: { +fill: 'red' +} +} +}, +(series, mark, stateKey) => { +return mark.datum.sales > 40; +} +); +console.log('图元状态更新'); }, 12000); // 9. 图表退场 setTimeout(() => { - vchart.release(); - console.log('图表退场'); -}, 15000); - -```
#### 创建逻辑说明 -1. **创建图表配置项与数据**: -1. **创建 VChart 实例**: -1. **渲染图表**: -1. **动画入场**: -1. **数据更新(新增图元)**: -1. **数据更新(图元更新)**: -1. **数据更新(图元退出)**: -1. **图元状态(state)的使用**: -1. **图表退场**: - -
-* 定义了一个初始的图表配置项`initialSpec`,其中包含图表类型、数据、坐标轴字段和动画配置。 - -* 数据部分包含了一个`barData`的数据集,初始包含5个月的销售数据。 - -* 使用`initialSpec`和DOM容器`chart`创建一个VChart实例。 - -* 调用`renderAsync`方法异步渲染图表。图表渲染完成后,会触发动画入场效果。 - -* 在渲染完成后,通过`setTimeout`模拟动画入场。实际动画效果由VChart内部处理。 - -* 在3秒后,通过`updateDataSync`方法新增两个月的销售数据。`reAnimate: true`参数确保新增数据时有动画效果。 - -* 在6秒后,通过`updateDataSync`方法更新所有图元的数据。`reAnimate: true`参数确保更新数据时有动画效果。 - -* 在9秒后,通过`updateDataSync`方法移除两个月的销售数据。`reAnimate: true`参数确保移除数据时有动画效果。 - -* 在12秒后,通过`updateState`方法更新图元的状态。这里设置了一个`selected`状态,当图元的`sales`值大于40时,图元的填充颜色变为红色。 - -* 在15秒后,通过`release`方法销毁图表实例,图表退场。 - ---- - - -
#### 动画流程图 -
#### 流程说明 -1. **创建图表配置项与数据**:定义初始图表配置和数据。 -1. **创建 VChart 实例**:使用配置和DOM容器创建VChart实例。 -1. **渲染图表**:调用`renderAsync`方法渲染图表,触发动画入场效果。 -1. **动画入场**:图表渲染完成后,自动触发入场动画。 -1. **数据更新(新增图元)**:通过`updateDataSync`方法新增数据,触发新增动画。 -1. **数据更新(图元更新)**:通过`updateDataSync`方法更新数据,触发更新动画。 -1. **数据更新(图元退出)**:通过`updateDataSync`方法移除数据,触发退出动画。 -1. **图元状态(state)的使用**:通过`updateState`方法更新图元状态,设置特定条件下的样式。 -1. **图表退场**:通过`release`方法销毁图表实例,图表退场。 - -
-### 源码实现流程 - -1. **初始化 VChart 实例** - -当你创建一个 `VChart` 实例并传入 `spec` 时,构造函数会处理 `animation` 配置: - -文件:`vchart.ts` 方法:`constructor` - +vchart.release(); +console.log('图表退场'); +}, 15000); + +````
#### 创建逻辑说明 +1. **创建图表配置项与数据**: +1. **创建 VChart 实例**: +1. **渲染图表**: +1. **动画入场**: +1. **数据更新(新增图元)**: +1. **数据更新(图元更新)**: +1. **数据更新(图元退出)**: +1. **图元状态(state)的使用**: +1. **图表退场**: + +
+* 定义了一个初始的图表配置项`initialSpec`,其中包含图表类型、数据、坐标轴字段和动画配置。 + +* 数据部分包含了一个`barData`的数据集,初始包含5个月的销售数据。 + +* 使用`initialSpec`和DOM容器`chart`创建一个VChart实例。 + +* 调用`renderAsync`方法异步渲染图表。图表渲染完成后,会触发动画入场效果。 + +* 在渲染完成后,通过`setTimeout`模拟动画入场。实际动画效果由VChart内部处理。 + +* 在3秒后,通过`updateDataSync`方法新增两个月的销售数据。`reAnimate: true`参数确保新增数据时有动画效果。 + +* 在6秒后,通过`updateDataSync`方法更新所有图元的数据。`reAnimate: true`参数确保更新数据时有动画效果。 + +* 在9秒后,通过`updateDataSync`方法移除两个月的销售数据。`reAnimate: true`参数确保移除数据时有动画效果。 + +* 在12秒后,通过`updateState`方法更新图元的状态。这里设置了一个`selected`状态,当图元的`sales`值大于40时,图元的填充颜色变为红色。 + +* 在15秒后,通过`release`方法销毁图表实例,图表退场。 + +--- + + +
#### 动画流程图 +
#### 流程说明 +1. **创建图表配置项与数据**:定义初始图表配置和数据。 +1. **创建 VChart 实例**:使用配置和DOM容器创建VChart实例。 +1. **渲染图表**:调用`renderAsync`方法渲染图表,触发动画入场效果。 +1. **动画入场**:图表渲染完成后,自动触发入场动画。 +1. **数据更新(新增图元)**:通过`updateDataSync`方法新增数据,触发新增动画。 +1. **数据更新(图元更新)**:通过`updateDataSync`方法更新数据,触发更新动画。 +1. **数据更新(图元退出)**:通过`updateDataSync`方法移除数据,触发退出动画。 +1. **图元状态(state)的使用**:通过`updateState`方法更新图元状态,设置特定条件下的样式。 +1. **图表退场**:通过`release`方法销毁图表实例,图表退场。 + +
+### 源码实现流程 + +1. **初始化 VChart 实例** + +当你创建一个 `VChart` 实例并传入 `spec` 时,构造函数会处理 `animation` 配置: + +文件:`vchart.ts` 方法:`constructor` + ```xml constructor(spec: ISpec, options: IInitOption) { this._option = mergeOrigin(this._option, { animation: (spec as any).animation !== false }, options); *// ...* -} - -``` -这段代码确保了如果 `spec` 中没有显式禁用动画(即 `animation !== false`),则启用动画。 - -1. 设置新 spec 并初始化图表 - -在 `VChart` 类中,`_setNewSpec` 方法用于设置新的 `spec`,并将其转换为内部使用的格式: - -文件:`vchart.ts` 方法:`_setNewSpec` - +} + +```` + +这段代码确保了如果 `spec` 中没有显式禁用动画(即 `animation !== false`),则启用动画。 + +1. 设置新 spec 并初始化图表 + +在 `VChart` 类中,`_setNewSpec` 方法用于设置新的 `spec`,并将其转换为内部使用的格式: + +文件:`vchart.ts` 方法:`_setNewSpec` + ```xml private _setNewSpec(spec: any, forceMerge?: boolean): boolean { if (!spec) { @@ -520,13 +507,14 @@ private _setNewSpec(spec: any, forceMerge?: boolean): boolean { this._originalSpec = spec; this._spec = this._getSpecFromOriginalSpec(); return true; -} +} + +``` + +接着,`_initChartSpec` 方法会根据 `spec` 初始化图表规格: + +文件:`vchart.ts` 方法:`_initChartSpec` -``` -接着,`_initChartSpec` 方法会根据 `spec` 初始化图表规格: - -文件:`vchart.ts` 方法:`_initChartSpec` - ```xml private _initChartSpec(spec: any, actionSource: VChartRenderActionSource) { *// 如果用户注册了函数,在配置中替换相应函数名为函数内容* @@ -546,15 +534,16 @@ private _initChartSpec(spec: any, actionSource: VChartRenderActionSource) { this._specInfo = this._chartSpecTransformer?.transformModelSpec(this._spec); *// 插件生命周期* this._chartPluginApply('onAfterModelSpecTransform', this._spec, this._specInfo, actionSource); -} - -``` -1. 创建和初始化 Chart 实例 - -在 `_initChart` 方法中,创建并初始化图表实例: - -文件:`vchart.ts` 方法:`_initChart` - +} + +``` + +1. 创建和初始化 Chart 实例 + +在 `_initChart` 方法中,创建并初始化图表实例: + +文件:`vchart.ts` 方法:`_initChart` + ```xml private _initChart(spec: any) { if (!this._compiler) { @@ -578,15 +567,16 @@ private _initChart(spec: any) { chart, vchart: this }); -} - -``` -1. 更新动画状态 - -当图表需要重新渲染或更新时,`_updateAnimateState` 方法会被调用来更新动画状态: - -文件:`vchart.ts` 方法:`_updateAnimateState` - +} + +``` + +1. 更新动画状态 + +当图表需要重新渲染或更新时,`_updateAnimateState` 方法会被调用来更新动画状态: + +文件:`vchart.ts` 方法:`_updateAnimateState` + ```xml private _updateAnimateState(initial?: boolean) { if (this._option.animation) { @@ -598,19 +588,20 @@ private _updateAnimateState(initial?: boolean) { component.animate?.updateAnimateState(animationState, true); }); } -} - -``` -* **初始状态**:如果 `initial` 为 `true`,则设置动画状态为 `AnimationStateEnum.appear`(入场动画)。 - -* **更新状态**:否则,设置为 `AnimationStateEnum.update`(更新动画)。 - -1. 渲染图表 - -在 `renderSync` 和 `renderAsync` 方法中,`animation` 配置会被传递给编译器进行渲染: - -文件:`vchart.ts` 方法:`_renderSync` - +} + +``` + +- **初始状态**:如果 `initial` 为 `true`,则设置动画状态为 `AnimationStateEnum.appear`(入场动画)。 + +- **更新状态**:否则,设置为 `AnimationStateEnum.update`(更新动画)。 + +1. 渲染图表 + +在 `renderSync` 和 `renderAsync` 方法中,`animation` 配置会被传递给编译器进行渲染: + +文件:`vchart.ts` 方法:`_renderSync` + ```xml protected _renderSync = (option: IVChartRenderOption = {}) => { const self = this as unknown as IVChart; @@ -621,391 +612,360 @@ protected _renderSync = (option: IVChartRenderOption = {}) => { this._compiler?.render(option.morphConfig); this._afterRender(); return self; -}; - -``` -1. 动画状态的更新 - -在 `updateSpec` 和 `updateCustomConfigAndRerender` 方法中,`reAnimate` 标志用于决定是否重新触发动画: - -文件:`vchart.ts` 方法:`updateSpec` 和 `updateCustomConfigAndRerender` - +}; + +``` + +1. 动画状态的更新 + +在 `updateSpec` 和 `updateCustomConfigAndRerender` 方法中,`reAnimate` 标志用于决定是否重新触发动画: + +文件:`vchart.ts` 方法:`updateSpec` 和 `updateCustomConfigAndRerender` + ```xml if (userUpdateOptions?.reAnimate) { this.stopAnimation(); this._updateAnimateState(true); -} - -``` - - -### 动画系统设计概述 - - - -VChart的动画系统设计遵循模块化、可扩展和易于配置的原则,旨在为开发者提供一个灵活且强大的工具来创建丰富的动画效果。以下是该系统的几个关键组成部分及其工作原理: - -### 原理 - -#### 1. 动画接口与抽象 - - - -* **IAnimate 接口**:定义了所有动画必须实现的方法和属性,包括获取唯一的ID、更新动画状态以及获取状态信号名称。 - -* - -* **IAnimationSpec 接口**:规定了动画配置的结构,涵盖了从入场到退场的各种动画设置。 - - - -classDiagram - - class AnimationStateEnum { - - --枚举-- - - appear: AnimationStateEnum - - disappear: AnimationStateEnum - - enter: AnimationStateEnum - - update: AnimationStateEnum - - exit: AnimationStateEnum - - state: AnimationStateEnum - - normal: AnimationStateEnum - - none: AnimationStateEnum - - } - - - - class IAnimate { - - <> - - +updateAnimateState(state: AnimationStateEnum, noRender?: boolean): void - - +getAnimationStateSignalName(): string - - +id: number - - } - - - - class ICartesianGroupAnimationParams { - - <> - - +direction(): "x" | "y" - - +orient(): "positive" | "negative" - - +width(): number - - +height(): number - - } - - - - class AnimateManager { - - --属性-- - - -_stateMap: IAnimateState & StateMap - - +id: number - - --方法-- - - +updateAnimateState(state: AnimationStateEnum, noRender?: boolean): void - - +getAnimationStateSignalName(): string - - +constructor() - - } - - - - class MarkAnimationSpec { - - --属性-- - - appear: IAnimationConfig - - enter: IAnimationConfig - - update: IAnimationConfig[] - - exit: IAnimationConfig - - disappear: IAnimationConfig - - } - - - - class IAnimationSpec { - - --属性-- - - animationAppear: boolean | IStateAnimateSpec | IMarkAnimateSpec - - animationEnter: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec - - animationUpdate: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec - - animationExit: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec - - animationDisappear: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec - - animationState: boolean | IStateAnimationConfig - - animationNormal: IMarkAnimateSpec - - } - - - - class IStateAnimateSpec { - - --属性-- - - duration?: number - - delay?: number - - easing?: EasingType - - oneByOne?: boolean - - preset?: Preset | false - - } - - - - class ICommonStateAnimateSpec { - - --属性-- - - duration?: number - - delay?: number - - easing?: EasingType - - oneByOne?: boolean - - } - - - - class IMorphSeriesSpec { - - --属性-- - - enable?: boolean - - morphKey?: string - - morphElementKey?: string - - } - - - - class IAnimateState { - - --属性-- - - animationState: { callback: (datum: any, element: IElement) => AnimationStateEnum } - - } - - - - class IAnimationConfig { - - --属性-- - - type?: string - - channel?: string - - custom?: Function - - customParameters?: Function - - oneByOne?: boolean | number - - duration?: number - - easing?: EasingType - - delay?: number - - delayAfter?: number - - } - - - - % 关系 - - AnimationStateEnum "1" --|> "多" AnimateManager: 使用 - - AnimateManager "1" --|> "1" IAnimate: 实现 - - AnimateManager "1" -- "1" ICartesianGroupAnimationParams: 依赖 - - IAnimationSpec "1" -- "多" spec.ts: 定义于 - - MarkAnimationSpec "1" -- "1" config.ts: 由 config.ts 使用 - - IAnimationConfig "1" -- "多" utils.ts: 由 utils.ts 处理 - - IStateAnimateSpec "1" -- "1" ICommonStateAnimateSpec: 继承 - - IAnimationSpec "1" -- "1" IStateAnimateSpec: 关联 - - IAnimationSpec "1" -- "1" IMorphSeriesSpec: 关联 - - IAnimateState "1" -- "1" AnimateManager: 内部使用 - - IAnimationConfig "1" -- "1" ICommonStateAnimateSpec: 继承 - - - -#### 2. 动画管理器 - - - -* **AnimateManager 类**:继承自 `StateManager` 并实现了 `IAnimate` 接口,负责管理动画的状态,并提供方法来根据传入的状态更新动画。它处理动画状态的更新和检索,并根据不同状态更新动画状态。 - - - -#### 3. 工厂模式 - - - -* **Factory 类**:用于注册新的动画类型,允许将自定义动画逻辑添加到图表组件中。通过静态方法 `registerAnimation`,可以将特定类型的动画与其配置关联起来,方便后续调用。 - - - -#### 4. 动画配置生成 - - - -* **animationConfig 函数**:根据默认配置和用户提供的配置生成最终的动画配置。这个函数遍历所有的动画状态(如出现、进入、更新等),并根据用户配置或默认配置构建出完整的动画配置对象。 - - - -#### 5. 动画任务接口 - - - -* **IAnimationTask 接口**:定义了一个动画任务的数据结构,这对于理解复杂的动画序列非常重要。每个任务包含时间偏移、动作队列和后继任务列表,形成了一种链式动画执行机制。 - - - -#### 6. 动画的具体实现 - - - -* 每个具体的图表系列(如柱状图、饼图、散点图等)都有各自的动画实现文件,这些文件中包含了针对该系列的预设动画函数。例如,柱状图可能有生长动画、淡入动画等;饼图则可能有扇区展开动画等。 - - - - - -通过上述步骤,我们已经完成了一个简单但完整的动画流程创建。在这个过程中,我们利用了VChart动画系统的模块化设计,分别对图表配置、动画注册、实例化图表、数据更新以及动画状态管理进行了处理。这种设计不仅让代码更加清晰易读,同时也提高了系统的灵活性和可维护性。开发者可以根据实际需求轻松地定制不同类型的动画效果,从而提升用户体验。 - - - -为了更好地理解和解读这些源码文件,建议按照以下顺序阅读: - -1. `**interface.ts**` - -* **原因**:该文件定义了动画模块中的核心类型和接口,如 `AnimationStateEnum`、`IAnimateState` 和 `IAnimate` 等。理解这些类型和接口是后续代码的基础。 - -* **重点内容**: - -* 动画状态枚举 `AnimationStateEnum` - -* 动画状态接口 `IAnimateState` - -* 动画接口 `IAnimate` - -1. `**spec.ts**` - -* **原因**:该文件定义了动画配置的规范,包括 `ICommonStateAnimateSpec`、`IStateAnimateSpec` 和 `IAnimationSpec` 等。这些规范在实际动画配置中会被使用,因此需要先了解它们的结构。 - -* **重点内容**: - -* 动画配置的通用属性 `ICommonStateAnimateSpec` - -* 动画状态配置 `IStateAnimateSpec` - -* 动画规范 `IAnimationSpec` - -1. `**config.ts**` - -* **原因**:该文件提供了默认的动画配置和一些预设的动画注册函数。理解这些默认配置有助于理解如何自定义动画配置。 - -* **重点内容**: - -* 默认动画配置 `DEFAULT_ANIMATION_CONFIG` - -* 预设动画注册函数(如 `registerScaleInOutAnimation`、`registerFadeInOutAnimation` 等) - -1. `**utils.ts**` - -* **原因**:该文件包含了许多辅助函数,用于生成和处理动画配置。理解这些函数的工作原理可以帮助你更好地理解动画配置是如何被应用的。 - -* **重点内容**: - -* 生成动画配置的函数 `animationConfig` - -* 处理用户动画配置的函数 `userAnimationConfig` - -* 辅助函数(如 `produceOneByOne`、`shouldMarkDoMorph` 等) - -1. `**animate-manager.ts**` - -* **原因**:该文件实现了 `AnimateManager` 类,它是管理动画的核心类。理解这个类的实现可以让你知道动画是如何被管理和更新的。 - -* **重点内容**: - -* `AnimateManager` 类的实现 - -* 更新动画状态的方法 `updateAnimateState` - -* 获取动画状态信号名称的方法 `getAnimationStateSignalName` - -### 总结 - -按照上述顺序阅读这些文件,可以逐步建立起对整个动画模块的理解。从基础的类型和接口开始,逐步深入到具体的配置和实现细节,最终理解动画是如何被管理和应用的。 - -### 阅读顺序总结 - -* `**interface.ts**` 核心类型和接口 - -* `**spec.ts**` 动画配置规范 - -* `**config.ts**` 默认配置和预设动画 - -* `**utils.ts**` 辅助函数和配置生成 - -* `**animate-manager.ts**`动画管理类实现 - - # 本文档由以下人员修正整理 - [玄魂](https://github.com/xuanhun) \ No newline at end of file +} + +``` + +### 动画系统设计概述 + +VChart的动画系统设计遵循模块化、可扩展和易于配置的原则,旨在为开发者提供一个灵活且强大的工具来创建丰富的动画效果。以下是该系统的几个关键组成部分及其工作原理: + +### 原理 + +#### 1. 动画接口与抽象 + +- **IAnimate 接口**:定义了所有动画必须实现的方法和属性,包括获取唯一的ID、更新动画状态以及获取状态信号名称。 + +- + +- **IAnimationSpec 接口**:规定了动画配置的结构,涵盖了从入场到退场的各种动画设置。 + +classDiagram + + class AnimationStateEnum { + + --枚举-- + + appear: AnimationStateEnum + + disappear: AnimationStateEnum + + enter: AnimationStateEnum + + update: AnimationStateEnum + + exit: AnimationStateEnum + + state: AnimationStateEnum + + normal: AnimationStateEnum + + none: AnimationStateEnum + + } + + + + class IAnimate { + + <> + + +updateAnimateState(state: AnimationStateEnum, noRender?: boolean): void + + +getAnimationStateSignalName(): string + + +id: number + + } + + + + class ICartesianGroupAnimationParams { + + <> + + +direction(): "x" | "y" + + +orient(): "positive" | "negative" + + +width(): number + + +height(): number + + } + + + + class AnimateManager { + + --属性-- + + -_stateMap: IAnimateState & StateMap + + +id: number + + --方法-- + + +updateAnimateState(state: AnimationStateEnum, noRender?: boolean): void + + +getAnimationStateSignalName(): string + + +constructor() + + } + + + + class MarkAnimationSpec { + + --属性-- + + appear: IAnimationConfig + + enter: IAnimationConfig + + update: IAnimationConfig[] + + exit: IAnimationConfig + + disappear: IAnimationConfig + + } + + + + class IAnimationSpec { + + --属性-- + + animationAppear: boolean | IStateAnimateSpec | IMarkAnimateSpec + + animationEnter: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec + + animationUpdate: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec + + animationExit: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec + + animationDisappear: boolean | ICommonStateAnimateSpec | IMarkAnimateSpec + + animationState: boolean | IStateAnimationConfig + + animationNormal: IMarkAnimateSpec + + } + + + + class IStateAnimateSpec { + + --属性-- + + duration?: number + + delay?: number + + easing?: EasingType + + oneByOne?: boolean + + preset?: Preset | false + + } + + + + class ICommonStateAnimateSpec { + + --属性-- + + duration?: number + + delay?: number + + easing?: EasingType + + oneByOne?: boolean + + } + + + + class IMorphSeriesSpec { + + --属性-- + + enable?: boolean + + morphKey?: string + + morphElementKey?: string + + } + + + + class IAnimateState { + + --属性-- + + animationState: { callback: (datum: any, element: IElement) => AnimationStateEnum } + + } + + + + class IAnimationConfig { + + --属性-- + + type?: string + + channel?: string + + custom?: Function + + customParameters?: Function + + oneByOne?: boolean | number + + duration?: number + + easing?: EasingType + + delay?: number + + delayAfter?: number + + } + + + + % 关系 + + AnimationStateEnum "1" --|> "多" AnimateManager: 使用 + + AnimateManager "1" --|> "1" IAnimate: 实现 + + AnimateManager "1" -- "1" ICartesianGroupAnimationParams: 依赖 + + IAnimationSpec "1" -- "多" spec.ts: 定义于 + + MarkAnimationSpec "1" -- "1" config.ts: 由 config.ts 使用 + + IAnimationConfig "1" -- "多" utils.ts: 由 utils.ts 处理 + + IStateAnimateSpec "1" -- "1" ICommonStateAnimateSpec: 继承 + + IAnimationSpec "1" -- "1" IStateAnimateSpec: 关联 + + IAnimationSpec "1" -- "1" IMorphSeriesSpec: 关联 + + IAnimateState "1" -- "1" AnimateManager: 内部使用 + + IAnimationConfig "1" -- "1" ICommonStateAnimateSpec: 继承 + +#### 2. 动画管理器 + +- **AnimateManager 类**:继承自 `StateManager` 并实现了 `IAnimate` 接口,负责管理动画的状态,并提供方法来根据传入的状态更新动画。它处理动画状态的更新和检索,并根据不同状态更新动画状态。 + +#### 3. 工厂模式 + +- **Factory 类**:用于注册新的动画类型,允许将自定义动画逻辑添加到图表组件中。通过静态方法 `registerAnimation`,可以将特定类型的动画与其配置关联起来,方便后续调用。 + +#### 4. 动画配置生成 + +- **animationConfig 函数**:根据默认配置和用户提供的配置生成最终的动画配置。这个函数遍历所有的动画状态(如出现、进入、更新等),并根据用户配置或默认配置构建出完整的动画配置对象。 + +#### 5. 动画任务接口 + +- **IAnimationTask 接口**:定义了一个动画任务的数据结构,这对于理解复杂的动画序列非常重要。每个任务包含时间偏移、动作队列和后继任务列表,形成了一种链式动画执行机制。 + +#### 6. 动画的具体实现 + +- 每个具体的图表系列(如柱状图、饼图、散点图等)都有各自的动画实现文件,这些文件中包含了针对该系列的预设动画函数。例如,柱状图可能有生长动画、淡入动画等;饼图则可能有扇区展开动画等。 + +通过上述步骤,我们已经完成了一个简单但完整的动画流程创建。在这个过程中,我们利用了VChart动画系统的模块化设计,分别对图表配置、动画注册、实例化图表、数据更新以及动画状态管理进行了处理。这种设计不仅让代码更加清晰易读,同时也提高了系统的灵活性和可维护性。开发者可以根据实际需求轻松地定制不同类型的动画效果,从而提升用户体验。 + +为了更好地理解和解读这些源码文件,建议按照以下顺序阅读: + +1. `**interface.ts**` + +- **原因**:该文件定义了动画模块中的核心类型和接口,如 `AnimationStateEnum`、`IAnimateState` 和 `IAnimate` 等。理解这些类型和接口是后续代码的基础。 + +- **重点内容**: + +- 动画状态枚举 `AnimationStateEnum` + +- 动画状态接口 `IAnimateState` + +- 动画接口 `IAnimate` + +1. `**spec.ts**` + +- **原因**:该文件定义了动画配置的规范,包括 `ICommonStateAnimateSpec`、`IStateAnimateSpec` 和 `IAnimationSpec` 等。这些规范在实际动画配置中会被使用,因此需要先了解它们的结构。 + +- **重点内容**: + +- 动画配置的通用属性 `ICommonStateAnimateSpec` + +- 动画状态配置 `IStateAnimateSpec` + +- 动画规范 `IAnimationSpec` + +1. `**config.ts**` + +- **原因**:该文件提供了默认的动画配置和一些预设的动画注册函数。理解这些默认配置有助于理解如何自定义动画配置。 + +- **重点内容**: + +- 默认动画配置 `DEFAULT_ANIMATION_CONFIG` + +- 预设动画注册函数(如 `registerScaleInOutAnimation`、`registerFadeInOutAnimation` 等) + +1. `**utils.ts**` + +- **原因**:该文件包含了许多辅助函数,用于生成和处理动画配置。理解这些函数的工作原理可以帮助你更好地理解动画配置是如何被应用的。 + +- **重点内容**: + +- 生成动画配置的函数 `animationConfig` + +- 处理用户动画配置的函数 `userAnimationConfig` + +- 辅助函数(如 `produceOneByOne`、`shouldMarkDoMorph` 等) + +1. `**animate-manager.ts**` + +- **原因**:该文件实现了 `AnimateManager` 类,它是管理动画的核心类。理解这个类的实现可以让你知道动画是如何被管理和更新的。 + +- **重点内容**: + +- `AnimateManager` 类的实现 + +- 更新动画状态的方法 `updateAnimateState` + +- 获取动画状态信号名称的方法 `getAnimationStateSignalName` + +### 总结 + +按照上述顺序阅读这些文件,可以逐步建立起对整个动画模块的理解。从基础的类型和接口开始,逐步深入到具体的配置和实现细节,最终理解动画是如何被管理和应用的。 + +### 阅读顺序总结 + +- `**interface.ts**` 核心类型和接口 + +- `**spec.ts**` 动画配置规范 + +- `**config.ts**` 默认配置和预设动画 + +- `**utils.ts**` 辅助函数和配置生成 + +- `**animate-manager.ts**`动画管理类实现 + +# 本文档由以下人员修正整理 + +[玄魂](https://github.com/xuanhun) diff --git a/docs/assets/guide/menu.json b/docs/assets/guide/menu.json index d3c09a0c13..b9651e7a77 100644 --- a/docs/assets/guide/menu.json +++ b/docs/assets/guide/menu.json @@ -63,20 +63,6 @@ "zh": "一份基础的 spec", "en": "A Basic Spec" } - }, - { - "path": "DeepSeek_With_Cursor", - "title": { - "zh": "Cursor+DeepSeek,快速上手属于你的 VChart 代码", - "en": "Cursor+DeepSeek: Quick Start to Your VChart Code" - } - }, - { - "path": "Quickly_Get_Started_with_VisActor_Using_Trae_Context_Doc", - "title": { - "zh": "使用 Trae Context Doc 快速上手 VisActor", - "en": "Quickly Get Started with VisActor Using Trae Context Doc" - } } ] }, @@ -974,4 +960,4 @@ ] } ] -} +} \ No newline at end of file diff --git a/docs/package.json b/docs/package.json index 84fa6776c4..fcae291319 100644 --- a/docs/package.json +++ b/docs/package.json @@ -12,15 +12,15 @@ }, "dependencies": { "@arco-design/web-react": "2.46.1", - "@visactor/openinula-vchart": "workspace:2.0.19", - "@visactor/react-vchart": "workspace:2.0.19", - "@visactor/vchart": "workspace:2.0.19", - "@visactor/vchart-extension": "workspace:2.0.19", + "@visactor/openinula-vchart": "workspace:2.0.20", + "@visactor/react-vchart": "workspace:2.0.20", + "@visactor/vchart": "workspace:2.0.20", + "@visactor/vchart-extension": "workspace:2.0.20", "@visactor/vchart-theme": "~1.6.6", "@visactor/vmind": "1.2.4-alpha.5", - "@visactor/vutils": "~1.0.22", - "@visactor/vrender": "~1.0.41", - "@visactor/vrender-kits": "~1.0.41", + "@visactor/vutils": "~1.0.23", + "@visactor/vrender": "1.0.44", + "@visactor/vrender-kits": "1.0.44", "@visactor/vtable": "1.19.0-alpha.0", "@visactor/vtable-editors": "1.19.0-alpha.0", "@visactor/vtable-gantt": "1.19.0-alpha.0", diff --git a/packages/block-vchart/block/vchart/index.js b/packages/block-vchart/block/vchart/index.js index 492024f1bf..5489fc0c3e 100644 --- a/packages/block-vchart/block/vchart/index.js +++ b/packages/block-vchart/block/vchart/index.js @@ -12,7 +12,7 @@ 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.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=(t,e=!1)=>e?"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 _=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||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=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||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 B=Object.prototype.hasOwnProperty;function P(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(B.call(t,e))return!1;return!0}var L=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&R.call(t,e);function I(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=y(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||_(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=I(r,e,i)}return s}function D(t,e,i=!1,s=!1){if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&y(t[a])?z(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(y(a)){if(s)o=[];else if(y(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(_(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function N(t){return Object.prototype.toString.call(t)}function V(t){return Object.keys(t)}function U(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(N(t)!==N(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(y(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!U(t[s],e[s],i))return!1;return!0}if(!m(t))return!1;const s=V(t),n=V(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!U(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;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},K=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;ne?1:t>=e?0:NaN}function it(t){return Number(t)}function st(t,e,i=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)}const nt="undefined"!=typeof console;function rt(t,e,i){const s=[e].concat([].slice.call(i));nt&&console[t].apply(console,s)}var at;!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"}(at||(at={}));class ot{static getInstance(t,e){return ot._instance&&S(t)?ot._instance.level(t):ot._instance||(ot._instance=new ot(t,e)),ot._instance}static setInstance(t){return ot._instance=t}static setInstanceLevel(t){ot._instance?ot._instance.level(t):ot._instance=new ot(t)}static clearInstance(){ot._instance=null}constructor(t=at.None,e){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(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=at.Info}canLogDebug(){return this._level>=at.Debug}canLogError(){return this._level>=at.Error}canLogWarn(){return this._level>=at.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=at.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):rt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=at.Warn&&rt(this._method||"warn","WARN",t),this}info(...t){return this._level>=at.Info&&rt(this._method||"log","INFO",t),this}debug(...t){return this._level>=at.Debug&&rt(this._method||"log","DEBUG",t),this}}function lt(t,e,i=0,s){for(u(s)&&(s=t.length);i>>1;et(t[n],e)>0?s=n:i=n+1}return i}ot._instance=null;const ht=(t,e)=>ct(0,t.length,(i=>e(t[i]))),ct=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},dt=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(et)),st(i,.5)},ut=1e-10,pt=1e-10;function gt(t,e,i=pt,s=ut){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function ft(t,e,i,s){return t>e&&!gt(t,e,i,s)}function mt(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var _t=function(t,e,i){return ti?i:t};var yt=(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 bt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let xt=!1;try{xt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){xt=!1}function St(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&xt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=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 _(){const t=Date.now();if(v(t))return y(t);o=m(_,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?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(_,e),c?f(t):a}(l);if(d)return o=m(_,e),f(l)}return void 0===o&&(o=m(_,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:y(Date.now())},b.pending=function(){return void 0!==o},b}function At(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),St(t,e,{leading:s,trailing:n,maxWait:e})}function kt(t,e){return i=>t*(1-i)+e*i}function Mt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Tt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function wt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}xt=!1;const Ct=4294967296;const Et=t=>e=>L(e,t),Bt=(t,e={})=>{if(d(t))return t;const i=[t];return(e&&e.get||Et)(i)},Pt=(t,e={})=>{if(y(t)){const i=t.map((t=>Bt(t,e)));return t=>i.map((e=>e(t)))}return Bt(t,e)},Lt=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t,Rt=t=>0,Ot=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function Dt(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Ft(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!u(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:d,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)d+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!u(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!u(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:d,b:p},predict:g,rSquared:Dt(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=It(f.min,f);for(let r=0;r=1?Ht:t<=-1?-Ht:Math.asin(t)}function Jt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Qt(t,e){return t[0]*e[1]-t[1]*e[0]}function te(t,e){let i=0;for(let s=0;s0?i:0}function se(t,e){return ee(t+e,10**Math.max(ie(t),ie(e)))}function ne(t,e){return ee(t-e,10**Math.max(ie(t),ie(e)))}class re{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new re(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 ae{static distancePP(t,e){return Kt(qt(t.x-e.x,2)+qt(t.y-e.y,2))}static distanceNN(t,e,i,s){return Kt(qt(t-i,2)+qt(e-s,2))}static distancePN(t,e,i){return Kt(qt(e-t.x,2)+qt(i-t.y,2))}static pointAtPP(t,e,i){return new re((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function oe(t){return t*(Math.PI/180)}function le(t){return 180*t/Math.PI}const he=(t=0)=>{if(t<0)for(;t<-Nt;)t+=Nt;else if(t>0)for(;t>Nt;)t-=Nt;return t};function ce(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 de(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function ue(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function pe(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ge(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=pe(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)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function fe(t){return(t=pe(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 me(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function ve(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function ye(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var be;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(be||(be={}));const xe=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function Se(t,e,i){if(!t||!e)return be.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function Me(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Te({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function we(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Ce(t,e){const i=e?oe(t.angle):t.angle,s=we(t);return[Te({x:t.x1,y:t.y1},i,s),Te({x:t.x2,y:t.y1},i,s),Te({x:t.x2,y:t.y2},i,s),Te({x:t.x1,y:t.y2},i,s)]}function Ee(t,e,i=!1){const s=Ce(t,i),n=Ce(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(we(t),we(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?oe(t.angle):t.angle;let u=i?oe(90-t.angle):t.angle+Ht;const p=i?oe(e.angle):e.angle;let g=i?oe(90-e.angle):e.angle+Ht;u>Vt&&(u-=Vt),g>Vt&&(g-=Vt);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Me(n,i)+Me(n,s))/2>Me(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Be=1e-8;function Pe(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Oe(t,e){return Math.abs(t-e){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"};function De(t,e={},i){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")}class Fe{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=De(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:f=o}=this._userSpec;if(_(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,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: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,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}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(Fe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Fe.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Fe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Fe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Fe.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}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)}}Fe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Fe.NUMBERS_CHAR_SET="0123456789",Fe.FULL_SIZE_CHAR="字";const ze=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),je=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=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(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=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(t=0,e=0,i=0,s=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(t=0,e=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(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return He(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 Ve extends Ne{}class Ue extends Ne{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Ee(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new Ue(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Te({x:this.x1,y:this.y1},this.angle,t),Te({x:this.x2,y:this.y1},this.angle,t),Te({x:this.x1,y:this.y2},this.angle,t),Te({x:this.x2,y:this.y2},this.angle,t)]}}class We{constructor(t=1,e=0,i=0,s=1,n=0,r=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 We,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,f=o*n+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 We;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:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new We(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=le(r.rotateDeg),r}}class Ge{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 Ye(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 $e(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 Xe=/^#([0-9a-f]{3,8})$/,Ke={transparent:4294967040},qe={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 Ze(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Je(t){return S(t)?new si(t>>16,t>>8&255,255&t,1):y(t)?new si(t[0],t[1],t[2]):new si(255,255,255)}function Qe(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ti(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ei=(t,e)=>{const i=Xe.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new si((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Je(t):8===e?new si(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class ii{static Brighter(t,e=1){return 1===e?t:new ii(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new ii(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof ii?t:new ii(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();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(Ke[t]))return function(t){return S(t)?new si(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new si(t[0],t[1],t[2],t[3]):new si(255,255,255,1)}(Ke[t]);if(p(qe[t]))return Je(qe[t]);const e=`${t}`.trim().toLowerCase(),i=ei(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new si(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=Ye(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new si(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ii.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new si(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=$e(this.color.r,this.color.g,this.color.b),r=Ye(u(t)?n.h:_t(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 si(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=ei(e,!0);return null!=i?i:this}setColorName(t){const e=qe[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(t=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}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new ii(this.color.toString())}copyGammaToLinear(t,e=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,e=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=Qe(t.color.r),this.color.g=Qe(t.color.g),this.color.b=Qe(t.color.b),this}copyLinearToSRGB(t){return this.color.r=ti(t.color.r),this.color.g=ti(t.color.g),this.color.b=ti(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class si{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`#${Ze(this.r)+Ze(this.g)+Ze(this.b)+(1===this.opacity?"":Ze(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}=$e(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ni(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 si(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:$e});function ai(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 oi(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=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:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}function li(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 hi(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}const ci=1e-10;function di(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+ci)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=fi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=ae.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=ui(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-ci,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function ui(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function pi(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return ui(t,t-(i*i-e*e+t*t)/(2*i))+ui(e,s)}function gi(t,e){const i=ae.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function fi(t){const e={x:0,y:0};for(let i=0;ithis.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 _i;function yi(t,e){const i=vi(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 bi{constructor(t={}){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 xi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Si(t){let e;if(e=xi.exec(t))return new bi({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]});ot.getInstance().error("invalid format: "+t)}const Ai=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class ki{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 ki.instance||(ki.instance=new ki),ki.instance}newFormat(t){const e=Si(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"):Mi[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=Mi[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:_,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)?m: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?Ai[8+_i/3]:"")+A+(t&&"("===n?")":""),f)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=Si(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=vi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=Ai[8+n/3];return function(t){return s(r*t)+a}}}const Mi={"%":(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)=>yi(100*t,e),r:yi,s:function(t,e){const i=vi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(_i=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")+vi(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 Ti(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(_.fx>e.fx?(Bi(y,1+c,v,-c,e),y.fx=t(y),y.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Bi(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=te(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Ri(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Ei(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},ts=Math.sqrt,es=Math.tan;function is(t){return t>1?0:t<-1?ji:Math.acos(t)}function ss(t){return t>1?Hi:t<-1?-Hi:Math.asin(t)}function ns(){}function rs(t,e){t&&os.hasOwnProperty(t.type)&&os[t.type](t,e)}var as={Feature:function(t,e){rs(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sji?t+Math.round(-t/Vi)*Vi:t,e]}function bs(t,e,i){return(t%=Vi)?e||i?_s(Ss(t),As(e,i)):Ss(t):e||i?As(e,i):ys}function xs(t){return function(e,i){return[(e+=t)>ji?e-Vi:e<-ji?e+Vi:e,i]}}function Ss(t){var e=xs(t);return e.invert=xs(-t),e}function As(t,e){var i=Xi(t),s=Ji(t),n=Xi(e),r=Ji(e);function a(t,e){var a=Xi(e),o=Xi(t)*a,l=Ji(t)*a,h=Ji(e),c=h*i+o*s;return[$i(l*n-c*r,o*i-h*s),ss(c*n+l*r)]}return a.invert=function(t,e){var a=Xi(e),o=Xi(t)*a,l=Ji(t)*a,h=Ji(e),c=h*n-l*r;return[$i(l*n+h*r,o*i+c*s),ss(c*i-o*s)]},a}function ks(t,e){(e=us(e))[0]-=t,vs(e);var i=is(-e[1]);return((-e[2]<0?-i:i)+Vi-zi)%Vi}function Ms(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:ns,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function Ts(t,e){return Gi(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 Es(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Is(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 Ds(t,e,i,s){return function(n){var r,a,o,l=e(n),h=Ms(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Is(a);var t=function(t,e){var i=Rs(e),s=e[1],n=Ji(s),r=[Ji(i),-Xi(i),0],a=0,o=0;Ls.reset(),1===n?s=Hi+zi:-1===n&&(s=-Hi-zi);for(var l=0,h=t.length;l=0?1:-1,M=k*A,T=M>ji,w=f*x;if(Ls.add($i(w*k*Ji(M),m*S+w*Xi(M))),a+=T?A+k*Vi:A,T^p>=i^y>=i){var C=gs(us(u),us(_));vs(C);var E=gs(r,C);vs(E);var B=(T^A>=0?-1:1)*ss(E[2]);(s>B||s===B&&(C[0]||C[1]))&&(o+=T^A>=0?1:-1)}}return(a<-zi||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(Fs))}return u}}function Fs(t){return t.length>1}function zs(t,e){return((t=t.x)[0]<0?t[1]-Hi-zi:Hi-t[1])-((e=e.x)[0]<0?e[1]-Hi-zi:Hi-e[1])}1===(Bs=Os).length&&(Ps=Bs,Bs=function(t,e){return Os(Ps(t),e)});var js=Ds((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?ji:-ji,l=Gi(r-i);Gi(l-ji)0?Hi:-Hi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=ji&&(Gi(i-n)zi?Yi((Ji(e)*(r=Xi(s))*Ji(i)-Ji(s)*(n=Xi(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*Hi,s.point(-ji,n),s.point(0,n),s.point(ji,n),s.point(ji,0),s.point(ji,-n),s.point(0,-n),s.point(-ji,-n),s.point(-ji,0),s.point(-ji,n);else if(Gi(t[0]-e[0])>zi){var r=t[0]0,n=Gi(e)>zi;function r(t,i){return Xi(t)*Xi(i)>e}function a(t,i,s){var n=[1,0,0],r=gs(us(t),us(i)),a=ps(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=gs(n,r),u=ms(n,h);fs(u,ms(r,c));var p=d,g=ps(u,p),f=ps(p,p),m=g*g-f*(ps(u,u)-1);if(!(m<0)){var v=ts(m),_=ms(p,(-g-v)/f);if(fs(_,u),_=ds(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],A=i[1];x0^_[1]<(Gi(_[0]-b)ji^(b<=_[0]&&_[0]<=x)){var T=ms(p,(-g+v)/f);return fs(T,u),[_,ds(T)]}}}function o(e,i){var n=s?t:ji-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Ds(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],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?ji:-ji),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||Ts(e,p)||Ts(g,p))&&(g[2]=1),f!==l)c=0,f?(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^f){var v;m&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)))}!f||e&&Ts(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},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=Xi(e),o=Ji(e),l=s*i;null==n?(n=e+s*Vi,r=e-l/2):(n=ks(a,n),r=ks(a,r),(s>0?nr)&&(n+=s*Vi));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 Gi(s[0]-t)0?0:3:Gi(s[0]-i)0?2:1:Gi(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,f,m,v,_,y=a,b=Ms(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(A(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&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=Is(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&Cs(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&&m)y.point(r,a);else{var l=[g=Math.max(Vs,Math.min(Ns,g)),f=Math.max(Vs,Math.min(Ns,f))],b=[r=Math.max(Vs,Math.min(Ns,r)),a=Math.max(Vs,Math.min(Ns,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):(m||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Ws(t){return t}var Gs,Ys,$s,Xs,Ks=Oi(),qs=Oi(),Zs={point:ns,lineStart:ns,lineEnd:ns,polygonStart:function(){Zs.lineStart=Js,Zs.lineEnd=en},polygonEnd:function(){Zs.lineStart=Zs.lineEnd=Zs.point=ns,Ks.add(Gi(qs)),qs.reset()},result:function(){var t=Ks/2;return Ks.reset(),t}};function Js(){Zs.point=Qs}function Qs(t,e){Zs.point=tn,Gs=$s=t,Ys=Xs=e}function tn(t,e){qs.add(Xs*t-$s*e),$s=t,Xs=e}function en(){tn(Gs,Ys)}var sn=Zs,nn=1/0,rn=nn,an=-nn,on=an;var ln,hn,cn,dn,un={point:function(t,e){tan&&(an=t);eon&&(on=e)},lineStart:ns,lineEnd:ns,polygonStart:ns,polygonEnd:ns,result:function(){var t=[[nn,rn],[an,on]];return an=on=-(rn=nn=1/0),t}},pn=0,gn=0,fn=0,mn=0,vn=0,_n=0,yn=0,bn=0,xn=0,Sn={point:An,lineStart:kn,lineEnd:wn,polygonStart:function(){Sn.lineStart=Cn,Sn.lineEnd=En},polygonEnd:function(){Sn.point=An,Sn.lineStart=kn,Sn.lineEnd=wn},result:function(){var t=xn?[yn/xn,bn/xn]:_n?[mn/_n,vn/_n]:fn?[pn/fn,gn/fn]:[NaN,NaN];return pn=gn=fn=mn=vn=_n=yn=bn=xn=0,t}};function An(t,e){pn+=t,gn+=e,++fn}function kn(){Sn.point=Mn}function Mn(t,e){Sn.point=Tn,An(cn=t,dn=e)}function Tn(t,e){var i=t-cn,s=e-dn,n=ts(i*i+s*s);mn+=n*(cn+t)/2,vn+=n*(dn+e)/2,_n+=n,An(cn=t,dn=e)}function wn(){Sn.point=An}function Cn(){Sn.point=Bn}function En(){Pn(ln,hn)}function Bn(t,e){Sn.point=Pn,An(ln=cn=t,hn=dn=e)}function Pn(t,e){var i=t-cn,s=e-dn,n=ts(i*i+s*s);mn+=n*(cn+t)/2,vn+=n*(dn+e)/2,_n+=n,yn+=(n=dn*t-cn*e)*(cn+t),bn+=n*(dn+e),xn+=3*n,An(cn=t,dn=e)}var Ln=Sn;function Rn(t){this._context=t}Rn.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,Vi)}},result:ns};var On,In,Dn,Fn,zn,jn=Oi(),Hn={point:ns,lineStart:function(){Hn.point=Nn},lineEnd:function(){On&&Vn(In,Dn),Hn.point=ns},polygonStart:function(){On=!0},polygonEnd:function(){On=null},result:function(){var t=+jn;return jn.reset(),t}};function Nn(t,e){Hn.point=Vn,In=Fn=t,Dn=zn=e}function Vn(t,e){Fn-=t,zn-=e,jn.add(ts(Fn*Fn+zn*zn)),Fn=t,zn=e}var Un=Hn;function Wn(){this._string=[]}function Gn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Yn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),cs(t,i(s))),s.result()}return r.area=function(t){return cs(t,i(sn)),sn.result()},r.measure=function(t){return cs(t,i(Un)),Un.result()},r.bounds=function(t){return cs(t,i(un)),un.result()},r.centroid=function(t){return cs(t,i(Ln)),Ln.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ws):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Wn):new Rn(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 $n(t){return function(e){var i=new Xn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Xn(){}function Kn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),cs(i,t.stream(un)),e(un.result()),null!=s&&t.clipExtent(s),t}function qn(t,e,i){return Kn(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 Zn(t,e,i){return qn(t,[[0,0],e],i)}function Jn(t,e,i){return Kn(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 Qn(t,e,i){return Kn(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)}Wn.prototype={_radius:4.5,_circle:Gn(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=Gn(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}},Xn.prototype={constructor:Xn,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 tr=16,er=Xi(30*Wi);function ir(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&f--){var b=a+u,x=o+p,S=l+g,A=ts(b*b+x*x+S*S),k=ss(S/=A),M=Gi(Gi(S)-1)e||Gi((v*E+_*B)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Wi:0,E()):[m*Ui,v*Ui,_*Ui]},w.angle=function(t){return arguments.length?(y=t%360*Wi,E()):y*Ui},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=ir(o,T=t*t),B()):ts(T)},w.fitExtent=function(t,e){return qn(w,t,e)},w.fitSize=function(t,e){return Zn(w,t,e)},w.fitWidth=function(t,e){return Jn(w,t,e)},w.fitHeight=function(t,e){return Qn(w,t,e)},function(){return e=t.apply(this,arguments),w.invert=e.invert&&C,E()}}function lr(t){var e=0,i=ji/3,s=or(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Wi,i=t[1]*Wi):[e*Ui,i*Ui]},n}function hr(t,e){var i=Ji(t),s=(i+Ji(e))/2;if(Gi(s)2?t[2]*Wi:0),e.invert=function(e){return(e=t.invert(e[0]*Wi,e[1]*Wi))[0]*=Ui,e[1]*=Ui,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===mr?[[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 _r(t){return es((Hi+t)/2)}function yr(t,e){var i=Xi(t),s=t===e?Ji(t):qi(i/Xi(e))/qi(_r(e)/_r(t)),n=i*Zi(_r(t),s)/s;if(!s)return mr;function r(t,e){n>0?e<-Hi+zi&&(e=-Hi+zi):e>Hi-zi&&(e=Hi-zi);var i=n/Zi(_r(e),s);return[i*Ji(s*t),n-i*Xi(s*t)]}return r.invert=function(t,e){var i=n-e,r=Qi(s)*ts(t*t+i*i),a=$i(t,Gi(i))*Qi(i);return i*s<0&&(a-=ji*Qi(t)*Qi(i)),[a/s,2*Yi(Zi(n/r,1/s))-Hi]},r}function br(t,e){return[t,e]}function xr(t,e){var i=Xi(t),s=t===e?Ji(t):(i-Xi(e))/(e-t),n=i/s+t;if(Gi(s)zi&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Br.invert=pr(ss),Pr.invert=pr((function(t){return 2*Yi(t)})),Lr.invert=function(t,e){return[-e,2*Yi(Ki(t))-Hi]};var Ir={exports:{}},Dr=function(t,e){this.p1=t,this.p2=e};Dr.prototype.rise=function(){return this.p2[1]-this.p1[1]},Dr.prototype.run=function(){return this.p2[0]-this.p1[0]},Dr.prototype.slope=function(){return this.rise()/this.run()},Dr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Dr.prototype.isVertical=function(){return!isFinite(this.slope())},Dr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Dr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Dr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Dr.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)},Dr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Fr=Dr,zr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Fr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=zr(t.slice(0,s),e),o=zr(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},jr=zr;!function(t){var e=jr;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;r{const i=Nr(Wr,e),{tolerance:s}=i;return Hr(t,s)};var Yr;!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"}(Yr||(Yr={}));const $r=(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.sort&&(k(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!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;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,_=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],A=new Set,k=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),A.has(i)||(A.add(i),S.push(i),y(m)?k.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):k.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else _[r][l]+=a;e&&e.includeValues&&!v&&_[r][c].push(t[n]);break}}}let M=0;const T=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=_.length;t0?_[t][l]/M:0,T.push(_[t])}return T},Kr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,_=-1/0;if(e.extent)v=e.extent[0],_=e.extent[1];else for(let e=0;e_&&(_=s))}if(!Number.isFinite(v)||!Number.isFinite(_)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=_;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(_-v>1){const e=Math.floor(v),i=Math.ceil((_-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>_){t=s,m.length=t+1;break}}else{const e=(_-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>_){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",A=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",k=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",M=null!==(d=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==d?d:"percentage",T=y(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],w=y(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],C=w.length?w:void 0,E=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:A,percentageName:M,valuesName:k,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:C});if(!T.length)return Xr(t,E);const B={};return t.forEach((t=>{const e=T.map((e=>null==t?void 0:t[e])).join("-&&-");B[e]?B[e].push(t):B[e]=[t]})),Object.values(B).map((t=>{const e=[...w,...T];return Xr(t,Object.assign(Object.assign({},E),{groupField:e.length?e:void 0,n:t.length}))})).flat()},qr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,_;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const A=!!(null==e?void 0:e.includeValues),k=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},M=null!==(n=k.key)&&void 0!==n?n:y(x)?null:null!==(r=x)&&void 0!==r?r:"key",T=null!==(a=k.count)&&void 0!==a?a:"count",w=null!==(o=k.mean)&&void 0!==o?o:"mean",C=null!==(l=k.q1)&&void 0!==l?l:"q1",E=null!==(h=k.median)&&void 0!==h?h:"median",B=null!==(c=k.q3)&&void 0!==c?c:"q3",P=null!==(d=k.iqr)&&void 0!==d?d:"iqr",L=null!==(p=k.min)&&void 0!==p?p:"min",R=null!==(g=k.max)&&void 0!==g?g:"max",O=null!==(f=k.lowerWhisker)&&void 0!==f?f:"lowerWhisker",I=null!==(m=k.upperWhisker)&&void 0!==m?m:"upperWhisker",D=null!==(v=k.outliers)&&void 0!==v?v:"outliers",F=null!==(_=k.values)&&void 0!==_?_:"values",z=new Map,j=new Map,H=new Map,N=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),A&&j.set(r,[]),y(x)?H.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):H.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),A){const t=j.get(r);t&&t.push(i)}}y(S)&&(S=[_t(Math.min.apply(null,S),0,1),_t(Math.max.apply(null,S),0,1)]);const V=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=H.get(t);if(null!==M)f[M]=m;else if(y(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[T]=s,f[w]=o,f[C]=l,f[E]=h,f[B]=c,f[P]=d,f[L]=n,f[R]=r,f[O]=u,f[I]=p,f[D]=g,A&&(f[F]=j.get(t)||[]),V.push(f)}return V};var Zr={},Jr={};function Qr(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function ta(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function ea(t,e){var i=t+"",s=i.length;return s9999?"+"+ea(e,6):ea(e,4))+"-"+ea(t.getUTCMonth()+1,2)+"-"+ea(t.getUTCDate(),2)+(r?"T"+ea(i,2)+":"+ea(s,2)+":"+ea(n,2)+"."+ea(r,3)+"Z":n?"T"+ea(i,2)+":"+ea(s,2)+":"+ea(n,2)+"Z":s||i?"T"+ea(i,2)+":"+ea(s,2)+"Z":"")}function sa(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 Jr;if(h)return h=!1,Zr;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(;a0}function ga(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=oa(t));var r=[];switch(t.type){case"GeometryCollection":return fa(t,(function(t){va(t,s)})),t;case"FeatureCollection":return ga(t,(function(t){ga(va(t,s),(function(t){r.push(t)}))})),hi(r)}return va(t,s)}function va(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return fa(t,(function(t){va(t,e)})),t;case"LineString":return _a(ua(t),e),t;case"Polygon":return ya(ua(t),e),t;case"MultiLineString":return ua(t).forEach((function(t){_a(t,e)})),t;case"MultiPolygon":return ua(t).forEach((function(t){ya(t,e)})),t;case"Point":case"MultiPoint":return t}}function _a(t,e){pa(t)===e&&t.reverse()}function ya(t,e){pa(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=ba(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},ka=(t,e={},i)=>{i.type=Yr.GEO;const s=Nr(Sa,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Aa(t))})):e.push(Aa(t))})),e})(t);let l=t.features;return o&&(l=ma(t,{reverse:!g(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=xa.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=xa.bounds(t);t.bbox=e}})),t.features=l,t},Ma={},Ta=(t,e,i)=>{i.type=Yr.GEO;const s=Nr(Sa,Ma,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 Or(a,t)}))}:Or(a,o));var a,o;return ka(r,s,i)},wa=(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 Ca=0;function Ea(t="dataset"){return Ca>1e8&&(Ca=0),t+"_"+Ca++}class Ba{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:Ea("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:ot.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()}}class Pa{constructor(t,e){let i;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=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&U(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Ea("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){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,e=!0){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)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}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,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&U(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof Pa||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!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",$r),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Yn();const La={},Ra={albers:dr,albersusa:function(){var t,e,i,s,n,r,a=dr(),o=cr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=cr().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)}},Oa=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Ia(t,e){return function i(){const s=e();return s.type=t,s.path=Yn().projection(s),s.copy=s.copy||function(){const t=i();return Oa.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Da{static GenAutoIncrementId(){return Da.auto_increment_id++}}Da.auto_increment_id=0;class Fa{constructor(t){this.id=Da.GenAutoIncrementId(),this.registry=t}}const za="named",ja="inject",Ha="multi_inject",Na="inversify:tagged",Va="inversify:paramtypes";class Ua{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===za?`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="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),s=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),n=new WeakMap;function r(t,e,i){let r=n.get(t);if(h(r)){if(!i)return;r=new s,n.set(t,r)}let a=r.get(e);if(h(a)){if(!i)return;a=new s,r.set(e,a)}return a}function a(t,e,i){if(o(t,e,i))return!0;const s=f(e);return!c(s)&&a(t,s,i)}function o(t,e,i){const s=r(e,i,!1);return!h(s)&&!!s.has(t)}function l(t,e,i){if(o(t,e,i))return function(t,e,i){const s=r(e,i,!1);if(!h(s))return s.get(t)}(t,e,i);const s=f(e);return c(s)?void 0:l(t,s,i)}function h(t){return void 0===t}function c(t){return null===t}function d(t){return"object"==typeof t?null!==t:"function"==typeof t}function u(t,i){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const s=3===i?"string":5===i?"number":"default",n=function(t,e){const i=t[e];if(null!=i){if(!g(i))throw new TypeError;return i}}(t,e);if(void 0!==n){const e=n.call(t,s);if(d(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.valueOf;if(g(i)){const e=i.call(t);if(!d(e))return e}}else{const e=t.valueOf;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.toString;if(g(i)){const e=i.call(t);if(!d(e))return e}}throw new TypeError}(t,"default"===s?"number":s)}function p(t){const e=u(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function g(t){return"function"==typeof t}function f(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const s=t.prototype,n=s&&Object.getPrototypeOf(s);if(null==n||n===Object.prototype)return e;const r=n.constructor;return"function"!=typeof r||r===t?e:r}t("defineMetadata",(function(t,e,i,s){if(!d(i))throw new TypeError;return n=t,a=e,void r(i,s,!0).set(n,a);var n,a})),t("hasMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),l(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function Ga(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};Wa.hasOwnMetadata(t,e)&&(r=Wa.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,Wa.defineMetadata(t,r,e)}(Na,t,i.toString(),s)}function Ya(t){return(e,i,s)=>{Ga(e,0,s,t)}}function $a(t){return e=>(i,s,n)=>Ya(new Ua(t,e))(i,s,n)}const Xa=$a(ja),Ka=$a(Ha);function qa(){return function(t){return Wa.defineMetadata(Va,null,t),t}}function Za(t){return Ya(new Ua(za,t))}const Ja="Singleton",Qa="Transient",to="ConstantValue",eo="DynamicValue",io="Factory",so="Function",no="Instance",ro="Invalid";class ao{constructor(t,e){this.id=Da.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=ro,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new ao(this.serviceIdentifier,this.scope);return t.activated=t.scope===Ja&&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 oo{getConstructorMetadata(t){return{compilerGeneratedMetadata:Wa.getMetadata(Va,t),userGeneratedMetadata:Wa.getMetadata(Na,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const lo=(ho=za,t=>{const e=e=>{if(null==e)return!1;if(e.key===ho&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const po=Symbol("ContributionProvider");class go{constructor(t,e){this.serviceIdentifier=t,this.container=e,mo.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function fo(t,e){t(po).toDynamicValue((({container:t})=>new go(e,t))).inSingletonScope().whenTargetNamed(e)}class mo{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}mo.store=new Map;class vo{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 _o extends vo{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const yo=Symbol.for("EnvContribution"),bo=Symbol.for("VGlobal"),xo=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Qa,this.options=e,this.id=Da.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new oo}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,za,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new ao(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new uo(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[ja],multiInject:s[Ha]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:a,metadata:e,bindings:l};n.push(t)}}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case to:case so:e=t.cache;break;case no: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===Ja&&(t.cache=e,t.activated=!0)}},So=Symbol.for("RenderService");const Ao=new class{get renderService(){return this._renderService||(this._renderService=xo.get(So)),this._renderService}};let ko=0;class Mo{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=Ao.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++ko,t),this.tryRunAnimationFrameNextFrame(),ko}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class To{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var wo=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Co=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Eo=function(t,e){return function(i,s){e(i,s,t)}},Bo=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 Po=class extends To{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}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){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Da.GenAutoIncrementId(),this.hooks={onSetEnv:new _o(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}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)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new Mo);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}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)}loadFont(t,e,i){return Bo(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}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,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var Lo,Ro,Oo,Io;Po=wo([qa(),Eo(0,Xa(po)),Eo(0,Za(yo)),Co("design:paramtypes",[Object])],Po),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(Lo||(Lo={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(Ro||(Ro={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(Oo||(Oo={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(Io||(Io={}));const Do=Nt-1e-8;class Fo{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>Do)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%=Nt)<0&&(s+=Nt),(n%=Nt)<0&&(n+=Nt),nn;++o,a-=Ht)g(a);else for(a=s-s%Ht+Ht,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const jo=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,Ho={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},No={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let Vo,Uo,Wo,Go,Yo,$o;var Xo,Ko,qo,Zo,Jo,Qo;function tl(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),f=Math.cos(n),m=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+f,A=i+m,k=S+y*m,M=A-y*f;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 el(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=oe(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 f=d/i,m=c/i,v=-c/s,_=d/s,y=f*o+m*l,b=v*o+_*l,x=f*t+m*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+=Nt:C>0&&0===r&&(C-=Nt);const E=Math.ceil(Math.abs(C/(Ht+.001))),B=[];for(let t=0;te.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 sl(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=cl(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=$t(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=$t(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function ul(t,e){const{p0:i,p1:s}=t,n=ae.pointAtPP(i,s,e);return[new pl(i,n),new pl(n,s)]}class pl extends nl{constructor(t,e){super(),this.type=Jo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return ae.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Wt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?ae.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Zo.ROW?Ut(this.p0.x-this.p1.x):t===Zo.COLUMN?Ut(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class gl{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new dl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new pl(new re(this._lastX,this._lastY),new re(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===Zo.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Ut(t.p0.y-s.y)}if(t===Zo.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Ut(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class fl extends gl{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 ml(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function vl(t,e,i){const s=null!=e?e:Ut(i[i.length-1].x-i[0].x)>Ut(i[i.length-1].y-i[0].y)?Zo.ROW:Zo.COLUMN;return"monotoneY"===t?new fl(t,s):new gl(t,s)}class _l{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 yl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=vl("linear",i,t);return function(t,e){ml(t,e,1)}(new _l(n,s),t),n}function bl(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 xl{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&&bl(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:bl(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 Sl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return yl(t,e);const n=vl("basis",i,t);return function(t,e){ml(t,e,2)}(new xl(n,s),t),n}function Al(t){return t<0?-1:1}function kl(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(Al(r)+Al(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Ml(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 wl{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,Ml(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,Ml(this,e=kl(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Tl(this,this._t0,e=kl(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 Cl extends wl{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function El(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return yl(t,e);const n=vl("monotoneX",i,t);return function(t,e){ml(t,e,2)}(new wl(n,s),t),n}function Bl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return yl(t,e);const n=vl("monotoneY",i,t);return function(t,e){ml(t,e,2)}(new Cl(n,s),t),n}let Pl=class{constructor(t,e=.5,i){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;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):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()}};class Ll extends Pl{lineEnd(){this.context.closePath()}}function Rl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new gl("step",null!=s?s:Ut(t[t.length-1].x-t[0].x)>Ut(t[t.length-1].y-t[0].y)?Zo.ROW:Zo.COLUMN);return Ol(new Pl(r,e,n),t),r}function Ol(t,e){return ml(t,e,1)}class Il extends _l{lineEnd(){this.context.closePath()}}function Dl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=vl("linear",i,t);return function(t,e){ml(t,e,1)}(new Il(n,s),t),n}function Fl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>zt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>zt){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function zl(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return yl(i,n);const o=vl(t,r,i);return ml(new e(o,s,a),i,2),o}}const jl=zl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:Fl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const Hl=zl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:Fl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class Nl extends nl{constructor(t,e,i){super(),this.type=Jo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return hl(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,rl([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===Zo.ROW?Ut(this.p0.x-this.p2.x):t===Zo.COLUMN?Ut(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Yt(t-.01,0),i=$t(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Wt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=hl(i,s,n,e),a=ae.pointAtPP(i,s,e),o=ae.pointAtPP(s,n,e);return[new Nl(i,a,r),new Nl(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Vl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new pl(new re(this._lastX,this._lastY),new re(t,e))}quadraticCurveTo(t,e,i,s){const n=new Nl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new dl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Ul(t,e,i){var s,n;switch(e){case"linear":default:return yl(t,i);case"basis":return Sl(t,i);case"monotoneX":return El(t,i);case"monotoneY":return Bl(t,i);case"step":return Rl(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new gl("step",null!=s?s:Ut(t[t.length-1].x-t[0].x)>Ut(t[t.length-1].y-t[0].y)?Zo.ROW:Zo.COLUMN);return Ol(new Ll(r,e,n),t),r}(t,.5,i);case"stepBefore":return Rl(t,0,i);case"stepAfter":return Rl(t,1,i);case"catmullRom":return jl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return Hl(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return Dl(t,i)}}class Wl extends zo{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Fo(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([No.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([No.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([No.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([No.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([No.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([No.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([No.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([No.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([No.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()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Vl(this);sl(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[No.M]=t=>`M${t[1]} ${t[2]}`,t[No.L]=t=>`L${t[1]} ${t[2]}`,t[No.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[No.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[No.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3];((t,e,i,s,n,r,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;e`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[No.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,e=Wo;for(let s=1,r=i.length;s{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,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),sl(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Zo.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Ut(t.p0.y-e.p1.y)}if(this.direction===Zo.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Ut(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{ot.getInstance().warn("空函数")}}),lh=Object.assign(Object.assign({},th),{points:[],cornerRadius:0,closePath:!0}),hh=Object.assign(Object.assign({},th),{width:100,height:100,spikes:5,thickness:.5}),ch=Object.assign(Object.assign({},th),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},th),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const dh=Object.assign(Object.assign({},th),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),uh=Object.assign(Object.assign(Object.assign({},th),Zl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),ph=Object.assign(Object.assign(Object.assign({},th),Zl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",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}),gh=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0,maxWidth:500,maxHeight:500},th),{fill:!0,cornerRadius:0,cornerType:"round"}),fh=Object.assign(Object.assign({},gh),{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}),mh=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 m("directional",t.sideOrCorner,1)||m("angular",t.angleValue,1)}function a(){return m("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=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 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=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 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 vh{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(vh.IsGradientStr(t))try{const e=mh(t)[0];if(e){if("linear"===e.type)return vh.ParseLinear(e);if("radial"===e.type)return vh.ParseRadial(e);if("conic"===e.type)return vh.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=jt/2,n=parseFloat(e.value)/180*jt-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Vt,stops:vh.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:vh.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=jt/2;let n="angular"===e.type?parseFloat(e.value)/180*jt:0;for(;n<0;)n+=Vt;for(;n>=Vt;)n-=Vt;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}const bh={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"}},xh=!0,Sh=!1,Ah=/\w|\(|\)|-/,kh=/[.?!,;:/,。?!、;:]/,Mh=/\S/,Th=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function wh(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=Ao.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=Ch(t,a)),a}function Ch(t,e,i=!1){let s=e;for(;Ah.test(t[s-1])&&Ah.test(t[s])||kh.test(t[s]);)if(s--,s<=0)return i?Eh(t,e):e;return s}function Eh(t,e){let i=e;for(;Ah.test(t[i+1])&&Ah.test(t[i])||kh.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Bh(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=Ao.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}var Ph=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Lh=class{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=uh.fontSize}){let i=0,s=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 a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=Ch(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_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){if(s===n){ot.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}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),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);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}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,a=!1){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=Ch(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}};Lh=Ph([qa()],Lh);var Rh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Oh=Symbol.for("TextMeasureContribution");let Ih=class extends Lh{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}};Ih=Rh([qa()],Ih);const Dh=Symbol.for("CanvasFactory"),Fh=Symbol.for("Context2dFactory");function zh(t){return xo.getNamed(Dh,Ao.global.env)(t)}const jh=1e-4,Hh=Math.sqrt(3),Nh=1/3;function Vh(t){return t>-ec&&tec||t<-ec}const Wh=[0,0],Gh=[0,0],Yh=[0,0];function $h(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Xh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function Kh(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 qh(t){return(t%=Vt)<0&&(t+=Vt),t}function Zh(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+=Vt);let d=Math.atan2(l,o);return d<0&&(d+=Vt),d>=s&&d<=n||d+Vt>=s&&d+Vt<=n}function tc(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(Vh(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 sc=[-1,-1,-1],nc=[-1,-1];function rc(){const t=nc[0];nc[0]=nc[1],nc[1]=t}function ac(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(Vh(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,Nh):Math.pow(i,Nh),s=s<0?-Math.pow(-s,Nh):Math.pow(s,Nh);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+Hh*Math.sin(e)))/(3*a),h=(-o+i*(s-Hh*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,sc);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&rc(),p=Kh(e,s,r,o,nc[0]),u>1&&(g=Kh(e,s,r,o,nc[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Vh(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,sc);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=Xh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);sc[0]=-l,sc[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Vt-1e-4){s=0,n=Vt;const e=r?1:-1;return a>=sc[0]+t&&a<=sc[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Vt,n+=Vt);let c=0;for(let e=0;e<2;e++){const i=sc[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Vt+t),(t>=s&&t<=n||t+Vt>=s&&t+Vt<=n)&&(t>jt/2&&t<1.5*jt&&(e=-e),c+=e)}}return c}function hc(t){return Math.round(t/jt*1e8)/1e8%2*jt}function cc(t,e){let i=hc(t[0]);i<0&&(i+=Vt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Vt?n=i+Vt:e&&i-n>=Vt?n=i-Vt:!e&&i>n?n=i+(Vt-hc(i-n)):e&&i1&&(i||(h+=Re(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],v=a[2],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,A=b;dc[0]=S,dc[1]=A,cc(dc,Boolean(a[6])),S=dc[0],A=dc[1];const k=S,M=A-S,T=!!(1-(a[6]?0:1)),w=(s-m)*_/_+m;switch(f){case No.M:u=m,p=v,c=u,d=p;break;case No.L:if(i){if(tc(c,d,m,v,e,s,n))return!0}else h+=Re(c,d,m,v,s,n)||0;c=m,d=v;break;case No.C:if(i){if(Jh(c,d,m,v,_,y,b,x,e,s,n))return!0}else h+=ac(c,d,m,v,_,y,b,x,s,n)||0;c=b,d=x;break;case No.Q:if(i){if(Zh(c,d,m,v,_,y,e,s,n))return!0}else h+=oc(c,d,m,v,_,y,s,n)||0;c=_,d=y;break;case No.A:if(o=Math.cos(k)*_+m,l=Math.sin(k)*_+v,g?(u=o,p=l):h+=Re(c,d,o,l,s,n),i){if(Qh(m,v,_,k,k+M,T,e,w,n))return!0}else h+=lc(m,v,_,k,k+M,T,w,n);c=Math.cos(k+M)*_+m,d=Math.sin(k+M)*_+v;break;case No.R:if(u=c=m,p=d=v,o=u+_,l=p+y,i){if(tc(u,p,o,p,e,s,n)||tc(o,p,o,l,e,s,n)||tc(o,l,u,l,e,s,n)||tc(u,l,u,p,e,s,n))return!0}else h+=Re(o,p,o,l,s,n),h+=Re(u,l,u,p,s,n);break;case No.Z:if(i){if(tc(c,d,u,p,e,s,n))return!0}else h+=Re(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},fc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const mc=Symbol.for("VWindow"),vc=Symbol.for("WindowHandlerContribution");let _c=class extends To{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(){super(),this.hooks={onChange:new _o(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(xo.getNamed(vc,t.env).configure(this,t),this.actived=!0)},this._uid=Da.GenAutoIncrementId(),this.global=Ao.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}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.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}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)}};_c=gc([qa(),fc("design:paramtypes",[])],_c);var yc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xc=function(t,e){return function(i,s){e(i,s,t)}};let Sc=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=Ao.global,this._textMeasureMap=new Map,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}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||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=pc.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="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:Zl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Fe(Object.assign({defaultFontParams:{fontFamily:Zl.fontFamily,fontSize:Zl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=xo.get(mc),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 Ac;Sc=yc([qa(),xc(0,Xa(po)),xc(0,Za(Oh)),bc("design:paramtypes",[Object])],Sc),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Ac||(Ac={}));const kc=new We;let Mc=class{constructor(){this.matrix=new We}init(t){return this.mode=Ac.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Ac.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(kc.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(kc.a,kc.b,kc.c,kc.d,kc.e,kc.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(kc.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(kc.a,kc.b,kc.c,kc.d,kc.e,kc.f),this}scale(t,e,i){return this.mode===Ac.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Ac.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return kc.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(kc.a,kc.b,kc.c,kc.d,kc.e,kc.f),this}translate(t,e){return this.mode===Ac.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Ac.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Mc=yc([qa(),bc("design:paramtypes",[])],Mc);const Tc={arc:eh,area:ih,circle:sh,line:ah,path:oh,symbol:dh,text:uh,rect:ch,polygon:lh,star:hh,richtext:ph,richtextIcon:fh,image:gh,group:nh,glyph:rh},wc=Object.keys(Tc);function Cc(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Ec={arc:Object.assign({},Tc.arc),area:Object.assign({},Tc.area),circle:Object.assign({},Tc.circle),line:Object.assign({},Tc.line),path:Object.assign({},Tc.path),symbol:Object.assign({},Tc.symbol),text:Object.assign({},Tc.text),rect:Object.assign({},Tc.rect),polygon:Object.assign({},Tc.polygon),star:Object.assign({},Tc.star),richtext:Object.assign({},Tc.richtext),richtextIcon:Object.assign({},Tc.richtextIcon),image:Object.assign({},Tc.image),group:Object.assign({},Tc.group),glyph:Object.assign({},Tc.glyph)};class Bc{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},wc.forEach((t=>{this._defaultTheme[t]=Object.create(Ec[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,i=!1){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,ot.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;wc.forEach((s=>{const n=Object.create(Ec[s]);t&&t[s]&&Cc(n,t[s]),i[s]&&Cc(n,i[s]),e[s]&&Cc(n,e[s]),this.combinedTheme[s]=n})),e.common&&wc.forEach((t=>{Cc(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 Pc=new Bc;function Lc(t,e){return t.glyphHost?Lc(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)):Pc.getTheme()}return null}(t)||t.attachedThemeGraphic&&Lc(t.attachedThemeGraphic)||Pc.getTheme()}var Rc=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 Oc 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=Da.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){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,e=!1){return Rc(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,e=!0){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,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)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===t||t===e)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&&ot.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)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,e=!1){let 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,e=!1){let 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,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Fc))return void ot.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(Nc(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 Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=Nc(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 Fc))return void ot.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=Nc(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 Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=Nc(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 Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=Hc.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Nc(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(Nc(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,Nc(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(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 Fc))return void ot.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"):Nc(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 zc))return void ot.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=Hc.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.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),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 Vc(s,{clickInterval:a,supportsTouchEvents:o}),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 Fc,this.rootWheelEvent=new zc,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.addEventListener("pointermove",this.onPointerMove,!0),t.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.addEventListener("mousemove",this.onPointerMove,!0),t.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.removeEventListener("pointermove",this.onPointerMove,!0),t.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.removeEventListener("mousemove",this.onPointerMove,!0),t.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 Yc{static GetImage(t,e){var i;const s=Yc.cache.get(t);s?"fail"===s.loadState?Ao.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):Yc.loadImage(t,e)}static GetSvg(t,e){var i;let s=Yc.cache.get(t);s?"fail"===s.loadState?Ao.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"},Yc.cache.set(t,s),s.dataPromise=Ao.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.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Yc.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Yc.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Ao.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Ao.global.loadBlob(t):"json"===e&&(i.dataPromise=Ao.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Yc.isLoading&&Yc.toLoadAueue.length){Yc.isLoading=!0;const t=Yc.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Yc.cache.set(i,n),n.dataPromise=Ao.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))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Yc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Yc.loading()})).catch((t=>{console.error(t),Yc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Yc.loading()}))}}),0)}static loadImage(t,e){const i=$c(t,Yc.toLoadAueue);if(-1!==i)return Yc.toLoadAueue[i].marks.push(e),void Yc.loading();Yc.toLoadAueue.push({url:t,marks:[e]}),Yc.loading()}static improveImageLoading(t){const e=$c(t,Yc.toLoadAueue);if(-1!==e){const t=Yc.toLoadAueue.splice(e,1);Yc.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function $c(t,e){for(let i=0;it?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(qc[0]=t[0],qc[2]=t[0],qc[1]=t[1],qc[3]=t[1],qc):t:t:0,Jc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Qc=[1,2,3,0,1,2,3,0];function td(t,e,i,s){for(;t>=Vt;)t-=Vt;for(;t<0;)t+=Vt;for(;t>e;)e+=Vt;Jc[0].x=i,Jc[1].y=i,Jc[2].x=-i,Jc[3].y=-i;const n=Math.ceil(t/Ht)%4,r=Math.ceil(e/Ht)%4;if(s.add(Gt(t)*i,Xt(t)*i),s.add(Gt(e)*i,Xt(e)*i),n!==r||e-t>jt){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{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)}}nd.TimeOut=1e3/60;const rd=new nd,ad=(t,e)=>{const i=((t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};class od{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}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function ld(t,e,i,s,n){return n?t.arc(i,s,e,0,Nt,!1,n):t.arc(i,s,e,0,Nt),!1}var hd=new class extends od{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 ld(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return ld(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(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 cd=new class extends od{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,this.parseSize(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,this.parseSize(e)/6,i,s,n,r)}};function dd(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 ud=new class extends od{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 dd(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return dd(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return dd(t,this.parseSize(e)/2+n,i,s,r)}};function pd(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var gd=new class extends od{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return pd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return pd(t,this.parseSize(e)/2+n,i,s)}};function fd(t,e,i,s,n=0){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}class md extends od{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 fd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return fd(t,this.parseSize(e)/2,i,s,n)}}var vd=new md;var _d=new class extends md{constructor(){super(...arguments),this.type="triangle"}};const yd=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),bd=Math.sin(Nt/10)*yd,xd=-Math.cos(Nt/10)*yd;function Sd(t,e,i,s){const n=bd*e,r=xd*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Nt*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 Ad=new class extends od{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 Sd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Sd(t,this.parseSize(e)/2+n,i,s)}};const kd=Kt(3);function Md(t,e,i,s){const n=e,r=n/kd,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 Td=new class extends od{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 Md(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Md(t,this.parseSize(e)/2+n,i,s)}};function wd(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 Cd=new class extends od{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return wd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return wd(t,this.parseSize(e)/2+n,i,s)}};function Ed(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Bd=new class extends od{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Ed(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ed(t,this.parseSize(e)/2+n,i,s)}};const Pd=-.5,Ld=Kt(3)/2,Rd=1/Kt(12);function Od(t,e,i,s){const n=e/2,r=e*Rd,a=n,o=e*Rd+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(Pd*n-Ld*r+i,Ld*n+Pd*r+s),t.lineTo(Pd*a-Ld*o+i,Ld*a+Pd*o+s),t.lineTo(Pd*l-Ld*h+i,Ld*l+Pd*h+s),t.lineTo(Pd*n+Ld*r+i,Pd*r-Ld*n+s),t.lineTo(Pd*a+Ld*o+i,Pd*o-Ld*a+s),t.lineTo(Pd*l+Ld*h+i,Pd*h-Ld*l+s),t.closePath(),!1}var Id=new class extends od{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 Od(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Od(t,this.parseSize(e)/2+n,i,s)}};function Dd(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}var Fd=new class extends od{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 Dd(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Dd(t,this.parseSize(e)/2,i,s,n)}};function zd(t,e,i,s,n=0){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}var jd=new class extends od{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 zd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return zd(t,this.parseSize(e)/2,i,s,n)}};function Hd(t,e,i,s,n=0){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}var Nd=new class extends od{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 Hd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Hd(t,this.parseSize(e)/2,i,s,n)}};const Vd=Kt(3);function Ud(t,e,i,s){const n=e*Vd;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var Wd=new class extends od{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Ud(t,this.parseSize(e)/2/Vd,i,s)}drawOffset(t,e,i,s,n){return Ud(t,this.parseSize(e)/2/Vd+n,i,s)}};function Gd(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 Yd=new class extends od{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 Gd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Gd(t,this.parseSize(e)/4+n,i,s)}};function $d(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 Xd=new class extends od{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 $d(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return $d(t,this.parseSize(e)/4+n,i,s)}};function Kd(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 qd=new class extends od{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 Kd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Kd(t,this.parseSize(e)/4+n,i,s)}};function Zd(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 Jd=new class extends od{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 Zd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Zd(t,this.parseSize(e)/4+n,i,s)}};function Qd(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var tu=new class extends od{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return Qd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Qd(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function eu(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var iu=new class extends od{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return eu(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return eu(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function su(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 nu=new class extends od{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 su(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return su(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function ru(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function au(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var ou=new class extends od{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)?au(t,e,i,s):ru(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?au(t,e+2*n,i,s):ru(t,[e[0]+2*n,e[1]+2*n],i,s)}};const lu=new Ve;class hu{constructor(t,e,i=!1){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 e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),sl(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(sl(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{lu.x1=i.bounds.x1*t,lu.y1=i.bounds.y1*t,lu.x2=i.bounds.x2*t,lu.y2=i.bounds.y2*t,e.union(lu)}))}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 cu={};[hd,cd,ud,gd,Wd,_d,Ad,Td,Cd,Bd,Id,Fd,jd,vd,Nd,Yd,Xd,qd,Jd,ou,tu,iu,nu].forEach((t=>{cu[t.type]=t}));const du={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"};class uu{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 pu(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function gu(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",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=gu(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=pu(t,"--\x3e",r+4,"Comment is not closed.");else{const a=gu(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 uu(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 uu(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 vu(t,e){return _u(t)}function _u(t,e){const i={};for(let e=0;ewu.set(t,!0)));const Cu=new Map;function Eu(t){if(wu.has(t))return!0;if(Cu.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>Cu.set(t,!0)));const Bu=Mu(),Pu=Mu(),Lu=Mu(),Ru=Mu(),Ou=Mu(),Iu=Mu(),Du=Mu(),Fu=Mu(),zu=Mu(),ju=Mu();Mu();const Hu=Mu();Mu();const Nu=Mu();Mu();const Vu=Mu(),Uu=Mu(),Wu=Symbol.for("GraphicService"),Gu=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"},$u=Object.keys(Yu),Xu={duration:200,easing:"cubicOut"};function Ku(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}function qu(t,e,i){const s=i[0],n=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]*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],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*s+c*n+g*r+e[12],t[13]=o*s+d*n+f*r+e[13],t[14]=l*s+u*n+m*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function Zu(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 Ju(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],f=e[12],m=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*f,t[1]=y*n+b*l+x*u+S*m,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*f,t[5]=y*n+b*l+x*u+S*m,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*f,t[9]=y*n+b*l+x*u+S*m,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*f,t[13]=y*n+b*l+x*u+S*m,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function Qu(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 tp{constructor(){this.pools=[]}static identity(t){return Ku(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 tp.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},np=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const rp=new We(1,0,0,1,0,0),ap={x:0,y:0};let op=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new We(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new We(1,0,0,1,0,0),this.path=new Wl,this._clearMatrix=new We(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return ep.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new We(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(ep.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(ep.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){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,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=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(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){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},ap),function(t,e,i){return uc(t,0,!1,e,i)}(this.path.commandList,ap.x,ap.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},ap);const i=_h(this,this.lineWidth,this.dpr);return function(t,e,i,s){return uc(t,e,!0,i,s)}(this.path.commandList,i,ap.x,ap.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(t=!0,e=this.dpr){this.setTransformFromMatrix(rp,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>ep.free(t))),this.stack.length=0}};op=sp([qa(),np("design:paramtypes",[Object,Number])],op);const lp={WIDTH:500,HEIGHT:500,DPR:1};class hp{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}set nativeCanvas(t){this._nativeCanvas=t}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=lp.WIDTH,height:n=lp.HEIGHT,dpr:r=lp.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(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var cp;hp.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(cp||(cp={}));class dp{static Get(t,e=cp.Color1,i=[0,0,0,1]){if(e===cp.Color1){const e=dp.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ii.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];dp.store1[t]=e,dp.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=dp.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ii.parseColorString(t);return n&&(dp.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],dp.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===cp.Color1){if(dp.store1[t])return;dp.store1[t]=i,dp.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(dp.store255[t])return;dp.store255[t]=i,dp.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function up(t,e=!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 pp(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)=>{var a,o;return gp(y(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,y(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):gp(t,e,i,s,n)}function gp(t,e,i,s,n){if(!t||!e)return t&&up(t)||e&&up(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=dp.Get(t,cp.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=dp.Get(e,cp.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:up(a)})))});return o?pp(r,l,i,s,n):pp(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:_p(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:_p(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:_p(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),up(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)}function fp(t,e,i){return`rgba(${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})`}dp.store255={},dp.store1={};const mp=[0,0,0,0],vp=[0,0,0,0];function _p(t,e,i){return dp.Get(t,cp.Color255,mp),dp.Get(e,cp.Color255,vp),`rgba(${Math.round(mp[0]+(vp[0]-mp[0])*i)},${Math.round(mp[1]+(vp[1]-mp[1])*i)},${Math.round(mp[2]+(vp[2]-mp[2])*i)},${mp[3]+(vp[3]-mp[3])*i})`}class yp{static GetCanvas(){try{return yp.canvas||(yp.canvas=Ao.global.createCanvas({})),yp.canvas}catch(t){return null}}static GetCtx(){if(!yp.ctx){const t=yp.GetCanvas();yp.ctx=t.getContext("2d")}return yp.ctx}}class bp extends Ge{static getInstance(){return bp._instance||(bp._instance=new bp),bp._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=yp.GetCanvas(),s=yp.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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new bp(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class xp{static GetSize(t){for(let e=0;e=t)return xp.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=xp.GenKey(t,e,i,s,n),l=xp.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=xp.GenKey(t,e,i,s,n);xp.cache[l]?xp.cache[l].push({width:a,height:o,pattern:r}):xp.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}xp.cache={},xp.ImageSize=[20,40,80,160,320,640,1280,2560];const Sp=new Ve,Ap=new We;new Ve;const kp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],Mp=["x","y"],Tp=["scaleX","scaleY"],wp=["angle"],Cp=new re,Ep={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Bp extends Oc{static mixin(t){const e=Object.keys(t);for(let i=0;i10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=cu[t];if(e)return e;if(e=Bp.userSymbolMap[t],e)return e;if(!0===((i=t=du[t]||t).startsWith("{const e=(new Wl).fromString(t.d),i={};$u.forEach((e=>{t[e]&&(i[Yu[e]]=t[e])})),n.push({path:e,attribute:i}),Sp.union(e.bounds)}));const r=Sp.width(),a=Sp.height(),o=1/Yt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new hu(t,n,!0);return Bp.userSymbolMap[t]=l,l}var i;const s=(new Wl).fromString(t),n=s.bounds.width(),r=s.bounds.height(),a=1/Yt(n,r);s.transform(0,0,a,a);const o=new hu(t,s);return Bp.userSymbolMap[t]=o,o}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,s=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:n=e.boundsPadding}=i,r=Zc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new Fo(t);return sl(e.commandList,i,0,0),!0}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(t=!0){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(t=!0){return this._transMatrix||(this._transMatrix=new We),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&Xo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&Xo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&Xo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&Xo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&Xo.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&Xo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=Xo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===Ko.GLOBAL){const i=new re(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){this.setAttributes(t,e,i),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||s)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,i){t&&((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,e=!1,i){const s=Object.keys(t);for(let e=0;e{i[e]?(o||(o={}),o[e]=t[e]):a[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(r=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==r?r:Xu;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:a,duration:l.duration,easing:l.easing}}]),o&&this.setAttributesAndPreventAnimate(o,!1,{type:qo.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t)}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:qo.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{type:qo.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(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,i;const s=this.attribute[t];return this.animates&&this.animates.size?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=s?s:null===(i=this.finalAttribute)||void 0===i?void 0:i[t]}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){const i=y(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);s.length!==this.currentStates.length&&this.useStates(s,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;this.stateSort&&(t=t.sort(this.stateSort));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|=Xo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=Xo.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=Xo.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&Xo.UPDATE_SHAPE_AND_BOUNDS)===Xo.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=Xo.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Xo.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Xo.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=Xo.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=Xo.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=Xo.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=Xo.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&Xo.UPDATE_LAYOUT)}getAnchor(t,e,i){const s=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=$l.x,y:e=$l.y,scaleX:i=$l.scaleX,scaleY:s=$l.scaleY,angle:n=$l.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(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=Gt(a),f=Xt(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const _=m-i,y=v-s,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,A=d*g-h*f;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*A,t.e=u+l*m+c*v-b*_-S*y,t.f=p+h*m+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,!0),Ao.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY($l);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Ap.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.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:qo.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Ao.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),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 Wl).fromString(t):this.pathProxy=new Wl,this.pathProxy}loadImage(t,e=!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(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",this.stopAnimates(),Ao.graphicService.onRelease(this),super.release()}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new jc(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)}}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||Ao.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new op(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}var Pp;Bp.userSymbolMap={},Bp.mixin(Uc),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Pp||(Pp={}));let Lp=class t extends Bp{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Iu,this._childUpdateTag=Xo.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 Bc),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Bc)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===Ko.GLOBAL){const i=new re(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&Xo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=$l.x,y:e=$l.y,dx:i=$l.dx,dy:s=$l.dy,scaleX:n=$l.scaleX,scaleY:r=$l.scaleY,angle:a=$l.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()}getGraphicTheme(){return Lc(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return Ao.graphicService.updateTempAABBBounds(i),Ao.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=Xo.CLEAR_BOUNDS,this._childUpdateTag&=Xo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=Xo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&Xo.UPDATE_BOUNDS||(this._childUpdateTag|=Xo.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(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().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),this.getGraphicService().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(t=!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&Xo.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=Ao.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}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}};function Rp(t){return new Lp(t)}Lp.NOWORK_ANIMATE_ATTR=Ep;class Op extends Lp{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 Bc,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!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=>{Ao.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=>{Ao.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 Ip=Symbol.for("TransformUtil"),Dp=Symbol.for("GraphicUtil"),Fp=Symbol.for("LayerService"),zp=Symbol.for("StaticLayerHandlerContribution"),jp=Symbol.for("DynamicLayerHandlerContribution"),Hp=Symbol.for("VirtualLayerHandlerContribution");var Np,Vp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)};let Wp=Np=class{static GenerateLayerId(){return`${Np.idprefix}_${Np.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Ao.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?xo.get(zp):"dynamic"===t?xo.get(jp):xo.get(Hp),e}createLayer(t,e={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 Op(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Np.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)}};Wp.idprefix="visactor_layer",Wp.prefix_count=0,Wp=Np=Vp([qa(),Up("design:paramtypes",[])],Wp);var Gp=new Fa((t=>{t(bo).to(Po).inSingletonScope(),t(mc).to(_c),t(Dp).to(Sc).inSingletonScope(),t(Ip).to(Mc).inSingletonScope(),t(Fp).to(Wp).inSingletonScope()}));function Yp(t,e){return!(!t&&!e)}function $p(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Xp(t,e,i){return i&&t*e>0}function Kp(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function qp(t,e){return t*e>0}function Zp(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Jp(t,e,i,s,n,r,a){const o=t-i,l=e-s,h=(a?r:-r)/Math.sqrt(o*o+l*l),c=h*l,d=-h*o,u=t+c,p=e+d,g=i+c,f=s+d,m=(u+g)/2,v=(p+f)/2,_=g-u,y=f-p,b=_*_+y*y,x=n-r,S=u*f-g*p,A=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let k=(S*y-_*A)/b,M=(-S*_-y*A)/b;const T=(S*y+_*A)/b,w=(-S*_+y*A)/b,C=k-m,E=M-v,B=T-m,P=w-v;return C*C+E*E>B*B+P*P&&(k=T,M=w),{cx:k,cy:M,x01:-c,y01:-d,x11:k*(n/x-1),y11:M*(n/x-1)}}function Qp(t,e,i,s,n){const r=Ut(i-e),a=t.getParsedCornerRadius(),o=y(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,_=Math.max(f,g),b=Math.max(m,v);let x=_,S=b;const A=n*Gt(c),k=n*Xt(c),M=s*Gt(u),T=s*Xt(u);let w,C,E,B;if((b>zt||_>zt)&&(w=n*Gt(d),C=n*Xt(d),E=s*Gt(p),B=s*Xt(p),r1?0:P<-1?jt:Math.acos(P))/2),l=Kt(t[0]*t[0]+t[1]*t[1]);S=$t(b,(s-l)/(o-1)),x=$t(_,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:E,yirs:B,xore:w,yore:C,xire:M,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:_,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function tg(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ut(l-o),c=l>o;let d=!1;if(n=Vt-zt)e.moveTo(i+n*Gt(o),s+n*Xt(o)),e.arc(i,s,n,o,l,!c),r>zt&&(e.moveTo(i+r*Gt(l),s+r*Xt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:M,limitedIcr:T,innerDeltaAngle:w,innerEndAngle:C,innerStartAngle:E,innerCornerRadiusStart:B,innerCornerRadiusEnd:P,maxInnerCornerRadius:L}=Qp(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>zt){const t=$t(v,m),r=$t(_,m),o=Jp(g,f,u,p,n,t,Number(c)),l=Jp(b,x,S,A,n,r,Number(c));m0&&e.arc(i+o.cx,s+o.cy,t,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,n,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Gt(Wt(l.y01,l.x01)),s+l.cy+r*Xt(Wt(l.y01,l.x01))):e.moveTo(i+b,s+n*Xt(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,M,!c)):e.moveTo(i+n*Gt(M),s+n*Xt(M));if(!(r>zt)||w<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(T>zt){const t=$t(B,T),n=$t(P,T),o=Jp(S,A,b,x,r,-n,Number(c)),l=Jp(u,p,g,f,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,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,r,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Gt(Wt(l.y01,l.x01)),s+l.cy+t*Xt(Wt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),!a||a[2]?e.arc(i,s,r,C,E,c):e.moveTo(i+r*Gt(E),s+r*Xt(E))}return a?a[3]&&e.lineTo(i+n*Gt(o),s+n*Xt(o)):e.closePath(),d}const eg=Symbol.for("ArcRenderContribution"),ig=Symbol.for("AreaRenderContribution"),sg=Symbol.for("CircleRenderContribution"),ng=Symbol.for("GroupRenderContribution"),rg=Symbol.for("ImageRenderContribution"),ag=Symbol.for("PathRenderContribution"),og=Symbol.for("PolygonRenderContribution"),lg=Symbol.for("RectRenderContribution"),hg=Symbol.for("SymbolRenderContribution"),cg=Symbol.for("TextRenderContribution"),dg=Symbol.for("InteractiveSubRenderContribution");function ug(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function pg(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}var gg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mg=function(t,e){return function(i,s){e(i,s,t)}};function vg(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:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:v}=e.attribute,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(s=m[2])&&void 0!==s?s:0}if(Ku(t),qu(t,t,[n+o,r+l,a+h]),qu(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),qu(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]),f){const i=ip.allocate(),s=[0,0];if(v){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=m[1]}qu(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,f),qu(i,i,[-s[0],-s[1],0]),Ju(t,t,i)}}let _g=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new _o(["graphic"]),onSetStage:new _o(["graphic","stage"]),onRemove:new _o(["graphic"]),onRelease:new _o(["graphic"]),onAddIncremental:new _o(["graphic","group","stage"]),onClearIncremental:new _o(["graphic","group","stage"]),beforeUpdateAABBBounds:new _o(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new _o(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new _o(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ve,this.tempAABBBounds2=new Ve}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)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new Fo(t);return sl(i.commandList,s,0,0),!0}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=pg(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=ug(n,e);i.set(s,i.y1,s+e,i.y2)}}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){Au(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;Au(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&&He(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};_g=gg([qa(),mg(0,Xa(Gu)),fg("design:paramtypes",[Object])],_g);const yg=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},bg=["radius","startAngle","endAngle",...kp];class xg extends Bp{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=Ru}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)}getGraphicTheme(){return Lc(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Ao.graphicService.updateTempAABBBounds(i);return yg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Vt-zt?i.set(-r,-r,r,r):td(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,bg)}needUpdateTag(t){return super.needUpdateTag(t,bg)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Wl,s.arc(0,0,r,a,o),s}clone(){return new xg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return xg.NOWORK_ANIMATE_ATTR}}function Sg(t){return new xg(t)}xg.NOWORK_ANIMATE_ATTR=Ep;class Ag{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Lo.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,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;a{t+=e.str})),(Array.isArray(r)?r.join(""):r).toString()!==t}return"vertical"===s.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==s.text.toString():null!=this.clipedText&&this.clipedText!==s.text.toString()}get multilineLayout(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=Uu,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}getGraphicTheme(){return Lc(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new Mg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Te(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=Ao.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Au(n,o/Math.abs(r+a),!0,l),i.union(n)}return Ao.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Ao.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,He(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:_=s.ignoreBuf,keepCenterInLine:y=s.keepCenterInLine}=n,b=_?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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(f/2),this._AABBBounds}const S=Ao.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new Ag(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:y}),{bbox:k}=A;return this.cache.layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{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,measureMode:v=r.measureMode,suffixPosition:_=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),k=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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 M=Ao.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),T={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:k},w=new Ag(a,T,M),C=y(t)?t.map((t=>t.toString())):[t.toString()],E=[],B=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/k),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),B[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const t=ug(_,a),e=this.cache.verticalList.length*v,i=pg(y,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>function(t){const e=[];let i=0,s="";for(let n=0;n{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===Tu.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))})),this.cache.verticalList=b,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const x=ug(_,a),S=this.cache.verticalList.length*v,A=pg(y,S,d);return this._AABBBounds.set(A,x,A+S,x+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=ad(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=kg){return super.needUpdateTags(t,e)}needUpdateTag(t,e=kg){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new Mg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Mg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return Mg.baselineMapAlign}getAlignMapBaseline(){return Mg.alignMapBaseline}}function Tg(t){return new Mg(t)}Mg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Ep),Mg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},Mg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const wg=["symbolType","size",...kp];let Cg=class t extends Bp{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=Vu}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}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{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return Lc(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Ao.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Au(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(y(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){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,wg)}needUpdateTag(t){return super.needUpdateTag(t,wg)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new Wl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Wl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Eg(t){return new Cg(t)}Cg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Ep);const Bg=["segments","points","curveType","curveTension",...kp];let Pg=class t extends Bp{constructor(t={}){super(t),this.type="line",this.numberType=Fu}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=id(i,s,e))}getGraphicTheme(){return Lc(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),Ao.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Bg)}needUpdateTag(t){return super.needUpdateTag(t,Bg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Wl;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Lg(t){return new Pg(t)}Pg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ep);const Rg=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}},Og=["width","x1","y1","height","cornerRadius",...kp];class Ig extends Bp{constructor(t){super(t),this.type="rect",this.numberType=Hu}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Lc(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=Ao.graphicService.updateTempAABBBounds(i);return yg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Og)}needUpdateTag(t){return super.needUpdateTag(t,Og)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=Rg(e);return t=new Wl,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new Ig(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ig.NOWORK_ANIMATE_ATTR}}function Dg(t){return new Ig(t)}Ig.NOWORK_ANIMATE_ATTR=Ep;class Fg extends Bp{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,e=!1,i){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}getGraphicTheme(){return Lc(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}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(),this.stateSort&&(t=t.sort(this.stateSort));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.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Fg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Fg.NOWORK_ANIMATE_ATTR}}function zg(t){return new Fg(t)}Fg.NOWORK_ANIMATE_ATTR=Ep;class jg{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=bh[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}}}function Hg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Ng{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=ad(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Bh(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||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,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r: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}=Bh(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=wh(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Bh(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=Hg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=wh(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Bh(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&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=wh(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Bh(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const Vg=["width","height","image",...kp];class Ug extends Bp{constructor(t){super(t),this.type="image",this.numberType=Du,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}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()})),this.addUpdateBoundTag()}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)}getGraphicTheme(){return Lc(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=Ao.graphicService.updateTempAABBBounds(i);return yg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return gh[t]}needUpdateTags(t){return super.needUpdateTags(t,Vg)}needUpdateTag(t){return super.needUpdateTag(t,Vg)}clone(){return new Ug(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ug.NOWORK_ANIMATE_ATTR}}function Wg(t){return new Ug(t)}Ug.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Ep);class Gg extends Ug{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=Zc(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=Zc(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=gh.width,height:e=gh.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 Yg{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 Gg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=bh[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Ng){const e=Mh.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,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Gg)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Bh(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Gg)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Gg)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||Sh;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,Th(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||xh;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?yh(t,s,{AABBBounds:i}):s,Th(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Gg)break;const{width:n}=Bh(t,s.character,s.ascentDescentMode),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.forEach(((t,e)=>{i+=t instanceof Gg?t.width:t.getWidthWithEllips(this.direction)})),i}}class $g{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=bh[this.direction]}store(t){if(t instanceof Gg){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 Yg(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,e=!1){t instanceof Gg?"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||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=wh(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Ng(i,t.newLine,t.character,t.ascentDescentMode),new Ng(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Xg=!1;try{Xg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Xg=!1}const Kg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...kp];class qg extends Bp{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Nu,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:ph.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:ph.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:ph.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:ph.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:ph.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:ph.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:ph.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:ph.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Lc(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&_(t.text)&&qg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&_(t.text)&&qg.splitText(t.text).length>1)))}static splitText(t){if(Xg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=qg.splitText(t.text.toString());if(_(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),Ao.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Ao.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Kg)}needUpdateTag(t){return super.needUpdateTag(t,Kg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!qg.AllSingleCharacter(_)&&(_=qg.TransformTextConfig2SingleCharacter(_),this.attribute.textConfig=_);const y=[],b=null!=t?t:_;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,y.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),M="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),T=new jg(0,0,(k?n:x?i:0)||0,(M?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&x,!M&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),w=new $g(T);if(w.newLine=v,p){let t=0,e=!1;for(let i=0;i{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new qg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(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())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return qg.NOWORK_ANIMATE_ATTR}}function Zg(t){return new qg(t)}qg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Ep);const Jg=["path","customPath",...kp];class Qg extends Bp{constructor(t){super(t),this.type="path",this.numberType=zu}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=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Wl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Wl?this.cache:t.path)}getGraphicTheme(){return Lc(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=Ao.graphicService.updateTempAABBBounds(i);yg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new Wl).fromString(t.path):t.customPath&&(this.cache=new Wl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,Jg)}needUpdateTag(t){return super.needUpdateTag(t,Jg)}toCustomPath(){return(new Wl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Qg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Qg.NOWORK_ANIMATE_ATTR}}function tf(t){return new Qg(t)}Qg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Ep);const ef=["segments","points","curveType","curveTension",...kp];class sf extends Bp{constructor(t){super(t),this.type="area",this.numberType=Lu}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}getGraphicTheme(){return Lc(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),Ao.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),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}_interpolate(t,e,i,s,n){"points"===t&&(n.points=id(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,ef)}needUpdateTag(t){return super.needUpdateTag(t,ef)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Wl;const 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 sf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return sf.NOWORK_ANIMATE_ATTR}}function nf(t){return new sf(t)}sf.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ep);const rf=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...kp];class af extends Bp{constructor(t){super(t),this.type="arc",this.numberType=Bu}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=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(y(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();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=he(e),i=e+r,s&&Ut(r)zt&&o>zt)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=this.getGraphicTheme(),{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=Kt(a*a+o*o)}=this.attribute,h=Ut(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>zt&&l>zt){const i=e>t?1:-1;let s=Zt(Number(l)/o*Xt(g)),n=Zt(Number(l)/a*Xt(g));return(f-=2*s)>zt?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>zt?(n*=i,c+=n,d-=n):(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}}getGraphicTheme(){return Lc(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Ao.graphicService.updateTempAABBBounds(i);yg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=zt?i.set(0,0,0,0):Math.abs(o-l)>Vt-zt?i.set(-s,-s,s,s):(td(l,o,s,i),td(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,rf)}needUpdateTag(t){return super.needUpdateTag(t,rf)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Ut(o-a),d=o>a;if(h=Vt-zt)n.moveTo(0+h*Gt(a),0+h*Xt(a)),n.arc(0,0,h,a,o,!d),l>zt&&(n.moveTo(0+l*Gt(o),0+l*Xt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Gt(a),e=h*Xt(a),i=l*Gt(o),s=l*Xt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new af(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return af.NOWORK_ANIMATE_ATTR}}function of(t){return new af(t)}af.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Ep);const lf=["points","cornerRadius",...kp];class hf extends Bp{constructor(t){super(t),this.type="polygon",this.numberType=ju}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Lc(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),Ao.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=id(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,lf)}needUpdateTag(t){return super.needUpdateTag(t,lf)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Wl,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new hf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return hf.NOWORK_ANIMATE_ATTR}}function cf(t){return new hf(t)}hf.NOWORK_ANIMATE_ATTR=Ep;class df extends Lp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!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 uf(t){return new df(t)}const pf=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 gf,ff;function mf(t){return gf||(gf=pf.CreateGraphic("text",{})),gf.initAttributes(t),gf.AABBBounds}var vf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},yf=function(t,e){return function(i,s){e(i,s,t)}};class bf{constructor(){this.time=Qo.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:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit,backgroundKeepAspectRatio:y=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip}=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=Lc(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:_,backgroundKeepAspectRatio:y,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s){const{backgroundMode:n,backgroundFit:r,backgroundKeepAspectRatio:a,backgroundScale:o=1,backgroundOffsetX:l=0,backgroundOffsetY:h=0}=s,c=i.width(),d=i.height();let u=c,p=d;if("no-repeat"===n)if(r)if(a){const s=Math.max(c/e.width,d/e.height);t.drawImage(e,i.x1+l,i.y1+h,e.width*s*o,e.height*s*o)}else t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const s=e.width*o,n=e.height*o;t.drawImage(e,i.x1+l,i.y1+h,s,n)}else{if(r&&"repeat"!==n&&(e.width||e.height)){const i=e.width,s=e.height;"repeat-x"===n?(u=i*(d/s),p=d):"repeat-y"===n&&(p=s*(c/i),u=c);const r=t.dpr,a=pc.allocate({width:u,height:p,dpr:r}),o=a.getContext("2d");o&&(o.inuse=!0,o.clearMatrix(),o.setTransformForCurrent(!0),o.clearRect(0,0,u,p),o.drawImage(e,0,0,u,p),e=a.nativeCanvas),pc.free(a)}const s=t.dpr,a=t.createPattern(e,n);a.setTransform&&a.setTransform(new DOMMatrix([1/s,0,0,1/s,0,0])),t.fillStyle=a,t.translate(i.x1,i.y1),t.fillRect(0,0,c,d),t.translate(-i.x1,-i.y1)}}}const xf=new bf;let Sf=class{constructor(t){this.subRenderContribitions=t,this.time=Qo.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)}))}};Sf=vf([qa(),yf(0,Xa(po)),yf(0,Za(dg)),_f("design:paramtypes",[Object])],Sf);const Af=new class{constructor(){this.time=Qo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),_=t.AABBBounds,y=null!==(p=t.attribute.width)&&void 0!==p?p:_.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:_.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[y,b],i+y/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const kf=new class{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}};class Mf{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=pc.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])),pc.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,Vt),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:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h;const{textureRatio:c=r.textureRatio,textureOptions:d=null}=e.attribute;let u=this.textureMap.get(t);if(!u)switch(t){case"circle":u=this.createCirclePattern(o,l,a,i);break;case"diamond":u=this.createDiamondPattern(o,l,a,i);break;case"rect":u=this.createRectPattern(o,l,a,i);break;case"vertical-line":u=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":u=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":u=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":u=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":u=this.createGridPattern(o,l,a,i)}if(d&&d.dynamicTexture){const{gridConfig:u={},useNewCanvas:p}=d,g=e.AABBBounds;s=g.x1,n=g.y1;const f=i;let m;if(p){m=pc.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=m.getContext("2d");t.clearRect(0,0,g.width(),g.height()),s=0,n=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,s,n,r),f.clip();const v=g.width(),_=g.height(),y=l,b=o,x=u.columns?u.columns:Math.ceil(v/b),S=u.rows?u.rows:Math.ceil(_/b),A=u.gutterColumn?u.gutterColumn:2*y,k=u.gutterRow?u.gutterRow:2*y;this._tempSymbolGraphic||(this._tempSymbolGraphic=Eg({}));const M=u.columns?v/u.columns:b,T=u.rows?_/u.rows:b;this._tempSymbolGraphic.setAttributes({size:[M-A,T-k],symbolType:t});const w=this._tempSymbolGraphic.getParsedPath();for(let t=0;t{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:_h(e,o,e.dpr),c=o/w,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:w+u*h,innerRadius:T-u*h,startAngle:_-u*c,endAngle:y+u*c}),e.beginPath(),tg(t,e,i,s,w+u*h,T-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/A,(S-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder"),t.setAttributes({outerRadius:w,innerRadius:T,startAngle:_,endAngle:y})}},Cf=Tf,Ef=xf;const Bf=new class{constructor(){this.time=Qo.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,f=p&&!1!==p.visible;if(!g&&!f)return;const{radius:m=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,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:_h(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),f&&M(p,"innerBorder")}},Pf=Tf,Lf=xf;const Rf=new class extends bf{constructor(){super(...arguments),this.time=Qo.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,backgroundKeepAspectRatio:f=l.backgroundKeepAspectRatio,backgroundScale:m=l.backgroundScale,backgroundOffsetX:v=l.backgroundOffsetX,backgroundOffsetY:_=l.backgroundOffsetY}=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,{backgroundMode:p,backgroundFit:g,backgroundKeepAspectRatio:f,backgroundScale:m,backgroundOffsetX:v,backgroundOffsetY:_}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Of=jt/2;function If(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=Ut(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Ut(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Ut(t[0]),i=Ut(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Ut(l[0]),l[1]=Ut(l[1]),l[2]=Ut(l[2]),l[3]=Ut(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],_=[c[0],c[1]+g[1]],y=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],x=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!q(v,_)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Of,0,!1)}if(o&&o[1]?o[1](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(y,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Of,!1)}if(o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),!q(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Of,jt,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],jt,jt+Of,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}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};class Ff{constructor(){this.time=Qo.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,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:M,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:w,height:C}=t.attribute;w=(null!=w?w:k-i)||0,C=(null!=C?C:M-s)||0;const E=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=T?h:_h(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||y(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,w-o*g,C-o*g)):(e.beginPath(),If(e,u,p,w-o*g,C-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&E(u,"outerBorder"),f&&E(p,"innerBorder")}}let zf=class{constructor(){this.time=Qo.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)}};zf=Df([qa()],zf);let jf=class{constructor(){this.time=Qo.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:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:_=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||y(v)&&v.every((t=>0===t)))){let n,r=0;return If(e,i,s,b,x,v,"bevel"!==_,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};jf=Df([qa()],jf);const Hf=new Ff,Nf=Tf,Vf=xf;const Uf=new class extends Ff{constructor(){super(...arguments),this.time=Qo.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)}},Wf=xf;const Gf=new class{constructor(){this.time=Qo.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,f=p&&!1!==p.visible,m=g&&!1!==g.visible;if(!f&&!m)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,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,k=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:_h(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(y-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}},Yf=new class{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:_=l.scaleX,scaleY:y=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/_,(f-s)/y,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/_,(f-s)/y,l),e.stroke())))}},$f=Tf,Xf=xf;const Kf={x:0,y:0,z:0,lastModelMatrix:null};class qf{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(Af),this.builtinContributions.push(kf),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===Qo.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Qo.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}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)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Lc(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,_=Xp(d,u,h),y=qp(d,g),b=Yp(h),x=$p(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(_||y||a||o))return!0;e.beginPath();return sl(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),!0}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=Xp(o,l,n),p=qp(o,c),g=Yp(n,r),f=$p(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){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;Kf.x=n,Kf.y=r,Kf.z=a,Kf.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=ip.allocate(),n=ip.allocate();vg(n,t,e),Ju(s,d||s,n),Kf.x=0,Kf.y=0,Kf.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),ip.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Kf.x+=s.x,Kf.y+=s.y,Kf.z=a,i.setTransformForCurrent()}else if(p)Kf.x=0,Kf.y=0,Kf.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Kf.x+=s.x,Kf.y+=s.y,this.transformWithoutTranslate(i,Kf.x,Kf.y,Kf.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Kf.x=0,Kf.y=0,Kf.z=0;return Kf}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,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,_=(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,f,m,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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&ip.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}var Zf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qf=function(t,e){return function(i,s){e(i,s,t)}};let tm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Bu,this.builtinContributions=[wf,Ef,Cf],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=d>c;let p=!1;if(nzt){const t=$t(b,y),r=$t(x,y),a=Jp(v,_,f,m,n,t,Number(u)),o=Jp(A,k,M,T,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,Wt(o.y11,o.x11),Wt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>zt)||C<.001)e.lineTo(i+M,s+T),p=!0;else if(w>zt){const t=$t(B,w),n=$t(P,w),a=Jp(M,T,A,k,r,-n,Number(u)),o=Jp(f,m,v,_,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),w0&&e.arc(i+a.cx,s+a.cy,n,Wt(a.y01,a.x01),Wt(a.y11,a.x11),!u);const t=Wt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Gt(E),s+r*Xt(E));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Lc(t,null==r?void 0:r.theme).arc;const{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:k=l.outerRadius,innerRadius:M=l.innerRadius}=t.attribute;k+=b,M-=x;let T=0;const w=(c(S)&&S||S[0])&&"conical"===h.gradient;if(w){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Ut(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((_||E)&&(e.beginPath(),tg(t,e,i,s,k,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),g?(this._runStroke(t,e,i,s,l,y,E,v,o),this._runFill(t,e,i,s,l,_,m,u,p,a)):(this._runFill(t,e,i,s,l,_,m,u,p,a),this._runStroke(t,e,i,s,l,y,E,v,o))),!E&&y&&(e.beginPath(),tg(t,e,i,s,k,M,B),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(c(S)&&S||S[1])&&A){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Ut(h-r)>=Vt-zt){e.beginPath();const r=Math.abs(k-M)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,M,d,d+r),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o);const u=()=>{if(_){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+=Vt;for(;i>Vt;)i-=Vt;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),pp(o.color,l.color,h,!1)}(0,0,h,n);a||Xp&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}},p=()=>{y&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};u(),p()}}this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),w&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}};tm=Zf([qa(),Qf(0,Xa(po)),Qf(0,Za(eg)),Jf("design:paramtypes",[Object])],tm);var em=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},im=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sm=function(t,e){return function(i,s){e(i,s,t)}};let nm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ru,this.builtinContributions=[Bf,Lf,Pf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Lc(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,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f;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,_,y,m,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{y&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o)}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function rm(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]=cl(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 am(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function om(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=am(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),rm(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=Zo.ROW:"y"===s?u=Zo.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.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 hm=class extends qf{constructor(){super(...arguments),this.numberType=Fu}draw(t,e,i,s){const n=Lc(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 f;if(!e)return;t.beginPath();om(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),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:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!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:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===_)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=Ul(x(t.points,v),_,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===_){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===y){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],y,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=y*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],$t(_,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,y,b,i,s,t,a,o)}};function cm(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),rm(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),rm(t,l,1,s),o=!1):o=!0}t.closePath()}hm=lm([qa()],hm);const dm=new class extends Mf{constructor(){super(...arguments),this.time=Qo.afterFillStroke}drawShape(t,e,i,s,n,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:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:sd(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:sd(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:sd(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:sd(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},um=xf;var pm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fm=function(t,e){return function(i,s){e(i,s,t)}};let mm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Lu,this.builtinContributions=[dm,um],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,_=m[0];e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const i=m[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,v)}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:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(y(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Lc(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:M=g.clipRange,closePath:T,points:w,segments:C}=t.attribute;let{curveType:E=g.curveType}=t.attribute;function B(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===E&&(E="linearClosed"),1===M&&!C&&!w.some((t=>!1===t.defined))&&"linear"===E)return this.drawLinearAreaHighPerformance(t,e,!!f,k,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(C&&C.length){let e,i;const s=C.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=Ul(B(t.points,x),E,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=C.length-1;t>=0;t--){const e=C[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=C[t-1].points,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=Ul(B(i,x),"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!w||!w.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=B(w,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Ul(e,E,{curveTension:b}),n=Ul(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===M){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,y,r[c],[g,t.attribute],M,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=M*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,A,v,k,y,r[u],[g,t.attribute],$t(f,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,y,t.attribute,g,M,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Lc(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,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let _,b,x=Zo.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],_=t.points[t.points.length-1]}else b=m[0],_=m[m.length-1];const S=Ut(_.x-b.x),A=Ut(_.y-b.y);x=null==_.x1?Zo.ROW:null==_.y1?Zo.COLUMN:Number.isFinite(S+A)?S>A?Zo.ROW:Zo.COLUMN:Zo.ROW,function(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?Zo.ROW:Zo.COLUMN,Number.isFinite(c)||(o=Zo.COLUMN),Number.isFinite(d)||(o=Zo.ROW);const u=i*(o===Zo.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;y(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),om(t,i[0]?e.top:e.bottom,l,x===Zo.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,M-c,o),t.stroke()}})(),!1}};mm=pm([qa(),fm(0,Xa(po)),fm(0,Za(ig)),gm("design:paramtypes",[Object])],mm);const vm=Tf,_m=xf;var ym=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xm=function(t,e){return function(i,s){e(i,s,t)}};let Sm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=zu,this.builtinContributions=[_m,vm],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:Lc(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:_,doFill:y,doStroke:b}=m;if(e.beginPath(),t.pathShape)sl(t.pathShape.commandList,e,i,s,1,1,f);else{sl((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,y,b,v,_,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):_&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{y&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,y,b,v,_,d,n,a,o)}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Sm=ym([qa(),xm(0,Xa(po)),xm(0,Za(ag)),bm("design:paramtypes",[Object])],Sm);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)}};let Tm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=Hu,this.builtinContributions=[Hf,Vf,Nf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Lc(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:_=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:M=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:w}=t.attribute;T=(null!=T?T:b-S)||0,w=(null!=w?w:x-A)||0;const C=Kp(g,f,T,w,h),E=Zp(g,v,T,w,M),B=Yp(h,c),P=$p(d,m);if(!t.valid||!_)return;if(!B&&!P)return;if(!(C||E||a||o||c))return;0===u||y(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,T,w)):(e.beginPath(),If(e,i,s,T,w,u,"bevel"!==p));const L={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,B,P,C,E,l,n,a,o,L),k?(this._runStroke(t,e,i,s,l,L,E,S,A,o),this._runFill(t,e,i,s,l,L,C,S,A,a)):(this._runFill(t,e,i,s,l,L,C,S,A,a),this._runStroke(t,e,i,s,l,L,E,S,A,o)),this.afterRenderStep(t,e,i,s,B,P,C,E,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}};Tm=Am([qa(),Mm(0,Xa(po)),Mm(0,Za(lg)),km("design:paramtypes",[Object])],Tm);var wm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Em=function(t,e){return function(i,s){e(i,s,t)}};let Bm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Vu,this.builtinContributions=[Gf,Xf,$f,Yf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:Lc(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,M=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,w=s,C=M;const E=e.camera;if(k&&E&&e.project){const t=e.project(i,s,M);e.camera=null,y(c)&&(c[0],c[1]),T=t.x,w=t.y,C=void 0}!1===A.draw(e,c,T,w,C,((n,r)=>{var h,c,v,_;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(_=r.lineWidth)&&void 0!==_?_:t.attribute.lineWidth,r=e}const y=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),y()):(y(),x())}))&&e.closePath(),e.camera=E,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,_,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,_,d,u,A,a)):(this._runFill(t,e,i,s,l,x,_,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,_,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Bm=wm([qa(),Em(0,Xa(po)),Em(0,Za(hg)),Cm("design:paramtypes",[Object])],Bm);const Pm=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ve)}allocate(t,e,i,s){if(!this.pools.length)return(new Ve).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 Ve(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(...t){this.pools=[]}};const Lm=new class extends bf{constructor(){super(...arguments),this.time=Qo.beforeFillStroke}drawShape(t,e,i,s,n,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,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio}=t.attribute;let T,{background:w}=t.attribute;if(!w)return;const C=()=>{"richtext"===t.type&&(e.restore(),e.save(),T&&e.setTransformFromMatrix(T,!0,1))};let E;"richtext"===t.type&&(T=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const B=g(w)&&w.background,P=t.transMatrix.onlyTranslate();if(B){const e=t.AABBBounds,i=(null!==(u=w.x)&&void 0!==u?u:e.x1)+(null!==(p=w.dx)&&void 0!==p?p:0),s=(null!==(f=w.y)&&void 0!==f?f:e.y1)+(null!==(m=w.dy)&&void 0!==m?m:0),n=null!==(v=w.width)&&void 0!==v?v:e.width(),r=null!==(_=w.height)&&void 0!==_?_:e.height();if(E=Pm.allocate(i,s,i+n,s+r),w=w.background,!P){const t=E.width(),e=E.height();E.set((null!==(y=w.x)&&void 0!==y?y:0)+(null!==(b=w.dx)&&void 0!==b?b:0),(null!==(x=w.y)&&void 0!==x?x:0)+(null!==(S=w.dy)&&void 0!==S?S:0),t,e)}}else E=t.AABBBounds,P||(E=mf(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(w);if("success"!==n.state||!n.data)return void C();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,E,{backgroundMode:A,backgroundFit:k,backgroundKeepAspectRatio:M}),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=w,n?(If(e,E.x1,E.y1,E.width(),E.height(),n,!0),e.fill()):e.fillRect(E.x1,E.y1,E.width(),E.height()),e.highPerformanceRestore()}B&&Pm.free(E),C()}};var Rm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Om=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Im=function(t,e){return function(i,s){e(i,s,t)}};let Dm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Uu,this.builtinContributions=[Lm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Lc(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,fontSize:v=d.fontSize,verticalMode:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute,x=null!==(l=ad(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:M,doStroke:T}=S,w=!f,C=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,M,T,A,k,d,n,a,o),w&&this.transformUseContext2d(t,d,C,e);const E=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=ep.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),ep.free(t)}T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,C))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,C))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,C),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,C)})))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,C),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,C,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!_){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Yt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;E(i,a-(e+1)*x+u,r,n),r+=s}))}))}w&&this.restoreTransformUseContext2d(t,d,C,e),this.afterRenderStep(t,e,i,s,M,T,A,k,d,n,a,o)}draw(t,e,i,s){const n=Lc(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,l,h,c){if(e+t<=0)return;const{textAlign:d=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,_=!u(c),y=_?c.width:i.clipedWidth,b=_?0:ug(d,y),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+y,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+y,t,o),h.stroke()}}};function Fm(t,e,i,s){if(e&&e.length){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},Um=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wm=function(t,e){return function(i,s){e(i,s,t)}};let Gm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ju,this.builtinContributions=[Nm,Hm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Lc(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,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:b}=f;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?Fm(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Fm(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,f=(Math.atan2(u,d)-Math.atan2(g,p))/2,m=Math.abs(Math.tan(f));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,_=v/m;const y=zm(d,u),b=zm(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*m);const S=jm(h,_,y,d,u),A=jm(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=zm(k,M),w=jm(h,zm(_,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 B=E-C;B<0&&(C=E,B=-B),B>Math.PI&&(B-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),B&&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,_,b,m,v,l,n,a,o);const x=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,_,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Gm=Vm([qa(),Wm(0,Xa(po)),Wm(0,Za(og)),Um("design:paramtypes",[Object])],Gm);var Ym=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Xm=function(t,e){return function(i,s){e(i,s,t)}};let Km=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Iu}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Rf)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:Lc(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:M=l.x,y:T=l.y}=t.attribute,w=Kp(p,m,g,f,c),C=Zp(p,v,g,f),E=Yp(c,u),B=$p(d,x);if(!t.valid||!S)return;if(!h){if(!E&&!B)return;if(!(w||C||a||o||u))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,g,f)):(e.beginPath(),If(e,i,s,g,f,_,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Rf));const P={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===Qo.beforeFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o,P)})),h&&e.clip();const L=()=>{P.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,M-i,T-s,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,M-i,T-s,l),e.stroke()))};A?(R(),L()):(L(),R()),this._groupRenderContribitions.forEach((r=>{r.time===Qo.afterFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=Ao.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=Lc(t,null==s?void 0:s.theme).group,i=ip.allocate(),n=ip.allocate();vg(n,t,e),Ju(i,p||i,n),a.modelMatrix=i,ip.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&ip.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}};Km=Ym([qa(),Xm(0,Xa(po)),Xm(0,Za(ng)),$m("design:paramtypes",[Object])],Km);var qm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jm=function(t,e){return function(i,s){e(i,s,t)}};const Qm=["","repeat-x","repeat-y","repeat"];let tv=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Du,this.builtinContributions=[Uf,Wf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Lc(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,image:m}=t.attribute,v=this.valid(t,l,a);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v;if(!m||!t.resources)return;const A=t.resources.get(m);if("success"!==A.state)return;const k=t.width,M=t.height;e.beginPath();let T=!1;0===p||y(p)&&p.every((t=>0===t))?e.rect(i,s,k,M):(If(e,i,s,k,M,p,"bevel"!==f),T=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const w=()=>{if(x)if(a)a(e,t.attribute,l);else if(_){e.setCommonStyle(t,t.attribute,i,s,l);let n=0;if("repeat"===h&&(n|=1),"repeat"===c&&(n|=2),n){const t=e.createPattern(A.data,Qm[n]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,k,M),e.translate(-i,-s,!0)}else e.drawImage(A.data,i,s,k,M)}},C=()=>{S&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(C(),T&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),w(),T&&e.restore()):(T&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),w(),T&&e.restore(),C()),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 Yc.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Lc(t).image;this._draw(t,a,!1,i)}};tv=qm([qa(),Jm(0,Xa(po)),Jm(0,Za(rg)),Zm("design:paramtypes",[Object])],tv);const ev=Symbol.for("IncrementalDrawContribution"),iv=Symbol.for("ArcRender"),sv=Symbol.for("AreaRender"),nv=Symbol.for("CircleRender"),rv=Symbol.for("GraphicRender"),av=Symbol.for("GroupRender"),ov=Symbol.for("LineRender"),lv=Symbol.for("PathRender"),hv=Symbol.for("PolygonRender"),cv=Symbol.for("RectRender"),dv=Symbol.for("SymbolRender"),uv=Symbol.for("TextRender"),pv=Symbol.for("RichTextRender"),gv=Symbol.for("GlyphRender"),fv=Symbol.for("ImageRender"),mv=Symbol.for("DrawContribution"),vv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Pu,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];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+=Vt;for(;o<0;)o+=Vt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};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},yv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const bv=Symbol.for("DrawItemInterceptor"),xv=new Ve,Sv=new Ve;class Av{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){xv.copy(s.dirtyBounds),Sv.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,ep.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(xv),s.backupDirtyBounds.copy(Sv)),!0}}class kv{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 Mv=class{constructor(){this.order=1,this.interceptors=[new Av,new wv,new Tv,new kv]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&ip.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Cv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},Bv=function(t,e){return function(i,s){e(i,s,t)}};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))}reInit(){this.drawContribution.reInit()}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=Cv([qa(),Bv(0,Xa(mv)),Ev("design:paramtypes",[Object])],Pv);var Lv=new Fa((t=>{t(So).to(Pv)}));const Rv=Symbol.for("PickerService"),Ov=Symbol.for("GlobalPickerService"),Iv=Symbol.for("PickItemInterceptor"),Dv=Symbol.for("PickServiceInterceptor");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};let zv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};zv=Fv([qa()],zv);let jv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Lc(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=ep.allocateByObj(a),u=new re(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};jv=Fv([qa()],jv);let Hv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new re(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}};Hv=Fv([qa()],Hv);let Nv=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){const a=vv(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};Nv=Fv([qa()],Nv);var Vv=new Fa(((t,e,i)=>{i(Rv)||(t(Ov).toSelf(),t(Rv).toService(Ov)),t(Nv).toSelf().inSingletonScope(),t(Iv).toService(Nv),t(jv).toSelf().inSingletonScope(),t(Iv).toService(jv),t(Hv).toSelf().inSingletonScope(),t(Iv).toService(Hv),fo(t,Iv),t(zv).toSelf().inSingletonScope(),t(Dv).toService(zv),fo(t,Dv)})),Uv=new Fa((t=>{t(Wu).to(_g),t(Gu).toConstantValue(pf)}));const Wv=Symbol.for("AutoEnablePlugins"),Gv=Symbol.for("PluginService");var Yv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$v=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Xv=function(t,e){return function(i,s){e(i,s,t)}};let Kv=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&&xo.isBound(Wv)&&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(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Kv=Yv([qa(),Xv(0,Xa(po)),Xv(0,Za(Wv)),$v("design:paramtypes",[Object])],Kv);var qv=new Fa((t=>{t(Gv).to(Kv),function(t,e){t(po).toDynamicValue((({container:t})=>new go(e,t))).whenTargetNamed(e)}(t,Wv)})),Zv=new Fa((t=>{fo(t,yo)})),Jv=new Fa((t=>{t(Oh).to(Ih).inSingletonScope(),fo(t,Oh)})),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.type="static",this.offscreen=!1,this.global=Ao.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=zh({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()}};e_=Qv([qa(),t_("design:paramtypes",[])],e_);var i_=new Fa((t=>{t(e_).toSelf(),t(zp).toService(e_)}));var s_=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 n_(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function r_(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=n_(t,e,s);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;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=n_(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var l_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},h_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},c_=function(t,e){return function(i,s){e(i,s,t)}};let d_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):r_(e,th.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Ne,this.backupDirtyBounds=new Ne,this.global=Ao.global,this.layerService=Ao.layerService,y(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}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){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=ye(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.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,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:th.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:th.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,ep.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=o_(e,i,th.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&&!Ae(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Pm.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=ep.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Pm.free(n),ep.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||xo.get(ev);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let p_=class extends hm{constructor(){super(...arguments),this.numberType=Fu}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=Lc(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=Xp(u,p,c),_=qp(u,g),y=Yp(c),b=$p(d,f);if(!t.valid||!m)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())}};p_=u_([qa()],p_);var g_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 f_=class extends mm{constructor(){super(...arguments),this.numberType=Lu}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=Lc(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Xp(u,d,c),f=Yp(c);if(!t.valid||!p)return;if(!f)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())}};f_=g_([qa()],f_);var m_,v_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},__=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},y_=function(t,e){return function(i,s){e(i,s,t)}},b_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(m_||(m_={}));let x_=class extends d_{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=m_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new _o([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return b_(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:th.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:th.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 b_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return b_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>b_(this,void 0,void 0,(function*(){if(2!==t.count)yield a_(t,th.zIndex,((i,s)=>{if(this.status===m_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return b_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return b_(this,void 0,void 0,(function*(){this.rendering&&(this.status=m_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=m_.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return b_(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:()=>b_(this,void 0,void 0,(function*(){yield a_(t,th.zIndex,(t=>b_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};x_=v_([qa(),y_(0,Ka(rv)),y_(1,Xa(p_)),y_(2,Xa(f_)),y_(3,Xa(po)),y_(3,Za(bv)),__("design:paramtypes",[Array,Object,Object,Object])],x_);var S_=new Fa((t=>{t(bf).toSelf().inSingletonScope(),t(Mf).toSelf().inSingletonScope(),t(mv).to(d_),t(ev).to(x_),t(av).to(Km).inSingletonScope(),t(rv).toService(av),fo(t,ng),t(Sf).toSelf().inSingletonScope(),fo(t,dg),fo(t,rv),t(Mv).toSelf().inSingletonScope(),t(bv).toService(Mv),fo(t,bv)}));function A_(){A_.__loaded||(A_.__loaded=!0,xo.load(Gp),xo.load(Uv),xo.load(Lv),xo.load(Vv),xo.load(qv),function(t){t.load(Zv),t.load(Jv),t.load(i_)}(xo),function(t){t.load(S_)}(xo))}A_.__loaded=!1,A_();const k_=xo.get(bo);Ao.global=k_;const M_=xo.get(Dp);Ao.graphicUtil=M_;const T_=xo.get(Ip);Ao.transformUtil=T_;const w_=xo.get(Wu);Ao.graphicService=w_;const C_=xo.get(Fp);Ao.layerService=C_;class E_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class B_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=Ao.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=Ao.global.getRequestAnimationFrame();this.rafId=t((()=>{Ao.global.devicePixelRatio!==this.dpr&&(this.dpr=Ao.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=Ao.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class P_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.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))})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Ao.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())}}const L_=new Ve;class R_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Da.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()}));const e=this.pluginService.stage;e&&(e.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&&(L_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(L_,t.parent&&t.parent.globalTransMatrix)))})),e.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))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let O_;function I_(){!function(){if(null==O_)try{const t=document.createElement("canvas"),e=t.getContext("2d");O_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),O_&&(O_=!!document.createElement)}catch(t){O_=!1}}();const t=Ao.global&&Ao.global.env;return t?"browser"===t:O_}let D_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};D_._pluginClasses={};const F_="white";class z_ extends Lp{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:F_}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={}){var e,i;super({}),this.tickedBeforeRender=!0,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._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Bc,this.hooks={beforeRender:new _o(["stage"]),afterRender:new _o(["stage"]),afterClearScreen:new _o(["stage"]),afterClearRect:new _o(["stage"])},this.global=Ao.global,!this.global.env&&I_()&&this.global.setEnv("browser"),this.window=xo.get(mc),this.renderService=xo.get(So),this.pluginService=xo.get(Gv),this.layerService=xo.get(Fp),this.graphicService=xo.get(Wu),this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],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:F_,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(),t.autoRefresh&&this.enableAutoRefresh(),!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),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&_(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(i=t.rafId)&&void 0!==i?i:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new Gc(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(t=!1){t&&(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:f=[1,1,-1],color:m="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);const k=D_.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const M={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]}};if(this.camera)this.camera.params=M;else{const t=D_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=D_.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}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 E_))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new B_))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new P_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Ne;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new R_,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=D_.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=D_.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=D_.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();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.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();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===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),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.dirtyBounds&&this.dirtyBounds.clear(),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,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new re(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;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.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=xo.get(mc),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=xo.get(Rv)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}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},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())}))};let N_=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ve}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}}loadFont(t,e,i){return H_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}};N_=j_([qa()],N_);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},U_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let W_=class{constructor(){this._uid=Da.GenAutoIncrementId(),this.viewBox=new Ve,this.modelMatrix=new We(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){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}};W_=V_([qa(),U_("design:paramtypes",[])],W_);var G_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Y_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$_=function(t,e){return function(i,s){e(i,s,t)}};let X_=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=Ao.global}reInit(){this._init()}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.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 Ve).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 We(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),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new re(e.x,e.y),a=Lc(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 re(e.x,e.y);l.transformPoint(a,a);const o=Lc(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&&ip.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),ep.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function K_(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 q_(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function iy(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;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}))),oy=(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]},ly=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new Ne;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 oy(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return oy(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);ly(n[0],s,i),ly(n[1],e-s,i)}};let hy=!1;const cy=new Fa((t=>{hy||(hy=!0,t(tm).toSelf().inSingletonScope(),t(iv).to(tm).inSingletonScope(),t(rv).toService(iv),t(eg).toService(Sf),fo(t,eg))}));let dy=!1;const uy=new Fa((t=>{dy||(dy=!0,t(Tm).toSelf().inSingletonScope(),t(cv).to(Tm).inSingletonScope(),t(rv).toService(cv),t(jf).toSelf(),t(zf).toSelf(),t(lg).toService(jf),t(lg).toService(zf),t(lg).toService(Sf),fo(t,lg))}));let py=!1;const gy=new Fa((t=>{py||(py=!0,t(hm).toSelf().inSingletonScope(),t(p_).toSelf().inSingletonScope(),t(ov).to(hm).inSingletonScope(),t(rv).toService(ov))}));let fy=!1;const my=new Fa((t=>{fy||(fy=!0,t(mm).toSelf().inSingletonScope(),t(sv).to(mm).inSingletonScope(),t(rv).toService(sv),t(ig).toService(Sf),fo(t,ig),t(f_).toSelf().inSingletonScope())}));let vy=!1;const _y=new Fa((t=>{vy||(vy=!0,t(Bm).toSelf().inSingletonScope(),t(dv).to(Bm).inSingletonScope(),t(rv).toService(dv),t(hg).toService(Sf),fo(t,hg))}));let yy=!1;const by=new Fa((t=>{yy||(yy=!0,t(nm).toSelf().inSingletonScope(),t(nv).to(nm).inSingletonScope(),t(rv).toService(nv),t(sg).toService(Sf),fo(t,sg))}));let xy=!1;const Sy=new Fa((t=>{xy||(xy=!0,t(uv).to(Dm).inSingletonScope(),t(rv).toService(uv),t(cg).toService(Sf),fo(t,cg))}));let Ay=!1;const ky=new Fa((t=>{Ay||(Ay=!0,t(Sm).toSelf().inSingletonScope(),t(lv).to(Sm).inSingletonScope(),t(rv).toService(lv),t(ag).toService(Sf),fo(t,ag))}));let My=!1;const Ty=new Fa((t=>{My||(My=!0,t(hv).to(Gm).inSingletonScope(),t(rv).toService(hv),t(og).toService(Sf),fo(t,og))}));var wy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Cy=class{constructor(){this.numberType=Ou}reInit(){}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=Lc(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};Cy=wy([qa()],Cy);let Ey=!1;const By=new Fa((t=>{Ey||(Ey=!0,t(gv).to(Cy).inSingletonScope(),t(rv).toService(gv))}));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},Ly=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ry=class extends qf{constructor(){super(),this.numberType=Nu,this.builtinContributions=[Lm],this.init()}drawShape(t,e,i,s,n){const r=Lc(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=Xp(o,l,!0),d=Xp(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),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=Lc(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:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),If(e,i-t,s-n,v,_,f,!0)),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=Lc(t).richtext;this._draw(t,s,!1,i)}};Ry=Py([qa(),Ly("design:paramtypes",[])],Ry);let Oy=!1;const Iy=new Fa((t=>{Oy||(Oy=!0,t(pv).to(Ry).inSingletonScope(),t(rv).toService(pv))}));let Dy=!1;const Fy=new Fa((t=>{Dy||(Dy=!0,t(fv).to(tv).inSingletonScope(),t(rv).toService(fv),t(rg).toService(Sf),fo(t,rg))}));function zy(t){const e=[];for(let i=0;i=0&&n>=0&&sot.getInstance().info(`[VChart log]: ${t}`,...e),Ny=(t,e)=>(d(Uy.warnHandler)&&Uy.warnHandler.call(null,t,e),e?ot.getInstance().warn(`[VChart warn]: ${t}`,e):ot.getInstance().warn(`[VChart warn]: ${t}`)),Vy=(t,e,i)=>{if(!d(Uy.errorHandler))throw new Error(t);Uy.errorHandler.call(null,t,e)},Uy={silent:!1,warnHandler:!1,errorHandler:!1},Wy=I_(),Gy=Wy&&globalThis?globalThis.document:void 0;function Yy(t){return("desktop-browser"===t||"mobile-browser"===t)&&Wy}function $y(t){return Xy(t)||"mobile-browser"===t}function Xy(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let Ky=0;function qy(){return Ky>=9999999&&(Ky=0),Ky++}function Zy(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function Jy(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const Qy=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class tb extends Lp{constructor(t,e){super(t),this._skipRenderAttributes=Qy,(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,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?j(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.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,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.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 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"},Cb=(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 Eb extends l{constructor(t,e={}){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.startTime=Hc.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.pressTimeout=null}),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=Hc.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||wb(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=Cb(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=Hc.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=Cb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=wb(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&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("pointerleave",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("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=Hc.now()-i>this.config.press.time&&Cb(s[0],t){Ao.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;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){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){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},Pb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Lb=[0,0,0];let Rb=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t: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(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},Xl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},ql),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Zl),{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 We(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new We(1,0,0,1,0,0),this._clearMatrix=new We(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&ot.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new We(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&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 ep.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&&(ep.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(ep.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){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,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=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(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){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-=Vt;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(f,-2*y),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&&xp.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&&(Qu(Lb,[t,e,i],this.modelMatrix),t=Lb[0],e=Lb[1],i=Lb[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&&(Qu(Lb,[t,e,i],this.modelMatrix),t=Lb[0],e=Lb[1],i=Lb[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Qu(Lb,[e,i,s],this.modelMatrix),e=Lb[0],i=Lb[1],s=Lb[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,e=Ao.global.measureTextMethod){var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Ao.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Zl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Zl.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&&(Qu(Lb,[e,i,s],this.modelMatrix),e=Lb[0],i=Lb[1],s=Lb[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=yh(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:_h(this,a,this.dpr),r.strokeStyle=yh(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=De(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?this.font=t.font:this.font=De(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(t=!0,e=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(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>ep.free(t))),this.stack.length=0}};Rb.env="browser",Rb=Bb([qa(),Pb("design:paramtypes",[Object,Number])],Rb);var Ob=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ib=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Db=class extends hp{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Ao.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new Rb(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 Fb(t,e){return new Fa((i=>{i(Dh).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Fh).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Db.env="browser",Db=Ob([qa(),Ib("design:paramtypes",[Object])],Db);const zb=Fb(Db,Rb);var jb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nb=function(t,e){return function(i,s){e(i,s,t)}};let Vb=class extends X_{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,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=pc.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 Wb=class{constructor(){this.type="group",this.numberType=Iu}contains(t,e,i){return!1}};Wb=Ub([qa()],Wb);const Gb=new Fa(((t,e,i,s)=>{Gb.__vloaded||(Gb.__vloaded=!0,t(Mb).to(Wb).inSingletonScope(),t(Tb).toService(Mb),fo(t,Tb))}));Gb.__vloaded=!1;var Yb=Gb;const $b=new Fa(((t,e,i,s)=>{i(Vb)||t(Vb).toSelf().inSingletonScope(),i(Rv)?s(Rv).toService(Vb):t(Rv).toService(Vb)}));var Xb,Kb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)};let Zb=Xb=class extends W_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Xb.idprefix}_${Xb.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Ao.global,this.viewBox=new Ve,this.modelMatrix=new We(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:Xb.GenerateCanvasId(),canvasControled:!0};this.canvas=new Db(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 Db({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)}};Zb.env="browser",Zb.idprefix="visactor_window",Zb.prefix_count=0,Zb=Xb=Kb([qa(),qb("design:paramtypes",[])],Zb);const Jb=new Fa((t=>{t(Zb).toSelf(),t(vc).toDynamicValue((t=>t.container.get(Zb))).whenTargetNamed(Zb.env)}));var Qb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},ex=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 ix{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 sx(t,e=!1){const i=document.createElement("img");if(Ao.global.isImageAnonymous&&(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 nx=class extends N_{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 ix(t)}return new Ve}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 sx(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return sx(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:Da.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(...t){}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}}loadFont(t,e,i){return ex(this,void 0,void 0,(function*(){return new FontFace(t,_(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}};nx=Qb([qa(),tx("design:paramtypes",[])],nx);const rx=new Fa((t=>{rx.isBrowserBound||(rx.isBrowserBound=!0,t(nx).toSelf().inSingletonScope(),t(yo).toService(nx))}));function ax(t,e=!0){ax.__loaded||(ax.__loaded=!0,t.load(rx),t.load(zb),t.load(Jb),e&&function(t){t.load(Yb),t.load($b)}(t))}rx.isBrowserBound=!1,ax.__loaded=!1;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};let lx=class extends Rb{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}};lx.env="feishu",lx=ox([qa()],lx);var hx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let dx=class extends hp{constructor(t){super(t)}init(){this._context=new lx(this,this._dpr)}release(...t){}};dx.env="feishu",dx=hx([qa(),cx("design:paramtypes",[Object])],dx);const ux=Fb(dx,lx);var px=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gx=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 mx{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 vx=class extends W_{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new mx}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:Da.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new dx(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 dx({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()}};vx.env="feishu",vx=px([qa(),fx(0,Xa(bo)),gx("design:paramtypes",[Object])],vx);const _x=new Fa((t=>{t(vx).toSelf(),t(vc).toDynamicValue((t=>t.container.get(vx))).whenTargetNamed(vx.env)}));var yx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xx=function(t,e){return function(i,s){e(i,s,t)}};let Sx=class extends X_{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,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 op(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}};Sx=yx([qa(),xx(0,Xa(po)),xx(0,Za(eb)),xx(1,Xa(po)),xx(1,Za(Iv)),xx(2,Xa(po)),xx(2,Za(Dv)),bx("design:paramtypes",[Object,Object,Object])],Sx);const Ax=new Fa((t=>{Ax.__vloaded||(Ax.__vloaded=!0,fo(t,eb))}));Ax.__vloaded=!1;var kx=Ax;class Mx{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();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,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:_h(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}var Tx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Cx=function(t,e){return function(i,s){e(i,s,t)}};let Ex=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Bu}};Ex=Tx([qa(),Cx(0,Xa(iv)),wx("design:paramtypes",[Object])],Ex);let Bx=!1;const Px=new Fa(((t,e,i,s)=>{Bx||(Bx=!0,t(ib).to(Ex).inSingletonScope(),t(eb).toService(ib))}));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},Rx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ox=function(t,e){return function(i,s){e(i,s,t)}};let Ix=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Lu}};Ix=Lx([qa(),Ox(0,Xa(sv)),Rx("design:paramtypes",[Object])],Ix);let Dx=!1;const Fx=new Fa(((t,e,i,s)=>{Dx||(Dx=!0,t(sb).to(Ix).inSingletonScope(),t(eb).toService(sb))}));var zx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hx=function(t,e){return function(i,s){e(i,s,t)}};let Nx=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Ru}};Nx=zx([qa(),Hx(0,Xa(nv)),jx("design:paramtypes",[Object])],Nx);let Vx=!1;const Ux=new Fa(((t,e,i,s)=>{Vx||(Vx=!0,t(nb).to(Nx).inSingletonScope(),t(eb).toService(nb))}));class Wx{constructor(){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}}var Gx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},$x=function(t,e){return function(i,s){e(i,s,t)}};let Xx=class extends Wx{constructor(t){super(),this.canvasRenderer=t}};Xx=Gx([qa(),$x(0,Xa(gv)),Yx("design:paramtypes",[Object])],Xx);let Kx=!1;const qx=new Fa(((t,e,i,s)=>{Kx||(Kx=!0,t(ub).to(Xx).inSingletonScope(),t(Xx).toService(ub))}));var Zx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Jx=class{constructor(){this.type="image",this.numberType=Du}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Jx=Zx([qa()],Jx);let Qx=!1;const tS=new Fa(((t,e,i,s)=>{Qx||(Qx=!0,t(rb).to(Jx).inSingletonScope(),t(Jx).toService(rb))}));var eS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sS=function(t,e){return function(i,s){e(i,s,t)}};let nS=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Fu}};nS=eS([qa(),sS(0,Xa(ov)),iS("design:paramtypes",[Object])],nS);let rS=!1;const aS=new Fa(((t,e,i,s)=>{rS||(rS=!0,t(ab).to(nS).inSingletonScope(),t(eb).toService(ab))}));var oS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hS=function(t,e){return function(i,s){e(i,s,t)}};let cS=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=ju}};cS=oS([qa(),hS(0,Xa(hv)),lS("design:paramtypes",[Object])],cS);let dS=!1;const uS=new Fa(((t,e,i,s)=>{dS||(dS=!0,t(db).to(cS).inSingletonScope(),t(eb).toService(db))}));var pS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fS=function(t,e){return function(i,s){e(i,s,t)}};let mS=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=zu}};mS=pS([qa(),fS(0,Xa(lv)),gS("design:paramtypes",[Object])],mS);let vS=!1;const _S=new Fa(((t,e,i,s)=>{vS||(vS=!0,t(ob).to(mS).inSingletonScope(),t(eb).toService(ob))})),yS=new Ve;class bS{constructor(){this.type="rect",this.numberType=Hu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{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,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:_h(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;yS.setValue(i.x1,i.y1,i.x2,i.y2),yS.expand(-r/2),h=!yS.containsPoint(e)}}return s.highPerformanceRestore(),h}}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 extends bS{constructor(t){super(),this.canvasRenderer=t}};kS=xS([qa(),AS(0,Xa(cv)),SS("design:paramtypes",[Object])],kS);let MS=!1;const TS=new Fa(((t,e,i,s)=>{MS||(MS=!0,t(lb).to(kS).inSingletonScope(),t(eb).toService(lb))}));let wS=!1;const CS=new Fa(((t,e,i,s)=>{wS||(wS=!0,t(rb).to(Jx).inSingletonScope(),t(Jx).toService(rb))}));var ES=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},BS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},PS=function(t,e){return function(i,s){e(i,s,t)}};let LS=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Vu}};LS=ES([qa(),PS(0,Xa(dv)),BS("design:paramtypes",[Object])],LS);let RS=!1;const OS=new Fa(((t,e,i,s)=>{RS||(RS=!0,t(hb).to(LS).inSingletonScope(),t(eb).toService(hb))}));var IS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 DS=class{constructor(){this.type="text",this.numberType=Uu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};DS=IS([qa()],DS);let FS=!1;const zS=new Fa(((t,e,i,s)=>{FS||(FS=!0,t(cb).to(DS).inSingletonScope(),t(eb).toService(cb))})),jS=new Fa(((t,e,i,s)=>{i(Sx)||t(Sx).toSelf().inSingletonScope(),i(Rv)?s(Rv).toService(Sx):t(Rv).toService(Sx)}));class HS{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 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},VS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let US=class extends N_{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 HS(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 rd.call(t)}}getCancelAnimationFrame(){return t=>{rd.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(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};US=NS([qa(),VS("design:paramtypes",[])],US);const WS=new Fa((t=>{WS.isFeishuBound||(WS.isFeishuBound=!0,t(US).toSelf().inSingletonScope(),t(yo).toService(US))}));function GS(t,e=!0){GS.__loaded||(GS.__loaded=!0,t.load(WS),t.load(ux),t.load(_x),e&&function(t){t.load(kx),t.load(jS),t.load(Px),t.load(Fx),t.load(Ux),t.load(qx),t.load(tS),t.load(aS),t.load(uS),t.load(_S),t.load(TS),t.load(CS),t.load(OS),t.load(zS)}(t))}WS.isFeishuBound=!1,GS.__loaded=!1;var YS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$S=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let XS=class extends Rb{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 We(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};XS.env="node",XS=YS([qa(),$S("design:paramtypes",[Object,Number])],XS);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},qS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ZS=class extends hp{constructor(t){super(t)}init(){this._context=new XS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};ZS.env="node",ZS=KS([qa(),qS("design:paramtypes",[Object])],ZS);const JS=Fb(ZS,XS);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},tA=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 iA=class extends W_{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:Da.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new ZS(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new ZS({width:n,height:r,dpr:s,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}getImageBuffer(t="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){}};iA.env="node",iA=QS([qa(),eA(0,Xa(bo)),tA("design:paramtypes",[Object])],iA);const sA=new Fa((t=>{t(iA).toSelf(),t(vc).toDynamicValue((t=>t.container.get(iA))).whenTargetNamed(iA.env)}));var nA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let rA=class extends N_{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 rd.call(t)}}getCancelAnimationFrame(){return t=>{rd.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};rA=nA([qa()],rA);const aA=new Fa((t=>{aA.isNodeBound||(aA.isNodeBound=!0,t(rA).toSelf().inSingletonScope(),t(yo).toService(rA))}));function oA(t,e=!0){oA.__loaded||(oA.__loaded=!0,t.load(aA),t.load(JS),t.load(sA))}aA.isNodeBound=!1,oA.__loaded=!1;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},hA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cA=function(t,e){return function(i,s){e(i,s,t)}};let dA=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Bu}};dA=lA([qa(),cA(0,Xa(iv)),hA("design:paramtypes",[Object])],dA);let uA=!1;const pA=new Fa(((t,e,i,s)=>{uA||(uA=!0,t(pb).to(dA).inSingletonScope(),t(Tb).toService(pb))}));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},fA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mA=function(t,e){return function(i,s){e(i,s,t)}};let vA=class extends bS{constructor(t){super(),this.canvasRenderer=t}};vA=gA([qa(),mA(0,Xa(cv)),fA("design:paramtypes",[Object])],vA);let _A=!1;const yA=new Fa(((t,e,i,s)=>{_A||(_A=!0,t(yb).to(vA).inSingletonScope(),t(Tb).toService(yb))}));class bA extends qf{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=t.getGraphicTheme(),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,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:_h(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&ip.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}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){return function(i,s){e(i,s,t)}};let kA=class extends bA{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Fu}};kA=xA([qa(),AA(0,Xa(ov)),SA("design:paramtypes",[Object])],kA);let MA=!1;const TA=new Fa(((t,e,i,s)=>{MA||(MA=!0,t(vb).to(kA).inSingletonScope(),t(Tb).toService(vb))}));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 BA=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Lu}};BA=wA([qa(),EA(0,Xa(sv)),CA("design:paramtypes",[Object])],BA);let PA=!1;const LA=new Fa(((t,e,i,s)=>{PA||(PA=!0,t(gb).to(BA).inSingletonScope(),t(Tb).toService(gb))}));class RA extends qf{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();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,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&ip.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var OA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},IA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},DA=function(t,e){return function(i,s){e(i,s,t)}};let FA=class extends RA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Vu}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=t.getGraphicTheme(),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,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:_h(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&ip.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};FA=OA([qa(),DA(0,Xa(dv)),IA("design:paramtypes",[Object])],FA);let zA=!1;const jA=new Fa(((t,e,i,s)=>{zA||(zA=!0,t(bb).to(FA).inSingletonScope(),t(Tb).toService(bb))}));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},NA=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)}};let UA=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Ru}};UA=HA([qa(),VA(0,Xa(nv)),NA("design:paramtypes",[Object])],UA);let WA=!1;const GA=new Fa(((t,e,i,s)=>{WA||(WA=!0,t(fb).to(UA).inSingletonScope(),t(Tb).toService(fb))}));var YA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$A=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XA=function(t,e){return function(i,s){e(i,s,t)}};let KA=class extends RA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=Uu}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=t.getGraphicTheme(),{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(),f=l.width(),m=pg(a,u,n),v=ug(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,s.modelMatrix!==u&&ip.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};KA=YA([qa(),XA(0,Xa(uv)),$A("design:paramtypes",[Object])],KA);let qA=!1;const ZA=new Fa(((t,e,i,s)=>{qA||(qA=!0,t(xb).to(KA).inSingletonScope(),t(Tb).toService(xb))}));var JA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},QA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tk=function(t,e){return function(i,s){e(i,s,t)}};let ek=class extends bA{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=zu}};ek=JA([qa(),tk(0,Xa(lv)),QA("design:paramtypes",[Object])],ek);let ik=!1;const sk=new Fa(((t,e,i,s)=>{ik||(ik=!0,t(_b).to(ek).inSingletonScope(),t(Tb).toService(_b))}));var nk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ak=function(t,e){return function(i,s){e(i,s,t)}};let ok=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=ju}};ok=nk([qa(),ak(0,Xa(hv)),rk("design:paramtypes",[Object])],ok);let lk=!1;const hk=new Fa(((t,e,i,s)=>{lk||(lk=!0,t(Sb).to(ok).inSingletonScope(),t(Tb).toService(Sb))}));var ck=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uk=function(t,e){return function(i,s){e(i,s,t)}};let pk=class extends Wx{constructor(t){super(),this.canvasRenderer=t}};pk=ck([qa(),uk(0,Xa(gv)),dk("design:paramtypes",[Object])],pk);let gk=!1;const fk=new Fa(((t,e,i,s)=>{gk||(gk=!0,t(kb).to(pk).inSingletonScope(),t(Tb).toService(kb))}));var mk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_k=function(t,e){return function(i,s){e(i,s,t)}};let yk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Nu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};yk=mk([qa(),_k(0,Xa(pv)),vk("design:paramtypes",[Object])],yk);let bk=!1;const xk=new Fa(((t,e,i,s)=>{bk||(bk=!0,t(Ab).to(yk).inSingletonScope(),t(Tb).toService(Ab))}));var Sk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ak=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kk=function(t,e){return function(i,s){e(i,s,t)}};let Mk=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=Du}};Mk=Sk([qa(),kk(0,Xa(fv)),Ak("design:paramtypes",[Object])],Mk);let Tk=!1;const wk=new Fa(((t,e,i,s)=>{Tk||(Tk=!0,t(mb).to(Mk).inSingletonScope(),t(Tb).toService(mb))})),Ck=I_();function Ek(){Ek.__loaded||(Ek.__loaded=!0,pf.RegisterGraphicCreator("arc",of),xo.load(cy),xo.load(Ck?pA:Px))}Ek.__loaded=!1;const Bk=Ek;function Pk(){Pk.__loaded||(Pk.__loaded=!0,pf.RegisterGraphicCreator("area",nf),xo.load(my),xo.load(Ck?LA:Fx))}Pk.__loaded=!1;const Lk=Pk;function Rk(){Rk.__loaded||(Rk.__loaded=!0,pf.RegisterGraphicCreator("circle",Sg),xo.load(by),xo.load(Ck?GA:Ux))}Rk.__loaded=!1;const Ok=Rk;function Ik(){Ik.__loaded||(Ik.__loaded=!0,pf.RegisterGraphicCreator("glyph",zg),xo.load(By),xo.load(Ck?fk:qx))}Ik.__loaded=!1;const Dk=Ik;function Fk(){Fk.__loaded||(Fk.__loaded=!0,pf.RegisterGraphicCreator("group",Rp))}Fk.__loaded=!1;const zk=Fk;function jk(){jk.__loaded||(jk.__loaded=!0,pf.RegisterGraphicCreator("image",Wg),xo.load(Fy),xo.load(Ck?wk:tS))}jk.__loaded=!1;const Hk=jk;function Nk(){Nk.__loaded||(Nk.__loaded=!0,pf.RegisterGraphicCreator("line",Lg),xo.load(gy),xo.load(Ck?TA:aS))}Nk.__loaded=!1;const Vk=Nk;function Uk(){Uk.__loaded||(Uk.__loaded=!0,pf.RegisterGraphicCreator("path",tf),xo.load(ky),xo.load(Ck?sk:_S))}Uk.__loaded=!1;const Wk=Uk;function Gk(){Gk.__loaded||(Gk.__loaded=!0,pf.RegisterGraphicCreator("polygon",cf),xo.load(Ty),xo.load(Ck?hk:uS))}Gk.__loaded=!1;const Yk=Gk;function $k(){$k.__loaded||($k.__loaded=!0,pf.RegisterGraphicCreator("rect",Dg),xo.load(uy),xo.load(Ck?yA:TS))}$k.__loaded=!1;const Xk=$k;function Kk(){Kk.__loaded||(Kk.__loaded=!0,pf.RegisterGraphicCreator("richtext",Zg),xo.load(Iy),xo.load(Ck?xk:CS))}Kk.__loaded=!1;const qk=Kk;function Zk(){Zk.__loaded||(Zk.__loaded=!0,pf.RegisterGraphicCreator("shadowRoot",uf))}Zk.__loaded=!1;const Jk=Zk;function Qk(){Qk.__loaded||(Qk.__loaded=!0,pf.RegisterGraphicCreator("symbol",Eg),xo.load(_y),xo.load(Ck?jA:OS))}Qk.__loaded=!1;const tM=Qk;function eM(){eM.__loaded||(eM.__loaded=!0,pf.RegisterGraphicCreator("text",Tg),xo.load(Sy),xo.load(Ck?ZA:zS))}eM.__loaded=!1;const iM=eM;function sM(){zk(),Xk()}const nM=-.5*Math.PI,rM=1.5*Math.PI,aM="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 oM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(oM||(oM={}));const lM={[oM.selectedReverse]:{},[oM.selected]:{},[oM.hover]:{},[oM.hoverReverse]:{}},hM={container:"",width:30,height:30,style:{}},cM="scrollDrag";function dM(){return"browser"===k_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const uM={debounce:St,throttle:At};sM();let pM=class t extends tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},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=_t(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=_t(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=>{this._clearDragEvents();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});const r=dM(),a="browser"===k_.env?k_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=_t(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},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:uM[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:yt(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=yt(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(cM,{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",uM[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===k_.env?k_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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(yt(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:ai(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,[s,n,r,a]=ai(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,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=_t(t[0],0,1),c=_t(t[1],0,1),d=_t(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=yt(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?yt([a+i*n,a+s*n],a,n-l):yt([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=dM(),e="browser"===k_.env?k_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===k_.env?k_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};pM.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,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};var gM,fM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 mM=gM=class{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new Ne).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Ut(t.deltaX)>Ut(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ve,e.addEventListener("wheel",this.scroll),this.params=gM.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(cM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new pM(v),h.name=a,e.add(h),h.isScrollBar=!0);const _=this.childrenBounds,{scrollX:y,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/_.width(),1),e=Math.max(Math.min(y/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/_.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=i{i(mM)||(t(mM).toSelf(),t(Wv).toService(mM))}));function _M(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&_M(t,e)}))}const yM=t=>!u(t)&&!1!==t.visible;function bM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function xM(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 AM=["#ffffff","#000000"];function kM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ii(t).toHex(),o=new ii(e).toHex();return MM(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(...AM);for(const n of a)if(t!==n&&MM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function MM(t,e,i,s,n){if("lightness"===n){const i=ii.getColorBrightness(new ii(e));return ii.getColorBrightness(new ii(t))<.5?i>=.5:i<.5}return s?TM(t,e)>s:"largeText"===i?TM(t,e)>3:TM(t,e)>4.5}function TM(t,e){const i=wM(t),s=wM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function wM(t){const e=ni(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 CM(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 EM(t,e){return[t[0]*e,t[1]*e]}function BM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function PM(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=Qt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const LM=(t,e,i,s)=>new Fe(Object.assign({defaultFontParams:Object.assign({fontFamily:aM,fontSize:14},s),getTextBounds:i?void 0:mf,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function RM(t,e,i={}){if(!t)return{width:0,height:0};const s=mf({text:t,fontFamily:e.fontFamily||i.fontFamily||aM,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 OM(t,e="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 IM(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function DM(t,e="type"){const i=OM(t,e);return"rich"===i?pf.richtext(IM(t)):("html"===i?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"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),pf.text(t))}function FM(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 zM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function jM(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 HM(t,e){const{dx:i,dy:s}=jM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function NM(){zk(),Xk(),tM(),qk(),iM()}var VM=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&&(T=h,R.setAttribute("maxLineWidth",h-b[1]-b[2]))),k=0,M=0;let H=0;"left"===z||"start"===z?H=1:"right"===z||"end"===z?H=-1:"center"===z&&(H=0),H?H<0?(k-=T,A&&A.setAttribute("x",(A.attribute.x||0)-O),x.setAttribute("x",-b[1]-E)):H>0&&x.setAttribute("x",b[3]):(k-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-O/2),x.setAttribute("x",-E/2));const N="right"===y||"end"===y,V="left"===y||"start"===y,U=(t,e)=>{"richtext"===R.type?R.setAttributes({x:t,textAlign:e,textConfig:Y(R.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):R.setAttributes({x:t,textAlign:e})};if((y?"center"===y:_)&&H){const t=T-b[1]-b[3],e=O+E,i=1===H?(t-e)/2+E+O/2:b[0]+E-(T/2+e/2-E)+O/2;if(U(i,"center"),A){const t=i-O/2-E+F/2;A.setAttributes({x:t})}}if(V&&1!==H){const t=T-b[1]-b[3],e=0===H?-t/2+E/2:-T+b[3]+b[1]+E;if(U(e+E,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(N&&-1!==H){const t=T-b[1]-b[3],e=0===H?t/2+E/2:t;if(U(e,"right"),A){const t=e-O-E+F/2;A.setAttributes({x:t})}}"middle"===j?(M-=w/2,A&&A.setAttribute("y",0)):"bottom"===j?(M-=w,A&&A.setAttribute("y",-I/2),x.setAttribute("y",-b[2])):"top"===j&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",I/2)),P(null==m?void 0:m.text)||(R.states=m.text);const{visible:W}=a,G=VM(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},G),{visible:W&&!!s,width:T,height:w,x:k,y:M}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),G.customShape){const e=G.customShape;t.pathProxy=t=>e(this,t,new Wl)}this._bgRect=t}this._textShape=R,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:j({},UM.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}UM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const WM={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}},GM={poptip:j({},WM)};var YM=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);nA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(y(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),I.setAttribute("x",I.attribute.x+e),o.setAttribute("dx",$t(Yt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),I.setAttribute("y",I.attribute.y+e),o.setAttribute("dy",$t(Yt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?jt/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:jt/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?jt/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?jt/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:jt/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?jt/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?jt:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:jt,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?jt:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}QM.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"},panel:{},maxWidthPercent:.8,space:8,padding:10};var tT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 eT=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};j(s,QM.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new QM(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};j(e,GM.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,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),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}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}};eT=tT([qa()],eT);var iT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 sT{constructor(){this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(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)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}let nT=class extends sT{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};nT=iT([qa()],nT);let rT=class extends sT{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}};rT=iT([qa()],rT);const aT=new Fa(((t,e,i,s)=>{i(eT)||(t(eT).toSelf().inSingletonScope(),t(dg).toService(eT)),i(nT)||(t(nT).toSelf(),t(Wv).toService(nT)),i(rT)||(t(rT).toSelf(),t(Wv).toService(rT))}));class oT extends tb{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}zk(),Vk();class lT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},lT.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})}}lT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},zk(),Xk();class hT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},hT.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})}}hT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},zk(),Bk();class cT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},cT.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=ae.distancePP(t,e);this.setAttribute("radius",i)}}cT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},zk(),Bk();class dT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},dT.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=nM,endAngle:s=rM}=this.attribute,n=s-i,r=le(ue(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}dT.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},zk(),Wk();class uT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},uT.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=ce(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=ae.distancePP(t,e);this.setAttribute("radius",i)}}function pT(){zk(),Vk(),Yk(),tM()}function gT(){zk(),Vk(),Bk(),tM()}uT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},pT();class fT extends tb{getStartAngle(){return pe(this._startAngle)}getEndAngle(){return pe(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},fT.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=pf.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),P(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=pf.line;Y(i)[0].cornerRadius&&(t=pf.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"),P(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:f=12}=t;let m,v;"start"===i?(m={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)):(m={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=pf.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(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}}fT.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}}},gT();class mT extends fT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},fT.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=pf.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"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var vT,_T;!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.labelHoverOnAxis="axis-label-hover-on-axis",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",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(vT||(vT={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(_T||(_T={}));const yT={[_T.selectedReverse]:{},[_T.selected]:{},[_T.hover]:{},[_T.hoverReverse]:{}},bT={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}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},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}}},xT={size:8,stroke:"#000",lineWidth:1,zIndex:1};const ST=Math.sin(Math.PI/10);function AT(t,e=ST){const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function kT(t,e=ST){const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function MT(t){const e={};return _M(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function TT(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function wT(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return EM(r,(s?-1:1)*(n?-1:1)*t/BM(r))}function CT(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function BT(t,e,i){var s;if(kT(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>ze(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>ze(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>je(n,r)}function PT(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(oM.hover,!0),_M(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(oM.hoverReverse,!0)})),s):i},RT=(t,e,i)=>i?(_M(e,(t=>{t.name&&!P(t.states)&&(t.removeState(oM.hoverReverse),t.removeState(oM.hover))})),null):i,OT=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(oM.selected)?(_M(e,(t=>{t.name&&!P(t.states)&&(t.removeState(oM.selectedReverse),t.removeState(oM.selected))})),null):s.name&&!P(s.states)?(s.addState(oM.selected,!0),_M(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(oM.selectedReverse,!0)})),s):i};class IT extends tb{_prepareAnimate(t){if(!1!==this.attribute.animation){const{animation:e,animationEnter:i,animationExit:s,animationUpdate:n}=this.attribute,r=g(e)?e:{};this._animationConfig={enter:!1!==i&&j({},t,r,null!=i?i:{}),exit:!1!==s&&j({},t,r,null!=s?s:{}),update:!1!==n&&(y(n)?n:j({},t,r,null!=n?n:{}))}}else this._animationConfig={enter:!1,exit:!1,update:!1}}}const DT={type:"default",duration:300,easing:"linear"};class FT extends IT{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=LT(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=RT(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=OT(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=pf.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._prepare(),this._prevInnerView=this._innerView&&MT(this._innerView),this.removeAllChild(!0),this._innerView=pf.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation()}_prepare(){this._prepareAnimate(DT)}_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=pf.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=vT.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=pf.group({x:0,y:0,pickable:!1});t.name=vT.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",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=pf.group({x:0,y:0,pickable:!1});i.name=vT.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=pf.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=vT.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=lM;else{const t=this.data[s],e=j({},lM,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=pf.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=vT.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=lM;else{const i=j({},lM,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=pf.group({x:0,y:0,pickable:!1});return r.name=`${vT.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=DM(this._getLabelAttribute(t,e,n,i));if(a.name=vT.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=lM;else{const s=j({},lM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new UM(Object.assign({},e));i.name=vT.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return TT(t,this.getVerticalVector(e,i,t))}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;Ut(s[0])>Ut(s[1])?o=jt/2*(l.x>e.x?1:-1):h=jt/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+L(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+L(this.attribute,"label.space",4))*s);const f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:_}=this.attribute.label;_=d(_)?j({},bT.label.style,_(t,e,i,s)):_;_=j(this.getLabelAlign(m,o,_.angle),_),d(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let y=_.react;return d(y)&&(y=y(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,_)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==_?void 0:_.fontSize,type:h}),_),{react:y})}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}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},_M(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(e.setFinalAttributes(e.attribute),r){r.release();const i=r.attribute,a=e.getFinalAttribute(),o=function(t,e,i){const s={};for(const i in e)i in t&&U(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}(i,a);let l=Object.keys(o).length>0;if("opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l){this._newElementAttrMap[e.id]={state:"update",node:e,attrs:e.attribute};const i=r.attribute;e.setAttributes(i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}])}}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const zT={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&&BT(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function jT(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function HT(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=d(n)?n:zT[n]||zT.parity;if(s.length>=3&&PT(s,r)){do{s=a(s,r)}while(s.length>=3&&PT(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=$(i);BT(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),HT(l,s,n,(t=>BT(t,l,r))),HT(h,s,o,(t=>BT(t,h,r)||!(!n||t===l)&&BT(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function VT(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},GT(t,e.attribute.angle)),{angle:WT(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({},YT(t,e.attribute.angle)),{angle:WT(e.attribute.angle)}))}))}(t,e),function(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=Te({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function WT(t=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 GT(t,e=0){let 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=WT(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 YT(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=WT(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 $T(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!u(h),d=c?Math.cos(h):1,p=c?Math.sin(h):0,f=kT(h),m=AT(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===_||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/d,l=Math.abs(i/p);if(y&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(d);r=Math.min(t,l)}else if(y&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(d);r=Math.min(t,l)}else r=l}else r=Math.abs(i/d);k(t.attribute.maxLineWidth)&&(r=k(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function XT(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class KT{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,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=BM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return EM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class qT{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-qT.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*qT.bounceIn(2*t):.5*qT.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Vt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Vt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Vt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Vt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Vt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Vt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Vt/e)*.5+1}}static registerFunc(t,e){qT[t]=e}}function ZT(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}qT.quadIn=qT.getPowIn(2),qT.quadOut=qT.getPowOut(2),qT.quadInOut=qT.getPowInOut(2),qT.cubicIn=qT.getPowIn(3),qT.cubicOut=qT.getPowOut(3),qT.cubicInOut=qT.getPowInOut(3),qT.quartIn=qT.getPowIn(4),qT.quartOut=qT.getPowOut(4),qT.quartInOut=qT.getPowInOut(4),qT.quintIn=qT.getPowIn(5),qT.quintOut=qT.getPowOut(5),qT.quintInOut=qT.getPowInOut(5),qT.backIn=qT.getBackIn(1.7),qT.backOut=qT.getBackOut(1.7),qT.backInOut=qT.getBackInOut(1.7),qT.elasticIn=qT.getElasticIn(1,.3),qT.elasticOut=qT.getElasticOut(1,.3),qT.elasticInOut=qT.getElasticInOut(1,.3*1.5),qT.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),qT.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},qT.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)qT[`flicker${t}`]=e=>ZT(e,t);for(let t=2;t<10;t++)qT[`aIn${t}`]=e=>t*e*e+(1-t)*e;function JT(t,e,i){return t+(e-t)*i}const QT=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=JT(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=JT(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=JT(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=JT(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=JT(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=JT(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=JT(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=JT(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=JT(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=pp(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?fp(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=pp(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?fp(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=JT(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=JT(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=JT(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=JT(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=JT(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=JT(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=JT(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=JT(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=JT(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=id(e,i,s),r.addUpdateBoundTag()}}};function tw(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.setAttributes(this.target.attribute)},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=qT[s])&&void 0!==n?n:qT.linear:qT.linear,"wait"===t&&(this.onUpdate=ew),this.id=Da.GenAutoIncrementId(),this.syncAttributeUpdate=ew}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(_(i)&&_(s)){const n=dp.Get(i,cp.Color255),r=dp.Get(s,cp.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(QT["fill"===e?"fillPure":"strokePure"])}else QT[e]?t.push(QT[e]):t.push(tw)}else QT[e]?t.push(QT[e]):t.push(tw)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate;this.target.animates.forEach((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const i=e.getStartProps();this.propKeys.forEach((t=>{null!=i[t]&&e.preventAttr(t)}))}))}deleteSelfAttr(t){var e;delete this.props[t],this.fromProps&&delete this.fromProps[t];const i=this.propKeys.indexOf(t);-1!==i&&(this.propKeys.splice(i,1),null===(e=this.interpolateUpdateFunctions)||void 0===e||e.splice(i,1))}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){this.target.setAttributes(this.props),t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class sw extends iw{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();this.target.setAttributes(t)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class nw extends l{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Da.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Io.END?this.removeAnimate(t,!0):t.status!==Io.RUNNING&&t.status!==Io.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const rw=new nw;rw.isGlobal=!0;class aw{constructor(t=Da.GenAutoIncrementId(),e=rw,i){this.id=t,this.status=Io.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){return this.target=t,this.target.animates||(this.target.animates=new Map),this.target.animates.set(this.id,this),this.onRemove((()=>{this.stop(),this.target.animates.delete(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new iw(Oo.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new sw(Oo.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new iw(Oo.from,t,e,i);return this._firstStep?(this._lastStep.append(s),this._lastStep=s):(this._firstStep=s,this._lastStep=s),this.updateDuration(),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Io.RUNNING&&(this.status=Io.PAUSED)}resume(){this.status===Io.PAUSED&&(this.status=Io.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this._preventAttrs.add(t),delete this._startProps[t],delete this._endProps[t];let e=this._firstStep;for(;e;)e.deleteSelfAttr(t),e=e.next}preventAttrs(t){t.forEach((t=>this._preventAttrs.add(t)))}validAttr(t){return!this._preventAttrs.has(t)}runCb(t){var e;return null===(e=this._lastStep)||void 0===e||e.onEnd(t),this}startAt(t){return this._startTime=t,this}customInterpolate(t,e,i,s,n,r){return!1}getFromValue(){return this._startProps}getToValue(){return this._endProps}stop(t){let e=this._firstStep;for(;e;)e.stop(),e=e.next;this.status!==Io.END&&this.onEnd(),this.status=Io.END,this.target&&("start"===t?this.target.setAttributes(this._startProps):"end"===t?this.target.setAttributes(this._endProps):t&&this.target.setAttributes(t))}release(){this.status=Io.END,this._onRemove&&this._onRemove.forEach((t=>t())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Io.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),void(this.status=Io.END);this.status=Io.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&this.target.setAttributes(this._startProps);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const ow=new Mo;class lw{constructor(){this.released=!1}tick(t,e){ow.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class hw extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Ro.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Ro.INITIAL,Ao.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),Ao.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new lw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Ro.INITIAL&&(this.status=Ro.PAUSE,!0)}resume(){return this.status!==Ro.INITIAL&&(this.status=Ro.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Ro.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Ro.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Ro.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Ro.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Ro.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Ro.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,Ao.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}function uw(t){if(!t||!d(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1}return 2}dw.getInstance();class pw{static registerBuiltInAnimate(t,e){pw.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;y(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:pw.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=uw(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:pw.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=uw(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=k(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){Array.isArray(t)?t.forEach((t=>this._execute(t))):this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,u;const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:_=0,duration:y=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:M,custom:T,customType:w,controlOptions:C}=t,E=e.animate();E.priority=k;const B=d(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],L=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&L&&(i=null!==(h=P[L])&&void 0!==h?h:i),E.startAt(b);const R=i*x+B;R>0&&E.wait(R);let O=null,I=t.to,D=t.from;I||(O||(O=this.createPropsFromChannel(g,e)),I=O.props),D||(O||(O=this.createPropsFromChannel(g,e)),D=O.from),O.attrOutChannel&&e.setAttributes(O.attrOutChannel),this._handleRunAnimate(E,T,w,D,I,y,m,f,C,M,p,e);let F=0;x&&(F=x*(s-i-1));const z=d(_)?_(null===(u=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===u?void 0:u[0],e,{}):_;return z>0&&(F+=z),F>0&&E.wait(F),S&&S>0&&E.loop(S),A&&E.bounce(!0),E}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,u){var p,g,f,m,v,_,y,b;if(e&&i){i=uw(e);let c=this.resolveValue(o,u);"function"==typeof c&&(c=c(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),c=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},c);const x=d(h)?h.call(null,null!==(_=c&&(null===(v=c.data)||void 0===v?void 0:v[0]))&&void 0!==_?_:null===(b=null===(y=u.context)||void 0===y?void 0:y.data)||void 0===b?void 0:b[0],u,c):h;c.options=x,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:u=0}=t,p=d(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=d(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;u||(d||(d=this.createPropsFromChannel(a,i)),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i)),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const g=null!==(n=t.custom)&&void 0!==n?n:pw.builtInAnimateMap[r],f=t.custom?t.customType:uw(g);this._handleRunAnimate(e,g,f,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e){var i;const s={};let n=null;if(!t)return{from:n,props:s,attrOutChannel:null};const r={};let a=!1;const o=null===(i=e.context)||void 0===i?void 0:i.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===o[e]||(t[e]={to:o[e]}),t)),{})),Object.keys(t).forEach((i=>{var r,a,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?s[i]=h.to(null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,{}):s[i]=h.to),void 0!==h.from&&(n||(n={}),"function"==typeof h.from?n[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):n[i]=h.from)})),o)for(const t in o){const e=o[t];void 0!==e&&(s.hasOwnProperty(t)||(r[t]=e,a=!0))}return{from:n,props:s,attrOutChannel:a?r:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}executeItem(t,e,i=0,s=1){return Array.isArray(t)?t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean):[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Io.END),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}pw.builtInAnimateMap={};const gw="appear",fw="disappear",mw="update",vw="highlight",_w="unhighlight";class yw{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class bw{constructor(t){this.stateList=null,this.graphic=t}applyState(t,e,i){const s=dw.getInstance(),n=[],r=[];if(this.stateList&&this.stateList.length?t.forEach(((t,i)=>{const a={allowTransition:!0,stopOriginalTransition:!0};this.stateList.forEach((e=>{const i=s.isTransitionAllowed(e.state,t,this.graphic);a.allowTransition=a.allowTransition&&i.allowTransition})),a.allowTransition&&(r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new pw(this.graphic)}),this.stateList.forEach((e=>{s.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&n.push(e)})))})):t.forEach(((t,i)=>{r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new pw(this.graphic)})})),n.forEach((t=>{t.executor.stop(null,!1)})),r.length){r[0].executor.execute(r[0].animationConfig);for(let t=0;t{e&&e.executor.execute(e.animationConfig),this.stateList=this.stateList.filter((t=>t!==s)),t===r.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!n.includes(t))):this.stateList=[],this.stateList.push(...r)}applyAppearState(t,e){this.applyState([gw],[{name:gw,animation:t}],e)}applyDisappearState(t,e){this.applyState([fw],[{name:fw,animation:t}],e)}applyUpdateState(t,e){this.applyState([mw],[{name:mw,animation:t}],e)}applyHighlightState(t,e){this.applyState([vw],[{name:vw,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([_w],[{name:_w,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class xw{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new bw(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new yw(t)),t._animationStateStore}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return(new xw)._getAnimationStateManager(t),t}}class Sw{getAttributes(t=!1){return t&&this.finalAttribute?this.finalAttribute:this.attribute}animate(t){var e,i,s;const n=new aw(null==t?void 0:t.id,null!==(i=null!==(e=null==t?void 0:t.timeline)&&void 0!==e?e:this.stage&&this.stage.getTimeline())&&void 0!==i?i:rw,null==t?void 0:t.slience);if(n.bind(this),t){const{onStart:e,onEnd:i,onRemove:s}=t;null!=e&&n.onStart(e),null!=i&&n.onEnd(i),null!=s&&n.onRemove(s)}return null===(s=this.stage)||void 0===s||s.ticker.start(),n}createTimeline(){return new nw}createTicker(t){return new hw(t)}setFinalAttributes(t){this.finalAttribute||(this.finalAttribute={}),Object.assign(this.finalAttribute,t)}initFinalAttributes(t){this.finalAttribute=t}initAnimateExecutor(){this._animateExecutor||(this._animateExecutor=new pw(this))}executeAnimation(t){return this.initAnimateExecutor(),this._animateExecutor.execute(t),this}executeAnimations(t){return this.initAnimateExecutor(),t.forEach((t=>{this._animateExecutor.execute(t)})),this}getFinalAttribute(){return this.finalAttribute}getGraphicAttribute(t,e=!1){return!e&&this.finalAttribute?this.finalAttribute[t]:this.attribute[t]}pauseAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function Aw(){G(Bp,xw),G(Bp,Sw)}class kw extends iw{constructor(t,e,i,s,n){super("customAnimate",e,i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class Mw extends kw{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class Tw{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new pw(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttr(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function ww(t){return new Tw(t)}class Cw extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,this.target.setAttribute("text",n)}}const Ew=1e3,Bw="quadInOut",Pw=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],Lw=(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=pp(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Rw=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?ey(t):[],n=ey(e);i&&s&&(i.fromTransform&&iy(s,i.fromTransform.clone().getInverse()),iy(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})))},Iw=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Dw=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Iw.includes(n))return;const r=e[n];if(!u(r)&&!u(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?dp.Get(t,cp.Color255):t;i.push({from:y(t[n])?t[n].map(e):e(t[n]),to:y(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class Fw extends kw{constructor(t,e,i){super({},{},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;Rw(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&Lw(this.otherAttrs,i,e),this.target.setAttributes(i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const zw=(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=Ow(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Dw(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new Fw({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Ew,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Bw);return c.play(d),c};class jw extends kw{constructor(t,e,i){super({},{},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;Rw(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&&Lw(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Hw=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Pw.includes(t))(i)||(e[i]=t[i])})),e},Nw=(t,e,i)=>{const s=Hw(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),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=Ao.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},Vw=(t,e,i)=>{const s=[],n=i?null:Hw(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:Hw(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=Rg(t.attribute),n=ny(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(Ao.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=ny(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(Ao.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=ny(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(Ao.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 ry(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 ry(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(Ao.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:ay(i)}];const s=[];return ly(i,e,s),s})(t,e).forEach((t=>{s.push(Ao.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 ly(l,e,h),h})(t,e).forEach((t=>{s.push(Ao.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=ey(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(Ao.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(Ao.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Nw(t,s,e),s};class Ww extends kw{constructor(t,e,i,s,n){super(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(){super.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:qo.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:qo.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:qo.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Gw extends Ww{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;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=Ao.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!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:y/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(_+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 Yw extends Ww{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:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=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=Ao.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:f,height:"in"===v&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===y?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class $w extends kw{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){super.onBind();const{points:t,segments:e}=this.target.attribute,{points:i,segments:s}=this.target.getFinalAttribute();this.from={points:t,segments:e},this.to={points:i,segments:s},this.props=this.to;const n=this.getPoints(this.from),r=this.getPoints(this.to,!0);this.fromPoints=n?Array.isArray(n)?n:[n]:[],this.toPoints=r?Array.isArray(r)?r:[r]:[];const a=new Map;this.fromPoints.forEach((t=>{t.context&&a.set(t.context,t)}));let o,l,h=1/0,c=-1/0;for(let t=0;t=0;t-=1)if(a.has(this.toPoints[t].context)){c=t,l=a.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(c)?(this.clipRange=this.toPoints[c][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[c][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=_t(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let d=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=a.get(t.context);return i?(d=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ec&&l?[l,t]:[d,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new re(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(t)return Object.keys(this.to).forEach((t=>{this.target.attribute[t]=this.to[t]})),this.target.addUpdatePositionTag(),void this.target.addUpdateShapeAndBoundsTag();if(this.points=this.points.map(((t,i)=>{const s=ed(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));this.target.setAttributes({clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.target.attribute.segments=e}else this.target.attribute.points=this.points;this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Xw extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0}));const o=this.target.getFinalAttribute();o&&this.target.setAttributes(o),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(a)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Kw extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Object.assign(this.target.attribute,i),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class qw extends Xw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class Zw extends Kw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}const Jw=(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.getFinalAttribute();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.getFinalAttribute();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)};class Qw extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this._updateFunction=null}updateStartAngle(t){this.target.attribute.startAngle=this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t}updateEndAngle(t){this.target.attribute.endAngle=this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class tC extends Qw{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=Jw(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r),this.determineUpdateFunction()}}class eC extends Qw{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class iC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/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:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class sC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const nC=(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,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:u(l)?void 0:c,height:u(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class rC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=nC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class aC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:u(o)?void 0:h,height:u(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const oC=(t,e,i)=>{const s=t.getFinalAttribute().points,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.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class lC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(this.target.attribute.points=r.map(((t,i)=>ed(r[i],a[i],e))),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class hC extends lC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:oC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class cC extends lC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:oC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const dC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class uC extends lC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:dC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class pC extends lC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:dC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const gC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class fC extends lC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:gC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class mC extends lC{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:gC(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const vC=(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.getFinalAttribute(),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.getFinalAttribute();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)};class _C extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class yC extends _C{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=vC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}}class bC extends _C{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const xC=(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.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:u(a)?void 0:l,width:u(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class SC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=xC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class AC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class kC extends Mw{onBind(){var t;const e=ww(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;this.target.setAttributes({x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class MC extends Mw{onBind(){const t=ww(this.target);this._animator=t;const e=this.duration,i=this.easing,{config:s,diffAttrs:n}=this.params;t.animate(this.target,{type:"to",to:Object.assign({},n),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},n)}}),this.completeBind(t)}deleteSelfAttr(t){super.deleteSelfAttr(t),this._animator.deleteSelfAttr(t)}tryPreventConflict(){}}function TC(){zk(),Vk(),qk(),iM(),pw.registerBuiltInAnimate("axisEnter",kC),pw.registerBuiltInAnimate("axisUpdate",MC)}var wC=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{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=pf.group({zIndex:999});e.name=vT.axisBreak,e.id=this._getNodeId(`${vT.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=j({},xT,s),a=null!==(e=r.size)&&void 0!==e?e:xT.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=pf.symbol(Object.assign({x:s.x,y:s.y},o));l.name=vT.axisBreakSymbol;const h=pf.symbol(Object.assign({x:n.x,y:n.y},o));h.name=vT.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=pf.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=vT.background,n.id=this._getNodeId("background"),n.states=j({},yT,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new UM(Object.assign({},t));e.name=vT.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=wC(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];P(l)||(c.state={line:j({},yT,l),symbol:j({},yT,l)});const d=new fT(c);d.name=vT.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return gt(t[0],0)?gt(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}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:d}=s,p=wC(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),_=this.getRelativeVector();let y=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+L(this.attribute,"label.space",4);y+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===_[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?y+=i+(e-1)*t:y=0}else if(0===_[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;y+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}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.getActualOffset(x),A=this.getVerticalCoord(v,S,!1),M=this.getVerticalVector(S,!1,{x:0,y:0});let T,w,{angle:C}=p;if(T="start"===n?"start":"end"===n?"end":"center",u(C)&&o){C=PM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;w=1==-1*t?"bottom":"top"}else T=this.getTextAlign(M),w=this.getTextBaseline(M,!1);let E=d;if(u(E)){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(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=s-S;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=s-S}const B=Object.assign(Object.assign(Object.assign({},A),p),{maxWidth:E,textStyle:Object.assign({textAlign:T,textBaseline:w},a),state:{text:j({},yT,c.text),shape:j({},yT,c.shape),panel:j({},yT,c.background)}});return B.angle=C,l&&l.visible&&(B.shape=Object.assign({visible:!0},l.style),l.space&&(B.space=l.space)),h&&h.visible&&(B.panel=Object.assign({visible:!0},h.style)),B}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:d}=s,p=wC(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),_=this.getVerticalVector(m,!1,{x:0,y:0});let y,{angle:b}=p,x="center";if(u(b)&&a){b=PM(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;y=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(_,!1,o.angle);x=t,y=e}const S=d,A=h?h(c):c,k=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:y},o),text:A});return k.angle=b,l&&l.visible&&(k.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),k}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return gt(t[1],0)?i=!gt(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 GT(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return YT(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=$(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(P(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(P(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,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=oe(e)})),UT(i,t),!VT(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=kT(a),l=AT(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=XT(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);k(i)&&(c=$t(c,i))}}else{if(l){const i=XT(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);k(i)&&(c=$t(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&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);$T(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&NT(t,{orient:o,method:m,separation:v,lastVisible:_,firstVisible: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=pf.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=vT.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-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(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 f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=RM(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=ai(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(){super.release(),this._breaks=null}}CC.defaultAttributes=bT,G(CC,KT);class EC{isInValidValue(t){const{startAngle:e=nM,endAngle:i=rM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=nM,endAngle:i=rM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return ce(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return wT(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function BC(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=BC(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var RC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),k(l)&&l>=3){const t=CT(n,l,c,e,i);h=pf.path(Object.assign(Object.assign({},a.style),{path:ET(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=pf.circle(t)}h.name=vT.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=j({},yT,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=RC(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=L(this.attribute.label,"style.fontSize",12)+L(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=n+m+f+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:j({},yT,d.text),shape:j({},yT,d.shape),panel:j({},yT,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;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(gt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=BC(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&PC(e,c,i)}else e.AABBBounds.width()>r&&PC(e,r,i)}else o>a.x&&h.x2>n.x2?(PC(e,n.x2-o,i),r&&LC(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return gt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}OC.defaultAttributes=bT,G(OC,EC);const IC=t=>t.map(((t,e)=>({index:e,value:t}))),DC=(t,e,i=0)=>{const s=new Ve(t).expand(i/2),n=new Ve(e).expand(i/2);return s.intersects(n)},FC=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=oe(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;u||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=LM(a),_=t.range();let y=[];for(let i=0;i{HC[t]=!0}));const GC=t=>-Math.log(-t),YC=t=>-Math.exp(-t),$C=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,XC=t=>10===t?$C:t===Math.E?Math.exp:e=>Math.pow(t,e),KC=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),qC=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),ZC=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function JC(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 QC(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function tE(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function eE(t,e,i,s){return 1===i&&(i=0),tE(t,i,s)*(e/(1-i))}function iE(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function sE(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=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 rE{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=iE(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=_t(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}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const aE=Symbol("implicit");class oE extends rE{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=jC.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=aE}clone(){const t=(new oE).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!==aE)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&&a>1;)a-=1,r=Math.floor((e-t)/a);return lE(t,e,r,n)}class cE extends oE{constructor(t){super(),this.type=jC.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=eE(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)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("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),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]}}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(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:hE(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=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(t=10){const e=this.calculateVisibleDomain(this._range);return hE(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=bt(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,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 cE(!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:dE}=ri;function uE(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return kt(t,e);if("string"===i){if(s=ii.parseColorString(e)){const e=dE(ii.parseColorString(t),s);return t=>e(t).formatRgb()}return kt(Number(t),Number(e))}return e instanceof si?dE(t,e):e instanceof ii?dE(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):kt(Number(t),Number(e))}class pE extends rE{constructor(t=WC,e=WC){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=WC,this._piecewise=QC,this._interpolate=uE}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),kt)),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=Mt,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=bt(i[0],i[r-1])),this._piecewise=r>2?sE:QC,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:WC),this.rescale(i)):this._clamp!==WC}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=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 gE=Math.sqrt(50),fE=Math.sqrt(10),mE=Math.sqrt(2),vE=[1,2,5,10],_E=(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=SE(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?bE(0,-(e-1)/s,s):bE((e-1)/s,0,s)},yE=vt(((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 _E(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return _E(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=bE(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=bE(t,e,l);return n&&r.reverse(),r})),SE=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=vE[0];return i>=gE?s=vE[3]:i>=fE?s=vE[2]:i>=mE&&(s=vE[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function AE(t,e,i){const s=(e-t)/Math.max(0,i);return SE(s)}function kE(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;e0;){if(s=AE(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function TE(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 wE=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),CE=vt(((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})),EE=vt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=xE(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?wE(t,e,n):wE(t,e,nE(n)),h=wE(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),BE=vt(((t,e,i,s,n)=>kE(s(t),s(e),i).map((t=>nE(n(t))))));class PE extends pE{constructor(){super(...arguments),this.type=jC.Linear}clone(){var t;const e=new PE;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return yE(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(d(null==e?void 0:e.customTicks))return e.customTicks(this,t);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=xE(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(t=10){const e=this.calculateVisibleDomain(this._range);return kE(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(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r: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}}function RE(t){return e=>-t(-e)}function OE(t=Number.EPSILON){return e=>Math.max(e,t)}class IE extends pE{constructor(){super(KC(10),XC(10)),this.type=jC.Log,this._limit=OE(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new IE).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=KC(this._base),s=XC(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=RE(i),this._pows=RE(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=GC,this.untransformer=YC):(this._logs=i,this._pows=s,this._limit=OE(),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 WC}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return CE(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return EE(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return BE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return BE(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{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))))}}}G(IE,LE);class DE extends PE{constructor(){super(qC(1),ZC(1)),this.type=jC.Symlog,this._const=1}clone(){return(new DE).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=qC(t),this.untransformer=ZC(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return CE(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return EE(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return BE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return BE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}G(DE,LE);class FE{constructor(){this.type=jC.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[lt(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 FE).domain(this._domain).range(this._range).unknown(this._unknown)}}function zE(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function jE(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!NC(t.type))return IC(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return IC([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:u=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),_=f&&f()?f().breakDomains:null,m=_&&_.length?v.filter((t=>_.every((e=>te[1])))):v;else if(p(h))m=zE(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=zE(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:u}):t.d3Ticks(e,{noDecimals:u})))}else{const i=null!==(s=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;m=zE(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:u,customTicks:n}):t.ticks(e,{noDecimals:u,customTicks:n})))}var v,_;const y=t.domain();if(e.labelFirstVisible&&y[0]!==m[0]&&!m.includes(y[0])&&m.unshift(y[0]),e.labelLastVisible&&y[y.length-1]!==m[m.length-1]&&!m.includes(y[y.length-1])&&m.push(y[y.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=zC(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=zC(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=$(l),r=f&&f()?NE.greedy:NE.parity;for(;l.length>=3&&PT(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;BT(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),jE(t,l,a,(e=>BT(e,t,i))),jE(n,l,o,(e=>BT(e,n,i)||!(!a||e===t)&&BT(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),$(h)!==$(m)&&h.push($(m))),m=h}}return IC(m)},NE={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&BT(i,t,e)||(i=t,0))))}},VE=(t,e,i,s)=>{const n=zC(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},UE=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,WE=(t,e)=>t[1]{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),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?IC([s[s.length-1]]):IC([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:f,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=K(g),a=X(g);if(s.length<=f/n){const i=VE(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=YE(s,i,o,e.labelLastVisible,Math.floor(n/l),!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=VE(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!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])){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&&!UE(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?WE(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{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=LM(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=ce({x:0,y:0},i,t),a=TT(r,wT(s,r,e,n));return o=a,l=wT(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return _.align||(gt(y,f.x)?_.baseline||(_.baseline=b>f.y?"top":"bottom"):y>f.x?_.align="left":y{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||h<=0)return IC(t.domain());let c;if(p(n))c=t.stepTicks(n);else if(p(s))c=t.forceTicks(s);else if(p(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=d(i)?i({axisLength:s,labelStyle:l}):i;c=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=$E(t,i,e),r=K(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=KE(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-p)}else c=t.domain();return IC(c)},KE=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&DC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},qE=new Uint32Array(33),ZE=new Uint32Array(33);ZE[0]=0,qE[0]=~ZE[0];for(let t=1;t<=32;++t)ZE[t]=ZE[t-1]<<1|1,qE[t]=~ZE[t];function JE(t,e,i={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:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&qE[31&o]&ZE[1+(31&l)])return!0}else{if(i[h]&qE[31&o])return!0;if(i[c]&ZE[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,qE[31&o]&ZE[1+(31&l)]);else for(s(h,qE[31&o]),s(c,ZE[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,ZE[31&a]|qE[1+(31&o)]);else for(n(l,ZE[31&a]),n(h,qE[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=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 QE(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=_t(i,-o,t.width+l),d=_t(s,-o,t.width+l),u=_t(n,-a,t.height+h),p=_t(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function tB(t,e,i=!1){return i?QE(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function eB(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=tB(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=QE(t,r)),e.getRange(r)))}function iB(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>p(t))),u=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return iB(t,e,n,o,h,c,l)}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 iB(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 iB(t,e,n,s,h,c)}return!1}const nB=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],rB=["top","inside-top","inside"];function aB(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let _=0,y=0;return u<0-h?_=-u:p>m&&(_=m-p),g<0-l?y=-g:f>v&&(y=v-f),{dx:_,dy:y}}const oB={mode:"same-time",duration:300,easing:"linear"};function lB(t){return 3===t||4===t}function hB(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 cB=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 dB(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)}}var uB=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{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const fB=(t,e)=>Math.ceil(t)>Math.floor(e),mB=([t,e],[i,s])=>s>t&&e>i;function vB(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}var _B=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{const e=t.target;e===this._lastHover||P(e.states)||(e.addState(oM.hover,!0),_M(this,(t=>{t===e||P(t.states)||t.addState(oM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(_M(this,(t=>{P(t.states)||(t.removeState(oM.hoverReverse),t.removeState(oM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void _M(this,(t=>{P(t.states)||(t.removeState(oM.selectedReverse),t.removeState(oM.selected))}));P(e.states)||(e.addState(oM.selected,!0),_M(this,(t=>{t===e||P(t.states)||t.addState(oM.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)===qo.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===qo.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(Ae(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,f=p-d;return[dB(g,f,c,d,a,o),dB(-g,-f,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds)}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=pf.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Wl)}return e&&e.getAttributes(!0).fill&&s.setAttribute("stroke",e.getAttributes(!0).fill),this.attribute.line&&!P(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;const t=[];!1!==this._enableAnimation&&this._baseMarks.forEach((e=>{t.push(e.attribute),e.initAttributes(e.getAttributes(!0))}));const{overlap:e,smartInvert:i,dataFilter:s,customLayoutFunc:n,customOverlapFunc:r}=this.attribute;let a=this.attribute.data;if(d(s)&&(a=s(a)),a&&a.length){const t=new Set;a=a.filter((e=>!t.has(e.id)&&t.add(e.id)))}let o=this._initText(a);o=d(n)?n(a,o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(o);const l=[],h=o;if(!c(e)&&d(null==e?void 0:e.filterBeforeOverlap)){const t=this.getRelatedGraphic.bind(this);o.forEach((i=>{e.filterBeforeOverlap(i,t,this)?h.push(i):l.push(i)}))}d(r)?o=r(h,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(l):!1!==e&&(o=this._overlapping(h).concat(l)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),o&&o.length&&o.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==i&&this._smartInvert(o),this._renderLabels(o),!1!==this._enableAnimation&&this._baseMarks.forEach(((e,i)=>{e.initAttributes(t[i])}))}_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&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(e)&&(t.states=e)}_createLabelText(t){var e,i;return DM(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;const i=[];let s;if(s=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),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&fB(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&fB(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(gt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(vB([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!mB([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let y=0,b=t.length-1;for(;y<=b;)y===b?_.push(t[y]):(_.push(t[y]),_.push(t[b])),y++,b--;return _}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&s.setRange(tB(i,t.AABBBounds,!0))}))),h.length>0&&h.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&&s.setRange(tB(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(tB(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){var s;if(t){if(!1!==t.attribute.visible){if(null===(s=t.context)||void 0===s?void 0:s.animationState){const e=t.clone();return Object.assign(e.attribute,t.getAttributes(!0)),e.AABBBounds}return t.AABBBounds}const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:n,y:r}=e;return{x1:n,x2:n,y1:r,y2:r}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:p}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{bB[t]=e};var SB=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{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,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*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}AB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const kB=()=>{xB("symbol",AB),xB("line-data",AB)};var MB=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{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}})(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}}}TB.tag="rect-label",TB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var wB=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{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=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}}(t,e,i,s)}};CB.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const EB=()=>{xB("line",CB),xB("area",CB)};var BB=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);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=d(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=d(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}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),h=l.getAttributes(!0),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.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=(h.startAngle+h.endAngle)/2,u=h.endAngle-h.startAngle,p=fe(h.endAngle-u/2),g=ce(c,h.outerRadius,o),f=ce(c,a+e.line.line1MinLength,o),m=new PB(t,g,f,p,u,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=ce(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(d=m.quadrant)||2===d?this._arcRight.set(m.refDatum,m):lB(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var d}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":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 f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,_=0;if("inside"===o&&(_="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=ce(t.circleCenter,v,t.middleAngle),t.labelLimit=f,ft(f,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.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=lB(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=lB(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.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 c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(mt(t.pointB.x,this._line2MinLength+h)||ft(t.pointB.x,c-this._line2MinLength-h))&&(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(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;k(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=lB(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-y-c:0+y+c;break;default:m=p.x+f*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+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?lB(t.quadrant)?"left":"right":lB(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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*(lB(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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,f,m;if(gt(l/2,u))g=0,f=1,m=-p;else if(gt(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,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,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?gt(v[0].y,v[1].y)?ft(t.middleAngle,-Math.PI)&&mt(t.middleAngle,0)||ft(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.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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;e{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 IB(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=ae.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 DB(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=ET(t,!!n),o=ET(r,!!n);const h=ae.distancePP(s,l),c=ae.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=IB(e,t,!1,!!n),o=IB(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=ET(t,!!n),o=ET(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}OB.defaultAttributes={pickable:!1};class FB extends tb{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&MT(this._innerView),this.removeAllChild(!0),this._innerView=pf.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 TT(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:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${vT.grid}-sub`:`${vT.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=ET(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=IB(t,o,!1,!!a)}const u=pf.path(Object.assign({path:c,z:l},d(r)?j({},this.skipDefault?null:FB.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 f=ET(o,!!a),m=Ut(o[0].x-o[1].x),v=Ut(o[0].y-o[1].y),_=pf.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*jt/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?j({},this.skipDefault?null:FB.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],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!gt(a.value,0)&&!gt(l.value,0),d=!gt(a.value,1)&&!gt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}FB.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},zk(),Wk();class zB extends FB{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},FB.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=nM,endAngle:r=rM}=this.attribute;i=CT(t,s,ae.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=j({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);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})}}G(zB,KT);var jB,HB,NB,VB=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){const e=this._getPointsOfSubGrid(p,d);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"})}}G(UB,EC),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(jB||(jB={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(HB||(HB={})),function(t){t.dataZoomChange="dataZoomChange"}(NB||(NB={}));const WB="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",GB={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:WB,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:WB,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},YB={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}},$B=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var XB=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;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto"},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,k,M,T;const{orient:w,middleHandlerStyle:C={},startHandlerStyle:E={},endHandlerStyle:B={},zoomLock:P}=this.attribute,{start:L,end:R}=this._getState(),{position:O,width:I,height:D}=this._getLayoutAttrFromConfig(),F=null!==(t=E.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=B.triggerMinSize)&&void 0!==e?e:40,j=this._getContainer();if(this._isHorizontal){if(C.visible){const t=(null===(i=C.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:O.x+L*I,y:O.y-t,width:(R-L)*I,height:t},null===(s=C.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=C.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:O.x+(L+R)/2*I,y:O.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=C.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square"},C.icon),{pickable:!P&&(null===(h=C.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:O.x+L*I,y:O.y+D/2,size:D,symbolType:null!==(c=E.symbolType)&&void 0!==c?c:"square"},YB.horizontal),E),{pickable:!P&&(null===(d=E.pickable)||void 0===d||d)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:O.x+R*I,y:O.y+D/2,size:D,symbolType:null!==(u=B.symbolType)&&void 0!==u?u:"square"},YB.horizontal),B),{pickable:!P&&(null===(p=B.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:O.x+L*I-t/2,y:O.y+D/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:999},YB.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:O.x+R*I-g/2,y:O.y+D/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:999},YB.horizontal),{pickable:!P}),"rect")}else{if(C.visible){const t=(null===(g=C.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===w?O.x-t:O.x+I,y:O.y+L*D,width:t,height:(R-L)*D},null===(f=C.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(_=null===(v=null===(m=C.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===_||_)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===w?O.x-t/2:O.x+I+t/2,y:O.y+(L+R)/2*D,angle:Math.PI/180*90,symbolType:null!==(b=null===(y=C.icon)||void 0===y?void 0:y.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0},C.icon),{pickable:!P&&(null===(S=null===(x=C.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:O.x+I/2,y:O.y+L*D,size:I,symbolType:null!==(A=E.symbolType)&&void 0!==A?A:"square"},YB.vertical),E),{pickable:!P&&(null===(k=E.pickable)||void 0===k||k)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:O.x+I/2,y:O.y+R*D,size:I,symbolType:null!==(M=B.symbolType)&&void 0!==M?M:"square"},YB.vertical),B),{pickable:!P&&(null===(T=B.pickable)||void 0===T||T)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:O.x+I/2+t/2,y:O.y+L*D-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},YB.vertical),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:O.x+I/2+i/2,y:O.y+R*D-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},YB.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move"},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move"},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_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))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){return t.length<=10||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,void 0!==e?e*e:1)}(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(t);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(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){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 Ne).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)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=XB(c,["formatMethod"]),{formatMethod:g}=d,f=XB(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:_,width:y,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,A={x1:_.x,y1:_.y,x2:_.x+y,y2:_.y+b};let k,M,T,w;this._isHorizontal?(k={x:_.x+m*y,y:_.y+b/2},M={x:_.x+v*y,y:_.y+b/2},T={textAlign:$B(A,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},w={textAlign:$B(A,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:_.x+y/2,y:_.y+m*b},M={x:_.x+y/2,y:_.y+v*b},T={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:$B(A,t,"start",this._isHorizontal)?"top":"bottom"},w={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:$B(A,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),j({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),j({},f,{text:S,x:M.x,y:M.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new UM(e),s.name=i,t.add(s)),s}}const qB={debounce:St,throttle:At};class ZB extends l{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=jB.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=jB.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=jB.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=jB.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=jB.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===k_.env?k_:this.stage,s=dM();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===jB.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===jB.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===jB.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===jB.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(HB.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(HB.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(HB.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===jB.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(HB.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(HB.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:qB[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===k_.env?k_:this.stage,e=dM();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===k_.env?k_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===k_.env?k_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:_t(e+t,0,1),end:_t(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=jB.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}NM(),Xk(),tM(),Lk(),Vk();let JB=class t extends tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,_;h.visible?this._isHorizontal?(m=p,v=g-f,_={x:a.x,y:a.y+f}):(m=p-f,v=g,_={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(y+b)/2,_={x:_.x+y/2,y:_.y}):(v-=(y+b)/2,_={x:_.x,y:_.y+y/2})),v+=(null!==(n=u.lineWidth)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:_,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new KB(this._getRendererAttrs()),this._interaction=new ZB(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(HB.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(HB.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(NB.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(HB.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;p(t)&&p(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(NB.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.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._renderer.previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._renderer.statePointToData=t)}};var QB,tP,eP,iP;function sP(){zk(),NM(),Aw()}JB.defaultAttributes=GB,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"}(QB||(QB={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(tP||(tP={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(eP||(eP={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(iP||(iP={}));class nP extends tb{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=LT(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=RT(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=OT(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:j({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:j({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:j({},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=pf.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=pf.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=pf.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 rP(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 aP(t,e,i,s){t&&(rP(t.startSymbol,e,i,s),t.lines.forEach((t=>rP(t,e,i,s))),rP(t.line,e,i,s),rP(t.endSymbol,e,i,s))}function oP(t,e,i,s){t&&(rP(t.getTextShape(),e,i,s),rP(t.getBgRect(),e,i,s))}function lP(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 hP(t,e,i,s){t&&(lP(t.startSymbol,e,i,s),t.lines.forEach((t=>lP(t,e,i,s))),lP(t.line,e,i,s),lP(t.endSymbol,e,i,s))}function cP(t,e,i,s){t&&(lP(t.getTextShape(),e,i,s),lP(t.getBgRect(),e,i,s))}function dP(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;rP(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)})),rP(t.endSymbol,s+r+a,o,n),Y(e).forEach((t=>{const e=s+r+a+o;rP(t.getTextShape(),e,l,n),rP(t.getBgRect(),e,l,n)}))}function uP(t,e,i,s,n){aP(t,s,i,n),Y(e).forEach((t=>{oP(t,s,i,n)}))}function pP(t,e,i,s,n){rP(t,s,i,n),Y(e).forEach((t=>{oP(t,s,i,n)}))}function gP(t,e,i,s,n){rP(t,s,i,n),Y(e).forEach((t=>{oP(t,s,i,n)}))}function fP(t,e,i,s,n,r){var a;aP(t,n,s,r),rP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?oP(i,n,s,r):rP(i,n,s,r)}function mP(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;rP(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)})),rP(e,n+o+l,h,r),rP(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(rP(i.getTextShape(),n+o+l+h+c,d,r),rP(i.getBgRect(),n+o+l+c,d,r)):rP(i,n+o+l+c,d,r)}function vP(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?dP(t,e,s,r,a):"fadeIn"===i&&uP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?dP(t,e,s,n,a):"fadeIn"===i&&uP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){hP(t,s,i,n),Y(e).forEach((t=>{cP(t,s,i,n)}))}(t,e,i,s,n)}}function _P(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&&pP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&pP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){lP(t,s,i,n),Y(e).forEach((t=>{cP(t,s,i,n)}))}(t,e,i,s,n)}}function yP(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&&gP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&gP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){lP(t,s,i,n),Y(e).forEach((t=>{cP(t,s,i,n)}))}(t,e,i,s,n)}}function bP(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?fP(n,r,e,i,s,o):"callIn"===t&&mP(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?fP(n,r,e,i,s,a):"callIn"===t&&mP(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;hP(t,n,s,r),lP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?cP(i,n,s,r):lP(i,n,s,r)}(n,r,e,t,i,s)}}const xP={type:"clipIn",duration:500,easing:"linear",delay:0},SP={type:"fadeIn",duration:500,easing:"linear",delay:0},AP={type:"callIn",duration:500,easing:"linear",delay:0},kP={type:"fadeOut",duration:500,easing:"linear",delay:0};class MP{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=Y(null==n?void 0:n.label),a=Y(null==n?void 0:n.labelBackground),o=Y(s).map(((s,n)=>{var o,l;const h=j({},i,s),c=new UM(Object.assign(Object.assign({},h),{state:{panel:j({},lM,null!==(o=a[n])&&void 0!==o?o:$(a)),text:j({},lM,null!==(l=r[n])&&void 0!==l?l:$(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===Y(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=Y(this._label),n=Y(null==i?void 0:i.label),r=Y(null==i?void 0:i.labelBackground);if(s.length){const i=Y(e);s.forEach(((e,s)=>{var a,o;const l=j({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:j({},lM,null!==(a=r[s])&&void 0!==a?a:$(r)),text:j({},lM,null!==(o=n[s])&&void 0!==o?o:$(n))}})),this.setLabelPos(e,l)}))}}}class TP extends nP{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=xP,this.defaultExitAnimation=kP}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;HM(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}G(TP,MP);const wP=.001,CP={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:QB.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]}},EP={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"}}},BP={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:{autoRotate:!0,position:eP.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]}},PP={interactive:!0,label:{position:tP.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}},LP={interactive:!0,label:{autoRotate:!0,position:eP.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}},RP={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"}},OP={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"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},IP={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 DP(){FP._animate=vP}sP(),pT(),Aw();class FP extends TP{markerAnimate(t){FP._animate&&this._animationConfig&&FP._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},FP.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i: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,e){var i;return(bM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return xM(Math.abs(e),Math.PI/2,wP)||xM(Math.abs(e),3*Math.PI/2,wP)?SM(i,e,t):bM(e)?EP.postiveXAxis[t]:EP.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new fT({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:j({},lM,null==a?void 0:a.line),startSymbol:j({},lM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},lM,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:j({},lM,null==a?void 0:a.line),startSymbol:j({},lM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},lM,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}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",FP.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(FP.defaultAttributes.label)}}function zP(){jP._animate=_P}FP.defaultAttributes=CP,sP(),Yk(),Aw();class jP extends nP{markerAnimate(t){jP._animate&&this._animationConfig&&jP._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},jP.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=SP,this.defaultExitAnimation=kP}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},OP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;HM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=pf.polygon(Object.assign({points:e},i));n.states=j({},lM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",jP.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=j({},lM,null==i?void 0:i.area)),this._updateMarkLabels(jP.defaultAttributes.label)}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}}jP.defaultAttributes=PP,G(jP,MP),sP(),gT(),Aw();class HP extends TP{markerAnimate(t){HP._animate&&this._animationConfig&&HP._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},HP.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case eP.arcInnerStart:l=n;case eP.arcOuterStart:l=n;break;case eP.arcInnerEnd:l=r;case eP.arcOuterEnd:l=r;break;case eP.center:case eP.arcInnerMiddle:case eP.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return RP[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new mT({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:j({},lM,null==o?void 0:o.line),startSymbol:j({},lM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},lM,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:j({},lM,null==o?void 0:o.line),startSymbol:j({},lM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},lM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",HP.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(HP.defaultAttributes.label)}}HP.defaultAttributes=BP,sP(),Bk(),Aw();class NP extends nP{markerAnimate(t){NP._animate&&this._animationConfig&&NP._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},NP.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=SP,this.defaultExitAnimation=kP}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case eP.center:h=(s+n)/2,c=(r+a)/2;break;case eP.arcInnerStart:h=s,c=r;break;case eP.arcOuterStart:h=n,c=r;break;case eP.arcInnerEnd:h=s,c=a;break;case eP.arcOuterEnd:h=n,c=a;break;case eP.arcInnerMiddle:h=s,c=(r+a)/2;break;case eP.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},RP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;HM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=pf.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=j({},lM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",NP.defaultAttributes.label)}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=j({},lM,null==o?void 0:o.area)),this._updateMarkLabels(NP.defaultAttributes.label)}isValidPoints(){return!0}}function VP(){UP._animate=bP}NP.defaultAttributes=LP,G(NP,MP),sP(),pT(),gT(),tM(),Hk(),Vk(),Aw();class UP extends nP{markerAnimate(t){UP._animate&&this._animationConfig&&UP._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},UP.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=AP,this.defaultExitAnimation=kP,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return xM(Math.abs(s),Math.PI/2,wP)||xM(Math.abs(s),3*Math.PI/2,wP)?SM(t,s,n):bM(s)?IP.postiveXAxis[n]:IP.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,style:d,position:u=iP.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-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,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:j({},lM,null==p?void 0:p.textBackground),text:j({},lM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=j({},lM,null==p?void 0:p.itemContent));const v=bM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+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",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=pf.symbol(Object.assign(Object.assign({},i),r)),o.states=j({},lM,null==s?void 0:s.itemContent)):"text"===n?o=new UM(Object.assign(Object.assign({},i),{state:{panel:j({},lM,null==s?void 0:s.textBackground),text:j({},lM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=pf.richtext(Object.assign(Object.assign({},i),r)),o.states=j({},lM,null==s?void 0:s.itemContent)):"image"===n?(o=pf.image(Object.assign(Object.assign({},i),r)),o.states=j({},lM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=j({},lM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}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=xM(c,0,wP)||xM(d,0,wP),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=zM(e-u,t-d),o=zM(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*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(JP.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(JP.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===JP.focus||"focus"===o){const s=a.hasState(qP.focus);a.toggleState(qP.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[qP.unSelected,qP.unSelectedHover,qP.focus],t),this._setLegendItemState(e,qP.selected,t)})):(this._setLegendItemState(a,qP.selected,t),this._removeLegendItemState(a,[qP.unSelected,qP.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[qP.selected,qP.selectedHover,qP.focus],t),this._setLegendItemState(e,qP.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(qP.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(qP.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(ZP.legendItemClick,a,t);i?(this._removeLegendItemState(a,[qP.selected,qP.selectedHover],t),this._setLegendItemState(a,qP.unSelected,t)):(this._setLegendItemState(a,qP.selected,t),this._removeLegendItemState(a,[qP.unSelected,qP.unSelectedHover],t))}else this._setLegendItemState(a,qP.selected,t),this._removeLegendItemState(a,[qP.unSelected,qP.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[qP.selected,qP.selectedHover],t),this._setLegendItemState(e,qP.unSelected,t))}))}this._dispatchLegendEvent(ZP.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,qP.selected),this._removeLegendItemState(e,[qP.unSelected,qP.unSelectedHover])):(this._removeLegendItemState(e,[qP.selected,qP.selectedHover]),this._setLegendItemState(e,qP.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=$P,spaceRow:l=XP,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:u?i:e,v=this._contentMaxHeight;let _,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,M=0,T=0;const w=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),_=d[t],_.id||(_.id=_.label),_.index=t;let e=!0;y(n)&&(e=n.includes(_.label));const i=this._renderEachItem(_,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||w.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=T+l,T=0,w.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),w.push(i)):(p(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=M+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=pf.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:u}=t,g=[];p(c)&&g.push(c),p(d)&&g.push(d),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=K(g)),p(u)&&(this._itemHeightByUser=u);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,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:f,autoEllipsisStrategy:m}=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=ai(c);let w;!1===x.visible?(w=pf.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,JP.item,t,w)):(w=pf.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,JP.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?qP.selected:qP.unSelected);const C=pf.group({x:0,y:0,pickable:!1});w.add(C);let E,B=0,P=0,R=0;if(v&&!1!==v.visible){const i=L(S,"style.size",10);P=y(i)?i[0]||0:i,R=L(v,"space",8);const s=pf.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,JP.itemShape,t,w,S.state),s.addState(e?qP.selected:qP.unSelected),C.add(s)}let O=0;if(d){const e=L(g,"size",10);E=pf.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,JP.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=DM(Object.assign(Object.assign({x:P/2+R,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,JP.itemLabel,t,w,A.state),D.addState(e?qP.selected:qP.unSelected),C.add(D);const F=L(_,"space",8);if(p(l)){const s=L(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=DM(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,JP.itemValue,t,w,k.state),r.addState(e?qP.selected:qP.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-P-R-F-O-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-P/2-T[1]-T[3]-O-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));B=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-P-R-O),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",B),C.add(E));const z=C.AABBBounds,j=z.width();if("right"===f){const t=z.x2,e=z.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=z.height(),N=p(this.attribute.item.width)?this.attribute.item.width:j+T[1]+T[3],V=this._itemHeightByUser||H+T[0]+T[2];return w.attribute.width=N,w.attribute.height=V,E&&E.setAttribute("visible",!1),C.translateTo(-z.x1+T[3],-z.y1+T[0]),w}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new YP(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},j({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new YP(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new pM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new pM(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?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 i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",At(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=$P,spaceRow:o=XP}=n,l=this._itemsContainer,{space:h=KP,defaultCurrent:c=1}=r,d=iL(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,_=0,y=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v0&&(y=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:y,y:b}),y+=a+i})),this._itemContext.startX=y,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),_=p-g.AABBBounds.height()-h-t,_<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;_0&&(b=0,y+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:y,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=pf.group({x:0,y:t,width:u?v:f,height:u?m:_,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=$P,spaceRow:a=XP}=s,o=this._itemsContainer,{space:l=KP,defaultCurrent:h=1}=n,c=iL(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const _=pf.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=pf.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];gt(_t(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),gt(_t(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(qP.selected)?this._setLegendItemState(t,qP.selectedHover,e):this._setLegendItemState(t,qP.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===JP.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(ZP.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(qP.unSelectedHover)||t.hasState(qP.selectedHover))&&(i=!0),t.removeState(qP.unSelectedHover),t.removeState(qP.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(qP.unSelectedHover)&&!t.hasState(qP.selectedHover)||(i=!0),t.removeState(qP.unSelectedHover),t.removeState(qP.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===JP.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(ZP.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(ZP.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!==JP.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(ZP.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!==JP.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(ZP.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(qP.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=j({},sL,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(qP.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}release(){super.release(),this.removeAllEventListeners()}};var rL;function aL(t){return y(t)?t:[t,t]}function oL(t){return t?"ew-resize":"ns-resize"}nL.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:$P,spaceRow:XP,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:KP,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"}(rL||(rL={})),tL();class lL extends tb{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},lL.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=_t(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=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=dM(),n="browser"===k_.env?k_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;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=_t(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=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=dM(),n="browser"===k_.env?k_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{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?_t(t+p,h,c):_t(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?_t(t+p,0,c-h):_t(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=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),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:aL(d)[0],endValue:aL(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=pf.group({x:0,y:0});f.name=rL.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=pf.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)),m.name=rL.startText,f.add(m);const e=p(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const _=pf.group({x:g?v:0,y:g?0:v});f.add(_);const y=pf.group({x:0,y:0});let b;if(y.name=rL.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=pf.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=rL.endText,f.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=pf.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=rL.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,f]=aL(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":oL(p)},r));if(v.name=rL.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=rL.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":oL(p)},r));if(i.name=rL.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f,"end");e.name=rL.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=yt(h,i,s);c=t[0],d=t[1]}else c=i,d=_t(h,i,s);const p=this._isHorizontal;e||(c=i);const f=pf.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=rL.trackContainer;const m=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":oL(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=pf.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=rL.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return pf.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":oL(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),pf.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=pf.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=pf.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),("browser"===k_.env?k_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=dM(),e="browser"===k_.env?k_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_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===rL.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===rL.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===rL.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===rL.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}}release(t){super.release(t),("browser"===k_.env?k_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}lL.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}}},eL(),tL();class hL extends QP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},hL.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:f,handlerText:m,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:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function cL(t="bottom"){let 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`}hL.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"}}},eL(),tL(),Wk();class dL extends QP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},dL.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:f,showTooltip:m,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=pf.group({x:0,y:0});this._innerView.add(x);const S=new lL({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:cL(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,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=pf.path(Object.assign(Object.assign({x:0,y:k,path:A},_),{zIndex:0}));x.add(M);const T=this._title?this._title.AABBBounds.height()+L(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))}}dL.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)"}},zk(),iM(),qk();let uL=class t extends tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,b,x;const{textType:S,text:A,subtextType:k,textStyle:M={},subtext:T,subtextStyle:w={},width:C,height:E,minWidth:B,maxWidth:P,minHeight:L,maxHeight:R,align:O,verticalAlign:I,padding:D=0}=this.attribute,F=ai(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),j=null!==(t=M.height)&&void 0!==t?t:E;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:u="break-word",maxWidth:g,lineClamp:f}=M;if("rich"===S||p(M.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:C)&&void 0!==e?e:0,height:null!=j?j:0,ellipsis:null==d||d,wordBreak:null!=u?u:"break-word",maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:null!==(i=M.character)&&void 0!==i?i:A},M);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},hM),M),x:h,y:c,width:null!==(s=null!=t?t:C)&&void 0!==s?s:0,height:null!=j?j:0,ellipsis:d,wordBreak:u,maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:[]},M);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else p(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(A)?A:[A],whiteSpace:"normal"},M),{maxLineWidth:null!==(r=null!==(n=M.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:C,heightLimit:null!==(a=M.height)&&void 0!==a?a:R,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const H=this._mainTitle?this._mainTitle.AABBBounds.height():0,N=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==w.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=w,v=Math.max(Number.MIN_VALUE,R-H);if("rich"===k||p(w.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:C)&&void 0!==o?o:0,height:null!==(l=null!=e?e:E)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=w.character)&&void 0!==h?h:T},w);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:T},hM),w),x:n,y:r,width:null!==(c=null!=t?t:C)&&void 0!==c?c:0,height:null!==(d=null!=e?e:E)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},w);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else p(T)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(T)?T:[T],whiteSpace:"normal"},w),{maxLineWidth:null!==(u=w.maxLineWidth)&&void 0!==u?u:C,heightLimit:null!==(g=w.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:H}),"text"))}const V=this._subTitle?this._subTitle.AABBBounds.height():0,U=this._subTitle?this._subTitle.AABBBounds.width():0;let W=Math.max(N,U),G=H+(null!==(f=w.height)&&void 0!==f?f:V);if(p(C)&&(W=C),p(E)&&(G=E),p(B)&&WP&&(W=P),p(L)&&GR&&(G=R),z.attribute.width=W,z.attribute.height=G,z.attribute.boundsPadding=F,this._mainTitle){if(p(O)||p(M.align)){const t=M.align?M.align:O,e=null!==(m=M.width)&&void 0!==m?m:W;"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")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:I,e=null!=j?j:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"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")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(p(O)||p(w.align)){const t=w.align?w.align:O,e=null!==(_=null!==(v=w.width)&&void 0!==v?v:M.width)&&void 0!==_?_:W;"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")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=w.verticalAlign?w.verticalAlign:I,e=this._mainTitle?p(j)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),j):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=w.height)&&void 0!==b?b:E)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"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")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};uL.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 pL={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"}}};zk(),iM(),qk();let gL=class extends tb{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=j({},L(pL,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=DM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{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,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(p(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),p(s)){const t=Y(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e: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=RM(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,f=c/2,m=g**2+1,v=2*f*g,_=f**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*m*_))/(2*m))+f),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 fL extends Cg{constructor(t){super(t)}}var mL,vL;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(mL||(mL={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(vL||(vL={}));class _L extends tb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},_L.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"},_L.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"},_L.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},_L.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},_L.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 fL(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new fL(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new fL(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(mL.OnPlay)},this.pause=()=>{this._dispatchEvent(mL.OnPause)},this.forward=()=>{this._dispatchEvent(mL.OnForward)},this.backward=()=>{this._dispatchEvent(mL.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()}}_L.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},_L.defaultAttributes={[vL.Start]:{},[vL.Pause]:{},[vL.Backward]:{},[vL.Forward]:{}};const yL={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},bL=[200,10];var xL,SL;!function(t){t.Default="default",t.Reverse="reverse"}(xL||(xL={})),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"}(SL||(SL={}));const AL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===xL.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===xL.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),kL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===xL.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===xL.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),ML=t=>"top"===t||"bottom"===t;class TL extends tb{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},TL.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=Yt(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(ML(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:bL[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:bL[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 lL(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 t.layout=ML(this._orient)?"horizontal":"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 _L(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=ML(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:bL[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Yt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(ML(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:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:ML(this._orient)?t+s:(this._size.width-r)/2,y:ML(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:ML(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:ML(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:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:ML(this._orient)?t+s:(this._size.width-r)/2,y:ML(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]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function wL(){tL(),zk(),tM()}TL.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({},yL),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},yL),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},yL),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},yL),{key:"backward",position:"start"})}},wL();class CL extends TL{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},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:xL.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(mL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(mL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(mL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(mL.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(SL.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(AL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||kL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===xL.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(SL.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=k_.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(SL.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(SL.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=k_.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(),k_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(SL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,k_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(SL.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(SL.change),this.dispatchCustomEvent(SL.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var EL,BL=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())}))};wL();class PL extends TL{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(mL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(mL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(mL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(mL.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(SL.change))},this.play=()=>BL(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(SL.play),this._rafId=k_.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=k_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,k_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(SL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,k_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(SL.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(SL.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(SL.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.brushActive="brushActive",t.brushClear="brushClear"}(EL||(EL={}));const LL={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],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:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},RL=5;const OL={debounce:St,throttle:At};zk(),Yk();let IL=class t extends tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=LL.updateTrigger,endTrigger:i=LL.endTrigger,brushMoved:s=!0}=this.attribute;Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushingWithDelay))),Y(i).forEach((t=>this.stage.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos]},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:OL[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(EL.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const{trigger:t=LL.trigger,resetTrigger:e=LL.resetTrigger}=this.attribute;Y(t).forEach((t=>this.stage.addEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(EL.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;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,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(EL.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=RL}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(EL.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(EL.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;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._dispatchBrushEvent(EL.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=RL}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(EL.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(EL.brushClear,t)):Math.abs(r-s)this.stage.removeEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents()}_releaseBrushUpdateEvents(){const{updateTrigger:t=LL.updateTrigger,endTrigger:e=LL.endTrigger}=this.attribute;Y(t).forEach((t=>this.stage.removeEventListener(t,this._onBrushingWithDelay))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushEnd)))}_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=pf.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}_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(Le(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_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.ythis._brushMaskAABBBoundsDict[t].empty()))}};IL.defaultAttributes=LL;const DL=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return j(t,...e,{shape:i.every(u)?void 0:j({},...i),key:s.every(u)?void 0:j({},...s),value:n.every(u)?void 0:j({},...n)})},FL=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}},zL={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:aM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:aM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:aM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ve).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},jL=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];zk(),Xk(),tM(),iM(),qk();let HL=class t extends tb{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: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=ai(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",j({symbolType:"circle"},u.shape,{visible:yM(u)&&yM(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:yM(u)&&yM(u.value)},FL(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:yM(u)&&yM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:yM(u)&&yM(u.value)},FL(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},hM),u.value),visible:yM(u)&&yM(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=yM(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:f,textBaseline:m}=u.value,v=n.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 _=yM(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(!yM(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)+(yM(n.key)?r+n.key.spacing:0)+(yM(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&&(FM(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";p(n.value.textAlign)?t=n.value.textAlign:yM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),FM(c,f,t,u,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(yM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=ad(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(yM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},FL(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},FL(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},hM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(yM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},FL(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},FL(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=>jL.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)&&yM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=yM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=LM(d),_=LM(u);let y=0;if(yM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),y=Math.max(y,e)}if(yM(u)){const{width:t,height:e}=_.quickMeasure(u.text);h.push(t),y=Math.max(y,e)}f&&cu[m]&&(t=!0,r.push(p.size),y=Math.max(p.size,y)),e.height=y,o+=y,a{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 DL({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return DL({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};HL.defaultAttributes=zL;const NL=gt;function VL(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:K(i)}function UL(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function WL(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function GL(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 YL(t,e){const i=GL(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 $L(t,e){const i=XL(t),s=XL(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 XL(t,e={x:0,y:0}){return ae.distancePP(t,e)}function KL(t){return k(t.x)&&k(t.y)}function qL(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 ZL(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const JL=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function tR(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&tR(t[i],e)}}var eR,iR,sR;function nR(t){var e,i;const{type:s}=t;return s===iR.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!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.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_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"}(eR||(eR={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",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",t.mosaic="mosaic",t.pictogram="pictogram"}(iR||(iR={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",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.transform="transform",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.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.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(sR||(sR={}));const rR={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},aR={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function oR(t,e){var i;if(!t)return[];const s=gR(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?uR(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>dR(i)?hR(t,i,e):i)).filter(p)}))):i.map((i=>dR(i)?hR(t,i,e):i)).filter(p):[]}return[]}function lR(t,e){var i,s;return uR(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 hR(t,e,i){var s;const n=gR(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=rR[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=aR[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 ii(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=$e(t,i,s),a=Ye(n,r,e.l),l=new ii(`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 cR=(t,e)=>{if(e&&dR(t)){const i=hR(e,t);if(i)return i}return t};function dR(t){return t&&"palette"===t.type&&!!t.key}function uR(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function pR(t){return y(t)?{dataScheme:t}:t}function gR(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=nR(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 fR extends oE{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(!uR(this._range))return void super.range(this._range);const t=lR(this._range,this._domain);super.range(t)}}const mR={linear:PE,band:cE,point:class extends cE{constructor(t){super(!1),this.type=jC.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:oE,threshold:FE,colorOrdinal:fR};function vR(t){const e=mR[t];return e?new e:null}function _R(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function yR(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function bR(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function xR(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function SR(t){return!!_(t)&&(!!t.endsWith("%")&&Zy(t.substring(0,t.length-1)))}function AR(t){return!!g(t)&&("percent"in t||"offset"in t)}function kR(t,e,i,s=0){var n,r;return S(t)?t:SR(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 MR(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]=kR(t[s],e.size,i)}))})),o}function TR(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}}function wR(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)||SR(t)||d(t)||AR(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function CR(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const ER=(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},BR=[{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"]}];function PR(t,e){return t&&e.key in t?t[e.key]:e.default}function LR(t){return t&&"token"===t.type&&!!t.key}const RR={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%"},OR={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:BR,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)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:RR,component:{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}}},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:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},IR={name:"dark",colorScheme:{default:{dataScheme:BR,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",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},DR=(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]={}),DR(t[s],e.slice(1),i))};function FR(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=pR(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}zR._charts={},zR._series={},zR._components={},zR._graphicComponents={},zR._marks={},zR._regions={},zR._animations={},zR._implements={},zR._chartPlugin={},zR._vChartPlugin={},zR._componentPlugin={},zR.transforms={fields:$r,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}},zR.dataParser={csv:(t,e={},i)=>(i.type=Yr.DSV,na(t)),dsv:(t,e={},i)=>{i.type=Yr.DSV;const s=Nr(aa,e),{delimiter:n}=s;if(!_(n))throw new TypeError("Invalid delimiter: must be a string!");return sa(n).parse(t)},tsv:(t,e={},i)=>(i.type=Yr.DSV,ra(t))},zR._layout={},zR._grammarTransforms={},zR._stageEventPlugins={},zR.registerStageEventPlugin=(t,e)=>{zR._stageEventPlugins[t]=e},zR.getStageEventPlugin=t=>zR._stageEventPlugins[t],zR._interactionTriggers={},zR.registerInteractionTrigger=(t,e)=>{zR._interactionTriggers[t]=e},zR._composedEventMap={},zR.registerComposedEvent=(t,e)=>{zR._composedEventMap[t]=e},zR._tooltipProcessors={},zR.registerTooltipProcessor=(t,e)=>{zR._tooltipProcessors[t]=e},zR.createTooltipProcessor=(t,e)=>{const i=zR._tooltipProcessors[t];return i?new i(e):null};const NR=t=>{const e={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"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},VR=NR(),UR={[OR.name]:OR},WR=OR.name,GR=new Map(Object.keys(UR).map((t=>[t,UR[t]]))),YR=new Map,$R=new Map(Object.keys(UR).map((t=>[t,t===WR]))),XR=(t,e)=>{if(!t)return;const i=JR(e);GR.set(t,i),$R.set(t,!0)},KR=(t=WR)=>($R.has(t)&&!$R.get(t)&&XR(t,GR.get(t)),GR.get(t)),qR=t=>GR.delete(t)&&YR.delete(t)&&$R.delete(t),ZR=t=>!!_(t)&&GR.has(t),JR=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:WR;return jR({},KR(i),t)};class QR{static registerInstance(t){QR.instances.set(t.id,t)}static unregisterInstance(t){QR.instances.delete(t.id)}static getInstance(t){return QR.instances.get(t)}static instanceExist(t){return QR.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return QR.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}QR.instances=new Map;class tO{static registerTheme(t,e){XR(t,e)}static getTheme(t,e=!1){return KR(t)}static removeTheme(t){return qR(t)}static themeExist(t){return ZR(t)}static getDefaultTheme(){return tO.themes.get(WR)}static setCurrentTheme(t){tO.themeExist(t)&&(tO._currentThemeName=t,QR.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return tO.getTheme(tO._currentThemeName,t)}static getCurrentThemeName(){return tO._currentThemeName}}function eO(t){return _(t)?tO.themeExist(t)?tO.getTheme(t):{}:g(t)?t:{}}tO.themes=GR,tO._currentThemeName=WR;const iO=["animationThreshold","colorScheme","name","padding"];function sO(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];iO.includes(n)?s[n]=r:m(r)?dR(r)?s[n]=cR(r,e):LR(r)?s[n]=PR(i,r):s[n]=sO(r,e,i):s[n]=r})),s}function nO(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]=nO(t[s],e)}return i}return y(t)?t.map((t=>nO(t,e))):t}function rO(t,e){if(!t)return t;if(m(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]=rO(t[s],e)}return i}return y(t)?t.map((t=>rO(t,e))):t}function aO(t,...e){return d(t)?t(...e):t}const oO=(t,e,i,s)=>((t,e,i)=>LM(t,e,i,{fontFamily:RR.fontFamily,fontSize:RR.fontSize}))(e,i,s).measure(t),lO="__VCHART",hO=500,cO=500,dO=`${lO}_MEASURE_CANVAS_ID`,uO=`${lO}_DEFAULT_DATA_INDEX`,pO=`${lO}_DEFAULT_DATA_KEY`,gO=`${lO}_DEFAULT_DATA_SERIES_FIELD`,fO=`${lO}_DEFAULT_SERIES_STYLE_NAME`,mO=`${lO}_STACK_KEY`,vO=`${lO}_STACK_START`,_O=`${lO}_STACK_END`,yO=`${lO}_STACK_START_PERCENT`,bO=`${lO}_STACK_END_PERCENT`,xO=`${lO}_STACK_START_OffsetSilhouette`,SO=`${lO}_STACK_END_OffsetSilhouette`,AO=`${lO}_STACK_TOTAL`,kO=`${lO}_STACK_TOTAL_PERCENT`,MO=`${lO}_STACK_TOTAL_TOP`,TO=`${lO}_STACK_TOTAL_BOTTOM`,wO=`${lO}_MOSAIC_VALUE_START_PERCENT`,CO=`${lO}_MOSAIC_VALUE_END_PERCENT`,EO=`${lO}_MOSAIC_CAT_START_PERCENT`,BO=`${lO}_MOSAIC_CAT_END_PERCENT`,PO=`${lO}_SEGMENT_START`,LO=`${lO}_SEGMENT_END`,RO=`${lO}_KEY`,OO=`${lO}_MAP_LOOK_UP_KEY`;function IO(t,e){for(let i=0;it.key===e))}function FO(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 zO(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:{groupField:a.groupField,nodes:{}},UO(t,a,n[o],l,e,r))})),s?jO(n):n}function jO(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))):jO(t[e].nodes);return t}function HO(t,e){if("values"in t&&t.values.length){const i=WL(t.values,e),s=UL(t.values,bO);t.values.forEach((t=>{t[AO]=i,t[kO]=s}))}else for(const i in t.nodes)HO(t.nodes[i],e)}function NO(t){if(!t.values.length)return;const e=t.values[t.values.length-1][_O]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)VO(t.nodes[r],e,i,s,n)}function UO(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[_O]=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 l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),UO(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const WO=(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]=YO(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function $O(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>qO(t.style(e,i,s,n)):P(t.style)||(e.style=qO(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>qO(t.state[e](i,s,n,r)):P(t.state[e])||(i[e]=qO(t.state[e]))})),e.state=i}return e}function XO(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>qO(t[i](e,s,n,r)):P(t[i])||(e[i]=qO(t[i]))})),e}function KO(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),qO(i)}function qO(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:oe(t.angle)}):t}const ZO=t=>"line"===t||"area"===t,JO=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return ZO(i)?e:null==e?void 0:e[0]},QO=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let tI=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},n=zR.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{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(zR.getComposedEvent(t))if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};var eI;!function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(eI||(eI={}));const iI=["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 sI,nI,rI;t.ChartEvent=void 0,(sI=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",sI.rendered="rendered",sI.renderFinished="renderFinished",sI.animationFinished="animationFinished",sI.regionSeriesDataFilterOver="regionSeriesDataFilterOver",sI.afterInitData="afterInitData",sI.afterInitEvent="afterInitEvent",sI.afterInitMark="afterInitMark",sI.rawDataUpdate="rawDataUpdate",sI.viewDataFilterOver="viewDataFilterOver",sI.viewDataUpdate="viewDataUpdate",sI.viewDataStatisticsUpdate="viewDataStatisticsUpdate",sI.markDeltaYUpdate="markDeltaYUpdate",sI.viewDataLabelUpdate="viewDataLabelUpdate",sI.scaleDomainUpdate="scaleDomainUpdate",sI.scaleRawDomainUpdate="scaleRawDomainUpdate",sI.scaleUpdate="scaleUpdate",sI.dataZoomChange="dataZoomChange",sI.drill="drill",sI.layoutStart="layoutStart",sI.layoutEnd="layoutEnd",sI.layoutRectUpdate="layoutRectUpdate",sI.playerPlay="playerPlay",sI.playerPause="playerPause",sI.playerEnd="playerEnd",sI.playerChange="playerChange",sI.playerForward="playerForward",sI.playerBackward="playerBackward",sI.scrollBarChange="scrollBarChange",sI.brushStart="brushStart",sI.brushChange="brushChange",sI.brushEnd="brushEnd",sI.brushClear="brushClear",sI.brushActive="brushActive",sI.legendSelectedDataChange="legendSelectedDataChange",sI.legendFilter="legendFilter",sI.legendItemClick="legendItemClick",sI.legendItemHover="legendItemHover",sI.legendItemUnHover="legendItemUnHover",sI.tooltipShow="tooltipShow",sI.tooltipHide="tooltipHide",sI.tooltipRelease="tooltipRelease",sI.afterResize="afterResize",sI.afterRender="afterRender",sI.afterLayout="afterLayout",sI.afterMarkLayoutEnd="afterMarkLayoutEnd",sI.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(nI||(nI={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(rI||(rI={}));const aI=[rI.mark,rI.model,rI.chart,rI.vchart];class oI{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(rI.vchart,[]),this._levelNodes.set(rI.chart,[]),this._levelNodes.set(rI.model,[]),this._levelNodes.set(rI.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const lI={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"};class hI{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=L(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>JO(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||nI.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||nI.chart);o.get(t)||o.set(t,new oI);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||nI.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||nI.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||nI.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||nI.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?aI.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[nI.chart,nI.window,nI.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.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&&L(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 lI[a]&&(a=lI[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)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?rI.model:rI.vchart:rI.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=At(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=St(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=nI.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==rI.model&&s!==rI.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=rI.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case nI.chart:return this._viewBubbles;case nI.window:return this._windowBubbles;case nI.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case nI.chart:return this._viewListeners;case nI.window:return this._windowListeners;case nI.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return iI.includes(t)||Object.values(eI).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&zR.hasInteractionTrigger(e)}}function cI(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function dI(t,e,i){t.getParser(e)||t.registerParser(e,i)}const uI=new Map;let pI;function gI(){pI||(pI=new Ba,dI(pI,"geojson",ka),dI(pI,"topojson",Ta),cI(pI,"simplify",Gr))}function fI(t,e,i={type:"geojson",centroid:!0}){uI.has(t)&&Ny(`map type of '${t}' already exists, will be overwritten.`),gI();const s=new Pa(pI),n=j({},{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}),uI.set(t,s)}function mI(t){uI.has(t)?uI.delete(t):Ny(`map type of '${t}' does not exists.`)}function vI(t,e=!1){let i=e;return t.latestData instanceof Pa&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const _I=(t,e)=>0===t.length?[]:1===t.length?vI(t[0],null==e?void 0:e.deep):t.map((t=>vI(t,null==e?void 0:e.deep)));function yI(e,i,s){cI(i=i instanceof Ba?i:e.dataSet,"copyDataView",_I);const n=new Pa(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function bI(t,e,i=[]){var s;if(t instanceof Pa)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new Pa(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return Ny(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return Ny(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!_(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),Ny("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function xI(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var SI,AI,kI,MI;t.TransformLevel=void 0,(SI=t.TransformLevel||(t.TransformLevel={}))[SI.copyDataView=-10]="copyDataView",SI[SI.treemapFilter=-8]="treemapFilter",SI[SI.treemapFlatten=-7]="treemapFlatten",SI[SI.dotObjFlat=-7]="dotObjFlat",SI[SI.linkDotInfo=-7]="linkDotInfo",SI[SI.sankeyLayout=-7]="sankeyLayout",SI[SI.dataZoomFilter=-6]="dataZoomFilter",SI[SI.legendFilter=-5]="legendFilter",function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(AI||(AI={})),function(t){t.data="data",t.mark="mark"}(kI||(kI={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(MI||(MI={}));const TI=["line","area","trail"];function wI(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(RO,i?t.slice().sort(i):t.slice()),{keys:[RO],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const CI=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function EI(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{EI(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function PI(t,e,i,s){const n=wI(t,(t=>i(t))),r=wI(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!u(t)){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}}const LI=`${lO}_BuiltIn_CallBack_Disappear`;var RI;!function(t){t.render="render",t.disappear="disappear"}(RI||(RI={}));class OI{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(e,i){this._count=0,this._rootMarks=[],this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{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._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var e,i,s,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:u,background:f}=this._option;k_.setEnv(function(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}(o),null!=l?l:{}),this._stage=null!==(e=this._option.stage)&&void 0!==e?e:new z_(Object.assign({background:f,width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,canvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:u},ReactDOM:this._option.ReactDOM,autoRefresh:p(r)?r:!p(a)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{})),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const m=Rp({x:0,y:0,width:this._width,height:this._height});m.name="root",this._stage.defaultLayer.appendChild(m),this._rootGroup=m;const v=(p(h)?h:$y(o))&&!1!==c&&zR.getStageEventPlugin("gesture");v&&(this._gestureController=new v(this._stage,g(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=MI.before}_setCanvasStyle(){if(this._stage&&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")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(k_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=k_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>EI(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>EI(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{EI(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;this._hasCommitedMark()&&(Hy(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),this._rootMarks.forEach((t=>{t.render()})),this._layoutState===MI.before&&(this._layoutState=MI.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=MI.reevaluate,this._hasCommitedMark()&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),this.findProgressiveMarks(),this.updateStateAnimation(),this._doRender(!0),this.doPreProgressive(),Hy(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=BI(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=PI(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=PI(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=wI(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=wI(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}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];y(s)?e[i]="disappear"===i?s.map((t=>{return"function"==typeof(e=t.callBack)&&/^class\s/.test(e.toString())?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:LI,customParameters:{callBack:t.callBack}});var e})):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{EI(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===AI.appear))?AI.appear:e.every((t=>t===AI.disappear))?AI.disappear:AI.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===nI.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=e;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=i.parent,i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:JO(o),markId:h,modelId:c,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===nI.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===nI.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===nI.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===nI.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===nI.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this.releaseGrammar(!0),this._stage!==(null===(t=this._option)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{EI(t,(t=>{t.removeProduct()}),null,!0)})):this._cachedMarks=BI(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return Yy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&function(t){return Su(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Ao.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()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{EI(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=k_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){k_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function II(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:Vy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function DI(t){t.crosshair=Y(t.crosshair||{}).map((e=>FR({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function FI(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}=oi(l,i.width,i.height);a=t,o=e}else if(h&&Yy(e.mode)){let t;t=_(h)?k_.getElementById(h):h;const{width:e,height:s}=oi(t,i.width,i.height);a=e,o=s}else if(Xy(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 zI(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function jI(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}}var HI,NI,VI,UI,WI,GI;t.LayoutZIndex=void 0,(HI=t.LayoutZIndex||(t.LayoutZIndex={}))[HI.SeriesGroup=0]="SeriesGroup",HI[HI.Axis_Grid=50]="Axis_Grid",HI[HI.CrossHair_Grid=100]="CrossHair_Grid",HI[HI.Region=450]="Region",HI[HI.Mark=300]="Mark",HI[HI.Node=400]="Node",HI[HI.Axis=100]="Axis",HI[HI.MarkLine=500]="MarkLine",HI[HI.MarkArea=100]="MarkArea",HI[HI.MarkPoint=500]="MarkPoint",HI[HI.DataZoom=500]="DataZoom",HI[HI.ScrollBar=500]="ScrollBar",HI[HI.Player=500]="Player",HI[HI.Legend=500]="Legend",HI[HI.CrossHair=500]="CrossHair",HI[HI.Indicator=500]="Indicator",HI[HI.Title=500]="Title",HI[HI.Label=500]="Label",HI[HI.Brush=500]="Brush",HI[HI.CustomMark=500]="CustomMark",HI[HI.Interaction=700]="Interaction",t.LayoutLevel=void 0,(NI=t.LayoutLevel||(t.LayoutLevel={}))[NI.Indicator=10]="Indicator",NI[NI.Region=20]="Region",NI[NI.Axis=30]="Axis",NI[NI.DataZoom=40]="DataZoom",NI[NI.Player=40]="Player",NI[NI.ScrollBar=40]="ScrollBar",NI[NI.Legend=50]="Legend",NI[NI.Title=70]="Title",NI[NI.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(VI=t.AttributeLevel||(t.AttributeLevel={}))[VI.Default=0]="Default",VI[VI.Theme=1]="Theme",VI[VI.Chart=2]="Chart",VI[VI.Base_Series=3]="Base_Series",VI[VI.Series=4]="Series",VI[VI.Mark=5]="Mark",VI[VI.User_Chart=6]="User_Chart",VI[VI.User_Series=7]="User_Series",VI[VI.User_Mark=8]="User_Mark",VI[VI.User_SeriesStyle=9]="User_SeriesStyle",VI[VI.Built_In=99]="Built_In";class YI{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({},YI.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]))))}}YI.defaultMarkInfo={};class $I{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class XI{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=>FR({},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 KI extends $I{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}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=XI,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new YI,this._lastLayoutRect=null,this.id=qy(),this.userId=t.id,this._spec=t,this.effect={},this.event=new tI(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){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}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){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_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){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${lO}_${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,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=zR.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_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 L(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}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class qI{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}get lastComputeRect(){return this._lastComputeRect}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}get willLayoutTag(){return this._willLayoutTag}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._willLayoutTag=!0,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){let a=MR(wR(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),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:kR(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:kR(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:kR(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:kR(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:kR(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:kR(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=kR(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=kR(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){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_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]=kR(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(TR(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class ZI extends KI{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,this._transformLayoutPadding=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 qI(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&U(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.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,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 JI extends XI{_initTheme(t,e){return{spec:t,theme:this._theme}}}class QI extends ZI{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=JI,this.modelType="region",this.specKey="region",this.type=QI.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,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"}_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,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[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.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex: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()}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,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(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})}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=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function tD(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 eD(t,e,i){e?t.forEach((t=>{const e=$(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=$(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 iD(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 sD(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=oD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),iD(d,!0,p,l),s&&eD(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function nD(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=oD(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=oD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),iD(d,!1,p,o),s&&eD(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function aD(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=oD(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_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){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_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,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=oD(t,this,e);"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,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=tD(t);n.length&&sD(n,e,i,!1,"left",s),r.length&&sD(r,e,i,!0,"left",s),a.length&&nD(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=tD(t);n.length&&rD(n,e,i,!1,"top",s),r.length&&rD(r,e,i,!0,"top",s),a.length&&aD(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=tD(t);n.length&&sD(n,e,i,!1,"right",s),r.length&&sD(r,e,i,!0,"right",s),a.length&&nD(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=tD(t);n.length&&rD(n,e,i,!1,"bottom",s),r.length&&rD(r,e,i,!0,"bottom",s),a.length&&aD(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=oD(t,this,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=>{U(i.getLayoutRect(),e.rect)||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{rect:i}=oD(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);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+c-l})}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+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&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:Vy)("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}}}lD.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(UI||(UI={})),t.STATE_VALUE_ENUM=void 0,(WI=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",WI.STATE_HOVER="hover",WI.STATE_HOVER_REVERSE="hover_reverse",WI.STATE_DIMENSION_HOVER="dimension_hover",WI.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",WI.STATE_SELECTED="selected",WI.STATE_SELECTED_REVERSE="selected_reverse",WI.STATE_SANKEY_EMPHASIS="selected",WI.STATE_SANKEY_EMPHASIS_REVERSE="blur",WI.STATE_HIGHLIGHT="highlight",WI.STATE_BLUR="blur",WI.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(GI||(GI={}));const hD=["linear","radial","conical"],cD={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const dD={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{dD[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class uD extends $I{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(j(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class pD extends uD{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:{}})}))}_isMultiMark(){return!this._mark||(t=this._mark.type,TI.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!dD[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(y(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(lO)));i=t.datums.some((t=>e&&y(null==t?void 0:t.items)?n.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])})):n.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(lO))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(NC(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class gD extends $I{constructor(){super(...arguments),this.id=qy(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=zR.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class fD extends gD{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}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._data=null,this._data=e}removeProduct(){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const mD=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,vD=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=mD(l.delay,n,a,o),d=mD(l.duration,n,a,o),u=mD(l.oneByOne,n,a,o),p=mD(l.splitPath,n,a,o),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)?Vw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Uw)(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);zw(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{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)?Vw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Uw)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Ow(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Dw(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:qo.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 Fw({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Ew,null!==(l=i.easing)&&void 0!==l?l:Bw))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:qo.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new jw({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Ew,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Bw))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):zw(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},_D=(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))))},yD=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}};class bD extends gD{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}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){u(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];y(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new fD(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}u(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=Rp("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){u(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(){this._product&&this._product.parent&&this._product.parent.removeChild(this._product),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Wl)),i&&(d(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==UI.enter&&t.context.diffState!==UI.update||(t.stateProxy=(e,i)=>{var s;return this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)},t.context.states&&t.useStates(t.context.states,e))},this.name=e,this.model=i.model,this.key=i.key,this.state=new pD(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_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,oe)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];u(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}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){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[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"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&FR(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(VC(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=vR(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),e.clamp&&t.clamp&&t.clamp(e.clamp))}(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=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):hD.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):VC(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=d(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_computeGradientAttr(t){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=t,c=e(t,["gradient","scale","field"]);let u=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(u=t),g||(g=e)}const f=lR(oR(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},cD[o]),c);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==u?void 0:u.scale(t[g]);return d(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=ii.SetOpacity(a,s)),{offset:d(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):d(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];d(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)hD.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=lR(oR(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return wI(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._graphics=t.getGraphics(),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear)}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return zR.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=d(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[pO],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=wI(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===AI.appear))?AI.appear:t.every((t=>t===AI.disappear))?AI.disappear:t[0];return null!=e?e:AI.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{yD(t),s.push(...t.getGraphics())})),e.forEach((t=>{yD(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);vD([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=_D(e,n),r=_D(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===AI.exit?AI.exit:i===AI.update?AI.update:AI.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===UI.exit&&(t.context.reusing=!0,t.animates&&t.animates.forEach((t=>t.stop())))}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===UI.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,d,p,g;let f,m;return u(e)?(f=this._graphicMap.get(t),f&&(m=UI.exit)):u(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=UI.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=UI.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(d=f.context)||void 0===d?void 0:d.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=AI.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=AI.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return CI(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=CI(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(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))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach(((t,e)=>{var i,n;let r=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i.update,t);null===(n=t.currentStates)||void 0===n||n.forEach((e=>{var i;const s=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i[e],t);r=Object.assign(Object.assign({},r),s)})),u(this._markConfig.interactive)||(r.pickable=this._markConfig.interactive);const a=this._transformGraphicAttributes(t,r,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=a}))}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r,a;const o=i.context.finalAttrs,l=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=QO(i,o);i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes({}),i.context.reusing=!1):l||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),!(null===(a=this.renderContext)||void 0===a?void 0:a.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i),e&&i.setFinalAttributes(o)}else{const a=i;i=this._createGraphic(o),e&&(null===(n=i.setFinalAttributes)||void 0===n||n.call(i,o)),i.context=a.context,i.context.diffAttrs=o,i.stateSort=this._stateSort;const l=this._graphics===t?s:s+this._graphics.length-t.length;if(l>=0&&(this._graphics[l]=i),null===(r=this.renderContext)||void 0===r?void 0:r.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,l),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(u(e)||(t.zIndex=e),u(i)||(t.clip=i),!u(s)){const e=y(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return u(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=zR.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=zR.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=Y(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===MI.before||(Hy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{"in"===this.state.checkOneState(i,i.context.data,e)?i.addState(t,!0,this.hasAnimationByState("state")):i.removeState(t,this.hasAnimationByState("state"))}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===UI.exit&&!e.isExiting)if(e.context.animationState===UI.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:UI.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=Rp({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}}var xD;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(xD||(xD={}));class SD extends bD{constructor(){super(...arguments),this.type=SD.type,this._marks=[],this._diffState=UI.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(Ny("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?(Ny("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))}getMarkInUserId(t){let e;return EI(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.diffState===UI.update){const t=this.hasAnimation(),e=QO(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e)),t&&this._product.setFinalAttributes(i)}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=UI.update}render(){this._isCommited&&(Hy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct()}}SD.type="group";const AD={measureText:oO};class kD{static instance(){return kD.instance_||(kD.instance_=new kD),kD.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 MD{constructor(){this.id=qy(),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))?Ny("不要重复添加相同的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 TD extends MD{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)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const wD={type:"fadeIn"};function CD(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 wD;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const ED={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"},state:{duration:300,easing:"linear"}},BD={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},PD={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},LD=()=>{zR.registerAnimation("scaleInOut",(()=>BD))},RD=()=>{zR.registerAnimation("fadeInOut",(()=>PD))},OD=(t,e)=>({appear:CD(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:$w,duration:ED.update.duration,easing:ED.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),ID=()=>{zR.registerAnimation("line",OD)},DD=()=>{pw.registerBuiltInAnimate("growPointsIn",hC),pw.registerBuiltInAnimate("growPointsOut",cC),pw.registerBuiltInAnimate("growPointsXIn",uC),pw.registerBuiltInAnimate("growPointsXOut",pC),pw.registerBuiltInAnimate("growPointsYIn",fC),pw.registerBuiltInAnimate("growPointsYOut",mC),pw.registerBuiltInAnimate("clipIn",qw),pw.registerBuiltInAnimate("clipOut",Zw)},FD=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class zD{constructor(t){this._markSet=new YI,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){y(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.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 jD={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class HD extends zD{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},jD,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}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}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll(e)}}HD.type="element-highlight",HD.defaultOptions=jD;const ND=()=>{zR.registerInteractionTrigger(HD.type,HD)},VD={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class UD extends zD{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},VD,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}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,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),t.addState(i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll(e)}}UD.type="element-select",UD.defaultOptions=VD;const WD=()=>{zR.registerInteractionTrigger(UD.type,UD)};class GD extends MD{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class YD{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>zR.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>zR.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>zR.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return zR.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>zR.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){zR.registerTransform(t,e)}static registerFunction(t,e){t&&e&&kD.instance().registerFunction(t,e)}static unregisterFunction(t){t&&kD.instance().unregisterFunction(t)}static getFunction(t){return t?kD.instance().getFunction(t):null}static getFunctionList(){return kD.instance().getFunctionNameList()}static registerMap(t,e,i){const s=zR.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=zR.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,uI.get(e);var e}static registerSVG(t,e,i){const s=zR.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=zR.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){QR.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 ot.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d,u;this.id=qy(),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._renderState=RI.render,this._disableDimensionHoverEvent=!1,this._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))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;U(n.theme,this._spec.theme)?U(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=zI(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?zR.getSeriesBuiltInTheme(e):zR.getComponentBuiltInTheme(e);i=i?FR({},s,i[e]):s}s===t.length-1&&p(i)&&(i=sO({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},tR(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:y,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=Yy(v);if(S?ax(xo):"node"===v&&oA(xo),S&&f&&(this._container=_(f)?k_.getElementById(f):f),m&&(this._canvas=m),y&&(this._stage=y),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=tO.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[];!1!==b&&A.push("poptipForText"),"sankey"===i.type&&A.push("scrollbar");const k=new ot(null!==(a=this._option.logLevel)&&void 0!==a?a:at.Error);ot.setInstance(k),(null===(o=this._option)||void 0===o?void 0:o.onError)&&k.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._compiler=new OI({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:y,pluginList:A},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new hI(this,this._compiler),this._event=new tI(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),QR.registerInstance(this),null===(u=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===u||u.call(d,this)}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=FR({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=nO(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;YD.getFunctionList()&&YD.getFunctionList().length&&(t=rO(t,YD)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=zR.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=zR.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=zR.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._chartSpecTransformer),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)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=At(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.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 FI(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:hO,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:cO})}_initDataSet(t){this._dataSet=t instanceof Ba?t:new Ba,dI(this._dataSet,"dataview",wa),dI(this._dataSet,"array",s),cI(this._dataSet,"copyDataView",_I);for(const t in zR.transforms)cI(this._dataSet,t,zR.transforms[t]);for(const t in zR.dataParser)dI(this._dataSet,t,zR.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake?(null===(n=this._compiler)||void 0===n||n.releaseGrammar(),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.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.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),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),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(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"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?AI.none:AI.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}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._cachedProcessedTheme=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,QR.unregisterInstance(this)}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):y(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._reSetRenderState(),u(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof Pa?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=bI(t,this._dataSet,s);y(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?FR({},t[n][e.index],i):i):t[n]=s?FR({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?FR({},t[n][r],i):i)}else t.id===e&&(t[n]=s?FR({},t[n],i):i)}))}(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=FR({},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),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,this),!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)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=jR({},e,e.chart[t])),e};let l;if(P(n)&&P(r))l=eO(this._currentThemeName),this._currentTheme=o(a,l);else if(_(n)&&(!r||_(r))||_(r)&&(!n||_(n))){const t=jR({},eO(this._currentThemeName),eO(n),eO(r));this._currentTheme=o(a,t)}else{const t=jR({},eO(this._currentThemeName),eO(n),eO(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),j(GM.poptip,WM,h),null===(s=this._compiler)||void 0===s||s.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=!!Yy(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return eO(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!tO.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),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}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield II(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(!Yy(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;this._chart.resetLayoutItemTag(),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)?k_.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)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(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?CR(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||P(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 Ny("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?CR(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Ny("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return kD.instance().getFunction(t)}registerFunction(t,e){t&&e&&kD.instance().registerFunction(t,e)}unregisterFunction(t){t&&kD.instance().unregisterFunction(t)}getFunctionList(){return kD.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=zR.getChartPlugins();t.length>0&&(this._chartPlugin=new TD(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=zR.getVChartPlugins();e.length>0&&(this._vChartPlugin=new GD(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_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,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=RI.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){this._renderState=RI.render,this.getStage().eventSystem.resumeTriggerEvent()}}YD.InstanceManager=QR,YD.ThemeManager=tO,YD.globalConfig={uniqueTooltip:!0},YD.Utils=AD,YD.vglobal=k_;zR.registerRegion("region",QI),zR.registerLayout("base",lD),Jk(),zk(),zR.registerMark(SD.type,SD),zR.registerStageEventPlugin("gesture",Eb),ND(),WD(),XR(IR.name,IR);const $D="monotone",XD="linear",KD="bevel";function qD(t,e){return e("component",t)}function ZD(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=zR.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));const JD=(t,e,i,s)=>{if(u(t[e]))return;const n=y(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},QD=(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)))},tF=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},eF=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):m(t)&&p(t.field)?L(e,t.field):t,s){const{formatFunc:i,args:r}=ZD(void 0,s,t,e);i&&r&&(n=i(...r))}return n},iF=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const sF=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(y(e.activeType)?e.activeType.includes(t):e.activeType===t)));function nF(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=u(i.key)&&u(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:d,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:_}=l,y=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=aF(eF(h,r,a,c),d,g),o.value=aF(eF(f,r,a,m),v,_),Object.keys(y).forEach((t=>{o[t]=eF(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};y(i)?i.forEach((t=>{o(t)})):o(i)}function rF(t,e,i,s,n,r,a){if(d(e)){nF(t,e(n,a),i,s,r,a)}else e&&nF(t,e,i,s,r,a)}const aF=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=mi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class oF{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},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.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{y(t)?t.forEach((t=>{rF(a,t,e,i,s,n,r)})):d(t)?rF(a,t,e,i,s,n,r):t&&nF(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=d(e)?e(s,n):e;if(r?u(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){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}(s),e={visible:eF(r.visible,t,n),value:aF(eF(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:eF(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=eF(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&sF(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const lF={min:t=>t.length?K(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?K(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}},hF=(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=IO([],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 cF(a,n,o)},cF=(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&&t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{Zy(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=>{Zy(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&&!0===o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=lF[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},dF=(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=>{Zy(t[e])||(t[e]=0)}))})),t},uF=`${lO}_HIERARCHY_DEPTH`,pF=`${lO}_HIERARCHY_ROOT`,gF=`${lO}_HIERARCHY_ROOT_INDEX`;function fF(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function mF(t,e,i){t&&(i.needDefaultSeriesField&&(t[gO]=i.defaultSeriesField),t[uO]=e,t[pO]=i.getKey(t,e,i))}function vF(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function _F(t,e,i,s=0,n,r){void 0===r&&(r=e),mF(t,e,i),t[uF]=s,t[pF]=n||t[i.categoryField],t[gF]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>_F(e,s,i,t[uF]+1,t[pF],r)))}const yF={label:{name:"label",type:"text"}},bF=`${lO}_rect_x`,xF=`${lO}_rect_x1`,SF=`${lO}_rect_y`,AF=`${lO}_rect_y1`,kF={data:!0},MF={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},TF=[...Object.keys(ED),"normal"];function wF(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 LF(n)&&delete n.type,n.oneByOne&&(n=EF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:BF,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=FR({},o[e],a);return LF(n)&&delete n.type,n.oneByOne&&(n=EF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:BF,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function CF(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=I(t,null,i),RF(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}),i),t}(h,i)}function EF(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.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function BF(t,e){var i;return null!==(i=null==t?void 0:t[uO])&&void 0!==i?i:e.context.graphicIndex}function PF(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 LF(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function RF(t,e,i=[]){if(y(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),RF(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),RF(t[s],e,i))}function OF(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class IF extends XI{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=nR(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=zR.getSeriesMarkMap(o)?function(t,e,i){const s=zR.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=FR({},i("mark",Y(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return FR({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;Y(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(d(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,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=FR({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>FR({},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 DF extends KI{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)}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:`${lO}_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(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=IF,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=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.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=OF(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),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)&&(cI(this._rawData.dataSet,"invalidTravel",dF),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;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=bI(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=yI(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=yI(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new fD(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=K(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=cF(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=j(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){cI(this._dataSet,"dimensionStatistics",hF);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new Pa(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&&IO(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){cI(this._dataSet,"dimensionStatistics",hF);const s=new Pa(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=IO(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&IO(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new Pa(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)&&(cI(this._rawData.dataSet,"addVChartProperty",tF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:fF.bind(this),call:mF}},!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,i;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.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(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:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=wF({},CF(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)}))),!u(t.dataId)||!u(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(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:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_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"}}:$y(s)||Xy(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=FR(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=FR(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=FD(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=FD(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=FD(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:gO;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:fO,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,fO,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.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()}initTooltip(){this._tooltipHelper=new oF(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||e.visible!==t[i].visible))?i.reMake=!0:!i.reCompile&&e.some(((e,i)=>!U(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!U(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},kF),MF),i),{extensionMark:!0,label:!0,totalLabel:!0});return this._compareExtensionMarksSpec(Y(t.extensionMark),Y(e.extensionMark),s),!s.reMake&&this._compareLabelSpec(Y(t.label),Y(e.label),s),!s.reMake&&this._compareLabelSpec(Y(t.totalLabel),Y(e.totalLabel),s),s.reMake?s:(!s.reCompile&&this._marks.getMarks().some((i=>{var s,n;return r[i.name]=!0,(null===(s=e[i.name])||void 0===s?void 0:s.visible)!==(null===(n=t[i.name])||void 0===n?void 0:n.visible)}))&&(s.reCompile=!0),!s.reCompile&&n.some((i=>MF[i]&&!U(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!U(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Pa||xI(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.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();OF(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),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:gO,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new fR).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return oR(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:gO}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:d={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:_=!1}=e,y=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:_,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(y)){const e=this.getSpec()||{};this._marks.addMark(y,{name:t.name}),v&&(this._seriesMark=y),u(f)?y.setData(this._data):!1!==f&&y.setDataView(f),y.setSkipBeforeLayouted(!1!==c),u(h)||y.setGroupKey(h);const l=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:null!==(s=i.morph)&&void 0!==s&&s,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(n=i.support3d)&&void 0!==n?n:e.support3d||!!e.zField,morphKey:(null===(r=e.morph)||void 0===r?void 0:r.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});y.setMarkConfig(l),this.initMarkStyleWithSpec(y,FR({},d,g||e[y.name]))}return y}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:pO}_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!==_O&&t!==bO&&t!==vO&&t!==yO||(t=this.getStackValueField()),null!==(e=FO(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>Zy(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:gO]}}function FF(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();NC(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 zF(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}}}DF.mark=yF,DF.transformerConstructor=IF;class jF extends DF{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);NC(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:`${lO}_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(_O),this.setFieldX2(vO)):(this.setFieldY(_O),this.setFieldY2(vO))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(bO),this.setFieldX2(yO)):(this.setFieldY(bO),this.setFieldY2(yO))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(SO),this.setFieldX2(xO)):(this.setFieldY(SO),this.setFieldY2(xO))}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)&&(FF("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)}}function HF(t){return"bottom"===t||"top"===t}function NF(t){return"left"===t||"right"===t}function VF(t){return"z"===t}function UF(t,e){return xR(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function WF(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function GF(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?HF(t)?"linear":"band":HF(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const YF=(t,e,i)=>{var s;const n=null!==(s="band"===e?qD("axisBand",i):["linear","log","symlog"].includes(e)?qD("axisLinear",i):{})&&void 0!==s?s:{},r=HF(t)?qD("axisX",i):NF(t)?qD("axisY",i):qD("axisZ",i);return FR({},qD("axis",i),n,r)};class $F{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:Vy)("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:Vy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;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)))),r=n.filter((t=>UC(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return HF(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class XF extends $F{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(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:nI.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const KF=(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))},qF=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},ZF=(t,e,i,s)=>{var n;const r=e.getScale(),a=UC(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=Y(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.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))})),o.push({series:h,datum:e,key:JF(h,s)})}else if(p(i[1])){const e=[],s=[];l.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 r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{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("_")}`,QF=(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};class tz extends $F{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!KF(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:nI.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:nI.canvas}),callback:this.onMouseOut}),$y(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:nI.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),$y(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var ez;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(ez||(ez={}));const iz={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class sz{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",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.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(iz.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),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:KD,curveType:XD,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===$D?"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){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(iz.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:PF(this._spec,iz.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new Pa(this._option.dataSet,{name:`${lO}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),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(ez.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[iz.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(ez.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,FR({},this._spec[iz.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.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=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},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.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const nz=Object.assign(Object.assign({},yF),iz),rz=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(y(t))return t.length===e.length&&t.every(((t,i)=>rz(t,e[i])));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]))},az=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class oz extends bD{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return az}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(u(o)||s.includes(a))return;r&&n.includes(a)&&(VC(null==o?void 0:o.type)||(null==o?void 0:o.scale)||d(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((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?rz(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n,r;const a=e.context.data,o=[],l=[],h={},c=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,d=c&&0===c.currentIndex;if(a.forEach(((e,i)=>{var s;l[i]={},o[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?l[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!c?o[i][s]=t[s](e):0!==i||c&&!d||(h[s]=t[s](e))})),l[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),c){const t=null!==(r=null===(n=e.attribute)||void 0===n?void 0:n.segments)&&void 0!==r?r:[];return t.push({points:l}),d?Object.assign(Object.assign({},h),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(o,l);if(t)return Object.assign(Object.assign(Object.assign({},h),o[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},h),o[0]),{points:l,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:UI.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[pO]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}class lz extends oz{constructor(){super(...arguments),this.type=lz.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)===iR.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}lz.type="line";const hz=()=>{zR.registerMark(lz.type,lz),Jk(),Vk(),EB(),kB(),DD(),zR.registerGraphicComponent("line",Lg)};class cz extends bD{constructor(){super(...arguments),this.type=cz.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="circle":a.symbolType=o,a}}cz.type="symbol";const dz=()=>{zR.registerMark(cz.type,cz),Jk(),tM(),kB(),zR.registerGraphicComponent("symbol",Eg)};class uz extends IF{_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)}}function pz(t){return t.length>=2&&k(t[0])&&k($(t))&&$(t)>=t[0]}function gz(t,e){var i;const s=$(e)-e[0],n=$(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=$(e)>0?$(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!k(o.min),extendable_max:!k(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):$(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function fz(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 mz(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 vz(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 _z(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 yz=(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=>t.type.includes("ticks"))))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)-p[0];if(0===g)return t;const f=c.domain(),m=$(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=ne(t,e),a=Math.max(ie(i),ie(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return IC(v)};class bz{constructor(t){this.id=qy(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class xz extends bz{constructor(){super(xz.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!NC(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&&pz(c)&&pz(d)))return;const u=gz(t,c),p=gz(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!mz(u,p))return}else if(0===y&&0===b){if(!mz(p,u))return}else if(_||A)if(_&&!A){if(!fz(u,p))return}else if(A&&!_){if(!fz(p,u))return}else{if(f===b)return;if(f>b){if(!vz(u,p))return}else if(!vz(p,u))return}else{if(0===f&&0===y){if(!_z(u,p))return}else if(0===b&&0===g&&!_z(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===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){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){cI(e.getOption().dataSet,"tickAlign",yz);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}xz.pluginType="component",xz.type="AxisSyncPlugin";const Sz={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function Az(t){let e=0;return L(t,"tick.visible")&&(e+=L(t,"tick.tickSize")),L(t,"label.visible")&&(e+=L(t,"label.space")),e}function kz(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 Mz(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const Tz=t=>"band"===t||"ordinal"===t||"point"===t;function wz(t,e){return{id:t,label:t,value:e,rawValue:t}}function Cz(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class Ez extends MD{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const Bz=`${lO}_ARC_TRANSFORM_VALUE`,Pz=`${lO}_ARC_RATIO`,Lz=`${lO}_ARC_START_ANGLE`,Rz=`${lO}_ARC_END_ANGLE`,Oz=`${lO}_ARC_K`,Iz=`${lO}_ARC_MIDDLE_ANGLE`,Dz=`${lO}_ARC_QUADRANT`,Fz=`${lO}_ARC_RADIAN`,zz=-Math.PI/2,jz=3*Math.PI/2,Hz=.6,Nz=(t,e,i,s)=>{const n=t();if(S(n))return n;if(d(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return ge(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},Vz=(t,e,i)=>{var s;const n=null!==(s="band"===e?qD("axisBand",i):"linear"===e?qD("axisLinear",i):{})&&void 0!==s?s:{},r=qD("angle"===t?"axisAngle":"axisRadius",i);return FR({},qD("axis",i),n,r)};function Uz(t,e,i,s){switch(t){case r.cartesianBandAxis:return YF(UF(i,["z"]),"band",e);case r.cartesianLinearAxis:return YF(UF(i,["z"]),"linear",e);case r.cartesianLogAxis:return YF(UF(i,["z"]),"log",e);case r.cartesianSymlogAxis:return YF(UF(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return YF(UF(i),void 0,e);case r.polarBandAxis:return Vz(i.orient,"band",e);case r.polarLinearAxis:return Vz(i.orient,"linear",e);case r.polarAxis:return Vz(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,trigger:c,triggerOff:d}=null!==(s=qD(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>HF(t.orient)));let g;g=p(u)?FR({},Tz(u.type)?a:o,l):l;const f=n.find((t=>NF(t.orient)));let m;return m=p(f)?FR({},UC(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(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,trigger:c,triggerOff:d}=null!==(s=qD(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>"angle"===t.orient));let g;g=p(u)?FR({},Tz(u.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?FR({},UC(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return Wz(i,qD(t,e));default:return qD(t,e)}}const Wz=(t,e)=>{var i;const s=FR({},e,e[WF(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class Gz extends XI{getTheme(t,e){return Uz(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({},wR(e)),{[s]:0}))}}class Yz extends ZI{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=Gz,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof jc||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:nI.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}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 Ez(this)}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)))}_getNeedClearVRenderComponents(){return[]}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=>!U(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&&(t.release(!0),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=>{e.compile({group:t,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}}getDatum(t){}}var $z,Xz;Yz.transformerConstructor=Gz,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}($z||($z={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(Xz||(Xz={}));class Kz extends bD{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}clearComponent(){this._component&&(this._component.parent&&this._component.parent.removeChild(this._component),this._component=null)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=zR.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(eI.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){super.release(),this.removeProduct()}}Kz.type="component";const qz=()=>{zR.registerMark(Kz.type,Kz)},Zz=t=>t;class Jz extends Yz{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._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,y,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?$z.circleAxis:$z.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?Xz.circleAxisGrid:Xz.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if((null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==L(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=wF(null===(h=zR.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(d=null!==(c=this._spec.animationAppear)&&void 0!==c?c:L(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==d?d:L(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(u=this._spec.animationDisappear)&&void 0!==u?u:L(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:L(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:L(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:L(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(_=null!==(v=this._spec.animationExit)&&void 0!==v?v:L(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==_?_:L(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(y=this._spec.animationUpdate)&&void 0!==y?y:L(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b:L(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()),e=new fD(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return qL(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=y(a)?NC(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!NC(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return qL(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=ZL(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()})),qL(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(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&U(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):qL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(qL(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_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=$O(s=t.domainLine)).startSymbol=$O(s.startSymbol),s.endSymbol=$O(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 qO(FR({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:qO(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>qO(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=qO(t[i]))})),e}(t.label.state)),d(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}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:d(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},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 qO(FR({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:qO(t.tick.style)),t.tick.state&&(i.tick.state=XO(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 qO(FR({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:qO(t.subTick.style)),t.subTick.state&&(i.subTick.state=XO(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=Sz[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?oe(p):null,textStyle:FR({},d,qO(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:qO(h.style)}),h.state&&(i.title.state.shape=XO(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:qO(o.style)}),o.state&&(i.title.state.background=XO(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=XO(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=qO(t.background.style)),t.background.state&&(i.panel.state=XO(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:aO(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 qO(FR({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:qO(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:aO(t.subGrid.alternateColor),style:qO(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=ZD(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){dI(this._option.dataSet,"scale",Zz);const i=this.registerTicksTransform();return new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,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)}getDatum(t){var e;return t&&t.name===vT.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}Jz.specKey="axes";const Qz=()=>{qz(),zR.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},tj=[xz];class ej extends Jz{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}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),qL(this._regions,(t=>{const e=this.getOrient();HF(e)?Cz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):NF(e)?Cz(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):VF(e)&&Cz(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&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._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=FR({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(FR({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=HF(this.getOrient()),n=t=>{var e;return(s?!HF(t.getOrient()):HF(t.getOrient()))&&NC(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())>=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,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=UF(i,["z"]),VF(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(!Mz(e))return null;const{axisType:t,componentName:s}=GF(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=>NF(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(!Mz(t))return;const{axisType:s,componentName:n}=GF(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=zR.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}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return HF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):VF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(tj.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){HF(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&&!HF(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!VF(this.getOrient())&&this._spec.innerOffset){const t=this._spec;NF(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=kR(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=kR(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=HF(this.getOrient())?t.fieldX:VF(this.getOrient())?t.fieldZ:t.fieldY,NC(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;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,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:NC(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 t;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(eI.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(HF(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._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=HF(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:K(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return qL(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]:HF(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:VF(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();qL(this._regions,(e=>{HF(t)?Cz(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):NF(t)?Cz(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):VF(t)&&Cz(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(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=HF(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=HF(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)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=FR(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new Ne).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=HF(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?_t(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):_t(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-$(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&u(null===(e=a.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=a.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 o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return wz(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:NC(this._scale.type)?i>=s[0]&&i<=$(s):s.includes(i)}))]:[]}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 i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}ej.type=r.cartesianAxis,ej.specKey="axes";const ij=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function sj(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,rj=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function aj(t,e,i="count"){const s=rj(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const oj=Math.sqrt(50),lj=Math.sqrt(10),hj=Math.sqrt(2);class cj{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){p(this._spec.nice)&&(this._nice=this._spec.nice),p(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=kz(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(i.forceTickCount))e=i.forceTickCount;else if(d(i.tickCount)){const t=this._scale.range();let s=Math.abs($(t)-t[0]);if(1===s&&this._option){s=HF(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=k(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return u(s)&&u(n)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&u(n)&&u(this._softMaxValue)?this._scale.niceMax(e):!(!u(s)||!u(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return u(e)&&u(i)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&u(i)&&u(this._softMaxValue)?this._scale.niceMax():!(!u(e)||!u(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=u(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(nj),e.sort(nj),{domain:sj(t,e),scope:aj(t,e,i)}}(r,zy(t),this._spec.breaks[0].scopeType);e=zy(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return 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);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}=kz(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs(K(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[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=oj?10:n>=lj?5:n>=hj?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max($(t),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)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}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)-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}_updateRawDomain(){const e=this.collectData(0,!0),i=this.computeLinearDomain(e);this._rawDomain=i,this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}const dj={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},uj={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}}},pj={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}}},gj={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}}};class fj extends ej{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new PE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}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)}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!VF(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=HF(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=SR(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=zy(this._break.scope).map((t=>i[0]+($(i)-i[0])*t))),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}registerTicksTransform(){const t=`${this.type}-ticks`;return cI(this._option.dataSet,t,HE),t}}fj.type=r.cartesianLinearAxis,fj.specKey="axes",fj.builtInTheme={axis:gj,axisLinear:dj,axisX:uj,axisY:pj},G(fj,cj);const mj=()=>{zR.registerGraphicComponent($z.lineAxis,((t,e)=>new CC(t,e))),zR.registerGraphicComponent(Xz.lineAxisGrid,((t,e)=>new zB(t,e))),Qz(),zR.registerComponent(fj.type,fj)};class vj{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new fD(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{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._spec.showAllGroupLayers?this._scales:[this._scales[0]]).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=wz(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=>wz(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const e=this._spec.domain;for(let t=0;tthis._rawDomainIndex[t][e]=i))}this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const _j={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}};class yj extends ej{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new cE}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}}registerTicksTransform(){const t=`${this.type}-ticks`;return cI(this._option.dataSet,t,GE),t}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=eE(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{zR.registerGraphicComponent($z.lineAxis,((t,e)=>new CC(t,e))),zR.registerGraphicComponent(Xz.lineAxisGrid,((t,e)=>new zB(t,e))),Qz(),zR.registerComponent(yj.type,yj,!1)};class xj extends fj{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),qL(this._regions,(t=>{HF(this.getOrient())?Cz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):Cz(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=FR({},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 Pa(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.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 fD(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=mi.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=>wz(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=>wz(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return cI(this._option.dataSet,t,HE),t}transformScaleDomain(){}}xj.type=r.cartesianTimeAxis,xj.specKey="axes",xj.builtInTheme={axis:gj,axisX:uj,axisY:pj};class Sj extends fj{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new IE}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return cI(this._option.dataSet,t,HE),t}transformScaleDomain(){}}Sj.type=r.cartesianLogAxis,Sj.specKey="axes",Sj.builtInTheme={axis:gj,axisLinear:dj,axisX:uj,axisY:pj},G(Sj,cj);class Aj extends fj{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new DE}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return cI(this._option.dataSet,t,HE),t}transformScaleDomain(){}}Aj.type=r.cartesianSymlogAxis,Aj.specKey="axes",Aj.builtInTheme={axis:gj,axisLinear:dj,axisX:uj,axisY:pj},G(Aj,cj);const kj=`${lO}_hide_`;function Mj(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const Tj=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[kj]&&(Mj(t,!0),t[kj]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=u(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[kj]=!0,Mj(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},wj=()=>{zR.registerGrammarTransform("symbolOverlap",{transform:Tj,runType:"afterEncode"})},Cj={min:K,max:X,average:GL,sum:WL};function Ej(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}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function Bj(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 Pj(t,e,i,s){return Bj(t,e,i,"min",s)}function Lj(t,e,i,s){return Bj(t,e,i,"max",s)}function Rj(t,e,i,s){return Bj(t,e,i,"average",s)}function Oj(t,e,i,s){return Bj(t,e,i,"sum",s)}const Ij=(t,e)=>{let i=d(t.size)?t.size():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=Ej;if("min"===n?l=Pj:"max"===n?l=Lj:"average"===n?l=Rj:"sum"===n&&(l=Oj),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[]},Dj=()=>{zR.registerGrammarTransform("dataSampling",{transform:Ij})};class Fj extends jF{constructor(){super(...arguments),this.type=iR.line,this.transformerConstructor=uz,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.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(wF(null===(i=zR.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),CF("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=zF(this);this._symbolMark.setAnimationConfig(wF(null===(s=zR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),CF("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),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]}}Fj.type=iR.line,Fj.mark=nz,Fj.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},Fj.transformerConstructor=uz,G(Fj,sz);class zj{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{xI(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof Pa)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];Ny(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];Ny(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class jj{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)=>{Jy(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{IO(e,[{key:t,operations:NC(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&&IO(e,[{key:i.field,operations:NC(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?vR("colorOrdinal"):vR(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(Jy(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),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(U(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;if(!U(r.specified,s.specified))return e.reMake=!0,e;s.range&&!U(s.range,n.range())&&(n.range(s.range),e.reRender=!0),Jy(s.domain)?e.reRender=!0:U(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(!Jy(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=NC(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=NC(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;NC(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(NC(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=NC(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(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)));NC(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 Hj{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&t.addState(i,!0,l):a&&t.addState(s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&t.addState(i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{t.removeState(i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&t.removeState(e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}class Nj extends $I{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){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=qy(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:hO,height:cO},this._viewRect={width:hO,height:cO},this._viewBox={x1:0,y1:0,x2:hO,y2:cO},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=wR(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new tI(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new zj(this._dataSet),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===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new Hj;const t=this.getAllSeries(),e=[],i={};t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=`${n}-${t.type}`;i[r]?s.forEach((t=>{i[r].marks.push(t)})):(i[r]=Object.assign(Object.assign({},t),{marks:s}),e.push(i[r]))}))}})),e.forEach((t=>{const e=zR.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(wF({},CF("stage",this._spec,{}),null))}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.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=H(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=zR.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({},i),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_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){const s=zR.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"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(){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e,this._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof KI)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 bD))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof bD)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}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&&xI(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=FI(this._spec,this._option,{width:hO,height:cO})),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),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=oR(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new jj(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){zI(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=oR(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0};return Object.keys(t).filter((t=>!e[t])).sort()}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=this._getSpecKeys(this._spec);if(!U(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{zI(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[r.title]:!0,[r.brush]:!0,[r.indicator]:!0};this._components.forEach((s=>{var n,a;if(s.type===r.label||s.type===r.totalLabel)return;i[s.type]&&(i[s.type]=!1);const o=s.specKey||s.type,l=null!==(n=this._spec[o])&&void 0!==n?n:{};y(l)?(e[o]=e[o]||{specCount:l.length,componentCount:0},e[o].componentCount++,zI(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):zI(t,s.updateSpec(l))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}const s=t=>t&&!1!==t.visible;Object.keys(i).forEach((e=>{if(i[e]){const i=this._spec[e];(y(i)?i.some(s):s(i))&&(t.reMake=!0)}}))}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];zI(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=MR(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.resetLayoutItemTag(),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(){this._backgroundMark&&this._backgroundMark.compile()}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._option.globalInstance),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,this._option.globalInstance)}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._option.globalInstance),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,this._option.globalInstance)}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._option.globalInstance),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,this._option.globalInstance)}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(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(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(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(eI.AFTER_MARK_RENDER_END,e)};this._event.on(eI.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?Y(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:JO;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||d(e.filter)&&e.filter(o,l))){if(ZO(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===ez.dimensionHover||s===ez.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=u(t)||!n||n.every((t=>UC(t.axis.getScale().type)&&u(t.index))),o=a||n.every((t=>UC(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(n))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(r.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(r.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),n=[];s.forEach((e=>{const i=t(e);!1!==i&&n.push({axis:e,value:i})})),i.showCrosshair(n)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const Vj=(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 Uj{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)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):DR(t,a,c.spec),DR(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));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=Vj(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=Vj(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,e,i){var s,n,r,a,o;const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,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},h=this.seriesType;return h&&(l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(zR.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(zR.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=zR.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=zR.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=zR.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.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):JD(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=JD(t,u.specKey,u.type))||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"];return 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}))}_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 Wj extends Uj{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_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;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{u(i[t])&&(i[t]=n[t])})),L(i,"trimPadding")&&FR(i,jI(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class Gj extends Wj{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),DI(t)}}const Yj=(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&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=zO(t,!0);for(const e in o)for(const i in o[e].nodes)VO(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)NO(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&HO(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}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 Xj{_beforeInit(){this._dataSet&&cI(this._dataSet,"stackSplit",Yj)}_initStack(){this._stack=new $j(this),this._stack.init()}}const Kj={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:ez.dimensionHover};class qj extends zD{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},Kj,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=JO(i);let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}qj.type="dimension-hover",qj.defaultOptions=Kj;const Zj=()=>{zR.registerInteractionTrigger(qj.type,qj)},Jj=()=>{zR.registerComposedEvent(ez.dimensionHover,tz),zR.registerComposedEvent(ez.dimensionClick,XF)},Qj=t=>t.fieldX[0],tH=t=>t.fieldY[0],eH=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},iH=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},sH=(t,e)=>t?e?Qj:eH:e?tH:iH,nH=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=QF(t,(t=>HF(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=QF(t,(t=>NF(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{UC(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((t=>{if(d.size>0){if(d.has(t)){const s=rH(t,i,sH(e,UC(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=rH(t,i,sH(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},rH=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:aH(t,s,i)},aH=(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=ZF(e,t,"cartesian",null!=i?i:HF(t.getOrient())?Qj:tH);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},oH=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:u,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,_=0,y=null;if(d.size){const t=Array.from(d.values())[0];_=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,y=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(_)&&!Number.isNaN(_),x=s&&!b&&p(u),S=x?u:{coordRange:[0,0],sizeRange:[0,0],coord:_,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:y};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(UC(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(NC(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,_=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=Az(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(a=y.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&y&&null!==(o=y.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(l=y.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&y&&null!==(h=y.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(c=y.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&y&&null!==(d=y.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(u=y.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&y&&null!==(p=y.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};hH(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=_+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=_+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&lH(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),lH=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=ZD(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},hH=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},cH=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=dH(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},dH=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},uH=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return oH(c,r,e),c.xField.cacheInfo?cH(c.xField):c.yField.cacheInfo?cH(c.yField):void 0},pH=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],gH=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&pH.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(fH(s).every((t=>{var e;return!sF("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},fH=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},mH={dom:`${lO}_TOOLTIP_HANDLER_DOM`,canvas:`${lO}_TOOLTIP_HANDLER_CANVAS`},vH={key:"其他",value:"..."};var _H;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(_H||(_H={}));class yH{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(u(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,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:h,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}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:d,model:g}=e;if(!d||!this._cacheActiveSpec){const d=this.component.getSpec();if(this._cacheActiveSpec=gH(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){u(this._cacheActiveSpec.handler)&&p(d.handler)&&(this._cacheActiveSpec.handler=d.handler);const g=null!==(i=d[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},vH),t):vH;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!u(e)&&sF(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class bH extends yH{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)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],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(!UC(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(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}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const xH=()=>{zR.registerTooltipProcessor("dimension",bH)};class SH extends yH{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,Ko.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(JO(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const AH=()=>{zR.registerTooltipProcessor("mark",SH)};class kH extends yH{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:Y(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?Y(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_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 MH=()=>{zR.registerTooltipProcessor("group",kH)};class TH extends Nj{constructor(){super(...arguments),this.transformerConstructor=Gj,this.type="line",this.seriesType=iR.line}_setModelOption(){this._modelOption.getDimensionInfo=nH,this._modelOption.getDimensionInfoByValue=aH,this._modelOption.getRectByDimensionData=uH}}TH.type="line",TH.seriesType=iR.line,TH.transformerConstructor=Gj,G(TH,Xj);const wH=[...az,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class CH extends oz{constructor(){super(...arguments),this.type=CH.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return wH}_getIgnoreAttributes(){return[]}}CH.type="area";const EH=()=>{zR.registerMark(CH.type,CH),Jk(),Lk(),EB(),kB(),DD(),zR.registerGraphicComponent("area",nf)};class BH extends oF{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 PH=Object.assign(Object.assign(Object.assign({},yF),iz),{area:{name:"area",type:"area"}}),LH=()=>{zR.registerAnimation("area",OD),ID(),LD()};class RH extends uz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!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,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_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,f=h;("line"===c||u&&!d)&&(g=h,f=l),l.style=FR({},f.style,g.style),l.state=FR({},f.state,g.state),!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),t.area=l,t.line=h}}class OH extends jF{constructor(){super(...arguments),this.type=iR.area,this.transformerConstructor=RH,this._sortDataByAxis=!1}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(OH.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}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===$D?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return _R(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),y1: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),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return _R(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:!!e&&this.getColorAttribute(),stroke:!!i&&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.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[_O]},"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(wF(null===(e=zR.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),CF("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(wF(null===(i=zR.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),CF("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=zF(this);this._symbolMark.setAnimationConfig(wF(null===(s=zR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),CF("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new BH(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.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(){super.onLayoutEnd(),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}}}OH.type=iR.area,OH.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},OH.mark=PH,OH.transformerConstructor=RH,G(OH,sz);class IH extends Wj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),DI(t)}}class DH extends Nj{constructor(){super(...arguments),this.transformerConstructor=IH,this.type="area",this.seriesType=iR.area}_setModelOption(){this._modelOption.getDimensionInfo=nH,this._modelOption.getDimensionInfoByValue=aH,this._modelOption.getRectByDimensionData=uH}}DH.type="area",DH.seriesType=iR.area,DH.transformerConstructor=IH,G(DH,Xj);function FH(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 zH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:FH(t,e)}),jH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:FH(t,e)}),HH={type:"fadeIn"},NH={type:"growCenterIn"};function VH(t,e){if(!1===e)return{};switch(e){case"fadeIn":return HH;case"scaleIn":return NH;default:return zH(t)}}class UH extends bD{constructor(){super(...arguments),this.type=UH.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}UH.type="rect";const WH=()=>{Jk(),Xk(),xB("rect",TB),zR.registerMark(UH.type,UH),pw.registerBuiltInAnimate("growHeightIn",rC),pw.registerBuiltInAnimate("growHeightOut",aC),pw.registerBuiltInAnimate("growWidthIn",SC),pw.registerBuiltInAnimate("growWidthOut",AC),pw.registerBuiltInAnimate("growCenterIn",iC),pw.registerBuiltInAnimate("growCenterOut",sC),zR.registerGraphicComponent("rect",Dg)},GH=Object.assign(Object.assign({},yF),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function YH(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;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=ER(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[bF]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):_R(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[xF]):_R(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=_R(this._dataToPosX(t),e,i),n=_R(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[SF]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):_R(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[AF]):_R(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=_R(this._dataToPosY(t),e,i),n=_R(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},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(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},KH.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:PF(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(KH.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}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(cI(this._option.dataSet,"addVChartProperty",tF),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};cI(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new Pa(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:fF.bind(this),call:mF}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new fD(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=AF,s=SF,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=xF,s=bF,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=zO(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)YH(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=_R(this[r](t),l,i),u=_R(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!yR(t[this.getStackValueField()],l)?p=0:pthis._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.setMarkConfig({clip:!0,clipPath:()=>{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[vO],n=t[_O],r=t[yO],h=t[bO];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]),{[vO]:i,[_O]:s}),a?{[yO]:o,[bO]:l}:void 0),c="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)};t.push(Dg(Object.assign(Object.assign({},c),{cornerRadius:d(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(c,h,this._markAttributeContext):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=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>_R(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},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=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>_R(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),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;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=K(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=zF(this);this._barMark.setAnimationConfig(wF(null===(e=zR.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),CF(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=p(this._spec.barWidth)&&r===n,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=a;return o&&(c=ER(this._spec.barWidth,a)),l&&(c=Math.max(c,ER(this._spec.barMinWidth,a))),h&&(c=Math.min(c,ER(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=u(i)?f:Math.min(f,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,m-1))&&void 0!==r?r:6,_=m===f?this._barMark.getAttribute(c,e):v;if(m>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=ER(null!==(l=i[r-1])&&void 0!==l?l:$(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=NC(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(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}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}}KH.type=iR.bar,KH.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},KH.mark=GH,KH.transformerConstructor=XH;const qH=()=>{Dj(),WH(),zR.registerAnimation("bar",((t,e)=>({appear:VH(t,e),enter:zH(t,!1),exit:jH(t,!1),disappear:{duration:ED.disappear.duration}}))),bj(),mj(),zR.registerSeries(KH.type,KH)};class ZH extends Wj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),DI(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 JH extends Nj{constructor(){super(...arguments),this.transformerConstructor=ZH,this.type="bar",this.seriesType=iR.bar}_setModelOption(){this._modelOption.getDimensionInfo=nH,this._modelOption.getDimensionInfoByValue=aH,this._modelOption.getRectByDimensionData=uH}}JH.type="bar",JH.seriesType=iR.bar,JH.transformerConstructor=ZH,G(JH,Xj);const QH=[10,20],tN=jC.Linear,eN="circle",iN=jC.Ordinal,sN=["circle","square","triangle","diamond","star"],nN=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},rN=Object.assign(Object.assign({},yF),{point:{name:"point",type:"symbol"}});class aN extends IF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class oN extends jF{constructor(){super(...arguments),this.type=iR.scatter,this.transformerConstructor=aN,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=`${lO}_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=`${lO}_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:tN,defaultRange:QH},"size")}getShapeAttribute(t,e){return u(e)?eN:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:iN,defaultRange:sN},"shape")}initMark(){this._symbolMark=this._createMark(oN.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:PF(this._spec,oN.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=zF(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(wF(null===(i=zR.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),CF("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:eN},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{if(!t)return;const e=t.getGraphics();e&&e.length&&e.forEach(((t,e)=>{var i,s;const n=null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],r=this.dataToPosition(n);r&&t&&t.translateTo(r.x,r.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){this.handleZoom(t)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}oN.type=iR.scatter,oN.mark=rN,oN.builtInTheme={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"}}}}},oN.transformerConstructor=aN;const lN=()=>{dz(),zR.registerAnimation("scatter",((t,e)=>Object.assign({appear:nN(0,e)},BD))),bj(),mj(),zR.registerSeries(oN.type,oN)};class hN extends Wj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class cN extends Nj{constructor(){super(...arguments),this.transformerConstructor=hN,this.type="scatter",this.seriesType=iR.scatter}_setModelOption(){this._modelOption.getDimensionInfo=nH,this._modelOption.getDimensionInfoByValue=aH,this._modelOption.getRectByDimensionData=uH}}cN.type="scatter",cN.seriesType=iR.scatter,cN.transformerConstructor=hN,G(cN,Xj);class dN extends DF{constructor(){super(...arguments),this.type=iR.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=`${lO}_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 uN=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[uO]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[OO]=e.nameMap[n]:t[OO]=n})),t.features);class pN extends oF{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 gN extends bD{constructor(){super(...arguments),this.type=gN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}gN.type="path";const fN=()=>{zR.registerMark(gN.type,gN),Jk(),Wk(),zR.registerGraphicComponent("path",tf)},mN=Object.assign(Object.assign({},yF),{area:{name:"area",type:"path"}});class vN{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Ia(i,e):Ra[i]?(La[i]||(La[i]=Ia(i,Ra[i])),La[i]):null}(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 _N{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(){}}class yN{constructor(){this._lastScale=0}clearZoom(){this._lastScale=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 bN(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:_N}:$y(e)||Xy(e)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:yN}:null}const xN={debounce:St,throttle:At};class SN{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=$y(this._renderMode)||Xy(this._renderMode),bN(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return bN(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(u(r))return;if(!ke({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{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(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:rI.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:rI.chart,consume:!1}];l.on(...c,xN[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,xN[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||bN(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||bN(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:ke({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:rI.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:rI.chart,consume:!1}];l.on(...c,xN[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,xN[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){bN(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||bN(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(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:rI.chart},(t=>{if(!t.event)return;const{event:n}=t;ke({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:rI.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||bN(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:rI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||bN(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:rI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:rI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:rI.chart,source:nI.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:rI.chart,source:nI.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=xN[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=xN[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:rI.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:rI.chart,source:nI.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:rI.chart,source:nI.chart},this._handleDragMouseUp)}))}}function AN(t,e){return`${lO}_${e}_${t}`}class kN extends Yz{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:AN(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;const l=p(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,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,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):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,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=FR(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var e,i,s;this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:n}=this._spec;if(n){let t=!0,r=!0,a=!1;!0!==n&&(t=null===(e=n.zoom)||void 0===e||e,r=null===(i=n.drag)||void 0===i||i,a=null!==(s=n.blank)&&void 0!==s&&s),t&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!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 vN(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===iR.map||e.type===iR.pictogram?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(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),qL(this._regions,(t=>{var e;if(t.type===iR.map||t.type===iR.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new We})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==iR.map&&e.type!==iR.pictogram||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[OO],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!U(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}kN.type=r.geoCoordinate,G(kN,SN);const MN=()=>{zR.registerComponent(kN.type,kN)};class TN extends IF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class wN extends dN{constructor(){super(...arguments),this.type=iR.map,this.transformerConstructor=TN,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 !`),uI.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var e,i;super.initData(),cI(this._dataSet,"copyDataView",_I),cI(this._dataSet,"map",uN),cI(this._dataSet,"lookup",QD);const s=uI.get(this.map);s||null===(e=this._option)||void 0===e||e.onError("no valid map data found!");const n=new Pa(this._dataSet,{name:`map_${this.id}_data`});n.parse([s],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:t.TransformLevel.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:OO,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",n.reRunAllTransform),this._mapViewData=new fD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(wN.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:PF(this._spec,wN.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}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:gO])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:gO]):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(wF(null===(t=zR.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),CF("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new pN(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[uO]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[uO],{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;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new We}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new We}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}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 uO}getActiveMarks(){return[this._pathMark]}}wN.type=iR.map,wN.mark=mN,wN.builtInTheme={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"}}}}},wN.transformerConstructor=TN;const CN=`${lO}_waterfall_default_seriesField`,EN=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n,calculationMode:r}=e,a=[],{dimensionValues:o,dimensionData:l}=n().latestData;let h=Array.from(o[i]);"decrease"===r&&(h=h.reverse());let c={start:0,end:0,positive:0,negative:0,lastIndex:null};return h.forEach(((t,i)=>{const n={start:c.end,end:c.end,lastIndex:c.lastIndex,lastEnd:c.end,index:t,isTotal:!1,positive:c.end,negative:c.end},r=!0===e.stackInverse?l[t].reverse():l[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[MO]=!0:delete t[MO]})),r.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===h.length-1)return!0;return!1};if(r.some((t=>o(t))))return c=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,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=BN([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 f=g[0];let{start:m,end:v}=PN(f,i,s,n,u);i.start=m,i.end=v;let _=m,y=m,b=v-m;const x=p.reduce(((t,e)=>ne(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=se(_,e)):(t[c]=+y,y=se(y,e)),t[d]=se(t[c],e),m=se(m,e),b=ne(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,n,a,c,h,i,e,o),void a.push(n)}c=BN(r,t,n,a,c,h,i,e),a.push(n)})),a};function BN(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}=PN(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=se(i.positive,e)):(t[h]=+i.negative,i.negative=se(i.negative,e)),t[c]=se(t[h],e),i.end=se(i.end,e)}i.isTotal=e,(u(p)||p===CN)&&(t[CN]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function PN(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?Ny("total.collectCountField error"):n=e[a].start;o<0?Ny("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=se(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 LN=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>se(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?t.unshift(o):t.push(o),t},RN={type:"fadeIn"},ON={type:"growCenterIn"};function IN(t,e){switch(e){case"fadeIn":return RN;case"scaleIn":return ON;default:return zH(t,!1)}}class DN extends bD{constructor(){super(...arguments),this.type=DN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(t,i,s){const n=super._transformGraphicAttributes(t,i,s),{x:r,x1:a,y:o,y1:l}=n,h=e(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return Lg(t)}}DN.type="rule";const FN=()=>{zR.registerMark(DN.type,DN),Jk(),Vk(),zR.registerGraphicComponent("line",Lg)},zN=Object.assign(Object.assign({},GH),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),jN=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:HN(t.map((t=>t.latestData)).flat(),e.fields,i)}};function HN(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)=>HN(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class NN{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 Pa(e instanceof Ba?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),cI(e,"dimensionTree",jN),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 VN extends XH{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const UN={rect:KN,symbol:$N,arc:ZN,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=$N(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:JN,line:QN,area:QN,rect3d:KN,arc3d:ZN,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function WN(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=UN[t])&&void 0!==i?i:UN.point;return e.series.type===iR.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=YN(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;_(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!_(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:tV(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function GN(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==iR.sankey){const{formatFunc:t,args:n}=ZD(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function YN(t){return d(t)?e=>t(e.data):t}function $N(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=YN(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:XN(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function XN(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function KN(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=YN(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;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:qN(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function qN(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 ZN(t){var e;const{labelSpec:i}=t,s=null!==(e=YN(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 JN(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=GN(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),Tg(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 QN(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}))):[{index:0,[gO]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function tV(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class eV extends KH{constructor(){super(...arguments),this.type=iR.waterfall,this.transformerConstructor=VN,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&HO(t,e)}}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 NN(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=CN)}getSeriesKeys(){return this._seriesField===CN?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t,e,i;super.initData(),cI(this._dataSet,"waterfallFillTotal",LN),cI(this._dataSet,"waterfall",EN),(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,calculationMode:null!==(e=this._spec.calculationMode)&&void 0!==e?e:"increase",stackInverse:this.getRegion().getStackInverse()}},!1));const s=yI(this.getViewData(),this._dataSet,{name:`${lO}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",s.reRunAllTransform),this._totalData=new fD(this._option,s),s.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:vO,endAs:_O,total:this._spec.total,calculationMode:null!==(i=this._spec.calculationMode)&&void 0!==i?i:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}},!1),s.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}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=zF(this);this._barMark.setAnimationConfig(wF(null===(i=zR.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),CF("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(wF(null===(s=zR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),CF("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(){super.initMark();const t=this._createMark(eV.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:ne(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:ne(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return JN(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?_R(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):_R(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle();const e="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),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",e?0:1):0,y1:t=>this.totalPositionY(t,"index",e?1:0)},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",e?0:1):0,x1:t=>this.totalPositionX(t,"index",e?1:0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}isVisibleLeaderLine(t){return!u(t.lastIndex)&&yR([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}eV.type=iR.waterfall,eV.mark=zN,eV.builtInTheme={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}}}},eV.transformerConstructor=VN;const iV=()=>{FN(),WH(),zR.registerAnimation("waterfall",((t,e)=>({appear:IN(t,e),enter:zH(t,!1),exit:jH(t,!1),disappear:{duration:ED.disappear.duration}}))),RD(),bj(),mj(),zR.registerSeries(eV.type,eV)},sV=`${lO}_BOX_PLOT_OUTLIER_VALUE`;var nV;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(nV||(nV={}));const rV=(t,e)=>{const i=[],{outliersField:s,dimensionField:n,seriesField:r}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];y(e)||(e=[e]),i.push(...e.map((e=>{const i={[sV]:e};return n.forEach((e=>{i[e]=t[e]})),p(r)&&(i[r]=t[r]),i})))})),i};class aV extends oF{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===nV.OUTLIER)return this.series.getOutliersField();if(t===nV.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case nV.MIN:return this.series.getMinField();case nV.MAX:return this.series.getMaxField();case nV.MEDIAN:return this.series.getMedianField();case nV.Q1:return this.series.getQ1Field();case nV.Q3:return this.series.getQ3Field();case nV.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===nV.OUTLIER)return e[sV];if(t===nV.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case nV.MIN:return e[this.series.getMinField()];case nV.MAX:return e[this.series.getMaxField()];case nV.MEDIAN:return e[this.series.getMedianField()];case nV.Q1:return e[this.series.getQ1Field()];case nV.Q3:return e[this.series.getQ3Field()];case nV.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,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>p(t[sV])}getDefaultContentList(t){return[{key:this.getContentKey(nV.OUTLIER),value:this.getContentValue(nV.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(nV.MAX),value:this.getContentValue(nV.MAX)},{key:this.getContentKey(nV.Q3),value:this.getContentValue(nV.Q3)},{key:this.getContentKey(nV.MEDIAN),value:this.getContentValue(nV.MEDIAN)},{key:this.getContentKey(nV.Q1),value:this.getContentValue(nV.Q1)},{key:this.getContentKey(nV.MIN),value:this.getContentValue(nV.MIN)},{key:this.getContentKey(nV.SERIES_FIELD),value:this.getContentValue(nV.SERIES_FIELD)}]}}class oV extends bD{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==UI.enter&&t.context.diffState!==UI.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;return this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?j(r,i):i}})),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=zg(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=zR.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const lV=()=>{zR.registerGraphicComponent("glyph",zg),Jk(),Dk()},hV=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],cV=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class dV extends oV{constructor(){super(...arguments),this.type=dV.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=hV,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=cV,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}dV.type="boxPlot";const uV=Object.assign(Object.assign({},yF),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),pV=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},gV=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},fV=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),mV=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,M;if(i&&k(i.center))return i.center;let T,w,C,E,B;if("horizontal"===e){T=null===(r=null===(n=(null===(s=fV(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,w=null===(h=null===(l=null===(o=null===(a=fV(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,C=null===(p=null===(u=null===(d=null===(c=fV(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=fV(t,"box").attribute.width,i=fV(t,"box").attribute.x;E=i,B=i+e}else{T=null===(m=null===(f=(null===(g=fV(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,w=null===(b=null===(y=null===(_=null===(v=fV(t,"max"))||void 0===v?void 0:v.attribute)||void 0===_?void 0:_.points)||void 0===y?void 0:y[0])||void 0===b?void 0:b.y,C=null===(M=null===(A=null===(S=null===(x=fV(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===M?void 0:M.y;const e=fV(t,"box").attribute.height,i=fV(t,"box").attribute.y;E=i,B=i+e}return k(T)?T:k(E)&&k(B)?(E+B)/2:k(w)&&k(C)?(w+C)/2:k(C)?C:k(w)?w:NaN},vV=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,_,y,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=fV(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=fV(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=fV(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;y=i,_=i+e;const c=(null===(l=fV(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=fV(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=fV(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=fV(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=fV(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;y=i,_=i+e;const s=(null===(f=fV(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=fV(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(_)&&k(y)?(_+y)/2:k(y)?y:k(_)?_:NaN};class _V extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return pV(mV)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class yV extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return gV(mV)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class bV extends _V{computeAttribute(){return pV(vV)(this.target,this.params,this.params.options)}}class xV extends yV{computeAttribute(){return gV(vV)(this.target,this.params,this.params.options)}}class SV extends IF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}class AV extends jF{constructor(){super(...arguments),this.type=iR.boxPlot,this.transformerConstructor=SV,this._bandPosition=0}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,r,a;super.setAttrFromSpec();const o=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=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(AV.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(AV.mark.outlier,{key:uO,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var e,i,s,n,r,a;const o=this._boxPlotMark;if(o){const s={lineWidth:this._lineWidth,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"!==this._shaftShape?"#000":this.getColorAttribute()};o.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const n="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return ER(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return ER(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return ER(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return ER(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return ER(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return ER(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return ER(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return ER(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(o,s,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(o,n,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Built_In)}const l=this._outlierMark;l&&this.setMarkStyle(l,{fill:null!==(r=null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this._boxFillColor)&&void 0!==r?r:this.getColorAttribute(),stroke:this.getColorAttribute(),size:S(null===(a=this._outliersStyle)||void 0===a?void 0:a.size)?this._outliersStyle.size:10},t.STATE_VALUE_ENUM.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=>_R(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>_R(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>_R(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>_R(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>_R(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},t.STATE_VALUE_ENUM.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:t=>this._getPosition(this.direction,t),x:t=>_R(e(this.getDatumPositionValues(t,sV),{bandPosition:this._bandPosition}),s)}:{x:t=>this._getPosition(this.direction,t),y:t=>_R(e(this.getDatumPositionValues(t,sV),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;cI(this._dataSet,"foldOutlierData",rV),cI(this._dataSet,"addVChartProperty",tF);const t=new Pa(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${lO}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField}}),t.transform({type:"addVChartProperty",options:{beforeCall:fF.bind(this),call:mF}},!1),this._outlierData=new fD(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t;if(this._autoBoxWidth)return this._autoBoxWidth;const e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,i=this._groups?this._groups.fields.length:1,s=null===(t=e.getBandwidth)||void 0===t?void 0:t.call(e,i-1);let n=s;return p(this._spec.boxWidth)&&(n=ER(this._spec.boxWidth,s)),p(this._spec.boxMinWidth)&&(n=Math.max(n,ER(this._spec.boxMinWidth,s))),p(this._spec.boxMaxWidth)&&(n=Math.min(n,ER(this._spec.boxMaxWidth,s))),this._autoBoxWidth=n,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r;let a,o,l;"horizontal"===t?(a=this.getYAxisHelper(),o="boxHeight",l=this.dataToPositionY.bind(this)):(a=this.getXAxisHelper(),o="boxWidth",l=this.dataToPositionX.bind(this));const h=a.getScale(0),c=this._groups?this._groups.fields.length:1,d=null===(i=a.getBandwidth)||void 0===i?void 0:i.call(a,c-1),u=this._boxPlotMark.getAttribute(o,e);if(c>1&&p(this._spec.boxGapInGroup)){const t=this._groups.fields,i=Y(this._spec.boxGapInGroup);let o=0,l=0;for(let h=t.length-1;h>=1;h--){const c=t[h],p=null!==(n=null===(s=a.getScale(h))||void 0===s?void 0:s.domain())&&void 0!==n?n:[],g=p.length,f=ER(null!==(r=i[h-1])&&void 0!==r?r:$(i),d),m=p.indexOf(e[c]);h===t.length-1?(o+=g*u+(g-1)*f,l+=m*(u+f)):(l+=m*(o+f),o+=o+(g-1)*f)}return h.scale(e[t[0]])+a.getBandwidth(0)/2-o/2+l+u/2}const g=NC(h.type||"band");return l(e)+.5*d+(g?-d/2:0)}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=j({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=zF(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=zR.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(CF("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(wF(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(wF(null===(a=zR.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new aV(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}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}AV.type=iR.boxPlot,AV.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},AV.mark=uV,AV.transformerConstructor=SV;const kV=()=>{lV(),Vk(),Xk(),zR.registerGraphicComponent("line",(t=>Lg(t))),zR.registerGraphicComponent("rect",(t=>Dg(t))),zR.registerMark(dV.type,dV),dz(),LD(),bj(),mj(),pw.registerBuiltInAnimate("boxplotScaleIn",_V),pw.registerBuiltInAnimate("boxplotScaleOut",yV),pw.registerBuiltInAnimate("barBoxplotScaleIn",bV),pw.registerBuiltInAnimate("barBoxplotScaleOut",xV),zR.registerSeries(AV.type,AV)};class MV extends bD{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=MV.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?Zg(t):Tg(t)}}MV.type="text";const TV=()=>{zR.registerMark(MV.type,MV),Jk(),iM(),qk(),zR.registerGraphicComponent("text",Tg),zR.registerGraphicComponent("richtext",Zg)};class wV extends oF{constructor(){super(...arguments),this._getMeasureData=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]]}}const CV=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),EV={type:"fadeIn"},BV=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function PV(t,e){return"fadeIn"===e?EV:CV(t)}const LV=Object.assign(Object.assign({},GH),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class RV extends XH{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 OV extends KH{constructor(){super(...arguments),this.type=iR.rangeColumn,this._barMarkType="rect",this._barName=iR.bar,this.transformerConstructor=RV}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(OV.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:PF(this._spec,OV.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(OV.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(OV.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(e,i,s,n){var r,a,o,l;if(e){this.setMarkStyle(e,{fill:null!==(a=null===(r=null==i?void 0:i.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[s]]:t[this._spec.yField[s]];return(null==i?void 0:i.formatMethod)?i.formatMethod(e,t):e}});!function(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)}(this,e,null!==(o=null==i?void 0:i.position)&&void 0!==o?o:n,null!==(l=null==i?void 0:i.offset)&&void 0!==l?l:"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=zF(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(wF(null===(i=zR.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),CF("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(wF(null===(s=zR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),CF("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(wF(null===(n=zR.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),CF("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new wV(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)}}OV.type=iR.rangeColumn,OV.mark=LV,OV.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},OV.transformerConstructor=RV;const IV=()=>{WH(),TV(),zR.registerAnimation("rangeColumn",((t,e)=>({appear:PV(t,e),enter:CV(t),exit:BV(t),disappear:{duration:ED.disappear.duration}}))),RD(),bj(),mj(),zR.registerSeries(OV.type,OV)};var DV,FV;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(DV||(DV={})),function(t){t.middle="middle",t.start="start",t.end="end"}(FV||(FV={}));class zV extends oF{constructor(){super(...arguments),this._getMeasureData=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]]}}const jV=Object.assign({},PH);class HV extends OH{constructor(){super(...arguments),this.type=iR.rangeArea}initMark(){this._areaMark=this._createMark(HV.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}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 zV(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}HV.type=iR.rangeArea,HV.mark=jV;class NV extends DF{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=Hz,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.radiusAxisHelper.dataToPosition(Y(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(Y(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}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:[]};NC(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:[]};NC(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)&&FF(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}}function VV(t){return Zy(t)?Number.parseFloat(t):0}const UV=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&WV(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=fe(e+a/2)};let _=0,y=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,M=0;const T=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))}(x);if(m.forEach(((t,e)=>{const i=t[Bz],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/M;A=p,m.forEach((e=>{const i=e[r]===f?f:e[Bz]*t;v(e,A,i),A+=i}))}if(0!==_&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},WV=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===VV(t[e])))||!i&&0===t.reduce(((t,i)=>t+VV(i[e])),0)));function GV(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const YV=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:GV(t,!0,AI.appear)}),$V={type:"fadeIn"},XV=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:GV(t,!0,AI.enter)}),KV=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:GV(t,!0,AI.exit)});function qV(t,e){if(!1===e)return{};switch(e){case"fadeIn":return $V;case"growRadius":return YV(Object.assign(Object.assign({},t),{growField:"radius"}));default:return YV(Object.assign(Object.assign({},t),{growField:"angle"}))}}class ZV extends bD{constructor(t,e){super(t,e),this.type=JV.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>ce({x:0,y:0},this.getAttribute("centerOffset",e,i),e[Iz])[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 JV extends ZV{constructor(){super(...arguments),this.type=JV.type}}JV.type="arc";const QV=()=>{Jk(),Bk(),xB("arc",LB),pw.registerBuiltInAnimate("growRadiusIn",yC),pw.registerBuiltInAnimate("growRadiusOut",bC),pw.registerBuiltInAnimate("growAngleIn",tC),pw.registerBuiltInAnimate("growAngleOut",eC),zR.registerGraphicComponent("arc",of),zR.registerMark(JV.type,JV)},tU=Object.assign(Object.assign({},yF),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class eU extends IF{_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=FR({},this._theme,i,t);const n=(t,e)=>FR({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);y(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const iU=`${lO}_LABEL_VISIBLE`;class sU extends NV{constructor(){super(...arguments),this.transformerConstructor=eU,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:kR(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:kR(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=zz,this._endAngle=jz,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[Iz];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return ce(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;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 a=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)?oe(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?oe(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?oe(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=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;cI(this._dataSet,"pie",UV),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?oe(this._spec.minAngle):0,asStartAngle:Lz,asEndAngle:Rz,asRatio:Pz,asMiddleAngle:Iz,asRadian:Fz,asQuadrant:Dz,asK:Oz,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new Pa(this._dataSet,{name:`${lO}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new fD(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},sU.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:pO,groupKey:this._seriesField,isSeriesMark:!0},{morph:PF(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return QL(Lz)(t)}endAngleScale(t){return QL(Rz)(t)}_computeLayoutRadius(){return Nz((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:bR(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:bR(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},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),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)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:QL(iU).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(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[Iz];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return ce(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===AI.appear)return this._startAngle;if(i===AI.disappear)return this._endAngle;const r=[AI.disappear,AI.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[uO];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[uO]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[uO])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[uO])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[Iz]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[Iz]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[Iz]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[Iz]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=wF(null===(i=zR.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}sU.transformerConstructor=eU,sU.mark=tU,sU.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class nU extends sU{constructor(){super(...arguments),this.type=iR.pie}}nU.type=iR.pie;const rU=()=>{QV(),zR.registerAnimation("pie",((t,e)=>({appear:qV(t,e),enter:XV(t),exit:KV(t),disappear:{duration:ED.disappear.duration}}))),zR.registerAnimation("emptyCircle",((t,e)=>({appear:qV(t,e)}))),zR.registerSeries(nU.type,nU)};function aU(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const oU=t=>({type:aU(t.growField),options:{overall:!0}}),lU={type:"fadeIn"},hU=t=>({type:aU(t.growField)}),cU=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function dU(t,e){if(!1===e)return{};switch(e){case"fadeIn":return lU;case"growAngle":return oU(Object.assign(Object.assign({},t),{growField:"angle"}));default:return oU(Object.assign(Object.assign({},t),{growField:"radius"}))}}class uU extends NV{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(_O),this.setInnerRadiusField(vO)}setValueFieldToPercent(){this.setRadiusField(bO),this.setInnerRadiusField(yO)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const pU=Object.assign(Object.assign({},yF),{rose:{name:"rose",type:"arc"}});class gU extends IF{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class fU extends Jz{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=y(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let n,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:u,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((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:-90,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.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=u,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const _={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(_),"radius"===i.orient?(o.push(_),a=h):(l.push(_),n=h)})),o.forEach((t=>{t.angleAxisIndex=n})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=zR.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=zz,this._endAngle=jz,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),qL(this._regions,(t=>{"radius"===this.getOrient()?Cz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):Cz(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(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.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:kR(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:kR(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this.visible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(this._spec.endAngle),this._inverse=this._spec.inverse}_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:Az(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}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(){qL(this._regions,(t=>{"radius"===this.getOrient()?Cz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):Cz(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(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 NC(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:NC(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 ce(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return de(t,this.getCenter(),this._startAngle,this._endAngle)}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=>wz(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_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=ae.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",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return Nz((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=Hz,e=0;const i=this.getChart().getSpec();return qL(this.getRegions(),(s=>{const n=s;if(r=n.type,[iR.rose,iR.radar,iR.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.getComponent().setAttributes(FR({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(FR({},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)}}fU.type=r.polarAxis,fU.specKey="axes";const mU={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},vU={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class _U extends fU{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new PE}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}registerTicksTransform(){const t=`${this.type}-ticks`;return cI(this._option.dataSet,t,HE),t}}_U.type=r.polarLinearAxis,_U.specKey="axes",_U.builtInTheme={axis:gj,axisLinear:dj,axisAngle:vU,axisRadius:mU},G(_U,cj);const yU=()=>{zR.registerGraphicComponent($z.lineAxis,((t,e)=>new CC(t,e))),zR.registerGraphicComponent(Xz.lineAxisGrid,((t,e)=>new zB(t,e))),zR.registerGraphicComponent($z.circleAxis,((t,e)=>new OC(t,e))),zR.registerGraphicComponent(Xz.circleAxisGrid,((t,e)=>new UB(t,e))),Qz(),zR.registerComponent(_U.type,_U)};class bU extends fU{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new cE}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)}registerTicksTransform(){const t=`${this.type}-ticks`;return cI(this._option.dataSet,t,XE),t}transformScaleDomain(){}}bU.type=r.polarBandAxis,bU.specKey="axes",bU.builtInTheme={axis:gj,axisBand:_j,axisAngle:vU,axisRadius:mU},G(bU,vj);const xU=()=>{zR.registerGraphicComponent($z.lineAxis,((t,e)=>new CC(t,e))),zR.registerGraphicComponent(Xz.lineAxisGrid,((t,e)=>new zB(t,e))),zR.registerGraphicComponent($z.circleAxis,((t,e)=>new OC(t,e))),zR.registerGraphicComponent(Xz.circleAxisGrid,((t,e)=>new UB(t,e))),Qz(),zR.registerComponent(bU.type,bU)};class SU extends uU{constructor(){super(...arguments),this.type=iR.rose,this.transformerConstructor=gU,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(){this._roseMark=this._createMark(SU.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:PF(this._spec,SU.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}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=>_R(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=_R(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(wF(null===(i=zR.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),CF("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}SU.type=iR.rose,SU.mark=pU,SU.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},SU.transformerConstructor=gU;const AU=()=>{zR.registerSeries(SU.type,SU),QV(),zR.registerAnimation("rose",((t,e)=>({appear:dU(t,e),enter:hU(t),exit:cU(t),disappear:{duration:ED.disappear.duration}}))),xU(),yU()};class kU extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:ce(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=de(this.from,this._prevCenter),{angle:i,radius:s}=de(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,NL(this._fromAngle,this._toAngle)&&NL(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class MU extends $w{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!KL(t)&&!KL(e))return e;const s=de(t,this._prevCenter),n=de(e,this._center);let r=pe(s.angle),a=pe(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new re(s,n,r,a);return o.defined=e.defined,o}}const TU=t=>({type:"in"===t?"fadeIn":"fadeOut"});function wU(t,e,i){return"fadeIn"===e?TU(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function CU(t,e,i){return"fadeIn"===e?TU(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 EU=(t,e)=>({custom:Gw,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),BU=Object.assign(Object.assign(Object.assign({},yF),iz),{area:{name:"area",type:"area"}});class PU extends uU{constructor(){super(...arguments),this.type=iR.radar,this.transformerConstructor=uz,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!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),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(PU.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}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:XD,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{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.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)?oe(this._spec.startAngle):zz},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(wF(null===(s=zR.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),CF("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=zR.getAnimationInKey(e);t.setAnimationConfig(wF(null==i?void 0:i(n,r),CF(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}}}PU.type=iR.radar,PU.mark=BU,PU.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},PU.transformerConstructor=uz,G(PU,sz);const LU=()=>{zR.registerSeries(PU.type,PU),EH(),hz(),dz(),zR.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:wU(t,e,"in"),enter:wU(t,e,"in"),exit:wU(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:ED.disappear.duration},update:[{channel:["points","center"],custom:MU,customParameters:t,duration:ED.update.duration,easing:ED.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),zR.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:CU(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:ED.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:kU,customParameters:t,duration:ED.update.duration,easing:ED.update.easing}]}))),zR.registerAnimation("radarGroup",((t,e)=>({appear:EU(t,"in"),disappear:{duration:ED.disappear.duration}}))),Bk(),xU(),yU()};class RU extends oF{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>mi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const OU=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(lO)||(i[n]=t[n],s=p(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[uO]:r,[pO]:`${s}_${e}`})),r++}))})),n},IU={fill:"#bbb",fillOpacity:.2},DU=Object.assign(Object.assign({},yF),{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"}});class FU extends jF{constructor(){super(...arguments),this.type=iR.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 e;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),cI(this._option.dataSet,"objFlat",OU),cI(this._option.dataSet,"copyDataView",_I),dI(this._option.dataSet,"dataview",wa),null===(e=this.getViewData())||void 0===e||e.transform({type:"objFlat",options:"dots",level:t.TransformLevel.dotObjFlat},!1)}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(FR(IU,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(FU.mark.group),this._containerMark=this._createMark(FU.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(FU.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(FU.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(FU.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(FU.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(FU.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(FU.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var e;const i=this._clipMark;i&&(this.setMarkStyle(i,{x:-(null!==(e=this._spec.leftAppendPadding)&&void 0!==e?e:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",t.AttributeLevel.Series),i.setMarkConfig({interactive:!1,clip:!0}));const s=this._containerMark;s&&(this.setMarkStyle(s,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),s.setMarkConfig({interactive:!1}));const n=this._gridBackgroundMark;n&&this.setMarkStyle(n,{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 r=this._gridMark;r&&this.setMarkStyle(r,{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 a=this._dotMark;a&&this.setMarkStyle(a,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const o=this._titleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._subTitleMark;l&&this.setMarkStyle(l,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const h=this._symbolMark;h&&this.setMarkStyle(h,{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(){var e,i;super.onLayoutEnd();const s=null!==(i=null===(e=this._spec)||void 0===e?void 0:e.leftAppendPadding)&&void 0!==i?i:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+s},"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:gO}}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 fR).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:gO}}initTooltip(){this._tooltipHelper=new RU(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}FU.type=iR.dot,FU.mark=DU,FU.builtInTheme={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"}}}}};class zU extends oF{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>mi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const jU=Object.assign(Object.assign({},yF),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),HU=(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 NU extends jF{constructor(){super(...arguments),this.type=iR.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 e;super.initData(),cI(this._option.dataSet,"linkDotInfo",HU),null===(e=this.getViewData())||void 0===e||e.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:t.TransformLevel.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(NU.mark.group),this._containerMark=this._createMark(NU.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(NU.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(NU.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},"normal",t.AttributeLevel.Series),r.setMarkConfig({interactive:!1,clip:!0}));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setMarkConfig({interactive:!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:gO}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new zU(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}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]}}NU.type=iR.link,NU.mark=jU,NU.builtInTheme={link:{arrow:{style:{size:10}}}};const VU=Object.assign(Object.assign({},yF),{group:{name:"group",type:"group"}});class UU extends NV{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()?vO:PO],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle);let o;if(p(s)){const t=ht(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()?_O:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle),o=ht(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)?oe(n):zz;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?oe(r):jz,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=_R(this.angleAxisHelper.dataToPosition([t[vO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=_R(this.angleAxisHelper.dataToPosition([t[_O]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?_R(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(UU.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+oe(a),o=oe(r)/2;return of(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[Dg({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_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 $U=()=>{zR.registerAnimation("circularProgress",((t,e)=>({appear:YU(t,e),enter:{type:"growAngleIn"},disappear:{duration:ED.disappear.duration}})))};class XU extends IF{constructor(){super(...arguments),this._supportStack=!0}}class KU extends UU{constructor(){super(...arguments),this.type=iR.circularProgress,this.transformerConstructor=XU,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(){return this._progressMark=this._createMark(KU.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:PF(this._spec,"progress")}),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)}getInteractionTriggers(){const t=[];return 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(){return this._trackMark=this._createMark(KU.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),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()?vO:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?_O: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(wF(null===(i=zR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),CF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(wF(null===(s=zR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),CF("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}KU.type=iR.circularProgress,KU.mark=WU,KU.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},KU.transformerConstructor=XU;const qU=()=>{zR.registerSeries(KU.type,KU),QV(),$U(),RD(),xU(),yU()};function ZU(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const JU={type:"fadeIn"};function QU(t,e="grow"){return!1===e?{}:"fadeIn"===e?JU:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:ZU(t)}))(t)}class tW extends oF{enableByType(t){return"dimension"!==t}}const eW=Object.assign(Object.assign({},yF),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class iW extends jF{constructor(){super(...arguments),this.type=iR.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=p(e.width)?e.width:e.x1-e.x,o=p(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(iW.mark.progress,{isSeriesMark:!0}),u(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n;const r=this._progressMark;if(r)if("vertical"===this._spec.direction){const s=this._spec.progress||{},n=null!==(e=s.leftPadding)&&void 0!==e?e:0,a=null!==(i=s.rightPadding)&&void 0!==i?i:0;this.setMarkStyle(r,{x:t=>{var e,i;return _R(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),!0)-this._spec.bandWidth/2+n},y1:t=>{var e,i;return _R(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))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?_R(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-n-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=this._spec.progress||{},i=null!==(s=e.topPadding)&&void 0!==s?s:0,a=null!==(n=e.bottomPadding)&&void 0!==n?n:0;this.setMarkStyle(r,{x1:t=>{var e,i;return _R(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))},y:t=>{var e,s;return _R(this.dataToPositionY(t),null===(s=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===s?void 0:s.call(e,0),!0)-this._spec.bandWidth/2+i},height:this._spec.bandWidth-i-a,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?_R(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){return this._trackMark=this._createMark(iW.mark.track),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return _R(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),!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 _R(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),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series))}getInteractionTriggers(){const t=[];return 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(wF(null===(i=zR.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),CF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(wF(null===(s=zR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),CF("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new tW(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}iW.type=iR.linearProgress,iW.mark=eW,iW.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const sW=()=>{WH(),zR.registerAnimation("linearProgress",((t,e)=>({appear:QU(t,e),enter:QU(t),disappear:{duration:ED.disappear.duration}}))),RD(),zR.registerSeries(iW.type,iW)},nW=[0],rW=[20,40],aW=[200,500],oW={shrink:!1,enlarge:!1,fontSizeLimitMin:0},lW=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class hW{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const cW=`${lO}_WORD_CLOUD_TEXT`,dW=Object.assign(Object.assign({},yF),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),uW={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic",scaleX:1,scaleY:1}}};class pW extends DF{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},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._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=rW}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,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:aW,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:nW,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?cW:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:oW},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||Yy(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:nW,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!lW.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new hW(1e3))}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",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var e;this._wordMark=this._createMark(pW.mark.word,{key:pO,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(e=this._spec.wordMask)||void 0===e?void 0:e.visible)&&(this._maskMark=this._createMark(pW.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",t.AttributeLevel.Series)}initMarkStyleOfWord(e,i,s,n,r){var a,o;e&&(this.setMarkStyle(e,{text:(null==i?void 0:i.formatMethod)?t=>i.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{fill:null!==(o=null===(a=null==i?void 0:i.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(wF(zR.getAnimationInKey("wordCloud")(n,s),CF("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 fR).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:gO])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new PE).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new PE).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[uO])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(e=this._spec.word)&&void 0!==e?e:{},h=null!==(i=l.style)&&void 0!==i?i:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const e=()=>{var i,s,n,r;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((t=>t.fn!==e)),null===(s=(i=this._option).dispatchEvent)||void 0===s||s.call(i,t.ChartEvent.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(r=null===(n=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===n?void 0:n.afterWordcloudShapeDraw)||void 0===r||r.call(n,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:e})},dataIndexKey:pO,text:l.formatMethod?t=>l.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(n=null===(s=this._spec.word)||void 0===s?void 0:s.padding)&&void 0!==n?n:1,fontFamily:p(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(r=h.fontFamily)&&void 0!==r?r:this._defaultFontFamily,fontWeight:p(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:p(h.fontWeight)?h.fontWeight:p(this._valueField)?this._calculateFontWeight:"normal",fontStyle:p(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:h.fontStyle,createCanvas:k_.createCanvas.bind(k_),getTextBounds:mf}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,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,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:Wg,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:p(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:p(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:p(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}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(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}pW.mark=dW,pW.builtInTheme={wordCloud:uW};function gW(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||ED.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,d;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(d=t.children)||void 0===d?void 0:d.length){p.children=[],p.isLeaf=!1;const e=fW(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Tt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Tt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},mW=(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=mW(t.children,e,t,n))})),s},vW=(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=vW(t.children,e,t,n)),n=e(t,s,i,n)})),n},_W=(t,e=[],i)=>{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):_W(t.children,e,i)))})),e};function yW(t,e){let i,s;if(SW(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function SW(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 TW(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 wW(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 CW(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 EW(t){return{_:t,next:null,prev:null}}function BW(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];TW(n,s,r);let a,o,l,h,c,d,u,p=EW(s),g=EW(n),f=EW(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.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=fW(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%Ct)/Ct}(),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:OW.defaultOpionts.nodeSort;mW([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)mW([o],PW(h)),vW([o],LW(this._getPadding,.5,a)),mW([o],RW(1,this._maxDepth));else{const t=Math.min(s.width,s.height);mW([o],PW(OW.defaultOpionts.setRadius)),vW([o],LW(Rt,1,a)),c&&vW([o],LW(this._getPadding,o.radius/t,a)),mW([o],RW(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}OW.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const IW=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=IW(t.children):t.value=0),e+=Math.abs(t.value)})),e};function DW(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){IW(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=u(t.value)?0:Tt(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=H(t,["parents"]);if(a.parents=t.parents.map((t=>H(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=Tt(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function FW(t){return t.depth}function zW(t,e){return e-1-t.endDepth}const jW=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),HW=(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},NW={left:FW,right:zW,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?K(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:FW,end:zW},VW=bt(0,1);class UW{constructor(t){this._ascendingSourceBreadth=(t,e)=>jW(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>jW(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},UW.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._logger=ot.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):NW[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)};"vertical"===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<=0)return null;const a=this.computeNodeBreadths(n);if(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))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;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}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return 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){return DW(t,this._getNodeKey)}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=[HW(s[t.source]),HW(s[t.target],!0)].filter((t=>!u(t)));e.length&&(t.value=K(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){return function(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))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=d(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}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=_t(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;ea)&&(o=a);let l=0,h=null,c=null;if(d(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)c=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:c>0?t=>c:t=>Math.max(t.value*l,0),m=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*VW(t.value/e.value):0,n,0),o);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;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,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(jW),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(jW),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{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];WW(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),GW);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({},YW.defaultOpionts,t):Object.assign({},YW.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Lt(this.options.center[0],t.width),s=t.y0+Lt(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=>Lt(t,n))):Lt(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>Lt(t,n))):Lt(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=Lt(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=fW(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=ce({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)}}}function $W(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(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,f,m,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,_=Math.max(v/x,x/m),_>y){f-=h;break}y=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{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*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:WW,slice:$W,sliceDice:function(t,e,i,s,n){(t.depth%2==1?$W:WW)(t,e,i,s,n)}};class qW{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({},qW.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?Pt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?XW(this.options.aspectRatio):null!==(e=KW[this.options.splitType])&&void 0!==e?e:KW.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=fW(t,n,0,-1,null,this._getNodeKey,this.options.valueField);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)}))}}function ZW(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+ci?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return ot.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=ZW(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=Ci(o.map(Ci))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rwt(e)));u=Ri(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=JW(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&ot.getInstance().error("Area "+r+" not represented on screen")}return i}function rG(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Pi((function(i){return-1*aG({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},lG=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=Y(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!P(Y(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:Y(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||tG,s=e.lossFunction||QW,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=Y(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];di(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rae.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:oG(f),arcs:f})}))},hG={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:cG,triangle:cG,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.955)%(2*Math.PI/5)-2*Math.PI/10>=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 cG(){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 dG(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*.4),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"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const uG=t=>hG[t]?hG[t]():hG.circle(),pG=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function gG(t){return d(t)?t:function(){return t}}class fG{constructor(t){var e,i;switch(this.options=j({},fG.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=uG(this.options.shape),this.getText=null!==(e=gG(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=gG(this.options.fontWeight),this.getTextFontSize=gG(this.options.fontSize),this.getTextFontStyle=gG(this.options.fontStyle),this.getTextFontFamily=gG(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>pG(10,50);break;case"random-light":this.getTextColor=()=>pG(50,90);break;default:this.getTextColor=gG(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 oe(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():wt(e);return oe(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+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:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1: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 vG extends fG{constructor(t){var e;super(j({},vG.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<=vG.defaultOptions.minFontSize&&(this.options.minFontSize=vG.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=mG[this.options.spiral])&&void 0!==e?e:mG.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=gG(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}=dG(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,f,m;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,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,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._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=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(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=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}));if(this.originalData=s,this.data=s,this.progressiveRun(),!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._originSize[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],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});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 f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);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*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(xG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(bG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}xG(p,this._size)&&(p=SG(p,this._size))}else if(xG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||yG(p,i))&&(!i||!_G(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 _G(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 yG(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,xG=(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 SG(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{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const u=n.measureText(h),g="normal"!==o?1.1:1,f=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(u.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},kG=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>ce(t,e,i+r*n)))},MG=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},TG=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=dG(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=uG("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return ce(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)MG(n,kG({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)MG(n,kG({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)MG(n,kG({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)MG(n,kG({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)MG(n,kG({x:l,y:h},o,0,3));else if("star"===t.shape){const t=kG({x:l,y:h},o,-Math.PI/2,5),e=kG({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);MG(n,i)}else n.fillRect(0,0,i,s)}; + ***************************************************************************** */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.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=(t,e=!1)=>e?"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 _=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||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=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||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 B=Object.prototype.hasOwnProperty;function P(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(B.call(t,e))return!1;return!0}var L=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&R.call(t,e);function I(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=y(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||_(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=I(r,e,i)}return s}function D(t,e,i=!1,s=!1){if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&y(t[a])?z(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(y(a)){if(s)o=[];else if(y(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.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 U(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(!U(t[s],e[s],i))return!1;return!0}if(!m(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(!U(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;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},K=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;ne?1:t>=e?0:NaN}function it(t){return Number(t)}function st(t,e,i=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)}const nt="undefined"!=typeof console;function rt(t,e,i){const s=[e].concat([].slice.call(i));nt&&console[t].apply(console,s)}var at;!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"}(at||(at={}));class ot{static getInstance(t,e){return ot._instance&&S(t)?ot._instance.level(t):ot._instance||(ot._instance=new ot(t,e)),ot._instance}static setInstance(t){return ot._instance=t}static setInstanceLevel(t){ot._instance?ot._instance.level(t):ot._instance=new ot(t)}static clearInstance(){ot._instance=null}constructor(t=at.None,e){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(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=at.Info}canLogDebug(){return this._level>=at.Debug}canLogError(){return this._level>=at.Error}canLogWarn(){return this._level>=at.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=at.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):rt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=at.Warn&&rt(this._method||"warn","WARN",t),this}info(...t){return this._level>=at.Info&&rt(this._method||"log","INFO",t),this}debug(...t){return this._level>=at.Debug&&rt(this._method||"log","DEBUG",t),this}}function lt(t,e,i=0,s){for(u(s)&&(s=t.length);i>>1;et(t[n],e)>0?s=n:i=n+1}return i}ot._instance=null;const ht=(t,e)=>ct(0,t.length,(i=>e(t[i]))),ct=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},dt=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(et)),st(i,.5)},ut=1e-10,pt=1e-10;function gt(t,e,i=pt,s=ut){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function ft(t,e,i,s){return t>e&&!gt(t,e,i,s)}function mt(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var _t=function(t,e,i){return ti?i:t};var yt=(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 bt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let xt=!1;try{xt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){xt=!1}function St(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&xt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=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 _(){const t=Date.now();if(v(t))return y(t);o=m(_,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?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(_,e),c?f(t):a}(l);if(d)return o=m(_,e),f(l)}return void 0===o&&(o=m(_,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:y(Date.now())},b.pending=function(){return void 0!==o},b}function At(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),St(t,e,{leading:s,trailing:n,maxWait:e})}function kt(t,e){return i=>t*(1-i)+e*i}function Mt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Tt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function wt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}xt=!1;const Ct=4294967296;const Et=t=>e=>L(e,t),Bt=(t,e={})=>{if(d(t))return t;const i=[t];return(e&&e.get||Et)(i)},Pt=(t,e={})=>{if(y(t)){const i=t.map((t=>Bt(t,e)));return t=>i.map((e=>e(t)))}return Bt(t,e)},Lt=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t,Rt=t=>0,Ot=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function Dt(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Ft(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!u(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:d,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)d+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!u(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!u(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:d,b:p},predict:g,rSquared:Dt(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=It(f.min,f);for(let r=0;r=1?Ht:t<=-1?-Ht:Math.asin(t)}function Jt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Qt(t,e){return t[0]*e[1]-t[1]*e[0]}function te(t,e){let i=0;for(let s=0;s0?i:0}function se(t,e){return ee(t+e,10**Math.max(ie(t),ie(e)))}function ne(t,e){return ee(t-e,10**Math.max(ie(t),ie(e)))}class re{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new re(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 ae{static distancePP(t,e){return Kt(qt(t.x-e.x,2)+qt(t.y-e.y,2))}static distanceNN(t,e,i,s){return Kt(qt(t-i,2)+qt(e-s,2))}static distancePN(t,e,i){return Kt(qt(e-t.x,2)+qt(i-t.y,2))}static pointAtPP(t,e,i){return new re((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function oe(t){return t*(Math.PI/180)}function le(t){return 180*t/Math.PI}const he=(t=0)=>{if(t<0)for(;t<-Vt;)t+=Vt;else if(t>0)for(;t>Vt;)t-=Vt;return t};function ce(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 de(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function ue(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function pe(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ge(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=pe(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)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function fe(t){return(t=pe(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 me(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function ve(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function ye(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var be;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(be||(be={}));const xe=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function Se(t,e,i){if(!t||!e)return be.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function Me(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Te({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function we(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Ce(t,e){const i=e?oe(t.angle):t.angle,s=we(t);return[Te({x:t.x1,y:t.y1},i,s),Te({x:t.x2,y:t.y1},i,s),Te({x:t.x2,y:t.y2},i,s),Te({x:t.x1,y:t.y2},i,s)]}function Ee(t,e,i=!1){const s=Ce(t,i),n=Ce(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(we(t),we(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?oe(t.angle):t.angle;let u=i?oe(90-t.angle):t.angle+Ht;const p=i?oe(e.angle):e.angle;let g=i?oe(90-e.angle):e.angle+Ht;u>Nt&&(u-=Nt),g>Nt&&(g-=Nt);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Me(n,i)+Me(n,s))/2>Me(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Be=1e-8;function Pe(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Oe(t,e){return Math.abs(t-e){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"};function De(t,e={},i){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")}class Fe{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=De(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:f=o}=this._userSpec;if(_(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,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: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,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}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(Fe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Fe.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Fe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Fe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Fe.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}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)}}Fe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Fe.NUMBERS_CHAR_SET="0123456789",Fe.FULL_SIZE_CHAR="字";const ze=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),je=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=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(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=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(t=0,e=0,i=0,s=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(t=0,e=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(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return He(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 Ne extends Ve{}class Ue extends Ve{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Ee(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new Ue(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Te({x:this.x1,y:this.y1},this.angle,t),Te({x:this.x2,y:this.y1},this.angle,t),Te({x:this.x1,y:this.y2},this.angle,t),Te({x:this.x2,y:this.y2},this.angle,t)]}}class We{constructor(t=1,e=0,i=0,s=1,n=0,r=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 We,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,f=o*n+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 We;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:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new We(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=le(r.rotateDeg),r}}class Ge{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 Ye(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 $e(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 Xe=/^#([0-9a-f]{3,8})$/,Ke={transparent:4294967040},qe={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 Ze(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Je(t){return S(t)?new si(t>>16,t>>8&255,255&t,1):y(t)?new si(t[0],t[1],t[2]):new si(255,255,255)}function Qe(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ti(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ei=(t,e)=>{const i=Xe.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new si((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Je(t):8===e?new si(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class ii{static Brighter(t,e=1){return 1===e?t:new ii(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new ii(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof ii?t:new ii(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();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(Ke[t]))return function(t){return S(t)?new si(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new si(t[0],t[1],t[2],t[3]):new si(255,255,255,1)}(Ke[t]);if(p(qe[t]))return Je(qe[t]);const e=`${t}`.trim().toLowerCase(),i=ei(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new si(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=Ye(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new si(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ii.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new si(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=$e(this.color.r,this.color.g,this.color.b),r=Ye(u(t)?n.h:_t(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 si(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=ei(e,!0);return null!=i?i:this}setColorName(t){const e=qe[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(t=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}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new ii(this.color.toString())}copyGammaToLinear(t,e=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,e=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=Qe(t.color.r),this.color.g=Qe(t.color.g),this.color.b=Qe(t.color.b),this}copyLinearToSRGB(t){return this.color.r=ti(t.color.r),this.color.g=ti(t.color.g),this.color.b=ti(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class si{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`#${Ze(this.r)+Ze(this.g)+Ze(this.b)+(1===this.opacity?"":Ze(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}=$e(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ni(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 si(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:$e});function ai(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 oi(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=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:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}function li(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 hi(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}const ci=1e-10;function di(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+ci)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=fi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=ae.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=ui(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-ci,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function ui(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function pi(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return ui(t,t-(i*i-e*e+t*t)/(2*i))+ui(e,s)}function gi(t,e){const i=ae.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function fi(t){const e={x:0,y:0};for(let i=0;ithis.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 _i;function yi(t,e){const i=vi(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 bi{constructor(t={}){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 xi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Si(t){let e;if(e=xi.exec(t))return new bi({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]});ot.getInstance().error("invalid format: "+t)}const Ai=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class ki{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 ki.instance||(ki.instance=new ki),ki.instance}newFormat(t){const e=Si(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"):Mi[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=Mi[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:_,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)?m: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?Ai[8+_i/3]:"")+A+(t&&"("===n?")":""),f)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=Si(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=vi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=Ai[8+n/3];return function(t){return s(r*t)+a}}}const Mi={"%":(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)=>yi(100*t,e),r:yi,s:function(t,e){const i=vi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(_i=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")+vi(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 Ti(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(_.fx>e.fx?(Bi(y,1+c,v,-c,e),y.fx=t(y),y.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Bi(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=te(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Ri(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Ei(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},ts=Math.sqrt,es=Math.tan;function is(t){return t>1?0:t<-1?ji:Math.acos(t)}function ss(t){return t>1?Hi:t<-1?-Hi:Math.asin(t)}function ns(){}function rs(t,e){t&&os.hasOwnProperty(t.type)&&os[t.type](t,e)}var as={Feature:function(t,e){rs(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sji?t+Math.round(-t/Ni)*Ni:t,e]}function bs(t,e,i){return(t%=Ni)?e||i?_s(Ss(t),As(e,i)):Ss(t):e||i?As(e,i):ys}function xs(t){return function(e,i){return[(e+=t)>ji?e-Ni:e<-ji?e+Ni:e,i]}}function Ss(t){var e=xs(t);return e.invert=xs(-t),e}function As(t,e){var i=Xi(t),s=Ji(t),n=Xi(e),r=Ji(e);function a(t,e){var a=Xi(e),o=Xi(t)*a,l=Ji(t)*a,h=Ji(e),c=h*i+o*s;return[$i(l*n-c*r,o*i-h*s),ss(c*n+l*r)]}return a.invert=function(t,e){var a=Xi(e),o=Xi(t)*a,l=Ji(t)*a,h=Ji(e),c=h*n-l*r;return[$i(l*n+h*r,o*i+c*s),ss(c*i-o*s)]},a}function ks(t,e){(e=us(e))[0]-=t,vs(e);var i=is(-e[1]);return((-e[2]<0?-i:i)+Ni-zi)%Ni}function Ms(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:ns,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function Ts(t,e){return Gi(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 Es(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Is(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 Ds(t,e,i,s){return function(n){var r,a,o,l=e(n),h=Ms(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Is(a);var t=function(t,e){var i=Rs(e),s=e[1],n=Ji(s),r=[Ji(i),-Xi(i),0],a=0,o=0;Ls.reset(),1===n?s=Hi+zi:-1===n&&(s=-Hi-zi);for(var l=0,h=t.length;l=0?1:-1,M=k*A,T=M>ji,w=f*x;if(Ls.add($i(w*k*Ji(M),m*S+w*Xi(M))),a+=T?A+k*Ni:A,T^p>=i^y>=i){var C=gs(us(u),us(_));vs(C);var E=gs(r,C);vs(E);var B=(T^A>=0?-1:1)*ss(E[2]);(s>B||s===B&&(C[0]||C[1]))&&(o+=T^A>=0?1:-1)}}return(a<-zi||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(Fs))}return u}}function Fs(t){return t.length>1}function zs(t,e){return((t=t.x)[0]<0?t[1]-Hi-zi:Hi-t[1])-((e=e.x)[0]<0?e[1]-Hi-zi:Hi-e[1])}1===(Bs=Os).length&&(Ps=Bs,Bs=function(t,e){return Os(Ps(t),e)});var js=Ds((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?ji:-ji,l=Gi(r-i);Gi(l-ji)0?Hi:-Hi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=ji&&(Gi(i-n)zi?Yi((Ji(e)*(r=Xi(s))*Ji(i)-Ji(s)*(n=Xi(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*Hi,s.point(-ji,n),s.point(0,n),s.point(ji,n),s.point(ji,0),s.point(ji,-n),s.point(0,-n),s.point(-ji,-n),s.point(-ji,0),s.point(-ji,n);else if(Gi(t[0]-e[0])>zi){var r=t[0]0,n=Gi(e)>zi;function r(t,i){return Xi(t)*Xi(i)>e}function a(t,i,s){var n=[1,0,0],r=gs(us(t),us(i)),a=ps(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=gs(n,r),u=ms(n,h);fs(u,ms(r,c));var p=d,g=ps(u,p),f=ps(p,p),m=g*g-f*(ps(u,u)-1);if(!(m<0)){var v=ts(m),_=ms(p,(-g-v)/f);if(fs(_,u),_=ds(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],A=i[1];x0^_[1]<(Gi(_[0]-b)ji^(b<=_[0]&&_[0]<=x)){var T=ms(p,(-g+v)/f);return fs(T,u),[_,ds(T)]}}}function o(e,i){var n=s?t:ji-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Ds(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],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?ji:-ji),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||Ts(e,p)||Ts(g,p))&&(g[2]=1),f!==l)c=0,f?(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^f){var v;m&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)))}!f||e&&Ts(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},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=Xi(e),o=Ji(e),l=s*i;null==n?(n=e+s*Ni,r=e-l/2):(n=ks(a,n),r=ks(a,r),(s>0?nr)&&(n+=s*Ni));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 Gi(s[0]-t)0?0:3:Gi(s[0]-i)0?2:1:Gi(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,f,m,v,_,y=a,b=Ms(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(A(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&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=Is(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&Cs(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&&m)y.point(r,a);else{var l=[g=Math.max(Ns,Math.min(Vs,g)),f=Math.max(Ns,Math.min(Vs,f))],b=[r=Math.max(Ns,Math.min(Vs,r)),a=Math.max(Ns,Math.min(Vs,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):(m||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Ws(t){return t}var Gs,Ys,$s,Xs,Ks=Oi(),qs=Oi(),Zs={point:ns,lineStart:ns,lineEnd:ns,polygonStart:function(){Zs.lineStart=Js,Zs.lineEnd=en},polygonEnd:function(){Zs.lineStart=Zs.lineEnd=Zs.point=ns,Ks.add(Gi(qs)),qs.reset()},result:function(){var t=Ks/2;return Ks.reset(),t}};function Js(){Zs.point=Qs}function Qs(t,e){Zs.point=tn,Gs=$s=t,Ys=Xs=e}function tn(t,e){qs.add(Xs*t-$s*e),$s=t,Xs=e}function en(){tn(Gs,Ys)}var sn=Zs,nn=1/0,rn=nn,an=-nn,on=an;var ln,hn,cn,dn,un={point:function(t,e){tan&&(an=t);eon&&(on=e)},lineStart:ns,lineEnd:ns,polygonStart:ns,polygonEnd:ns,result:function(){var t=[[nn,rn],[an,on]];return an=on=-(rn=nn=1/0),t}},pn=0,gn=0,fn=0,mn=0,vn=0,_n=0,yn=0,bn=0,xn=0,Sn={point:An,lineStart:kn,lineEnd:wn,polygonStart:function(){Sn.lineStart=Cn,Sn.lineEnd=En},polygonEnd:function(){Sn.point=An,Sn.lineStart=kn,Sn.lineEnd=wn},result:function(){var t=xn?[yn/xn,bn/xn]:_n?[mn/_n,vn/_n]:fn?[pn/fn,gn/fn]:[NaN,NaN];return pn=gn=fn=mn=vn=_n=yn=bn=xn=0,t}};function An(t,e){pn+=t,gn+=e,++fn}function kn(){Sn.point=Mn}function Mn(t,e){Sn.point=Tn,An(cn=t,dn=e)}function Tn(t,e){var i=t-cn,s=e-dn,n=ts(i*i+s*s);mn+=n*(cn+t)/2,vn+=n*(dn+e)/2,_n+=n,An(cn=t,dn=e)}function wn(){Sn.point=An}function Cn(){Sn.point=Bn}function En(){Pn(ln,hn)}function Bn(t,e){Sn.point=Pn,An(ln=cn=t,hn=dn=e)}function Pn(t,e){var i=t-cn,s=e-dn,n=ts(i*i+s*s);mn+=n*(cn+t)/2,vn+=n*(dn+e)/2,_n+=n,yn+=(n=dn*t-cn*e)*(cn+t),bn+=n*(dn+e),xn+=3*n,An(cn=t,dn=e)}var Ln=Sn;function Rn(t){this._context=t}Rn.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,Ni)}},result:ns};var On,In,Dn,Fn,zn,jn=Oi(),Hn={point:ns,lineStart:function(){Hn.point=Vn},lineEnd:function(){On&&Nn(In,Dn),Hn.point=ns},polygonStart:function(){On=!0},polygonEnd:function(){On=null},result:function(){var t=+jn;return jn.reset(),t}};function Vn(t,e){Hn.point=Nn,In=Fn=t,Dn=zn=e}function Nn(t,e){Fn-=t,zn-=e,jn.add(ts(Fn*Fn+zn*zn)),Fn=t,zn=e}var Un=Hn;function Wn(){this._string=[]}function Gn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Yn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),cs(t,i(s))),s.result()}return r.area=function(t){return cs(t,i(sn)),sn.result()},r.measure=function(t){return cs(t,i(Un)),Un.result()},r.bounds=function(t){return cs(t,i(un)),un.result()},r.centroid=function(t){return cs(t,i(Ln)),Ln.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ws):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Wn):new Rn(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 $n(t){return function(e){var i=new Xn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Xn(){}function Kn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),cs(i,t.stream(un)),e(un.result()),null!=s&&t.clipExtent(s),t}function qn(t,e,i){return Kn(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 Zn(t,e,i){return qn(t,[[0,0],e],i)}function Jn(t,e,i){return Kn(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 Qn(t,e,i){return Kn(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)}Wn.prototype={_radius:4.5,_circle:Gn(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=Gn(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}},Xn.prototype={constructor:Xn,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 tr=16,er=Xi(30*Wi);function ir(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&f--){var b=a+u,x=o+p,S=l+g,A=ts(b*b+x*x+S*S),k=ss(S/=A),M=Gi(Gi(S)-1)e||Gi((v*E+_*B)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Wi:0,E()):[m*Ui,v*Ui,_*Ui]},w.angle=function(t){return arguments.length?(y=t%360*Wi,E()):y*Ui},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=ir(o,T=t*t),B()):ts(T)},w.fitExtent=function(t,e){return qn(w,t,e)},w.fitSize=function(t,e){return Zn(w,t,e)},w.fitWidth=function(t,e){return Jn(w,t,e)},w.fitHeight=function(t,e){return Qn(w,t,e)},function(){return e=t.apply(this,arguments),w.invert=e.invert&&C,E()}}function lr(t){var e=0,i=ji/3,s=or(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Wi,i=t[1]*Wi):[e*Ui,i*Ui]},n}function hr(t,e){var i=Ji(t),s=(i+Ji(e))/2;if(Gi(s)2?t[2]*Wi:0),e.invert=function(e){return(e=t.invert(e[0]*Wi,e[1]*Wi))[0]*=Ui,e[1]*=Ui,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===mr?[[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 _r(t){return es((Hi+t)/2)}function yr(t,e){var i=Xi(t),s=t===e?Ji(t):qi(i/Xi(e))/qi(_r(e)/_r(t)),n=i*Zi(_r(t),s)/s;if(!s)return mr;function r(t,e){n>0?e<-Hi+zi&&(e=-Hi+zi):e>Hi-zi&&(e=Hi-zi);var i=n/Zi(_r(e),s);return[i*Ji(s*t),n-i*Xi(s*t)]}return r.invert=function(t,e){var i=n-e,r=Qi(s)*ts(t*t+i*i),a=$i(t,Gi(i))*Qi(i);return i*s<0&&(a-=ji*Qi(t)*Qi(i)),[a/s,2*Yi(Zi(n/r,1/s))-Hi]},r}function br(t,e){return[t,e]}function xr(t,e){var i=Xi(t),s=t===e?Ji(t):(i-Xi(e))/(e-t),n=i/s+t;if(Gi(s)zi&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Br.invert=pr(ss),Pr.invert=pr((function(t){return 2*Yi(t)})),Lr.invert=function(t,e){return[-e,2*Yi(Ki(t))-Hi]};var Ir={exports:{}},Dr=function(t,e){this.p1=t,this.p2=e};Dr.prototype.rise=function(){return this.p2[1]-this.p1[1]},Dr.prototype.run=function(){return this.p2[0]-this.p1[0]},Dr.prototype.slope=function(){return this.rise()/this.run()},Dr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Dr.prototype.isVertical=function(){return!isFinite(this.slope())},Dr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Dr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Dr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Dr.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)},Dr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Fr=Dr,zr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Fr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=zr(t.slice(0,s),e),o=zr(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},jr=zr;!function(t){var e=jr;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;r{const i=Vr(Wr,e),{tolerance:s}=i;return Hr(t,s)};var Yr;!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"}(Yr||(Yr={}));const $r=(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.sort&&(k(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!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;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,_=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],A=new Set,k=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),A.has(i)||(A.add(i),S.push(i),y(m)?k.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):k.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else _[r][l]+=a;e&&e.includeValues&&!v&&_[r][c].push(t[n]);break}}}let M=0;const T=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=_.length;t0?_[t][l]/M:0,T.push(_[t])}return T},Kr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,_=-1/0;if(e.extent)v=e.extent[0],_=e.extent[1];else for(let e=0;e_&&(_=s))}if(!Number.isFinite(v)||!Number.isFinite(_)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=_;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(_-v>1){const e=Math.floor(v),i=Math.ceil((_-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>_){t=s,m.length=t+1;break}}else{const e=(_-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>_){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",A=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",k=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",M=null!==(d=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==d?d:"percentage",T=y(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],w=y(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],C=w.length?w:void 0,E=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:A,percentageName:M,valuesName:k,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:C});if(!T.length)return Xr(t,E);const B={};return t.forEach((t=>{const e=T.map((e=>null==t?void 0:t[e])).join("-&&-");B[e]?B[e].push(t):B[e]=[t]})),Object.values(B).map((t=>{const e=[...w,...T];return Xr(t,Object.assign(Object.assign({},E),{groupField:e.length?e:void 0,n:t.length}))})).flat()},qr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,_;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const A=!!(null==e?void 0:e.includeValues),k=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},M=null!==(n=k.key)&&void 0!==n?n:y(x)?null:null!==(r=x)&&void 0!==r?r:"key",T=null!==(a=k.count)&&void 0!==a?a:"count",w=null!==(o=k.mean)&&void 0!==o?o:"mean",C=null!==(l=k.q1)&&void 0!==l?l:"q1",E=null!==(h=k.median)&&void 0!==h?h:"median",B=null!==(c=k.q3)&&void 0!==c?c:"q3",P=null!==(d=k.iqr)&&void 0!==d?d:"iqr",L=null!==(p=k.min)&&void 0!==p?p:"min",R=null!==(g=k.max)&&void 0!==g?g:"max",O=null!==(f=k.lowerWhisker)&&void 0!==f?f:"lowerWhisker",I=null!==(m=k.upperWhisker)&&void 0!==m?m:"upperWhisker",D=null!==(v=k.outliers)&&void 0!==v?v:"outliers",F=null!==(_=k.values)&&void 0!==_?_:"values",z=new Map,j=new Map,H=new Map,V=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),A&&j.set(r,[]),y(x)?H.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):H.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),A){const t=j.get(r);t&&t.push(i)}}y(S)&&(S=[_t(Math.min.apply(null,S),0,1),_t(Math.max.apply(null,S),0,1)]);const N=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=H.get(t);if(null!==M)f[M]=m;else if(y(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[T]=s,f[w]=o,f[C]=l,f[E]=h,f[B]=c,f[P]=d,f[L]=n,f[R]=r,f[O]=u,f[I]=p,f[D]=g,A&&(f[F]=j.get(t)||[]),N.push(f)}return N};var Zr={},Jr={};function Qr(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function ta(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function ea(t,e){var i=t+"",s=i.length;return s9999?"+"+ea(e,6):ea(e,4))+"-"+ea(t.getUTCMonth()+1,2)+"-"+ea(t.getUTCDate(),2)+(r?"T"+ea(i,2)+":"+ea(s,2)+":"+ea(n,2)+"."+ea(r,3)+"Z":n?"T"+ea(i,2)+":"+ea(s,2)+":"+ea(n,2)+"Z":s||i?"T"+ea(i,2)+":"+ea(s,2)+"Z":"")}function sa(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 Jr;if(h)return h=!1,Zr;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(;a0}function ga(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=oa(t));var r=[];switch(t.type){case"GeometryCollection":return fa(t,(function(t){va(t,s)})),t;case"FeatureCollection":return ga(t,(function(t){ga(va(t,s),(function(t){r.push(t)}))})),hi(r)}return va(t,s)}function va(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return fa(t,(function(t){va(t,e)})),t;case"LineString":return _a(ua(t),e),t;case"Polygon":return ya(ua(t),e),t;case"MultiLineString":return ua(t).forEach((function(t){_a(t,e)})),t;case"MultiPolygon":return ua(t).forEach((function(t){ya(t,e)})),t;case"Point":case"MultiPoint":return t}}function _a(t,e){pa(t)===e&&t.reverse()}function ya(t,e){pa(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=ba(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},ka=(t,e={},i)=>{i.type=Yr.GEO;const s=Vr(Sa,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Aa(t))})):e.push(Aa(t))})),e})(t);let l=t.features;return o&&(l=ma(t,{reverse:!g(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=xa.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=xa.bounds(t);t.bbox=e}})),t.features=l,t},Ma={},Ta=(t,e,i)=>{i.type=Yr.GEO;const s=Vr(Sa,Ma,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 Or(a,t)}))}:Or(a,o));var a,o;return ka(r,s,i)},wa=(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 Ca=0;function Ea(t="dataset"){return Ca>1e8&&(Ca=0),t+"_"+Ca++}class Ba{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:Ea("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:ot.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()}}class Pa{constructor(t,e){let i;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=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&U(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Ea("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){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,e=!0){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)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}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,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&U(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof Pa||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!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",$r),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Yn();const La={},Ra={albers:dr,albersusa:function(){var t,e,i,s,n,r,a=dr(),o=cr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=cr().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)}},Oa=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Ia(t,e){return function i(){const s=e();return s.type=t,s.path=Yn().projection(s),s.copy=s.copy||function(){const t=i();return Oa.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Da{static GenAutoIncrementId(){return Da.auto_increment_id++}}Da.auto_increment_id=0;class Fa{constructor(t){this.id=Da.GenAutoIncrementId(),this.registry=t}}const za="named",ja="inject",Ha="multi_inject",Va="inversify:tagged",Na="inversify:paramtypes";class Ua{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===za?`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="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),s=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),n=new WeakMap;function r(t,e,i){let r=n.get(t);if(h(r)){if(!i)return;r=new s,n.set(t,r)}let a=r.get(e);if(h(a)){if(!i)return;a=new s,r.set(e,a)}return a}function a(t,e,i){if(o(t,e,i))return!0;const s=f(e);return!c(s)&&a(t,s,i)}function o(t,e,i){const s=r(e,i,!1);return!h(s)&&!!s.has(t)}function l(t,e,i){if(o(t,e,i))return function(t,e,i){const s=r(e,i,!1);if(!h(s))return s.get(t)}(t,e,i);const s=f(e);return c(s)?void 0:l(t,s,i)}function h(t){return void 0===t}function c(t){return null===t}function d(t){return"object"==typeof t?null!==t:"function"==typeof t}function u(t,i){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const s=3===i?"string":5===i?"number":"default",n=function(t,e){const i=t[e];if(null!=i){if(!g(i))throw new TypeError;return i}}(t,e);if(void 0!==n){const e=n.call(t,s);if(d(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.valueOf;if(g(i)){const e=i.call(t);if(!d(e))return e}}else{const e=t.valueOf;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.toString;if(g(i)){const e=i.call(t);if(!d(e))return e}}throw new TypeError}(t,"default"===s?"number":s)}function p(t){const e=u(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function g(t){return"function"==typeof t}function f(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const s=t.prototype,n=s&&Object.getPrototypeOf(s);if(null==n||n===Object.prototype)return e;const r=n.constructor;return"function"!=typeof r||r===t?e:r}t("defineMetadata",(function(t,e,i,s){if(!d(i))throw new TypeError;return n=t,a=e,void r(i,s,!0).set(n,a);var n,a})),t("hasMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),l(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function Ga(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};Wa.hasOwnMetadata(t,e)&&(r=Wa.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,Wa.defineMetadata(t,r,e)}(Va,t,i.toString(),s)}function Ya(t){return(e,i,s)=>{Ga(e,0,s,t)}}function $a(t){return e=>(i,s,n)=>Ya(new Ua(t,e))(i,s,n)}const Xa=$a(ja),Ka=$a(Ha);function qa(){return function(t){return Wa.defineMetadata(Na,null,t),t}}function Za(t){return Ya(new Ua(za,t))}const Ja="Singleton",Qa="Transient",to="ConstantValue",eo="DynamicValue",io="Factory",so="Function",no="Instance",ro="Invalid";class ao{constructor(t,e){this.id=Da.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=ro,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new ao(this.serviceIdentifier,this.scope);return t.activated=t.scope===Ja&&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 oo{getConstructorMetadata(t){return{compilerGeneratedMetadata:Wa.getMetadata(Na,t),userGeneratedMetadata:Wa.getMetadata(Va,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const lo=(ho=za,t=>{const e=e=>{if(null==e)return!1;if(e.key===ho&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const po=Symbol("ContributionProvider");class go{constructor(t,e){this.serviceIdentifier=t,this.container=e,mo.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function fo(t,e){t(po).toDynamicValue((({container:t})=>new go(e,t))).inSingletonScope().whenTargetNamed(e)}class mo{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}mo.store=new Map;class vo{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 _o extends vo{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const yo=Symbol.for("EnvContribution"),bo=Symbol.for("VGlobal"),xo=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Qa,this.options=e,this.id=Da.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new oo}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,za,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new ao(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new uo(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[ja],multiInject:s[Ha]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:a,metadata:e,bindings:l};n.push(t)}}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case to:case so:e=t.cache;break;case no: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===Ja&&(t.cache=e,t.activated=!0)}},So=Symbol.for("RenderService");const Ao=new class{get renderService(){return this._renderService||(this._renderService=xo.get(So)),this._renderService}};let ko=0;class Mo{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=Ao.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++ko,t),this.tryRunAnimationFrameNextFrame(),ko}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class To{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var wo=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Co=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Eo=function(t,e){return function(i,s){e(i,s,t)}},Bo=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 Po=class extends To{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}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){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Da.GenAutoIncrementId(),this.hooks={onSetEnv:new _o(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}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)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new Mo);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}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)}loadFont(t,e,i){return Bo(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}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,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var Lo,Ro,Oo,Io;Po=wo([qa(),Eo(0,Xa(po)),Eo(0,Za(yo)),Co("design:paramtypes",[Object])],Po),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(Lo||(Lo={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(Ro||(Ro={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(Oo||(Oo={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(Io||(Io={}));const Do=Vt-1e-8;class Fo{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>Do)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%=Vt)<0&&(s+=Vt),(n%=Vt)<0&&(n+=Vt),nn;++o,a-=Ht)g(a);else for(a=s-s%Ht+Ht,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const jo=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,Ho={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},Vo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let No,Uo,Wo,Go,Yo,$o;var Xo,Ko,qo,Zo,Jo,Qo;function tl(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),f=Math.cos(n),m=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+f,A=i+m,k=S+y*m,M=A-y*f;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 el(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=oe(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 f=d/i,m=c/i,v=-c/s,_=d/s,y=f*o+m*l,b=v*o+_*l,x=f*t+m*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+=Vt:C>0&&0===r&&(C-=Vt);const E=Math.ceil(Math.abs(C/(Ht+.001))),B=[];for(let t=0;te.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 sl(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=cl(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=$t(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=$t(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function ul(t,e){const{p0:i,p1:s}=t,n=ae.pointAtPP(i,s,e);return[new pl(i,n),new pl(n,s)]}class pl extends nl{constructor(t,e){super(),this.type=Jo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return ae.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Wt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?ae.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Zo.ROW?Ut(this.p0.x-this.p1.x):t===Zo.COLUMN?Ut(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class gl{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new dl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new pl(new re(this._lastX,this._lastY),new re(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===Zo.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Ut(t.p0.y-s.y)}if(t===Zo.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Ut(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class fl extends gl{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 ml(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function vl(t,e,i){const s=null!=e?e:Ut(i[i.length-1].x-i[0].x)>Ut(i[i.length-1].y-i[0].y)?Zo.ROW:Zo.COLUMN;return"monotoneY"===t?new fl(t,s):new gl(t,s)}class _l{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 yl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=vl("linear",i,t);return function(t,e){ml(t,e,1)}(new _l(n,s),t),n}function bl(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 xl{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&&bl(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:bl(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 Sl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return yl(t,e);const n=vl("basis",i,t);return function(t,e){ml(t,e,2)}(new xl(n,s),t),n}function Al(t){return t<0?-1:1}function kl(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(Al(r)+Al(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Ml(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 wl{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,Ml(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,Ml(this,e=kl(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Tl(this,this._t0,e=kl(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 Cl extends wl{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function El(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return yl(t,e);const n=vl("monotoneX",i,t);return function(t,e){ml(t,e,2)}(new wl(n,s),t),n}function Bl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return yl(t,e);const n=vl("monotoneY",i,t);return function(t,e){ml(t,e,2)}(new Cl(n,s),t),n}let Pl=class{constructor(t,e=.5,i){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;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):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()}};class Ll extends Pl{lineEnd(){this.context.closePath()}}function Rl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new gl("step",null!=s?s:Ut(t[t.length-1].x-t[0].x)>Ut(t[t.length-1].y-t[0].y)?Zo.ROW:Zo.COLUMN);return Ol(new Pl(r,e,n),t),r}function Ol(t,e){return ml(t,e,1)}class Il extends _l{lineEnd(){this.context.closePath()}}function Dl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=vl("linear",i,t);return function(t,e){ml(t,e,1)}(new Il(n,s),t),n}function Fl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>zt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>zt){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function zl(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return yl(i,n);const o=vl(t,r,i);return ml(new e(o,s,a),i,2),o}}const jl=zl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:Fl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const Hl=zl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:Fl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class Vl extends nl{constructor(t,e,i){super(),this.type=Jo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return hl(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,rl([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===Zo.ROW?Ut(this.p0.x-this.p2.x):t===Zo.COLUMN?Ut(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Yt(t-.01,0),i=$t(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Wt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=hl(i,s,n,e),a=ae.pointAtPP(i,s,e),o=ae.pointAtPP(s,n,e);return[new Vl(i,a,r),new Vl(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Nl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new pl(new re(this._lastX,this._lastY),new re(t,e))}quadraticCurveTo(t,e,i,s){const n=new Vl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new dl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Ul(t,e,i){var s,n;switch(e){case"linear":default:return yl(t,i);case"basis":return Sl(t,i);case"monotoneX":return El(t,i);case"monotoneY":return Bl(t,i);case"step":return Rl(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new gl("step",null!=s?s:Ut(t[t.length-1].x-t[0].x)>Ut(t[t.length-1].y-t[0].y)?Zo.ROW:Zo.COLUMN);return Ol(new Ll(r,e,n),t),r}(t,.5,i);case"stepBefore":return Rl(t,0,i);case"stepAfter":return Rl(t,1,i);case"catmullRom":return jl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return Hl(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return Dl(t,i)}}class Wl extends zo{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Fo(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([Vo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([Vo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([Vo.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([Vo.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([Vo.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([Vo.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([Vo.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([Vo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([Vo.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()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Nl(this);sl(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[Vo.M]=t=>`M${t[1]} ${t[2]}`,t[Vo.L]=t=>`L${t[1]} ${t[2]}`,t[Vo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[Vo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[Vo.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3];((t,e,i,s,n,r,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;e`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[Vo.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,e=Wo;for(let s=1,r=i.length;s{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,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),sl(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Zo.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Ut(t.p0.y-e.p1.y)}if(this.direction===Zo.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Ut(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{ot.getInstance().warn("空函数")}}),lh=Object.assign(Object.assign({},th),{points:[],cornerRadius:0,closePath:!0}),hh=Object.assign(Object.assign({},th),{width:100,height:100,spikes:5,thickness:.5}),ch=Object.assign(Object.assign({},th),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},th),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const dh=Object.assign(Object.assign({},th),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),uh=Object.assign(Object.assign(Object.assign({},th),Zl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),ph=Object.assign(Object.assign(Object.assign({},th),Zl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",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}),gh=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0,maxWidth:500,maxHeight:500},th),{fill:!0,cornerRadius:0,cornerType:"round"}),fh=Object.assign(Object.assign({},gh),{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}),mh=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 m("directional",t.sideOrCorner,1)||m("angular",t.angleValue,1)}function a(){return m("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=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 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=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 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 vh{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(vh.IsGradientStr(t))try{const e=mh(t)[0];if(e){if("linear"===e.type)return vh.ParseLinear(e);if("radial"===e.type)return vh.ParseRadial(e);if("conic"===e.type)return vh.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=jt/2,n=parseFloat(e.value)/180*jt-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Nt,stops:vh.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:vh.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=jt/2;let n="angular"===e.type?parseFloat(e.value)/180*jt:0;for(;n<0;)n+=Nt;for(;n>=Nt;)n-=Nt;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}const bh={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"}},xh=!0,Sh=!1,Ah=/\w|\(|\)|-/,kh=/[.?!,;:/,。?!、;:]/,Mh=/\S/,Th=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function wh(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=Ao.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=Ch(t,a)),a}function Ch(t,e,i=!1){let s=e;for(;Ah.test(t[s-1])&&Ah.test(t[s])||kh.test(t[s]);)if(s--,s<=0)return i?Eh(t,e):e;return s}function Eh(t,e){let i=e;for(;Ah.test(t[i+1])&&Ah.test(t[i])||kh.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Bh(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=Ao.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}var Ph=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Lh=class{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=uh.fontSize}){let i=0,s=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 a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=Ch(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_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){if(s===n){ot.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}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),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);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}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,a=!1){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=Ch(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}};Lh=Ph([qa()],Lh);var Rh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Oh=Symbol.for("TextMeasureContribution");let Ih=class extends Lh{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}};Ih=Rh([qa()],Ih);const Dh=Symbol.for("CanvasFactory"),Fh=Symbol.for("Context2dFactory");function zh(t){return xo.getNamed(Dh,Ao.global.env)(t)}const jh=1e-4,Hh=Math.sqrt(3),Vh=1/3;function Nh(t){return t>-ec&&tec||t<-ec}const Wh=[0,0],Gh=[0,0],Yh=[0,0];function $h(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Xh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function Kh(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 qh(t){return(t%=Nt)<0&&(t+=Nt),t}function Zh(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+=Nt);let d=Math.atan2(l,o);return d<0&&(d+=Nt),d>=s&&d<=n||d+Nt>=s&&d+Nt<=n}function tc(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(Nh(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 sc=[-1,-1,-1],nc=[-1,-1];function rc(){const t=nc[0];nc[0]=nc[1],nc[1]=t}function ac(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(Nh(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,Vh):Math.pow(i,Vh),s=s<0?-Math.pow(-s,Vh):Math.pow(s,Vh);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+Hh*Math.sin(e)))/(3*a),h=(-o+i*(s-Hh*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,sc);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&rc(),p=Kh(e,s,r,o,nc[0]),u>1&&(g=Kh(e,s,r,o,nc[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Nh(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,sc);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=Xh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);sc[0]=-l,sc[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Nt-1e-4){s=0,n=Nt;const e=r?1:-1;return a>=sc[0]+t&&a<=sc[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Nt,n+=Nt);let c=0;for(let e=0;e<2;e++){const i=sc[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Nt+t),(t>=s&&t<=n||t+Nt>=s&&t+Nt<=n)&&(t>jt/2&&t<1.5*jt&&(e=-e),c+=e)}}return c}function hc(t){return Math.round(t/jt*1e8)/1e8%2*jt}function cc(t,e){let i=hc(t[0]);i<0&&(i+=Nt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Nt?n=i+Nt:e&&i-n>=Nt?n=i-Nt:!e&&i>n?n=i+(Nt-hc(i-n)):e&&i1&&(i||(h+=Re(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],v=a[2],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,A=b;dc[0]=S,dc[1]=A,cc(dc,Boolean(a[6])),S=dc[0],A=dc[1];const k=S,M=A-S,T=!!(1-(a[6]?0:1)),w=(s-m)*_/_+m;switch(f){case Vo.M:u=m,p=v,c=u,d=p;break;case Vo.L:if(i){if(tc(c,d,m,v,e,s,n))return!0}else h+=Re(c,d,m,v,s,n)||0;c=m,d=v;break;case Vo.C:if(i){if(Jh(c,d,m,v,_,y,b,x,e,s,n))return!0}else h+=ac(c,d,m,v,_,y,b,x,s,n)||0;c=b,d=x;break;case Vo.Q:if(i){if(Zh(c,d,m,v,_,y,e,s,n))return!0}else h+=oc(c,d,m,v,_,y,s,n)||0;c=_,d=y;break;case Vo.A:if(o=Math.cos(k)*_+m,l=Math.sin(k)*_+v,g?(u=o,p=l):h+=Re(c,d,o,l,s,n),i){if(Qh(m,v,_,k,k+M,T,e,w,n))return!0}else h+=lc(m,v,_,k,k+M,T,w,n);c=Math.cos(k+M)*_+m,d=Math.sin(k+M)*_+v;break;case Vo.R:if(u=c=m,p=d=v,o=u+_,l=p+y,i){if(tc(u,p,o,p,e,s,n)||tc(o,p,o,l,e,s,n)||tc(o,l,u,l,e,s,n)||tc(u,l,u,p,e,s,n))return!0}else h+=Re(o,p,o,l,s,n),h+=Re(u,l,u,p,s,n);break;case Vo.Z:if(i){if(tc(c,d,u,p,e,s,n))return!0}else h+=Re(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},fc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const mc=Symbol.for("VWindow"),vc=Symbol.for("WindowHandlerContribution");let _c=class extends To{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(){super(),this.hooks={onChange:new _o(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(xo.getNamed(vc,t.env).configure(this,t),this.actived=!0)},this._uid=Da.GenAutoIncrementId(),this.global=Ao.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}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.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}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)}};_c=gc([qa(),fc("design:paramtypes",[])],_c);var yc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xc=function(t,e){return function(i,s){e(i,s,t)}};let Sc=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=Ao.global,this._textMeasureMap=new Map,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}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||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=pc.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="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:Zl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Fe(Object.assign({defaultFontParams:{fontFamily:Zl.fontFamily,fontSize:Zl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=xo.get(mc),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 Ac;Sc=yc([qa(),xc(0,Xa(po)),xc(0,Za(Oh)),bc("design:paramtypes",[Object])],Sc),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Ac||(Ac={}));const kc=new We;let Mc=class{constructor(){this.matrix=new We}init(t){return this.mode=Ac.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Ac.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(kc.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(kc.a,kc.b,kc.c,kc.d,kc.e,kc.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(kc.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(kc.a,kc.b,kc.c,kc.d,kc.e,kc.f),this}scale(t,e,i){return this.mode===Ac.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Ac.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return kc.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(kc.a,kc.b,kc.c,kc.d,kc.e,kc.f),this}translate(t,e){return this.mode===Ac.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Ac.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Mc=yc([qa(),bc("design:paramtypes",[])],Mc);const Tc={arc:eh,area:ih,circle:sh,line:ah,path:oh,symbol:dh,text:uh,rect:ch,polygon:lh,star:hh,richtext:ph,richtextIcon:fh,image:gh,group:nh,glyph:rh},wc=Object.keys(Tc);function Cc(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Ec={arc:Object.assign({},Tc.arc),area:Object.assign({},Tc.area),circle:Object.assign({},Tc.circle),line:Object.assign({},Tc.line),path:Object.assign({},Tc.path),symbol:Object.assign({},Tc.symbol),text:Object.assign({},Tc.text),rect:Object.assign({},Tc.rect),polygon:Object.assign({},Tc.polygon),star:Object.assign({},Tc.star),richtext:Object.assign({},Tc.richtext),richtextIcon:Object.assign({},Tc.richtextIcon),image:Object.assign({},Tc.image),group:Object.assign({},Tc.group),glyph:Object.assign({},Tc.glyph)};class Bc{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},wc.forEach((t=>{this._defaultTheme[t]=Object.create(Ec[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,i=!1){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,ot.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;wc.forEach((s=>{const n=Object.create(Ec[s]);t&&t[s]&&Cc(n,t[s]),i[s]&&Cc(n,i[s]),e[s]&&Cc(n,e[s]),this.combinedTheme[s]=n})),e.common&&wc.forEach((t=>{Cc(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 Pc=new Bc;function Lc(t,e){return t.glyphHost?Lc(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)):Pc.getTheme()}return null}(t)||t.attachedThemeGraphic&&Lc(t.attachedThemeGraphic)||Pc.getTheme()}var Rc=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 Oc 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=Da.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){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,e=!1){return Rc(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,e=!0){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,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)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===t||t===e)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&&ot.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)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,e=!1){let 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,e=!1){let 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,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Fc))return void ot.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(Vc(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 Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=Vc(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 Fc))return void ot.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=Vc(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 Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=Vc(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 Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=Hc.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Vc(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(Vc(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,Vc(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(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 Fc))return void ot.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"):Vc(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 zc))return void ot.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=Hc.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.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),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,supportsTouchEvents:o}),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 Fc,this.rootWheelEvent=new zc,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.addEventListener("pointermove",this.onPointerMove,!0),t.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.addEventListener("mousemove",this.onPointerMove,!0),t.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.removeEventListener("pointermove",this.onPointerMove,!0),t.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.removeEventListener("mousemove",this.onPointerMove,!0),t.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 Yc{static GetImage(t,e){var i;const s=Yc.cache.get(t);s?"fail"===s.loadState?Ao.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):Yc.loadImage(t,e)}static GetSvg(t,e){var i;let s=Yc.cache.get(t);s?"fail"===s.loadState?Ao.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"},Yc.cache.set(t,s),s.dataPromise=Ao.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.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Yc.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Yc.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Ao.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Ao.global.loadBlob(t):"json"===e&&(i.dataPromise=Ao.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Yc.isLoading&&Yc.toLoadAueue.length){Yc.isLoading=!0;const t=Yc.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Yc.cache.set(i,n),n.dataPromise=Ao.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))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Yc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Yc.loading()})).catch((t=>{console.error(t),Yc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Yc.loading()}))}}),0)}static loadImage(t,e){const i=$c(t,Yc.toLoadAueue);if(-1!==i)return Yc.toLoadAueue[i].marks.push(e),void Yc.loading();Yc.toLoadAueue.push({url:t,marks:[e]}),Yc.loading()}static improveImageLoading(t){const e=$c(t,Yc.toLoadAueue);if(-1!==e){const t=Yc.toLoadAueue.splice(e,1);Yc.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function $c(t,e){for(let i=0;it?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(qc[0]=t[0],qc[2]=t[0],qc[1]=t[1],qc[3]=t[1],qc):t:t:0,Jc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Qc=[1,2,3,0,1,2,3,0];function td(t,e,i,s){for(;t>=Nt;)t-=Nt;for(;t<0;)t+=Nt;for(;t>e;)e+=Nt;Jc[0].x=i,Jc[1].y=i,Jc[2].x=-i,Jc[3].y=-i;const n=Math.ceil(t/Ht)%4,r=Math.ceil(e/Ht)%4;if(s.add(Gt(t)*i,Xt(t)*i),s.add(Gt(e)*i,Xt(e)*i),n!==r||e-t>jt){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{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)}}nd.TimeOut=1e3/60;const rd=new nd,ad=(t,e)=>{const i=((t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};class od{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}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function ld(t,e,i,s,n){return n?t.arc(i,s,e,0,Vt,!1,n):t.arc(i,s,e,0,Vt),!1}var hd=new class extends od{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 ld(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return ld(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(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 cd=new class extends od{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,this.parseSize(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,this.parseSize(e)/6,i,s,n,r)}};function dd(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 ud=new class extends od{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 dd(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return dd(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return dd(t,this.parseSize(e)/2+n,i,s,r)}};function pd(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var gd=new class extends od{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return pd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return pd(t,this.parseSize(e)/2+n,i,s)}};function fd(t,e,i,s,n=0){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}class md extends od{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 fd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return fd(t,this.parseSize(e)/2,i,s,n)}}var vd=new md;var _d=new class extends md{constructor(){super(...arguments),this.type="triangle"}};const yd=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),bd=Math.sin(Vt/10)*yd,xd=-Math.cos(Vt/10)*yd;function Sd(t,e,i,s){const n=bd*e,r=xd*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Vt*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 Ad=new class extends od{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 Sd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Sd(t,this.parseSize(e)/2+n,i,s)}};const kd=Kt(3);function Md(t,e,i,s){const n=e,r=n/kd,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 Td=new class extends od{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 Md(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Md(t,this.parseSize(e)/2+n,i,s)}};function wd(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 Cd=new class extends od{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return wd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return wd(t,this.parseSize(e)/2+n,i,s)}};function Ed(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Bd=new class extends od{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Ed(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ed(t,this.parseSize(e)/2+n,i,s)}};const Pd=-.5,Ld=Kt(3)/2,Rd=1/Kt(12);function Od(t,e,i,s){const n=e/2,r=e*Rd,a=n,o=e*Rd+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(Pd*n-Ld*r+i,Ld*n+Pd*r+s),t.lineTo(Pd*a-Ld*o+i,Ld*a+Pd*o+s),t.lineTo(Pd*l-Ld*h+i,Ld*l+Pd*h+s),t.lineTo(Pd*n+Ld*r+i,Pd*r-Ld*n+s),t.lineTo(Pd*a+Ld*o+i,Pd*o-Ld*a+s),t.lineTo(Pd*l+Ld*h+i,Pd*h-Ld*l+s),t.closePath(),!1}var Id=new class extends od{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 Od(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Od(t,this.parseSize(e)/2+n,i,s)}};function Dd(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}var Fd=new class extends od{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 Dd(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Dd(t,this.parseSize(e)/2,i,s,n)}};function zd(t,e,i,s,n=0){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}var jd=new class extends od{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 zd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return zd(t,this.parseSize(e)/2,i,s,n)}};function Hd(t,e,i,s,n=0){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}var Vd=new class extends od{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 Hd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Hd(t,this.parseSize(e)/2,i,s,n)}};const Nd=Kt(3);function Ud(t,e,i,s){const n=e*Nd;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var Wd=new class extends od{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Ud(t,this.parseSize(e)/2/Nd,i,s)}drawOffset(t,e,i,s,n){return Ud(t,this.parseSize(e)/2/Nd+n,i,s)}};function Gd(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 Yd=new class extends od{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 Gd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Gd(t,this.parseSize(e)/4+n,i,s)}};function $d(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 Xd=new class extends od{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 $d(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return $d(t,this.parseSize(e)/4+n,i,s)}};function Kd(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 qd=new class extends od{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 Kd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Kd(t,this.parseSize(e)/4+n,i,s)}};function Zd(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 Jd=new class extends od{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 Zd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Zd(t,this.parseSize(e)/4+n,i,s)}};function Qd(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var tu=new class extends od{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return Qd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Qd(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function eu(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var iu=new class extends od{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return eu(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return eu(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function su(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 nu=new class extends od{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 su(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return su(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function ru(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function au(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var ou=new class extends od{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)?au(t,e,i,s):ru(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?au(t,e+2*n,i,s):ru(t,[e[0]+2*n,e[1]+2*n],i,s)}};const lu=new Ne;class hu{constructor(t,e,i=!1){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 e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),sl(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(sl(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{lu.x1=i.bounds.x1*t,lu.y1=i.bounds.y1*t,lu.x2=i.bounds.x2*t,lu.y2=i.bounds.y2*t,e.union(lu)}))}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 cu={};[hd,cd,ud,gd,Wd,_d,Ad,Td,Cd,Bd,Id,Fd,jd,vd,Vd,Yd,Xd,qd,Jd,ou,tu,iu,nu].forEach((t=>{cu[t.type]=t}));const du={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"};class uu{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 pu(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function gu(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",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=gu(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=pu(t,"--\x3e",r+4,"Comment is not closed.");else{const a=gu(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 uu(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 uu(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 vu(t,e){return _u(t)}function _u(t,e){const i={};for(let e=0;ewu.set(t,!0)));const Cu=new Map;function Eu(t){if(wu.has(t))return!0;if(Cu.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>Cu.set(t,!0)));const Bu=Mu(),Pu=Mu(),Lu=Mu(),Ru=Mu(),Ou=Mu(),Iu=Mu(),Du=Mu(),Fu=Mu(),zu=Mu(),ju=Mu();Mu();const Hu=Mu();Mu();const Vu=Mu();Mu();const Nu=Mu(),Uu=Mu(),Wu=Symbol.for("GraphicService"),Gu=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"},$u=Object.keys(Yu),Xu={duration:200,easing:"cubicOut"};function Ku(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}function qu(t,e,i){const s=i[0],n=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]*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],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*s+c*n+g*r+e[12],t[13]=o*s+d*n+f*r+e[13],t[14]=l*s+u*n+m*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function Zu(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 Ju(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],f=e[12],m=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*f,t[1]=y*n+b*l+x*u+S*m,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*f,t[5]=y*n+b*l+x*u+S*m,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*f,t[9]=y*n+b*l+x*u+S*m,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*f,t[13]=y*n+b*l+x*u+S*m,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function Qu(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 tp{constructor(){this.pools=[]}static identity(t){return Ku(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 tp.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},np=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const rp=new We(1,0,0,1,0,0),ap={x:0,y:0};let op=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new We(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new We(1,0,0,1,0,0),this.path=new Wl,this._clearMatrix=new We(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return ep.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new We(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(ep.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(ep.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){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,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=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(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){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},ap),function(t,e,i){return uc(t,0,!1,e,i)}(this.path.commandList,ap.x,ap.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},ap);const i=_h(this,this.lineWidth,this.dpr);return function(t,e,i,s){return uc(t,e,!0,i,s)}(this.path.commandList,i,ap.x,ap.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(t=!0,e=this.dpr){this.setTransformFromMatrix(rp,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>ep.free(t))),this.stack.length=0}};op=sp([qa(),np("design:paramtypes",[Object,Number])],op);const lp={WIDTH:500,HEIGHT:500,DPR:1};class hp{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}set nativeCanvas(t){this._nativeCanvas=t}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=lp.WIDTH,height:n=lp.HEIGHT,dpr:r=lp.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(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var cp;hp.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(cp||(cp={}));class dp{static Get(t,e=cp.Color1,i=[0,0,0,1]){if(e===cp.Color1){const e=dp.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ii.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];dp.store1[t]=e,dp.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=dp.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ii.parseColorString(t);return n&&(dp.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],dp.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===cp.Color1){if(dp.store1[t])return;dp.store1[t]=i,dp.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(dp.store255[t])return;dp.store255[t]=i,dp.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function up(t,e=!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 pp(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)=>{var a,o;return gp(y(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,y(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):gp(t,e,i,s,n)}function gp(t,e,i,s,n){if(!t||!e)return t&&up(t)||e&&up(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=dp.Get(t,cp.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=dp.Get(e,cp.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:up(a)})))});return o?pp(r,l,i,s,n):pp(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:_p(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:_p(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:_p(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),up(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)}function fp(t,e,i){return`rgba(${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})`}dp.store255={},dp.store1={};const mp=[0,0,0,0],vp=[0,0,0,0];function _p(t,e,i){return dp.Get(t,cp.Color255,mp),dp.Get(e,cp.Color255,vp),`rgba(${Math.round(mp[0]+(vp[0]-mp[0])*i)},${Math.round(mp[1]+(vp[1]-mp[1])*i)},${Math.round(mp[2]+(vp[2]-mp[2])*i)},${mp[3]+(vp[3]-mp[3])*i})`}class yp{static GetCanvas(){try{return yp.canvas||(yp.canvas=Ao.global.createCanvas({})),yp.canvas}catch(t){return null}}static GetCtx(){if(!yp.ctx){const t=yp.GetCanvas();yp.ctx=t.getContext("2d")}return yp.ctx}}class bp extends Ge{static getInstance(){return bp._instance||(bp._instance=new bp),bp._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=yp.GetCanvas(),s=yp.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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new bp(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class xp{static GetSize(t){for(let e=0;e=t)return xp.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=xp.GenKey(t,e,i,s,n),l=xp.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=xp.GenKey(t,e,i,s,n);xp.cache[l]?xp.cache[l].push({width:a,height:o,pattern:r}):xp.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}xp.cache={},xp.ImageSize=[20,40,80,160,320,640,1280,2560];const Sp=new Ne,Ap=new We;new Ne;const kp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],Mp=["x","y"],Tp=["scaleX","scaleY"],wp=["angle"],Cp=new re,Ep={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Bp extends Oc{static mixin(t){const e=Object.keys(t);for(let i=0;i10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=cu[t];if(e)return e;if(e=Bp.userSymbolMap[t],e)return e;if(!0===((i=t=du[t]||t).startsWith("{const e=(new Wl).fromString(t.d),i={};$u.forEach((e=>{t[e]&&(i[Yu[e]]=t[e])})),n.push({path:e,attribute:i}),Sp.union(e.bounds)}));const r=Sp.width(),a=Sp.height(),o=1/Yt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new hu(t,n,!0);return Bp.userSymbolMap[t]=l,l}var i;const s=(new Wl).fromString(t),n=s.bounds.width(),r=s.bounds.height(),a=1/Yt(n,r);s.transform(0,0,a,a);const o=new hu(t,s);return Bp.userSymbolMap[t]=o,o}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,s=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:n=e.boundsPadding}=i,r=Zc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new Fo(t);return sl(e.commandList,i,0,0),!0}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(t=!0){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(t=!0){return this._transMatrix||(this._transMatrix=new We),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&Xo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&Xo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&Xo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&Xo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&Xo.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&Xo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=Xo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===Ko.GLOBAL){const i=new re(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){this.setAttributes(t,e,i),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||s)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,i){t&&((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,e=!1,i){const s=Object.keys(t);for(let e=0;e{i[e]?(o||(o={}),o[e]=t[e]):a[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(r=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==r?r:Xu;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:a,duration:l.duration,easing:l.easing}}]),o&&this.setAttributesAndPreventAnimate(o,!1,{type:qo.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t)}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:qo.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{type:qo.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(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,i;const s=this.attribute[t];return this.animates&&this.animates.size?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=s?s:null===(i=this.finalAttribute)||void 0===i?void 0:i[t]}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){const i=y(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);s.length!==this.currentStates.length&&this.useStates(s,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;this.stateSort&&(t=t.sort(this.stateSort));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|=Xo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=Xo.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=Xo.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&Xo.UPDATE_SHAPE_AND_BOUNDS)===Xo.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=Xo.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Xo.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Xo.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=Xo.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=Xo.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=Xo.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=Xo.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&Xo.UPDATE_LAYOUT)}getAnchor(t,e,i){const s=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=$l.x,y:e=$l.y,scaleX:i=$l.scaleX,scaleY:s=$l.scaleY,angle:n=$l.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(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=Gt(a),f=Xt(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const _=m-i,y=v-s,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,A=d*g-h*f;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*A,t.e=u+l*m+c*v-b*_-S*y,t.f=p+h*m+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,!0),Ao.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY($l);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Ap.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.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:qo.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Ao.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),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 Wl).fromString(t):this.pathProxy=new Wl,this.pathProxy}loadImage(t,e=!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(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",this.stopAnimates(),Ao.graphicService.onRelease(this),super.release()}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new jc(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)}}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||Ao.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new op(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}var Pp;Bp.userSymbolMap={},Bp.mixin(Uc),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Pp||(Pp={}));let Lp=class t extends Bp{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Iu,this._childUpdateTag=Xo.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 Bc),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Bc)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===Ko.GLOBAL){const i=new re(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&Xo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=$l.x,y:e=$l.y,dx:i=$l.dx,dy:s=$l.dy,scaleX:n=$l.scaleX,scaleY:r=$l.scaleY,angle:a=$l.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()}getGraphicTheme(){return Lc(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return Ao.graphicService.updateTempAABBBounds(i),Ao.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=Xo.CLEAR_BOUNDS,this._childUpdateTag&=Xo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=Xo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&Xo.UPDATE_BOUNDS||(this._childUpdateTag|=Xo.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(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().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),this.getGraphicService().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(t=!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&Xo.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=Ao.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}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}};function Rp(t){return new Lp(t)}Lp.NOWORK_ANIMATE_ATTR=Ep;class Op extends Lp{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 Bc,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!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=>{Ao.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=>{Ao.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 Ip=Symbol.for("TransformUtil"),Dp=Symbol.for("GraphicUtil"),Fp=Symbol.for("LayerService"),zp=Symbol.for("StaticLayerHandlerContribution"),jp=Symbol.for("DynamicLayerHandlerContribution"),Hp=Symbol.for("VirtualLayerHandlerContribution");var Vp,Np=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)};let Wp=Vp=class{static GenerateLayerId(){return`${Vp.idprefix}_${Vp.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Ao.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?xo.get(zp):"dynamic"===t?xo.get(jp):xo.get(Hp),e}createLayer(t,e={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 Op(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Vp.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)}};Wp.idprefix="visactor_layer",Wp.prefix_count=0,Wp=Vp=Np([qa(),Up("design:paramtypes",[])],Wp);var Gp=new Fa((t=>{t(bo).to(Po).inSingletonScope(),t(mc).to(_c),t(Dp).to(Sc).inSingletonScope(),t(Ip).to(Mc).inSingletonScope(),t(Fp).to(Wp).inSingletonScope()}));function Yp(t,e){return!(!t&&!e)}function $p(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Xp(t,e,i){return i&&t*e>0}function Kp(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function qp(t,e){return t*e>0}function Zp(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Jp(t,e,i,s,n,r,a){const o=t-i,l=e-s,h=(a?r:-r)/Math.sqrt(o*o+l*l),c=h*l,d=-h*o,u=t+c,p=e+d,g=i+c,f=s+d,m=(u+g)/2,v=(p+f)/2,_=g-u,y=f-p,b=_*_+y*y,x=n-r,S=u*f-g*p,A=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let k=(S*y-_*A)/b,M=(-S*_-y*A)/b;const T=(S*y+_*A)/b,w=(-S*_+y*A)/b,C=k-m,E=M-v,B=T-m,P=w-v;return C*C+E*E>B*B+P*P&&(k=T,M=w),{cx:k,cy:M,x01:-c,y01:-d,x11:k*(n/x-1),y11:M*(n/x-1)}}function Qp(t,e,i,s,n){const r=Ut(i-e),a=t.getParsedCornerRadius(),o=y(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,_=Math.max(f,g),b=Math.max(m,v);let x=_,S=b;const A=n*Gt(c),k=n*Xt(c),M=s*Gt(u),T=s*Xt(u);let w,C,E,B;if((b>zt||_>zt)&&(w=n*Gt(d),C=n*Xt(d),E=s*Gt(p),B=s*Xt(p),r1?0:P<-1?jt:Math.acos(P))/2),l=Kt(t[0]*t[0]+t[1]*t[1]);S=$t(b,(s-l)/(o-1)),x=$t(_,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:E,yirs:B,xore:w,yore:C,xire:M,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:_,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function tg(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ut(l-o),c=l>o;let d=!1;if(n=Nt-zt)e.moveTo(i+n*Gt(o),s+n*Xt(o)),e.arc(i,s,n,o,l,!c),r>zt&&(e.moveTo(i+r*Gt(l),s+r*Xt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:M,limitedIcr:T,innerDeltaAngle:w,innerEndAngle:C,innerStartAngle:E,innerCornerRadiusStart:B,innerCornerRadiusEnd:P,maxInnerCornerRadius:L}=Qp(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>zt){const t=$t(v,m),r=$t(_,m),o=Jp(g,f,u,p,n,t,Number(c)),l=Jp(b,x,S,A,n,r,Number(c));m0&&e.arc(i+o.cx,s+o.cy,t,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,n,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Gt(Wt(l.y01,l.x01)),s+l.cy+r*Xt(Wt(l.y01,l.x01))):e.moveTo(i+b,s+n*Xt(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,M,!c)):e.moveTo(i+n*Gt(M),s+n*Xt(M));if(!(r>zt)||w<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(T>zt){const t=$t(B,T),n=$t(P,T),o=Jp(S,A,b,x,r,-n,Number(c)),l=Jp(u,p,g,f,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,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,r,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Gt(Wt(l.y01,l.x01)),s+l.cy+t*Xt(Wt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),!a||a[2]?e.arc(i,s,r,C,E,c):e.moveTo(i+r*Gt(E),s+r*Xt(E))}return a?a[3]&&e.lineTo(i+n*Gt(o),s+n*Xt(o)):e.closePath(),d}const eg=Symbol.for("ArcRenderContribution"),ig=Symbol.for("AreaRenderContribution"),sg=Symbol.for("CircleRenderContribution"),ng=Symbol.for("GroupRenderContribution"),rg=Symbol.for("ImageRenderContribution"),ag=Symbol.for("PathRenderContribution"),og=Symbol.for("PolygonRenderContribution"),lg=Symbol.for("RectRenderContribution"),hg=Symbol.for("SymbolRenderContribution"),cg=Symbol.for("TextRenderContribution"),dg=Symbol.for("InteractiveSubRenderContribution");function ug(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function pg(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}var gg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mg=function(t,e){return function(i,s){e(i,s,t)}};function vg(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:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:v}=e.attribute,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(s=m[2])&&void 0!==s?s:0}if(Ku(t),qu(t,t,[n+o,r+l,a+h]),qu(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),qu(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]),f){const i=ip.allocate(),s=[0,0];if(v){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=m[1]}qu(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,f),qu(i,i,[-s[0],-s[1],0]),Ju(t,t,i)}}let _g=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new _o(["graphic"]),onSetStage:new _o(["graphic","stage"]),onRemove:new _o(["graphic"]),onRelease:new _o(["graphic"]),onAddIncremental:new _o(["graphic","group","stage"]),onClearIncremental:new _o(["graphic","group","stage"]),beforeUpdateAABBBounds:new _o(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new _o(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new _o(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ne,this.tempAABBBounds2=new Ne}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)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new Fo(t);return sl(i.commandList,s,0,0),!0}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=pg(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=ug(n,e);i.set(s,i.y1,s+e,i.y2)}}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){Au(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;Au(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&&He(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};_g=gg([qa(),mg(0,Xa(Gu)),fg("design:paramtypes",[Object])],_g);const yg=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},bg=["radius","startAngle","endAngle",...kp];class xg extends Bp{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=Ru}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)}getGraphicTheme(){return Lc(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Ao.graphicService.updateTempAABBBounds(i);return yg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Nt-zt?i.set(-r,-r,r,r):td(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,bg)}needUpdateTag(t){return super.needUpdateTag(t,bg)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Wl,s.arc(0,0,r,a,o),s}clone(){return new xg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return xg.NOWORK_ANIMATE_ATTR}}function Sg(t){return new xg(t)}xg.NOWORK_ANIMATE_ATTR=Ep;class Ag{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Lo.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,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;a{t+=e.str})),(Array.isArray(r)?r.join(""):r).toString()!==t}return"vertical"===s.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==s.text.toString():null!=this.clipedText&&this.clipedText!==s.text.toString()}get multilineLayout(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=Uu,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}getGraphicTheme(){return Lc(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new Mg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Te(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=Ao.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Au(n,o/Math.abs(r+a),!0,l),i.union(n)}return Ao.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Ao.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,He(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:_=s.ignoreBuf,keepCenterInLine:y=s.keepCenterInLine}=n,b=_?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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(f/2),this._AABBBounds}const S=Ao.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new Ag(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:y}),{bbox:k}=A;return this.cache.layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{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,measureMode:v=r.measureMode,suffixPosition:_=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),k=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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 M=Ao.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),T={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:k},w=new Ag(a,T,M),C=y(t)?t.map((t=>t.toString())):[t.toString()],E=[],B=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/k),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),B[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const t=ug(_,a),e=this.cache.verticalList.length*v,i=pg(y,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>function(t){const e=[];let i=0,s="";for(let n=0;n{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===Tu.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))})),this.cache.verticalList=b,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const x=ug(_,a),S=this.cache.verticalList.length*v,A=pg(y,S,d);return this._AABBBounds.set(A,x,A+S,x+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=ad(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=kg){return super.needUpdateTags(t,e)}needUpdateTag(t,e=kg){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new Mg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Mg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return Mg.baselineMapAlign}getAlignMapBaseline(){return Mg.alignMapBaseline}}function Tg(t){return new Mg(t)}Mg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Ep),Mg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},Mg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const wg=["symbolType","size",...kp];let Cg=class t extends Bp{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=Nu}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}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{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return Lc(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Ao.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Au(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(y(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){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,wg)}needUpdateTag(t){return super.needUpdateTag(t,wg)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new Wl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Wl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Eg(t){return new Cg(t)}Cg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Ep);const Bg=["segments","points","curveType","curveTension",...kp];let Pg=class t extends Bp{constructor(t={}){super(t),this.type="line",this.numberType=Fu}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=id(i,s,e))}getGraphicTheme(){return Lc(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),Ao.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Bg)}needUpdateTag(t){return super.needUpdateTag(t,Bg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Wl;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Lg(t){return new Pg(t)}Pg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ep);const Rg=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}},Og=["width","x1","y1","height","cornerRadius",...kp];class Ig extends Bp{constructor(t){super(t),this.type="rect",this.numberType=Hu}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Lc(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=Ao.graphicService.updateTempAABBBounds(i);return yg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Og)}needUpdateTag(t){return super.needUpdateTag(t,Og)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=Rg(e);return t=new Wl,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new Ig(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ig.NOWORK_ANIMATE_ATTR}}function Dg(t){return new Ig(t)}Ig.NOWORK_ANIMATE_ATTR=Ep;class Fg extends Bp{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,e=!1,i){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}getGraphicTheme(){return Lc(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}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(),this.stateSort&&(t=t.sort(this.stateSort));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.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Fg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Fg.NOWORK_ANIMATE_ATTR}}function zg(t){return new Fg(t)}Fg.NOWORK_ANIMATE_ATTR=Ep;class jg{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=bh[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}}}function Hg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Vg{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=ad(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Bh(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||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,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r: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}=Bh(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=wh(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Bh(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=Hg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=wh(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Bh(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&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=wh(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Bh(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const Ng=["width","height","image",...kp];class Ug extends Bp{constructor(t){super(t),this.type="image",this.numberType=Du,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}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()})),this.addUpdateBoundTag()}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)}getGraphicTheme(){return Lc(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=Ao.graphicService.updateTempAABBBounds(i);return yg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return gh[t]}needUpdateTags(t){return super.needUpdateTags(t,Ng)}needUpdateTag(t){return super.needUpdateTag(t,Ng)}clone(){return new Ug(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ug.NOWORK_ANIMATE_ATTR}}function Wg(t){return new Ug(t)}Ug.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Ep);class Gg extends Ug{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=Zc(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=Zc(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=gh.width,height:e=gh.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 Yg{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 Gg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=bh[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Vg){const e=Mh.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,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Gg)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Bh(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Gg)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Gg)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||Sh;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,Th(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||xh;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?yh(t,s,{AABBBounds:i}):s,Th(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Gg)break;const{width:n}=Bh(t,s.character,s.ascentDescentMode),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.forEach(((t,e)=>{i+=t instanceof Gg?t.width:t.getWidthWithEllips(this.direction)})),i}}class $g{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=bh[this.direction]}store(t){if(t instanceof Gg){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 Yg(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,e=!1){t instanceof Gg?"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||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=wh(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Vg(i,t.newLine,t.character,t.ascentDescentMode),new Vg(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Xg=!1;try{Xg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Xg=!1}const Kg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...kp];class qg extends Bp{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Vu,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:ph.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:ph.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:ph.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:ph.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:ph.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:ph.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:ph.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:ph.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Lc(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&_(t.text)&&qg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&_(t.text)&&qg.splitText(t.text).length>1)))}static splitText(t){if(Xg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=qg.splitText(t.text.toString());if(_(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),Ao.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Ao.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Kg)}needUpdateTag(t){return super.needUpdateTag(t,Kg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!qg.AllSingleCharacter(_)&&(_=qg.TransformTextConfig2SingleCharacter(_),this.attribute.textConfig=_);const y=[],b=null!=t?t:_;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,y.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),M="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),T=new jg(0,0,(k?n:x?i:0)||0,(M?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&x,!M&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),w=new $g(T);if(w.newLine=v,p){let t=0,e=!1;for(let i=0;i{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new qg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(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())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return qg.NOWORK_ANIMATE_ATTR}}function Zg(t){return new qg(t)}qg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Ep);const Jg=["path","customPath",...kp];class Qg extends Bp{constructor(t){super(t),this.type="path",this.numberType=zu}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=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Wl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Wl?this.cache:t.path)}getGraphicTheme(){return Lc(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=Ao.graphicService.updateTempAABBBounds(i);yg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new Wl).fromString(t.path):t.customPath&&(this.cache=new Wl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,Jg)}needUpdateTag(t){return super.needUpdateTag(t,Jg)}toCustomPath(){return(new Wl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Qg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Qg.NOWORK_ANIMATE_ATTR}}function tf(t){return new Qg(t)}Qg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Ep);const ef=["segments","points","curveType","curveTension",...kp];class sf extends Bp{constructor(t){super(t),this.type="area",this.numberType=Lu}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}getGraphicTheme(){return Lc(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),Ao.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),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}_interpolate(t,e,i,s,n){"points"===t&&(n.points=id(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,ef)}needUpdateTag(t){return super.needUpdateTag(t,ef)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Wl;const 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 sf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return sf.NOWORK_ANIMATE_ATTR}}function nf(t){return new sf(t)}sf.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ep);const rf=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...kp];class af extends Bp{constructor(t){super(t),this.type="arc",this.numberType=Bu}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=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(y(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();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=he(e),i=e+r,s&&Ut(r)zt&&o>zt)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=this.getGraphicTheme(),{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=Kt(a*a+o*o)}=this.attribute,h=Ut(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>zt&&l>zt){const i=e>t?1:-1;let s=Zt(Number(l)/o*Xt(g)),n=Zt(Number(l)/a*Xt(g));return(f-=2*s)>zt?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>zt?(n*=i,c+=n,d-=n):(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}}getGraphicTheme(){return Lc(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Ao.graphicService.updateTempAABBBounds(i);yg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=zt?i.set(0,0,0,0):Math.abs(o-l)>Nt-zt?i.set(-s,-s,s,s):(td(l,o,s,i),td(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,rf)}needUpdateTag(t){return super.needUpdateTag(t,rf)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Ut(o-a),d=o>a;if(h=Nt-zt)n.moveTo(0+h*Gt(a),0+h*Xt(a)),n.arc(0,0,h,a,o,!d),l>zt&&(n.moveTo(0+l*Gt(o),0+l*Xt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Gt(a),e=h*Xt(a),i=l*Gt(o),s=l*Xt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new af(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return af.NOWORK_ANIMATE_ATTR}}function of(t){return new af(t)}af.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Ep);const lf=["points","cornerRadius",...kp];class hf extends Bp{constructor(t){super(t),this.type="polygon",this.numberType=ju}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Lc(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),Ao.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=id(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,lf)}needUpdateTag(t){return super.needUpdateTag(t,lf)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Wl,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new hf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return hf.NOWORK_ANIMATE_ATTR}}function cf(t){return new hf(t)}hf.NOWORK_ANIMATE_ATTR=Ep;class df extends Lp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!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 uf(t){return new df(t)}const pf=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 gf,ff;function mf(t){return gf||(gf=pf.CreateGraphic("text",{})),gf.initAttributes(t),gf.AABBBounds}var vf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},yf=function(t,e){return function(i,s){e(i,s,t)}};class bf{constructor(){this.time=Qo.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:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit,backgroundKeepAspectRatio:y=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip}=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=Lc(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:_,backgroundKeepAspectRatio:y,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s){const{backgroundMode:n,backgroundFit:r,backgroundKeepAspectRatio:a,backgroundScale:o=1,backgroundOffsetX:l=0,backgroundOffsetY:h=0}=s,c=i.width(),d=i.height();let u=c,p=d;if("no-repeat"===n)if(r)if(a){const s=Math.max(c/e.width,d/e.height);t.drawImage(e,i.x1+l,i.y1+h,e.width*s*o,e.height*s*o)}else t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const s=e.width*o,n=e.height*o;t.drawImage(e,i.x1+l,i.y1+h,s,n)}else{if(r&&"repeat"!==n&&(e.width||e.height)){const i=e.width,s=e.height;"repeat-x"===n?(u=i*(d/s),p=d):"repeat-y"===n&&(p=s*(c/i),u=c);const r=t.dpr,a=pc.allocate({width:u,height:p,dpr:r}),o=a.getContext("2d");o&&(o.inuse=!0,o.clearMatrix(),o.setTransformForCurrent(!0),o.clearRect(0,0,u,p),o.drawImage(e,0,0,u,p),e=a.nativeCanvas),pc.free(a)}const s=t.dpr,a=t.createPattern(e,n);a.setTransform&&a.setTransform(new DOMMatrix([1/s,0,0,1/s,0,0])),t.fillStyle=a,t.translate(i.x1,i.y1),t.fillRect(0,0,c,d),t.translate(-i.x1,-i.y1)}}}const xf=new bf;let Sf=class{constructor(t){this.subRenderContribitions=t,this.time=Qo.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)}))}};Sf=vf([qa(),yf(0,Xa(po)),yf(0,Za(dg)),_f("design:paramtypes",[Object])],Sf);const Af=new class{constructor(){this.time=Qo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),_=t.AABBBounds,y=null!==(p=t.attribute.width)&&void 0!==p?p:_.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:_.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[y,b],i+y/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const kf=new class{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}};class Mf{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=pc.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])),pc.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,Nt),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:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h;const{textureRatio:c=r.textureRatio,textureOptions:d=null}=e.attribute;let u=this.textureMap.get(t);if(!u)switch(t){case"circle":u=this.createCirclePattern(o,l,a,i);break;case"diamond":u=this.createDiamondPattern(o,l,a,i);break;case"rect":u=this.createRectPattern(o,l,a,i);break;case"vertical-line":u=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":u=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":u=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":u=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":u=this.createGridPattern(o,l,a,i)}if(d&&d.dynamicTexture){const{gridConfig:u={},useNewCanvas:p}=d,g=e.AABBBounds;s=g.x1,n=g.y1;const f=i;let m;if(p){m=pc.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=m.getContext("2d");t.clearRect(0,0,g.width(),g.height()),s=0,n=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,s,n,r),f.clip();const v=g.width(),_=g.height(),y=l,b=o,x=u.columns?u.columns:Math.ceil(v/b),S=u.rows?u.rows:Math.ceil(_/b),A=u.gutterColumn?u.gutterColumn:2*y,k=u.gutterRow?u.gutterRow:2*y;this._tempSymbolGraphic||(this._tempSymbolGraphic=Eg({}));const M=u.columns?v/u.columns:b,T=u.rows?_/u.rows:b;this._tempSymbolGraphic.setAttributes({size:[M-A,T-k],symbolType:t});const w=this._tempSymbolGraphic.getParsedPath();for(let t=0;t{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:_h(e,o,e.dpr),c=o/w,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:w+u*h,innerRadius:T-u*h,startAngle:_-u*c,endAngle:y+u*c}),e.beginPath(),tg(t,e,i,s,w+u*h,T-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/A,(S-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder"),t.setAttributes({outerRadius:w,innerRadius:T,startAngle:_,endAngle:y})}},Cf=Tf,Ef=xf;const Bf=new class{constructor(){this.time=Qo.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,f=p&&!1!==p.visible;if(!g&&!f)return;const{radius:m=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,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:_h(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),f&&M(p,"innerBorder")}},Pf=Tf,Lf=xf;const Rf=new class extends bf{constructor(){super(...arguments),this.time=Qo.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,backgroundKeepAspectRatio:f=l.backgroundKeepAspectRatio,backgroundScale:m=l.backgroundScale,backgroundOffsetX:v=l.backgroundOffsetX,backgroundOffsetY:_=l.backgroundOffsetY}=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,{backgroundMode:p,backgroundFit:g,backgroundKeepAspectRatio:f,backgroundScale:m,backgroundOffsetX:v,backgroundOffsetY:_}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Of=jt/2;function If(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=Ut(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Ut(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Ut(t[0]),i=Ut(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Ut(l[0]),l[1]=Ut(l[1]),l[2]=Ut(l[2]),l[3]=Ut(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],_=[c[0],c[1]+g[1]],y=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],x=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!q(v,_)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Of,0,!1)}if(o&&o[1]?o[1](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(y,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Of,!1)}if(o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),!q(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Of,jt,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],jt,jt+Of,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}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};class Ff{constructor(){this.time=Qo.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,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:M,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:w,height:C}=t.attribute;w=(null!=w?w:k-i)||0,C=(null!=C?C:M-s)||0;const E=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=T?h:_h(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||y(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,w-o*g,C-o*g)):(e.beginPath(),If(e,u,p,w-o*g,C-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&E(u,"outerBorder"),f&&E(p,"innerBorder")}}let zf=class{constructor(){this.time=Qo.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)}};zf=Df([qa()],zf);let jf=class{constructor(){this.time=Qo.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:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:_=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||y(v)&&v.every((t=>0===t)))){let n,r=0;return If(e,i,s,b,x,v,"bevel"!==_,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};jf=Df([qa()],jf);const Hf=new Ff,Vf=Tf,Nf=xf;const Uf=new class extends Ff{constructor(){super(...arguments),this.time=Qo.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)}},Wf=xf;const Gf=new class{constructor(){this.time=Qo.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,f=p&&!1!==p.visible,m=g&&!1!==g.visible;if(!f&&!m)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,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,k=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:_h(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(y-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}},Yf=new class{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:_=l.scaleX,scaleY:y=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/_,(f-s)/y,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/_,(f-s)/y,l),e.stroke())))}},$f=Tf,Xf=xf;const Kf={x:0,y:0,z:0,lastModelMatrix:null};class qf{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(Af),this.builtinContributions.push(kf),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===Qo.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Qo.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}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)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Lc(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,_=Xp(d,u,h),y=qp(d,g),b=Yp(h),x=$p(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(_||y||a||o))return!0;e.beginPath();return sl(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),!0}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=Xp(o,l,n),p=qp(o,c),g=Yp(n,r),f=$p(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){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;Kf.x=n,Kf.y=r,Kf.z=a,Kf.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=ip.allocate(),n=ip.allocate();vg(n,t,e),Ju(s,d||s,n),Kf.x=0,Kf.y=0,Kf.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),ip.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Kf.x+=s.x,Kf.y+=s.y,Kf.z=a,i.setTransformForCurrent()}else if(p)Kf.x=0,Kf.y=0,Kf.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Kf.x+=s.x,Kf.y+=s.y,this.transformWithoutTranslate(i,Kf.x,Kf.y,Kf.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Kf.x=0,Kf.y=0,Kf.z=0;return Kf}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,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,_=(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,f,m,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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&ip.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}var Zf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qf=function(t,e){return function(i,s){e(i,s,t)}};let tm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Bu,this.builtinContributions=[wf,Ef,Cf],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=d>c;let p=!1;if(nzt){const t=$t(b,y),r=$t(x,y),a=Jp(v,_,f,m,n,t,Number(u)),o=Jp(A,k,M,T,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,Wt(o.y11,o.x11),Wt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>zt)||C<.001)e.lineTo(i+M,s+T),p=!0;else if(w>zt){const t=$t(B,w),n=$t(P,w),a=Jp(M,T,A,k,r,-n,Number(u)),o=Jp(f,m,v,_,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),w0&&e.arc(i+a.cx,s+a.cy,n,Wt(a.y01,a.x01),Wt(a.y11,a.x11),!u);const t=Wt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Gt(E),s+r*Xt(E));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Lc(t,null==r?void 0:r.theme).arc;const{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:k=l.outerRadius,innerRadius:M=l.innerRadius}=t.attribute;k+=b,M-=x;let T=0;const w=(c(S)&&S||S[0])&&"conical"===h.gradient;if(w){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Ut(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((_||E)&&(e.beginPath(),tg(t,e,i,s,k,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),g?(this._runStroke(t,e,i,s,l,y,E,v,o),this._runFill(t,e,i,s,l,_,m,u,p,a)):(this._runFill(t,e,i,s,l,_,m,u,p,a),this._runStroke(t,e,i,s,l,y,E,v,o))),!E&&y&&(e.beginPath(),tg(t,e,i,s,k,M,B),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(c(S)&&S||S[1])&&A){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Ut(h-r)>=Nt-zt){e.beginPath();const r=Math.abs(k-M)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,M,d,d+r),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o);const u=()=>{if(_){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+=Nt;for(;i>Nt;)i-=Nt;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),pp(o.color,l.color,h,!1)}(0,0,h,n);a||Xp&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}},p=()=>{y&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};u(),p()}}this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),w&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}};tm=Zf([qa(),Qf(0,Xa(po)),Qf(0,Za(eg)),Jf("design:paramtypes",[Object])],tm);var em=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},im=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sm=function(t,e){return function(i,s){e(i,s,t)}};let nm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ru,this.builtinContributions=[Bf,Lf,Pf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Lc(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,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f;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,_,y,m,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{y&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o)}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function rm(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]=cl(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 am(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function om(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=am(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),rm(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=Zo.ROW:"y"===s?u=Zo.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.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 hm=class extends qf{constructor(){super(...arguments),this.numberType=Fu}draw(t,e,i,s){const n=Lc(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 f;if(!e)return;t.beginPath();om(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),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:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!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:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===_)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=Ul(x(t.points,v),_,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===_){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===y){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],y,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=y*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],$t(_,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,y,b,i,s,t,a,o)}};function cm(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),rm(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),rm(t,l,1,s),o=!1):o=!0}t.closePath()}hm=lm([qa()],hm);const dm=new class extends Mf{constructor(){super(...arguments),this.time=Qo.afterFillStroke}drawShape(t,e,i,s,n,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:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:sd(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:sd(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:sd(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:sd(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},um=xf;var pm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fm=function(t,e){return function(i,s){e(i,s,t)}};let mm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Lu,this.builtinContributions=[dm,um],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,_=m[0];e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const i=m[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,v)}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:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(y(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Lc(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:M=g.clipRange,closePath:T,points:w,segments:C}=t.attribute;let{curveType:E=g.curveType}=t.attribute;function B(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===E&&(E="linearClosed"),1===M&&!C&&!w.some((t=>!1===t.defined))&&"linear"===E)return this.drawLinearAreaHighPerformance(t,e,!!f,k,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(C&&C.length){let e,i;const s=C.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=Ul(B(t.points,x),E,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=C.length-1;t>=0;t--){const e=C[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=C[t-1].points,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=Ul(B(i,x),"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!w||!w.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=B(w,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Ul(e,E,{curveTension:b}),n=Ul(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===M){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,y,r[c],[g,t.attribute],M,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=M*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,A,v,k,y,r[u],[g,t.attribute],$t(f,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,y,t.attribute,g,M,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Lc(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,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let _,b,x=Zo.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],_=t.points[t.points.length-1]}else b=m[0],_=m[m.length-1];const S=Ut(_.x-b.x),A=Ut(_.y-b.y);x=null==_.x1?Zo.ROW:null==_.y1?Zo.COLUMN:Number.isFinite(S+A)?S>A?Zo.ROW:Zo.COLUMN:Zo.ROW,function(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?Zo.ROW:Zo.COLUMN,Number.isFinite(c)||(o=Zo.COLUMN),Number.isFinite(d)||(o=Zo.ROW);const u=i*(o===Zo.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;y(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),om(t,i[0]?e.top:e.bottom,l,x===Zo.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,M-c,o),t.stroke()}})(),!1}};mm=pm([qa(),fm(0,Xa(po)),fm(0,Za(ig)),gm("design:paramtypes",[Object])],mm);const vm=Tf,_m=xf;var ym=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xm=function(t,e){return function(i,s){e(i,s,t)}};let Sm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=zu,this.builtinContributions=[_m,vm],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:Lc(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:_,doFill:y,doStroke:b}=m;if(e.beginPath(),t.pathShape)sl(t.pathShape.commandList,e,i,s,1,1,f);else{sl((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,y,b,v,_,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):_&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{y&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,y,b,v,_,d,n,a,o)}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Sm=ym([qa(),xm(0,Xa(po)),xm(0,Za(ag)),bm("design:paramtypes",[Object])],Sm);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)}};let Tm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=Hu,this.builtinContributions=[Hf,Nf,Vf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Lc(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:_=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:M=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:w}=t.attribute;T=(null!=T?T:b-S)||0,w=(null!=w?w:x-A)||0;const C=Kp(g,f,T,w,h),E=Zp(g,v,T,w,M),B=Yp(h,c),P=$p(d,m);if(!t.valid||!_)return;if(!B&&!P)return;if(!(C||E||a||o||c))return;0===u||y(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,T,w)):(e.beginPath(),If(e,i,s,T,w,u,"bevel"!==p));const L={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,B,P,C,E,l,n,a,o,L),k?(this._runStroke(t,e,i,s,l,L,E,S,A,o),this._runFill(t,e,i,s,l,L,C,S,A,a)):(this._runFill(t,e,i,s,l,L,C,S,A,a),this._runStroke(t,e,i,s,l,L,E,S,A,o)),this.afterRenderStep(t,e,i,s,B,P,C,E,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}};Tm=Am([qa(),Mm(0,Xa(po)),Mm(0,Za(lg)),km("design:paramtypes",[Object])],Tm);var wm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Em=function(t,e){return function(i,s){e(i,s,t)}};let Bm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Nu,this.builtinContributions=[Gf,Xf,$f,Yf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:Lc(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,M=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,w=s,C=M;const E=e.camera;if(k&&E&&e.project){const t=e.project(i,s,M);e.camera=null,y(c)&&(c[0],c[1]),T=t.x,w=t.y,C=void 0}!1===A.draw(e,c,T,w,C,((n,r)=>{var h,c,v,_;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(_=r.lineWidth)&&void 0!==_?_:t.attribute.lineWidth,r=e}const y=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),y()):(y(),x())}))&&e.closePath(),e.camera=E,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,_,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,_,d,u,A,a)):(this._runFill(t,e,i,s,l,x,_,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,_,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Bm=wm([qa(),Em(0,Xa(po)),Em(0,Za(hg)),Cm("design:paramtypes",[Object])],Bm);const Pm=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ne)}allocate(t,e,i,s){if(!this.pools.length)return(new Ne).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 Ne(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(...t){this.pools=[]}};const Lm=new class extends bf{constructor(){super(...arguments),this.time=Qo.beforeFillStroke}drawShape(t,e,i,s,n,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,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio}=t.attribute;let T,{background:w}=t.attribute;if(!w)return;const C=()=>{"richtext"===t.type&&(e.restore(),e.save(),T&&e.setTransformFromMatrix(T,!0,1))};let E;"richtext"===t.type&&(T=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const B=g(w)&&w.background,P=t.transMatrix.onlyTranslate();if(B){const e=t.AABBBounds,i=(null!==(u=w.x)&&void 0!==u?u:e.x1)+(null!==(p=w.dx)&&void 0!==p?p:0),s=(null!==(f=w.y)&&void 0!==f?f:e.y1)+(null!==(m=w.dy)&&void 0!==m?m:0),n=null!==(v=w.width)&&void 0!==v?v:e.width(),r=null!==(_=w.height)&&void 0!==_?_:e.height();if(E=Pm.allocate(i,s,i+n,s+r),w=w.background,!P){const t=E.width(),e=E.height();E.set((null!==(y=w.x)&&void 0!==y?y:0)+(null!==(b=w.dx)&&void 0!==b?b:0),(null!==(x=w.y)&&void 0!==x?x:0)+(null!==(S=w.dy)&&void 0!==S?S:0),t,e)}}else E=t.AABBBounds,P||(E=mf(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(w);if("success"!==n.state||!n.data)return void C();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,E,{backgroundMode:A,backgroundFit:k,backgroundKeepAspectRatio:M}),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n,backgroundOpacity:r=1}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=r,e.fillStyle=w,n?(If(e,E.x1,E.y1,E.width(),E.height(),n,!0),e.fill()):e.fillRect(E.x1,E.y1,E.width(),E.height()),e.highPerformanceRestore()}B&&Pm.free(E),C()}};var Rm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Om=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Im=function(t,e){return function(i,s){e(i,s,t)}};let Dm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Uu,this.builtinContributions=[Lm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Lc(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,fontSize:v=d.fontSize,verticalMode:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute,x=null!==(l=ad(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:M,doStroke:T}=S,w=!f,C=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,M,T,A,k,d,n,a,o),w&&this.transformUseContext2d(t,d,C,e);const E=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=ep.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),ep.free(t)}T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,C))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,C))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,C),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,C)})))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,C),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,C,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!_){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Yt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;E(i,a-(e+1)*x+u,r,n),r+=s}))}))}w&&this.restoreTransformUseContext2d(t,d,C,e),this.afterRenderStep(t,e,i,s,M,T,A,k,d,n,a,o)}draw(t,e,i,s){const n=Lc(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,l,h,c){if(e+t<=0)return;const{textAlign:d=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,_=!u(c),y=_?c.width:i.clipedWidth,b=_?0:ug(d,y),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+y,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+y,t,o),h.stroke()}}};function Fm(t,e,i,s){if(e&&e.length){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},Um=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wm=function(t,e){return function(i,s){e(i,s,t)}};let Gm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ju,this.builtinContributions=[Vm,Hm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Lc(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,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:b}=f;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?Fm(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Fm(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,f=(Math.atan2(u,d)-Math.atan2(g,p))/2,m=Math.abs(Math.tan(f));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,_=v/m;const y=zm(d,u),b=zm(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*m);const S=jm(h,_,y,d,u),A=jm(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=zm(k,M),w=jm(h,zm(_,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 B=E-C;B<0&&(C=E,B=-B),B>Math.PI&&(B-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),B&&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,_,b,m,v,l,n,a,o);const x=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,_,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Gm=Nm([qa(),Wm(0,Xa(po)),Wm(0,Za(og)),Um("design:paramtypes",[Object])],Gm);var Ym=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Xm=function(t,e){return function(i,s){e(i,s,t)}};let Km=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Iu}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Rf)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:Lc(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:M=l.x,y:T=l.y}=t.attribute,w=Kp(p,m,g,f,c),C=Zp(p,v,g,f),E=Yp(c,u),B=$p(d,x);if(!t.valid||!S)return;if(!h){if(!E&&!B)return;if(!(w||C||a||o||u))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,g,f)):(e.beginPath(),If(e,i,s,g,f,_,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Rf));const P={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===Qo.beforeFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o,P)})),h&&e.clip();const L=()=>{P.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,M-i,T-s,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,M-i,T-s,l),e.stroke()))};A?(R(),L()):(L(),R()),this._groupRenderContribitions.forEach((r=>{r.time===Qo.afterFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=Ao.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=Lc(t,null==s?void 0:s.theme).group,i=ip.allocate(),n=ip.allocate();vg(n,t,e),Ju(i,p||i,n),a.modelMatrix=i,ip.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&ip.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}};Km=Ym([qa(),Xm(0,Xa(po)),Xm(0,Za(ng)),$m("design:paramtypes",[Object])],Km);var qm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jm=function(t,e){return function(i,s){e(i,s,t)}};const Qm=["","repeat-x","repeat-y","repeat"];let tv=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Du,this.builtinContributions=[Uf,Wf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Lc(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,image:m}=t.attribute,v=this.valid(t,l,a);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v;if(!m||!t.resources)return;const A=t.resources.get(m);if("success"!==A.state)return;const k=t.width,M=t.height;e.beginPath();let T=!1;0===p||y(p)&&p.every((t=>0===t))?e.rect(i,s,k,M):(If(e,i,s,k,M,p,"bevel"!==f),T=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const w=()=>{if(x)if(a)a(e,t.attribute,l);else if(_){e.setCommonStyle(t,t.attribute,i,s,l);let n=0;if("repeat"===h&&(n|=1),"repeat"===c&&(n|=2),n){const t=e.createPattern(A.data,Qm[n]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,k,M),e.translate(-i,-s,!0)}else e.drawImage(A.data,i,s,k,M)}},C=()=>{S&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(C(),T&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),w(),T&&e.restore()):(T&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),w(),T&&e.restore(),C()),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 Yc.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Lc(t).image;this._draw(t,a,!1,i)}};tv=qm([qa(),Jm(0,Xa(po)),Jm(0,Za(rg)),Zm("design:paramtypes",[Object])],tv);const ev=Symbol.for("IncrementalDrawContribution"),iv=Symbol.for("ArcRender"),sv=Symbol.for("AreaRender"),nv=Symbol.for("CircleRender"),rv=Symbol.for("GraphicRender"),av=Symbol.for("GroupRender"),ov=Symbol.for("LineRender"),lv=Symbol.for("PathRender"),hv=Symbol.for("PolygonRender"),cv=Symbol.for("RectRender"),dv=Symbol.for("SymbolRender"),uv=Symbol.for("TextRender"),pv=Symbol.for("RichTextRender"),gv=Symbol.for("GlyphRender"),fv=Symbol.for("ImageRender"),mv=Symbol.for("DrawContribution"),vv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Pu,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];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+=Nt;for(;o<0;)o+=Nt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};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},yv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const bv=Symbol.for("DrawItemInterceptor"),xv=new Ne,Sv=new Ne;class Av{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){xv.copy(s.dirtyBounds),Sv.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,ep.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(xv),s.backupDirtyBounds.copy(Sv)),!0}}class kv{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 Mv=class{constructor(){this.order=1,this.interceptors=[new Av,new wv,new Tv,new kv]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&ip.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Cv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},Bv=function(t,e){return function(i,s){e(i,s,t)}};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))}reInit(){this.drawContribution.reInit()}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=Cv([qa(),Bv(0,Xa(mv)),Ev("design:paramtypes",[Object])],Pv);var Lv=new Fa((t=>{t(So).to(Pv)}));const Rv=Symbol.for("PickerService"),Ov=Symbol.for("GlobalPickerService"),Iv=Symbol.for("PickItemInterceptor"),Dv=Symbol.for("PickServiceInterceptor");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};let zv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};zv=Fv([qa()],zv);let jv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Lc(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=ep.allocateByObj(a),u=new re(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};jv=Fv([qa()],jv);let Hv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new re(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}};Hv=Fv([qa()],Hv);let Vv=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){const a=vv(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};Vv=Fv([qa()],Vv);var Nv=new Fa(((t,e,i)=>{i(Rv)||(t(Ov).toSelf(),t(Rv).toService(Ov)),t(Vv).toSelf().inSingletonScope(),t(Iv).toService(Vv),t(jv).toSelf().inSingletonScope(),t(Iv).toService(jv),t(Hv).toSelf().inSingletonScope(),t(Iv).toService(Hv),fo(t,Iv),t(zv).toSelf().inSingletonScope(),t(Dv).toService(zv),fo(t,Dv)})),Uv=new Fa((t=>{t(Wu).to(_g),t(Gu).toConstantValue(pf)}));const Wv=Symbol.for("AutoEnablePlugins"),Gv=Symbol.for("PluginService");var Yv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$v=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Xv=function(t,e){return function(i,s){e(i,s,t)}};let Kv=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&&xo.isBound(Wv)&&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(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Kv=Yv([qa(),Xv(0,Xa(po)),Xv(0,Za(Wv)),$v("design:paramtypes",[Object])],Kv);var qv=new Fa((t=>{t(Gv).to(Kv),function(t,e){t(po).toDynamicValue((({container:t})=>new go(e,t))).whenTargetNamed(e)}(t,Wv)})),Zv=new Fa((t=>{fo(t,yo)})),Jv=new Fa((t=>{t(Oh).to(Ih).inSingletonScope(),fo(t,Oh)})),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.type="static",this.offscreen=!1,this.global=Ao.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=zh({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()}};e_=Qv([qa(),t_("design:paramtypes",[])],e_);var i_=new Fa((t=>{t(e_).toSelf(),t(zp).toService(e_)}));var s_=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 n_(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function r_(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=n_(t,e,s);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;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=n_(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var l_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},h_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},c_=function(t,e){return function(i,s){e(i,s,t)}};let d_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):r_(e,th.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Ve,this.backupDirtyBounds=new Ve,this.global=Ao.global,this.layerService=Ao.layerService,y(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}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){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=ye(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.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,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:th.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:th.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,ep.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=o_(e,i,th.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&&!Ae(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Pm.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=ep.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Pm.free(n),ep.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||xo.get(ev);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let p_=class extends hm{constructor(){super(...arguments),this.numberType=Fu}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=Lc(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=Xp(u,p,c),_=qp(u,g),y=Yp(c),b=$p(d,f);if(!t.valid||!m)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())}};p_=u_([qa()],p_);var g_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 f_=class extends mm{constructor(){super(...arguments),this.numberType=Lu}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=Lc(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Xp(u,d,c),f=Yp(c);if(!t.valid||!p)return;if(!f)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())}};f_=g_([qa()],f_);var m_,v_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},__=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},y_=function(t,e){return function(i,s){e(i,s,t)}},b_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(m_||(m_={}));let x_=class extends d_{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=m_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new _o([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return b_(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:th.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:th.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 b_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return b_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>b_(this,void 0,void 0,(function*(){if(2!==t.count)yield a_(t,th.zIndex,((i,s)=>{if(this.status===m_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return b_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return b_(this,void 0,void 0,(function*(){this.rendering&&(this.status=m_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=m_.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return b_(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:()=>b_(this,void 0,void 0,(function*(){yield a_(t,th.zIndex,(t=>b_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};x_=v_([qa(),y_(0,Ka(rv)),y_(1,Xa(p_)),y_(2,Xa(f_)),y_(3,Xa(po)),y_(3,Za(bv)),__("design:paramtypes",[Array,Object,Object,Object])],x_);var S_=new Fa((t=>{t(bf).toSelf().inSingletonScope(),t(Mf).toSelf().inSingletonScope(),t(mv).to(d_),t(ev).to(x_),t(av).to(Km).inSingletonScope(),t(rv).toService(av),fo(t,ng),t(Sf).toSelf().inSingletonScope(),fo(t,dg),fo(t,rv),t(Mv).toSelf().inSingletonScope(),t(bv).toService(Mv),fo(t,bv)}));function A_(){A_.__loaded||(A_.__loaded=!0,xo.load(Gp),xo.load(Uv),xo.load(Lv),xo.load(Nv),xo.load(qv),function(t){t.load(Zv),t.load(Jv),t.load(i_)}(xo),function(t){t.load(S_)}(xo))}A_.__loaded=!1,A_();const k_=xo.get(bo);Ao.global=k_;const M_=xo.get(Dp);Ao.graphicUtil=M_;const T_=xo.get(Ip);Ao.transformUtil=T_;const w_=xo.get(Wu);Ao.graphicService=w_;const C_=xo.get(Fp);Ao.layerService=C_;class E_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class B_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=Ao.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=Ao.global.getRequestAnimationFrame();this.rafId=t((()=>{Ao.global.devicePixelRatio!==this.dpr&&(this.dpr=Ao.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=Ao.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class P_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.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))})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Ao.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())}}const L_=new Ne;class R_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Da.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()}));const e=this.pluginService.stage;e&&(e.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&&(L_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(L_,t.parent&&t.parent.globalTransMatrix)))})),e.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))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let O_;function I_(){!function(){if(null==O_)try{const t=document.createElement("canvas"),e=t.getContext("2d");O_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),O_&&(O_=!!document.createElement)}catch(t){O_=!1}}();const t=Ao.global&&Ao.global.env;return t?"browser"===t:O_}let D_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};D_._pluginClasses={};const F_="white";class z_ extends Lp{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:F_}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={}){var e,i;super({}),this.tickedBeforeRender=!0,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._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Bc,this.hooks={beforeRender:new _o(["stage"]),afterRender:new _o(["stage"]),afterClearScreen:new _o(["stage"]),afterClearRect:new _o(["stage"])},this.global=Ao.global,!this.global.env&&I_()&&this.global.setEnv("browser"),this.window=xo.get(mc),this.renderService=xo.get(So),this.pluginService=xo.get(Gv),this.layerService=xo.get(Fp),this.graphicService=xo.get(Wu),this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],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:F_,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(),t.autoRefresh&&this.enableAutoRefresh(),!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),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&_(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(i=t.rafId)&&void 0!==i?i:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new Gc(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(t=!1){t&&(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:f=[1,1,-1],color:m="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);const k=D_.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const M={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]}};if(this.camera)this.camera.params=M;else{const t=D_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=D_.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}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 E_))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new B_))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new P_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Ve;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new R_,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=D_.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=D_.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=D_.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();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.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();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===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),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.dirtyBounds&&this.dirtyBounds.clear(),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,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new re(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;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.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=xo.get(mc),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=xo.get(Rv)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}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},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())}))};let V_=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ne}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}}loadFont(t,e,i){return H_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}};V_=j_([qa()],V_);var N_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},U_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let W_=class{constructor(){this._uid=Da.GenAutoIncrementId(),this.viewBox=new Ne,this.modelMatrix=new We(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){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}};W_=N_([qa(),U_("design:paramtypes",[])],W_);var G_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Y_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$_=function(t,e){return function(i,s){e(i,s,t)}};let X_=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=Ao.global}reInit(){this._init()}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.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 Ne).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 We(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),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new re(e.x,e.y),a=Lc(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 re(e.x,e.y);l.transformPoint(a,a);const o=Lc(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&&ip.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),ep.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function K_(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 q_(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function iy(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;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}))),oy=(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]},ly=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new Ve;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 oy(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return oy(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);ly(n[0],s,i),ly(n[1],e-s,i)}};let hy=!1;const cy=new Fa((t=>{hy||(hy=!0,t(tm).toSelf().inSingletonScope(),t(iv).to(tm).inSingletonScope(),t(rv).toService(iv),t(eg).toService(Sf),fo(t,eg))}));let dy=!1;const uy=new Fa((t=>{dy||(dy=!0,t(Tm).toSelf().inSingletonScope(),t(cv).to(Tm).inSingletonScope(),t(rv).toService(cv),t(jf).toSelf(),t(zf).toSelf(),t(lg).toService(jf),t(lg).toService(zf),t(lg).toService(Sf),fo(t,lg))}));let py=!1;const gy=new Fa((t=>{py||(py=!0,t(hm).toSelf().inSingletonScope(),t(p_).toSelf().inSingletonScope(),t(ov).to(hm).inSingletonScope(),t(rv).toService(ov))}));let fy=!1;const my=new Fa((t=>{fy||(fy=!0,t(mm).toSelf().inSingletonScope(),t(sv).to(mm).inSingletonScope(),t(rv).toService(sv),t(ig).toService(Sf),fo(t,ig),t(f_).toSelf().inSingletonScope())}));let vy=!1;const _y=new Fa((t=>{vy||(vy=!0,t(Bm).toSelf().inSingletonScope(),t(dv).to(Bm).inSingletonScope(),t(rv).toService(dv),t(hg).toService(Sf),fo(t,hg))}));let yy=!1;const by=new Fa((t=>{yy||(yy=!0,t(nm).toSelf().inSingletonScope(),t(nv).to(nm).inSingletonScope(),t(rv).toService(nv),t(sg).toService(Sf),fo(t,sg))}));let xy=!1;const Sy=new Fa((t=>{xy||(xy=!0,t(uv).to(Dm).inSingletonScope(),t(rv).toService(uv),t(cg).toService(Sf),fo(t,cg))}));let Ay=!1;const ky=new Fa((t=>{Ay||(Ay=!0,t(Sm).toSelf().inSingletonScope(),t(lv).to(Sm).inSingletonScope(),t(rv).toService(lv),t(ag).toService(Sf),fo(t,ag))}));let My=!1;const Ty=new Fa((t=>{My||(My=!0,t(hv).to(Gm).inSingletonScope(),t(rv).toService(hv),t(og).toService(Sf),fo(t,og))}));var wy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Cy=class{constructor(){this.numberType=Ou}reInit(){}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=Lc(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};Cy=wy([qa()],Cy);let Ey=!1;const By=new Fa((t=>{Ey||(Ey=!0,t(gv).to(Cy).inSingletonScope(),t(rv).toService(gv))}));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},Ly=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ry=class extends qf{constructor(){super(),this.numberType=Vu,this.builtinContributions=[Lm],this.init()}drawShape(t,e,i,s,n){const r=Lc(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=Xp(o,l,!0),d=Xp(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),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=Lc(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:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),If(e,i-t,s-n,v,_,f,!0)),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=Lc(t).richtext;this._draw(t,s,!1,i)}};Ry=Py([qa(),Ly("design:paramtypes",[])],Ry);let Oy=!1;const Iy=new Fa((t=>{Oy||(Oy=!0,t(pv).to(Ry).inSingletonScope(),t(rv).toService(pv))}));let Dy=!1;const Fy=new Fa((t=>{Dy||(Dy=!0,t(fv).to(tv).inSingletonScope(),t(rv).toService(fv),t(rg).toService(Sf),fo(t,rg))}));function zy(t){const e=[];for(let i=0;i=0&&n>=0&&sot.getInstance().info(`[VChart log]: ${t}`,...e),Vy=(t,e)=>(d(Uy.warnHandler)&&Uy.warnHandler.call(null,t,e),e?ot.getInstance().warn(`[VChart warn]: ${t}`,e):ot.getInstance().warn(`[VChart warn]: ${t}`)),Ny=(t,e,i)=>{if(!d(Uy.errorHandler))throw new Error(t);Uy.errorHandler.call(null,t,e)},Uy={silent:!1,warnHandler:!1,errorHandler:!1},Wy=I_(),Gy=Wy&&globalThis?globalThis.document:void 0;function Yy(t){return("desktop-browser"===t||"mobile-browser"===t)&&Wy}function $y(t){return Xy(t)||"mobile-browser"===t}function Xy(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let Ky=0;function qy(){return Ky>=9999999&&(Ky=0),Ky++}function Zy(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function Jy(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const Qy=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class tb extends Lp{constructor(t,e){super(t),this._skipRenderAttributes=Qy,(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,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?j(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.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,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.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 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"},Cb=(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 Eb extends l{constructor(t,e={}){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.startTime=Hc.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.pressTimeout=null}),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=Hc.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||wb(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=Cb(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=Hc.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=Cb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=wb(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&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("pointerleave",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("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=Hc.now()-i>this.config.press.time&&Cb(s[0],t){Ao.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;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){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){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},Pb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Lb=[0,0,0];let Rb=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t: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(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},Xl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},ql),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Zl),{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 We(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new We(1,0,0,1,0,0),this._clearMatrix=new We(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&ot.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new We(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&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 ep.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&&(ep.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(ep.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){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,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=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(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){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-=Nt;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(f,-2*y),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&&xp.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&&(Qu(Lb,[t,e,i],this.modelMatrix),t=Lb[0],e=Lb[1],i=Lb[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&&(Qu(Lb,[t,e,i],this.modelMatrix),t=Lb[0],e=Lb[1],i=Lb[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Qu(Lb,[e,i,s],this.modelMatrix),e=Lb[0],i=Lb[1],s=Lb[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,e=Ao.global.measureTextMethod){var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Ao.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Zl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Zl.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&&(Qu(Lb,[e,i,s],this.modelMatrix),e=Lb[0],i=Lb[1],s=Lb[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=yh(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:_h(this,a,this.dpr),r.strokeStyle=yh(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=De(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?this.font=t.font:this.font=De(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(t=!0,e=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(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>ep.free(t))),this.stack.length=0}};Rb.env="browser",Rb=Bb([qa(),Pb("design:paramtypes",[Object,Number])],Rb);var Ob=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ib=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Db=class extends hp{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Ao.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new Rb(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 Fb(t,e){return new Fa((i=>{i(Dh).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Fh).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Db.env="browser",Db=Ob([qa(),Ib("design:paramtypes",[Object])],Db);const zb=Fb(Db,Rb);var jb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vb=function(t,e){return function(i,s){e(i,s,t)}};let Nb=class extends X_{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,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=pc.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 Wb=class{constructor(){this.type="group",this.numberType=Iu}contains(t,e,i){return!1}};Wb=Ub([qa()],Wb);const Gb=new Fa(((t,e,i,s)=>{Gb.__vloaded||(Gb.__vloaded=!0,t(Mb).to(Wb).inSingletonScope(),t(Tb).toService(Mb),fo(t,Tb))}));Gb.__vloaded=!1;var Yb=Gb;const $b=new Fa(((t,e,i,s)=>{i(Nb)||t(Nb).toSelf().inSingletonScope(),i(Rv)?s(Rv).toService(Nb):t(Rv).toService(Nb)}));var Xb,Kb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)};let Zb=Xb=class extends W_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Xb.idprefix}_${Xb.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Ao.global,this.viewBox=new Ne,this.modelMatrix=new We(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:Xb.GenerateCanvasId(),canvasControled:!0};this.canvas=new Db(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 Db({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)}};Zb.env="browser",Zb.idprefix="visactor_window",Zb.prefix_count=0,Zb=Xb=Kb([qa(),qb("design:paramtypes",[])],Zb);const Jb=new Fa((t=>{t(Zb).toSelf(),t(vc).toDynamicValue((t=>t.container.get(Zb))).whenTargetNamed(Zb.env)}));var Qb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},ex=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 ix{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 sx(t,e=!1){const i=document.createElement("img");if(Ao.global.isImageAnonymous&&(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 nx=class extends V_{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 ix(t)}return new Ne}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 sx(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return sx(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:Da.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(...t){}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}}loadFont(t,e,i){return ex(this,void 0,void 0,(function*(){return new FontFace(t,_(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}};nx=Qb([qa(),tx("design:paramtypes",[])],nx);const rx=new Fa((t=>{rx.isBrowserBound||(rx.isBrowserBound=!0,t(nx).toSelf().inSingletonScope(),t(yo).toService(nx))}));function ax(t,e=!0){ax.__loaded||(ax.__loaded=!0,t.load(rx),t.load(zb),t.load(Jb),e&&function(t){t.load(Yb),t.load($b)}(t))}rx.isBrowserBound=!1,ax.__loaded=!1;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};let lx=class extends Rb{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}};lx.env="feishu",lx=ox([qa()],lx);var hx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let dx=class extends hp{constructor(t){super(t)}init(){this._context=new lx(this,this._dpr)}release(...t){}};dx.env="feishu",dx=hx([qa(),cx("design:paramtypes",[Object])],dx);const ux=Fb(dx,lx);var px=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gx=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 mx{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 vx=class extends W_{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new mx}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:Da.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new dx(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 dx({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()}};vx.env="feishu",vx=px([qa(),fx(0,Xa(bo)),gx("design:paramtypes",[Object])],vx);const _x=new Fa((t=>{t(vx).toSelf(),t(vc).toDynamicValue((t=>t.container.get(vx))).whenTargetNamed(vx.env)}));var yx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xx=function(t,e){return function(i,s){e(i,s,t)}};let Sx=class extends X_{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,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 op(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}};Sx=yx([qa(),xx(0,Xa(po)),xx(0,Za(eb)),xx(1,Xa(po)),xx(1,Za(Iv)),xx(2,Xa(po)),xx(2,Za(Dv)),bx("design:paramtypes",[Object,Object,Object])],Sx);const Ax=new Fa((t=>{Ax.__vloaded||(Ax.__vloaded=!0,fo(t,eb))}));Ax.__vloaded=!1;var kx=Ax;class Mx{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();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,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:_h(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}var Tx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Cx=function(t,e){return function(i,s){e(i,s,t)}};let Ex=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Bu}};Ex=Tx([qa(),Cx(0,Xa(iv)),wx("design:paramtypes",[Object])],Ex);let Bx=!1;const Px=new Fa(((t,e,i,s)=>{Bx||(Bx=!0,t(ib).to(Ex).inSingletonScope(),t(eb).toService(ib))}));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},Rx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ox=function(t,e){return function(i,s){e(i,s,t)}};let Ix=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Lu}};Ix=Lx([qa(),Ox(0,Xa(sv)),Rx("design:paramtypes",[Object])],Ix);let Dx=!1;const Fx=new Fa(((t,e,i,s)=>{Dx||(Dx=!0,t(sb).to(Ix).inSingletonScope(),t(eb).toService(sb))}));var zx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hx=function(t,e){return function(i,s){e(i,s,t)}};let Vx=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Ru}};Vx=zx([qa(),Hx(0,Xa(nv)),jx("design:paramtypes",[Object])],Vx);let Nx=!1;const Ux=new Fa(((t,e,i,s)=>{Nx||(Nx=!0,t(nb).to(Vx).inSingletonScope(),t(eb).toService(nb))}));class Wx{constructor(){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}}var Gx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},$x=function(t,e){return function(i,s){e(i,s,t)}};let Xx=class extends Wx{constructor(t){super(),this.canvasRenderer=t}};Xx=Gx([qa(),$x(0,Xa(gv)),Yx("design:paramtypes",[Object])],Xx);let Kx=!1;const qx=new Fa(((t,e,i,s)=>{Kx||(Kx=!0,t(ub).to(Xx).inSingletonScope(),t(Xx).toService(ub))}));var Zx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Jx=class{constructor(){this.type="image",this.numberType=Du}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Jx=Zx([qa()],Jx);let Qx=!1;const tS=new Fa(((t,e,i,s)=>{Qx||(Qx=!0,t(rb).to(Jx).inSingletonScope(),t(Jx).toService(rb))}));var eS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sS=function(t,e){return function(i,s){e(i,s,t)}};let nS=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Fu}};nS=eS([qa(),sS(0,Xa(ov)),iS("design:paramtypes",[Object])],nS);let rS=!1;const aS=new Fa(((t,e,i,s)=>{rS||(rS=!0,t(ab).to(nS).inSingletonScope(),t(eb).toService(ab))}));var oS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hS=function(t,e){return function(i,s){e(i,s,t)}};let cS=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=ju}};cS=oS([qa(),hS(0,Xa(hv)),lS("design:paramtypes",[Object])],cS);let dS=!1;const uS=new Fa(((t,e,i,s)=>{dS||(dS=!0,t(db).to(cS).inSingletonScope(),t(eb).toService(db))}));var pS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fS=function(t,e){return function(i,s){e(i,s,t)}};let mS=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=zu}};mS=pS([qa(),fS(0,Xa(lv)),gS("design:paramtypes",[Object])],mS);let vS=!1;const _S=new Fa(((t,e,i,s)=>{vS||(vS=!0,t(ob).to(mS).inSingletonScope(),t(eb).toService(ob))})),yS=new Ne;class bS{constructor(){this.type="rect",this.numberType=Hu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{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,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:_h(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;yS.setValue(i.x1,i.y1,i.x2,i.y2),yS.expand(-r/2),h=!yS.containsPoint(e)}}return s.highPerformanceRestore(),h}}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 extends bS{constructor(t){super(),this.canvasRenderer=t}};kS=xS([qa(),AS(0,Xa(cv)),SS("design:paramtypes",[Object])],kS);let MS=!1;const TS=new Fa(((t,e,i,s)=>{MS||(MS=!0,t(lb).to(kS).inSingletonScope(),t(eb).toService(lb))}));let wS=!1;const CS=new Fa(((t,e,i,s)=>{wS||(wS=!0,t(rb).to(Jx).inSingletonScope(),t(Jx).toService(rb))}));var ES=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},BS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},PS=function(t,e){return function(i,s){e(i,s,t)}};let LS=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Nu}};LS=ES([qa(),PS(0,Xa(dv)),BS("design:paramtypes",[Object])],LS);let RS=!1;const OS=new Fa(((t,e,i,s)=>{RS||(RS=!0,t(hb).to(LS).inSingletonScope(),t(eb).toService(hb))}));var IS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 DS=class{constructor(){this.type="text",this.numberType=Uu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};DS=IS([qa()],DS);let FS=!1;const zS=new Fa(((t,e,i,s)=>{FS||(FS=!0,t(cb).to(DS).inSingletonScope(),t(eb).toService(cb))})),jS=new Fa(((t,e,i,s)=>{i(Sx)||t(Sx).toSelf().inSingletonScope(),i(Rv)?s(Rv).toService(Sx):t(Rv).toService(Sx)}));class HS{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 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},NS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let US=class extends V_{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 HS(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 rd.call(t)}}getCancelAnimationFrame(){return t=>{rd.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(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};US=VS([qa(),NS("design:paramtypes",[])],US);const WS=new Fa((t=>{WS.isFeishuBound||(WS.isFeishuBound=!0,t(US).toSelf().inSingletonScope(),t(yo).toService(US))}));function GS(t,e=!0){GS.__loaded||(GS.__loaded=!0,t.load(WS),t.load(ux),t.load(_x),e&&function(t){t.load(kx),t.load(jS),t.load(Px),t.load(Fx),t.load(Ux),t.load(qx),t.load(tS),t.load(aS),t.load(uS),t.load(_S),t.load(TS),t.load(CS),t.load(OS),t.load(zS)}(t))}WS.isFeishuBound=!1,GS.__loaded=!1;var YS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$S=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let XS=class extends Rb{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 We(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};XS.env="node",XS=YS([qa(),$S("design:paramtypes",[Object,Number])],XS);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},qS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ZS=class extends hp{constructor(t){super(t)}init(){this._context=new XS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};ZS.env="node",ZS=KS([qa(),qS("design:paramtypes",[Object])],ZS);const JS=Fb(ZS,XS);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},tA=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 iA=class extends W_{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:Da.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new ZS(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new ZS({width:n,height:r,dpr:s,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}getImageBuffer(t="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){}};iA.env="node",iA=QS([qa(),eA(0,Xa(bo)),tA("design:paramtypes",[Object])],iA);const sA=new Fa((t=>{t(iA).toSelf(),t(vc).toDynamicValue((t=>t.container.get(iA))).whenTargetNamed(iA.env)}));var nA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let rA=class extends V_{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 rd.call(t)}}getCancelAnimationFrame(){return t=>{rd.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};rA=nA([qa()],rA);const aA=new Fa((t=>{aA.isNodeBound||(aA.isNodeBound=!0,t(rA).toSelf().inSingletonScope(),t(yo).toService(rA))}));function oA(t,e=!0){oA.__loaded||(oA.__loaded=!0,t.load(aA),t.load(JS),t.load(sA))}aA.isNodeBound=!1,oA.__loaded=!1;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},hA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cA=function(t,e){return function(i,s){e(i,s,t)}};let dA=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Bu}};dA=lA([qa(),cA(0,Xa(iv)),hA("design:paramtypes",[Object])],dA);let uA=!1;const pA=new Fa(((t,e,i,s)=>{uA||(uA=!0,t(pb).to(dA).inSingletonScope(),t(Tb).toService(pb))}));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},fA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mA=function(t,e){return function(i,s){e(i,s,t)}};let vA=class extends bS{constructor(t){super(),this.canvasRenderer=t}};vA=gA([qa(),mA(0,Xa(cv)),fA("design:paramtypes",[Object])],vA);let _A=!1;const yA=new Fa(((t,e,i,s)=>{_A||(_A=!0,t(yb).to(vA).inSingletonScope(),t(Tb).toService(yb))}));class bA extends qf{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=t.getGraphicTheme(),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,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:_h(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&ip.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}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){return function(i,s){e(i,s,t)}};let kA=class extends bA{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Fu}};kA=xA([qa(),AA(0,Xa(ov)),SA("design:paramtypes",[Object])],kA);let MA=!1;const TA=new Fa(((t,e,i,s)=>{MA||(MA=!0,t(vb).to(kA).inSingletonScope(),t(Tb).toService(vb))}));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 BA=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Lu}};BA=wA([qa(),EA(0,Xa(sv)),CA("design:paramtypes",[Object])],BA);let PA=!1;const LA=new Fa(((t,e,i,s)=>{PA||(PA=!0,t(gb).to(BA).inSingletonScope(),t(Tb).toService(gb))}));class RA extends qf{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();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,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&ip.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var OA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},IA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},DA=function(t,e){return function(i,s){e(i,s,t)}};let FA=class extends RA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Nu}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=t.getGraphicTheme(),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,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:_h(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&ip.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};FA=OA([qa(),DA(0,Xa(dv)),IA("design:paramtypes",[Object])],FA);let zA=!1;const jA=new Fa(((t,e,i,s)=>{zA||(zA=!0,t(bb).to(FA).inSingletonScope(),t(Tb).toService(bb))}));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},VA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},NA=function(t,e){return function(i,s){e(i,s,t)}};let UA=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Ru}};UA=HA([qa(),NA(0,Xa(nv)),VA("design:paramtypes",[Object])],UA);let WA=!1;const GA=new Fa(((t,e,i,s)=>{WA||(WA=!0,t(fb).to(UA).inSingletonScope(),t(Tb).toService(fb))}));var YA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$A=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XA=function(t,e){return function(i,s){e(i,s,t)}};let KA=class extends RA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=Uu}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=t.getGraphicTheme(),{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(),f=l.width(),m=pg(a,u,n),v=ug(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,s.modelMatrix!==u&&ip.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};KA=YA([qa(),XA(0,Xa(uv)),$A("design:paramtypes",[Object])],KA);let qA=!1;const ZA=new Fa(((t,e,i,s)=>{qA||(qA=!0,t(xb).to(KA).inSingletonScope(),t(Tb).toService(xb))}));var JA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},QA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tk=function(t,e){return function(i,s){e(i,s,t)}};let ek=class extends bA{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=zu}};ek=JA([qa(),tk(0,Xa(lv)),QA("design:paramtypes",[Object])],ek);let ik=!1;const sk=new Fa(((t,e,i,s)=>{ik||(ik=!0,t(_b).to(ek).inSingletonScope(),t(Tb).toService(_b))}));var nk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ak=function(t,e){return function(i,s){e(i,s,t)}};let ok=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=ju}};ok=nk([qa(),ak(0,Xa(hv)),rk("design:paramtypes",[Object])],ok);let lk=!1;const hk=new Fa(((t,e,i,s)=>{lk||(lk=!0,t(Sb).to(ok).inSingletonScope(),t(Tb).toService(Sb))}));var ck=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uk=function(t,e){return function(i,s){e(i,s,t)}};let pk=class extends Wx{constructor(t){super(),this.canvasRenderer=t}};pk=ck([qa(),uk(0,Xa(gv)),dk("design:paramtypes",[Object])],pk);let gk=!1;const fk=new Fa(((t,e,i,s)=>{gk||(gk=!0,t(kb).to(pk).inSingletonScope(),t(Tb).toService(kb))}));var mk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_k=function(t,e){return function(i,s){e(i,s,t)}};let yk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Vu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};yk=mk([qa(),_k(0,Xa(pv)),vk("design:paramtypes",[Object])],yk);let bk=!1;const xk=new Fa(((t,e,i,s)=>{bk||(bk=!0,t(Ab).to(yk).inSingletonScope(),t(Tb).toService(Ab))}));var Sk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ak=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kk=function(t,e){return function(i,s){e(i,s,t)}};let Mk=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=Du}};Mk=Sk([qa(),kk(0,Xa(fv)),Ak("design:paramtypes",[Object])],Mk);let Tk=!1;const wk=new Fa(((t,e,i,s)=>{Tk||(Tk=!0,t(mb).to(Mk).inSingletonScope(),t(Tb).toService(mb))})),Ck=I_();function Ek(){Ek.__loaded||(Ek.__loaded=!0,pf.RegisterGraphicCreator("arc",of),xo.load(cy),xo.load(Ck?pA:Px))}Ek.__loaded=!1;const Bk=Ek;function Pk(){Pk.__loaded||(Pk.__loaded=!0,pf.RegisterGraphicCreator("area",nf),xo.load(my),xo.load(Ck?LA:Fx))}Pk.__loaded=!1;const Lk=Pk;function Rk(){Rk.__loaded||(Rk.__loaded=!0,pf.RegisterGraphicCreator("circle",Sg),xo.load(by),xo.load(Ck?GA:Ux))}Rk.__loaded=!1;const Ok=Rk;function Ik(){Ik.__loaded||(Ik.__loaded=!0,pf.RegisterGraphicCreator("glyph",zg),xo.load(By),xo.load(Ck?fk:qx))}Ik.__loaded=!1;const Dk=Ik;function Fk(){Fk.__loaded||(Fk.__loaded=!0,pf.RegisterGraphicCreator("group",Rp))}Fk.__loaded=!1;const zk=Fk;function jk(){jk.__loaded||(jk.__loaded=!0,pf.RegisterGraphicCreator("image",Wg),xo.load(Fy),xo.load(Ck?wk:tS))}jk.__loaded=!1;const Hk=jk;function Vk(){Vk.__loaded||(Vk.__loaded=!0,pf.RegisterGraphicCreator("line",Lg),xo.load(gy),xo.load(Ck?TA:aS))}Vk.__loaded=!1;const Nk=Vk;function Uk(){Uk.__loaded||(Uk.__loaded=!0,pf.RegisterGraphicCreator("path",tf),xo.load(ky),xo.load(Ck?sk:_S))}Uk.__loaded=!1;const Wk=Uk;function Gk(){Gk.__loaded||(Gk.__loaded=!0,pf.RegisterGraphicCreator("polygon",cf),xo.load(Ty),xo.load(Ck?hk:uS))}Gk.__loaded=!1;const Yk=Gk;function $k(){$k.__loaded||($k.__loaded=!0,pf.RegisterGraphicCreator("rect",Dg),xo.load(uy),xo.load(Ck?yA:TS))}$k.__loaded=!1;const Xk=$k;function Kk(){Kk.__loaded||(Kk.__loaded=!0,pf.RegisterGraphicCreator("richtext",Zg),xo.load(Iy),xo.load(Ck?xk:CS))}Kk.__loaded=!1;const qk=Kk;function Zk(){Zk.__loaded||(Zk.__loaded=!0,pf.RegisterGraphicCreator("shadowRoot",uf))}Zk.__loaded=!1;const Jk=Zk;function Qk(){Qk.__loaded||(Qk.__loaded=!0,pf.RegisterGraphicCreator("symbol",Eg),xo.load(_y),xo.load(Ck?jA:OS))}Qk.__loaded=!1;const tM=Qk;function eM(){eM.__loaded||(eM.__loaded=!0,pf.RegisterGraphicCreator("text",Tg),xo.load(Sy),xo.load(Ck?ZA:zS))}eM.__loaded=!1;const iM=eM;function sM(){zk(),Xk()}const nM=-.5*Math.PI,rM=1.5*Math.PI,aM="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 oM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(oM||(oM={}));const lM={[oM.selectedReverse]:{},[oM.selected]:{},[oM.hover]:{},[oM.hoverReverse]:{}},hM={container:"",width:30,height:30,style:{}},cM="scrollDrag";function dM(){return"browser"===k_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const uM={debounce:St,throttle:At};sM();let pM=class t extends tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},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=_t(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=_t(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=>{this._clearDragEvents();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});const r=dM(),a="browser"===k_.env?k_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=_t(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},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:uM[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:yt(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=yt(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(cM,{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",uM[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===k_.env?k_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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(yt(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:ai(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,[s,n,r,a]=ai(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,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=_t(t[0],0,1),c=_t(t[1],0,1),d=_t(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=yt(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?yt([a+i*n,a+s*n],a,n-l):yt([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=dM(),e="browser"===k_.env?k_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===k_.env?k_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};pM.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,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};var gM,fM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 mM=gM=class{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new Ve).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Ut(t.deltaX)>Ut(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ne,e.addEventListener("wheel",this.scroll),this.params=gM.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(cM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new pM(v),h.name=a,e.add(h),h.isScrollBar=!0);const _=this.childrenBounds,{scrollX:y,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/_.width(),1),e=Math.max(Math.min(y/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/_.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=i{i(mM)||(t(mM).toSelf(),t(Wv).toService(mM))}));function _M(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&_M(t,e)}))}const yM=t=>!u(t)&&!1!==t.visible;function bM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function xM(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 AM=["#ffffff","#000000"];function kM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ii(t).toHex(),o=new ii(e).toHex();return MM(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(...AM);for(const n of a)if(t!==n&&MM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function MM(t,e,i,s,n){if("lightness"===n){const i=ii.getColorBrightness(new ii(e));return ii.getColorBrightness(new ii(t))<.5?i>=.5:i<.5}return s?TM(t,e)>s:"largeText"===i?TM(t,e)>3:TM(t,e)>4.5}function TM(t,e){const i=wM(t),s=wM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function wM(t){const e=ni(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 CM(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 EM(t,e){return[t[0]*e,t[1]*e]}function BM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function PM(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=Qt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const LM=(t,e,i,s)=>new Fe(Object.assign({defaultFontParams:Object.assign({fontFamily:aM,fontSize:14},s),getTextBounds:i?void 0:mf,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function RM(t,e,i={}){if(!t)return{width:0,height:0};const s=mf({text:t,fontFamily:e.fontFamily||i.fontFamily||aM,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 OM(t,e="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 IM(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function DM(t,e="type"){const i=OM(t,e);return"rich"===i?pf.richtext(IM(t)):("html"===i?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"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),pf.text(t))}function FM(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 zM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function jM(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 HM(t,e){const{dx:i,dy:s}=jM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function VM(){zk(),Xk(),tM(),qk(),iM()}var NM=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&&(T=h,R.setAttribute("maxLineWidth",h-b[1]-b[2]))),k=0,M=0;let H=0;"left"===z||"start"===z?H=1:"right"===z||"end"===z?H=-1:"center"===z&&(H=0),H?H<0?(k-=T,A&&A.setAttribute("x",(A.attribute.x||0)-O),x.setAttribute("x",-b[1]-E)):H>0&&x.setAttribute("x",b[3]):(k-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-O/2),x.setAttribute("x",-E/2));const V="right"===y||"end"===y,N="left"===y||"start"===y,U=(t,e)=>{"richtext"===R.type?R.setAttributes({x:t,textAlign:e,textConfig:Y(R.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):R.setAttributes({x:t,textAlign:e})};if((y?"center"===y:_)&&H){const t=T-b[1]-b[3],e=O+E,i=1===H?(t-e)/2+E+O/2:b[0]+E-(T/2+e/2-E)+O/2;if(U(i,"center"),A){const t=i-O/2-E+F/2;A.setAttributes({x:t})}}if(N&&1!==H){const t=T-b[1]-b[3],e=0===H?-t/2+E/2:-T+b[3]+b[1]+E;if(U(e+E,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(V&&-1!==H){const t=T-b[1]-b[3],e=0===H?t/2+E/2:t;if(U(e,"right"),A){const t=e-O-E+F/2;A.setAttributes({x:t})}}"middle"===j?(M-=w/2,A&&A.setAttribute("y",0)):"bottom"===j?(M-=w,A&&A.setAttribute("y",-I/2),x.setAttribute("y",-b[2])):"top"===j&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",I/2)),P(null==m?void 0:m.text)||(R.states=m.text);const{visible:W}=a,G=NM(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},G),{visible:W&&!!s,width:T,height:w,x:k,y:M}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),G.customShape){const e=G.customShape;t.pathProxy=t=>e(this,t,new Wl)}this._bgRect=t}this._textShape=R,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:j({},UM.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}UM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const WM={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}},GM={poptip:j({},WM)};var YM=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);nA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(y(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),I.setAttribute("x",I.attribute.x+e),o.setAttribute("dx",$t(Yt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),I.setAttribute("y",I.attribute.y+e),o.setAttribute("dy",$t(Yt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?jt/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:jt/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?jt/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?jt/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:jt/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?jt/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?jt:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:jt,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?jt:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}QM.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"},panel:{},maxWidthPercent:.8,space:8,padding:10};var tT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 eT=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};j(s,QM.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new QM(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};j(e,GM.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,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),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}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}};eT=tT([qa()],eT);var iT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 sT{constructor(){this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(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)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}let nT=class extends sT{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};nT=iT([qa()],nT);let rT=class extends sT{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}};rT=iT([qa()],rT);const aT=new Fa(((t,e,i,s)=>{i(eT)||(t(eT).toSelf().inSingletonScope(),t(dg).toService(eT)),i(nT)||(t(nT).toSelf(),t(Wv).toService(nT)),i(rT)||(t(rT).toSelf(),t(Wv).toService(rT))}));class oT extends tb{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}zk(),Nk();class lT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},lT.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})}}lT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},zk(),Xk();class hT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},hT.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})}}hT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},zk(),Bk();class cT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},cT.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=ae.distancePP(t,e);this.setAttribute("radius",i)}}cT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},zk(),Bk();class dT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},dT.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=nM,endAngle:s=rM}=this.attribute,n=s-i,r=le(ue(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}dT.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},zk(),Wk();class uT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},uT.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=ce(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=ae.distancePP(t,e);this.setAttribute("radius",i)}}function pT(){zk(),Nk(),Yk(),tM()}function gT(){zk(),Nk(),Bk(),tM()}uT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},pT();class fT extends tb{getStartAngle(){return pe(this._startAngle)}getEndAngle(){return pe(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},fT.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=pf.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),P(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=pf.line;Y(i)[0].cornerRadius&&(t=pf.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"),P(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:f=12}=t;let m,v;"start"===i?(m={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)):(m={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=pf.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(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}}fT.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}}},gT();class mT extends fT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},fT.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=pf.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"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var vT,_T;!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.labelHoverOnAxis="axis-label-hover-on-axis",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",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(vT||(vT={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(_T||(_T={}));const yT={[_T.selectedReverse]:{},[_T.selected]:{},[_T.hover]:{},[_T.hoverReverse]:{}},bT={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}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},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}}},xT={size:8,stroke:"#000",lineWidth:1,zIndex:1};const ST=Math.sin(Math.PI/10);function AT(t,e=ST){const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function kT(t,e=ST){const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function MT(t){const e={};return _M(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function TT(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function wT(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return EM(r,(s?-1:1)*(n?-1:1)*t/BM(r))}function CT(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function BT(t,e,i){var s;if(kT(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>ze(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>ze(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>je(n,r)}function PT(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(oM.hover,!0),_M(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(oM.hoverReverse,!0)})),s):i},RT=(t,e,i)=>i?(_M(e,(t=>{t.name&&!P(t.states)&&(t.removeState(oM.hoverReverse),t.removeState(oM.hover))})),null):i,OT=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(oM.selected)?(_M(e,(t=>{t.name&&!P(t.states)&&(t.removeState(oM.selectedReverse),t.removeState(oM.selected))})),null):s.name&&!P(s.states)?(s.addState(oM.selected,!0),_M(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(oM.selectedReverse,!0)})),s):i};class IT extends tb{_prepareAnimate(t){if(!1!==this.attribute.animation){const{animation:e,animationEnter:i,animationExit:s,animationUpdate:n}=this.attribute,r=g(e)?e:{};this._animationConfig={enter:!1!==i&&j({},t,r,null!=i?i:{}),exit:!1!==s&&j({},t,r,null!=s?s:{}),update:!1!==n&&(y(n)?n:j({},t,r,null!=n?n:{}))}}else this._animationConfig={enter:!1,exit:!1,update:!1}}}const DT={type:"default",duration:300,easing:"linear"};class FT extends IT{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=LT(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=RT(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=OT(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=pf.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._prepare(),this._prevInnerView=this._innerView&&MT(this._innerView),this.removeAllChild(!0),this._innerView=pf.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation()}_prepare(){this._prepareAnimate(DT)}_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=pf.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=vT.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=pf.group({x:0,y:0,pickable:!1});t.name=vT.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",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=pf.group({x:0,y:0,pickable:!1});i.name=vT.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=pf.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=vT.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=lM;else{const t=this.data[s],e=j({},lM,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=pf.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=vT.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=lM;else{const i=j({},lM,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=pf.group({x:0,y:0,pickable:!1});return r.name=`${vT.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=DM(this._getLabelAttribute(t,e,n,i));if(a.name=vT.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=lM;else{const s=j({},lM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new UM(Object.assign({},e));i.name=vT.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return TT(t,this.getVerticalVector(e,i,t))}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;Ut(s[0])>Ut(s[1])?o=jt/2*(l.x>e.x?1:-1):h=jt/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+L(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+L(this.attribute,"label.space",4))*s);const f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:_}=this.attribute.label;_=d(_)?j({},bT.label.style,_(t,e,i,s)):_;_=j(this.getLabelAlign(m,o,_.angle),_),d(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let y=_.react;return d(y)&&(y=y(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,_)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==_?void 0:_.fontSize,type:h}),_),{react:y})}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}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},_M(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(e.setFinalAttributes(e.attribute),r){r.release();const i=r.attribute,a=e.getFinalAttribute(),o=function(t,e,i){const s={};for(const i in e)i in t&&U(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}(i,a);let l=Object.keys(o).length>0;if("opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l){this._newElementAttrMap[e.id]={state:"update",node:e,attrs:e.attribute};const i=r.attribute;e.setAttributes(i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}])}}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const zT={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&&BT(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function jT(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function HT(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=d(n)?n:zT[n]||zT.parity;if(s.length>=3&&PT(s,r)){do{s=a(s,r)}while(s.length>=3&&PT(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=$(i);BT(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),HT(l,s,n,(t=>BT(t,l,r))),HT(h,s,o,(t=>BT(t,h,r)||!(!n||t===l)&&BT(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function NT(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},GT(t,e.attribute.angle)),{angle:WT(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({},YT(t,e.attribute.angle)),{angle:WT(e.attribute.angle)}))}))}(t,e),function(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=Te({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function WT(t=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 GT(t,e=0){let 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=WT(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 YT(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=WT(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 $T(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!u(h),d=c?Math.cos(h):1,p=c?Math.sin(h):0,f=kT(h),m=AT(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===_||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/d,l=Math.abs(i/p);if(y&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(d);r=Math.min(t,l)}else if(y&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(d);r=Math.min(t,l)}else r=l}else r=Math.abs(i/d);k(t.attribute.maxLineWidth)&&(r=k(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function XT(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class KT{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,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=BM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return EM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class qT{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-qT.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*qT.bounceIn(2*t):.5*qT.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Nt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Nt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Nt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Nt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Nt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Nt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Nt/e)*.5+1}}static registerFunc(t,e){qT[t]=e}}function ZT(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}qT.quadIn=qT.getPowIn(2),qT.quadOut=qT.getPowOut(2),qT.quadInOut=qT.getPowInOut(2),qT.cubicIn=qT.getPowIn(3),qT.cubicOut=qT.getPowOut(3),qT.cubicInOut=qT.getPowInOut(3),qT.quartIn=qT.getPowIn(4),qT.quartOut=qT.getPowOut(4),qT.quartInOut=qT.getPowInOut(4),qT.quintIn=qT.getPowIn(5),qT.quintOut=qT.getPowOut(5),qT.quintInOut=qT.getPowInOut(5),qT.backIn=qT.getBackIn(1.7),qT.backOut=qT.getBackOut(1.7),qT.backInOut=qT.getBackInOut(1.7),qT.elasticIn=qT.getElasticIn(1,.3),qT.elasticOut=qT.getElasticOut(1,.3),qT.elasticInOut=qT.getElasticInOut(1,.3*1.5),qT.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),qT.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},qT.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)qT[`flicker${t}`]=e=>ZT(e,t);for(let t=2;t<10;t++)qT[`aIn${t}`]=e=>t*e*e+(1-t)*e;function JT(t,e,i){return t+(e-t)*i}const QT=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=JT(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=JT(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=JT(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=JT(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=JT(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=JT(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=JT(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=JT(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=JT(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=pp(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?fp(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=pp(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?fp(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=JT(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=JT(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=JT(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=JT(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=JT(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=JT(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=JT(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=JT(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=JT(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=id(e,i,s),r.addUpdateBoundTag()}}};function tw(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.setAttributes(this.target.attribute)},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=qT[s])&&void 0!==n?n:qT.linear:qT.linear,"wait"===t&&(this.onUpdate=ew),this.id=Da.GenAutoIncrementId(),this.syncAttributeUpdate=ew}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(_(i)&&_(s)){const n=dp.Get(i,cp.Color255),r=dp.Get(s,cp.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(QT["fill"===e?"fillPure":"strokePure"])}else QT[e]?t.push(QT[e]):t.push(tw)}else QT[e]?t.push(QT[e]):t.push(tw)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate;this.target.animates.forEach((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const i=e.getStartProps();this.propKeys.forEach((t=>{null!=i[t]&&e.preventAttr(t)}))}))}deleteSelfAttr(t){var e;delete this.props[t],this.fromProps&&delete this.fromProps[t];const i=this.propKeys.indexOf(t);-1!==i&&(this.propKeys.splice(i,1),null===(e=this.interpolateUpdateFunctions)||void 0===e||e.splice(i,1))}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){this.target.setAttributes(this.props),t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class sw extends iw{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();this.target.setAttributes(t)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class nw extends l{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Da.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Io.END?this.removeAnimate(t,!0):t.status!==Io.RUNNING&&t.status!==Io.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const rw=new nw;rw.isGlobal=!0;class aw{constructor(t=Da.GenAutoIncrementId(),e=rw,i){this.id=t,this.status=Io.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){return this.target=t,this.target.animates||(this.target.animates=new Map),this.target.animates.set(this.id,this),this.onRemove((()=>{this.stop(),this.target.animates.delete(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new iw(Oo.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new sw(Oo.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new iw(Oo.from,t,e,i);return this._firstStep?(this._lastStep.append(s),this._lastStep=s):(this._firstStep=s,this._lastStep=s),this.updateDuration(),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Io.RUNNING&&(this.status=Io.PAUSED)}resume(){this.status===Io.PAUSED&&(this.status=Io.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this._preventAttrs.add(t),delete this._startProps[t],delete this._endProps[t];let e=this._firstStep;for(;e;)e.deleteSelfAttr(t),e=e.next}preventAttrs(t){t.forEach((t=>this._preventAttrs.add(t)))}validAttr(t){return!this._preventAttrs.has(t)}runCb(t){var e;return null===(e=this._lastStep)||void 0===e||e.onEnd(t),this}startAt(t){return this._startTime=t,this}customInterpolate(t,e,i,s,n,r){return!1}getFromValue(){return this._startProps}getToValue(){return this._endProps}stop(t){let e=this._firstStep;for(;e;)e.stop(),e=e.next;this.status!==Io.END&&this.onEnd(),this.status=Io.END,this.target&&("start"===t?this.target.setAttributes(this._startProps):"end"===t?this.target.setAttributes(this._endProps):t&&this.target.setAttributes(t))}release(){this.status=Io.END,this._onRemove&&this._onRemove.forEach((t=>t())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Io.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),void(this.status=Io.END);this.status=Io.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&this.target.setAttributes(this._startProps);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const ow=new Mo;class lw{constructor(){this.released=!1}tick(t,e){ow.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class hw extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Ro.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Ro.INITIAL,Ao.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),Ao.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new lw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Ro.INITIAL&&(this.status=Ro.PAUSE,!0)}resume(){return this.status!==Ro.INITIAL&&(this.status=Ro.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Ro.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Ro.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Ro.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Ro.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Ro.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Ro.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,Ao.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}function uw(t){if(!t||!d(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1}return 2}dw.getInstance();class pw{static registerBuiltInAnimate(t,e){pw.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;y(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:pw.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=uw(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:pw.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=uw(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=k(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){Array.isArray(t)?t.forEach((t=>this._execute(t))):this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,u;const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:_=0,duration:y=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:M,custom:T,customType:w,controlOptions:C}=t,E=e.animate();E.priority=k;const B=d(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],L=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&L&&(i=null!==(h=P[L])&&void 0!==h?h:i),E.startAt(b);const R=i*x+B;R>0&&E.wait(R);let O=null,I=t.to,D=t.from;I||(O||(O=this.createPropsFromChannel(g,e)),I=O.props),D||(O||(O=this.createPropsFromChannel(g,e)),D=O.from),O.attrOutChannel&&e.setAttributes(O.attrOutChannel),this._handleRunAnimate(E,T,w,D,I,y,m,f,C,M,p,e);let F=0;x&&(F=x*(s-i-1));const z=d(_)?_(null===(u=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===u?void 0:u[0],e,{}):_;return z>0&&(F+=z),F>0&&E.wait(F),S&&S>0&&E.loop(S),A&&E.bounce(!0),E}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,u){var p,g,f,m,v,_,y,b;if(e&&i){i=uw(e);let c=this.resolveValue(o,u);"function"==typeof c&&(c=c(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),c=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},c);const x=d(h)?h.call(null,null!==(_=c&&(null===(v=c.data)||void 0===v?void 0:v[0]))&&void 0!==_?_:null===(b=null===(y=u.context)||void 0===y?void 0:y.data)||void 0===b?void 0:b[0],u,c):h;c.options=x,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:u=0}=t,p=d(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=d(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;u||(d||(d=this.createPropsFromChannel(a,i)),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i)),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const g=null!==(n=t.custom)&&void 0!==n?n:pw.builtInAnimateMap[r],f=t.custom?t.customType:uw(g);this._handleRunAnimate(e,g,f,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e){var i;const s={};let n=null;if(!t)return{from:n,props:s,attrOutChannel:null};const r={};let a=!1;const o=null===(i=e.context)||void 0===i?void 0:i.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===o[e]||(t[e]={to:o[e]}),t)),{})),Object.keys(t).forEach((i=>{var r,a,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?s[i]=h.to(null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,{}):s[i]=h.to),void 0!==h.from&&(n||(n={}),"function"==typeof h.from?n[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):n[i]=h.from)})),o)for(const t in o){const e=o[t];void 0!==e&&(s.hasOwnProperty(t)||(r[t]=e,a=!0))}return{from:n,props:s,attrOutChannel:a?r:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}executeItem(t,e,i=0,s=1){return Array.isArray(t)?t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean):[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Io.END),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}pw.builtInAnimateMap={};const gw="appear",fw="disappear",mw="update",vw="highlight",_w="unhighlight";class yw{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class bw{constructor(t){this.stateList=null,this.graphic=t}applyState(t,e,i){const s=dw.getInstance(),n=[],r=[];if(this.stateList&&this.stateList.length?t.forEach(((t,i)=>{const a={allowTransition:!0,stopOriginalTransition:!0};this.stateList.forEach((e=>{const i=s.isTransitionAllowed(e.state,t,this.graphic);a.allowTransition=a.allowTransition&&i.allowTransition})),a.allowTransition&&(r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new pw(this.graphic)}),this.stateList.forEach((e=>{s.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&n.push(e)})))})):t.forEach(((t,i)=>{r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new pw(this.graphic)})})),n.forEach((t=>{t.executor.stop(null,!1)})),r.length){r[0].executor.execute(r[0].animationConfig);for(let t=0;t{e&&e.executor.execute(e.animationConfig),this.stateList=this.stateList.filter((t=>t!==s)),t===r.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!n.includes(t))):this.stateList=[],this.stateList.push(...r)}applyAppearState(t,e){this.applyState([gw],[{name:gw,animation:t}],e)}applyDisappearState(t,e){this.applyState([fw],[{name:fw,animation:t}],e)}applyUpdateState(t,e){this.applyState([mw],[{name:mw,animation:t}],e)}applyHighlightState(t,e){this.applyState([vw],[{name:vw,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([_w],[{name:_w,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class xw{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new bw(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new yw(t)),t._animationStateStore}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return(new xw)._getAnimationStateManager(t),t}}class Sw{getAttributes(t=!1){return t&&this.finalAttribute?this.finalAttribute:this.attribute}animate(t){var e,i,s;const n=new aw(null==t?void 0:t.id,null!==(i=null!==(e=null==t?void 0:t.timeline)&&void 0!==e?e:this.stage&&this.stage.getTimeline())&&void 0!==i?i:rw,null==t?void 0:t.slience);if(n.bind(this),t){const{onStart:e,onEnd:i,onRemove:s}=t;null!=e&&n.onStart(e),null!=i&&n.onEnd(i),null!=s&&n.onRemove(s)}return null===(s=this.stage)||void 0===s||s.ticker.start(),n}createTimeline(){return new nw}createTicker(t){return new hw(t)}setFinalAttributes(t){this.finalAttribute||(this.finalAttribute={}),Object.assign(this.finalAttribute,t)}initFinalAttributes(t){this.finalAttribute=t}initAnimateExecutor(){this._animateExecutor||(this._animateExecutor=new pw(this))}executeAnimation(t){return this.initAnimateExecutor(),this._animateExecutor.execute(t),this}executeAnimations(t){return this.initAnimateExecutor(),t.forEach((t=>{this._animateExecutor.execute(t)})),this}getFinalAttribute(){return this.finalAttribute}getGraphicAttribute(t,e=!1){return!e&&this.finalAttribute?this.finalAttribute[t]:this.attribute[t]}pauseAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function Aw(){G(Bp,xw),G(Bp,Sw)}class kw extends iw{constructor(t,e,i,s,n){super("customAnimate",e,i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class Mw extends kw{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class Tw{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new pw(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttr(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function ww(t){return new Tw(t)}class Cw extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,this.target.setAttribute("text",n)}}const Ew=1e3,Bw="quadInOut",Pw=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],Lw=(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=pp(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Rw=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?ey(t):[],n=ey(e);i&&s&&(i.fromTransform&&iy(s,i.fromTransform.clone().getInverse()),iy(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})))},Iw=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Dw=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Iw.includes(n))return;const r=e[n];if(!u(r)&&!u(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?dp.Get(t,cp.Color255):t;i.push({from:y(t[n])?t[n].map(e):e(t[n]),to:y(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class Fw extends kw{constructor(t,e,i){super({},{},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;Rw(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&Lw(this.otherAttrs,i,e),this.target.setAttributes(i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const zw=(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=Ow(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Dw(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new Fw({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Ew,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Bw);return c.play(d),c};class jw extends kw{constructor(t,e,i){super({},{},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;Rw(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&&Lw(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Hw=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Pw.includes(t))(i)||(e[i]=t[i])})),e},Vw=(t,e,i)=>{const s=Hw(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),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=Ao.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},Nw=(t,e,i)=>{const s=[],n=i?null:Hw(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:Hw(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=Rg(t.attribute),n=ny(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(Ao.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=ny(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(Ao.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=ny(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(Ao.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 ry(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 ry(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(Ao.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:ay(i)}];const s=[];return ly(i,e,s),s})(t,e).forEach((t=>{s.push(Ao.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 ly(l,e,h),h})(t,e).forEach((t=>{s.push(Ao.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=ey(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(Ao.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(Ao.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Vw(t,s,e),s};class Ww extends kw{constructor(t,e,i,s,n){super(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(){super.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:qo.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:qo.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:qo.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Gw extends Ww{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;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=Ao.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!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:y/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(_+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 Yw extends Ww{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:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=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=Ao.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:f,height:"in"===v&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===y?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class $w extends kw{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){super.onBind();const{points:t,segments:e}=this.target.attribute,{points:i,segments:s}=this.target.getFinalAttribute();this.from={points:t,segments:e},this.to={points:i,segments:s},this.props=this.to;const n=this.getPoints(this.from),r=this.getPoints(this.to,!0);this.fromPoints=n?Array.isArray(n)?n:[n]:[],this.toPoints=r?Array.isArray(r)?r:[r]:[];const a=new Map;this.fromPoints.forEach((t=>{t.context&&a.set(t.context,t)}));let o,l,h=1/0,c=-1/0;for(let t=0;t=0;t-=1)if(a.has(this.toPoints[t].context)){c=t,l=a.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(c)?(this.clipRange=this.toPoints[c][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[c][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=_t(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let d=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=a.get(t.context);return i?(d=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ec&&l?[l,t]:[d,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new re(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(t)return Object.keys(this.to).forEach((t=>{this.target.attribute[t]=this.to[t]})),this.target.addUpdatePositionTag(),void this.target.addUpdateShapeAndBoundsTag();if(this.points=this.points.map(((t,i)=>{const s=ed(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));this.target.setAttributes({clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.target.attribute.segments=e}else this.target.attribute.points=this.points;this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Xw extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0}));const o=this.target.getFinalAttribute();o&&this.target.setAttributes(o),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(a)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Kw extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Object.assign(this.target.attribute,i),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class qw extends Xw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class Zw extends Kw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}const Jw=(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.getFinalAttribute();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.getFinalAttribute();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)};class Qw extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this._updateFunction=null}updateStartAngle(t){this.target.attribute.startAngle=this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t}updateEndAngle(t){this.target.attribute.endAngle=this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class tC extends Qw{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=Jw(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r),this.determineUpdateFunction()}}class eC extends Qw{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class iC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/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:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class sC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const nC=(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,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:u(l)?void 0:c,height:u(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class rC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=nC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class aC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:u(o)?void 0:h,height:u(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const oC=(t,e,i)=>{const s=t.getFinalAttribute().points,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.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class lC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(this.target.attribute.points=r.map(((t,i)=>ed(r[i],a[i],e))),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class hC extends lC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:oC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class cC extends lC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:oC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const dC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class uC extends lC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:dC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class pC extends lC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:dC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const gC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class fC extends lC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:gC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class mC extends lC{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:gC(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const vC=(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.getFinalAttribute(),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.getFinalAttribute();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)};class _C extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class yC extends _C{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=vC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}}class bC extends _C{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const xC=(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.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:u(a)?void 0:l,width:u(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class SC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=xC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class AC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class kC extends Mw{onBind(){var t;const e=ww(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;this.target.setAttributes({x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class MC extends Mw{onBind(){const t=ww(this.target);this._animator=t;const e=this.duration,i=this.easing,{config:s,diffAttrs:n}=this.params;t.animate(this.target,{type:"to",to:Object.assign({},n),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},n)}}),this.completeBind(t)}deleteSelfAttr(t){super.deleteSelfAttr(t),this._animator.deleteSelfAttr(t)}tryPreventConflict(){}}function TC(){zk(),Nk(),qk(),iM(),pw.registerBuiltInAnimate("axisEnter",kC),pw.registerBuiltInAnimate("axisUpdate",MC)}var wC=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{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=pf.group({zIndex:999});e.name=vT.axisBreak,e.id=this._getNodeId(`${vT.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=j({},xT,s),a=null!==(e=r.size)&&void 0!==e?e:xT.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=pf.symbol(Object.assign({x:s.x,y:s.y},o));l.name=vT.axisBreakSymbol;const h=pf.symbol(Object.assign({x:n.x,y:n.y},o));h.name=vT.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=pf.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=vT.background,n.id=this._getNodeId("background"),n.states=j({},yT,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new UM(Object.assign({},t));e.name=vT.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=wC(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];P(l)||(c.state={line:j({},yT,l),symbol:j({},yT,l)});const d=new fT(c);d.name=vT.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return gt(t[0],0)?gt(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}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:d}=s,p=wC(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),_=this.getRelativeVector();let y=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+L(this.attribute,"label.space",4);y+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===_[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?y+=i+(e-1)*t:y=0}else if(0===_[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;y+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}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.getActualOffset(x),A=this.getVerticalCoord(v,S,!1),M=this.getVerticalVector(S,!1,{x:0,y:0});let T,w,{angle:C}=p;if(T="start"===n?"start":"end"===n?"end":"center",u(C)&&o){C=PM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;w=1==-1*t?"bottom":"top"}else T=this.getTextAlign(M),w=this.getTextBaseline(M,!1);let E=d;if(u(E)){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(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=s-S;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=s-S}const B=Object.assign(Object.assign(Object.assign({},A),p),{maxWidth:E,textStyle:Object.assign({textAlign:T,textBaseline:w},a),state:{text:j({},yT,c.text),shape:j({},yT,c.shape),panel:j({},yT,c.background)}});return B.angle=C,l&&l.visible&&(B.shape=Object.assign({visible:!0},l.style),l.space&&(B.space=l.space)),h&&h.visible&&(B.panel=Object.assign({visible:!0},h.style)),B}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:d}=s,p=wC(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),_=this.getVerticalVector(m,!1,{x:0,y:0});let y,{angle:b}=p,x="center";if(u(b)&&a){b=PM(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;y=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(_,!1,o.angle);x=t,y=e}const S=d,A=h?h(c):c,k=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:y},o),text:A});return k.angle=b,l&&l.visible&&(k.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),k}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return gt(t[1],0)?i=!gt(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 GT(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return YT(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=$(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(P(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(P(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,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=oe(e)})),UT(i,t),!NT(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=kT(a),l=AT(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=XT(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);k(i)&&(c=$t(c,i))}}else{if(l){const i=XT(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);k(i)&&(c=$t(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&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);$T(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&VT(t,{orient:o,method:m,separation:v,lastVisible:_,firstVisible: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=pf.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=vT.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-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(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 f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=RM(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=ai(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(){super.release(),this._breaks=null}}CC.defaultAttributes=bT,G(CC,KT);class EC{isInValidValue(t){const{startAngle:e=nM,endAngle:i=rM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=nM,endAngle:i=rM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return ce(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return wT(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function BC(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=BC(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var RC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),k(l)&&l>=3){const t=CT(n,l,c,e,i);h=pf.path(Object.assign(Object.assign({},a.style),{path:ET(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=pf.circle(t)}h.name=vT.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=j({},yT,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=RC(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=L(this.attribute.label,"style.fontSize",12)+L(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=n+m+f+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:j({},yT,d.text),shape:j({},yT,d.shape),panel:j({},yT,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;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(gt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=BC(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&PC(e,c,i)}else e.AABBBounds.width()>r&&PC(e,r,i)}else o>a.x&&h.x2>n.x2?(PC(e,n.x2-o,i),r&&LC(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return gt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}OC.defaultAttributes=bT,G(OC,EC);const IC=t=>t.map(((t,e)=>({index:e,value:t}))),DC=(t,e,i=0)=>{const s=new Ne(t).expand(i/2),n=new Ne(e).expand(i/2);return s.intersects(n)},FC=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=oe(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;u||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=LM(a),_=t.range();let y=[];for(let i=0;i{HC[t]=!0}));const GC=t=>-Math.log(-t),YC=t=>-Math.exp(-t),$C=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,XC=t=>10===t?$C:t===Math.E?Math.exp:e=>Math.pow(t,e),KC=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),qC=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),ZC=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function JC(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 QC(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function tE(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function eE(t,e,i,s){return 1===i&&(i=0),tE(t,i,s)*(e/(1-i))}function iE(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function sE(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=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 rE{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=iE(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=_t(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}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const aE=Symbol("implicit");class oE extends rE{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=jC.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=aE}clone(){const t=(new oE).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!==aE)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&&a>1;)a-=1,r=Math.floor((e-t)/a);return lE(t,e,r,n)}class cE extends oE{constructor(t){super(),this.type=jC.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=eE(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)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("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),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]}}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(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:hE(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=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(t=10){const e=this.calculateVisibleDomain(this._range);return hE(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=bt(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,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 cE(!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:dE}=ri;function uE(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return kt(t,e);if("string"===i){if(s=ii.parseColorString(e)){const e=dE(ii.parseColorString(t),s);return t=>e(t).formatRgb()}return kt(Number(t),Number(e))}return e instanceof si?dE(t,e):e instanceof ii?dE(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):kt(Number(t),Number(e))}class pE extends rE{constructor(t=WC,e=WC){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=WC,this._piecewise=QC,this._interpolate=uE}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),kt)),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=Mt,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=bt(i[0],i[r-1])),this._piecewise=r>2?sE:QC,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:WC),this.rescale(i)):this._clamp!==WC}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=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 gE=Math.sqrt(50),fE=Math.sqrt(10),mE=Math.sqrt(2),vE=[1,2,5,10],_E=(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=SE(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?bE(0,-(e-1)/s,s):bE((e-1)/s,0,s)},yE=vt(((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 _E(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return _E(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=bE(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=bE(t,e,l);return n&&r.reverse(),r})),SE=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=vE[0];return i>=gE?s=vE[3]:i>=fE?s=vE[2]:i>=mE&&(s=vE[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function AE(t,e,i){const s=(e-t)/Math.max(0,i);return SE(s)}function kE(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;e0;){if(s=AE(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function TE(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 wE=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),CE=vt(((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})),EE=vt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=xE(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?wE(t,e,n):wE(t,e,nE(n)),h=wE(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),BE=vt(((t,e,i,s,n)=>kE(s(t),s(e),i).map((t=>nE(n(t))))));class PE extends pE{constructor(){super(...arguments),this.type=jC.Linear}clone(){var t;const e=new PE;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return yE(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(d(null==e?void 0:e.customTicks))return e.customTicks(this,t);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=xE(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(t=10){const e=this.calculateVisibleDomain(this._range);return kE(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(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r: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}}function RE(t){return e=>-t(-e)}function OE(t=Number.EPSILON){return e=>Math.max(e,t)}class IE extends pE{constructor(){super(KC(10),XC(10)),this.type=jC.Log,this._limit=OE(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new IE).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=KC(this._base),s=XC(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=RE(i),this._pows=RE(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=GC,this.untransformer=YC):(this._logs=i,this._pows=s,this._limit=OE(),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 WC}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return CE(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return EE(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return BE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return BE(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{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))))}}}G(IE,LE);class DE extends PE{constructor(){super(qC(1),ZC(1)),this.type=jC.Symlog,this._const=1}clone(){return(new DE).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=qC(t),this.untransformer=ZC(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return CE(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return EE(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return BE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return BE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}G(DE,LE);class FE{constructor(){this.type=jC.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[lt(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 FE).domain(this._domain).range(this._range).unknown(this._unknown)}}function zE(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function jE(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!VC(t.type))return IC(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return IC([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:u=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),_=f&&f()?f().breakDomains:null,m=_&&_.length?v.filter((t=>_.every((e=>te[1])))):v;else if(p(h))m=zE(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=zE(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:u}):t.d3Ticks(e,{noDecimals:u})))}else{const i=null!==(s=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;m=zE(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:u,customTicks:n}):t.ticks(e,{noDecimals:u,customTicks:n})))}var v,_;const y=t.domain();if(e.labelFirstVisible&&y[0]!==m[0]&&!m.includes(y[0])&&m.unshift(y[0]),e.labelLastVisible&&y[y.length-1]!==m[m.length-1]&&!m.includes(y[y.length-1])&&m.push(y[y.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=zC(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=zC(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=$(l),r=f&&f()?VE.greedy:VE.parity;for(;l.length>=3&&PT(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;BT(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),jE(t,l,a,(e=>BT(e,t,i))),jE(n,l,o,(e=>BT(e,n,i)||!(!a||e===t)&&BT(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),$(h)!==$(m)&&h.push($(m))),m=h}}return IC(m)},VE={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&BT(i,t,e)||(i=t,0))))}},NE=(t,e,i,s)=>{const n=zC(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},UE=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,WE=(t,e)=>t[1]{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),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?IC([s[s.length-1]]):IC([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:f,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=K(g),a=X(g);if(s.length<=f/n){const i=NE(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=YE(s,i,o,e.labelLastVisible,Math.floor(n/l),!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=NE(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!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])){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&&!UE(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?WE(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{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=LM(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=ce({x:0,y:0},i,t),a=TT(r,wT(s,r,e,n));return o=a,l=wT(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return _.align||(gt(y,f.x)?_.baseline||(_.baseline=b>f.y?"top":"bottom"):y>f.x?_.align="left":y{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||h<=0)return IC(t.domain());let c;if(p(n))c=t.stepTicks(n);else if(p(s))c=t.forceTicks(s);else if(p(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=d(i)?i({axisLength:s,labelStyle:l}):i;c=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=$E(t,i,e),r=K(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=KE(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-p)}else c=t.domain();return IC(c)},KE=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&DC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},qE=new Uint32Array(33),ZE=new Uint32Array(33);ZE[0]=0,qE[0]=~ZE[0];for(let t=1;t<=32;++t)ZE[t]=ZE[t-1]<<1|1,qE[t]=~ZE[t];function JE(t,e,i={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:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&qE[31&o]&ZE[1+(31&l)])return!0}else{if(i[h]&qE[31&o])return!0;if(i[c]&ZE[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,qE[31&o]&ZE[1+(31&l)]);else for(s(h,qE[31&o]),s(c,ZE[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,ZE[31&a]|qE[1+(31&o)]);else for(n(l,ZE[31&a]),n(h,qE[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=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 QE(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=_t(i,-o,t.width+l),d=_t(s,-o,t.width+l),u=_t(n,-a,t.height+h),p=_t(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function tB(t,e,i=!1){return i?QE(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function eB(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=tB(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=QE(t,r)),e.getRange(r)))}function iB(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>p(t))),u=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return iB(t,e,n,o,h,c,l)}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 iB(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 iB(t,e,n,s,h,c)}return!1}const nB=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],rB=["top","inside-top","inside"];function aB(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let _=0,y=0;return u<0-h?_=-u:p>m&&(_=m-p),g<0-l?y=-g:f>v&&(y=v-f),{dx:_,dy:y}}const oB={mode:"same-time",duration:300,easing:"linear"};function lB(t){return 3===t||4===t}function hB(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 cB=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 dB(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)}}var uB=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{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const fB=(t,e)=>Math.ceil(t)>Math.floor(e),mB=([t,e],[i,s])=>s>t&&e>i;function vB(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}var _B=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{const e=t.target;e===this._lastHover||P(e.states)||(e.addState(oM.hover,!0),_M(this,(t=>{t===e||P(t.states)||t.addState(oM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(_M(this,(t=>{P(t.states)||(t.removeState(oM.hoverReverse),t.removeState(oM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void _M(this,(t=>{P(t.states)||(t.removeState(oM.selectedReverse),t.removeState(oM.selected))}));P(e.states)||(e.addState(oM.selected,!0),_M(this,(t=>{t===e||P(t.states)||t.addState(oM.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)===qo.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===qo.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(Ae(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,f=p-d;return[dB(g,f,c,d,a,o),dB(-g,-f,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds)}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=pf.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Wl)}return e&&e.getAttributes(!0).fill&&s.setAttribute("stroke",e.getAttributes(!0).fill),this.attribute.line&&!P(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;const t=[];!1!==this._enableAnimation&&this._baseMarks.forEach((e=>{t.push(e.attribute),e.initAttributes(e.getAttributes(!0))}));const{overlap:e,smartInvert:i,dataFilter:s,customLayoutFunc:n,customOverlapFunc:r}=this.attribute;let a=this.attribute.data;if(d(s)&&(a=s(a)),a&&a.length){const t=new Set;a=a.filter((e=>!t.has(e.id)&&t.add(e.id)))}let o=this._initText(a);o=d(n)?n(a,o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(o);const l=[],h=o;if(!c(e)&&d(null==e?void 0:e.filterBeforeOverlap)){const t=this.getRelatedGraphic.bind(this);o.forEach((i=>{e.filterBeforeOverlap(i,t,this)?h.push(i):l.push(i)}))}d(r)?o=r(h,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(l):!1!==e&&(o=this._overlapping(h).concat(l)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),o&&o.length&&o.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==i&&this._smartInvert(o),this._renderLabels(o),!1!==this._enableAnimation&&this._baseMarks.forEach(((e,i)=>{e.initAttributes(t[i])}))}_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&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(e)&&(t.states=e)}_createLabelText(t){var e,i;return DM(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;const i=[];let s;if(s=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),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&fB(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&fB(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(gt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(vB([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!mB([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let y=0,b=t.length-1;for(;y<=b;)y===b?_.push(t[y]):(_.push(t[y]),_.push(t[b])),y++,b--;return _}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&s.setRange(tB(i,t.AABBBounds,!0))}))),h.length>0&&h.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&&s.setRange(tB(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(tB(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){var s;if(t){if(!1!==t.attribute.visible){if(null===(s=t.context)||void 0===s?void 0:s.animationState){const e=t.clone();return Object.assign(e.attribute,t.getAttributes(!0)),e.AABBBounds}return t.AABBBounds}const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:n,y:r}=e;return{x1:n,x2:n,y1:r,y2:r}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:p}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{bB[t]=e};var SB=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{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,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*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}AB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const kB=()=>{xB("symbol",AB),xB("line-data",AB)};var MB=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{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}})(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}}}TB.tag="rect-label",TB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var wB=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{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=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}}(t,e,i,s)}};CB.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const EB=()=>{xB("line",CB),xB("area",CB)};var BB=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);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=d(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=d(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}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),h=l.getAttributes(!0),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.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=(h.startAngle+h.endAngle)/2,u=h.endAngle-h.startAngle,p=fe(h.endAngle-u/2),g=ce(c,h.outerRadius,o),f=ce(c,a+e.line.line1MinLength,o),m=new PB(t,g,f,p,u,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=ce(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(d=m.quadrant)||2===d?this._arcRight.set(m.refDatum,m):lB(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var d}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":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 f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,_=0;if("inside"===o&&(_="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=ce(t.circleCenter,v,t.middleAngle),t.labelLimit=f,ft(f,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.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=lB(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=lB(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.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 c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(mt(t.pointB.x,this._line2MinLength+h)||ft(t.pointB.x,c-this._line2MinLength-h))&&(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(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;k(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=lB(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-y-c:0+y+c;break;default:m=p.x+f*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+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?lB(t.quadrant)?"left":"right":lB(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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*(lB(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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,f,m;if(gt(l/2,u))g=0,f=1,m=-p;else if(gt(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,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,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?gt(v[0].y,v[1].y)?ft(t.middleAngle,-Math.PI)&&mt(t.middleAngle,0)||ft(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.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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;e{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 IB(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=ae.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 DB(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=ET(t,!!n),o=ET(r,!!n);const h=ae.distancePP(s,l),c=ae.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=IB(e,t,!1,!!n),o=IB(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=ET(t,!!n),o=ET(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}OB.defaultAttributes={pickable:!1};class FB extends tb{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&MT(this._innerView),this.removeAllChild(!0),this._innerView=pf.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 TT(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:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${vT.grid}-sub`:`${vT.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=ET(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=IB(t,o,!1,!!a)}const u=pf.path(Object.assign({path:c,z:l},d(r)?j({},this.skipDefault?null:FB.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 f=ET(o,!!a),m=Ut(o[0].x-o[1].x),v=Ut(o[0].y-o[1].y),_=pf.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*jt/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?j({},this.skipDefault?null:FB.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],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!gt(a.value,0)&&!gt(l.value,0),d=!gt(a.value,1)&&!gt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}FB.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},zk(),Wk();class zB extends FB{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},FB.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=nM,endAngle:r=rM}=this.attribute;i=CT(t,s,ae.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=j({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);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})}}G(zB,KT);var jB,HB,VB,NB=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){const e=this._getPointsOfSubGrid(p,d);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"})}}G(UB,EC),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(jB||(jB={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(HB||(HB={})),function(t){t.dataZoomChange="dataZoomChange"}(VB||(VB={}));const WB="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",GB={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:WB,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:WB,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},YB={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}},$B=0,XB=1,KB=2,qB=3,ZB=4,JB=5,QB=5,tP=999,eP=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var iP=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;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s,zIndex:KB},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s,zIndex:KB},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto",zIndex:$B},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,k,M,T;const{orient:w,middleHandlerStyle:C={},startHandlerStyle:E={},endHandlerStyle:B={},zoomLock:P}=this.attribute,{start:L,end:R}=this._getState(),{position:O,width:I,height:D}=this._getLayoutAttrFromConfig(),F=null!==(t=E.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=B.triggerMinSize)&&void 0!==e?e:40,j=this._getContainer();if(this._isHorizontal){if(C.visible){const t=(null===(i=C.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:O.x+L*I,y:O.y-t,width:(R-L)*I,height:t,zIndex:JB},null===(s=C.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=C.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:O.x+(L+R)/2*I,y:O.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=C.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square",zIndex:JB},C.icon),{pickable:!P&&(null===(h=C.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:O.x+L*I,y:O.y+D/2,size:D,symbolType:null!==(c=E.symbolType)&&void 0!==c?c:"square"},YB.horizontal),{zIndex:JB}),E),{pickable:!P&&(null===(d=E.pickable)||void 0===d||d)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:O.x+R*I,y:O.y+D/2,size:D,symbolType:null!==(u=B.symbolType)&&void 0!==u?u:"square"},YB.horizontal),{zIndex:JB}),B),{pickable:!P&&(null===(p=B.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:O.x+L*I-t/2,y:O.y+D/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:tP},YB.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:O.x+R*I-g/2,y:O.y+D/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:tP},YB.horizontal),{pickable:!P}),"rect")}else{if(C.visible){const t=(null===(g=C.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===w?O.x-t:O.x+I,y:O.y+L*D,width:t,height:(R-L)*D,zIndex:JB},null===(f=C.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(_=null===(v=null===(m=C.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===_||_)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===w?O.x-t/2:O.x+I+t/2,y:O.y+(L+R)/2*D,angle:Math.PI/180*90,symbolType:null!==(b=null===(y=C.icon)||void 0===y?void 0:y.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0,zIndex:JB},C.icon),{pickable:!P&&(null===(S=null===(x=C.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:O.x+I/2,y:O.y+L*D,size:I,symbolType:null!==(A=E.symbolType)&&void 0!==A?A:"square"},YB.vertical),{zIndex:JB}),E),{pickable:!P&&(null===(k=E.pickable)||void 0===k||k)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:O.x+I/2,y:O.y+R*D,size:I,symbolType:null!==(M=B.symbolType)&&void 0!==M?M:"square",zIndex:JB},YB.vertical),B),{pickable:!P&&(null===(T=B.pickable)||void 0===T||T)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:O.x+I/2+t/2,y:O.y+L*D-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:tP},YB.vertical),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:O.x+I/2+i/2,y:O.y+R*D-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:tP},YB.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move",zIndex:qB},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move",zIndex:qB},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1,zIndex:XB},"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))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1,zIndex:ZB},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){return t.length<=10||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,void 0!==e?e*e:1)}(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(t);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(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){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 Ve).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)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=iP(c,["formatMethod"]),{formatMethod:g}=d,f=iP(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:_,width:y,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,A={x1:_.x,y1:_.y,x2:_.x+y,y2:_.y+b};let k,M,T,w;this._isHorizontal?(k={x:_.x+m*y,y:_.y+b/2},M={x:_.x+v*y,y:_.y+b/2},T={textAlign:eP(A,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},w={textAlign:eP(A,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:_.x+y/2,y:_.y+m*b},M={x:_.x+y/2,y:_.y+v*b},T={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:eP(A,t,"start",this._isHorizontal)?"top":"bottom"},w={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:eP(A,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),j({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T,zIndex:QB}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),j({},f,{text:S,x:M.x,y:M.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w,zIndex:QB}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new UM(e),s.name=i,t.add(s)),s}}const nP={debounce:St,throttle:At};class rP extends l{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=jB.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=jB.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=jB.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=jB.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=jB.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===k_.env?k_:this.stage,s=dM();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===jB.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===jB.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===jB.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===jB.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(HB.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(HB.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(HB.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===jB.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(HB.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(HB.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:nP[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===k_.env?k_:this.stage,e=dM();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===k_.env?k_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===k_.env?k_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:_t(e+t,0,1),end:_t(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=jB.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}VM(),Xk(),tM(),Lk(),Nk();let aP=class t extends tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,_;h.visible?this._isHorizontal?(m=p,v=g-f,_={x:a.x,y:a.y+f}):(m=p-f,v=g,_={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(y+b)/2,_={x:_.x+y/2,y:_.y}):(v-=(y+b)/2,_={x:_.x,y:_.y+y/2})),v+=(null!==(n=u.lineWidth)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:_,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new sP(this._getRendererAttrs()),this._interaction=new rP(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(HB.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(HB.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(VB.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(HB.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;p(t)&&p(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(VB.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.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._renderer.previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._renderer.statePointToData=t)}};var oP,lP,hP,cP;function dP(){zk(),VM(),Aw()}aP.defaultAttributes=GB,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"}(oP||(oP={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(lP||(lP={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(hP||(hP={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(cP||(cP={}));class uP extends tb{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=LT(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=RT(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=OT(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:j({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:j({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:j({},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=pf.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=pf.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=pf.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 pP(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 gP(t,e,i,s){t&&(pP(t.startSymbol,e,i,s),t.lines.forEach((t=>pP(t,e,i,s))),pP(t.line,e,i,s),pP(t.endSymbol,e,i,s))}function fP(t,e,i,s){t&&(pP(t.getTextShape(),e,i,s),pP(t.getBgRect(),e,i,s))}function mP(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 vP(t,e,i,s){t&&(mP(t.startSymbol,e,i,s),t.lines.forEach((t=>mP(t,e,i,s))),mP(t.line,e,i,s),mP(t.endSymbol,e,i,s))}function _P(t,e,i,s){t&&(mP(t.getTextShape(),e,i,s),mP(t.getBgRect(),e,i,s))}function yP(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;pP(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)})),pP(t.endSymbol,s+r+a,o,n),Y(e).forEach((t=>{const e=s+r+a+o;pP(t.getTextShape(),e,l,n),pP(t.getBgRect(),e,l,n)}))}function bP(t,e,i,s,n){gP(t,s,i,n),Y(e).forEach((t=>{fP(t,s,i,n)}))}function xP(t,e,i,s,n){pP(t,s,i,n),Y(e).forEach((t=>{fP(t,s,i,n)}))}function SP(t,e,i,s,n){pP(t,s,i,n),Y(e).forEach((t=>{fP(t,s,i,n)}))}function AP(t,e,i,s,n,r){var a;gP(t,n,s,r),pP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?fP(i,n,s,r):pP(i,n,s,r)}function kP(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;pP(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)})),pP(e,n+o+l,h,r),pP(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(pP(i.getTextShape(),n+o+l+h+c,d,r),pP(i.getBgRect(),n+o+l+c,d,r)):pP(i,n+o+l+c,d,r)}function MP(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?yP(t,e,s,r,a):"fadeIn"===i&&bP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?yP(t,e,s,n,a):"fadeIn"===i&&bP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){vP(t,s,i,n),Y(e).forEach((t=>{_P(t,s,i,n)}))}(t,e,i,s,n)}}function TP(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&&xP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&xP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){mP(t,s,i,n),Y(e).forEach((t=>{_P(t,s,i,n)}))}(t,e,i,s,n)}}function wP(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&&SP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&SP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){mP(t,s,i,n),Y(e).forEach((t=>{_P(t,s,i,n)}))}(t,e,i,s,n)}}function CP(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?AP(n,r,e,i,s,o):"callIn"===t&&kP(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?AP(n,r,e,i,s,a):"callIn"===t&&kP(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;vP(t,n,s,r),mP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?_P(i,n,s,r):mP(i,n,s,r)}(n,r,e,t,i,s)}}const EP={type:"clipIn",duration:500,easing:"linear",delay:0},BP={type:"fadeIn",duration:500,easing:"linear",delay:0},PP={type:"callIn",duration:500,easing:"linear",delay:0},LP={type:"fadeOut",duration:500,easing:"linear",delay:0};class RP{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=Y(null==n?void 0:n.label),a=Y(null==n?void 0:n.labelBackground),o=Y(s).map(((s,n)=>{var o,l;const h=j({},i,s),c=new UM(Object.assign(Object.assign({},h),{state:{panel:j({},lM,null!==(o=a[n])&&void 0!==o?o:$(a)),text:j({},lM,null!==(l=r[n])&&void 0!==l?l:$(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===Y(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=Y(this._label),n=Y(null==i?void 0:i.label),r=Y(null==i?void 0:i.labelBackground);if(s.length){const i=Y(e);s.forEach(((e,s)=>{var a,o;const l=j({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:j({},lM,null!==(a=r[s])&&void 0!==a?a:$(r)),text:j({},lM,null!==(o=n[s])&&void 0!==o?o:$(n))}})),this.setLabelPos(e,l)}))}}}class OP extends uP{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=EP,this.defaultExitAnimation=LP}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;HM(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}G(OP,RP);const IP=.001,DP={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:oP.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]}},FP={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"}}},zP={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:{autoRotate:!0,position:hP.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]}},jP={interactive:!0,label:{position:lP.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}},HP={interactive:!0,label:{autoRotate:!0,position:hP.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}},VP={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"}},NP={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"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},UP={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 WP(){GP._animate=MP}dP(),pT(),Aw();class GP extends OP{markerAnimate(t){GP._animate&&this._animationConfig&&GP._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},GP.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i: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,e){var i;return(bM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return xM(Math.abs(e),Math.PI/2,IP)||xM(Math.abs(e),3*Math.PI/2,IP)?SM(i,e,t):bM(e)?FP.postiveXAxis[t]:FP.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new fT({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:j({},lM,null==a?void 0:a.line),startSymbol:j({},lM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},lM,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:j({},lM,null==a?void 0:a.line),startSymbol:j({},lM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},lM,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}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",GP.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(GP.defaultAttributes.label)}}function YP(){$P._animate=TP}GP.defaultAttributes=DP,dP(),Yk(),Aw();class $P extends uP{markerAnimate(t){$P._animate&&this._animationConfig&&$P._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},$P.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=BP,this.defaultExitAnimation=LP}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},NP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;HM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=pf.polygon(Object.assign({points:e},i));n.states=j({},lM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",$P.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=j({},lM,null==i?void 0:i.area)),this._updateMarkLabels($P.defaultAttributes.label)}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}}$P.defaultAttributes=jP,G($P,RP),dP(),gT(),Aw();class XP extends OP{markerAnimate(t){XP._animate&&this._animationConfig&&XP._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},XP.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case hP.arcInnerStart:l=n;case hP.arcOuterStart:l=n;break;case hP.arcInnerEnd:l=r;case hP.arcOuterEnd:l=r;break;case hP.center:case hP.arcInnerMiddle:case hP.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return VP[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new mT({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:j({},lM,null==o?void 0:o.line),startSymbol:j({},lM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},lM,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:j({},lM,null==o?void 0:o.line),startSymbol:j({},lM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},lM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",XP.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(XP.defaultAttributes.label)}}XP.defaultAttributes=zP,dP(),Bk(),Aw();class KP extends uP{markerAnimate(t){KP._animate&&this._animationConfig&&KP._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},KP.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=BP,this.defaultExitAnimation=LP}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case hP.center:h=(s+n)/2,c=(r+a)/2;break;case hP.arcInnerStart:h=s,c=r;break;case hP.arcOuterStart:h=n,c=r;break;case hP.arcInnerEnd:h=s,c=a;break;case hP.arcOuterEnd:h=n,c=a;break;case hP.arcInnerMiddle:h=s,c=(r+a)/2;break;case hP.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},VP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;HM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=pf.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=j({},lM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",KP.defaultAttributes.label)}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=j({},lM,null==o?void 0:o.area)),this._updateMarkLabels(KP.defaultAttributes.label)}isValidPoints(){return!0}}function qP(){ZP._animate=CP}KP.defaultAttributes=HP,G(KP,RP),dP(),pT(),gT(),tM(),Hk(),Nk(),Aw();class ZP extends uP{markerAnimate(t){ZP._animate&&this._animationConfig&&ZP._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},ZP.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=PP,this.defaultExitAnimation=LP,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return xM(Math.abs(s),Math.PI/2,IP)||xM(Math.abs(s),3*Math.PI/2,IP)?SM(t,s,n):bM(s)?UP.postiveXAxis[n]:UP.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,style:d,position:u=cP.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-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,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:j({},lM,null==p?void 0:p.textBackground),text:j({},lM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=j({},lM,null==p?void 0:p.itemContent));const v=bM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+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",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=pf.symbol(Object.assign(Object.assign({},i),r)),o.states=j({},lM,null==s?void 0:s.itemContent)):"text"===n?o=new UM(Object.assign(Object.assign({},i),{state:{panel:j({},lM,null==s?void 0:s.textBackground),text:j({},lM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=pf.richtext(Object.assign(Object.assign({},i),r)),o.states=j({},lM,null==s?void 0:s.itemContent)):"image"===n?(o=pf.image(Object.assign(Object.assign({},i),r)),o.states=j({},lM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=j({},lM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}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=xM(c,0,IP)||xM(d,0,IP),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=zM(e-u,t-d),o=zM(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*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(aL.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(aL.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===aL.focus||"focus"===o){const s=a.hasState(nL.focus);a.toggleState(nL.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[nL.unSelected,nL.unSelectedHover,nL.focus],t),this._setLegendItemState(e,nL.selected,t)})):(this._setLegendItemState(a,nL.selected,t),this._removeLegendItemState(a,[nL.unSelected,nL.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[nL.selected,nL.selectedHover,nL.focus],t),this._setLegendItemState(e,nL.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(nL.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(nL.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(rL.legendItemClick,a,t);i?(this._removeLegendItemState(a,[nL.selected,nL.selectedHover],t),this._setLegendItemState(a,nL.unSelected,t)):(this._setLegendItemState(a,nL.selected,t),this._removeLegendItemState(a,[nL.unSelected,nL.unSelectedHover],t))}else this._setLegendItemState(a,nL.selected,t),this._removeLegendItemState(a,[nL.unSelected,nL.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[nL.selected,nL.selectedHover],t),this._setLegendItemState(e,nL.unSelected,t))}))}this._dispatchLegendEvent(rL.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,nL.selected),this._removeLegendItemState(e,[nL.unSelected,nL.unSelectedHover])):(this._removeLegendItemState(e,[nL.selected,nL.selectedHover]),this._setLegendItemState(e,nL.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=eL,spaceRow:l=iL,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:u?i:e,v=this._contentMaxHeight;let _,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,M=0,T=0;const w=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),_=d[t],_.id||(_.id=_.label),_.index=t;let e=!0;y(n)&&(e=n.includes(_.label));const i=this._renderEachItem(_,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||w.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=T+l,T=0,w.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),w.push(i)):(p(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=M+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=pf.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:u}=t,g=[];p(c)&&g.push(c),p(d)&&g.push(d),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=K(g)),p(u)&&(this._itemHeightByUser=u);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,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:f,autoEllipsisStrategy:m}=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=ai(c);let w;!1===x.visible?(w=pf.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,aL.item,t,w)):(w=pf.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,aL.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?nL.selected:nL.unSelected);const C=pf.group({x:0,y:0,pickable:!1});w.add(C);let E,B=0,P=0,R=0;if(v&&!1!==v.visible){const i=L(S,"style.size",10);P=y(i)?i[0]||0:i,R=L(v,"space",8);const s=pf.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,aL.itemShape,t,w,S.state),s.addState(e?nL.selected:nL.unSelected),C.add(s)}let O=0;if(d){const e=L(g,"size",10);E=pf.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,aL.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=DM(Object.assign(Object.assign({x:P/2+R,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,aL.itemLabel,t,w,A.state),D.addState(e?nL.selected:nL.unSelected),C.add(D);const F=L(_,"space",8);if(p(l)){const s=L(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=DM(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,aL.itemValue,t,w,k.state),r.addState(e?nL.selected:nL.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-P-R-F-O-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-P/2-T[1]-T[3]-O-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));B=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-P-R-O),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",B),C.add(E));const z=C.AABBBounds,j=z.width();if("right"===f){const t=z.x2,e=z.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=z.height(),V=p(this.attribute.item.width)?this.attribute.item.width:j+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(-z.x1+T[3],-z.y1+T[0]),w}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new tL(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},j({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new tL(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new pM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new pM(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?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 i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",At(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=eL,spaceRow:o=iL}=n,l=this._itemsContainer,{space:h=sL,defaultCurrent:c=1}=r,d=cL(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,_=0,y=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v0&&(y=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:y,y:b}),y+=a+i})),this._itemContext.startX=y,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),_=p-g.AABBBounds.height()-h-t,_<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;_0&&(b=0,y+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:y,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=pf.group({x:0,y:t,width:u?v:f,height:u?m:_,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=eL,spaceRow:a=iL}=s,o=this._itemsContainer,{space:l=sL,defaultCurrent:h=1}=n,c=cL(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const _=pf.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=pf.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];gt(_t(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),gt(_t(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(nL.selected)?this._setLegendItemState(t,nL.selectedHover,e):this._setLegendItemState(t,nL.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===aL.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(rL.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(nL.unSelectedHover)||t.hasState(nL.selectedHover))&&(i=!0),t.removeState(nL.unSelectedHover),t.removeState(nL.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(nL.unSelectedHover)&&!t.hasState(nL.selectedHover)||(i=!0),t.removeState(nL.unSelectedHover),t.removeState(nL.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===aL.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(rL.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(rL.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!==aL.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(rL.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!==aL.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(rL.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(nL.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=j({},dL,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(nL.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}release(){super.release(),this.removeAllEventListeners()}};var pL;function gL(t){return y(t)?t:[t,t]}function fL(t){return t?"ew-resize":"ns-resize"}uL.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:eL,spaceRow:iL,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:sL,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"}(pL||(pL={})),lL();class mL extends tb{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},mL.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=_t(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=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=dM(),n="browser"===k_.env?k_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;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=_t(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=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=dM(),n="browser"===k_.env?k_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{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?_t(t+p,h,c):_t(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?_t(t+p,0,c-h):_t(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=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),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:gL(d)[0],endValue:gL(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=pf.group({x:0,y:0});f.name=pL.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=pf.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)),m.name=pL.startText,f.add(m);const e=p(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const _=pf.group({x:g?v:0,y:g?0:v});f.add(_);const y=pf.group({x:0,y:0});let b;if(y.name=pL.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=pf.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=pL.endText,f.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=pf.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=pL.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,f]=gL(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":fL(p)},r));if(v.name=pL.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=pL.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":fL(p)},r));if(i.name=pL.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f,"end");e.name=pL.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=yt(h,i,s);c=t[0],d=t[1]}else c=i,d=_t(h,i,s);const p=this._isHorizontal;e||(c=i);const f=pf.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=pL.trackContainer;const m=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":fL(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=pf.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=pL.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return pf.symbol(t)}_renderHandlerText(t,e){return pf.text(this._getHandlerTextAttributes(t,e))}_getHandlerPosition(t){return this.attribute.range&&t?"start":"end"}_getHandlerTextStyle(t,e){const{align:i,handlerSize:s=14,handlerText:n={},railHeight:r,railWidth:a,slidable:o}=this.attribute;return d(n.style)?n.style(t,e,{layout:this.attribute.layout,align:i,railWidth:a,railHeight:r,handlerSize:s,slidable:o}):n.style}_getHandlerTextAttributes(t,e){var i,s;const{align:n,handlerSize:r=14,handlerText:a={},railHeight:o,railWidth:l,slidable:h}=this.attribute,c=this._isHorizontal,d=this.calculatePosByValue(t,e),u=null!==(i=a.space)&&void 0!==i?i:4,p=this._getHandlerTextStyle(t,e),g={text:a.formatter?a.formatter(t):t.toFixed(null!==(s=a.precision)&&void 0!==s?s:0),lineHeight:null==p?void 0:p.lineHeight,cursor:!1===h?"default":fL(c)};return c?"top"===n?(g.textBaseline="bottom",g.textAlign="center",g.x=d,g.y=(o-r)/2-u):(g.textBaseline="top",g.textAlign="center",g.x=d,g.y=(o+r)/2+u):"left"===n?(g.textBaseline="middle",g.textAlign="end",g.x=(l-r)/2-u,g.y=d):(g.textBaseline="middle",g.textAlign="start",g.x=(l+r)/2+u,g.y=d),Object.assign(Object.assign({},g),p)}_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=pf.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=pf.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),("browser"===k_.env?k_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=dM(),e="browser"===k_.env?k_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_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){const s=this._isHorizontal;t.setAttribute(s?"x":"y",e);const n=t.name===pL.startHandler?this._startHandlerText:this._endHandlerText;if(n){const e=this._getHandlerPosition(t.name===pL.startHandler);n.setAttributes(this._getHandlerTextAttributes(i,e))}t.name===pL.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){const s=this._isHorizontal,n=this._getHandlerPosition(t.name===pL.startHandlerText);t.setAttributes(this._getHandlerTextAttributes(i,n));const r=t.name===pL.startHandlerText?this._startHandler:this._endHandler;r&&r.setAttributes({[s?"x":"y"]:e}),t.name===pL.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}}release(t){super.release(t),("browser"===k_.env?k_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}mL.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}}},hL(),lL();class vL extends oL{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},vL.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:f,handlerText:m,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:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function _L(t="bottom"){let 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`}vL.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"}}},hL(),lL(),Wk();class yL extends oL{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},yL.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:f,showTooltip:m,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=pf.group({x:0,y:0});this._innerView.add(x);const S=new mL({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:_L(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,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=pf.path(Object.assign(Object.assign({x:0,y:k,path:A},_),{zIndex:0}));x.add(M);const T=this._title?this._title.AABBBounds.height()+L(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))}}yL.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)"}},zk(),iM(),qk();let bL=class t extends tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,b,x;const{textType:S,text:A,subtextType:k,textStyle:M={},subtext:T,subtextStyle:w={},width:C,height:E,minWidth:B,maxWidth:P,minHeight:L,maxHeight:R,align:O,verticalAlign:I,padding:D=0}=this.attribute,F=ai(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),j=null!==(t=M.height)&&void 0!==t?t:E;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:u="break-word",maxWidth:g,lineClamp:f}=M;if("rich"===S||p(M.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:C)&&void 0!==e?e:0,height:null!=j?j:0,ellipsis:null==d||d,wordBreak:null!=u?u:"break-word",maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:null!==(i=M.character)&&void 0!==i?i:A},M);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},hM),M),x:h,y:c,width:null!==(s=null!=t?t:C)&&void 0!==s?s:0,height:null!=j?j:0,ellipsis:d,wordBreak:u,maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:[]},M);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else p(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(A)?A:[A],whiteSpace:"normal"},M),{maxLineWidth:null!==(r=null!==(n=M.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:C,heightLimit:null!==(a=M.height)&&void 0!==a?a:R,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const H=this._mainTitle?this._mainTitle.AABBBounds.height():0,V=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==w.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=w,v=Math.max(Number.MIN_VALUE,R-H);if("rich"===k||p(w.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:C)&&void 0!==o?o:0,height:null!==(l=null!=e?e:E)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=w.character)&&void 0!==h?h:T},w);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:T},hM),w),x:n,y:r,width:null!==(c=null!=t?t:C)&&void 0!==c?c:0,height:null!==(d=null!=e?e:E)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},w);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else p(T)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(T)?T:[T],whiteSpace:"normal"},w),{maxLineWidth:null!==(u=w.maxLineWidth)&&void 0!==u?u:C,heightLimit:null!==(g=w.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:H}),"text"))}const N=this._subTitle?this._subTitle.AABBBounds.height():0,U=this._subTitle?this._subTitle.AABBBounds.width():0;let W=Math.max(V,U),G=H+(null!==(f=w.height)&&void 0!==f?f:N);if(p(C)&&(W=C),p(E)&&(G=E),p(B)&&WP&&(W=P),p(L)&&GR&&(G=R),z.attribute.width=W,z.attribute.height=G,z.attribute.boundsPadding=F,this._mainTitle){if(p(O)||p(M.align)){const t=M.align?M.align:O,e=null!==(m=M.width)&&void 0!==m?m:W;"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")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:I,e=null!=j?j:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"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")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(p(O)||p(w.align)){const t=w.align?w.align:O,e=null!==(_=null!==(v=w.width)&&void 0!==v?v:M.width)&&void 0!==_?_:W;"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")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=w.verticalAlign?w.verticalAlign:I,e=this._mainTitle?p(j)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),j):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=w.height)&&void 0!==b?b:E)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"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")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};bL.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 xL={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"}}};zk(),iM(),qk();let SL=class extends tb{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=j({},L(xL,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=DM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{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,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(p(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),p(s)){const t=Y(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e: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=RM(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,f=c/2,m=g**2+1,v=2*f*g,_=f**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*m*_))/(2*m))+f),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 AL extends Cg{constructor(t){super(t)}}var kL,ML;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(kL||(kL={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(ML||(ML={}));class TL extends tb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},TL.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"},TL.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"},TL.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},TL.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},TL.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 AL(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new AL(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new AL(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(kL.OnPlay)},this.pause=()=>{this._dispatchEvent(kL.OnPause)},this.forward=()=>{this._dispatchEvent(kL.OnForward)},this.backward=()=>{this._dispatchEvent(kL.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()}}TL.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},TL.defaultAttributes={[ML.Start]:{},[ML.Pause]:{},[ML.Backward]:{},[ML.Forward]:{}};const wL={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},CL=[200,10];var EL,BL;!function(t){t.Default="default",t.Reverse="reverse"}(EL||(EL={})),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"}(BL||(BL={}));const PL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===EL.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===EL.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),LL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===EL.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===EL.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),RL=t=>"top"===t||"bottom"===t;class OL extends tb{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},OL.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=Yt(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(RL(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:CL[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:CL[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 mL(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 t.layout=RL(this._orient)?"horizontal":"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 TL(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=RL(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:CL[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Yt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(RL(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:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:RL(this._orient)?t+s:(this._size.width-r)/2,y:RL(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:RL(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:RL(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:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:RL(this._orient)?t+s:(this._size.width-r)/2,y:RL(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]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function IL(){lL(),zk(),tM()}OL.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({},wL),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},wL),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},wL),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},wL),{key:"backward",position:"start"})}},IL();class DL extends OL{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},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:EL.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(kL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(kL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(kL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(kL.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(BL.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(PL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||LL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===EL.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(BL.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=k_.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(BL.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(BL.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=k_.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(),k_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(BL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,k_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(BL.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(BL.change),this.dispatchCustomEvent(BL.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var FL,zL=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())}))};IL();class jL extends OL{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(kL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(kL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(kL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(kL.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(BL.change))},this.play=()=>zL(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(BL.play),this._rafId=k_.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=k_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,k_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(BL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,k_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(BL.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(BL.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(BL.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.brushActive="brushActive",t.brushClear="brushClear"}(FL||(FL={}));const HL={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],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:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},VL=5;const NL={debounce:St,throttle:At};zk(),Yk();let UL=class t extends tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=HL.updateTrigger,endTrigger:i=HL.endTrigger,brushMoved:s=!0}=this.attribute;Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushingWithDelay))),Y(i).forEach((t=>this.stage.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos]},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:NL[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(FL.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const{trigger:t=HL.trigger,resetTrigger:e=HL.resetTrigger}=this.attribute;Y(t).forEach((t=>this.stage.addEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(FL.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;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,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(FL.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=VL}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(FL.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(FL.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;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._dispatchBrushEvent(FL.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=VL}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(FL.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(FL.brushClear,t)):Math.abs(r-s)this.stage.removeEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents()}_releaseBrushUpdateEvents(){const{updateTrigger:t=HL.updateTrigger,endTrigger:e=HL.endTrigger}=this.attribute;Y(t).forEach((t=>this.stage.removeEventListener(t,this._onBrushingWithDelay))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushEnd)))}_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=pf.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}_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(Le(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_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.ythis._brushMaskAABBBoundsDict[t].empty()))}};UL.defaultAttributes=HL;const WL=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return j(t,...e,{shape:i.every(u)?void 0:j({},...i),key:s.every(u)?void 0:j({},...s),value:n.every(u)?void 0:j({},...n)})},GL=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}},YL={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:aM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:aM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:aM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ne).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},$L=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];zk(),Xk(),tM(),iM(),qk();let XL=class t extends tb{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: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=ai(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",j({symbolType:"circle"},u.shape,{visible:yM(u)&&yM(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:yM(u)&&yM(u.value)},GL(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:yM(u)&&yM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:yM(u)&&yM(u.value)},GL(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},hM),u.value),visible:yM(u)&&yM(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=yM(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:f,textBaseline:m}=u.value,v=n.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 _=yM(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(!yM(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)+(yM(n.key)?r+n.key.spacing:0)+(yM(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&&(FM(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";p(n.value.textAlign)?t=n.value.textAlign:yM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),FM(c,f,t,u,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(yM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=ad(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(yM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},GL(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},GL(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},hM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(yM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},GL(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},GL(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=>$L.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)&&yM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=yM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=LM(d),_=LM(u);let y=0;if(yM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),y=Math.max(y,e)}if(yM(u)){const{width:t,height:e}=_.quickMeasure(u.text);h.push(t),y=Math.max(y,e)}f&&cu[m]&&(t=!0,r.push(p.size),y=Math.max(p.size,y)),e.height=y,o+=y,a{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 WL({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return WL({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};XL.defaultAttributes=YL;const KL=gt;function qL(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:K(i)}function ZL(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function JL(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function QL(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 tR(t,e){const i=QL(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 eR(t,e){const i=iR(t),s=iR(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 iR(t,e={x:0,y:0}){return ae.distancePP(t,e)}function sR(t){return k(t.x)&&k(t.y)}function nR(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 rR(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const aR=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function lR(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&lR(t[i],e)}}var hR,cR,dR;function uR(t){var e,i;const{type:s}=t;return s===cR.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!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.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_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"}(hR||(hR={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",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",t.mosaic="mosaic",t.pictogram="pictogram"}(cR||(cR={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",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.transform="transform",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.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.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(dR||(dR={}));const pR={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},gR={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function fR(t,e){var i;if(!t)return[];const s=SR(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?bR(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>yR(i)?vR(t,i,e):i)).filter(p)}))):i.map((i=>yR(i)?vR(t,i,e):i)).filter(p):[]}return[]}function mR(t,e){var i,s;return bR(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 vR(t,e,i){var s;const n=SR(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=pR[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=gR[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 ii(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=$e(t,i,s),a=Ye(n,r,e.l),l=new ii(`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 _R=(t,e)=>{if(e&&yR(t)){const i=vR(e,t);if(i)return i}return t};function yR(t){return t&&"palette"===t.type&&!!t.key}function bR(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function xR(t){return y(t)?{dataScheme:t}:t}function SR(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=uR(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 AR extends oE{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(!bR(this._range))return void super.range(this._range);const t=mR(this._range,this._domain);super.range(t)}}const kR={linear:PE,band:cE,point:class extends cE{constructor(t){super(!1),this.type=jC.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:oE,threshold:FE,colorOrdinal:AR};function MR(t){const e=kR[t];return e?new e:null}function TR(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function wR(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function CR(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function ER(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function BR(t){return!!_(t)&&(!!t.endsWith("%")&&Zy(t.substring(0,t.length-1)))}function PR(t){return!!g(t)&&("percent"in t||"offset"in t)}function LR(t,e,i,s=0){var n,r;return S(t)?t:BR(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 RR(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]=LR(t[s],e.size,i)}))})),o}function OR(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}}function IR(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)||BR(t)||d(t)||PR(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function DR(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const FR=(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},zR=[{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"]}];function jR(t,e){return t&&e.key in t?t[e.key]:e.default}function HR(t){return t&&"token"===t.type&&!!t.key}const VR={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%"},NR={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:zR,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)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:VR,component:{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}}},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:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},UR={name:"dark",colorScheme:{default:{dataScheme:zR,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",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},WR=(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]={}),WR(t[s],e.slice(1),i))};function GR(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=xR(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}YR._charts={},YR._series={},YR._components={},YR._graphicComponents={},YR._marks={},YR._regions={},YR._animations={},YR._implements={},YR._chartPlugin={},YR._vChartPlugin={},YR._componentPlugin={},YR.transforms={fields:$r,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}},YR.dataParser={csv:(t,e={},i)=>(i.type=Yr.DSV,na(t)),dsv:(t,e={},i)=>{i.type=Yr.DSV;const s=Vr(aa,e),{delimiter:n}=s;if(!_(n))throw new TypeError("Invalid delimiter: must be a string!");return sa(n).parse(t)},tsv:(t,e={},i)=>(i.type=Yr.DSV,ra(t))},YR._layout={},YR._grammarTransforms={},YR._stageEventPlugins={},YR.registerStageEventPlugin=(t,e)=>{YR._stageEventPlugins[t]=e},YR.getStageEventPlugin=t=>YR._stageEventPlugins[t],YR._interactionTriggers={},YR.registerInteractionTrigger=(t,e)=>{YR._interactionTriggers[t]=e},YR._composedEventMap={},YR.registerComposedEvent=(t,e)=>{YR._composedEventMap[t]=e},YR._tooltipProcessors={},YR.registerTooltipProcessor=(t,e)=>{YR._tooltipProcessors[t]=e},YR.createTooltipProcessor=(t,e)=>{const i=YR._tooltipProcessors[t];return i?new i(e):null};const KR=t=>{const e={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"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},qR=KR(),ZR={[NR.name]:NR},JR=NR.name,QR=new Map(Object.keys(ZR).map((t=>[t,ZR[t]]))),tO=new Map,eO=new Map(Object.keys(ZR).map((t=>[t,t===JR]))),iO=(t,e)=>{if(!t)return;const i=aO(e);QR.set(t,i),eO.set(t,!0)},sO=(t=JR)=>(eO.has(t)&&!eO.get(t)&&iO(t,QR.get(t)),QR.get(t)),nO=t=>QR.delete(t)&&tO.delete(t)&&eO.delete(t),rO=t=>!!_(t)&&QR.has(t),aO=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:JR;return $R({},sO(i),t)};class oO{static registerInstance(t){oO.instances.set(t.id,t)}static unregisterInstance(t){oO.instances.delete(t.id)}static getInstance(t){return oO.instances.get(t)}static instanceExist(t){return oO.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return oO.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}oO.instances=new Map;class lO{static registerTheme(t,e){iO(t,e)}static getTheme(t,e=!1){return sO(t)}static removeTheme(t){return nO(t)}static themeExist(t){return rO(t)}static getDefaultTheme(){return lO.themes.get(JR)}static setCurrentTheme(t){lO.themeExist(t)&&(lO._currentThemeName=t,oO.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return lO.getTheme(lO._currentThemeName,t)}static getCurrentThemeName(){return lO._currentThemeName}}function hO(t){return _(t)?lO.themeExist(t)?lO.getTheme(t):{}:g(t)?t:{}}lO.themes=QR,lO._currentThemeName=JR;const cO=["animationThreshold","colorScheme","name","padding"];function dO(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];cO.includes(n)?s[n]=r:m(r)?yR(r)?s[n]=_R(r,e):HR(r)?s[n]=jR(i,r):s[n]=dO(r,e,i):s[n]=r})),s}function uO(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]=uO(t[s],e)}return i}return y(t)?t.map((t=>uO(t,e))):t}function pO(t,e){if(!t)return t;if(m(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]=pO(t[s],e)}return i}return y(t)?t.map((t=>pO(t,e))):t}function gO(t,...e){return d(t)?t(...e):t}const fO=(t,e,i,s)=>((t,e,i)=>LM(t,e,i,{fontFamily:VR.fontFamily,fontSize:VR.fontSize}))(e,i,s).measure(t),mO="__VCHART",vO=500,_O=500,yO=`${mO}_MEASURE_CANVAS_ID`,bO=`${mO}_DEFAULT_DATA_INDEX`,xO=`${mO}_DEFAULT_DATA_KEY`,SO=`${mO}_DEFAULT_DATA_SERIES_FIELD`,AO=`${mO}_DEFAULT_SERIES_STYLE_NAME`,kO=`${mO}_STACK_KEY`,MO=`${mO}_STACK_START`,TO=`${mO}_STACK_END`,wO=`${mO}_STACK_START_PERCENT`,CO=`${mO}_STACK_END_PERCENT`,EO=`${mO}_STACK_START_OffsetSilhouette`,BO=`${mO}_STACK_END_OffsetSilhouette`,PO=`${mO}_STACK_TOTAL`,LO=`${mO}_STACK_TOTAL_PERCENT`,RO=`${mO}_STACK_TOTAL_TOP`,OO=`${mO}_STACK_TOTAL_BOTTOM`,IO=`${mO}_MOSAIC_VALUE_START_PERCENT`,DO=`${mO}_MOSAIC_VALUE_END_PERCENT`,FO=`${mO}_MOSAIC_CAT_START_PERCENT`,zO=`${mO}_MOSAIC_CAT_END_PERCENT`,jO=`${mO}_SEGMENT_START`,HO=`${mO}_SEGMENT_END`,VO=`${mO}_KEY`,NO=`${mO}_MAP_LOOK_UP_KEY`;function UO(t,e){for(let i=0;it.key===e))}function GO(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 YO(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:{groupField:a.groupField,nodes:{}},ZO(t,a,n[o],l,e,r))})),s?$O(n):n}function $O(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))):$O(t[e].nodes);return t}function XO(t,e){if("values"in t&&t.values.length){const i=JL(t.values,e),s=ZL(t.values,CO);t.values.forEach((t=>{t[PO]=i,t[LO]=s}))}else for(const i in t.nodes)XO(t.nodes[i],e)}function KO(t){if(!t.values.length)return;const e=t.values[t.values.length-1][TO]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)qO(t.nodes[r],e,i,s,n)}function ZO(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[TO]=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 l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),ZO(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const JO=(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]=tI(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function eI(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>nI(t.style(e,i,s,n)):P(t.style)||(e.style=nI(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>nI(t.state[e](i,s,n,r)):P(t.state[e])||(i[e]=nI(t.state[e]))})),e.state=i}return e}function iI(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>nI(t[i](e,s,n,r)):P(t[i])||(e[i]=nI(t[i]))})),e}function sI(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),nI(i)}function nI(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:oe(t.angle)}):t}const rI=t=>"line"===t||"area"===t,aI=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return rI(i)?e:null==e?void 0:e[0]},oI=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let lI=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},n=YR.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{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(YR.getComposedEvent(t))if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};var hI;!function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(hI||(hI={}));const cI=["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 dI,uI,pI;t.ChartEvent=void 0,(dI=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",dI.rendered="rendered",dI.renderFinished="renderFinished",dI.animationFinished="animationFinished",dI.regionSeriesDataFilterOver="regionSeriesDataFilterOver",dI.afterInitData="afterInitData",dI.afterInitEvent="afterInitEvent",dI.afterInitMark="afterInitMark",dI.rawDataUpdate="rawDataUpdate",dI.viewDataFilterOver="viewDataFilterOver",dI.viewDataUpdate="viewDataUpdate",dI.viewDataStatisticsUpdate="viewDataStatisticsUpdate",dI.markDeltaYUpdate="markDeltaYUpdate",dI.viewDataLabelUpdate="viewDataLabelUpdate",dI.scaleDomainUpdate="scaleDomainUpdate",dI.scaleRawDomainUpdate="scaleRawDomainUpdate",dI.scaleUpdate="scaleUpdate",dI.dataZoomChange="dataZoomChange",dI.drill="drill",dI.layoutStart="layoutStart",dI.layoutEnd="layoutEnd",dI.layoutRectUpdate="layoutRectUpdate",dI.playerPlay="playerPlay",dI.playerPause="playerPause",dI.playerEnd="playerEnd",dI.playerChange="playerChange",dI.playerForward="playerForward",dI.playerBackward="playerBackward",dI.scrollBarChange="scrollBarChange",dI.brushStart="brushStart",dI.brushChange="brushChange",dI.brushEnd="brushEnd",dI.brushClear="brushClear",dI.brushActive="brushActive",dI.legendSelectedDataChange="legendSelectedDataChange",dI.legendFilter="legendFilter",dI.legendItemClick="legendItemClick",dI.legendItemHover="legendItemHover",dI.legendItemUnHover="legendItemUnHover",dI.tooltipShow="tooltipShow",dI.tooltipHide="tooltipHide",dI.tooltipRelease="tooltipRelease",dI.afterResize="afterResize",dI.afterRender="afterRender",dI.afterLayout="afterLayout",dI.afterMarkLayoutEnd="afterMarkLayoutEnd",dI.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(uI||(uI={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(pI||(pI={}));const gI=[pI.mark,pI.model,pI.chart,pI.vchart];class fI{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(pI.vchart,[]),this._levelNodes.set(pI.chart,[]),this._levelNodes.set(pI.model,[]),this._levelNodes.set(pI.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const mI={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"};class vI{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=L(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>aI(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||uI.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||uI.chart);o.get(t)||o.set(t,new fI);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||uI.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||uI.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||uI.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||uI.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?gI.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[uI.chart,uI.window,uI.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.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&&L(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 mI[a]&&(a=mI[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)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?pI.model:pI.vchart:pI.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=At(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=St(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=uI.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==pI.model&&s!==pI.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=pI.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case uI.chart:return this._viewBubbles;case uI.window:return this._windowBubbles;case uI.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case uI.chart:return this._viewListeners;case uI.window:return this._windowListeners;case uI.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return cI.includes(t)||Object.values(hI).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&YR.hasInteractionTrigger(e)}}function _I(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function yI(t,e,i){t.getParser(e)||t.registerParser(e,i)}const bI=new Map;let xI;function SI(){xI||(xI=new Ba,yI(xI,"geojson",ka),yI(xI,"topojson",Ta),_I(xI,"simplify",Gr))}function AI(t,e,i={type:"geojson",centroid:!0}){bI.has(t)&&Vy(`map type of '${t}' already exists, will be overwritten.`),SI();const s=new Pa(xI),n=j({},{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}),bI.set(t,s)}function kI(t){bI.has(t)?bI.delete(t):Vy(`map type of '${t}' does not exists.`)}function MI(t,e=!1){let i=e;return t.latestData instanceof Pa&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const TI=(t,e)=>0===t.length?[]:1===t.length?MI(t[0],null==e?void 0:e.deep):t.map((t=>MI(t,null==e?void 0:e.deep)));function wI(e,i,s){_I(i=i instanceof Ba?i:e.dataSet,"copyDataView",TI);const n=new Pa(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function CI(t,e,i=[]){var s;if(t instanceof Pa)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new Pa(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return Vy(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return Vy(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!_(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),Vy("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function EI(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var BI,PI,LI,RI;t.TransformLevel=void 0,(BI=t.TransformLevel||(t.TransformLevel={}))[BI.copyDataView=-10]="copyDataView",BI[BI.treemapFilter=-8]="treemapFilter",BI[BI.treemapFlatten=-7]="treemapFlatten",BI[BI.dotObjFlat=-7]="dotObjFlat",BI[BI.linkDotInfo=-7]="linkDotInfo",BI[BI.sankeyLayout=-7]="sankeyLayout",BI[BI.dataZoomFilter=-6]="dataZoomFilter",BI[BI.legendFilter=-5]="legendFilter",function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(PI||(PI={})),function(t){t.data="data",t.mark="mark"}(LI||(LI={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(RI||(RI={}));const OI=["line","area","trail"];function II(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(VO,i?t.slice().sort(i):t.slice()),{keys:[VO],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const DI=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function FI(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{FI(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function jI(t,e,i,s){const n=II(t,(t=>i(t))),r=II(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!u(t)){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}}const HI=`${mO}_BuiltIn_CallBack_Disappear`;var VI;!function(t){t.render="render",t.disappear="disappear"}(VI||(VI={}));class NI{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(e,i){this._count=0,this._rootMarks=[],this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{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._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var e,i,s,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:u,background:f}=this._option;k_.setEnv(function(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}(o),null!=l?l:{}),this._stage=null!==(e=this._option.stage)&&void 0!==e?e:new z_(Object.assign({background:f,width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,canvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:u},ReactDOM:this._option.ReactDOM,autoRefresh:p(r)?r:!p(a)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{})),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const m=Rp({x:0,y:0,width:this._width,height:this._height});m.name="root",this._stage.defaultLayer.appendChild(m),this._rootGroup=m;const v=(p(h)?h:$y(o))&&!1!==c&&YR.getStageEventPlugin("gesture");v&&(this._gestureController=new v(this._stage,g(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=RI.before}_setCanvasStyle(){if(this._stage&&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")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(k_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=k_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>FI(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>FI(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{FI(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;this._hasCommitedMark()&&(Hy(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),this._rootMarks.forEach((t=>{t.render()})),this._layoutState===RI.before&&(this._layoutState=RI.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=RI.reevaluate,this._hasCommitedMark()&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),this.findProgressiveMarks(),this.updateStateAnimation(),this._doRender(!0),this.doPreProgressive(),Hy(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=zI(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=jI(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=jI(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=II(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=II(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}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];y(s)?e[i]="disappear"===i?s.map((t=>{return"function"==typeof(e=t.callBack)&&/^class\s/.test(e.toString())?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:HI,customParameters:{callBack:t.callBack}});var e})):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{FI(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===PI.appear))?PI.appear:e.every((t=>t===PI.disappear))?PI.disappear:PI.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===uI.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=e;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=i.parent,i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:aI(o),markId:h,modelId:c,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===uI.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===uI.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===uI.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===uI.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===uI.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this.releaseGrammar(!0),this._stage!==(null===(t=this._option)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{FI(t,(t=>{t.removeProduct()}),null,!0)})):this._cachedMarks=zI(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return Yy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&function(t){return Su(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Ao.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()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{FI(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=k_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){k_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function UI(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:Ny)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function WI(t){t.crosshair=Y(t.crosshair||{}).map((e=>GR({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function GI(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}=oi(l,i.width,i.height);a=t,o=e}else if(h&&Yy(e.mode)){let t;t=_(h)?k_.getElementById(h):h;const{width:e,height:s}=oi(t,i.width,i.height);a=e,o=s}else if(Xy(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 YI(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function $I(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}}var XI,KI,qI,ZI,JI,QI;t.LayoutZIndex=void 0,(XI=t.LayoutZIndex||(t.LayoutZIndex={}))[XI.SeriesGroup=0]="SeriesGroup",XI[XI.Axis_Grid=50]="Axis_Grid",XI[XI.CrossHair_Grid=100]="CrossHair_Grid",XI[XI.Region=450]="Region",XI[XI.Mark=300]="Mark",XI[XI.Node=400]="Node",XI[XI.Axis=100]="Axis",XI[XI.MarkLine=500]="MarkLine",XI[XI.MarkArea=100]="MarkArea",XI[XI.MarkPoint=500]="MarkPoint",XI[XI.DataZoom=500]="DataZoom",XI[XI.ScrollBar=500]="ScrollBar",XI[XI.Player=500]="Player",XI[XI.Legend=500]="Legend",XI[XI.CrossHair=500]="CrossHair",XI[XI.Indicator=500]="Indicator",XI[XI.Title=500]="Title",XI[XI.Label=500]="Label",XI[XI.Brush=500]="Brush",XI[XI.CustomMark=500]="CustomMark",XI[XI.Interaction=700]="Interaction",t.LayoutLevel=void 0,(KI=t.LayoutLevel||(t.LayoutLevel={}))[KI.Indicator=10]="Indicator",KI[KI.Region=20]="Region",KI[KI.Axis=30]="Axis",KI[KI.DataZoom=40]="DataZoom",KI[KI.Player=40]="Player",KI[KI.ScrollBar=40]="ScrollBar",KI[KI.Legend=50]="Legend",KI[KI.Title=70]="Title",KI[KI.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(qI=t.AttributeLevel||(t.AttributeLevel={}))[qI.Default=0]="Default",qI[qI.Theme=1]="Theme",qI[qI.Chart=2]="Chart",qI[qI.Base_Series=3]="Base_Series",qI[qI.Series=4]="Series",qI[qI.Mark=5]="Mark",qI[qI.User_Chart=6]="User_Chart",qI[qI.User_Series=7]="User_Series",qI[qI.User_Mark=8]="User_Mark",qI[qI.User_SeriesStyle=9]="User_SeriesStyle",qI[qI.Built_In=99]="Built_In";class tD{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({},tD.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]))))}}tD.defaultMarkInfo={};class eD{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class iD{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=>GR({},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 sD extends eD{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}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=iD,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new tD,this._lastLayoutRect=null,this.id=qy(),this.userId=t.id,this._spec=t,this.effect={},this.event=new lI(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){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}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){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_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){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${mO}_${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,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=YR.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_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 L(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}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class nD{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}get lastComputeRect(){return this._lastComputeRect}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}get willLayoutTag(){return this._willLayoutTag}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._willLayoutTag=!0,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){let a=RR(IR(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),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:LR(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:LR(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:LR(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:LR(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:LR(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:LR(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=LR(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=LR(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){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_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]=LR(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(OR(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class rD extends sD{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,this._transformLayoutPadding=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 nD(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&U(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.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,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 aD extends iD{_initTheme(t,e){return{spec:t,theme:this._theme}}}class oD extends rD{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=aD,this.modelType="region",this.specKey="region",this.type=oD.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,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"}_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,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[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.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex: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()}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,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(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})}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=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function lD(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 hD(t,e,i){e?t.forEach((t=>{const e=$(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=$(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 cD(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 dD(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=fD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),cD(d,!0,p,l),s&&hD(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function uD(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=fD(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=fD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),cD(d,!1,p,o),s&&hD(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function gD(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=fD(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_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){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_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,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=fD(t,this,e);"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,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=lD(t);n.length&&dD(n,e,i,!1,"left",s),r.length&&dD(r,e,i,!0,"left",s),a.length&&uD(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=lD(t);n.length&&pD(n,e,i,!1,"top",s),r.length&&pD(r,e,i,!0,"top",s),a.length&&gD(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=lD(t);n.length&&dD(n,e,i,!1,"right",s),r.length&&dD(r,e,i,!0,"right",s),a.length&&uD(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=lD(t);n.length&&pD(n,e,i,!1,"bottom",s),r.length&&pD(r,e,i,!0,"bottom",s),a.length&&gD(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=fD(t,this,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=>{U(i.getLayoutRect(),e.rect)||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{rect:i}=fD(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);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+c-l})}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+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&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:Ny)("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}}}mD.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(ZI||(ZI={})),t.STATE_VALUE_ENUM=void 0,(JI=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",JI.STATE_HOVER="hover",JI.STATE_HOVER_REVERSE="hover_reverse",JI.STATE_DIMENSION_HOVER="dimension_hover",JI.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",JI.STATE_SELECTED="selected",JI.STATE_SELECTED_REVERSE="selected_reverse",JI.STATE_SANKEY_EMPHASIS="selected",JI.STATE_SANKEY_EMPHASIS_REVERSE="blur",JI.STATE_HIGHLIGHT="highlight",JI.STATE_BLUR="blur",JI.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(QI||(QI={}));const vD=["linear","radial","conical"],_D={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const yD={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{yD[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class bD extends eD{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(j(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class xD extends bD{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:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||(t=this._mark.type,OI.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!yD[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(y(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(mO)));i=t.datums.some((t=>e&&y(null==t?void 0:t.items)?n.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])})):n.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(mO))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(VC(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class SD extends eD{constructor(){super(...arguments),this.id=qy(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=YR.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class AD extends SD{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}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._data=null,this._data=e}removeProduct(){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const kD=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,MD=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=kD(l.delay,n,a,o),d=kD(l.duration,n,a,o),u=kD(l.oneByOne,n,a,o),p=kD(l.splitPath,n,a,o),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)?Nw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Uw)(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);zw(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{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)?Nw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Uw)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Ow(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Dw(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:qo.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 Fw({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Ew,null!==(l=i.easing)&&void 0!==l?l:Bw))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:qo.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new jw({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Ew,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Bw))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):zw(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},TD=(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))))},wD=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}};class CD extends SD{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}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){u(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];y(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new AD(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}u(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=Rp("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){u(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(){this._product&&this._product.parent&&this._product.parent.removeChild(this._product),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Wl)),i&&(d(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==ZI.enter&&t.context.diffState!==ZI.update||(t.stateProxy=(e,i)=>{var s;return this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)},t.context.states&&t.useStates(t.context.states,e))},this.name=e,this.model=i.model,this.key=i.key,this.state=new xD(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_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,oe)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];u(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}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){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[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"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&GR(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(NC(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=MR(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),e.clamp&&t.clamp&&t.clamp(e.clamp))}(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=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):vD.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):NC(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=d(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_computeGradientAttr(t){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=t,c=e(t,["gradient","scale","field"]);let u=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(u=t),g||(g=e)}const f=mR(fR(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},_D[o]),c);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==u?void 0:u.scale(t[g]);return d(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=ii.SetOpacity(a,s)),{offset:d(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):d(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];d(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)vD.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=mR(fR(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return II(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return YR.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=d(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[xO],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=II(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===PI.appear))?PI.appear:t.every((t=>t===PI.disappear))?PI.disappear:t[0];return null!=e?e:PI.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{wD(t),s.push(...t.getGraphics())})),e.forEach((t=>{wD(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);MD([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=TD(e,n),r=TD(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===PI.exit?PI.exit:i===PI.update?PI.update:PI.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===ZI.exit&&(t.context.reusing=!0,t.animates&&t.animates.forEach((t=>t.stop())))}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===ZI.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,d,p,g;let f,m;return u(e)?(f=this._graphicMap.get(t),f&&(m=ZI.exit)):u(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=ZI.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=ZI.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(d=f.context)||void 0===d?void 0:d.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=PI.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=PI.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return DI(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=DI(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(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))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach(((t,e)=>{var i,n;let r=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i.update,t);null===(n=t.currentStates)||void 0===n||n.forEach((e=>{var i;const s=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i[e],t);r=Object.assign(Object.assign({},r),s)})),u(this._markConfig.interactive)||(r.pickable=this._markConfig.interactive);const a=this._transformGraphicAttributes(t,r,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=a}))}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r,a;const o=i.context.finalAttrs,l=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=oI(i,o);i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes({}),i.context.reusing=!1):l||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),!(null===(a=this.renderContext)||void 0===a?void 0:a.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i),e&&i.setFinalAttributes(o)}else{const a=i;i=this._createGraphic(o),e&&(null===(n=i.setFinalAttributes)||void 0===n||n.call(i,o)),i.context=a.context,i.context.diffAttrs=o,i.stateSort=this._stateSort;const l=this._graphics===t?s:s+this._graphics.length-t.length;if(l>=0&&(this._graphics[l]=i),null===(r=this.renderContext)||void 0===r?void 0:r.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,l),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(u(e)||(t.zIndex=e),u(i)||(t.clip=i),!u(s)){const e=y(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return u(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=YR.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=YR.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=Y(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===RI.before||(this._product||this._initProduct(),Hy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{"in"===this.state.checkOneState(i,i.context.data,e)?i.addState(t,!0,this.hasAnimationByState("state")):i.removeState(t,this.hasAnimationByState("state"))}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===ZI.exit&&!e.isExiting)if(e.context.animationState===ZI.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:ZI.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=Rp({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{t.clearStates()}))}}var ED;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(ED||(ED={}));class BD extends CD{constructor(){super(...arguments),this.type=BD.type,this._marks=[],this._diffState=ZI.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(Vy("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?(Vy("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))}getMarkInUserId(t){let e;return FI(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.diffState===ZI.update){const t=this.hasAnimation(),e=oI(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e)),t&&this._product.setFinalAttributes(i)}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=ZI.update}render(){this._isCommited&&(Hy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct()}}BD.type="group";const PD={measureText:fO};class LD{static instance(){return LD.instance_||(LD.instance_=new LD),LD.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 RD{constructor(){this.id=qy(),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))?Vy("不要重复添加相同的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 OD extends RD{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)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const ID={type:"fadeIn"};function DD(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 ID;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const FD={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"},state:{duration:300,easing:"linear"}},zD={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},jD={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},HD=()=>{YR.registerAnimation("scaleInOut",(()=>zD))},VD=()=>{YR.registerAnimation("fadeInOut",(()=>jD))},ND=(t,e)=>({appear:DD(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:$w,duration:FD.update.duration,easing:FD.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),UD=()=>{YR.registerAnimation("line",ND)},WD=()=>{pw.registerBuiltInAnimate("growPointsIn",hC),pw.registerBuiltInAnimate("growPointsOut",cC),pw.registerBuiltInAnimate("growPointsXIn",uC),pw.registerBuiltInAnimate("growPointsXOut",pC),pw.registerBuiltInAnimate("growPointsYIn",fC),pw.registerBuiltInAnimate("growPointsYOut",mC),pw.registerBuiltInAnimate("clipIn",qw),pw.registerBuiltInAnimate("clipOut",Zw)},GD=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class YD{constructor(t){this._markSet=new tD,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){y(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.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 $D={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class XD extends YD{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},$D,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}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}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll(e)}}XD.type="element-highlight",XD.defaultOptions=$D;const KD=()=>{YR.registerInteractionTrigger(XD.type,XD)},qD={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class ZD extends YD{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},qD,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}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,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),t.addState(i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll(e)}}ZD.type="element-select",ZD.defaultOptions=qD;const JD=()=>{YR.registerInteractionTrigger(ZD.type,ZD)};class QD extends RD{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class tF{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>YR.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>YR.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>YR.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return YR.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>YR.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){YR.registerTransform(t,e)}static registerFunction(t,e){t&&e&&LD.instance().registerFunction(t,e)}static unregisterFunction(t){t&&LD.instance().unregisterFunction(t)}static getFunction(t){return t?LD.instance().getFunction(t):null}static getFunctionList(){return LD.instance().getFunctionNameList()}static registerMap(t,e,i){const s=YR.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=YR.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,bI.get(e);var e}static registerSVG(t,e,i){const s=YR.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=YR.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){oO.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 ot.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d,u;this.id=qy(),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._renderState=VI.render,this._disableDimensionHoverEvent=!1,this._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))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;U(n.theme,this._spec.theme)?U(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=YI(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?YR.getSeriesBuiltInTheme(e):YR.getComponentBuiltInTheme(e);i=i?GR({},s,i[e]):s}s===t.length-1&&p(i)&&(i=dO({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},lR(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:y,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=Yy(v);if(S?ax(xo):"node"===v&&oA(xo),S&&f&&(this._container=_(f)?k_.getElementById(f):f),m&&(this._canvas=m),y&&(this._stage=y),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=lO.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[];!1!==b&&A.push("poptipForText"),"sankey"===i.type&&A.push("scrollbar");const k=new ot(null!==(a=this._option.logLevel)&&void 0!==a?a:at.Error);ot.setInstance(k),(null===(o=this._option)||void 0===o?void 0:o.onError)&&k.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._compiler=new NI({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:y,pluginList:A},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new vI(this,this._compiler),this._event=new lI(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),oO.registerInstance(this),null===(u=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===u||u.call(d,this)}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=GR({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=uO(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;tF.getFunctionList()&&tF.getFunctionList().length&&(t=pO(t,tF)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=YR.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=YR.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=YR.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._chartSpecTransformer),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)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=At(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.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 GI(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:vO,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:_O})}_initDataSet(t){this._dataSet=t instanceof Ba?t:new Ba,yI(this._dataSet,"dataview",wa),yI(this._dataSet,"array",s),_I(this._dataSet,"copyDataView",TI);for(const t in YR.transforms)_I(this._dataSet,t,YR.transforms[t]);for(const t in YR.dataParser)yI(this._dataSet,t,YR.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake?(null===(n=this._compiler)||void 0===n||n.releaseGrammar(),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.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.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),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),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(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"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?PI.none:PI.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}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._cachedProcessedTheme=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,oO.unregisterInstance(this)}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):y(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._reSetRenderState(),u(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof Pa?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=CI(t,this._dataSet,s);y(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?GR({},t[n][e.index],i):i):t[n]=s?GR({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?GR({},t[n][r],i):i)}else t.id===e&&(t[n]=s?GR({},t[n],i):i)}))}(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=GR({},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),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,this),!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)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=$R({},e,e.chart[t])),e};let l;if(P(n)&&P(r))l=hO(this._currentThemeName),this._currentTheme=o(a,l);else{const t=$R({},hO(g(r)&&r.type?r.type:g(n)&&n.type?n.type:this._currentThemeName),hO(n),hO(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),j(GM.poptip,WM,h),null===(s=this._compiler)||void 0===s||s.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=!!Yy(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return hO(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!lO.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),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}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield UI(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(!Yy(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;this._chart.resetLayoutItemTag(),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)?k_.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)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(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?DR(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||P(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 Vy("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?DR(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Vy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return LD.instance().getFunction(t)}registerFunction(t,e){t&&e&&LD.instance().registerFunction(t,e)}unregisterFunction(t){t&&LD.instance().unregisterFunction(t)}getFunctionList(){return LD.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=YR.getChartPlugins();t.length>0&&(this._chartPlugin=new OD(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=YR.getVChartPlugins();e.length>0&&(this._vChartPlugin=new QD(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_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,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=VI.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){this._renderState=VI.render,this.getStage().eventSystem.resumeTriggerEvent()}}tF.InstanceManager=oO,tF.ThemeManager=lO,tF.globalConfig={uniqueTooltip:!0},tF.Utils=PD,tF.vglobal=k_;YR.registerRegion("region",oD),YR.registerLayout("base",mD),Jk(),zk(),YR.registerMark(BD.type,BD),YR.registerStageEventPlugin("gesture",Eb),KD(),JD(),iO(UR.name,UR);const eF="monotone",iF="linear",sF="bevel";function nF(t,e){return e("component",t)}function rF(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=YR.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));const aF=(t,e,i,s)=>{if(u(t[e]))return;const n=y(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},oF=(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)))},lF=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},hF=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):m(t)&&p(t.field)?L(e,t.field):t,s){const{formatFunc:i,args:r}=rF(void 0,s,t,e);i&&r&&(n=i(...r))}return n},cF=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const dF=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(y(e.activeType)?e.activeType.includes(t):e.activeType===t)));function uF(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=u(i.key)&&u(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:d,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:_}=l,y=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=gF(hF(h,r,a,c),d,g),o.value=gF(hF(f,r,a,m),v,_),Object.keys(y).forEach((t=>{o[t]=hF(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};y(i)?i.forEach((t=>{o(t)})):o(i)}function pF(t,e,i,s,n,r,a){if(d(e)){uF(t,e(n,a),i,s,r,a)}else e&&uF(t,e,i,s,r,a)}const gF=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=mi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class fF{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},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.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{y(t)?t.forEach((t=>{pF(a,t,e,i,s,n,r)})):d(t)?pF(a,t,e,i,s,n,r):t&&uF(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=d(e)?e(s,n):e;if(r?u(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){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}(s),e={visible:hF(r.visible,t,n),value:gF(hF(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:hF(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=hF(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&dF(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const mF={min:t=>t.length?K(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?K(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}},vF=(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=UO([],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 _F(a,n,o)},_F=(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&&t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{Zy(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=>{Zy(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&&!0===o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=mF[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},yF=(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=>{Zy(t[e])||(t[e]=0)}))})),t},bF=`${mO}_HIERARCHY_DEPTH`,xF=`${mO}_HIERARCHY_ROOT`,SF=`${mO}_HIERARCHY_ROOT_INDEX`;function AF(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function kF(t,e,i){t&&(i.needDefaultSeriesField&&(t[SO]=i.defaultSeriesField),t[bO]=e,t[xO]=i.getKey(t,e,i))}function MF(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function TF(t,e,i,s=0,n,r){void 0===r&&(r=e),kF(t,e,i),t[bF]=s,t[xF]=n||t[i.categoryField],t[SF]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>TF(e,s,i,t[bF]+1,t[xF],r)))}const wF={label:{name:"label",type:"text"}},CF=`${mO}_rect_x`,EF=`${mO}_rect_x1`,BF=`${mO}_rect_y`,PF=`${mO}_rect_y1`,LF={data:!0},RF={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},OF=[...Object.keys(FD),"normal"];function IF(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 HF(n)&&delete n.type,n.oneByOne&&(n=FF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:zF,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=GR({},o[e],a);return HF(n)&&delete n.type,n.oneByOne&&(n=FF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:zF,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function DF(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=I(t,null,i),VF(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}),i),t}(h,i)}function FF(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.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function zF(t,e){var i;return null!==(i=null==t?void 0:t[bO])&&void 0!==i?i:e.context.graphicIndex}function jF(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 HF(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function VF(t,e,i=[]){if(y(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),VF(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),VF(t[s],e,i))}function NF(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class UF extends iD{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=uR(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=YR.getSeriesMarkMap(o)?function(t,e,i){const s=YR.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=GR({},i("mark",Y(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return GR({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;Y(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(d(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,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=GR({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>GR({},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 WF extends sD{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)}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:`${mO}_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(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=UF,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=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.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=NF(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),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)&&(_I(this._rawData.dataSet,"invalidTravel",yF),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;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=CI(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=wI(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=wI(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new AD(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=K(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=_F(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=j(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){_I(this._dataSet,"dimensionStatistics",vF);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new Pa(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&&UO(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){_I(this._dataSet,"dimensionStatistics",vF);const s=new Pa(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=UO(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&UO(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new Pa(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)&&(_I(this._rawData.dataSet,"addVChartProperty",lF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:AF.bind(this),call:kF}},!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,i;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.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(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:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=IF({},DF(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)}))),!u(t.dataId)||!u(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(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:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_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"}}:$y(s)||Xy(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=GR(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=GR(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=GD(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=GD(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=GD(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:SO;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:AO,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,AO,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.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()}initTooltip(){this._tooltipHelper=new fF(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||e.visible!==t[i].visible))?i.reMake=!0:!i.reCompile&&e.some(((e,i)=>!U(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!U(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},LF),RF),i),{extensionMark:!0,label:!0,totalLabel:!0});return this._compareExtensionMarksSpec(Y(t.extensionMark),Y(e.extensionMark),s),!s.reMake&&this._compareLabelSpec(Y(t.label),Y(e.label),s),!s.reMake&&this._compareLabelSpec(Y(t.totalLabel),Y(e.totalLabel),s),s.reMake?s:(!s.reCompile&&this._marks.getMarks().some((i=>{var s,n;return r[i.name]=!0,(null===(s=e[i.name])||void 0===s?void 0:s.visible)!==(null===(n=t[i.name])||void 0===n?void 0:n.visible)}))&&(s.reCompile=!0),!s.reCompile&&n.some((i=>RF[i]&&!U(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!U(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Pa||EI(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();NF(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),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:SO,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new AR).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return fR(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:SO}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:d={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:_=!1}=e,y=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:_,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(y)){const e=this.getSpec()||{};this._marks.addMark(y,{name:t.name}),v&&(this._seriesMark=y),u(f)?y.setData(this._data):!1!==f&&y.setDataView(f),y.setSkipBeforeLayouted(!1!==c),u(h)||y.setGroupKey(h);const l=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:null!==(s=i.morph)&&void 0!==s&&s,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(n=i.support3d)&&void 0!==n?n:e.support3d||!!e.zField,morphKey:(null===(r=e.morph)||void 0===r?void 0:r.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});y.setMarkConfig(l),this.initMarkStyleWithSpec(y,GR({},d,g||e[y.name]))}return y}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:xO}_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!==TO&&t!==CO&&t!==MO&&t!==wO||(t=this.getStackValueField()),null!==(e=GO(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>Zy(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:SO]}}function GF(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();VC(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 YF(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}}}WF.mark=wF,WF.transformerConstructor=UF;class $F extends WF{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);VC(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:`${mO}_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(TO),this.setFieldX2(MO)):(this.setFieldY(TO),this.setFieldY2(MO))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(CO),this.setFieldX2(wO)):(this.setFieldY(CO),this.setFieldY2(wO))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(BO),this.setFieldX2(EO)):(this.setFieldY(BO),this.setFieldY2(EO))}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)&&(GF("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)}}function XF(t){return"bottom"===t||"top"===t}function KF(t){return"left"===t||"right"===t}function qF(t){return"z"===t}function ZF(t,e){return ER(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function JF(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function QF(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?XF(t)?"linear":"band":XF(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const tz=(t,e,i)=>{var s;const n=null!==(s="band"===e?nF("axisBand",i):["linear","log","symlog"].includes(e)?nF("axisLinear",i):{})&&void 0!==s?s:{},r=XF(t)?nF("axisX",i):KF(t)?nF("axisY",i):nF("axisZ",i);return GR({},nF("axis",i),n,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:Ny)("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:Ny)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;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)))),r=n.filter((t=>UC(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return XF(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class iz 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(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:uI.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const sz=(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))},nz=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},rz=(t,e,i,s)=>{var n;const r=e.getScale(),a=UC(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=Y(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.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))})),o.push({series:h,datum:e,key:az(h,s)})}else if(p(i[1])){const e=[],s=[];l.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 r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{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("_")}`,oz=(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};class lz extends ez{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!sz(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:uI.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:uI.canvas}),callback:this.onMouseOut}),$y(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:uI.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),$y(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var hz;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(hz||(hz={}));const cz={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class dz{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",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.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(cz.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),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:sF,curveType:iF,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===eF?"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){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(cz.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:jF(this._spec,cz.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new Pa(this._option.dataSet,{name:`${mO}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),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(hz.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[cz.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(hz.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,GR({},this._spec[cz.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.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=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},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.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const uz=Object.assign(Object.assign({},wF),cz),pz=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(y(t))return t.length===e.length&&t.every(((t,i)=>pz(t,e[i])));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]))},gz=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class fz extends CD{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return gz}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(u(o)||s.includes(a))return;r&&n.includes(a)&&(NC(null==o?void 0:o.type)||(null==o?void 0:o.scale)||d(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((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?pz(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n,r;const a=e.context.data,o=[],l=[],h={},c=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,d=c&&0===c.currentIndex;if(a.forEach(((e,i)=>{var s;l[i]={},o[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?l[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!c?o[i][s]=t[s](e):0!==i||c&&!d||(h[s]=t[s](e))})),l[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),c){const t=null!==(r=null===(n=e.attribute)||void 0===n?void 0:n.segments)&&void 0!==r?r:[];return t.push({points:l}),d?Object.assign(Object.assign({},h),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(o,l);if(t)return Object.assign(Object.assign(Object.assign({},h),o[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},h),o[0]),{points:l,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:ZI.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[xO]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}class mz extends fz{constructor(){super(...arguments),this.type=mz.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)===cR.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}mz.type="line";const vz=()=>{YR.registerMark(mz.type,mz),Jk(),Nk(),EB(),kB(),WD(),YR.registerGraphicComponent("line",Lg)};class _z extends CD{constructor(){super(...arguments),this.type=_z.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="circle":a.symbolType=o,a}}_z.type="symbol";const yz=()=>{YR.registerMark(_z.type,_z),Jk(),tM(),kB(),YR.registerGraphicComponent("symbol",Eg)};class bz extends UF{_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)}}function xz(t){return t.length>=2&&k(t[0])&&k($(t))&&$(t)>=t[0]}function Sz(t,e){var i;const s=$(e)-e[0],n=$(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=$(e)>0?$(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!k(o.min),extendable_max:!k(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):$(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function Az(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 kz(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 Mz(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 Tz(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 wz=(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=>t.type.includes("ticks"))))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)-p[0];if(0===g)return t;const f=c.domain(),m=$(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=ne(t,e),a=Math.max(ie(i),ie(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return IC(v)};class Cz{constructor(t){this.id=qy(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class Ez extends Cz{constructor(){super(Ez.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!VC(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&&xz(c)&&xz(d)))return;const u=Sz(t,c),p=Sz(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!kz(u,p))return}else if(0===y&&0===b){if(!kz(p,u))return}else if(_||A)if(_&&!A){if(!Az(u,p))return}else if(A&&!_){if(!Az(p,u))return}else{if(f===b)return;if(f>b){if(!Mz(u,p))return}else if(!Mz(p,u))return}else{if(0===f&&0===y){if(!Tz(u,p))return}else if(0===b&&0===g&&!Tz(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===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){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){_I(e.getOption().dataSet,"tickAlign",wz);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}Ez.pluginType="component",Ez.type="AxisSyncPlugin";const Bz={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function Pz(t){let e=0;return L(t,"tick.visible")&&(e+=L(t,"tick.tickSize")),L(t,"label.visible")&&(e+=L(t,"label.space")),e}function Lz(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 Rz(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const Oz=t=>"band"===t||"ordinal"===t||"point"===t;function Iz(t,e){return{id:t,label:t,value:e,rawValue:t}}function Dz(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class Fz extends RD{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const zz=`${mO}_ARC_TRANSFORM_VALUE`,jz=`${mO}_ARC_RATIO`,Hz=`${mO}_ARC_START_ANGLE`,Vz=`${mO}_ARC_END_ANGLE`,Nz=`${mO}_ARC_K`,Uz=`${mO}_ARC_MIDDLE_ANGLE`,Wz=`${mO}_ARC_QUADRANT`,Gz=`${mO}_ARC_RADIAN`,Yz=-Math.PI/2,$z=3*Math.PI/2,Xz=.6,Kz=(t,e,i,s)=>{const n=t();if(S(n))return n;if(d(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return ge(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},qz=(t,e,i)=>{var s;const n=null!==(s="band"===e?nF("axisBand",i):"linear"===e?nF("axisLinear",i):{})&&void 0!==s?s:{},r=nF("angle"===t?"axisAngle":"axisRadius",i);return GR({},nF("axis",i),n,r)};function Zz(t,e,i,s){switch(t){case r.cartesianBandAxis:return tz(ZF(i,["z"]),"band",e);case r.cartesianLinearAxis:return tz(ZF(i,["z"]),"linear",e);case r.cartesianLogAxis:return tz(ZF(i,["z"]),"log",e);case r.cartesianSymlogAxis:return tz(ZF(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return tz(ZF(i),void 0,e);case r.polarBandAxis:return qz(i.orient,"band",e);case r.polarLinearAxis:return qz(i.orient,"linear",e);case r.polarAxis:return qz(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,trigger:c,triggerOff:d}=null!==(s=nF(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>XF(t.orient)));let g;g=p(u)?GR({},Oz(u.type)?a:o,l):l;const f=n.find((t=>KF(t.orient)));let m;return m=p(f)?GR({},UC(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(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,trigger:c,triggerOff:d}=null!==(s=nF(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>"angle"===t.orient));let g;g=p(u)?GR({},Oz(u.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?GR({},UC(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return Jz(i,nF(t,e));default:return nF(t,e)}}const Jz=(t,e)=>{var i;const s=GR({},e,e[JF(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class Qz extends iD{getTheme(t,e){return Zz(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({},IR(e)),{[s]:0}))}}class tj extends rD{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=Qz,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof jc||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:uI.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}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 Fz(this)}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)))}_getNeedClearVRenderComponents(){return[]}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=>!U(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&&(t.release(!0),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=>{e.compile({group:t,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}}getDatum(t){}}var ej,ij;tj.transformerConstructor=Qz,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(ej||(ej={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(ij||(ij={}));class sj extends CD{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}clearComponent(){this._component&&(this._component.parent&&this._component.parent.removeChild(this._component),this._component=null)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=YR.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(hI.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){super.release(),this.removeProduct()}}sj.type="component";const nj=()=>{YR.registerMark(sj.type,sj)},rj=t=>t;class aj extends tj{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}getVisible(){return this._visible}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i,s;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._specVisible=!0,this._hideWhenEmpty=!1,this._tick=void 0,this._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._specVisible=null===(i=t.visible)||void 0===i||i,this._hideWhenEmpty=null!==(s=t.hideWhenEmpty)&&void 0!==s&&s,this._visible=this._specVisible,this._coordinateType="none"}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._specVisible=null===(t=this._spec.visible)||void 0===t||t,this._hideWhenEmpty=null!==(e=this._spec.hideWhenEmpty)&&void 0!==e&&e,this._visible=this._specVisible,this._scale&&this._refreshVisibilityByData()}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,y,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._refreshVisibilityByData(),this._shouldComputeTickData()&&this._initData(),this._specVisible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?ej.circleAxis:ej.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?ij.circleAxisGrid:ij.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if(this._syncComponentVisibility(),(null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==L(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=IF(null===(h=YR.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(d=null!==(c=this._spec.animationAppear)&&void 0!==c?c:L(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==d?d:L(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(u=this._spec.animationDisappear)&&void 0!==u?u:L(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:L(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:L(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:L(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(_=null!==(v=this._spec.animationExit)&&void 0!==v?v:L(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==_?_:L(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(y=this._spec.animationUpdate)&&void 0!==y?y:L(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b:L(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._specVisible&&(this.getVisible()||this._spec.forceInitTick||this._hideWhenEmpty)}_initData(){const t=this._initTickDataSet(this._tickTransformOption()),e=new AD(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return this._regions&&nR(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=y(a)?VC(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!VC(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return nR(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=rR(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()})),nR(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(){}_hasCollectedSeriesData(){return this.collectData(0).length>0}_refreshVisibilityByData(){const t=this._specVisible&&(!this._hideWhenEmpty||this._hasCollectedSeriesData()),e=this._visible!==t;return this._visible=t,(this._axisMark||this._gridMark)&&this._syncComponentVisibility(),e&&this._forceLayout(),e}_syncComponentVisibility(){var t,e,i,s,n,r,a,o,l,h,c,d;null===(t=this._axisMark)||void 0===t||t.setVisible(this._visible),null===(e=this._gridMark)||void 0===e||e.setVisible(this._visible&&!1!==(null===(i=this._spec.grid)||void 0===i?void 0:i.visible)),null===(a=null===(r=null===(n=null===(s=this._axisMark)||void 0===s?void 0:s.getComponent)||void 0===n?void 0:n.call(s))||void 0===r?void 0:r.setAttributes)||void 0===a||a.call(r,{visibleAll:this._visible}),null===(c=null===(h=null===(l=null===(o=this._gridMark)||void 0===o?void 0:o.getComponent)||void 0===l?void 0:l.call(o))||void 0===h?void 0:h.setAttributes)||void 0===c||c.call(h,{visibleAll:this._visible&&!1!==(null===(d=this._spec.grid)||void 0===d?void 0:d.visible)})}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&U(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):nR(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(nR(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_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=eI(s=t.domainLine)).startSymbol=eI(s.startSymbol),s.endSymbol=eI(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 nI(GR({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:nI(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>nI(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=nI(t[i]))})),e}(t.label.state)),d(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}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:d(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},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 nI(GR({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:nI(t.tick.style)),t.tick.state&&(i.tick.state=iI(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 nI(GR({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:nI(t.subTick.style)),t.subTick.state&&(i.subTick.state=iI(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=Bz[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?oe(p):null,textStyle:GR({},d,nI(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:nI(h.style)}),h.state&&(i.title.state.shape=iI(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:nI(o.style)}),o.state&&(i.title.state.background=iI(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=iI(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=nI(t.background.style)),t.background.state&&(i.panel.state=iI(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:gO(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 nI(GR({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:nI(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:gO(t.subGrid.alternateColor),style:nI(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=rF(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){yI(this._option.dataSet,"scale",rj);const i=this.registerTicksTransform();return new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,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)}getDatum(t){var e;return t&&t.name===vT.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}aj.specKey="axes";const oj=()=>{nj(),YR.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},lj=[Ez];class hj extends aj{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}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),nR(this._regions,(t=>{const e=this.getOrient();XF(e)?Dz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):KF(e)?Dz(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):qF(e)&&Dz(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&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._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{if(!this._visible)return void this._syncComponentVisibility();const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=GR({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(GR({x:t.x,y:t.y},this._getGridAttributes(),s)),this._syncComponentVisibility()},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=XF(this.getOrient()),n=t=>{var e;return(s?!XF(t.getOrient()):XF(t.getOrient()))&&VC(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())>=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,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=ZF(i,["z"]),qF(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(!Rz(e))return null;const{axisType:t,componentName:s}=QF(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=>KF(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(!Rz(t))return;const{axisType:s,componentName:n}=QF(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=YR.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}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return XF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):qF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(lj.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this._specVisible){XF(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&&!XF(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!qF(this.getOrient())&&this._spec.innerOffset){const t=this._spec;KF(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=LR(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=LR(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=XF(this.getOrient())?t.fieldX:qF(this.getOrient())?t.fieldZ:t.fieldY,VC(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;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,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:VC(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 t;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(hI.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(XF(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._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=XF(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:K(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return nR(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]:XF(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:qF(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();nR(this._regions,(e=>{XF(t)?Dz(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):KF(t)?Dz(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):qF(t)&&Dz(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(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=XF(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=XF(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)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=GR(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new Ve).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=XF(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?_t(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):_t(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-$(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&u(null===(e=a.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=a.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 o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return Iz(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:VC(this._scale.type)?i>=s[0]&&i<=$(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this._specVisible&&(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 i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}hj.type=r.cartesianAxis,hj.specKey="axes";const cj=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function dj(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,pj=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function gj(t,e,i="count"){const s=pj(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const fj=Math.sqrt(50),mj=Math.sqrt(10),vj=Math.sqrt(2);class _j{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){p(this._spec.nice)&&(this._nice=this._spec.nice),p(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=Lz(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(i.forceTickCount))e=i.forceTickCount;else if(d(i.tickCount)){const t=this._scale.range();let s=Math.abs($(t)-t[0]);if(1===s&&this._option){s=XF(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=k(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return u(s)&&u(n)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&u(n)&&u(this._softMaxValue)?this._scale.niceMax(e):!(!u(s)||!u(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return u(e)&&u(i)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&u(i)&&u(this._softMaxValue)?this._scale.niceMax():!(!u(e)||!u(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=u(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(uj),e.sort(uj),{domain:dj(t,e),scope:gj(t,e,i)}}(r,zy(t),this._spec.breaks[0].scopeType);e=zy(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return 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);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}=Lz(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs(K(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[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=fj?10:n>=mj?5:n>=vj?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max($(t),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)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}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._refreshVisibilityByData(),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)-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}_updateRawDomain(){const e=this.collectData(0,!0),i=this.computeLinearDomain(e);this._rawDomain=i,this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}const yj={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},bj={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}}},xj={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}}},Sj={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}}};class Aj extends hj{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new PE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}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)}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!qF(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=XF(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=BR(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=zy(this._break.scope).map((t=>i[0]+($(i)-i[0])*t))),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}registerTicksTransform(){const t=`${this.type}-ticks`;return _I(this._option.dataSet,t,HE),t}}Aj.type=r.cartesianLinearAxis,Aj.specKey="axes",Aj.builtInTheme={axis:Sj,axisLinear:yj,axisX:bj,axisY:xj},G(Aj,_j);const kj=()=>{YR.registerGraphicComponent(ej.lineAxis,((t,e)=>new CC(t,e))),YR.registerGraphicComponent(ij.lineAxisGrid,((t,e)=>new zB(t,e))),oj(),YR.registerComponent(Aj.type,Aj)};class Mj{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new AD(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{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._refreshVisibilityByData(),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._spec.showAllGroupLayers?this._scales:[this._scales[0]]).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=Iz(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=>Iz(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const e=this._spec.domain;for(let t=0;tthis._rawDomainIndex[t][e]=i))}this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const Tj={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}};class wj extends hj{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new cE}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}}registerTicksTransform(){const t=`${this.type}-ticks`;return _I(this._option.dataSet,t,GE),t}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=eE(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{YR.registerGraphicComponent(ej.lineAxis,((t,e)=>new CC(t,e))),YR.registerGraphicComponent(ij.lineAxisGrid,((t,e)=>new zB(t,e))),oj(),YR.registerComponent(wj.type,wj,!1)};class Ej extends Aj{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),nR(this._regions,(t=>{XF(this.getOrient())?Dz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):Dz(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=GR({},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 Pa(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.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 AD(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=mi.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=>Iz(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=>Iz(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return _I(this._option.dataSet,t,HE),t}transformScaleDomain(){}}Ej.type=r.cartesianTimeAxis,Ej.specKey="axes",Ej.builtInTheme={axis:Sj,axisX:bj,axisY:xj};class Bj extends Aj{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new IE}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return _I(this._option.dataSet,t,HE),t}transformScaleDomain(){}}Bj.type=r.cartesianLogAxis,Bj.specKey="axes",Bj.builtInTheme={axis:Sj,axisLinear:yj,axisX:bj,axisY:xj},G(Bj,_j);class Pj extends Aj{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new DE}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return _I(this._option.dataSet,t,HE),t}transformScaleDomain(){}}Pj.type=r.cartesianSymlogAxis,Pj.specKey="axes",Pj.builtInTheme={axis:Sj,axisLinear:yj,axisX:bj,axisY:xj},G(Pj,_j);const Lj=`${mO}_hide_`;function Rj(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const Oj=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[Lj]&&(Rj(t,!0),t[Lj]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=u(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[Lj]=!0,Rj(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},Ij=()=>{YR.registerGrammarTransform("symbolOverlap",{transform:Oj,runType:"afterEncode"})},Dj={min:K,max:X,average:QL,sum:JL};function Fj(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}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function zj(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 jj(t,e,i,s){return zj(t,e,i,"min",s)}function Hj(t,e,i,s){return zj(t,e,i,"max",s)}function Vj(t,e,i,s){return zj(t,e,i,"average",s)}function Nj(t,e,i,s){return zj(t,e,i,"sum",s)}const Uj=(t,e)=>{let i=d(t.size)?t.size():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=Fj;if("min"===n?l=jj:"max"===n?l=Hj:"average"===n?l=Vj:"sum"===n&&(l=Nj),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[]},Wj=()=>{YR.registerGrammarTransform("dataSampling",{transform:Uj})};class Gj extends $F{constructor(){super(...arguments),this.type=cR.line,this.transformerConstructor=bz,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.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(IF(null===(i=YR.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),DF("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=YF(this);this._symbolMark.setAnimationConfig(IF(null===(s=YR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),DF("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),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]}}Gj.type=cR.line,Gj.mark=uz,Gj.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},Gj.transformerConstructor=bz,G(Gj,dz);class Yj{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{EI(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof Pa)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];Vy(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];Vy(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class $j{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)=>{Jy(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{UO(e,[{key:t,operations:VC(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&&UO(e,[{key:i.field,operations:VC(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?MR("colorOrdinal"):MR(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(Jy(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),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(U(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;if(!U(r.specified,s.specified))return e.reMake=!0,e;s.range&&!U(s.range,n.range())&&(n.range(s.range),e.reRender=!0),Jy(s.domain)?e.reRender=!0:U(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(!Jy(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=VC(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=VC(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;VC(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(VC(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=VC(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(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)));VC(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 Xj{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&t.addState(i,!0,l):a&&t.addState(s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&t.addState(i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{t.removeState(i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&t.removeState(e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}class Kj extends eD{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){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=qy(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:vO,height:_O},this._viewRect={width:vO,height:_O},this._viewBox={x1:0,y1:0,x2:vO,y2:_O},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=IR(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new lI(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new Yj(this._dataSet),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===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new Xj;const t=this.getAllSeries(),e=[],i={};t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=`${n}-${t.type}`;i[r]?s.forEach((t=>{i[r].marks.push(t)})):(i[r]=Object.assign(Object.assign({},t),{marks:s}),e.push(i[r]))}))}})),e.forEach((t=>{const e=YR.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(IF({},DF("stage",this._spec,{}),null))}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.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=H(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=YR.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({},i),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_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){const s=YR.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"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(){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e,this._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof sD)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 CD))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof CD)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}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&&EI(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=GI(this._spec,this._option,{width:vO,height:_O})),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),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=fR(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new $j(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){YI(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=fR(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0};return Object.keys(t).filter((t=>!e[t])).sort()}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=this._getSpecKeys(this._spec);if(!U(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{YI(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[r.title]:!0,[r.brush]:!0,[r.indicator]:!0};this._components.forEach((s=>{var n,a;if(s.type===r.label||s.type===r.totalLabel)return;i[s.type]&&(i[s.type]=!1);const o=s.specKey||s.type,l=null!==(n=this._spec[o])&&void 0!==n?n:{};y(l)?(e[o]=e[o]||{specCount:l.length,componentCount:0},e[o].componentCount++,YI(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):YI(t,s.updateSpec(l))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}const s=t=>t&&!1!==t.visible;Object.keys(i).forEach((e=>{if(i[e]){const i=this._spec[e];(y(i)?i.some(s):s(i))&&(t.reMake=!0)}}))}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];YI(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=RR(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.resetLayoutItemTag(),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(){this._backgroundMark&&this._backgroundMark.compile()}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._option.globalInstance),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,this._option.globalInstance)}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._option.globalInstance),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,this._option.globalInstance)}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._option.globalInstance),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,this._option.globalInstance)}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(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(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(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(hI.AFTER_MARK_RENDER_END,e)};this._event.on(hI.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?Y(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:aI;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||d(e.filter)&&e.filter(o,l))){if(rI(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===hz.dimensionHover||s===hz.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=u(t)||!n||n.every((t=>UC(t.axis.getScale().type)&&u(t.index))),o=a||n.every((t=>UC(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(n))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(r.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(r.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),n=[];s.forEach((e=>{const i=t(e);!1!==i&&n.push({axis:e,value:i})})),i.showCrosshair(n)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const qj=(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 Zj{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)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):WR(t,a,c.spec),WR(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));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=qj(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=qj(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,e,i){var s,n,r,a,o;const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,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},h=this.seriesType;return h&&(l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(YR.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(YR.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=YR.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=YR.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=YR.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.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):aF(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=aF(t,u.specKey,u.type))||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"];return 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}))}_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 Jj extends Zj{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_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;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{u(i[t])&&(i[t]=n[t])})),L(i,"trimPadding")&&GR(i,$I(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class Qj extends Jj{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),WI(t)}}const tH=(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&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=YO(t,!0);for(const e in o)for(const i in o[e].nodes)qO(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)KO(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&XO(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}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 iH{_beforeInit(){this._dataSet&&_I(this._dataSet,"stackSplit",tH)}_initStack(){this._stack=new eH(this),this._stack.init()}}const sH={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:hz.dimensionHover};class nH extends YD{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},sH,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=aI(i);let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}nH.type="dimension-hover",nH.defaultOptions=sH;const rH=()=>{YR.registerInteractionTrigger(nH.type,nH)},aH=()=>{YR.registerComposedEvent(hz.dimensionHover,lz),YR.registerComposedEvent(hz.dimensionClick,iz)},oH=t=>t.fieldX[0],lH=t=>t.fieldY[0],hH=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},cH=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},dH=(t,e)=>t?e?oH:hH:e?lH:cH,uH=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=oz(t,(t=>XF(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=oz(t,(t=>KF(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{UC(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((t=>{if(d.size>0){if(d.has(t)){const s=pH(t,i,dH(e,UC(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=pH(t,i,dH(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},pH=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:gH(t,s,i)},gH=(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=rz(e,t,"cartesian",null!=i?i:XF(t.getOrient())?oH:lH);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},fH=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:u,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,_=0,y=null;if(d.size){const t=Array.from(d.values())[0];_=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,y=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(_)&&!Number.isNaN(_),x=s&&!b&&p(u),S=x?u:{coordRange:[0,0],sizeRange:[0,0],coord:_,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:y};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(UC(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(VC(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,_=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=Pz(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(a=y.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&y&&null!==(o=y.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(l=y.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&y&&null!==(h=y.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(c=y.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&y&&null!==(d=y.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(u=y.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&y&&null!==(p=y.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};vH(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=_+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=_+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&mH(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),mH=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=rF(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},vH=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},_H=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=yH(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},yH=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},bH=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return fH(c,r,e),c.xField.cacheInfo?_H(c.xField):c.yField.cacheInfo?_H(c.yField):void 0},xH=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],SH=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&xH.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(AH(s).every((t=>{var e;return!dF("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},AH=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},kH={dom:`${mO}_TOOLTIP_HANDLER_DOM`,canvas:`${mO}_TOOLTIP_HANDLER_CANVAS`},MH={key:"其他",value:"..."};var TH;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(TH||(TH={}));class wH{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(u(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,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:h,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}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:d,model:g}=e;if(!d||!this._cacheActiveSpec){const d=this.component.getSpec();if(this._cacheActiveSpec=SH(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){u(this._cacheActiveSpec.handler)&&p(d.handler)&&(this._cacheActiveSpec.handler=d.handler);const g=null!==(i=d[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},MH),t):MH;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!u(e)&&dF(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class CH extends wH{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)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],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(!UC(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(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}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const EH=()=>{YR.registerTooltipProcessor("dimension",CH)};class BH extends wH{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,Ko.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(aI(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const PH=()=>{YR.registerTooltipProcessor("mark",BH)};class LH extends wH{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:Y(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?Y(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_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 RH=()=>{YR.registerTooltipProcessor("group",LH)};class OH extends Kj{constructor(){super(...arguments),this.transformerConstructor=Qj,this.type="line",this.seriesType=cR.line}_setModelOption(){this._modelOption.getDimensionInfo=uH,this._modelOption.getDimensionInfoByValue=gH,this._modelOption.getRectByDimensionData=bH}}OH.type="line",OH.seriesType=cR.line,OH.transformerConstructor=Qj,G(OH,iH);const IH=[...gz,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class DH extends fz{constructor(){super(...arguments),this.type=DH.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return IH}_getIgnoreAttributes(){return[]}}DH.type="area";const FH=()=>{YR.registerMark(DH.type,DH),Jk(),Lk(),EB(),kB(),WD(),YR.registerGraphicComponent("area",nf)};class zH extends fF{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 jH=Object.assign(Object.assign(Object.assign({},wF),cz),{area:{name:"area",type:"area"}}),HH=()=>{YR.registerAnimation("area",ND),UD(),HD()};class VH extends bz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!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,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_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,f=h;("line"===c||u&&!d)&&(g=h,f=l),l.style=GR({},f.style,g.style),l.state=GR({},f.state,g.state),!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),t.area=l,t.line=h}}class NH extends $F{constructor(){super(...arguments),this.type=cR.area,this.transformerConstructor=VH,this._sortDataByAxis=!1}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(NH.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}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===eF?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return TR(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),y1: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),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return TR(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:!!e&&this.getColorAttribute(),stroke:!!i&&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.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[TO]},"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(IF(null===(e=YR.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),DF("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(IF(null===(i=YR.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),DF("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=YF(this);this._symbolMark.setAnimationConfig(IF(null===(s=YR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),DF("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new zH(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.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(){super.onLayoutEnd(),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}}}NH.type=cR.area,NH.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},NH.mark=jH,NH.transformerConstructor=VH,G(NH,dz);class UH extends Jj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),WI(t)}}class WH extends Kj{constructor(){super(...arguments),this.transformerConstructor=UH,this.type="area",this.seriesType=cR.area}_setModelOption(){this._modelOption.getDimensionInfo=uH,this._modelOption.getDimensionInfoByValue=gH,this._modelOption.getRectByDimensionData=bH}}WH.type="area",WH.seriesType=cR.area,WH.transformerConstructor=UH,G(WH,iH);function GH(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 YH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:GH(t,e)}),$H=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:GH(t,e)}),XH={type:"fadeIn"},KH={type:"growCenterIn"};function qH(t,e){if(!1===e)return{};switch(e){case"fadeIn":return XH;case"scaleIn":return KH;default:return YH(t)}}class ZH extends CD{constructor(){super(...arguments),this.type=ZH.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}ZH.type="rect";const JH=()=>{Jk(),Xk(),xB("rect",TB),YR.registerMark(ZH.type,ZH),pw.registerBuiltInAnimate("growHeightIn",rC),pw.registerBuiltInAnimate("growHeightOut",aC),pw.registerBuiltInAnimate("growWidthIn",SC),pw.registerBuiltInAnimate("growWidthOut",AC),pw.registerBuiltInAnimate("growCenterIn",iC),pw.registerBuiltInAnimate("growCenterOut",sC),YR.registerGraphicComponent("rect",Dg)},QH=Object.assign(Object.assign({},wF),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function tV(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;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=FR(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[CF]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):TR(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[EF]):TR(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=TR(this._dataToPosX(t),e,i),n=TR(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[BF]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):TR(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[PF]):TR(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=TR(this._dataToPosY(t),e,i),n=TR(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},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(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},sV.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:jF(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(sV.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}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(_I(this._option.dataSet,"addVChartProperty",lF),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};_I(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new Pa(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:AF.bind(this),call:kF}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new AD(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=PF,s=BF,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=EF,s=CF,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=YO(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)tV(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=TR(this[r](t),l,i),u=TR(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!wR(t[this.getStackValueField()],l)?p=0:pthis._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.setMarkConfig({clip:!0,clipPath:()=>{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[MO],n=t[TO],r=t[wO],h=t[CO];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]),{[MO]:i,[TO]:s}),a?{[wO]:o,[CO]:l}:void 0),c="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)};t.push(Dg(Object.assign(Object.assign({},c),{cornerRadius:d(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(c,h,this._markAttributeContext):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=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>TR(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},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=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>TR(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),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;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=K(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=YF(this);this._barMark.setAnimationConfig(IF(null===(e=YR.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),DF(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=p(this._spec.barWidth)&&r===n,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=a;return o&&(c=FR(this._spec.barWidth,a)),l&&(c=Math.max(c,FR(this._spec.barMinWidth,a))),h&&(c=Math.min(c,FR(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=u(i)?f:Math.min(f,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,m-1))&&void 0!==r?r:6,_=m===f?this._barMark.getAttribute(c,e):v;if(m>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=FR(null!==(l=i[r-1])&&void 0!==l?l:$(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=VC(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(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}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}}sV.type=cR.bar,sV.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},sV.mark=QH,sV.transformerConstructor=iV;const nV=()=>{Wj(),JH(),YR.registerAnimation("bar",((t,e)=>({appear:qH(t,e),enter:YH(t,!1),exit:$H(t,!1),disappear:{duration:FD.disappear.duration}}))),Cj(),kj(),YR.registerSeries(sV.type,sV)};class rV extends Jj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),WI(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 aV extends Kj{constructor(){super(...arguments),this.transformerConstructor=rV,this.type="bar",this.seriesType=cR.bar}_setModelOption(){this._modelOption.getDimensionInfo=uH,this._modelOption.getDimensionInfoByValue=gH,this._modelOption.getRectByDimensionData=bH}}aV.type="bar",aV.seriesType=cR.bar,aV.transformerConstructor=rV,G(aV,iH);const oV=[10,20],lV=jC.Linear,hV="circle",cV=jC.Ordinal,dV=["circle","square","triangle","diamond","star"],uV=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},pV=Object.assign(Object.assign({},wF),{point:{name:"point",type:"symbol"}});class gV extends UF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class fV extends $F{constructor(){super(...arguments),this.type=cR.scatter,this.transformerConstructor=gV,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=`${mO}_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=`${mO}_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:lV,defaultRange:oV},"size")}getShapeAttribute(t,e){return u(e)?hV:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:cV,defaultRange:dV},"shape")}initMark(){this._symbolMark=this._createMark(fV.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:jF(this._spec,fV.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=YF(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(IF(null===(i=YR.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),DF("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:hV},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{if(!t)return;const e=t.getGraphics();e&&e.length&&e.forEach(((t,e)=>{var i,s;const n=null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],r=this.dataToPosition(n);r&&t&&t.translateTo(r.x,r.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){this.handleZoom(t)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}fV.type=cR.scatter,fV.mark=pV,fV.builtInTheme={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"}}}}},fV.transformerConstructor=gV;const mV=()=>{yz(),YR.registerAnimation("scatter",((t,e)=>Object.assign({appear:uV(0,e)},zD))),Cj(),kj(),YR.registerSeries(fV.type,fV)};class vV extends Jj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class _V extends Kj{constructor(){super(...arguments),this.transformerConstructor=vV,this.type="scatter",this.seriesType=cR.scatter}_setModelOption(){this._modelOption.getDimensionInfo=uH,this._modelOption.getDimensionInfoByValue=gH,this._modelOption.getRectByDimensionData=bH}}_V.type="scatter",_V.seriesType=cR.scatter,_V.transformerConstructor=vV,G(_V,iH);class yV extends WF{constructor(){super(...arguments),this.type=cR.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=`${mO}_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 bV=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[bO]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[NO]=e.nameMap[n]:t[NO]=n})),t.features);class xV extends fF{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 SV extends CD{constructor(){super(...arguments),this.type=SV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}SV.type="path";const AV=()=>{YR.registerMark(SV.type,SV),Jk(),Wk(),YR.registerGraphicComponent("path",tf)},kV=Object.assign(Object.assign({},wF),{area:{name:"area",type:"path"}});class MV{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Ia(i,e):Ra[i]?(La[i]||(La[i]=Ia(i,Ra[i])),La[i]):null}(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 TV{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(){}}class wV{constructor(){this._lastScale=0}clearZoom(){this._lastScale=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 CV(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:TV}:$y(e)||Xy(e)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:wV}:null}const EV={debounce:St,throttle:At};class BV{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=$y(this._renderMode)||Xy(this._renderMode),CV(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return CV(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(u(r))return;if(!ke({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{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(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:pI.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:pI.chart,consume:!1}];l.on(...c,EV[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,EV[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||CV(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||CV(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:ke({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:pI.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:pI.chart,consume:!1}];l.on(...c,EV[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,EV[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){CV(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||CV(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(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:pI.chart},(t=>{if(!t.event)return;const{event:n}=t;ke({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:pI.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||CV(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:pI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||CV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:pI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:pI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:pI.chart,source:uI.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:pI.chart,source:uI.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=EV[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=EV[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:pI.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:pI.chart,source:uI.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:pI.chart,source:uI.chart},this._handleDragMouseUp)}))}}function PV(t,e){return`${mO}_${e}_${t}`}class LV extends tj{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:PV(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;const l=p(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,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,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):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,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=GR(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var e,i,s;this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:n}=this._spec;if(n){let t=!0,r=!0,a=!1;!0!==n&&(t=null===(e=n.zoom)||void 0===e||e,r=null===(i=n.drag)||void 0===i||i,a=null!==(s=n.blank)&&void 0!==s&&s),t&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!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 MV(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===cR.map||e.type===cR.pictogram?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(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),nR(this._regions,(t=>{var e;if(t.type===cR.map||t.type===cR.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new We})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==cR.map&&e.type!==cR.pictogram||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[NO],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!U(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}LV.type=r.geoCoordinate,G(LV,BV);const RV=()=>{YR.registerComponent(LV.type,LV)};class OV extends UF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class IV extends yV{constructor(){super(...arguments),this.type=cR.map,this.transformerConstructor=OV,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 !`),bI.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var e,i;super.initData(),_I(this._dataSet,"copyDataView",TI),_I(this._dataSet,"map",bV),_I(this._dataSet,"lookup",oF);const s=bI.get(this.map);s||null===(e=this._option)||void 0===e||e.onError("no valid map data found!");const n=new Pa(this._dataSet,{name:`map_${this.id}_data`});n.parse([s],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:t.TransformLevel.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:NO,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",n.reRunAllTransform),this._mapViewData=new AD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(IV.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:jF(this._spec,IV.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}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:SO])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:SO]):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(IF(null===(t=YR.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),DF("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new xV(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[bO]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[bO],{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;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new We}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new We}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}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 bO}getActiveMarks(){return[this._pathMark]}}IV.type=cR.map,IV.mark=kV,IV.builtInTheme={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"}}}}},IV.transformerConstructor=OV;const DV=`${mO}_waterfall_default_seriesField`,FV=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n,calculationMode:r}=e,a=[],{dimensionValues:o,dimensionData:l}=n().latestData;let h=Array.from(o[i]);"decrease"===r&&(h=h.reverse());let c={start:0,end:0,positive:0,negative:0,lastIndex:null};return h.forEach(((t,i)=>{const n={start:c.end,end:c.end,lastIndex:c.lastIndex,lastEnd:c.end,index:t,isTotal:!1,positive:c.end,negative:c.end},r=!0===e.stackInverse?l[t].reverse():l[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[RO]=!0:delete t[RO]})),r.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===h.length-1)return!0;return!1};if(r.some((t=>o(t))))return c=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,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=zV([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 f=g[0];let{start:m,end:v}=jV(f,i,s,n,u);i.start=m,i.end=v;let _=m,y=m,b=v-m;const x=p.reduce(((t,e)=>ne(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=se(_,e)):(t[c]=+y,y=se(y,e)),t[d]=se(t[c],e),m=se(m,e),b=ne(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,n,a,c,h,i,e,o),void a.push(n)}c=zV(r,t,n,a,c,h,i,e),a.push(n)})),a};function zV(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}=jV(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=se(i.positive,e)):(t[h]=+i.negative,i.negative=se(i.negative,e)),t[c]=se(t[h],e),i.end=se(i.end,e)}i.isTotal=e,(u(p)||p===DV)&&(t[DV]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function jV(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?Vy("total.collectCountField error"):n=e[a].start;o<0?Vy("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=se(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 HV=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>se(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?t.unshift(o):t.push(o),t},VV={type:"fadeIn"},NV={type:"growCenterIn"};function UV(t,e){switch(e){case"fadeIn":return VV;case"scaleIn":return NV;default:return YH(t,!1)}}class WV extends CD{constructor(){super(...arguments),this.type=WV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(t,i,s){const n=super._transformGraphicAttributes(t,i,s),{x:r,x1:a,y:o,y1:l}=n,h=e(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return Lg(t)}}WV.type="rule";const GV=()=>{YR.registerMark(WV.type,WV),Jk(),Nk(),YR.registerGraphicComponent("line",Lg)},YV=Object.assign(Object.assign({},QH),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),$V=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:XV(t.map((t=>t.latestData)).flat(),e.fields,i)}};function XV(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)=>XV(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class KV{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 Pa(e instanceof Ba?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),_I(e,"dimensionTree",$V),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 qV extends iV{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const ZV={rect:sN,symbol:eN,arc:rN,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=eN(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:aN,line:oN,area:oN,rect3d:sN,arc3d:rN,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function JV(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=ZV[t])&&void 0!==i?i:ZV.point;return e.series.type===cR.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=tN(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;_(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!_(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:lN(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function QV(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==cR.sankey){const{formatFunc:t,args:n}=rF(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function tN(t){return d(t)?e=>t(e.data):t}function eN(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=tN(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:iN(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function iN(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function sN(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=tN(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;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:nN(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function nN(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 rN(t){var e;const{labelSpec:i}=t,s=null!==(e=tN(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 aN(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=QV(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),Tg(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 oN(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}))):[{index:0,[SO]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function lN(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class hN extends sV{constructor(){super(...arguments),this.type=cR.waterfall,this.transformerConstructor=qV,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&XO(t,e)}}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 KV(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=DV)}getSeriesKeys(){return this._seriesField===DV?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t,e,i;super.initData(),_I(this._dataSet,"waterfallFillTotal",HV),_I(this._dataSet,"waterfall",FV),(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,calculationMode:null!==(e=this._spec.calculationMode)&&void 0!==e?e:"increase",stackInverse:this.getRegion().getStackInverse()}},!1));const s=wI(this.getViewData(),this._dataSet,{name:`${mO}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",s.reRunAllTransform),this._totalData=new AD(this._option,s),s.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:MO,endAs:TO,total:this._spec.total,calculationMode:null!==(i=this._spec.calculationMode)&&void 0!==i?i:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}},!1),s.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}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=YF(this);this._barMark.setAnimationConfig(IF(null===(i=YR.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),DF("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(IF(null===(s=YR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),DF("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(){super.initMark();const t=this._createMark(hN.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:ne(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:ne(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return aN(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?TR(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):TR(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle();const e="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),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",e?0:1):0,y1:t=>this.totalPositionY(t,"index",e?1:0)},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",e?0:1):0,x1:t=>this.totalPositionX(t,"index",e?1:0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}isVisibleLeaderLine(t){return!u(t.lastIndex)&&wR([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}hN.type=cR.waterfall,hN.mark=YV,hN.builtInTheme={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}}}},hN.transformerConstructor=qV;const cN=()=>{GV(),JH(),YR.registerAnimation("waterfall",((t,e)=>({appear:UV(t,e),enter:YH(t,!1),exit:$H(t,!1),disappear:{duration:FD.disappear.duration}}))),VD(),Cj(),kj(),YR.registerSeries(hN.type,hN)},dN=`${mO}_BOX_PLOT_OUTLIER_VALUE`;var uN;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(uN||(uN={}));const pN=(t,e)=>{const i=[],{outliersField:s,dimensionField:n,seriesField:r}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];y(e)||(e=[e]),i.push(...e.map((e=>{const i={[dN]:e};return n.forEach((e=>{i[e]=t[e]})),p(r)&&(i[r]=t[r]),i})))})),i};class gN extends fF{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===uN.OUTLIER)return this.series.getOutliersField();if(t===uN.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case uN.MIN:return this.series.getMinField();case uN.MAX:return this.series.getMaxField();case uN.MEDIAN:return this.series.getMedianField();case uN.Q1:return this.series.getQ1Field();case uN.Q3:return this.series.getQ3Field();case uN.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===uN.OUTLIER)return e[dN];if(t===uN.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case uN.MIN:return e[this.series.getMinField()];case uN.MAX:return e[this.series.getMaxField()];case uN.MEDIAN:return e[this.series.getMedianField()];case uN.Q1:return e[this.series.getQ1Field()];case uN.Q3:return e[this.series.getQ3Field()];case uN.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,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>p(t[dN])}getDefaultContentList(t){return[{key:this.getContentKey(uN.OUTLIER),value:this.getContentValue(uN.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(uN.MAX),value:this.getContentValue(uN.MAX)},{key:this.getContentKey(uN.Q3),value:this.getContentValue(uN.Q3)},{key:this.getContentKey(uN.MEDIAN),value:this.getContentValue(uN.MEDIAN)},{key:this.getContentKey(uN.Q1),value:this.getContentValue(uN.Q1)},{key:this.getContentKey(uN.MIN),value:this.getContentValue(uN.MIN)},{key:this.getContentKey(uN.SERIES_FIELD),value:this.getContentValue(uN.SERIES_FIELD)}]}}class fN extends CD{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==ZI.enter&&t.context.diffState!==ZI.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;return this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?j(r,i):i}})),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=zg(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=YR.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const mN=()=>{YR.registerGraphicComponent("glyph",zg),Jk(),Dk()},vN=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],_N=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class yN extends fN{constructor(){super(...arguments),this.type=yN.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=vN,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=_N,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}yN.type="boxPlot";const bN=Object.assign(Object.assign({},wF),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),xN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},SN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},AN=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),kN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,M;if(i&&k(i.center))return i.center;let T,w,C,E,B;if("horizontal"===e){T=null===(r=null===(n=(null===(s=AN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,w=null===(h=null===(l=null===(o=null===(a=AN(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,C=null===(p=null===(u=null===(d=null===(c=AN(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=AN(t,"box").attribute.width,i=AN(t,"box").attribute.x;E=i,B=i+e}else{T=null===(m=null===(f=(null===(g=AN(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,w=null===(b=null===(y=null===(_=null===(v=AN(t,"max"))||void 0===v?void 0:v.attribute)||void 0===_?void 0:_.points)||void 0===y?void 0:y[0])||void 0===b?void 0:b.y,C=null===(M=null===(A=null===(S=null===(x=AN(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===M?void 0:M.y;const e=AN(t,"box").attribute.height,i=AN(t,"box").attribute.y;E=i,B=i+e}return k(T)?T:k(E)&&k(B)?(E+B)/2:k(w)&&k(C)?(w+C)/2:k(C)?C:k(w)?w:NaN},MN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,_,y,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=AN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=AN(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=AN(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;y=i,_=i+e;const c=(null===(l=AN(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=AN(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=AN(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=AN(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=AN(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;y=i,_=i+e;const s=(null===(f=AN(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=AN(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(_)&&k(y)?(_+y)/2:k(y)?y:k(_)?_:NaN};class TN extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return xN(kN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class wN extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return SN(kN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class CN extends TN{computeAttribute(){return xN(MN)(this.target,this.params,this.params.options)}}class EN extends wN{computeAttribute(){return SN(MN)(this.target,this.params,this.params.options)}}class BN extends UF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}class PN extends $F{constructor(){super(...arguments),this.type=cR.boxPlot,this.transformerConstructor=BN,this._bandPosition=0}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,r,a;super.setAttrFromSpec();const o=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=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(PN.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(PN.mark.outlier,{key:bO,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var e,i,s,n,r,a;const o=this._boxPlotMark;if(o){const s={lineWidth:this._lineWidth,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"!==this._shaftShape?"#000":this.getColorAttribute()};o.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const n="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return FR(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return FR(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return FR(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return FR(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return FR(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return FR(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return FR(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return FR(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(o,s,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(o,n,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Built_In)}const l=this._outlierMark;l&&this.setMarkStyle(l,{fill:null!==(r=null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this._boxFillColor)&&void 0!==r?r:this.getColorAttribute(),stroke:this.getColorAttribute(),size:S(null===(a=this._outliersStyle)||void 0===a?void 0:a.size)?this._outliersStyle.size:10},t.STATE_VALUE_ENUM.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=>TR(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>TR(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>TR(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>TR(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>TR(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},t.STATE_VALUE_ENUM.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:t=>this._getPosition(this.direction,t),x:t=>TR(e(this.getDatumPositionValues(t,dN),{bandPosition:this._bandPosition}),s)}:{x:t=>this._getPosition(this.direction,t),y:t=>TR(e(this.getDatumPositionValues(t,dN),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;_I(this._dataSet,"foldOutlierData",pN),_I(this._dataSet,"addVChartProperty",lF);const t=new Pa(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${mO}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField}}),t.transform({type:"addVChartProperty",options:{beforeCall:AF.bind(this),call:kF}},!1),this._outlierData=new AD(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t;if(this._autoBoxWidth)return this._autoBoxWidth;const e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,i=this._groups?this._groups.fields.length:1,s=null===(t=e.getBandwidth)||void 0===t?void 0:t.call(e,i-1);let n=s;return p(this._spec.boxWidth)&&(n=FR(this._spec.boxWidth,s)),p(this._spec.boxMinWidth)&&(n=Math.max(n,FR(this._spec.boxMinWidth,s))),p(this._spec.boxMaxWidth)&&(n=Math.min(n,FR(this._spec.boxMaxWidth,s))),this._autoBoxWidth=n,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r;let a,o,l;"horizontal"===t?(a=this.getYAxisHelper(),o="boxHeight",l=this.dataToPositionY.bind(this)):(a=this.getXAxisHelper(),o="boxWidth",l=this.dataToPositionX.bind(this));const h=a.getScale(0),c=this._groups?this._groups.fields.length:1,d=null===(i=a.getBandwidth)||void 0===i?void 0:i.call(a,c-1),u=this._boxPlotMark.getAttribute(o,e);if(c>1&&p(this._spec.boxGapInGroup)){const t=this._groups.fields,i=Y(this._spec.boxGapInGroup);let o=0,l=0;for(let h=t.length-1;h>=1;h--){const c=t[h],p=null!==(n=null===(s=a.getScale(h))||void 0===s?void 0:s.domain())&&void 0!==n?n:[],g=p.length,f=FR(null!==(r=i[h-1])&&void 0!==r?r:$(i),d),m=p.indexOf(e[c]);h===t.length-1?(o+=g*u+(g-1)*f,l+=m*(u+f)):(l+=m*(o+f),o+=o+(g-1)*f)}return h.scale(e[t[0]])+a.getBandwidth(0)/2-o/2+l+u/2}const g=VC(h.type||"band");return l(e)+.5*d+(g?-d/2:0)}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=j({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=YF(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=YR.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(DF("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(IF(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(IF(null===(a=YR.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new gN(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}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}PN.type=cR.boxPlot,PN.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},PN.mark=bN,PN.transformerConstructor=BN;const LN=()=>{mN(),Nk(),Xk(),YR.registerGraphicComponent("line",(t=>Lg(t))),YR.registerGraphicComponent("rect",(t=>Dg(t))),YR.registerMark(yN.type,yN),yz(),HD(),Cj(),kj(),pw.registerBuiltInAnimate("boxplotScaleIn",TN),pw.registerBuiltInAnimate("boxplotScaleOut",wN),pw.registerBuiltInAnimate("barBoxplotScaleIn",CN),pw.registerBuiltInAnimate("barBoxplotScaleOut",EN),YR.registerSeries(PN.type,PN)};class RN extends CD{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=RN.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?Zg(t):Tg(t)}}RN.type="text";const ON=()=>{YR.registerMark(RN.type,RN),Jk(),iM(),qk(),YR.registerGraphicComponent("text",Tg),YR.registerGraphicComponent("richtext",Zg)};class IN extends fF{constructor(){super(...arguments),this._getMeasureData=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]]}}const DN=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),FN={type:"fadeIn"},zN=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function jN(t,e){return"fadeIn"===e?FN:DN(t)}const HN=Object.assign(Object.assign({},QH),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class VN extends iV{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 NN extends sV{constructor(){super(...arguments),this.type=cR.rangeColumn,this._barMarkType="rect",this._barName=cR.bar,this.transformerConstructor=VN}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(NN.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:jF(this._spec,NN.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(NN.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(NN.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(e,i,s,n){var r,a,o,l;if(e){this.setMarkStyle(e,{fill:null!==(a=null===(r=null==i?void 0:i.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[s]]:t[this._spec.yField[s]];return(null==i?void 0:i.formatMethod)?i.formatMethod(e,t):e}});!function(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)}(this,e,null!==(o=null==i?void 0:i.position)&&void 0!==o?o:n,null!==(l=null==i?void 0:i.offset)&&void 0!==l?l:"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=YF(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(IF(null===(i=YR.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),DF("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(IF(null===(s=YR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),DF("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(IF(null===(n=YR.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),DF("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new IN(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)}}NN.type=cR.rangeColumn,NN.mark=HN,NN.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},NN.transformerConstructor=VN;const UN=()=>{JH(),ON(),YR.registerAnimation("rangeColumn",((t,e)=>({appear:jN(t,e),enter:DN(t),exit:zN(t),disappear:{duration:FD.disappear.duration}}))),VD(),Cj(),kj(),YR.registerSeries(NN.type,NN)};var WN,GN;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(WN||(WN={})),function(t){t.middle="middle",t.start="start",t.end="end"}(GN||(GN={}));class YN extends fF{constructor(){super(...arguments),this._getMeasureData=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]]}}const $N=Object.assign({},jH);class XN extends NH{constructor(){super(...arguments),this.type=cR.rangeArea}initMark(){this._areaMark=this._createMark(XN.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}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 YN(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}XN.type=cR.rangeArea,XN.mark=$N;class KN extends WF{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=Xz,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.radiusAxisHelper.dataToPosition(Y(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(Y(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}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:[]};VC(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:[]};VC(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)&&GF(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}}function qN(t){return Zy(t)?Number.parseFloat(t):0}const ZN=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&JN(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=fe(e+a/2)};let _=0,y=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,M=0;const T=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))}(x);if(m.forEach(((t,e)=>{const i=t[zz],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/M;A=p,m.forEach((e=>{const i=e[r]===f?f:e[zz]*t;v(e,A,i),A+=i}))}if(0!==_&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},JN=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===qN(t[e])))||!i&&0===t.reduce(((t,i)=>t+qN(i[e])),0)));function QN(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const tU=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:QN(t,!0,PI.appear)}),eU={type:"fadeIn"},iU=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:QN(t,!0,PI.enter)}),sU=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:QN(t,!0,PI.exit)});function nU(t,e){if(!1===e)return{};switch(e){case"fadeIn":return eU;case"growRadius":return tU(Object.assign(Object.assign({},t),{growField:"radius"}));default:return tU(Object.assign(Object.assign({},t),{growField:"angle"}))}}class rU extends CD{constructor(t,e){super(t,e),this.type=aU.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>ce({x:0,y:0},this.getAttribute("centerOffset",e,i),e[Uz])[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 aU extends rU{constructor(){super(...arguments),this.type=aU.type}}aU.type="arc";const oU=()=>{Jk(),Bk(),xB("arc",LB),pw.registerBuiltInAnimate("growRadiusIn",yC),pw.registerBuiltInAnimate("growRadiusOut",bC),pw.registerBuiltInAnimate("growAngleIn",tC),pw.registerBuiltInAnimate("growAngleOut",eC),YR.registerGraphicComponent("arc",of),YR.registerMark(aU.type,aU)},lU=Object.assign(Object.assign({},wF),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class hU extends UF{_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=GR({},this._theme,i,t);const n=(t,e)=>GR({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);y(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const cU=`${mO}_LABEL_VISIBLE`;class dU extends KN{constructor(){super(...arguments),this.transformerConstructor=hU,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:LR(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:LR(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=Yz,this._endAngle=$z,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[Uz];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return ce(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;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 a=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)?oe(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?oe(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?oe(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=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;_I(this._dataSet,"pie",ZN),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?oe(this._spec.minAngle):0,asStartAngle:Hz,asEndAngle:Vz,asRatio:jz,asMiddleAngle:Uz,asRadian:Gz,asQuadrant:Wz,asK:Nz,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new Pa(this._dataSet,{name:`${mO}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new AD(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},dU.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:xO,groupKey:this._seriesField,isSeriesMark:!0},{morph:jF(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return oR(Hz)(t)}endAngleScale(t){return oR(Vz)(t)}_computeLayoutRadius(){return Kz((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:CR(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:CR(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},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),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)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:oR(cU).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(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[Uz];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return ce(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===PI.appear)return this._startAngle;if(i===PI.disappear)return this._endAngle;const r=[PI.disappear,PI.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[bO];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[bO]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[bO])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[bO])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[Uz]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[Uz]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[Uz]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[Uz]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=IF(null===(i=YR.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}dU.transformerConstructor=hU,dU.mark=lU,dU.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class uU extends dU{constructor(){super(...arguments),this.type=cR.pie}}uU.type=cR.pie;const pU=()=>{oU(),YR.registerAnimation("pie",((t,e)=>({appear:nU(t,e),enter:iU(t),exit:sU(t),disappear:{duration:FD.disappear.duration}}))),YR.registerAnimation("emptyCircle",((t,e)=>({appear:nU(t,e)}))),YR.registerSeries(uU.type,uU)};function gU(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const fU=t=>({type:gU(t.growField),options:{overall:!0}}),mU={type:"fadeIn"},vU=t=>({type:gU(t.growField)}),_U=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function yU(t,e){if(!1===e)return{};switch(e){case"fadeIn":return mU;case"growAngle":return fU(Object.assign(Object.assign({},t),{growField:"angle"}));default:return fU(Object.assign(Object.assign({},t),{growField:"radius"}))}}class bU extends KN{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(TO),this.setInnerRadiusField(MO)}setValueFieldToPercent(){this.setRadiusField(CO),this.setInnerRadiusField(wO)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const xU=Object.assign(Object.assign({},wF),{rose:{name:"rose",type:"arc"}});class SU extends UF{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class AU extends aj{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=y(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let n,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:u,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((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:-90,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.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=u,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const _={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(_),"radius"===i.orient?(o.push(_),a=h):(l.push(_),n=h)})),o.forEach((t=>{t.angleAxisIndex=n})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=YR.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=Yz,this._endAngle=$z,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),nR(this._regions,(t=>{"radius"===this.getOrient()?Dz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):Dz(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(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.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:LR(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:LR(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this._specVisible&&(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=oe(this._spec.startAngle),this._endAngle=oe(this._spec.endAngle),this._inverse=this._spec.inverse}_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:Pz(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}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(){nR(this._regions,(t=>{"radius"===this.getOrient()?Dz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):Dz(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(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 VC(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:VC(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 ce(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return de(t,this.getCenter(),this._startAngle,this._endAngle)}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=>Iz(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_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=ae.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",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return Kz((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=Xz,e=0;const i=this.getChart().getSpec();return nR(this.getRegions(),(s=>{const n=s;if(r=n.type,[cR.rose,cR.radar,cR.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.getComponent().setAttributes(GR({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(GR({},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)}}AU.type=r.polarAxis,AU.specKey="axes";const kU={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},MU={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class TU extends AU{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new PE}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}registerTicksTransform(){const t=`${this.type}-ticks`;return _I(this._option.dataSet,t,HE),t}}TU.type=r.polarLinearAxis,TU.specKey="axes",TU.builtInTheme={axis:Sj,axisLinear:yj,axisAngle:MU,axisRadius:kU},G(TU,_j);const wU=()=>{YR.registerGraphicComponent(ej.lineAxis,((t,e)=>new CC(t,e))),YR.registerGraphicComponent(ij.lineAxisGrid,((t,e)=>new zB(t,e))),YR.registerGraphicComponent(ej.circleAxis,((t,e)=>new OC(t,e))),YR.registerGraphicComponent(ij.circleAxisGrid,((t,e)=>new UB(t,e))),oj(),YR.registerComponent(TU.type,TU)};class CU extends AU{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new cE}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)}registerTicksTransform(){const t=`${this.type}-ticks`;return _I(this._option.dataSet,t,XE),t}transformScaleDomain(){}}CU.type=r.polarBandAxis,CU.specKey="axes",CU.builtInTheme={axis:Sj,axisBand:Tj,axisAngle:MU,axisRadius:kU},G(CU,Mj);const EU=()=>{YR.registerGraphicComponent(ej.lineAxis,((t,e)=>new CC(t,e))),YR.registerGraphicComponent(ij.lineAxisGrid,((t,e)=>new zB(t,e))),YR.registerGraphicComponent(ej.circleAxis,((t,e)=>new OC(t,e))),YR.registerGraphicComponent(ij.circleAxisGrid,((t,e)=>new UB(t,e))),oj(),YR.registerComponent(CU.type,CU)};class BU extends bU{constructor(){super(...arguments),this.type=cR.rose,this.transformerConstructor=SU,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(){this._roseMark=this._createMark(BU.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:jF(this._spec,BU.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}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=>TR(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=TR(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(IF(null===(i=YR.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),DF("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}BU.type=cR.rose,BU.mark=xU,BU.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},BU.transformerConstructor=SU;const PU=()=>{YR.registerSeries(BU.type,BU),oU(),YR.registerAnimation("rose",((t,e)=>({appear:yU(t,e),enter:vU(t),exit:_U(t),disappear:{duration:FD.disappear.duration}}))),EU(),wU()};class LU extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:ce(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=de(this.from,this._prevCenter),{angle:i,radius:s}=de(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,KL(this._fromAngle,this._toAngle)&&KL(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class RU extends $w{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!sR(t)&&!sR(e))return e;const s=de(t,this._prevCenter),n=de(e,this._center);let r=pe(s.angle),a=pe(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new re(s,n,r,a);return o.defined=e.defined,o}}const OU=t=>({type:"in"===t?"fadeIn":"fadeOut"});function IU(t,e,i){return"fadeIn"===e?OU(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function DU(t,e,i){return"fadeIn"===e?OU(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 FU=(t,e)=>({custom:Gw,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),zU=Object.assign(Object.assign(Object.assign({},wF),cz),{area:{name:"area",type:"area"}});class jU extends bU{constructor(){super(...arguments),this.type=cR.radar,this.transformerConstructor=bz,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!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),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(jU.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}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:iF,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{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.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)?oe(this._spec.startAngle):Yz},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(IF(null===(s=YR.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),DF("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=YR.getAnimationInKey(e);t.setAnimationConfig(IF(null==i?void 0:i(n,r),DF(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}}}jU.type=cR.radar,jU.mark=zU,jU.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},jU.transformerConstructor=bz,G(jU,dz);const HU=()=>{YR.registerSeries(jU.type,jU),FH(),vz(),yz(),YR.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:IU(t,e,"in"),enter:IU(t,e,"in"),exit:IU(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:FD.disappear.duration},update:[{channel:["points","center"],custom:RU,customParameters:t,duration:FD.update.duration,easing:FD.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),YR.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:DU(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:FD.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:LU,customParameters:t,duration:FD.update.duration,easing:FD.update.easing}]}))),YR.registerAnimation("radarGroup",((t,e)=>({appear:FU(t,"in"),disappear:{duration:FD.disappear.duration}}))),Bk(),EU(),wU()};class VU extends fF{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>mi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const NU=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(mO)||(i[n]=t[n],s=p(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[bO]:r,[xO]:`${s}_${e}`})),r++}))})),n},UU={fill:"#bbb",fillOpacity:.2},WU=Object.assign(Object.assign({},wF),{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"}});class GU extends $F{constructor(){super(...arguments),this.type=cR.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 e;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),_I(this._option.dataSet,"objFlat",NU),_I(this._option.dataSet,"copyDataView",TI),yI(this._option.dataSet,"dataview",wa),null===(e=this.getViewData())||void 0===e||e.transform({type:"objFlat",options:"dots",level:t.TransformLevel.dotObjFlat},!1)}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(GR(UU,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(GU.mark.group),this._containerMark=this._createMark(GU.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(GU.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(GU.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(GU.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(GU.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(GU.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(GU.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var e;const i=this._clipMark;i&&(this.setMarkStyle(i,{x:-(null!==(e=this._spec.leftAppendPadding)&&void 0!==e?e:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",t.AttributeLevel.Series),i.setMarkConfig({interactive:!1,clip:!0}));const s=this._containerMark;s&&(this.setMarkStyle(s,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),s.setMarkConfig({interactive:!1}));const n=this._gridBackgroundMark;n&&this.setMarkStyle(n,{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 r=this._gridMark;r&&this.setMarkStyle(r,{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 a=this._dotMark;a&&this.setMarkStyle(a,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const o=this._titleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._subTitleMark;l&&this.setMarkStyle(l,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const h=this._symbolMark;h&&this.setMarkStyle(h,{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(){var e,i;super.onLayoutEnd();const s=null!==(i=null===(e=this._spec)||void 0===e?void 0:e.leftAppendPadding)&&void 0!==i?i:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+s},"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:SO}}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 AR).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:SO}}initTooltip(){this._tooltipHelper=new VU(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}GU.type=cR.dot,GU.mark=WU,GU.builtInTheme={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"}}}}};class YU extends fF{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>mi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const $U=Object.assign(Object.assign({},wF),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),XU=(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 KU extends $F{constructor(){super(...arguments),this.type=cR.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 e;super.initData(),_I(this._option.dataSet,"linkDotInfo",XU),null===(e=this.getViewData())||void 0===e||e.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:t.TransformLevel.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(KU.mark.group),this._containerMark=this._createMark(KU.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(KU.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(KU.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},"normal",t.AttributeLevel.Series),r.setMarkConfig({interactive:!1,clip:!0}));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setMarkConfig({interactive:!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:SO}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new YU(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}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]}}KU.type=cR.link,KU.mark=$U,KU.builtInTheme={link:{arrow:{style:{size:10}}}};const qU=Object.assign(Object.assign({},wF),{group:{name:"group",type:"group"}});class ZU extends KN{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()?MO:jO],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle);let o;if(p(s)){const t=ht(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()?TO:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle),o=ht(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)?oe(n):Yz;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?oe(r):$z,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=TR(this.angleAxisHelper.dataToPosition([t[MO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=TR(this.angleAxisHelper.dataToPosition([t[TO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?TR(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(ZU.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+oe(a),o=oe(r)/2;return of(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[Dg({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_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 eW=()=>{YR.registerAnimation("circularProgress",((t,e)=>({appear:tW(t,e),enter:{type:"growAngleIn"},disappear:{duration:FD.disappear.duration}})))};class iW extends UF{constructor(){super(...arguments),this._supportStack=!0}}class sW extends ZU{constructor(){super(...arguments),this.type=cR.circularProgress,this.transformerConstructor=iW,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(){return this._progressMark=this._createMark(sW.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:jF(this._spec,"progress")}),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)}getInteractionTriggers(){const t=[];return 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(){return this._trackMark=this._createMark(sW.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),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()?MO:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?TO: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(IF(null===(i=YR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),DF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(IF(null===(s=YR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),DF("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}sW.type=cR.circularProgress,sW.mark=JU,sW.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},sW.transformerConstructor=iW;const nW=()=>{YR.registerSeries(sW.type,sW),oU(),eW(),VD(),EU(),wU()};function rW(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const aW={type:"fadeIn"};function oW(t,e="grow"){return!1===e?{}:"fadeIn"===e?aW:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:rW(t)}))(t)}class lW extends fF{enableByType(t){return"dimension"!==t}}const hW=Object.assign(Object.assign({},wF),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class cW extends $F{constructor(){super(...arguments),this.type=cR.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=p(e.width)?e.width:e.x1-e.x,o=p(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(cW.mark.progress,{isSeriesMark:!0}),u(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n;const r=this._progressMark;if(r)if("vertical"===this._spec.direction){const s=this._spec.progress||{},n=null!==(e=s.leftPadding)&&void 0!==e?e:0,a=null!==(i=s.rightPadding)&&void 0!==i?i:0;this.setMarkStyle(r,{x:t=>{var e,i;return TR(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),!0)-this._spec.bandWidth/2+n},y1:t=>{var e,i;return TR(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))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?TR(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-n-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=this._spec.progress||{},i=null!==(s=e.topPadding)&&void 0!==s?s:0,a=null!==(n=e.bottomPadding)&&void 0!==n?n:0;this.setMarkStyle(r,{x1:t=>{var e,i;return TR(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))},y:t=>{var e,s;return TR(this.dataToPositionY(t),null===(s=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===s?void 0:s.call(e,0),!0)-this._spec.bandWidth/2+i},height:this._spec.bandWidth-i-a,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?TR(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){return this._trackMark=this._createMark(cW.mark.track),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return TR(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),!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 TR(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),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series))}getInteractionTriggers(){const t=[];return 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(IF(null===(i=YR.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),DF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(IF(null===(s=YR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),DF("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new lW(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}cW.type=cR.linearProgress,cW.mark=hW,cW.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const dW=()=>{JH(),YR.registerAnimation("linearProgress",((t,e)=>({appear:oW(t,e),enter:oW(t),disappear:{duration:FD.disappear.duration}}))),VD(),YR.registerSeries(cW.type,cW)},uW=[0],pW=[20,40],gW=[200,500],fW={shrink:!1,enlarge:!1,fontSizeLimitMin:0},mW=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class vW{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const _W=`${mO}_WORD_CLOUD_TEXT`,yW=Object.assign(Object.assign({},wF),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),bW={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic",scaleX:1,scaleY:1}}};class xW extends WF{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},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._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=pW}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,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:gW,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:uW,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?_W:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:fW},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||Yy(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:uW,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!mW.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new vW(1e3))}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",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var e;this._wordMark=this._createMark(xW.mark.word,{key:xO,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(e=this._spec.wordMask)||void 0===e?void 0:e.visible)&&(this._maskMark=this._createMark(xW.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",t.AttributeLevel.Series)}initMarkStyleOfWord(e,i,s,n,r){var a,o;e&&(this.setMarkStyle(e,{text:(null==i?void 0:i.formatMethod)?t=>i.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{fill:null!==(o=null===(a=null==i?void 0:i.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(IF(YR.getAnimationInKey("wordCloud")(n,s),DF("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 AR).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:SO])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new PE).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new PE).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[bO])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(e=this._spec.word)&&void 0!==e?e:{},h=null!==(i=l.style)&&void 0!==i?i:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const e=()=>{var i,s,n,r;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((t=>t.fn!==e)),null===(s=(i=this._option).dispatchEvent)||void 0===s||s.call(i,t.ChartEvent.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(r=null===(n=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===n?void 0:n.afterWordcloudShapeDraw)||void 0===r||r.call(n,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:e})},dataIndexKey:xO,text:l.formatMethod?t=>l.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(n=null===(s=this._spec.word)||void 0===s?void 0:s.padding)&&void 0!==n?n:1,fontFamily:p(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(r=h.fontFamily)&&void 0!==r?r:this._defaultFontFamily,fontWeight:p(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:p(h.fontWeight)?h.fontWeight:p(this._valueField)?this._calculateFontWeight:"normal",fontStyle:p(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:h.fontStyle,createCanvas:k_.createCanvas.bind(k_),getTextBounds:mf}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,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,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:Wg,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:p(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:p(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:p(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}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(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}xW.mark=yW,xW.builtInTheme={wordCloud:bW};function SW(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||FD.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,d;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(d=t.children)||void 0===d?void 0:d.length){p.children=[],p.isLeaf=!1;const e=AW(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Tt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Tt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},kW=(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=kW(t.children,e,t,n))})),s},MW=(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=MW(t.children,e,t,n)),n=e(t,s,i,n)})),n},TW=(t,e=[],i)=>{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):TW(t.children,e,i)))})),e};function wW(t,e){let i,s;if(BW(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function BW(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 OW(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 IW(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 DW(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 FW(t){return{_:t,next:null,prev:null}}function zW(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];OW(n,s,r);let a,o,l,h,c,d,u,p=FW(s),g=FW(n),f=FW(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.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,this._valueField=null!==(e=null==t?void 0:t.valueField)&&void 0!==e?e:"value"}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=AW(t,n,0,-1,null,this._getNodeKey,this._valueField);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%Ct)/Ct}(),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:NW.defaultOpionts.nodeSort;kW([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)kW([o],jW(h)),MW([o],HW(this._getPadding,.5,a)),kW([o],VW(1,this._maxDepth));else{const t=Math.min(s.width,s.height);kW([o],jW(NW.defaultOpionts.setRadius)),MW([o],HW(Rt,1,a)),c&&MW([o],HW(this._getPadding,o.radius/t,a)),kW([o],VW(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}NW.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const UW=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=UW(t.children):t.value=0),e+=Math.abs(t.value)})),e};function WW(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){UW(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=u(t.value)?0:Tt(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=H(t,["parents"]);if(a.parents=t.parents.map((t=>H(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=Tt(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function GW(t){return t.depth}function YW(t,e){return e-1-t.endDepth}const $W=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),XW=(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},KW={left:GW,right:YW,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?K(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:GW,end:YW},qW=bt(0,1);class ZW{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({},ZW.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._logger=ot.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):KW[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)};"vertical"===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<=0)return null;const a=this.computeNodeBreadths(n);if(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))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;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}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return 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){return WW(t,this._getNodeKey)}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=[XW(s[t.source]),XW(s[t.target],!0)].filter((t=>!u(t)));e.length&&(t.value=K(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){return function(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))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=d(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}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=_t(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;ea)&&(o=a);let l=0,h=null,c=null;if(d(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)c=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:c>0?t=>c:t=>Math.max(t.value*l,0),m=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*qW(t.value/e.value):0,n,0),o);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;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,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{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];JW(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),QW);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({},tG.defaultOpionts,t):Object.assign({},tG.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Lt(this.options.center[0],t.width),s=t.y0+Lt(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=>Lt(t,n))):Lt(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>Lt(t,n))):Lt(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=Lt(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=AW(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=ce({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)}}}function eG(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(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,f,m,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,_=Math.max(v/x,x/m),_>y){f-=h;break}y=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{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*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:JW,slice:eG,sliceDice:function(t,e,i,s,n){(t.depth%2==1?eG:JW)(t,e,i,s,n)}};class nG{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({},nG.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?Pt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?iG(this.options.aspectRatio):null!==(e=sG[this.options.splitType])&&void 0!==e?e:sG.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=AW(t,n,0,-1,null,this._getNodeKey,this.options.valueField);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)}))}}function rG(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+ci?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return ot.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=rG(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=Ci(o.map(Ci))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rwt(e)));u=Ri(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=aG(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&ot.getInstance().error("Area "+r+" not represented on screen")}return i}function pG(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Pi((function(i){return-1*gG({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},mG=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=Y(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!P(Y(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:Y(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||lG,s=e.lossFunction||oG,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=Y(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];di(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rae.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:fG(f),arcs:f})}))},vG={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:_G,triangle:_G,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.955)%(2*Math.PI/5)-2*Math.PI/10>=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 _G(){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 yG(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*.4),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"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const bG=t=>vG[t]?vG[t]():vG.circle(),xG=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function SG(t){return d(t)?t:function(){return t}}class AG{constructor(t){var e,i;switch(this.options=j({},AG.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=bG(this.options.shape),this.getText=null!==(e=SG(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=SG(this.options.fontWeight),this.getTextFontSize=SG(this.options.fontSize),this.getTextFontStyle=SG(this.options.fontStyle),this.getTextFontFamily=SG(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>xG(10,50);break;case"random-light":this.getTextColor=()=>xG(50,90);break;default:this.getTextColor=SG(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 oe(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():wt(e);return oe(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+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:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1: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 MG extends AG{constructor(t){var e;super(j({},MG.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<=MG.defaultOptions.minFontSize&&(this.options.minFontSize=MG.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=kG[this.options.spiral])&&void 0!==e?e:kG.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=SG(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}=yG(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,f,m;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,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,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._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=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(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=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}));if(this.originalData=s,this.data=s,this.progressiveRun(),!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._originSize[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],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});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 f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);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*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(EG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(CG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}EG(p,this._size)&&(p=BG(p,this._size))}else if(EG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||wG(p,i))&&(!i||!TG(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 TG(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 wG(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,EG=(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 BG(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{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const u=n.measureText(h),g="normal"!==o?1.1:1,f=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(u.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},LG=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>ce(t,e,i+r*n)))},RG=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},OG=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=yG(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=bG("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return ce(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)RG(n,LG({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)RG(n,LG({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)RG(n,LG({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)RG(n,LG({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)RG(n,LG({x:l,y:h},o,0,3));else if("star"===t.shape){const t=LG({x:l,y:h},o,-Math.PI/2,5),e=LG({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);RG(n,i)}else n.fillRect(0,0,i,s)}; /*! * wordcloud2.js * http://timdream.org/wordcloud2.js/ @@ -20,4 +20,4 @@ * Copyright 2011 - 2019 Tim Guan-tin Chien and contributors. * Released under the MIT license */ -let wG=class t extends fG{constructor(e){super(j({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{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,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize: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=this.options.createCanvas({width:1,height:1}),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 f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),_=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*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],B=(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--;)B(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}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=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,e=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){this.grid=[];const e=this.options.shape;if(g(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?AG(t,o,l.width,l.height,h):"geometric"===t.type&&TG(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!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)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,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}=dG(this.options.shape,[e.width,e.height]);return 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),this.result=[],this.progressiveRun()}};wG.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class CG extends fG{constructor(t){super(j({},CG.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,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)}CG.defaultOptions={enlarge:!1};const BG={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},PG=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return ot.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?LG(t.fontFamily):"sans-serif",d=t.fontStyle?LG(t.fontStyle):"normal",u=t.fontWeight?LG(t.fontWeight):"normal",p=t.rotate?LG(t.rotate):0,g=LG(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?LG(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?Object.assign(Object.assign({},BG),t.as):BG,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?LG(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=OG(IG(t,l),C);w=i=>e(t(i))}let E=vG;"fast"===t.layoutType?E=CG:"grid"===t.layoutType&&(E=wG);const B=new E(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:w,shrink:_,clip:b,enlarge:y,minFontSize:x,random:A,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:B}:B.output()},LG=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],RG=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),OG=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=RG(t[0]),n=RG(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(RG(t)-r)/(a-r)*(e[1]-e[0])+e[0]},IG=(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 DG(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{zR.registerGrammarTransform("wordcloud",{transform:PG}),TV(),zR.registerAnimation("wordCloud",((t,e)=>({appear:gW(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:ED.disappear.duration}}))),zR.registerSeries(FG.type,FG)},jG=(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:f=!1,isCone:m=!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===f?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?m?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},HG=(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},NG=`${lO}_FUNNEL_TRANSFORM_RATIO`,VG=`${lO}_FUNNEL_REACH_RATIO`,UG=`${lO}_FUNNEL_HEIGHT_RATIO`,WG=`${lO}_FUNNEL_VALUE_RATIO`,GG=`${lO}_FUNNEL_LAST_VALUE_RATIO`,YG=`${lO}_FUNNEL_NEXT_VALUE_RATIO`,$G=`${lO}_FUNNEL_LAST_VALUE`,XG=`${lO}_FUNNEL_CURRENT_VALUE`,KG=`${lO}_FUNNEL_NEXT_VALUE`,qG=`${lO}_FUNNEL_TRANSFORM_LEVEL`;class ZG extends oF{constructor(t){var e,i;super(t),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)?this._transformRatioText: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[VG])).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 this._transformRatioText;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]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class JG extends bD{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class QG extends JG{constructor(){super(...arguments),this.type=QG.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}QG.type="polygon";const tY=()=>{zR.registerMark(QG.type,QG),Jk(),Yk(),pw.registerBuiltInAnimate("growPointsOut",cC),zR.registerGraphicComponent("polygon",cf)},eY=Object.assign(Object.assign({},yF),{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"}});class iY extends IF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class sY extends DF{constructor(){super(...arguments),this.type=iR.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=iY,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,i,s,n;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._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;cI(this._dataSet,"funnel",jG),cI(this._dataSet,"funnelTransform",HG);const t=new Pa(this._dataSet,{name:`${lO}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new fD(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}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:XG,asTransformRatio:NG,asReachRatio:VG,asHeightRatio:UG,asValueRatio:WG,asNextValueRatio:YG,asLastValueRatio:GG,asLastValue:$G,asNextValue:KG,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:qG}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},sY.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:PF(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},sY.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),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(sY.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(sY.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new ZG(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(){var e,i,s,n;const r=this._funnelMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const a=this._funnelTransformMark;a&&this.setMarkStyle(a,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const o=this._funnelOuterLabelMark.label;o&&(this.setMarkStyle(o,{text:t=>`${t[this.getCategoryField()]}`,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),width:0,height:0},"normal",t.AttributeLevel.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(o,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",t.AttributeLevel.User_Mark));const l=this._funnelOuterLabelMark.line;if(l&&o){this.setMarkStyle(l,{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);const r=null!==(s=null===(i=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.line)||void 0===i?void 0:i.visible)&&void 0!==s?s:null===(n=this._spec.outerLabel)||void 0===n?void 0:n.visible;p(r)&&l.setVisible(r)}}initLabelMarkStyle(e){var i;if(!e)return;const s=e.getTarget(),n=e.getComponent();if(s===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);const s=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&jy(s,this._funnelOuterLabelMark.label,n),this._funnelOuterLabelMark.line&&jy(s,this._funnelOuterLabelMark.line,null!==(i=this._funnelOuterLabelMark.label)&&void 0!==i?i:n)}else this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*QL(VG).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(wF(null===(s=zR.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.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),CF("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(wF(zR.getAnimationInKey("fadeInOut")(),CF(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(wF(zR.getAnimationInKey("funnel")({},o),CF(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(wF(null===(a=zR.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),CF("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[GG])/2:this._getSecondaryAxisLength(t[WG])/2,n=this._getSecondaryAxisLength(t[WG])/2):(s=this._getSecondaryAxisLength(t[WG])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[YG])/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[qG])}_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[pO]===t[pO]));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,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,_,y;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h: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!==f.alignLabel?(null==u?void 0:u.y2)+e:_-e,m=this._getPolygonCenter(i).x,_-y{tY(),TV(),FN(),zR.registerSeries(sY.type,sY),zR.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},PD))),zR.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Yw,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),RD()},rY=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},aY=t=>{const e=t.filter((t=>t.context.diffState===UI.update)),i=K(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},oY=(t,e,i)=>{if(P(t))return[e,i];const s=K(t.map((t=>1*t.getFinalAttribute().startAngle))),n=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},lY=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=aY(i.parent.children),a=oY(r,s,n);return rY(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=aY(i.parent.children),a=oY(r,s,n);return rY(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),hY=t=>{const e=K(t.map((t=>1*t.getFinalAttribute().startAngle))),i=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},cY=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=aY(i.parent.children),a=hY(r);return rY(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=aY(i.parent.children),a=hY(r);return rY(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),dY=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},uY=(t,e={})=>{if(!t)return[];const i=[];return _W(t,i,e),i},pY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new YW(i).layout(t,{width:s,height:n})};class gY extends oF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var fY;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(fY||(fY={}));const mY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===fY.DrillDown){return Y(WO(t,n,s,"children"))}if(i.type===fY.DrillUp){const e=GO(t,n,s,"children");if(e)return Y(e)}return t};class vY{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=bN(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;cI(t,"drillFilter",mY),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)||P(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:fY.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:fY.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)||P(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:fY.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:fY.DrillUp},model:this}),r}}const _Y=Object.assign(Object.assign({},yF),{sunburst:{name:"sunburst",type:"arc"}}),yY=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:uF,operations:["max","min","values"]}),t.push({key:pF,operations:["values"]}),t),bY={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,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"}}}};class xY extends NV{constructor(){super(...arguments),this.type=iR.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:pF),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:pO},getRawData:()=>this.getRawData()}),this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(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),cI(this._dataSet,"sunburstLayout",pY),cI(this._dataSet,"flatten",uY),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 yY(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(cI(t.dataSet,"addVChartProperty",tF),t.transform({type:"addVChartProperty",options:{beforeCall:vF.bind(this),call:_F}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(xY.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_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()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(xY.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new gY(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(wF(null===(e=zR.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),CF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(wF(null===(e=zR.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),CF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),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]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}xY.type=iR.sunburst,xY.mark=_Y,xY.builtInTheme={sunburst:bY},G(xY,vY);const SY=()=>{zR.registerSeries(xY.type,xY),QV(),TV(),RD(),zR.registerAnimation("sunburst",((t,e)=>({appear:dY(0,e),enter:lY(t),exit:cY(t),disappear:{duration:ED.disappear.duration}})))},AY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new OW(i).layout(t,{width:s,height:n})};class kY extends oF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const MY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},TY=Object.assign(Object.assign({},yF),{circlePacking:{name:"circlePacking",type:"arc"}});class wY extends jF{constructor(){super(...arguments),this.type=iR.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:pF),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:pO},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),cI(this._dataSet,"circlePackingLayout",AY),cI(this._dataSet,"flatten",uY),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)||(cI(t.dataSet,"addVChartProperty",tF),t.transform({type:"addVChartProperty",options:{beforeCall:vF.bind(this),call:_F}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(wY.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_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},t.STATE_VALUE_ENUM.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(wY.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"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return yY(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new kY(this),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(wF(null===(i=zR.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),CF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(wF(null===(e=zR.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),CF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}wY.type=iR.circlePacking,wY.mark=TY,wY.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,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"}}}}},G(wY,vY);const CY=()=>{zR.registerSeries(wY.type,wY),QV(),TV(),LD(),zR.registerAnimation("circlePacking",((t,e)=>({appear:MY(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:ED.disappear.duration}})))},EY=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&EY(t,e.children,i)}))},BY=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},PY=(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 UW(e),r=[];return r.push(n.layout(s,i)),r},LY=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:[]},RY=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 OY extends oF{constructor(){super(...arguments),this._getDimensionData=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},this.markTooltipValueCallback=t=>t.value}}const IY=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),DY=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:IY(t),FY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class zY extends kw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class jY extends kw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const HY=(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,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=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}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},NY=(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,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=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}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class VY extends oV{constructor(){super(...arguments),this.type=VY.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?NY:HY,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}VY.type="linkPath";const UY=Object.assign(Object.assign({},yF),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class WY extends IF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const GY=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&t.removeState(e),t.addState(e,s,n)};class YY extends jF{constructor(){super(...arguments),this.type=iR.sankey,this.transformerConstructor=WY,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new Ne,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;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(p(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var e,i;if(!this._needClear)return;const s=null===(e=this._nodeMark)||void 0===e?void 0:e.getGraphics();if(!s||!s.length)return;const n=null===(i=this._linkMark)||void 0===i?void 0:i.getGraphics();n&&n.length&&(s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),n.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._needClear=!1)},this._handleNodeAdjacencyClick=e=>{const i=JO(e),s=[i.key];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,n)=>{const r=JO(e);r.source===i.key?(s.includes(r.target)||s.push(r.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):r.target===i.key?(s.includes(r.source)||s.push(r.source),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleLinkAdjacencyClick=e=>{const i=JO(e),s=[i.source,i.target];if(this._linkMark){const i=this._linkMark.getGraphics();if(!i||!i.length)return;i.forEach((i=>{i===e?(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),GY(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1})):(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),i.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleNodeRelatedClick=e=>{var i;const s=JO(e),n=this._nodeMark.getGraphics();if(!n||!n.length)return;const r=this._linkMark.getGraphics();if(!r||!r.length)return;const a=(null===(i=JO(r[0]))||void 0===i?void 0:i.parents)?"parents":"source";if("source"===a){const e=[s.key],i=[];if(r.forEach(((t,r)=>{var a,o,l,h;const c=JO(t),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(s.key)){if(i.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||i.push(null!==(o=c.key)&&void 0!==o?o:c.index),e.includes(c.source)||e.push(c.source),!e.includes(c.target)){e.push(c.target);let t=n.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.target))){e.push(t.target);const i=n.find((e=>e.data[0].key===t.target));s.push(i.data[0].targetLinks)}})),void(t=s)}}}else if(c.target===s.key&&(i.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||i.push(null!==(h=c.key)&&void 0!==h?h:c.index),!e.includes(c.source))){e.push(c.source);let t=n.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.source))){e.push(t.source);const i=n.find((e=>e.data[0].key===t.source));s.push(i.data[0].targetLinks)}})),void(t=s)}}})),this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,s)=>{var n;const r=JO(e);i.includes(null!==(n=r.key)&&void 0!==n?n:r.index)?(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}else{const e=[s.key],i=s.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const i=e.parents,n=i.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);r.forEach(((n,r)=>{const o=JO(n),l=o.datum,h=l?l.filter((t=>t[a].some((t=>t.key===s.key)))):null,c=i.find((t=>t.source===o.source&&t.target===o.target));if(h&&h.length){e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target);const i=h.reduce(((t,e)=>t+e.value),0),s=i/o.value;return n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void GY(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:s})}if(c)return e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target),n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void GY(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:c.value/o.value});n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),n.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}this._needClear=!0},this._handleLinkRelatedClick=e=>{const i=this._nodeMark.getGraphics();if(!i||!i.length)return;const s=this._linkMark.getGraphics();if(!s||!s.length)return;if("source"===(JO(e)?"parents":"source"))this._linkMark&&s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&i.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)}));else{const n=JO(e),r=[n.source,n.target],a=[];Y(n.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));a.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=r:a.push({source:i,target:n,value:r})}})),s.forEach((e=>{const i=JO(e),s=i.datum;if(i.source===n.source&&i.target===n.target)return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void GY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1});const o=s?s.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(n.source)&&e.includes(n.target)})):null;if(o&&o.length){r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target);const s=o.filter((t=>t.parents.some(((e,i)=>{var s;return e.key===n.source&&(null===(s=t.parents[i+1])||void 0===s?void 0:s.key)===n.target})))).reduce(((t,e)=>t+e.value),0),a=s/i.value;return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void GY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:a})}const l=a.find((t=>t.source===i.source&&t.target===i.target));if(l)return r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void GY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:l.value/i.value});e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(i,r)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}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:this._spec.categoryField)}initData(){var e,i,s,n;super.initData();const r=this.getViewData(),a=this.getRawData();if(a&&r){cI(this._dataSet,"sankeyLayout",PY),cI(this._dataSet,"sankeyFormat",BY),a.transform({type:"sankeyFormat"},!1),r.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.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(e=this._spec.nodeAlign)&&void 0!==e?e:"justify",nodeGap:null!==(i=this._spec.nodeGap)&&void 0!==i?i:8,nodeWidth:null!==(s=this._spec.nodeWidth)&&void 0!==s?s:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(n=this._spec.minNodeHeight)&&void 0!==n?n:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,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,inverse:this._spec.inverse},level:t.TransformLevel.sankeyLayout});const{dataSet:o}=this._option;cI(o,"sankeyNodes",LY),cI(o,"flatten",uY);const l=new Pa(o,{name:`sankey-node-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyNodes"}),l.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),l.transform({type:"addVChartProperty",options:{beforeCall:fF.bind(this),call:mF}},!1),this._nodesSeriesData=l,cI(o,"sankeyLinks",RY);const h=new Pa(o,{name:`sankey-link-${this.id}-data`});h.parse([this.getViewData()],{type:"dataview"}),h.transform({type:"sankeyLinks"}),h.transform({type:"addVChartProperty",options:{beforeCall:fF.bind(this),call:mF}},!1),this._linksSeriesData=h}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(YY.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(YY.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,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()}_initNodeMarkStyle(){var e,i;const s=this._nodeMark;s&&(this.setMarkStyle(s,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Mark),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.node.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByNode},"normal",t.AttributeLevel.User_Mark))}_initLinkMarkStyle(){var e,i;const s=this._linkMark;s&&(s.setGlyphConfig({direction:this.direction}),this.setMarkStyle(s,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.link.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByLink},"normal",t.AttributeLevel.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=ZD(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={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;this._nodeMark&&this._nodeMark.setAnimationConfig(wF(null===(i=zR.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),CF("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(wF(null===(s=zR.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),CF("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:rI.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(e,i){e&&e.length&&e.forEach((e=>{e.removeState([t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]),i.includes(JO(e).key)?e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0):e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new OY(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_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&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new fR;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_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 EY(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),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]}getMarkData(t){return t.datum?y(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}YY.type=iR.sankey,YY.transformerConstructor=WY,YY.mark=UY,YY.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const $Y=()=>{WH(),lV(),Wk(),zR.registerGraphicComponent("path",(t=>tf(t))),zR.registerMark(VY.type,VY),TV(),zR.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:DY(t,e)},PD))),zR.registerAnimation("sankeyLinkPath",((t,e)=>({appear:FY(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:ED.disappear.duration}}))),pw.registerBuiltInAnimate("linkPathGrowOut",jY),pw.registerBuiltInAnimate("linkPathGrowIn",zY),RD(),zR.registerSeries(YY.type,YY)},XY=(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=uY(n);return i=hF([{latestData:r}],e),i};class KY extends oF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const qY=Object.assign(Object.assign({},yF),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),ZY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class JY extends IF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const QY=(t,e)=>{if(e.getViewBox()){const i=new qW(e).layout(t,e.getViewBox()),s=[];return _W(i,s,{maxDepth:null==e?void 0:e.maxDepth}),s.forEach(((t,i)=>{t&&[pF,"name"].forEach((i=>{t[i]=t.datum[t.depth][e.nameField]}))})),s}return[]};class t$ extends jF{constructor(){super(...arguments),this.type=iR.treemap,this.transformerConstructor=JY,this._categoryField="name",this._valueField="value",this._viewBox=new Ne,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:pF),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new We),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:pO},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,s,n;super.initData(),cI(this._dataSet,"treemap",QY),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{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}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(cI(this._rawData.dataSet,"addVChartProperty",tF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:vF.bind(this),call:_F}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=XY([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=j(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){cI(this._dataSet,"hierarchyDimensionStatistics",XY),cI(this._dataSet,"flatten",uY);const i=new Pa(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 yY(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(t$.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(t$.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}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()},t.STATE_VALUE_ENUM.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()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRichStyleOfLabelMark(e){"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(wF(null===(e=zR.getAnimationInKey("treemap"))||void 0===e?void 0:e(),CF(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 KY(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(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(eI.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(eI.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}t$.type=iR.treemap,t$.mark=qY,t$.builtInTheme={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"}}}},t$.transformerConstructor=JY,G(t$,vY),G(t$,SN);const e$=()=>{zR.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),zR.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),WH(),TV(),zR.registerAnimation("treemap",((t,e)=>({appear:ZY(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:ED.disappear.duration}}))),RD(),zR.registerSeries(t$.type,t$)},i$=Object.assign(Object.assign({},VU),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),s$=Object.assign(Object.assign({},yF),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),n$={type:"fadeIn"};function r$(t,e){return"fadeIn"===e?n$:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class a$ extends IF{constructor(){super(...arguments),this._supportStack=!1}}class o$ extends oF{enableByType(t){return"dimension"!==t}}const l$="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",h$={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:l$,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:l$,fill:"#ddd"}}};class c$ extends UU{constructor(){super(...arguments),this.type=iR.gaugePointer,this.transformerConstructor=a$,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(c$.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},c$.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(c$.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(){this._tooltipHelper=new o$(this),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=K(e),n=_t(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})}getInteractionTriggers(){return 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(wF(null===(i=zR.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),CF("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}c$.type=iR.gaugePointer,c$.mark=s$,c$.builtInTheme={gaugePointer:h$},c$.transformerConstructor=a$;const d$=()=>{zR.registerSeries(c$.type,c$),fN(),WH(),zR.registerAnimation("gaugePointer",((t,e)=>{const i=r$(t,e);return{appear:i,enter:i,disappear:{duration:ED.disappear.duration}}})),xU(),yU()};class u$ extends IF{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class p$ extends UU{constructor(){super(...arguments),this.type=iR.gauge,this.transformerConstructor=u$,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=oe(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();cI(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[LO]=t[this._angleField[0]],t[PO]=e>0?i[e-1][LO]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(p$.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(p$.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})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e&&"segment"===e.name){const i=this.getSpec().segment;if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}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),s=bt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?_R(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?_R(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return p(t[PO])?this.angleAxisHelper.dataToPosition([t[PO]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[LO]])}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(wF(null===(i=zR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),CF("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}p$.type=iR.gauge,p$.mark=i$,p$.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},p$.transformerConstructor=u$;class g$ extends bD{constructor(){super(...arguments),this.type=g$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Eg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="rect":a.symbolType=o,a}}g$.type="cell";function f$(t){return!1===t?{}:{type:"fadeIn"}}class m$ extends oF{enableByType(t){return"dimension"!==t}}const v$=Object.assign(Object.assign({},yF),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class _$ extends IF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class y$ extends jF{constructor(){super(...arguments),this.type=iR.heatmap,this.transformerConstructor=_$}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(y$.mark.cell,{isSeriesMark:!0},{morph:PF(this._spec,y$.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(y$.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){var e,i,s;t&&this.setMarkStyle(t,{fill:null!==(s=null===(i=null===(e=this._spec.cell)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s: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=ai(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]}}getInteractionTriggers(){return 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=zF(this);this._cellMark.setAnimationConfig(wF(null===(i=zR.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),CF("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 m$(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}y$.type=iR.heatmap,y$.mark=v$,y$.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1},label:{style:{lineWidth:2}}}},y$.transformerConstructor=_$;const b$=()=>{TV(),zR.registerMark(g$.type,g$),zR.registerGraphicComponent("symbol",Eg),Jk(),tM(),kB(),zR.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},PD),{appear:f$(e)}))),bj(),mj(),zR.registerSeries(y$.type,y$)},x$=Object.assign(Object.assign({},yF),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),S$=`${lO}_CORRELATION_X`,A$=`${lO}_CORRELATION_Y`,k$=`${lO}_CORRELATION_SIZE`,M$=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,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=oe(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=oe(null!==(s=e.endAngle)&&void 0!==s?s:270),A=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),k=Lt(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=Lt(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+Lt(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+Lt(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=Pt(e.field),C=t.map(w),[E,B]=Ot(C),P=E===B?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(B-E),L=u(e.radiusField)?w:Pt(e.radiusField),R=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=>R;if(L){const[i,s]=L!==w?Ot(t.map(L)):[E,B],n=null!==(f=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==f?f:5,r=null!==(v=null===(m=e.radiusRange)||void 0===m?void 0:m[1])&&void 0!==v?v:5;i!==s&&(O=t=>n+(r-n)*(L(t)-i)/(s-i))}const I=Math.min(b,x),D=Math.max(b,x),F=T$(I,D,t.length),z=[],j=(D-I)/60;return t.forEach(((t,e)=>{const i=P(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),w$({x:n,y:r,size:s},z)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=j,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},w$=(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,[uO]:null==n?void 0:n[uO],[gO]:null==n?void 0:n[gO]}};class E$ extends oV{constructor(){super(...arguments),this.type=E$.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=_t(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}E$.type="ripple";const B$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class P$ extends IF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class L$ extends NV{constructor(){super(...arguments),this.type=iR.correlation,this.transformerConstructor=P$,this._viewBox=new Ne}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;cI(this._dataSet,"correlation",M$);const s=new Ba;dI(s,"dataview",wa),cI(s,"correlationCenter",C$);const n=new Pa(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 fD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_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(){const e=this._createMark(L$.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:uO});e&&(e.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._nodePointMark=e);const i=this._createMark(L$.mark.ripplePoint,{key:uO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(this._ripplePointMark=i);const s=this._createMark(L$.mark.centerPoint,{key:uO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});s&&(s.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._centerPointMark=s)}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[S$],y:t=>t[A$],size:t=>t[k$],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.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)},t.STATE_VALUE_ENUM.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(wF(null===(e=zR.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),CF("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(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}L$.type=iR.correlation,L$.mark=x$,L$.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},L$.transformerConstructor=P$;const R$=()=>{dz(),lV(),tM(),zR.registerMark(E$.type,E$),zR.registerGraphicComponent("symbol",(t=>Eg(t))),zR.registerSeries(L$.type,L$),zR.registerAnimation("correlation",((t,e)=>Object.assign({appear:B$(0,e)},BD)))},O$=Object.assign(Object.assign({},yF),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class I$ extends oV{constructor(){super(...arguments),this.type=I$.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}I$.type="liquid";const D$=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class F$ extends oF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class z$ extends DF{constructor(){super(...arguments),this.type=iR.liquid,this.transformerConstructor=uz,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Dg({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Eg({x:s,y:n,size:r,symbolType:D$(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=wR(this._spec.outlineMargin),this._paddingSpec=wR(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Yt(...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(z$.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(z$.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(z$.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(z$.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.created(),this.setMarkStyle(e,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new F$(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(wF(null===(i=zR.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),CF("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(wF(null===(s=zR.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),CF("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=kM(t.attribute.fill,n.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]}}z$.type=iR.liquid,z$.mark=O$,z$.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},z$.transformerConstructor=uz;const j$=t=>Y(t).join(",");class H$ extends oF{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>j$(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>j$(null==t?void 0:t[this.series.getDimensionField()[0]])}}const N$=Object.assign(Object.assign({},yF),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class V$ extends IF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const U$=(t,e)=>{const i=e.getViewBox();return i&&(null==t?void 0:t.length)?lG(Object.assign({setField:e.setField,valueField:e.valueField},i),t):[]};class W$ extends DF{constructor(){super(...arguments),this.type=iR.venn,this.transformerConstructor=V$,this._viewBox=new Ne}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:pO)}initData(){var t;super.initData(),cI(this._dataSet,"venn",U$),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:{getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField}})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(W$.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(W$.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()},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},t.STATE_VALUE_ENUM.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=>j$(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)}},t.STATE_VALUE_ENUM.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=>j$(t.sets)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new H$(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(){super.onLayoutEnd(),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:j$(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return j$(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[j$(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(j$(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(wF(null===(e=zR.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),CF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(wF(null===(e=zR.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),CF(t.name,this._spec,this._markAttributeContext)))}))}}W$.type=iR.venn,W$.mark=N$,W$.builtInTheme={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"}}}}},W$.transformerConstructor=V$;class G$ extends KH{constructor(){super(...arguments),this.type=iR.mosaic,this.transformerConstructor=XH}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(CO),this.setFieldX2(wO)),this.setFieldY(BO),this.setFieldY2(EO)):(t&&(this.setFieldY(CO),this.setFieldY2(wO)),this.setFieldX(BO),this.setFieldX2(EO)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&u(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];u(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}G$.type=iR.mosaic,G$.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},G$.transformerConstructor=XH;class Y$ extends Uj{_isValidSeries(t){return t===iR.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class $$ extends Nj{constructor(){super(...arguments),this.transformerConstructor=Y$,this.type="map",this.seriesType=iR.map}}$$.type="map",$$.seriesType=iR.map,$$.transformerConstructor=Y$;class X$ extends Uj{_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,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],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 K$ extends X${needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_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=kz(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,FR({},s,l)),n&&Object.assign(o,FR({},n,o))}}class q$ extends X${needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}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 Z$ extends X${needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class J$ extends Nj{constructor(){super(...arguments),this.transformerConstructor=Z$}}J$.transformerConstructor=Z$;class Q$ extends J${constructor(){super(...arguments),this.transformerConstructor=Z$,this.type="pie",this.seriesType=iR.pie}}Q$.type="pie",Q$.seriesType=iR.pie,Q$.transformerConstructor=Z$;class tX extends q${_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return n.radius=null!==(e=t.radius)&&void 0!==e?e:Hz,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:Hz,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}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=>FR({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const eX=(t,e)=>{if(!t)return null;const i=QF(t,(t=>"angle"===t.getOrient()),e),s=QF(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&UC(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=$L({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=K(e),n=X(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=XL(d),f=null===(e=s[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 _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=ZF(v,t,"polar",r);n.push({index:_,value:v,position:i.scale(v),axis:t,data:y})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&UC(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=$L({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=XL(c),g=null===(e=i[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=s.invert(p);if(u(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const _=ZF(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:_})}})),n.length?n:null};class iX extends Nj{constructor(){super(...arguments),this.transformerConstructor=tX,this.type="rose",this.seriesType=iR.rose}_setModelOption(){this._modelOption.getDimensionInfo=eX}}iX.type="rose",iX.seriesType=iR.rose,iX.transformerConstructor=tX,G(iX,Xj);class sX extends q${_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t);return i.line=t.line,i.point=t.point,i.stack=t.stack,i.percent=t.percent,i.area=FR({visible:!1},t.area),i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"area",i.activePoint=t.activePoint,i.pointDis=t.pointDis,i.pointDisMul=t.pointDisMul,i.markOverlap=t.markOverlap,i}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=>FR({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class nX extends Nj{constructor(){super(...arguments),this.transformerConstructor=sX,this.type="radar",this.seriesType=iR.radar}_setModelOption(){this._modelOption.getDimensionInfo=eX}}nX.type="radar",nX.seriesType=iR.radar,nX.transformerConstructor=sX,G(nX,Xj);class rX extends Uj{_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=>{L(e,"trimPadding")&&FR(e,jI(this.type,t))})),this._transformAxisSpec(t)}}class aX extends Nj{constructor(){super(...arguments),this.transformerConstructor=rX,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=nH(t,e,i))&&void 0!==s?s:[],...null!==(n=eX(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=aH,this._modelOption.getRectByDimensionData=uH}}aX.type="common",aX.transformerConstructor=rX,G(aX,Xj);class oX extends Wj{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class lX extends Nj{constructor(){super(...arguments),this.transformerConstructor=oX}}lX.transformerConstructor=oX,G(lX,Xj);class hX extends oX{transformSpec(t){super.transformSpec(t),DI(t)}}class cX extends lX{constructor(){super(...arguments),this.transformerConstructor=hX,this.type="histogram",this.seriesType=iR.bar}_setModelOption(){this._modelOption.getDimensionInfo=nH,this._modelOption.getDimensionInfoByValue=aH,this._modelOption.getRectByDimensionData=uH}}cX.type="histogram",cX.seriesType=iR.bar,cX.transformerConstructor=hX;class dX extends K${_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class uX extends Nj{constructor(){super(...arguments),this.transformerConstructor=dX,this.type="circularProgress",this.seriesType=iR.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=eX}}uX.type="circularProgress",uX.seriesType=iR.circularProgress,uX.transformerConstructor=dX,G(uX,Xj);class pX extends K${_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=iR.circularProgress,e}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===iR.gauge||t.type===iR.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===iR.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 gX extends Nj{constructor(){super(...arguments),this.transformerConstructor=pX,this.type="gauge",this.seriesType=iR.gaugePointer}}gX.type="gauge",gX.seriesType=iR.gaugePointer,gX.transformerConstructor=pX;class fX extends Uj{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class mX extends Nj{constructor(){super(...arguments),this.transformerConstructor=fX,this.type="wordCloud",this.seriesType=iR.wordCloud}}mX.transformerConstructor=fX;class vX extends mX{constructor(){super(...arguments),this.transformerConstructor=fX,this.type="wordCloud",this.seriesType=iR.wordCloud}}vX.type="wordCloud",vX.seriesType=iR.wordCloud,vX.transformerConstructor=fX;class _X extends Uj{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class yX extends Nj{constructor(){super(...arguments),this.transformerConstructor=_X,this.type="funnel",this.seriesType=iR.funnel}}yX.type="funnel",yX.seriesType=iR.funnel,yX.transformerConstructor=_X;class bX extends Wj{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}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=kz(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=kz(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class xX extends Nj{constructor(){super(...arguments),this.transformerConstructor=bX,this.type="linearProgress",this.seriesType=iR.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=nH,this._modelOption.getDimensionInfoByValue=aH,this._modelOption.getRectByDimensionData=uH}}xX.type="linearProgress",xX.seriesType=iR.linearProgress,xX.transformerConstructor=bX,G(xX,Xj);class SX extends Wj{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"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),DI(t)}}class AX extends Nj{constructor(){super(...arguments),this.transformerConstructor=SX,this.type="rangeColumn",this.seriesType=iR.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=nH,this._modelOption.getDimensionInfoByValue=aH,this._modelOption.getRectByDimensionData=uH}}AX.type="rangeColumn",AX.seriesType=iR.rangeColumn,AX.transformerConstructor=SX;class kX extends Uj{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+le(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class MX extends Nj{constructor(){super(...arguments),this.transformerConstructor=kX,this.type="sunburst",this.seriesType=iR.sunburst}}MX.type="sunburst",MX.seriesType=iR.sunburst,MX.transformerConstructor=kX;class TX extends Uj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class wX extends Nj{constructor(){super(...arguments),this.transformerConstructor=TX,this.type="circlePacking",this.seriesType=iR.circlePacking}}wX.type="circlePacking",wX.seriesType=iR.circlePacking,wX.transformerConstructor=TX;class CX extends Uj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class EX extends Nj{constructor(){super(...arguments),this.transformerConstructor=CX,this.type="treemap",this.seriesType=iR.treemap}}EX.type="treemap",EX.seriesType=iR.treemap,EX.transformerConstructor=CX;class BX extends ZH{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),DI(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class PX extends JH{constructor(){super(...arguments),this.transformerConstructor=BX,this.type="waterfall",this.seriesType=iR.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=nH,this._modelOption.getDimensionInfoByValue=aH,this._modelOption.getRectByDimensionData=uH}}PX.type="waterfall",PX.seriesType=iR.waterfall,PX.transformerConstructor=BX;class LX extends Wj{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),DI(t)}}class RX extends Nj{constructor(){super(...arguments),this.transformerConstructor=LX,this.type="boxPlot",this.seriesType=iR.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=nH,this._modelOption.getDimensionInfoByValue=aH,this._modelOption.getRectByDimensionData=uH}}RX.type="boxPlot",RX.seriesType=iR.boxPlot,RX.transformerConstructor=LX;class OX extends Uj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class IX extends Nj{constructor(){super(...arguments),this.transformerConstructor=OX,this.type="sankey",this.seriesType=iR.sankey}_setStateInDatum(t,e,i,s){const n=y(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=JO(t))||void 0===e?void 0:e.datum;return y(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}IX.type="sankey",IX.seriesType=iR.sankey,IX.transformerConstructor=OX;class DX extends Wj{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.area=t.area,s.point=t.point,s.line=t.line,"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),DI(t)}}class FX extends Nj{constructor(){super(...arguments),this.transformerConstructor=DX,this.type="rangeArea",this.seriesType=iR.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=nH,this._modelOption.getDimensionInfoByValue=aH,this._modelOption.getRectByDimensionData=uH}}FX.type="rangeArea",FX.seriesType=iR.rangeArea,FX.transformerConstructor=DX;class zX extends Wj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class jX extends Nj{constructor(){super(...arguments),this.transformerConstructor=zX,this.type="heatmap",this.seriesType=iR.heatmap}}jX.type="heatmap",jX.seriesType=iR.heatmap,jX.transformerConstructor=zX;class HX extends Uj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class NX extends Nj{constructor(){super(...arguments),this.transformerConstructor=HX,this.type="correlation",this.seriesType=iR.correlation}}NX.type="correlation",NX.seriesType=iR.correlation,NX.transformerConstructor=HX;function VX(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=qO(t.style)),P(t.textStyle)||FR(s.textStyle,qO(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&qO(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&qO(s.background.style),s}const UX=(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},WX=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const u={};c.forEach((t=>{u[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:gO;return h?h(t,c,g):(y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===u[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===u[t.source]&&!0===u[t.target])))):p(g)&&(t=t.filter((t=>!0===u[r.getSeriesFieldValue(t,g)]))),t)};class GX extends Yz{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:()=>{qL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),qL(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=xR(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()}_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):(U(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new fD(this._option,e),this._initSelectedData(),qL(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(qL(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)U(s,this._cacheAttrs)||this._legendComponent.setAttributes(FR({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(FR({},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;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());U(t,this._cacheAttrs)||this._legendComponent.setAttributes(FR({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}GX.specKey="legends";class YX extends GX{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return JD(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),qL(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){cI(this._option.dataSet,"discreteLegendFilter",WX),cI(this._option.dataSet,"discreteLegendDataMake",UX);const t=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return qL(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(!Jy(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=FO(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 s=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:n={},item:r={},pager:a={},background:o={}}=t;n=I(n),r=I(r),a=I(a),o=I(o);const l=s;return n.visible?l.title=VX(n):l.title={visible:!1},P(r.focusIconStyle)||qO(r.focusIconStyle),r.shape&&(r.shape=$O(r.shape)),r.label&&(r.label=$O(r.label)),r.value&&(r.value=$O(r.value)),r.background&&(r.background=$O(r.background)),SR(r.maxWidth)&&(r.maxWidth=Number(r.maxWidth.substring(0,r.maxWidth.length-1))*i.width/100),SR(r.width)&&(r.width=Number(r.width.substring(0,r.width.length-1))*i.width/100),SR(r.height)&&(r.height=Number(r.height.substring(0,r.height.length-1))*i.width/100),l.item=r,"scrollbar"===a.type?(P(a.railStyle)||qO(a.railStyle),P(a.sliderStyle)||qO(a.sliderStyle)):(P(a.textStyle)||qO(a.textStyle),a.handler&&$O(a.handler)),l.pager=a,o.visible&&!P(o.style)&&(FR(l,o.style),p(o.padding)&&(l.padding=o.padding)),l}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return nL}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(ZP.legendItemClick,(i=>{const s=L(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(ZP.legendItemHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(ZP.legendItemUnHover,(e=>{const i=L(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}=ZD(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=ZD(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}YX.specKey="legends",YX.builtInTheme={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}},YX.type=r.discreteLegend;const $X=(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[]},XX=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=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(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?YO(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};const KX={color:hL,size:dL},qX={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}},ZX=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},qX),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},JX={horizontal:ZX(!0),vertical:ZX(!1)},QX=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},qX),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},tK={horizontal:QX(!0),vertical:QX(!1)},eK=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],iK=[2,10];class sK extends GX{static getSpecInfo(t){const e=JD(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}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(e){super.init(e),qL(this._regions,(e=>{e.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:e.isHierarchyData,customFilter:this._spec.customFilter},level:t.TransformLevel.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(){cI(this._option.dataSet,"continuousLegendFilter",XX),cI(this._option.dataSet,"continuousLegendDataMake",$X);const t=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>ZL(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=FO(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!Jy(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=FO(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()),P(a)&&(a="color"===this._legendType?eK:iK);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=FR({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:d={},type:u,id:g,visible:f,orient:m,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=VX(s):w.title={visible:!1},w.showHandler=!1!==n.visible,P(n.style)||(w.handlerStyle=qO(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),P(r.style)||(w.railStyle=qO(r.style)),P(a.style)||(w.trackStyle=qO(a.style)),w.startText=$O(o),w.endText=$O(l),w.handlerText=$O(h),P(c)||(w.sizeBackground=qO(c)),d.visible&&!P(d.style)&&(FR(w,d.style),p(d.padding)&&(w.padding=d.padding)),w}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return KX[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",St((i=>{const s=L(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}sK.specKey="legends",sK.builtInTheme={colorLegend:JX,sizeLegend:tK},sK.type=r.continuousLegend;const nK=(t,e)=>p(e)?t.map((t=>e[t])):void 0,rK=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),aK=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function oK(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),d=i.getOption(),g=d.getRegionsInUserIdOrIndex(p(c.regionId)?[c.regionId]:void 0,p(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=lK(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),_=g.getLayoutRect(),y=d.globalInstance.getContainer(),b=Object.assign({x:0,y:0},y?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(y):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>rK(i,s)(t)&&rK(n,r)(t)&&(u(a)||rK([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),A=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),_.width),y:Math.min(Math.max(t.y,0),_.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.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 l=[{value:t[e.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=>x(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=d.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:nI.chart,event:A({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=d.globalInstance;return YD.globalConfig.uniqueTooltip&&YD.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=d.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:nI.chart,event:A(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=d.globalInstance;return YD.globalConfig.uniqueTooltip&&YD.hideTooltip(a.id),m}return"none"}const lK=(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(),f=p(g)?t[g]:void 0,m=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=nK(c,t);let _=nK(d,t);const y=aK(_),b=!y&&p(g)&&u(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(rK(c,v));if(!y&&(_=nK(d,i),!aK(_)))return;const n=e.type===iR.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:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=UC(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(rK(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=nK(d,o),!aK(_))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(rK(c,n));if(!y&&(_=nK(d,r),!aK(_)))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:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===iR.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(rK(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(_=nK(d,i),!aK(_))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&&(()=>{var i,n,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(rK(c,v));const o=e.getNameMap(),l=null===(r=null===(n=e.getMapViewData)||void 0===n?void 0:n.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=_;if(l&&!a&&(a=Object.assign({},t)),!y){if(_=nK(d,a),h=_,!aK(_)&&!a)return;aK(_)||(_=[null])}const p=e.dataToPosition(a);u(p)||isNaN(p.x)||isNaN(p.y)||s.push({pos:p,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:h,hasMeasureData:y,groupField:g,groupData:f,originDatum:a},series:e})})()})),s},hK=t=>p(t)&&!y(t),cK=t=>p(t)&&y(t);class dK extends Gz{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i,s,n;const{spec:r,theme:a}=super._initTheme(t,e);return r.style=FR({},this._theme,r.style),r.offset=FR({},a.offset,t.offset),r.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:a.transitionDuration,r.trigger=null!==(s=t.trigger)&&void 0!==s?s:a.trigger,r.triggerOff=null!==(n=t.triggerOff)&&void 0!==n?n:a.triggerOff,{spec:r,theme:a}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(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]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:Xy(this._option.mode)||!Yy(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.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?_(t.parentElement)&&(t.parentElement=k_.getElementById(t.parentElement)):Yy(this._option.mode)&&(t.parentElement=null==Gy?void 0:Gy.body)}}const uK={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}};class pK extends Yz{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=dK,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=Yy(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&hK(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!u(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&YD.globalConfig.uniqueTooltip&&l&&YD.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;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;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:nI.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(null==r?void 0:r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:nI.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),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,this._enterable=!1;else{const t="canvas"===s?mH.canvas:mH.dom,n=zR.getComponentPluginInType(t);n||Vy("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,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=zR.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=Y(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),($y(s)||Xy(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,At(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===s||s.call(i)}else 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=oK(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_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(cK(t)){if(hK(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>KF(t,e[i])))}if(cK(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.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: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}getVisible(){return!1!==this._spec.visible}}pK.type=r.tooltip,pK.transformerConstructor=dK,pK.builtInTheme={tooltip:uK},pK.specKey="tooltip";var gK,fK;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(gK||(gK={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(fK||(fK={}));const mK={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class vK extends Yz{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=At((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},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.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{UC(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_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}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(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(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:rI.chart}:{source:nI.chart};y(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,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)}onBeforeRender(){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"}:$y(e)||Xy(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:nI.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:nI.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:nI.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=L(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{mK[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=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const u=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+u.left),o=Math.min(o,i-d+u.top),l=Math.max(l,e+t.getLayoutRect().width-c-u.right),h=Math.max(h,i+t.getLayoutRect().height-d-u.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_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)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_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 i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=L(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=L(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:d}=n,u=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:L(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{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||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}vK.specKey="crosshair";const _K={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}}}}};class yK extends vK{static getSpecInfo(t){return JD(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_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)}}_getDatumAtPoint(t,e){const i=HF(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){HF(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:NF(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();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 o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=JL(this._regions,"cartesian");e&&(oH(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=cH(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new lT(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new hT(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}yK.specKey="crosshair",yK.builtInTheme={crosshair:_K},yK.type=r.cartesianCrosshair;class bK extends vK{static getSpecInfo(t){return JD(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_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)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_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}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=JL(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&p(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=Az(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=ZD(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:ce(d,a.getInnerRadius(),o),end:ce(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=ue(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=ce(t,o,r),d=ce(t,o,h),m=_e([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=_t(ae.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new lT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new dT(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new uT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new cT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=pe(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}}(u):function(t){let e="center",i="middle";return e=(t=pe(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}}(g.startAngle),a="angle"===l?ce(e,p[1]+m.offset,u):ce(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}bK.specKey="crosshair",bK.builtInTheme={crosshair:_K},bK.type=r.polarCrosshair;const xK=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(u(o)||u(a))return t;const l=r(),h=y(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},SK=(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=>{let e=!1;return Y(r).every((i=>{t[i]>=a[0]&&t[i]<=$(a)&&(e=!0)})),e}:t=>{let e=!1;return Y(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},AK=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],d=[],g=[];let f=!1,m=!1;n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);p(null==t?void 0:t.max)&&p(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{u(h[t])&&(g.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(h[t[i]])&&(g.push(t[i]),h[t[i]]=0,c.push(t[i])),u(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const v=f?g:!1===r||m?g.sort(((t,e)=>t-e)):c;return v.forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),d.push(e)})),d},kK=(t,e,i)=>{const s=e.domain();if(NC(e.type))return i?s[0]+($(s)-s[0])*(1-t):s[0]+($(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+($(n)-n[0])*t;return e.invert(r)},MK=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&NC(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/($(n)-n[0])))},TK=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},wK=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}},CK=(t,e,i)=>"start"===t?"percent"===e&&p(i.start)||"value"===e&&p(i.startValue):"percent"===e&&p(i.end)||"value"===e&&p(i.endValue),EK=(t,e,i)=>{if(NC(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class BK{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})}constructor(t,e,i,s,n,r,a,o){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.initZoomEvent=()=>{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,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),d=Math.abs(this.getState().start-this.getState().end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=_t(this.getState().start+f,0,1),_=_t(this.getState().end-m,0,1);this._handleChange(Math.min(v,_),Math.max(v,_),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Ut(s/n)>=.5:Ut(n/s)>=.5;if(this._scrollAttr.reverse||(r=-r),a){const t=this._spec.scrollStep;if(k(t)){r=(r>0?1:-1)*(t*(this.getState().end-this.getState().start)/1)}this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1)}const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))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.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===WF(UF(e))}setEventAttrFromSpec(){!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=j({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=j({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=j({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,c(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&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.getEvent(),this._option.mode)}}G(BK,SN);class PK extends Yz{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:MK(t,this._stateScale,this._isHorizontal),a="percent"===n?e:MK(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var e;this._dataFilterEvent.initZoomEvent(),null===(e=this._relatedAxisComponent)||void 0===e||e.event.on(t.ChartEvent.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_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)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=TK(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[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._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._currentDataCollection=[],this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=EK(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!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&&wK(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({value:"force"})}else qL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),qL(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=UF(t),this._isHorizontal="horizontal"===WF(this._orient),this._dataFilterEvent=new BK(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){this._handleDataCollectionChangeBound=this._handleDataCollectionChange.bind(this),super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(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])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(NC(n.type)){const r=n.domain(),a=r[0],o=$(r)-a,l=p(t)?a+o*t:+e,h=p(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=p(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=p(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}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}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_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=>WF(t._orient)===WF(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!NC(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;}_collectDataInfo(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};qL(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l,u=NC(d.getScale(0).type),p=NC(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?Y(g.xField):Y(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?Y(g.yField):Y(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:d===l?f:m;u&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else qL(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});return{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}}_initData(){const{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}=this._collectDataInfo(),{dataSet:r}=this._option;dI(r,"dataview",wa),cI(r,"dataFilterComputeDomain",AK);const a=new Pa(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new fD(this._option,a),a.reRunAllTransform(),this._currentDataCollection=t,r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChangeBound)}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(cI(this._option.dataSet,"dataFilterWithNewDomain",SK),cI(this._option.dataSet,"lockStatisticsFilter",xK),qL(this._regions,(e=>{e.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>e.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>NC(this._stateScale.type)},level:1},!1),e.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>NC(this._stateScale.type)},level:t.TransformLevel.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r}=this._collectDataInfo();if(this._currentDataCollection.length!==e.length||this._currentDataCollection.some(((t,i)=>t!==e[i]))){this._currentDataCollection.forEach((t=>{var e;null===(e=null==t?void 0:t.target)||void 0===e||e.removeListener("change",this._handleDataCollectionChangeBound)})),this._currentDataCollection=e;const{dataSet:t}=this._option;t.multipleDataViewAddListener(this._currentDataCollection,"change",this._handleDataCollectionChangeBound)}this._data.getDataView().transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data.getDataView().reRunAllTransform();const a=this._computeDomainOfStateScale(NC(this._stateScale.type));this._stateScale.domain(a,!1),(p(this._spec.start)||p(this._spec.end))&&this._setStateFromSpec(),this._handleChange(this._start,this._end,!0),this._spec.auto&&!U(this._domainCache,a)&&(this._domainCache=a,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;CK("start",i,this._spec)&&CK("end",s,this._spec)&&(t="percent"===i?this._spec.start:MK(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:MK(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?MK(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?MK(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=kK(this._start,this._stateScale,TK(i,this._isHorizontal)),this._endValue=kK(this._end,this._stateScale,TK(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,NC(this._stateScale.type)&&this._stateScale.domain()[0]!==$(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=EK(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&qL(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);k(null==i?void 0:i.min)&&k(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new PE:new cE,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_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?[K(t),X(t)]:[-1/0,1/0]}return e}_autoVisible(e){if(!this._auto)return;e?this.show():this.hide();const i=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[i]:e?this[`_${i}`]:0},{[i]:t.AttributeLevel.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_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=wK(h);if(!this._dataUpdating&&UC(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,UC(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),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}G(PK,SN);class LK extends Gz{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=FR({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}}}const RK=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),OK={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:RK(!1),startHandler:{style:{symbolType:"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;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"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;",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:RK(!0)};class IK extends PK{constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=LK,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=this._isHorizontal?0:this._middleHandlerSize,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=this._isHorizontal?0:this._middleHandlerSize,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._getPreviewStateScale(),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._getPreviewStateScale(),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"}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange)if(s&&this._component)this._component.setStartAndEnd(e,i);else{const s=this._relatedAxisComponent,r=kK(e,this._stateScale,TK(s,this._isHorizontal)),a=kK(i,this._stateScale,TK(s,this._isHorizontal));if(!p(r)||!p(a))return;this._start=e,this._end=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(){this._data.getDataView().reRunAllTransform();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new PE),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(TK(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=TK(t,this._isHorizontal),this.effect.onZoomChange())}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,d=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+d,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+d),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);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(),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=isNaN(c)?this._backgroundSize:c-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=isNaN(c)?this._backgroundSize:c-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,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new PE;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(TK(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[K(e),X(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!NC(t.type)||e[0]!==$(e))&&(!UC(t.type)||1!==(i=e,i&&y(i)?Array.from(new Set(Y(i))):i).length);var i}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_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:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_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._computeWidth(),height:this._computeHeight()},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,isReverse:TK(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=this._isHorizontal?this._stateScale:this._valueScale,i=this._isHorizontal?this._valueScale:this._stateScale,s=this._isScaleValid(e)&&this._isScaleValid(i)&&!1!==this._spec.showBackgroundChart,n=this._getAttrs(s),r=this._relatedAxisComponent;if(this._component)this._component.setAttributes(n),t&&(this._component.setPreviewData(this._data.getDataView().latestData),s&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>kK(t,this._stateScale,TK(r,this._isHorizontal))))));else{const t=this.getContainer();this._component=new JB(n),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?s&&this._component.setPreviewPointsY1(this._dataToPositionY2):s&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>kK(t,this._stateScale,TK(r,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:qO(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:qO(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:qO(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:qO(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:qO(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:qO(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:qO(g.style)},selectedBackgroundStyle:qO(this._spec.selectedBackground.style),dragMaskStyle:qO(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:FR(qO(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},qO(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:FR(qO(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},qO(null===(d=m.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}=ZD(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(TK(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}}IK.type=r.dataZoom,IK.transformerConstructor=LK,IK.builtInTheme={dataZoom:OK},IK.specKey="dataZoom";const DK={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}};class FK extends PK{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"}_handleChange(e,i,s){super._handleChange(e,i,s);const n=NL(this._start,e)&&NL(this._end,i);if(this._shouldChange&&(!n||!1===this._spec.realTime)){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=kK(e,this._stateScale,!1),r=kK(i,this._stateScale,!1);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,n,r):this._handleStateChange(n,r))&&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(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r,a;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,minSliderSize:null===(a=this._spec)||void 0===a?void 0:a.minSliderSize},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new pM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=qO(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=qO(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}FK.type=r.scrollBar,FK.builtInTheme={scrollBar:DK},FK.specKey="scrollBar";const zK=(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},jK=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),HK={title:{visible:!0,autoLimit:!1,autoFit:!1,style:jK("l1FontSize","primaryFontColor")},content:{visible:!0,style:jK("l2FontSize","tertiaryFontColor")}};class NK extends Yz{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){return JD(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}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))}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(JO(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(JO(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){cI(this._option.dataSet,"indicatorFilter",zK);const t=new Pa(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 fD(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:i,height:s}=t.getLayoutRect(),{x:n,y:r}=t.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,u=e(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return Y(o).forEach((t=>{const e=FR({},this._theme.content,t);g.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({},KO(H(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?ER(l,this._computeLayoutRadius()):0,dy:h?ER(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!p(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},KO(H(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},u)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)U(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new gL(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_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.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}NK.type=r.indicator,NK.builtInTheme={indicator:HK},NK.specKey="indicator";const VK=["sum","average","min","max","variance","standardDeviation","median"];function UK(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=K(s),r=X(s);return er}function WK(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&UK(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=SR(t.x)?XK(t.x,n)+r.x:KK(l.getXAxisHelper(),[t.x])+r.x,h}function GK(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&UK(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=SR(t.y)?XK(t.y,n)+r.y:KK(l.getYAxisHelper(),[t.y])+r.y,h}function YK(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&UK(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)),KK(a.angleAxisHelper,[t.angle])}function $K(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&UK(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)),KK(a.radiusAxisHelper,[t.radius])}function XK(t,e){return Number(t.substring(0,t.length-1))*e/100}function KK(t,e){const i=t.getScale(0);return NC(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function qK(t){return VK.includes(t)}function ZK(t,e,i,s,n,r=!1){const a=e.getRegion(),o=a.getLayoutStartPoint(),l=i.getRegion(),h=l.getLayoutStartPoint(),c=Math.abs(Math.min(o.x,h.x)-Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width)),d=Math.abs(Math.min(o.y,h.y)-Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height)),u={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},g=[],f=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper(),v=s.getYAxisHelper(),_=m.getScale(0).domain(),y=v.getScale(0).domain(),b=r&&!m.isContinuous&&!!m.getBandwidth,x=r&&!v.isContinuous&&!!v.getBandwidth,S={min:null,max:null},A={min:null,max:null};return f.forEach((t=>{const e=p(t.x),i=p(t.y);let s,r;if(e&&i)s=WK(t,_,n,u,c,o),r=GK(t,y,n,u,d,o),JK(s,b,S,g.length),JK(r,x,A,g.length),g.push([{x:s,y:r}]);else if(e){s=WK(t,_,n,u,c,o),r=Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height);const e=Math.min(o.y,h.y);JK(s,b,S,g.length),g.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(o.x,h.x),r=GK(t,y,n,u,d,o);const e=Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width);JK(r,x,A,g.length),g.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(g,m,v,S,A),g}function JK(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=YK(t,l,n,r),i=$K(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=YK(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=$K(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function tq(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:f}=u.getLayoutRect();let m=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(m=SR(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=SR(i)?Number(i.substring(0,i.length-1))*f/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])&&UK(_,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])&&UK(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:KK(d.getXAxisHelper(),b)+p.x+m,y:KK(d.getYAxisHelper(),x)+p.y+v})})),n}function eq(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])&&UK(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])&&UK(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:KK(l.angleAxisHelper,d),radius:KK(l.radiusAxisHelper,u)})})),s}function iq(t,e,i){let{x:s,y:n}=t;return SR(s)&&(s=XK(s,e)),SR(n)&&(n=XK(n,i)),{x:s,y:n}}function sq(t,e,i){let s;if(s=d(t)?Y(t(e.getData().getLatestData(),e)):Y(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=iq(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>iq(t,n,r)))}function nq(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 rq(t,i,s){const{labelBackground:n={},style:r,shape:a}=t,o=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},qO(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},oq(qO(n.style),i,s)),p(n.padding)&&(t.padding=ai(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=oq(qO(r),i,s)),t}return{visible:!1}}function aq(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function oq(t,e,i){return d(t)?t(e,i):t}function lq(t,e){return d(t)?t(e):t}function hq(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 cq(t){return{isXProcess:p(t.x),isYProcess:p(t.y),isX1Process:p(t.x1),isY1Process:p(t.y1),isAngleProcess:p(t.angle),isRadiusProcess:p(t.radius),isAngle1Process:p(t.angle1),isRadius1Process:p(t.radius1),isCoordinatesProcess:p(t.coordinates),isValidProcess:p(t.process)}}function dq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=cq(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:h&&(!c||"process"in t&&"xy"in t.process)}}function uq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=cq(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function pq(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function gq(t,i){let s;if(i.coordinates){const t=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=t,o=e(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(d(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=Y(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;p(r)&&(c=Y(i)[r]),n&&Y(i).includes(n)&&(c=n);let d=s;p(l)&&(d=Y(s)[l]),a&&Y(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),_(t[c])&&qK(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),_(t[d])&&qK(t[d])?h.y={field:d,aggrType:t[d]}:h.y=Y(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;p(r)&&(a=Y(s)[r]),n&&Y(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),_(t[a])&&qK(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),_(t[l])&&qK(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=Y(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const s=e.x;y(s)?i.x=s.map((i=>mq(i,t,e))):i.x=mq(s,t,e)}if(p(e.y)){const s=e.y;y(s)?i.y=s.map((i=>mq(i,t,e))):i.y=mq(s,t,e)}if(p(e.angle)){const s=e.angle;y(s)?i.angle=s.map((i=>mq(i,t,e))):i.angle=mq(s,t,e)}if(p(e.radius)){const s=e.radius;y(s)?i.radius=s.map((i=>mq(i,t,e))):i.radius=mq(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=mq(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const fq={min:(t,e)=>VL(t[0].latestData,e.field),max:(t,e)=>UL(t[0].latestData,e.field),sum:function(t,e){return WL(t[0].latestData,e.field)},average:function(t,e){return GL(t[0].latestData,e.field)},variance:function(t,e){return YL(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(YL(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return dt(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function mq(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(m(t)){const{aggrType:i,field:s}=t;return fq[i](e,{field:s})}return t}function vq(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 _q extends Yz{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){return JD(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_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)&&qK(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){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Ba;return e.registerParser("array",s),new Pa(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)))}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=JL(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){u(this._spec.offsetX)||(this._layoutOffsetX=kR(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=kR(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();cI(this._option.dataSet,"markerAggregation",gq),cI(this._option.dataSet,"markerFilter",vq);const i=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),i.target.on("change",(()=>{this._markerLayout()})),this._markerData=i}}function yq(t,e){return function(t,e,i){const{predict:s}=Ft(t,(t=>t[e]),(t=>t[i])),n=VL(t,e),r=UL(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class bq extends _q{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}=dq(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;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={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},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:oq(qO(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>rq(t,this._markerData,this._markAttributeContext))),state:{line:aq(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:aq(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:aq(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return aq(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return aq(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:oq(qO(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:oq(qO(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||Y(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=nq([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=Y(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,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}=dq(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;cI(this._option.dataSet,"markerAggregation",gq),cI(this._option.dataSet,"markerRegression",yq),cI(this._option.dataSet,"markerFilter",vq);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new Pa(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",(()=>{this._markerLayout()})),this._markerData=m}}bq.specKey="markLine";const xq=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),Sq={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"}}},refY:5},Aq={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:xq(!1),endSymbol:xq(!0),label:Sq};class kq extends bq{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new FP(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:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:_}=dq(e);let y=[];if(u||f||g||m||v||a&&l||a&&h){const t=ZK(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=tq(i,r,d,e.coordinatesOffset):c&&(y=sq(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n;const r=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const n=this._startRelativeSeries,a=this._endRelativeSeries,{multiSegment:o,mainSegmentIndex:l}=this._spec.line||{},{connectDirection:h,expandDistance:c=0}=this._spec;let d;if(SR(c)){const t=n.getRegion(),e=t.getLayoutStartPoint(),i=a.getRegion(),s=i.getLayoutStartPoint();if("bottom"===h||"top"===h){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));d=Number(c.substring(0,c.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));d=Number(c.substring(0,c.length-1))*n/100}}else d=c;const{points:u,limitRect:g}=r;if(!u||u.length<2)return void(null===(t=this._markerComponent)||void 0===t||t.setAttributes(r));const f=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}(u[0],u[1],h,d);let m;m=o&&p(l)?{position:"middle",autoRotate:!1}: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)}:{}}(u[0],u[1],h,d));const v=Y((null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{}).label),_=Y(r.label),y=Y(this._spec.label);null===(s=this._markerComponent)||void 0===s||s.setAttributes({points:o?[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]]]:f,label:_.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=m.dx)&&void 0!==i?i:0,h=null!==(s=m.dy)&&void 0!==s?s:0;const c=null!==(n=y[e])&&void 0!==n?n:y[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),m),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=v[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:g,multiSegment:o,mainSegmentIndex:l,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(n=this._markerComponent)||void 0===n||n.setAttributes(r)}_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}=dq(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 Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&p(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&p(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&p(n.process.xy)){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}}}kq.type=r.markLine,kq.coordinateType="cartesian",kq.builtInTheme={markLine:Aq};class Mq extends bq{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=dq(this._spec);return e||i?new HP(t):new FP(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}=dq(e);let p=[],g={};const f={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=QK(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:f}:{points:p.map((t=>ce(f,t.radius,t.angle)))}}else u&&(p=eq(i,r,a),g={points:p.map((t=>ce(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=dq(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}}}Mq.type=r.polarMarkLine,Mq.coordinateType="polar",Mq.builtInTheme={polarMarkLine:Aq};class Tq extends Yz{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=xR(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return JD(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}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;if(!1===this._spec.visible)return{visible:!1};const a=this.getLayoutRect(),o=kR(this._spec.width,a.width,null,a.width),l=kR(this._spec.maxWidth,a.width,null,a.width),h=Math.max(Math.min(o,l,a.width),0),c=p(this._spec.text)&&""!==this._spec.text,d=p(this._spec.subtext)&&""!==this._spec.subtext,u=Object.assign(Object.assign({},H(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:c?this._spec.text:void 0,subtextType:null!==(e=this._spec.subtextType)&&void 0!==e?e:"text",subtext:d?this._spec.subtext:void 0,x:null!==(i=this._spec.x)&&void 0!==i?i:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:h,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(n=this._spec.align)&&void 0!==n?n:"left",verticalAlign:null!==(r=this._spec.verticalAlign)&&void 0!==r?r:"top",textStyle:Object.assign({maxLineWidth:h},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:h},this._spec.subtextStyle)});if(c&&(u.textStyle.width=h),d&&(u.subtextStyle.width=h),p(this._spec.width)){const t=Math.max(Math.min(o,a.width),0);c?u.textStyle.width=t:delete u.textStyle.width,d&&(u.subtextStyle.width=t)}return u}_createOrUpdateTitleComponent(t){if(this._titleComponent)U(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new uL(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}Tq.type=r.title,Tq.specKey=r.title,Tq.builtInTheme={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"}}}};class wq extends _q{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=uq(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={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:oq(qO(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>rq(t,this._markerData,this._markAttributeContext))),state:{area:aq(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>aq(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return aq(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||Y(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=nq([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=Y(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=Y(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,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}=uq(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}wq.specKey="markArea";const Cq={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"}}}}};class Eq extends wq{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new jP(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=uq(i),d=p(i.positions),u=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=ZK(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=ZK(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=tq(s,a,u,i.coordinatesOffset):d&&(f=sq(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=uq(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}Eq.type=r.markArea,Eq.coordinateType="cartesian",Eq.builtInTheme={markArea:Cq};class Bq extends wq{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=uq(this._spec);return i||e||s?new NP(t):new jP(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}=uq(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=QK(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=eq(i,r,c),u={points:d.map((t=>ce(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=uq(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}}}Bq.type=r.polarMarkArea,Bq.coordinateType="polar",Bq.builtInTheme={polarMarkArea:Cq};const Pq=t=>qO(Object.assign({},t)),Lq=t=>Object.assign(Object.assign({},t),{style:Object.assign({},qO(t.style))}),Rq=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=Pq(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=Pq(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:{},qO(Object.assign({},y)));var y;const b=Lq(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=Lq(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=Lq(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=Lq(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!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:A})});return t.visible||(k.controller.visible=!1,k.slider.visible=!1),k},Oq=t=>"left"===t||"right"===t,Iq=t=>"top"===t||"bottom"===t,Dq={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:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,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:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class Fq extends Yz{constructor(){super(...arguments),this.layoutZIndex=t.LayoutZIndex.Player,this.layoutLevel=t.LayoutLevel.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},Rq(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},Rq(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?U(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new CL(t):this._playerComponent=new PL(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...Y(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...Y(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...Y(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...Y(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=Oq(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=Oq(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this.autoPlayCallback=()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback),this._option.globalInstance.on(t.ChartEvent.rendered,this.autoPlayCallback),this._playerComponent.addEventListener(SL.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(SL.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(SL.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(SL.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(SL.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(SL.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}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=Oq(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=Iq(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}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):Oq(this._orient)?this._maxSize():t.width}_computeHeight(t){return S(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):Iq(this._orient)?this._maxSize():t.height}_computeDx(t){return Oq(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return Iq(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(e){const i=this._specs[e];this._option.globalInstance.updateFullData(i.data),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})}release(){this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback)}}Fq.builtInTheme={player:Dq},Fq.specKey="player",Fq.type=r.player;class zq extends Yz{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,U(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=cR({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:Y(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==UI.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&u(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}zq.type=r.label;class jq extends MV{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}render(){}}jq.type="text",jq.constructorType="label";const Hq=()=>{TV(),zR.registerMark(jq.constructorType,jq)};class Nq extends Gz{_initTheme(t,e){return{spec:t,theme:this._theme}}}class Vq extends zq{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.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(eI.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(eI.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),qL(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{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),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,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=FR({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},WN(h,r),Object.assign(Object.assign(Object.assign({},H(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[TO])):t=>t.filter((t=>t.data[MO]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?GN(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=y(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=Y(i())[t])}))}return e}}Vq.type=r.label,Vq.specKey="label",Vq.transformerConstructor=Nq;class Uq extends zq{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()}reInit(t){super.reInit(t),this._initTextMark()}_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[AO]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return FR({textStyle:{pickable:!0===this._spec.interactive},position:Wq(t,this._baseMark.type,a),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=>"bottom"===a?t.data[TO]:t.data[MO]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>GN({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function Wq(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}Uq.type=r.totalLabel,Uq.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},Uq.specKey="totalLabel";class Gq extends _q{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=pq(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,f,m,v,_,y,b,x,S,A,k,M,T,w,C,E,B,P,L,R,O;const{itemContent:I={},itemLine:D={},targetSymbol:F={}}=this._spec,z=I,{type:H="text",text:N,symbol:V,image:U,richText:W,customMark:G,textStyle:Y,symbolStyle:$,imageStyle:X,richTextStyle:K,customMarkStyle:q,style:Z={},state:J={}}=z,Q=e(z,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let tt=null,et=null,it={};"text"===H?(tt=null!==(t=null==N?void 0:N.state)&&void 0!==t?t:J,it={dx:0,dy:0},et=rq(Object.assign(Object.assign({},N),{style:j(it,null!==(n=null!==(s=null!==(i=null==N?void 0:N.style)&&void 0!==i?i:null==N?void 0:N.textStyle)&&void 0!==s?s:Y)&&void 0!==n?n:Z)}),this._markerData,this._markAttributeContext)):"richText"===H?(tt=null!==(r=null==W?void 0:W.state)&&void 0!==r?r:J,it={width:100,height:100},et=oq(j(it,null!==(o=null!==(a=null==W?void 0:W.style)&&void 0!==a?a:K)&&void 0!==o?o:Z),this._markerData,this._markAttributeContext)):"symbol"===H?(tt=null!==(l=null==V?void 0:V.state)&&void 0!==l?l:J,it={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},et=qO(oq(j(it,null!==(c=null!==(h=null==V?void 0:V.style)&&void 0!==h?h:$)&&void 0!==c?c:Z),this._markerData,this._markAttributeContext))):"image"===H?(tt=null!==(d=null==U?void 0:U.state)&&void 0!==d?d:J,it={width:80,height:80},et=oq(j(it,null!==(p=null!==(u=null==U?void 0:U.style)&&void 0!==u?u:X)&&void 0!==p?p:Z),this._markerData,this._markAttributeContext)):"custom"===H&&(tt=null!==(g=null==G?void 0:G.state)&&void 0!==g?g:J,et=oq(null!==(m=null!==(f=null==G?void 0:G.style)&&void 0!==f?f:q)&&void 0!==m?m:Z,this._markerData,this._markAttributeContext));const st={zIndex:this.layoutZIndex,interactive:null===(v=this._spec.interactive)||void 0===v||v,hover:null===(_=this._spec.interactive)||void 0===_||_,select:null===(y=this._spec.interactive)||void 0===y||y,position:{x:0,y:0},clipInRange:null!==(b=this._spec.clip)&&void 0!==b&&b,itemContent:Object.assign(Object.assign({type:H,offsetX:lq(I.offsetX,this._relativeSeries.getRegion()),offsetY:lq(I.offsetX,this._relativeSeries.getRegion())},Q),{style:oq(et,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(x=F.offset)&&void 0!==x?x:0,visible:null!==(S=F.visible)&&void 0!==S&&S,size:null!==(A=F.size)&&void 0!==A?A:20,style:oq(F.style,this._markerData,this._markAttributeContext)},state:{line:aq(null!==(M=null===(k=this._spec.itemLine.line)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),lineStartSymbol:aq(null!==(w=null===(T=this._spec.itemLine.startSymbol)||void 0===T?void 0:T.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),lineEndSymbol:aq(null!==(E=null===(C=this._spec.itemLine.endSymbol)||void 0===C?void 0:C.state)&&void 0!==E?E:{},this._markerData,this._markAttributeContext),itemContent:aq(tt,this._markerData,this._markAttributeContext),textBackground:aq(null===(P=null===(B=this._spec.itemContent.text)||void 0===B?void 0:B.labelBackground)||void 0===P?void 0:P.state,this._markerData,this._markAttributeContext),targetItem:aq(null!==(R=null===(L=this._spec.targetSymbol)||void 0===L?void 0:L.state)&&void 0!==R?R:{},this._markerData,this._markAttributeContext)},animation:null!==(O=this._spec.animation)&&void 0!==O&&O,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:nt,line:rt={}}=D,at=e(D,["visible","line"]);st.itemLine=!1!==nt?Object.assign(Object.assign({},at),{visible:!0,lineStyle:qO(rt.style)}):{visible:!1};return new UP(st)}_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}=nq([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:hq(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:hq(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}=pq(t);(p(t.coordinate)||e||i||s)&&this._initCommonDataView()}}Gq.specKey="markPoint";const Yq={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}};class $q extends Gq{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=p(s.x)&&p(s.y),o=p(s.coordinate),l=p(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=ZK(n,r,r,r,h))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=tq(n,r,h,s.coordinatesOffset)[0]:l&&(c=sq(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=pq(t),i=p(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}$q.type=r.markPoint,$q.coordinateType="cartesian",$q.builtInTheme={markPoint:Yq};class Xq extends Gq{constructor(){super(...arguments),this.type=r.polarMarkPoint,this.name=r.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=QK(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:ce({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}])]}}}Xq.type=r.polarMarkPoint,Xq.coordinateType="polar",Xq.builtInTheme={polarMarkPoint:Yq};class Kq extends Gq{constructor(){super(...arguments),this.type=r.geoMarkPoint,this.name=r.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){const t=function(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{p(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}(this._markerData,this._relativeSeries)[0][0];return{point:t}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}Kq.type=r.geoMarkPoint,Kq.coordinateType="geo",Kq.builtInTheme={geoMarkPoint:Yq};const qq="inBrush",Zq="outOfBrush";class Jq extends Yz{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._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return JD(t,this.specKey,this.type,(t=>!1!==t.visible))}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),qq,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),Zq,t.AttributeLevel.Series))}))}))}_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()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){p(this._spec.regionId)||p(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_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)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild()}_shouldEnableInteractive(){return!1!==this.getOption().getCompiler().getOption().interactive}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new IL(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:qO(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),this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(EL.brushActive,(s=>{this._initMarkBrushState(i,Zq),this._emitEvent(t.ChartEvent.brushActive,e,s)})),a.addEventListener(EL.drawStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener(EL.moveStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener(EL.drawing,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener(EL.moving,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener(EL.brushClear,(s=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)})),a.addEventListener(EL.drawEnd,(s=>{var n;this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:r}=s.detail,{updateElementsState:a=!0}=this._spec;if(null===(n=this._spec)||void 0===n?void 0:n.onBrushEnd)!0===this._spec.onBrushEnd(s)?(this.clearGraphic(),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)):(this._spec.onBrushEnd(s),this._emitEvent(t.ChartEvent.brushEnd,e,s));else{const i=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&i.length>0||!a)&&this._setAxisAndDataZoom(r,e),this._emitEvent(t.ChartEvent.brushEnd,e,s)}})),a.addEventListener(EL.moveEnd,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:s}=i.detail,{updateElementsState:n=!0}=this._spec,r=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&r.length>0||n)&&this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e,i)}))}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a],interactive:this._shouldEnableInteractive()}}_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({},qO(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail;this._operateMask=i;const{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e,i){var s;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},vchart:null===(s=this._option)||void 0===s?void 0:s.globalInstance,event:i})}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(i.addState(qq,!0),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(i.removeState(qq),i.addState(Zq,!0),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:_=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(_.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(i.addState(qq,!0),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(i.removeState(qq),i.addState(Zq,!0),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Pe(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;s.removeState(qq),s.removeState(Zq),i&&s.addState(i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_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?"width":"height",p=r?o:h,g=r?l:c;if(this._axisDataZoomMap[t.id]){const i=this._axisDataZoomMap[t.id],s=(p-e.getLayoutStartPoint()[d])/e.getLayoutRect()[u],n=(g-e.getLayoutStartPoint()[d])/e.getLayoutRect()[u],r=this._stateClamp(s-a),o=this._stateClamp(n+a);i.setStartAndEnd(Math.min(r,o),Math.max(r,o),["percent","percent"]),this._zoomRecord.push({operateComponent:i,start:r,end:o,startValue:kK(r,i.stateScale,TK(i.relatedAxisComponent,i.isHorizontal)),endValue:kK(o,i.stateScale,TK(i.relatedAxisComponent,i.isHorizontal))})}else{const i=t.getScale().range(),s=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],r=$(i){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}clearBrushStateAndMask(){this._relativeRegions.forEach(((t,e)=>{this._initMarkBrushState(e,""),this._brushComponents[e].children[0].removeAllChild()}))}}Jq.type=r.brush,Jq.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},Jq.specKey="brush";class Qq extends Yz{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}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;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${lO}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=wF({},CF(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(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)}))),p(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,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 Ne).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Ne;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),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}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}Qq.type=r.customMark,Qq.specKey="customMark";class tZ{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._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=>{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=>eZ(t))),a=n.filter((t=>!eZ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>eZ(t))),h=o.filter((t=>!eZ(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 eZ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}tZ.type="grid";const iZ="vchart-tooltip",sZ=`${iZ}-container`,nZ=`${iZ}-title`,rZ=`${iZ}-content-box`,aZ={offsetX:10,offsetY:10},oZ="99999999999999";function lZ(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const hZ=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,cZ=t=>_(t)&&""!==(null==t?void 0:t.trim())||S(t)?lZ(t):"",dZ=(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},uZ={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},pZ=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=uZ[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class gZ extends bz{constructor(){super(...arguments),this._visible=!0,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._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const _=e.event,{activeType:y,data:b}=t,x="dimension"===y?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:M}=this._option,T=m[y],w=iF(null==T?void 0:T.position,b,e),C=null!==(r=iF(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===y?"mark":"pointer",{width:E=0,height:B=0}=null!=i?i:{},P="canvas"===m.renderMode,L=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==L?void 0:L.width)&&void 0!==o?o:hO,O=null!==(l=null==L?void 0:L.height)&&void 0!==l?l:cO;let I=!1;const D={width:0,height:0};let F,z={x:0,y:0},j={x:0,y:0},H=1,N=1;const V=Yy(this._env);if(V&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=R,D.height=O),V&&!P){const t=this._getParentElement(m);j=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-j.x,y:F.y-j.y},H=hZ(e,F),N=hZ(t,j)}const U=N/H,W={},G={x:w,y:w},Y={x:["left","right"],y:["top","bottom"]},$=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?A:M;if("mark"===i){I=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){I=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(I){const e=Y[n][0],i="x"===n?E:B;switch(pZ(t,n)){case-2:W[e]=a-i*U-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*U/2;break;case-1:W[e]=(a+o)/2-i*U-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*U-c;break;case 2:W[e]=o+c}}},X=["x","y"];if(g(w))if(g(K=w)&&(p(K.left)||p(K.right)||p(K.top)||p(K.bottom))){const{left:t,right:e,top:i,bottom:s}=w;W.left=dZ(t,_),W.top=dZ(i,_),W.right=dZ(e,_),W.bottom=dZ(s,_)}else(t=>g(t)&&(p(t.x)||p(t.y)))(w)&&X.forEach((t=>{const e=w[t];S(e)||d(e)?W[Y[t][0]]=dZ(e,_):$(e,t)}));else p(w)&&($({orient:w,mode:C},"x"),$({orient:w,mode:C},"y"));var K;const q={x:null,y:null};return X.forEach((t=>{var e;const i="x"===t?E:B,s="x"===t?R:O,n="x"===t?A:M,r=pZ(G[t],t);if(k(W[Y[t][0]]))q[t]=W[Y[t][0]];else if(k(W[Y[t][1]]))q[t]=s-i*U-W[Y[t][1]];else{const e="x"===t?_.canvasX:_.canvasY;q[t]=r>0?e+n:0===r?e-i*U/2:e-i*U-n}q[t]*=H,V&&(q[t]+=z[t]),q[t]/=N;const a="x"===t?D.width:D.height,o=m.confine?-(j[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/H)/N:-j[t]/N,l=a/N+o-i;2!==r&&q[t]l&&(q[t]=l)):-2!==r&&q[t]>l&&(I?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",mZ=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=fZ(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=fZ(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},vZ=(t={})=>{const{lineHeight:e}=t;return t.fontSize?kR(e,t.fontSize):0},_Z=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),p(r)&&(o=ai(r),a.padding=fZ(o)),{panelStyle:a,panelPadding:o}};function yZ(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}class bZ extends gZ{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(bZ.type),this.type=mH.dom,this._tooltipContainer=null==Gy?void 0:Gy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(Gy&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:d,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=_Z(l),_={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(_.marginBottom=`${g}px`);const y={width:fZ(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=mZ(h),x=mZ(d),S=mZ(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),u(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),u(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),u(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),y[A]=fZ(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=fZ(null!==(s=d.spacing)&&void 0!==s?s:26),S[A]=fZ(null!==(n=p.spacing)&&void 0!==n?n:0);const M=Math.max(vZ(p),vZ(d));return _.lineHeight=M>0?`${M}px`:"20px",{panelPadding:v,row:_,panel:m,title:b,shape:y,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(nZ))),l=a.find((t=>t.className.includes(rZ)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(nZ),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(yZ(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${iZ}-column`),e.classList.add(`${iZ}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(rZ),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];yZ(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));yZ(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${iZ}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=cZ(e.key),e.keyStyle&&mZ(e.keyStyle,l)):"value"===i?(o.innerHTML=cZ(e.value),e.valueStyle&&mZ(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?lZ(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?lZ(c):m,y=p,b=t=>new Cg({symbolType:t,size:y,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new Ne));let M=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const T=vh.IsGradientStr(u);if(!u||_(u)&&!T||d)return m=d?"none":u?lZ(u):"currentColor",`\n \n \n \n `;const w=T?vh.Parse(u):g(u)?u:null;if(w){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=w.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===w.gradient?t=`\n ${i}\n `:"linear"===w.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),yZ(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(rZ))),h=[...o.children].find((t=>t.className.includes(nZ)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(nZ)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=kR(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,yZ(l,c))}const u=l.children,g=[];if(u){for(let i=0;i{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},ff||(ff=pf.CreateGraphic("richtext",{})),ff.setAttributes(a),ff.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function AZ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:xZ),{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:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const kZ=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};class MZ extends gZ{constructor(){super(MZ.type),this.type=mH.canvas,this._attributes=null}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 HL({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}_getTooltipBoxSize(t,e){var i,s;if(!e||u(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");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:f,valueLabel:m,spaceRow:v,align:_}=l,y=ai(d.padding),b=wR(d.padding),x=AZ(Object.assign({textAlign:"right"===_?"right":"left"},u),i),S=AZ(Object.assign({textAlign:"right"===_?"right":"left"},f),i),A=AZ(m,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:kZ(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,enterable:h,transitionDuration:c,align:_},{title:T={},content:w=[]}=t;let C=b.left+b.right,E=b.top+b.bottom,B=0;const P=!!w.length;let L=0,R=0,O=0,I=0;if(P){const t=[],e=[],i=[],s=[];let n=0;M.content=w.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:M}=r,T={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=FR({},S,AZ(b,void 0,{})),{width:s,height:n,text:r}=SZ(h,i);T.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(m)){const t=FR({},A,AZ(x,void 0,{})),{width:e,height:s,text:n}=SZ(m,t);T.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};M?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,T.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else T.shape={visible:!1};return T.height=o,n+=o,aU.autoWidth&&!1!==U.multiLine;if(j){U=FR({},x,AZ(N,void 0,{})),W()&&(U.multiLine=null===(r=U.multiLine)||void 0===r||r,U.maxWidth=null!==(a=U.maxWidth)&&void 0!==a?a:P?Math.ceil(B):void 0);const{text:t,width:e,height:i}=SZ(H,U);M.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=U.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},U),{text:t}),D=M.title.value.width,F=M.title.value.height,z=F+(P?M.title.spaceRow:0)}return E+=z,M.title.width=D,M.title.height=F,W()?C+=B||D:C+=Math.max(D,B),P&&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-I-L-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})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_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{activeTooltipSpec: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()}}MZ.type=mH.canvas;const TZ=/\{([^}]+)\}/,wZ=/\{([^}]+)\}/g,CZ=/:/;class EZ extends bz{constructor(){super(EZ.type),this.type="formatterPlugin",this._timeModeFormat={utc:mi.getInstance().timeUTCFormat,local:mi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=ki.getInstance().format,this._numericSpecifier=ki.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[EZ.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)),zR.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=TZ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(wZ,((t,i)=>{if(!CZ.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(xi.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):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}EZ.pluginType="chart",EZ.specKey="formatter",EZ.type="formatterPlugin";YD.useRegisters([()=>{xH(),AH(),MH(),Jj(),Zj(),Dj(),wj(),hz(),dz(),ID(),LD(),bj(),mj(),zR.registerSeries(Fj.type,Fj),zR.registerChart(TH.type,TH)},()=>{xH(),AH(),MH(),Zj(),Dj(),wj(),hz(),EH(),dz(),LH(),bj(),mj(),zR.registerSeries(OH.type,OH),Jj(),zR.registerChart(DH.type,DH)},()=>{xH(),AH(),MH(),Zj(),qH(),Jj(),zR.registerChart(JH.type,JH)},()=>{xH(),AH(),Jj(),Zj(),lN(),zR.registerChart(cN.type,cN)},()=>{AH(),rU(),zR.registerChart(Q$.type,Q$)},()=>{xH(),AH(),Jj(),Zj(),AU(),zR.registerChart(iX.type,iX)},()=>{xH(),AH(),MH(),Jj(),Zj(),LU(),zR.registerChart(nX.type,nX)},()=>{xH(),AH(),MH(),Jj(),Zj(),qH(),zR.registerTransform("bin",Kr),zR.registerChart(cX.type,cX)},()=>{AH(),MN(),fN(),zR.registerSeries(wN.type,wN),zR.registerImplement("registerMap",fI),zR.registerImplement("unregisterMap",mI),RD(),zR.registerChart($$.type,$$)},()=>{AH(),d$(),zR.registerSeries(p$.type,p$),QV(),$U(),yU(),qU(),zR.registerChart(gX.type,gX)},()=>{AH(),zG(),zR.registerChart(vX.type,vX)},()=>{AH(),nY(),zR.registerChart(yX.type,yX)},()=>{xH(),AH(),MH(),Jj(),Zj(),iV(),zR.registerChart(PX.type,PX)},()=>{xH(),AH(),Jj(),Zj(),kV(),zR.registerTransform("boxplot",qr),zR.registerChart(RX.type,RX)},()=>{xH(),AH(),Jj(),Zj(),qU(),zR.registerChart(uX.type,uX)},()=>{xH(),AH(),Jj(),Zj(),sW(),zR.registerChart(xX.type,xX)},()=>{xH(),AH(),Jj(),Zj(),IV(),zR.registerChart(AX.type,AX)},()=>{xH(),AH(),MH(),Jj(),Zj(),EH(),bj(),mj(),zR.registerSeries(HV.type,HV),zR.registerChart(FX.type,FX)},()=>{AH(),SY(),zR.registerChart(MX.type,MX)},()=>{AH(),CY(),zR.registerChart(wX.type,wX)},()=>{AH(),e$(),zR.registerChart(EX.type,EX)},()=>{AH(),xo.load(vM),$Y(),zR.registerChart(IX.type,IX)},()=>{AH(),b$(),zR.registerChart(jX.type,jX)},()=>{AH(),R$(),zR.registerChart(NX.type,NX)},()=>{xH(),AH(),MH(),Jj(),zR.registerChart(aX.type,aX),Zj()},mj,bj,()=>{zR.registerGraphicComponent($z.lineAxis,((t,e)=>new CC(t,e))),zR.registerGraphicComponent(Xz.lineAxisGrid,((t,e)=>new zB(t,e))),Qz(),zR.registerComponent(xj.type,xj)},()=>{zR.registerGraphicComponent($z.lineAxis,((t,e)=>new CC(t,e))),zR.registerGraphicComponent(Xz.lineAxisGrid,((t,e)=>new zB(t,e))),Qz(),zR.registerComponent(Sj.type,Sj)},()=>{zR.registerGraphicComponent($z.lineAxis,((t,e)=>new CC(t,e))),zR.registerGraphicComponent(Xz.lineAxisGrid,((t,e)=>new zB(t,e))),Qz(),zR.registerComponent(Aj.type,Aj)},xU,yU,()=>{zR.registerComponent(YX.type,YX)},()=>{zR.registerComponent(sK.type,sK)},()=>{zR.registerComponent(pK.type,pK)},()=>{zR.registerComponent(yK.type,yK)},()=>{zR.registerComponent(bK.type,bK)},()=>{zR.registerComponent(IK.type,IK)},()=>{zR.registerComponent(FK.type,FK)},()=>{zR.registerComponent(NK.type,NK)},MN,()=>{zR.registerComponent(kq.type,kq),DP()},()=>{zR.registerComponent(Eq.type,Eq),zP()},()=>{zR.registerComponent($q.type,$q),VP()},()=>{zR.registerComponent(Mq.type,Mq),HP._animate=vP,DP()},()=>{zR.registerComponent(Bq.type,Bq),NP._animate=yP,zP()},()=>{zR.registerComponent(Xq.type,Xq),VP()},()=>{zR.registerComponent(Kq.type,Kq),VP()},()=>{zR.registerComponent(Tq.type,Tq)},()=>{zR.registerComponent(Fq.type,Fq)},()=>{zR.registerGraphicComponent(Vq.type,(t=>new OB(t))),Hq(),qz(),zR.registerComponent(Vq.type,Vq,!0,1/0)},()=>{zR.registerGraphicComponent(Uq.type,(t=>new OB(t))),Hq(),qz(),zR.registerComponent(Uq.type,Uq,!0)},()=>{zR.registerComponent(Jq.type,Jq)},()=>{zR.registerComponent(Qq.type,Qq)},()=>{xo.load(aT)},()=>{zR.registerLayout(tZ.type,tZ)},()=>{var t;t=MZ,zR.registerComponentPlugin(t.type,t)},()=>{var t;t=EZ,zR.registerChartPlugin(t.type,t)},ND,WD]),YD.useRegisters([()=>{GS(xo)}]),t.DEFAULT_CHART_HEIGHT=cO,t.DEFAULT_CHART_WIDTH=hO,t.DEFAULT_CLOSE_STROKE_JOIN=KD,t.DEFAULT_DATA_INDEX=uO,t.DEFAULT_DATA_KEY=pO,t.DEFAULT_DATA_SERIES_FIELD=gO,t.DEFAULT_KEY=RO,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=XD,t.DEFAULT_MAP_LOOK_UP_KEY=OO,t.DEFAULT_MEASURE_CANVAS_ID=dO,t.DEFAULT_SERIES_STYLE_NAME=fO,t.DEFAULT_SMOOTH_INTERPOLATE=$D,t.Factory=zR,t.MOSAIC_CAT_END_PERCENT=BO,t.MOSAIC_CAT_START_PERCENT=EO,t.MOSAIC_VALUE_END_PERCENT=CO,t.MOSAIC_VALUE_START_PERCENT=wO,t.ManualTicker=class extends hw{constructor(t){super(t),this.lastFrameTime=0,this.status=Ro.RUNNING}setupTickHandler(){const t=new cw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===Ro.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Ro.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Ro.RUNNING,!0}},t.PREFIX=lO,t.SEGMENT_FIELD_END=LO,t.SEGMENT_FIELD_START=PO,t.STACK_FIELD_END=_O,t.STACK_FIELD_END_OffsetSilhouette=SO,t.STACK_FIELD_END_PERCENT=bO,t.STACK_FIELD_KEY=mO,t.STACK_FIELD_START=vO,t.STACK_FIELD_START_OffsetSilhouette=xO,t.STACK_FIELD_START_PERCENT=yO,t.STACK_FIELD_TOTAL=AO,t.STACK_FIELD_TOTAL_BOTTOM=TO,t.STACK_FIELD_TOTAL_PERCENT=kO,t.STACK_FIELD_TOTAL_TOP=MO,t.StreamLight=class extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=Ao.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Wl,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=Ao.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_;const y=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(y){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:qo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(_=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==_?_:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:qo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=cl(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=cl(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;e{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,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize: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=this.options.createCanvas({width:1,height:1}),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 f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),_=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*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],B=(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--;)B(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}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=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,e=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){this.grid=[];const e=this.options.shape;if(g(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?PG(t,o,l.width,l.height,h):"geometric"===t.type&&OG(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!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)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,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}=yG(this.options.shape,[e.width,e.height]);return 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),this.result=[],this.progressiveRun()}};IG.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class DG extends AG{constructor(t){super(j({},DG.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,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)}DG.defaultOptions={enlarge:!1};const zG={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},jG=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return ot.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?HG(t.fontFamily):"sans-serif",d=t.fontStyle?HG(t.fontStyle):"normal",u=t.fontWeight?HG(t.fontWeight):"normal",p=t.rotate?HG(t.rotate):0,g=HG(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?HG(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?Object.assign(Object.assign({},zG),t.as):zG,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?HG(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=NG(UG(t,l),C);w=i=>e(t(i))}let E=MG;"fast"===t.layoutType?E=DG:"grid"===t.layoutType&&(E=IG);const B=new E(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:w,shrink:_,clip:b,enlarge:y,minFontSize:x,random:A,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:B}:B.output()},HG=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],VG=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),NG=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=VG(t[0]),n=VG(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(VG(t)-r)/(a-r)*(e[1]-e[0])+e[0]},UG=(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 WG(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{YR.registerGrammarTransform("wordcloud",{transform:jG}),ON(),YR.registerAnimation("wordCloud",((t,e)=>({appear:SW(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:FD.disappear.duration}}))),YR.registerSeries(GG.type,GG)},$G=(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:f=!1,isCone:m=!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===f?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?m?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},XG=(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},KG=`${mO}_FUNNEL_TRANSFORM_RATIO`,qG=`${mO}_FUNNEL_REACH_RATIO`,ZG=`${mO}_FUNNEL_HEIGHT_RATIO`,JG=`${mO}_FUNNEL_VALUE_RATIO`,QG=`${mO}_FUNNEL_LAST_VALUE_RATIO`,tY=`${mO}_FUNNEL_NEXT_VALUE_RATIO`,eY=`${mO}_FUNNEL_LAST_VALUE`,iY=`${mO}_FUNNEL_CURRENT_VALUE`,sY=`${mO}_FUNNEL_NEXT_VALUE`,nY=`${mO}_FUNNEL_TRANSFORM_LEVEL`;class rY extends fF{constructor(t){var e,i;super(t),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)?this._transformRatioText: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[qG])).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 this._transformRatioText;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]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class aY extends CD{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class oY extends aY{constructor(){super(...arguments),this.type=oY.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}oY.type="polygon";const lY=()=>{YR.registerMark(oY.type,oY),Jk(),Yk(),pw.registerBuiltInAnimate("growPointsOut",cC),YR.registerGraphicComponent("polygon",cf)},hY=Object.assign(Object.assign({},wF),{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"}});class cY extends UF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class dY extends WF{constructor(){super(...arguments),this.type=cR.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=cY,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,i,s,n;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._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;_I(this._dataSet,"funnel",$G),_I(this._dataSet,"funnelTransform",XG);const t=new Pa(this._dataSet,{name:`${mO}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new AD(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}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:iY,asTransformRatio:KG,asReachRatio:qG,asHeightRatio:ZG,asValueRatio:JG,asNextValueRatio:tY,asLastValueRatio:QG,asLastValue:eY,asNextValue:sY,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:nY}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},dY.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:jF(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},dY.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),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(dY.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(dY.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new rY(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(){var e,i,s,n;const r=this._funnelMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const a=this._funnelTransformMark;a&&this.setMarkStyle(a,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const o=this._funnelOuterLabelMark.label;o&&(this.setMarkStyle(o,{text:t=>`${t[this.getCategoryField()]}`,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),width:0,height:0},"normal",t.AttributeLevel.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(o,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",t.AttributeLevel.User_Mark));const l=this._funnelOuterLabelMark.line;if(l&&o){this.setMarkStyle(l,{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);const r=null!==(s=null===(i=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.line)||void 0===i?void 0:i.visible)&&void 0!==s?s:null===(n=this._spec.outerLabel)||void 0===n?void 0:n.visible;p(r)&&l.setVisible(r)}}initLabelMarkStyle(e){var i;if(!e)return;const s=e.getTarget(),n=e.getComponent();if(s===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);const s=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&jy(s,this._funnelOuterLabelMark.label,n),this._funnelOuterLabelMark.line&&jy(s,this._funnelOuterLabelMark.line,null!==(i=this._funnelOuterLabelMark.label)&&void 0!==i?i:n)}else this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*oR(qG).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(IF(null===(s=YR.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.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),DF("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(IF(YR.getAnimationInKey("fadeInOut")(),DF(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(IF(YR.getAnimationInKey("funnel")({},o),DF(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(IF(null===(a=YR.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),DF("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[QG])/2:this._getSecondaryAxisLength(t[JG])/2,n=this._getSecondaryAxisLength(t[JG])/2):(s=this._getSecondaryAxisLength(t[JG])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[tY])/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[nY])}_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[xO]===t[xO]));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,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,_,y;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h: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!==f.alignLabel?(null==u?void 0:u.y2)+e:_-e,m=this._getPolygonCenter(i).x,_-y{lY(),ON(),GV(),YR.registerSeries(dY.type,dY),YR.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},jD))),YR.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Yw,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),VD()},pY=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},gY=t=>{const e=t.filter((t=>t.context.diffState===ZI.update)),i=K(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},fY=(t,e,i)=>{if(P(t))return[e,i];const s=K(t.map((t=>1*t.getFinalAttribute().startAngle))),n=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},mY=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=gY(i.parent.children),a=fY(r,s,n);return pY(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=gY(i.parent.children),a=fY(r,s,n);return pY(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),vY=t=>{const e=K(t.map((t=>1*t.getFinalAttribute().startAngle))),i=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},_Y=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=gY(i.parent.children),a=vY(r);return pY(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=gY(i.parent.children),a=vY(r);return pY(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),yY=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},bY=(t,e={})=>{if(!t)return[];const i=[];return TW(t,i,e),i},xY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new tG(i).layout(t,{width:s,height:n})};class SY extends fF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var AY;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(AY||(AY={}));const kY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===AY.DrillDown){return Y(JO(t,n,s,"children"))}if(i.type===AY.DrillUp){const e=QO(t,n,s,"children");if(e)return Y(e)}return t};class MY{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=CV(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;_I(t,"drillFilter",kY),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)||P(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:AY.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:AY.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)||P(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:AY.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:AY.DrillUp},model:this}),r}}const TY=Object.assign(Object.assign({},wF),{sunburst:{name:"sunburst",type:"arc"}}),wY=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:bF,operations:["max","min","values"]}),t.push({key:xF,operations:["values"]}),t),CY={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,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"}}}};class EY extends KN{constructor(){super(...arguments),this.type=cR.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:xF),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:xO},getRawData:()=>this.getRawData()}),this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(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),_I(this._dataSet,"sunburstLayout",xY),_I(this._dataSet,"flatten",bY),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 wY(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(_I(t.dataSet,"addVChartProperty",lF),t.transform({type:"addVChartProperty",options:{beforeCall:MF.bind(this),call:TF}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(EY.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_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()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(EY.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new SY(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(IF(null===(e=YR.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),DF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(IF(null===(e=YR.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),DF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),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]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}EY.type=cR.sunburst,EY.mark=TY,EY.builtInTheme={sunburst:CY},G(EY,MY);const BY=()=>{YR.registerSeries(EY.type,EY),oU(),ON(),VD(),YR.registerAnimation("sunburst",((t,e)=>({appear:yY(0,e),enter:mY(t),exit:_Y(t),disappear:{duration:FD.disappear.duration}})))},PY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new NW(i).layout(t,{width:s,height:n})};class LY extends fF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const RY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},OY=Object.assign(Object.assign({},wF),{circlePacking:{name:"circlePacking",type:"arc"}});class IY extends $F{constructor(){super(...arguments),this.type=cR.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:xF),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:xO},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),_I(this._dataSet,"circlePackingLayout",PY),_I(this._dataSet,"flatten",bY),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,valueField:this._valueField,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)||(_I(t.dataSet,"addVChartProperty",lF),t.transform({type:"addVChartProperty",options:{beforeCall:MF.bind(this),call:TF}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(IY.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_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},t.STATE_VALUE_ENUM.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(IY.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"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return wY(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new LY(this),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(IF(null===(i=YR.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),DF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(IF(null===(e=YR.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),DF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}IY.type=cR.circlePacking,IY.mark=OY,IY.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,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"}}}}},G(IY,MY);const DY=()=>{YR.registerSeries(IY.type,IY),oU(),ON(),HD(),YR.registerAnimation("circlePacking",((t,e)=>({appear:RY(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:FD.disappear.duration}})))},FY=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&FY(t,e.children,i)}))},zY=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},jY=(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 ZW(e),r=[];return r.push(n.layout(s,i)),r},HY=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:[]},VY=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 NY extends fF{constructor(){super(...arguments),this._getDimensionData=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},this.markTooltipValueCallback=t=>t.value}}const UY=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),WY=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:UY(t),GY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class YY extends kw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class $Y extends kw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const XY=(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,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=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}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},KY=(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,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=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}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class qY extends fN{constructor(){super(...arguments),this.type=qY.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?KY:XY,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}qY.type="linkPath";const ZY=Object.assign(Object.assign({},wF),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class JY extends UF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const QY=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&t.removeState(e),t.addState(e,s,n)};class t$ extends $F{constructor(){super(...arguments),this.type=cR.sankey,this.transformerConstructor=JY,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new Ve,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;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(p(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var e,i;if(!this._needClear)return;const s=null===(e=this._nodeMark)||void 0===e?void 0:e.getGraphics();if(!s||!s.length)return;const n=null===(i=this._linkMark)||void 0===i?void 0:i.getGraphics();n&&n.length&&(s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),n.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._needClear=!1)},this._handleNodeAdjacencyClick=e=>{const i=aI(e),s=[i.key];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,n)=>{const r=aI(e);r.source===i.key?(s.includes(r.target)||s.push(r.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):r.target===i.key?(s.includes(r.source)||s.push(r.source),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleLinkAdjacencyClick=e=>{const i=aI(e),s=[i.source,i.target];if(this._linkMark){const i=this._linkMark.getGraphics();if(!i||!i.length)return;i.forEach((i=>{i===e?(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),QY(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1})):(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),i.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleNodeRelatedClick=e=>{var i;const s=aI(e),n=this._nodeMark.getGraphics();if(!n||!n.length)return;const r=this._linkMark.getGraphics();if(!r||!r.length)return;const a=(null===(i=aI(r[0]))||void 0===i?void 0:i.parents)?"parents":"source";if("source"===a){const e=[s.key],i=[];if(r.forEach(((t,r)=>{var a,o,l,h;const c=aI(t),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(s.key)){if(i.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||i.push(null!==(o=c.key)&&void 0!==o?o:c.index),e.includes(c.source)||e.push(c.source),!e.includes(c.target)){e.push(c.target);let t=n.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.target))){e.push(t.target);const i=n.find((e=>e.data[0].key===t.target));s.push(i.data[0].targetLinks)}})),void(t=s)}}}else if(c.target===s.key&&(i.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||i.push(null!==(h=c.key)&&void 0!==h?h:c.index),!e.includes(c.source))){e.push(c.source);let t=n.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.source))){e.push(t.source);const i=n.find((e=>e.data[0].key===t.source));s.push(i.data[0].targetLinks)}})),void(t=s)}}})),this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,s)=>{var n;const r=aI(e);i.includes(null!==(n=r.key)&&void 0!==n?n:r.index)?(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}else{const e=[s.key],i=s.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const i=e.parents,n=i.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);r.forEach(((n,r)=>{const o=aI(n),l=o.datum,h=l?l.filter((t=>t[a].some((t=>t.key===s.key)))):null,c=i.find((t=>t.source===o.source&&t.target===o.target));if(h&&h.length){e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target);const i=h.reduce(((t,e)=>t+e.value),0),s=i/o.value;return n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void QY(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:s})}if(c)return e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target),n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void QY(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:c.value/o.value});n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),n.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}this._needClear=!0},this._handleLinkRelatedClick=e=>{const i=this._nodeMark.getGraphics();if(!i||!i.length)return;const s=this._linkMark.getGraphics();if(!s||!s.length)return;if("source"===(aI(e)?"parents":"source"))this._linkMark&&s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&i.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)}));else{const n=aI(e),r=[n.source,n.target],a=[];Y(n.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));a.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=r:a.push({source:i,target:n,value:r})}})),s.forEach((e=>{const i=aI(e),s=i.datum;if(i.source===n.source&&i.target===n.target)return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void QY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1});const o=s?s.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(n.source)&&e.includes(n.target)})):null;if(o&&o.length){r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target);const s=o.filter((t=>t.parents.some(((e,i)=>{var s;return e.key===n.source&&(null===(s=t.parents[i+1])||void 0===s?void 0:s.key)===n.target})))).reduce(((t,e)=>t+e.value),0),a=s/i.value;return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void QY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:a})}const l=a.find((t=>t.source===i.source&&t.target===i.target));if(l)return r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void QY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:l.value/i.value});e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(i,r)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}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:this._spec.categoryField)}initData(){var e,i,s,n;super.initData();const r=this.getViewData(),a=this.getRawData();if(a&&r){_I(this._dataSet,"sankeyLayout",jY),_I(this._dataSet,"sankeyFormat",zY),a.transform({type:"sankeyFormat"},!1),r.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.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(e=this._spec.nodeAlign)&&void 0!==e?e:"justify",nodeGap:null!==(i=this._spec.nodeGap)&&void 0!==i?i:8,nodeWidth:null!==(s=this._spec.nodeWidth)&&void 0!==s?s:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(n=this._spec.minNodeHeight)&&void 0!==n?n:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,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,inverse:this._spec.inverse},level:t.TransformLevel.sankeyLayout});const{dataSet:o}=this._option;_I(o,"sankeyNodes",HY),_I(o,"flatten",bY);const l=new Pa(o,{name:`sankey-node-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyNodes"}),l.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),l.transform({type:"addVChartProperty",options:{beforeCall:AF.bind(this),call:kF}},!1),this._nodesSeriesData=l,_I(o,"sankeyLinks",VY);const h=new Pa(o,{name:`sankey-link-${this.id}-data`});h.parse([this.getViewData()],{type:"dataview"}),h.transform({type:"sankeyLinks"}),h.transform({type:"addVChartProperty",options:{beforeCall:AF.bind(this),call:kF}},!1),this._linksSeriesData=h}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(t$.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(t$.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,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()}_initNodeMarkStyle(){var e,i;const s=this._nodeMark;s&&(this.setMarkStyle(s,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Mark),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.node.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByNode},"normal",t.AttributeLevel.User_Mark))}_initLinkMarkStyle(){var e,i;const s=this._linkMark;s&&(s.setGlyphConfig({direction:this.direction}),this.setMarkStyle(s,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.link.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByLink},"normal",t.AttributeLevel.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=rF(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={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;this._nodeMark&&this._nodeMark.setAnimationConfig(IF(null===(i=YR.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),DF("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(IF(null===(s=YR.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),DF("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:pI.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(e,i){e&&e.length&&e.forEach((e=>{e.removeState([t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]),i.includes(aI(e).key)?e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0):e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new NY(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_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&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new AR;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_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 FY(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),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]}getMarkData(t){return t.datum?y(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}t$.type=cR.sankey,t$.transformerConstructor=JY,t$.mark=ZY,t$.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const e$=()=>{JH(),mN(),Wk(),YR.registerGraphicComponent("path",(t=>tf(t))),YR.registerMark(qY.type,qY),ON(),YR.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:WY(t,e)},jD))),YR.registerAnimation("sankeyLinkPath",((t,e)=>({appear:GY(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:FD.disappear.duration}}))),pw.registerBuiltInAnimate("linkPathGrowOut",$Y),pw.registerBuiltInAnimate("linkPathGrowIn",YY),VD(),YR.registerSeries(t$.type,t$)},i$=(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=bY(n);return i=vF([{latestData:r}],e),i};class s$ extends fF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const n$=Object.assign(Object.assign({},wF),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),r$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class a$ extends UF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const o$=(t,e)=>{if(e.getViewBox()){const i=new nG(e).layout(t,e.getViewBox()),s=[];return TW(i,s,{maxDepth:null==e?void 0:e.maxDepth}),s.forEach(((t,i)=>{t&&[xF,"name"].forEach((i=>{t[i]=t.datum[t.depth][e.nameField]}))})),s}return[]};class l$ extends $F{constructor(){super(...arguments),this.type=cR.treemap,this.transformerConstructor=a$,this._categoryField="name",this._valueField="value",this._viewBox=new Ve,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:xF),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new We),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:xO},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,s,n;super.initData(),_I(this._dataSet,"treemap",o$),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{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}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(_I(this._rawData.dataSet,"addVChartProperty",lF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:MF.bind(this),call:TF}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=i$([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=j(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){_I(this._dataSet,"hierarchyDimensionStatistics",i$),_I(this._dataSet,"flatten",bY);const i=new Pa(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 wY(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(l$.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(l$.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}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()},t.STATE_VALUE_ENUM.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()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRichStyleOfLabelMark(e){"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(IF(null===(e=YR.getAnimationInKey("treemap"))||void 0===e?void 0:e(),DF(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 s$(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(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(hI.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(hI.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}l$.type=cR.treemap,l$.mark=n$,l$.builtInTheme={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"}}}},l$.transformerConstructor=a$,G(l$,MY),G(l$,BV);const h$=()=>{YR.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),YR.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),JH(),ON(),YR.registerAnimation("treemap",((t,e)=>({appear:r$(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:FD.disappear.duration}}))),VD(),YR.registerSeries(l$.type,l$)},c$=Object.assign(Object.assign({},qU),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),d$=Object.assign(Object.assign({},wF),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),u$={type:"fadeIn"};function p$(t,e){return"fadeIn"===e?u$:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class g$ extends UF{constructor(){super(...arguments),this._supportStack=!1}}class f$ extends fF{enableByType(t){return"dimension"!==t}}const m$="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",v$={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:m$,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:m$,fill:"#ddd"}}};class _$ extends ZU{constructor(){super(...arguments),this.type=cR.gaugePointer,this.transformerConstructor=g$,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(_$.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},_$.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(_$.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(){this._tooltipHelper=new f$(this),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=K(e),n=_t(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})}getInteractionTriggers(){return 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(IF(null===(i=YR.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),DF("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}_$.type=cR.gaugePointer,_$.mark=d$,_$.builtInTheme={gaugePointer:v$},_$.transformerConstructor=g$;const y$=()=>{YR.registerSeries(_$.type,_$),AV(),JH(),YR.registerAnimation("gaugePointer",((t,e)=>{const i=p$(t,e);return{appear:i,enter:i,disappear:{duration:FD.disappear.duration}}})),EU(),wU()};class b$ extends UF{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class x$ extends ZU{constructor(){super(...arguments),this.type=cR.gauge,this.transformerConstructor=b$,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=oe(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();_I(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[HO]=t[this._angleField[0]],t[jO]=e>0?i[e-1][HO]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(x$.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(x$.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})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e&&"segment"===e.name){const i=this.getSpec().segment;if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}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),s=bt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?TR(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?TR(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return p(t[jO])?this.angleAxisHelper.dataToPosition([t[jO]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[HO]])}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(IF(null===(i=YR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),DF("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}x$.type=cR.gauge,x$.mark=c$,x$.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},x$.transformerConstructor=b$;class S$ extends CD{constructor(){super(...arguments),this.type=S$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Eg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="rect":a.symbolType=o,a}}S$.type="cell";function A$(t){return!1===t?{}:{type:"fadeIn"}}class k$ extends fF{enableByType(t){return"dimension"!==t}}const M$=Object.assign(Object.assign({},wF),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class T$ extends UF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class w$ extends $F{constructor(){super(...arguments),this.type=cR.heatmap,this.transformerConstructor=T$}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(w$.mark.cell,{isSeriesMark:!0},{morph:jF(this._spec,w$.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(w$.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){var e,i,s;t&&this.setMarkStyle(t,{fill:null!==(s=null===(i=null===(e=this._spec.cell)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s: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=ai(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]}}getInteractionTriggers(){return 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=YF(this);this._cellMark.setAnimationConfig(IF(null===(i=YR.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),DF("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 k$(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}w$.type=cR.heatmap,w$.mark=M$,w$.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1},label:{style:{lineWidth:2}}}},w$.transformerConstructor=T$;const C$=()=>{ON(),YR.registerMark(S$.type,S$),YR.registerGraphicComponent("symbol",Eg),Jk(),tM(),kB(),YR.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},jD),{appear:A$(e)}))),Cj(),kj(),YR.registerSeries(w$.type,w$)},E$=Object.assign(Object.assign({},wF),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),B$=`${mO}_CORRELATION_X`,P$=`${mO}_CORRELATION_Y`,L$=`${mO}_CORRELATION_SIZE`,R$=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,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=oe(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=oe(null!==(s=e.endAngle)&&void 0!==s?s:270),A=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),k=Lt(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=Lt(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+Lt(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+Lt(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=Pt(e.field),C=t.map(w),[E,B]=Ot(C),P=E===B?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(B-E),L=u(e.radiusField)?w:Pt(e.radiusField),R=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=>R;if(L){const[i,s]=L!==w?Ot(t.map(L)):[E,B],n=null!==(f=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==f?f:5,r=null!==(v=null===(m=e.radiusRange)||void 0===m?void 0:m[1])&&void 0!==v?v:5;i!==s&&(O=t=>n+(r-n)*(L(t)-i)/(s-i))}const I=Math.min(b,x),D=Math.max(b,x),F=O$(I,D,t.length),z=[],j=(D-I)/60;return t.forEach(((t,e)=>{const i=P(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),I$({x:n,y:r,size:s},z)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=j,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},I$=(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,[bO]:null==n?void 0:n[bO],[SO]:null==n?void 0:n[SO]}};class F$ extends fN{constructor(){super(...arguments),this.type=F$.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=_t(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}F$.type="ripple";const z$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class j$ extends UF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class H$ extends KN{constructor(){super(...arguments),this.type=cR.correlation,this.transformerConstructor=j$,this._viewBox=new Ve}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;_I(this._dataSet,"correlation",R$);const s=new Ba;yI(s,"dataview",wa),_I(s,"correlationCenter",D$);const n=new Pa(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 AD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_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(){const e=this._createMark(H$.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:bO});e&&(e.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._nodePointMark=e);const i=this._createMark(H$.mark.ripplePoint,{key:bO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(this._ripplePointMark=i);const s=this._createMark(H$.mark.centerPoint,{key:bO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});s&&(s.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._centerPointMark=s)}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[B$],y:t=>t[P$],size:t=>t[L$],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.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)},t.STATE_VALUE_ENUM.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(IF(null===(e=YR.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),DF("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(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}H$.type=cR.correlation,H$.mark=E$,H$.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},H$.transformerConstructor=j$;const V$=()=>{yz(),mN(),tM(),YR.registerMark(F$.type,F$),YR.registerGraphicComponent("symbol",(t=>Eg(t))),YR.registerSeries(H$.type,H$),YR.registerAnimation("correlation",((t,e)=>Object.assign({appear:z$(0,e)},zD)))},N$=Object.assign(Object.assign({},wF),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class U$ extends fN{constructor(){super(...arguments),this.type=U$.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}U$.type="liquid";const W$=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class G$ extends fF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class Y$ extends WF{constructor(){super(...arguments),this.type=cR.liquid,this.transformerConstructor=bz,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Dg({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Eg({x:s,y:n,size:r,symbolType:W$(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=IR(this._spec.outlineMargin),this._paddingSpec=IR(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Yt(...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(Y$.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(Y$.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(Y$.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(Y$.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.created(),this.setMarkStyle(e,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new G$(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(IF(null===(i=YR.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),DF("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(IF(null===(s=YR.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),DF("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=kM(t.attribute.fill,n.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]}}Y$.type=cR.liquid,Y$.mark=N$,Y$.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},Y$.transformerConstructor=bz;const $$=t=>Y(t).join(",");class X$ extends fF{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>$$(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>$$(null==t?void 0:t[this.series.getDimensionField()[0]])}}const K$=Object.assign(Object.assign({},wF),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class q$ extends UF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const Z$=(t,e)=>{const i=e.getViewBox();return i&&(null==t?void 0:t.length)?mG(Object.assign({setField:e.setField,valueField:e.valueField},i),t):[]};class J$ extends WF{constructor(){super(...arguments),this.type=cR.venn,this.transformerConstructor=q$,this._viewBox=new Ve}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:xO)}initData(){var t;super.initData(),_I(this._dataSet,"venn",Z$),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:{getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField}})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(J$.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(J$.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()},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},t.STATE_VALUE_ENUM.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=>$$(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)}},t.STATE_VALUE_ENUM.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=>$$(t.sets)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new X$(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(){super.onLayoutEnd(),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:$$(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return $$(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[$$(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($$(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(IF(null===(e=YR.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),DF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(IF(null===(e=YR.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),DF(t.name,this._spec,this._markAttributeContext)))}))}}J$.type=cR.venn,J$.mark=K$,J$.builtInTheme={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"}}}}},J$.transformerConstructor=q$;class Q$ extends sV{constructor(){super(...arguments),this.type=cR.mosaic,this.transformerConstructor=iV}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(DO),this.setFieldX2(IO)),this.setFieldY(zO),this.setFieldY2(FO)):(t&&(this.setFieldY(DO),this.setFieldY2(IO)),this.setFieldX(zO),this.setFieldX2(FO)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&u(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];u(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}Q$.type=cR.mosaic,Q$.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},Q$.transformerConstructor=iV;class tX extends Zj{_isValidSeries(t){return t===cR.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class eX extends Kj{constructor(){super(...arguments),this.transformerConstructor=tX,this.type="map",this.seriesType=cR.map}}eX.type="map",eX.seriesType=cR.map,eX.transformerConstructor=tX;class iX extends Zj{_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,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],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 sX extends iX{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_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=Lz(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,GR({},s,l)),n&&Object.assign(o,GR({},n,o))}}class nX extends iX{needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}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 rX extends iX{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class aX extends Kj{constructor(){super(...arguments),this.transformerConstructor=rX}}aX.transformerConstructor=rX;class oX extends aX{constructor(){super(...arguments),this.transformerConstructor=rX,this.type="pie",this.seriesType=cR.pie}}oX.type="pie",oX.seriesType=cR.pie,oX.transformerConstructor=rX;class lX extends nX{_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return n.radius=null!==(e=t.radius)&&void 0!==e?e:Xz,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:Xz,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}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=>GR({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const hX=(t,e)=>{if(!t)return null;const i=oz(t,(t=>"angle"===t.getOrient()),e),s=oz(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&UC(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=eR({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=K(e),n=X(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=iR(d),f=null===(e=s[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 _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=rz(v,t,"polar",r);n.push({index:_,value:v,position:i.scale(v),axis:t,data:y})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&UC(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=eR({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=iR(c),g=null===(e=i[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=s.invert(p);if(u(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const _=rz(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:_})}})),n.length?n:null};class cX extends Kj{constructor(){super(...arguments),this.transformerConstructor=lX,this.type="rose",this.seriesType=cR.rose}_setModelOption(){this._modelOption.getDimensionInfo=hX}}cX.type="rose",cX.seriesType=cR.rose,cX.transformerConstructor=lX,G(cX,iH);class dX extends nX{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t);return i.line=t.line,i.point=t.point,i.stack=t.stack,i.percent=t.percent,i.area=GR({visible:!1},t.area),i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"area",i.activePoint=t.activePoint,i.pointDis=t.pointDis,i.pointDisMul=t.pointDisMul,i.markOverlap=t.markOverlap,i}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=>GR({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class uX extends Kj{constructor(){super(...arguments),this.transformerConstructor=dX,this.type="radar",this.seriesType=cR.radar}_setModelOption(){this._modelOption.getDimensionInfo=hX}}uX.type="radar",uX.seriesType=cR.radar,uX.transformerConstructor=dX,G(uX,iH);class pX extends Zj{_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=>{L(e,"trimPadding")&&GR(e,$I(this.type,t))})),this._transformAxisSpec(t)}}class gX extends Kj{constructor(){super(...arguments),this.transformerConstructor=pX,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=uH(t,e,i))&&void 0!==s?s:[],...null!==(n=hX(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=gH,this._modelOption.getRectByDimensionData=bH}}gX.type="common",gX.transformerConstructor=pX,G(gX,iH);class fX extends Jj{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class mX extends Kj{constructor(){super(...arguments),this.transformerConstructor=fX}}mX.transformerConstructor=fX,G(mX,iH);class vX extends fX{transformSpec(t){super.transformSpec(t),WI(t)}}class _X extends mX{constructor(){super(...arguments),this.transformerConstructor=vX,this.type="histogram",this.seriesType=cR.bar}_setModelOption(){this._modelOption.getDimensionInfo=uH,this._modelOption.getDimensionInfoByValue=gH,this._modelOption.getRectByDimensionData=bH}}_X.type="histogram",_X.seriesType=cR.bar,_X.transformerConstructor=vX;class yX extends sX{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class bX extends Kj{constructor(){super(...arguments),this.transformerConstructor=yX,this.type="circularProgress",this.seriesType=cR.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=hX}}bX.type="circularProgress",bX.seriesType=cR.circularProgress,bX.transformerConstructor=yX,G(bX,iH);class xX extends sX{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=cR.circularProgress,e}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===cR.gauge||t.type===cR.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===cR.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 SX extends Kj{constructor(){super(...arguments),this.transformerConstructor=xX,this.type="gauge",this.seriesType=cR.gaugePointer}}SX.type="gauge",SX.seriesType=cR.gaugePointer,SX.transformerConstructor=xX;class AX extends Zj{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class kX extends Kj{constructor(){super(...arguments),this.transformerConstructor=AX,this.type="wordCloud",this.seriesType=cR.wordCloud}}kX.transformerConstructor=AX;class MX extends kX{constructor(){super(...arguments),this.transformerConstructor=AX,this.type="wordCloud",this.seriesType=cR.wordCloud}}MX.type="wordCloud",MX.seriesType=cR.wordCloud,MX.transformerConstructor=AX;class TX extends Zj{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class wX extends Kj{constructor(){super(...arguments),this.transformerConstructor=TX,this.type="funnel",this.seriesType=cR.funnel}}wX.type="funnel",wX.seriesType=cR.funnel,wX.transformerConstructor=TX;class CX extends Jj{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}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=Lz(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=Lz(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class EX extends Kj{constructor(){super(...arguments),this.transformerConstructor=CX,this.type="linearProgress",this.seriesType=cR.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=uH,this._modelOption.getDimensionInfoByValue=gH,this._modelOption.getRectByDimensionData=bH}}EX.type="linearProgress",EX.seriesType=cR.linearProgress,EX.transformerConstructor=CX,G(EX,iH);class BX extends Jj{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"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),WI(t)}}class PX extends Kj{constructor(){super(...arguments),this.transformerConstructor=BX,this.type="rangeColumn",this.seriesType=cR.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=uH,this._modelOption.getDimensionInfoByValue=gH,this._modelOption.getRectByDimensionData=bH}}PX.type="rangeColumn",PX.seriesType=cR.rangeColumn,PX.transformerConstructor=BX;class LX extends Zj{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+le(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class RX extends Kj{constructor(){super(...arguments),this.transformerConstructor=LX,this.type="sunburst",this.seriesType=cR.sunburst}}RX.type="sunburst",RX.seriesType=cR.sunburst,RX.transformerConstructor=LX;class OX extends Zj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class IX extends Kj{constructor(){super(...arguments),this.transformerConstructor=OX,this.type="circlePacking",this.seriesType=cR.circlePacking}}IX.type="circlePacking",IX.seriesType=cR.circlePacking,IX.transformerConstructor=OX;class DX extends Zj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class FX extends Kj{constructor(){super(...arguments),this.transformerConstructor=DX,this.type="treemap",this.seriesType=cR.treemap}}FX.type="treemap",FX.seriesType=cR.treemap,FX.transformerConstructor=DX;class zX extends rV{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),WI(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class jX extends aV{constructor(){super(...arguments),this.transformerConstructor=zX,this.type="waterfall",this.seriesType=cR.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=uH,this._modelOption.getDimensionInfoByValue=gH,this._modelOption.getRectByDimensionData=bH}}jX.type="waterfall",jX.seriesType=cR.waterfall,jX.transformerConstructor=zX;class HX extends Jj{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),WI(t)}}class VX extends Kj{constructor(){super(...arguments),this.transformerConstructor=HX,this.type="boxPlot",this.seriesType=cR.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=uH,this._modelOption.getDimensionInfoByValue=gH,this._modelOption.getRectByDimensionData=bH}}VX.type="boxPlot",VX.seriesType=cR.boxPlot,VX.transformerConstructor=HX;class NX extends Zj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class UX extends Kj{constructor(){super(...arguments),this.transformerConstructor=NX,this.type="sankey",this.seriesType=cR.sankey}_setStateInDatum(t,e,i,s){const n=y(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=aI(t))||void 0===e?void 0:e.datum;return y(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}UX.type="sankey",UX.seriesType=cR.sankey,UX.transformerConstructor=NX;class WX extends Jj{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.area=t.area,s.point=t.point,s.line=t.line,"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),WI(t)}}class GX extends Kj{constructor(){super(...arguments),this.transformerConstructor=WX,this.type="rangeArea",this.seriesType=cR.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=uH,this._modelOption.getDimensionInfoByValue=gH,this._modelOption.getRectByDimensionData=bH}}GX.type="rangeArea",GX.seriesType=cR.rangeArea,GX.transformerConstructor=WX;class YX extends Jj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class $X extends Kj{constructor(){super(...arguments),this.transformerConstructor=YX,this.type="heatmap",this.seriesType=cR.heatmap}}$X.type="heatmap",$X.seriesType=cR.heatmap,$X.transformerConstructor=YX;class XX extends Zj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class KX extends Kj{constructor(){super(...arguments),this.transformerConstructor=XX,this.type="correlation",this.seriesType=cR.correlation}}KX.type="correlation",KX.seriesType=cR.correlation,KX.transformerConstructor=XX;function qX(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=nI(t.style)),P(t.textStyle)||GR(s.textStyle,nI(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&nI(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&nI(s.background.style),s}const ZX=(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},JX=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const u={};c.forEach((t=>{u[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:SO;return h?h(t,c,g):(y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===u[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===u[t.source]&&!0===u[t.target])))):p(g)&&(t=t.filter((t=>!0===u[r.getSeriesFieldValue(t,g)]))),t)};class QX extends tj{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:()=>{nR(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),nR(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=ER(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()}_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):(U(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new AD(this._option,e),this._initSelectedData(),nR(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(nR(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)U(s,this._cacheAttrs)||this._legendComponent.setAttributes(GR({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(GR({},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;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());U(t,this._cacheAttrs)||this._legendComponent.setAttributes(GR({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}QX.specKey="legends";class tK extends QX{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return aF(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),nR(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){_I(this._option.dataSet,"discreteLegendFilter",JX),_I(this._option.dataSet,"discreteLegendDataMake",ZX);const t=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return nR(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(!Jy(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=GO(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 s=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:n={},item:r={},pager:a={},background:o={}}=t;n=I(n),r=I(r),a=I(a),o=I(o);const l=s;return n.visible?l.title=qX(n):l.title={visible:!1},P(r.focusIconStyle)||nI(r.focusIconStyle),r.shape&&(r.shape=eI(r.shape)),r.label&&(r.label=eI(r.label)),r.value&&(r.value=eI(r.value)),r.background&&(r.background=eI(r.background)),BR(r.maxWidth)&&(r.maxWidth=Number(r.maxWidth.substring(0,r.maxWidth.length-1))*i.width/100),BR(r.width)&&(r.width=Number(r.width.substring(0,r.width.length-1))*i.width/100),BR(r.height)&&(r.height=Number(r.height.substring(0,r.height.length-1))*i.width/100),l.item=r,"scrollbar"===a.type?(P(a.railStyle)||nI(a.railStyle),P(a.sliderStyle)||nI(a.sliderStyle)):(P(a.textStyle)||nI(a.textStyle),a.handler&&eI(a.handler)),l.pager=a,o.visible&&!P(o.style)&&(GR(l,o.style),p(o.padding)&&(l.padding=o.padding)),l}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return uL}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(rL.legendItemClick,(i=>{const s=L(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(rL.legendItemHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(rL.legendItemUnHover,(e=>{const i=L(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}=rF(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=rF(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}tK.specKey="legends",tK.builtInTheme={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}},tK.type=r.discreteLegend;const eK=(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[]},iK=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=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(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?tI(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};function sK(t){const i=GR({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:u={},type:g,id:f,visible:m,orient:v,position:_,data:y,defaultSelected:b,field:x,filter:S,regionId:A,regionIndex:k,seriesIndex:M,seriesId:T,padding:w}=i,C=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?C.title=qX(s):C.title={visible:!1},C.showHandler=!1!==n.visible,P(n.style)||(C.handlerStyle=nI(n.style)),p(r.width)&&(C.railWidth=r.width),p(r.height)&&(C.railHeight=r.height),P(r.style)||(C.railStyle=nI(r.style)),P(a.style)||(C.trackStyle=nI(a.style)),C.startText=eI(o),C.endText=eI(l),C.handlerText=function(t){if(!t)return t;const e=Object.assign({},t),i=t.style;return d(i)?e.style=(t,e,s)=>nI(i(t,e,s)):P(i)||(e.style=nI(i)),e}(h),P(c)||(C.sizeBackground=nI(c)),u.visible&&!P(u.style)&&(GR(C,u.style),p(u.padding)&&(C.padding=u.padding)),C}const nK={color:vL,size:yL},rK={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}},aK=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},rK),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},oK={horizontal:aK(!0),vertical:aK(!1)},lK=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},rK),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},hK={horizontal:lK(!0),vertical:lK(!1)},cK=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],dK=[2,10];class uK extends QX{static getSpecInfo(t){const e=aF(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}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(e){super.init(e),nR(this._regions,(e=>{e.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:e.isHierarchyData,customFilter:this._spec.customFilter},level:t.TransformLevel.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(){_I(this._option.dataSet,"continuousLegendFilter",iK),_I(this._option.dataSet,"continuousLegendDataMake",eK);const t=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>rR(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=GO(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!Jy(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=GO(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var e,i;const s="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",n="horizontal"===s?"bottom":this.layoutOrient;let r=[];const a=this._getScaleInGlobal();a&&"linear"===a.type&&(r=a.range()),P(r)&&(r="color"===this._legendType?cK:dK);let o=null!==(e=this._legendData.getLatestData()[0])&&void 0!==e?e:0,l=null!==(i=this._legendData.getLatestData()[1])&&void 0!==i?i:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(o=Math.min(0,this._legendData.getLatestData()[0]),l=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const h=Object.assign({layout:s,align:n,zIndex:this.layoutZIndex,min:o,max:l,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:r},sK(this._spec));return this._addDefaultTitleText(h),h}_getLegendConstructor(){return nK[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",St((i=>{const s=L(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}uK.specKey="legends",uK.builtInTheme={colorLegend:oK,sizeLegend:hK},uK.type=r.continuousLegend;const pK=(t,e)=>p(e)?t.map((t=>e[t])):void 0,gK=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),fK=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function mK(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),d=i.getOption(),g=d.getRegionsInUserIdOrIndex(p(c.regionId)?[c.regionId]:void 0,p(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=vK(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),_=g.getLayoutRect(),y=d.globalInstance.getContainer(),b=Object.assign({x:0,y:0},y?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(y):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>gK(i,s)(t)&&gK(n,r)(t)&&(u(a)||gK([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),A=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),_.width),y:Math.min(Math.max(t.y,0),_.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.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 l=[{value:t[e.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=>x(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=d.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:uI.chart,event:A({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=d.globalInstance;return tF.globalConfig.uniqueTooltip&&tF.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=d.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:uI.chart,event:A(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=d.globalInstance;return tF.globalConfig.uniqueTooltip&&tF.hideTooltip(a.id),m}return"none"}const vK=(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(),f=p(g)?t[g]:void 0,m=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=pK(c,t);let _=pK(d,t);const y=fK(_),b=!y&&p(g)&&u(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(gK(c,v));if(!y&&(_=pK(d,i),!fK(_)))return;const n=e.type===cR.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:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=UC(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(gK(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=pK(d,o),!fK(_))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(gK(c,n));if(!y&&(_=pK(d,r),!fK(_)))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:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===cR.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(gK(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(_=pK(d,i),!fK(_))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&&(()=>{var i,n,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(gK(c,v));const o=e.getNameMap(),l=null===(r=null===(n=e.getMapViewData)||void 0===n?void 0:n.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=_;if(l&&!a&&(a=Object.assign({},t)),!y){if(_=pK(d,a),h=_,!fK(_)&&!a)return;fK(_)||(_=[null])}const p=e.dataToPosition(a);u(p)||isNaN(p.x)||isNaN(p.y)||s.push({pos:p,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:h,hasMeasureData:y,groupField:g,groupData:f,originDatum:a},series:e})})()})),s},_K=t=>p(t)&&!y(t),yK=t=>p(t)&&y(t);class bK extends Qz{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i,s,n;const{spec:r,theme:a}=super._initTheme(t,e);return r.style=GR({},this._theme,r.style),r.offset=GR({},a.offset,t.offset),r.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:a.transitionDuration,r.trigger=null!==(s=t.trigger)&&void 0!==s?s:a.trigger,r.triggerOff=null!==(n=t.triggerOff)&&void 0!==n?n:a.triggerOff,{spec:r,theme:a}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(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]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:Xy(this._option.mode)||!Yy(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.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?_(t.parentElement)&&(t.parentElement=k_.getElementById(t.parentElement)):Yy(this._option.mode)&&(t.parentElement=null==Gy?void 0:Gy.body)}}const xK={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}};class SK extends tj{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=bK,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=Yy(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&_K(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!u(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&tF.globalConfig.uniqueTooltip&&l&&tF.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;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;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:uI.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(null==r?void 0:r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:uI.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),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,this._enterable=!1;else{const t="canvas"===s?kH.canvas:kH.dom,n=YR.getComponentPluginInType(t);n||Ny("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,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=YR.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=Y(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),($y(s)||Xy(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,At(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===s||s.call(i)}else 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=mK(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_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(yK(t)){if(_K(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>sz(t,e[i])))}if(yK(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.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: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}getVisible(){return!1!==this._spec.visible}}SK.type=r.tooltip,SK.transformerConstructor=bK,SK.builtInTheme={tooltip:xK},SK.specKey="tooltip";var AK,kK;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(AK||(AK={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(kK||(kK={}));const MK={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class TK extends tj{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=At((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},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.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{UC(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_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}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(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(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:pI.chart}:{source:uI.chart};y(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,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)}onBeforeRender(){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"}:$y(e)||Xy(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:uI.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:uI.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:uI.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=L(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{MK[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=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const u=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+u.left),o=Math.min(o,i-d+u.top),l=Math.max(l,e+t.getLayoutRect().width-c-u.right),h=Math.max(h,i+t.getLayoutRect().height-d-u.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_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)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_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 i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=L(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=L(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:d}=n,u=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:L(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{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||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}TK.specKey="crosshair";const wK={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}}}}};class CK extends TK{static getSpecInfo(t){return aF(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_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)}}_getDatumAtPoint(t,e){const i=XF(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){XF(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:KF(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();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 o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=aR(this._regions,"cartesian");e&&(fH(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=_H(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new lT(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new hT(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}CK.specKey="crosshair",CK.builtInTheme={crosshair:wK},CK.type=r.cartesianCrosshair;class EK extends TK{static getSpecInfo(t){return aF(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_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)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_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}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=aR(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&p(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=Pz(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=rF(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:ce(d,a.getInnerRadius(),o),end:ce(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=ue(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=ce(t,o,r),d=ce(t,o,h),m=_e([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=_t(ae.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new lT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new dT(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new uT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new cT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=pe(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}}(u):function(t){let e="center",i="middle";return e=(t=pe(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}}(g.startAngle),a="angle"===l?ce(e,p[1]+m.offset,u):ce(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}EK.specKey="crosshair",EK.builtInTheme={crosshair:wK},EK.type=r.polarCrosshair;const BK=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(u(o)||u(a))return t;const l=r(),h=y(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},PK=(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=>{let e=!1;return Y(r).every((i=>{t[i]>=a[0]&&t[i]<=$(a)&&(e=!0)})),e}:t=>{let e=!1;return Y(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},LK=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],d=[],g=[];let f=!1,m=!1;n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);p(null==t?void 0:t.max)&&p(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{u(h[t])&&(g.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(h[t[i]])&&(g.push(t[i]),h[t[i]]=0,c.push(t[i])),u(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const v=f?g:!1===r||m?g.sort(((t,e)=>t-e)):c;return v.forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),d.push(e)})),d},RK=(t,e,i)=>{const s=e.domain();if(VC(e.type))return i?s[0]+($(s)-s[0])*(1-t):s[0]+($(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+($(n)-n[0])*t;return e.invert(r)},OK=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&VC(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/($(n)-n[0])))},IK=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},DK=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}},FK=(t,e,i)=>"start"===t?"percent"===e&&p(i.start)||"value"===e&&p(i.startValue):"percent"===e&&p(i.end)||"value"===e&&p(i.endValue),zK=(t,e,i)=>{if(VC(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class jK{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})}constructor(t,e,i,s,n,r,a,o){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.initZoomEvent=()=>{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,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),d=Math.abs(this.getState().start-this.getState().end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=_t(this.getState().start+f,0,1),_=_t(this.getState().end-m,0,1);this._handleChange(Math.min(v,_),Math.max(v,_),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Ut(s/n)>=.5:Ut(n/s)>=.5;if(this._scrollAttr.reverse||(r=-r),a){const t=this._spec.scrollStep;if(k(t)){r=(r>0?1:-1)*(t*(this.getState().end-this.getState().start)/1)}this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1)}const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))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.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===JF(ZF(e))}setEventAttrFromSpec(){!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=j({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=j({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=j({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,c(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&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.getEvent(),this._option.mode)}}G(jK,BV);class HK extends tj{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:OK(t,this._stateScale,this._isHorizontal),a="percent"===n?e:OK(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var e;this._dataFilterEvent.initZoomEvent(),null===(e=this._relatedAxisComponent)||void 0===e||e.event.on(t.ChartEvent.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_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)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=IK(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[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._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._currentDataCollection=[],this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=zK(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!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&&DK(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({value:"force"})}else nR(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),nR(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=ZF(t),this._isHorizontal="horizontal"===JF(this._orient),this._dataFilterEvent=new jK(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){this._handleDataCollectionChangeBound=this._handleDataCollectionChange.bind(this),super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(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])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(VC(n.type)){const r=n.domain(),a=r[0],o=$(r)-a,l=p(t)?a+o*t:+e,h=p(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=p(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=p(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}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}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_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=>JF(t._orient)===JF(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!VC(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;}_collectDataInfo(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};nR(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l,u=VC(d.getScale(0).type),p=VC(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?Y(g.xField):Y(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?Y(g.yField):Y(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:d===l?f:m;u&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else nR(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});return{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}}_initData(){const{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}=this._collectDataInfo(),{dataSet:r}=this._option;yI(r,"dataview",wa),_I(r,"dataFilterComputeDomain",LK);const a=new Pa(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new AD(this._option,a),a.reRunAllTransform(),this._currentDataCollection=t,r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChangeBound)}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(_I(this._option.dataSet,"dataFilterWithNewDomain",PK),_I(this._option.dataSet,"lockStatisticsFilter",BK),nR(this._regions,(e=>{e.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>e.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>VC(this._stateScale.type)},level:1},!1),e.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>VC(this._stateScale.type)},level:t.TransformLevel.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r}=this._collectDataInfo();if(this._currentDataCollection.length!==e.length||this._currentDataCollection.some(((t,i)=>t!==e[i]))){this._currentDataCollection.forEach((t=>{var e;null===(e=null==t?void 0:t.target)||void 0===e||e.removeListener("change",this._handleDataCollectionChangeBound)})),this._currentDataCollection=e;const{dataSet:t}=this._option;t.multipleDataViewAddListener(this._currentDataCollection,"change",this._handleDataCollectionChangeBound)}this._data.getDataView().transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data.getDataView().reRunAllTransform();const a=this._computeDomainOfStateScale(VC(this._stateScale.type));this._stateScale.domain(a,!1),(p(this._spec.start)||p(this._spec.end))&&this._setStateFromSpec(),this._handleChange(this._start,this._end,!0),this._spec.auto&&!U(this._domainCache,a)&&(this._domainCache=a,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;FK("start",i,this._spec)&&FK("end",s,this._spec)&&(t="percent"===i?this._spec.start:OK(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:OK(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?OK(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?OK(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=RK(this._start,this._stateScale,IK(i,this._isHorizontal)),this._endValue=RK(this._end,this._stateScale,IK(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,VC(this._stateScale.type)&&this._stateScale.domain()[0]!==$(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=zK(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&nR(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);k(null==i?void 0:i.min)&&k(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new PE:new cE,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_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?[K(t),X(t)]:[-1/0,1/0]}return e}_autoVisible(e){if(!this._auto)return;e?this.show():this.hide();const i=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[i]:e?this[`_${i}`]:0},{[i]:t.AttributeLevel.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_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=DK(h);if(!this._dataUpdating&&UC(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,UC(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),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}G(HK,BV);class VK extends Qz{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=GR({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}}}const NK=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),UK={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:NK(!1),startHandler:{style:{symbolType:"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;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"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;",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:NK(!0)};class WK extends HK{constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=VK,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=this._isHorizontal?0:this._middleHandlerSize,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=this._isHorizontal?0:this._middleHandlerSize,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._getPreviewStateScale(),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._getPreviewStateScale(),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"}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange)if(s&&this._component)this._component.setStartAndEnd(e,i);else{const s=this._relatedAxisComponent,r=RK(e,this._stateScale,IK(s,this._isHorizontal)),a=RK(i,this._stateScale,IK(s,this._isHorizontal));if(!p(r)||!p(a))return;this._start=e,this._end=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(){this._data.getDataView().reRunAllTransform(),this._initAfterLayout();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new PE),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(IK(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=IK(t,this._isHorizontal),this.effect.onZoomChange())}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,d=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+d,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+d),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);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(),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=isNaN(c)?this._backgroundSize:c-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=isNaN(c)?this._backgroundSize:c-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,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new PE;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(IK(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[K(e),X(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!VC(t.type)||e[0]!==$(e))&&(!UC(t.type)||1!==(i=e,i&&y(i)?Array.from(new Set(Y(i))):i).length);var i}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_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:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_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._computeWidth(),height:this._computeHeight()},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,isReverse:IK(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=!1!==this._spec.showBackgroundChart,i=this._getAttrs(e),s=this._relatedAxisComponent;if(this._component)this._component.setAttributes(i),t&&(this._component.setPreviewData(this._data.getDataView().latestData),e&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>RK(t,this._stateScale,IK(s,this._isHorizontal))))));else{const t=this.getContainer();this._component=new aP(i),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?e&&this._component.setPreviewPointsY1(this._dataToPositionY2):e&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>RK(t,this._stateScale,IK(s,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:nI(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:nI(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:nI(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:nI(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:nI(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:nI(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:nI(g.style)},selectedBackgroundStyle:nI(this._spec.selectedBackground.style),dragMaskStyle:nI(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:GR(nI(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},nI(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:GR(nI(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},nI(null===(d=m.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}=rF(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(IK(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}}WK.type=r.dataZoom,WK.transformerConstructor=VK,WK.builtInTheme={dataZoom:UK},WK.specKey="dataZoom";const GK={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}};class YK extends HK{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"}_handleChange(e,i,s){super._handleChange(e,i,s);const n=KL(this._start,e)&&KL(this._end,i);if(this._shouldChange&&(!n||!1===this._spec.realTime)){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this._relatedAxisComponent,r=IK(n,this._isHorizontal),a=RK(e,this._stateScale,r),o=RK(i,this._stateScale,r);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,a,o):this._handleStateChange(a,o))&&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(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r,a;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,minSliderSize:null===(a=this._spec)||void 0===a?void 0:a.minSliderSize},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new pM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=nI(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=nI(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}YK.type=r.scrollBar,YK.builtInTheme={scrollBar:GK},YK.specKey="scrollBar";const $K=(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},XK=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),KK={title:{visible:!0,autoLimit:!1,autoFit:!1,style:XK("l1FontSize","primaryFontColor")},content:{visible:!0,style:XK("l2FontSize","tertiaryFontColor")}};class qK extends tj{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){return aF(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}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))}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(aI(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(aI(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){_I(this._option.dataSet,"indicatorFilter",$K);const t=new Pa(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 AD(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:i,height:s}=t.getLayoutRect(),{x:n,y:r}=t.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,u=e(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return Y(o).forEach((t=>{const e=GR({},this._theme.content,t);g.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({},sI(H(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?FR(l,this._computeLayoutRadius()):0,dy:h?FR(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!p(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},sI(H(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},u)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)U(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new SL(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_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.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}qK.type=r.indicator,qK.builtInTheme={indicator:KK},qK.specKey="indicator";const ZK=["sum","average","min","max","variance","standardDeviation","median"];function JK(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=K(s),r=X(s);return er}function QK(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&JK(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=BR(t.x)?sq(t.x,n)+r.x:nq(l.getXAxisHelper(),[t.x])+r.x,h}function tq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&JK(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=BR(t.y)?sq(t.y,n)+r.y:nq(l.getYAxisHelper(),[t.y])+r.y,h}function eq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&JK(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)),nq(a.angleAxisHelper,[t.angle])}function iq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&JK(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)),nq(a.radiusAxisHelper,[t.radius])}function sq(t,e){return Number(t.substring(0,t.length-1))*e/100}function nq(t,e){const i=t.getScale(0);return VC(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function rq(t){return ZK.includes(t)}function aq(t,e,i,s,n,r=!1){const a=e.getRegion(),o=a.getLayoutStartPoint(),l=i.getRegion(),h=l.getLayoutStartPoint(),c=Math.abs(Math.min(o.x,h.x)-Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width)),d=Math.abs(Math.min(o.y,h.y)-Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height)),u={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},g=[],f=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper(),v=s.getYAxisHelper(),_=m.getScale(0).domain(),y=v.getScale(0).domain(),b=r&&!m.isContinuous&&!!m.getBandwidth,x=r&&!v.isContinuous&&!!v.getBandwidth,S={min:null,max:null},A={min:null,max:null};return f.forEach((t=>{const e=p(t.x),i=p(t.y);let s,r;if(e&&i)s=QK(t,_,n,u,c,o),r=tq(t,y,n,u,d,o),oq(s,b,S,g.length),oq(r,x,A,g.length),g.push([{x:s,y:r}]);else if(e){s=QK(t,_,n,u,c,o),r=Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height);const e=Math.min(o.y,h.y);oq(s,b,S,g.length),g.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(o.x,h.x),r=tq(t,y,n,u,d,o);const e=Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width);oq(r,x,A,g.length),g.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(g,m,v,S,A),g}function oq(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=eq(t,l,n,r),i=iq(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=eq(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=iq(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function hq(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:f}=u.getLayoutRect();let m=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(m=BR(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=BR(i)?Number(i.substring(0,i.length-1))*f/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])&&JK(_,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])&&JK(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:nq(d.getXAxisHelper(),b)+p.x+m,y:nq(d.getYAxisHelper(),x)+p.y+v})})),n}function cq(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])&&JK(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])&&JK(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:nq(l.angleAxisHelper,d),radius:nq(l.radiusAxisHelper,u)})})),s}function dq(t,e,i){let{x:s,y:n}=t;return BR(s)&&(s=sq(s,e)),BR(n)&&(n=sq(n,i)),{x:s,y:n}}function uq(t,e,i){let s;if(s=d(t)?Y(t(e.getData().getLatestData(),e)):Y(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=dq(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>dq(t,n,r)))}function pq(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 gq(t,i,s){const{labelBackground:n={},style:r,shape:a}=t,o=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},nI(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},mq(nI(n.style),i,s)),p(n.padding)&&(t.padding=ai(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=mq(nI(r),i,s)),t}return{visible:!1}}function fq(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function mq(t,e,i){return d(t)?t(e,i):t}function vq(t,e){return d(t)?t(e):t}function _q(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 yq(t){return{isXProcess:p(t.x),isYProcess:p(t.y),isX1Process:p(t.x1),isY1Process:p(t.y1),isAngleProcess:p(t.angle),isRadiusProcess:p(t.radius),isAngle1Process:p(t.angle1),isRadius1Process:p(t.radius1),isCoordinatesProcess:p(t.coordinates),isValidProcess:p(t.process)}}function bq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=yq(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:h&&(!c||"process"in t&&"xy"in t.process)}}function xq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=yq(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function Sq(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function Aq(t,i){let s;if(i.coordinates){const t=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=t,o=e(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(d(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=Y(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;p(r)&&(c=Y(i)[r]),n&&Y(i).includes(n)&&(c=n);let d=s;p(l)&&(d=Y(s)[l]),a&&Y(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),_(t[c])&&rq(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),_(t[d])&&rq(t[d])?h.y={field:d,aggrType:t[d]}:h.y=Y(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;p(r)&&(a=Y(s)[r]),n&&Y(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),_(t[a])&&rq(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),_(t[l])&&rq(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=Y(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const s=e.x;y(s)?i.x=s.map((i=>Mq(i,t,e))):i.x=Mq(s,t,e)}if(p(e.y)){const s=e.y;y(s)?i.y=s.map((i=>Mq(i,t,e))):i.y=Mq(s,t,e)}if(p(e.angle)){const s=e.angle;y(s)?i.angle=s.map((i=>Mq(i,t,e))):i.angle=Mq(s,t,e)}if(p(e.radius)){const s=e.radius;y(s)?i.radius=s.map((i=>Mq(i,t,e))):i.radius=Mq(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=Mq(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const kq={min:(t,e)=>qL(t[0].latestData,e.field),max:(t,e)=>ZL(t[0].latestData,e.field),sum:function(t,e){return JL(t[0].latestData,e.field)},average:function(t,e){return QL(t[0].latestData,e.field)},variance:function(t,e){return tR(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(tR(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return dt(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function Mq(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(m(t)){const{aggrType:i,field:s}=t;return kq[i](e,{field:s})}return t}function Tq(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 wq extends tj{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){return aF(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_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)&&rq(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){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Ba;return e.registerParser("array",s),new Pa(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)))}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=aR(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){u(this._spec.offsetX)||(this._layoutOffsetX=LR(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=LR(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();_I(this._option.dataSet,"markerAggregation",Aq),_I(this._option.dataSet,"markerFilter",Tq);const i=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),i.target.on("change",(()=>{this._markerLayout()})),this._markerData=i}}function Cq(t,e){return function(t,e,i){const{predict:s}=Ft(t,(t=>t[e]),(t=>t[i])),n=qL(t,e),r=ZL(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class Eq extends wq{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}=bq(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;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={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},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:mq(nI(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>gq(t,this._markerData,this._markAttributeContext))),state:{line:fq(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:fq(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:fq(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return fq(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return fq(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:mq(nI(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:mq(nI(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||Y(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=pq([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=Y(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,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}=bq(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;_I(this._option.dataSet,"markerAggregation",Aq),_I(this._option.dataSet,"markerRegression",Cq),_I(this._option.dataSet,"markerFilter",Tq);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new Pa(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",(()=>{this._markerLayout()})),this._markerData=m}}Eq.specKey="markLine";const Bq=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),Pq={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"}}},refY:5},Lq={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:Bq(!1),endSymbol:Bq(!0),label:Pq};class Rq extends Eq{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new GP(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:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:_}=bq(e);let y=[];if(u||f||g||m||v||a&&l||a&&h){const t=aq(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=hq(i,r,d,e.coordinatesOffset):c&&(y=uq(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n;const r=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const n=this._startRelativeSeries,a=this._endRelativeSeries,{multiSegment:o,mainSegmentIndex:l}=this._spec.line||{},{connectDirection:h,expandDistance:c=0}=this._spec;let d;if(BR(c)){const t=n.getRegion(),e=t.getLayoutStartPoint(),i=a.getRegion(),s=i.getLayoutStartPoint();if("bottom"===h||"top"===h){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));d=Number(c.substring(0,c.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));d=Number(c.substring(0,c.length-1))*n/100}}else d=c;const{points:u,limitRect:g}=r;if(!u||u.length<2)return void(null===(t=this._markerComponent)||void 0===t||t.setAttributes(r));const f=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}(u[0],u[1],h,d);let m;m=o&&p(l)?{position:"middle",autoRotate:!1}: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)}:{}}(u[0],u[1],h,d));const v=Y((null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{}).label),_=Y(r.label),y=Y(this._spec.label);null===(s=this._markerComponent)||void 0===s||s.setAttributes({points:o?[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]]]:f,label:_.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=m.dx)&&void 0!==i?i:0,h=null!==(s=m.dy)&&void 0!==s?s:0;const c=null!==(n=y[e])&&void 0!==n?n:y[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),m),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=v[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:g,multiSegment:o,mainSegmentIndex:l,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(n=this._markerComponent)||void 0===n||n.setAttributes(r)}_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}=bq(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 Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&p(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&p(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&p(n.process.xy)){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}}}Rq.type=r.markLine,Rq.coordinateType="cartesian",Rq.builtInTheme={markLine:Lq};class Oq extends Eq{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=bq(this._spec);return e||i?new XP(t):new GP(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}=bq(e);let p=[],g={};const f={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=lq(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:f}:{points:p.map((t=>ce(f,t.radius,t.angle)))}}else u&&(p=cq(i,r,a),g={points:p.map((t=>ce(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=bq(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}}}Oq.type=r.polarMarkLine,Oq.coordinateType="polar",Oq.builtInTheme={polarMarkLine:Lq};class Iq extends tj{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=ER(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return aF(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}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;if(!1===this._spec.visible)return{visible:!1};const a=this.getLayoutRect(),o=LR(this._spec.width,a.width,null,a.width),l=LR(this._spec.maxWidth,a.width,null,a.width),h=Math.max(Math.min(o,l,a.width),0),c=p(this._spec.text)&&""!==this._spec.text,d=p(this._spec.subtext)&&""!==this._spec.subtext,u=Object.assign(Object.assign({},H(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:c?this._spec.text:void 0,subtextType:null!==(e=this._spec.subtextType)&&void 0!==e?e:"text",subtext:d?this._spec.subtext:void 0,x:null!==(i=this._spec.x)&&void 0!==i?i:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:h,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(n=this._spec.align)&&void 0!==n?n:"left",verticalAlign:null!==(r=this._spec.verticalAlign)&&void 0!==r?r:"top",textStyle:Object.assign({maxLineWidth:h},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:h},this._spec.subtextStyle)});if(c&&(u.textStyle.width=h),d&&(u.subtextStyle.width=h),p(this._spec.width)){const t=Math.max(Math.min(o,a.width),0);c?u.textStyle.width=t:delete u.textStyle.width,d&&(u.subtextStyle.width=t)}return u}_createOrUpdateTitleComponent(t){if(this._titleComponent)U(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new bL(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}}Iq.type=r.title,Iq.specKey=r.title,Iq.builtInTheme={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"}}}};class Dq extends wq{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=xq(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={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:mq(nI(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>gq(t,this._markerData,this._markAttributeContext))),state:{area:fq(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>fq(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return fq(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||Y(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=pq([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=Y(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=Y(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,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}=xq(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}Dq.specKey="markArea";const Fq={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"}}}}};class zq extends Dq{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new $P(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=xq(i),d=p(i.positions),u=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=aq(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=aq(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=hq(s,a,u,i.coordinatesOffset):d&&(f=uq(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=xq(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}}}zq.type=r.markArea,zq.coordinateType="cartesian",zq.builtInTheme={markArea:Fq};class jq extends Dq{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=xq(this._spec);return i||e||s?new KP(t):new $P(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}=xq(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=lq(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=cq(i,r,c),u={points:d.map((t=>ce(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=xq(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}}}jq.type=r.polarMarkArea,jq.coordinateType="polar",jq.builtInTheme={polarMarkArea:Fq};const Hq=t=>nI(Object.assign({},t)),Vq=t=>Object.assign(Object.assign({},t),{style:Object.assign({},nI(t.style))}),Nq=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=Hq(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=Hq(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:{},nI(Object.assign({},y)));var y;const b=Vq(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=Vq(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=Vq(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=Vq(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!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,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},Uq=t=>"left"===t||"right"===t,Wq=t=>"top"===t||"bottom"===t,Gq={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:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,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:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class Yq extends tj{constructor(){super(...arguments),this.layoutZIndex=t.LayoutZIndex.Player,this.layoutLevel=t.LayoutLevel.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},Nq(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},Nq(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?U(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new DL(t):this._playerComponent=new jL(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=Uq(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=Uq(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.autoPlayCallback=()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback),this._option.globalInstance.on(t.ChartEvent.rendered,this.autoPlayCallback),this._playerComponent.addEventListener(BL.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(BL.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(BL.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(BL.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(BL.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(BL.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}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=Uq(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=Wq(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}_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)):Uq(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))):Wq(this._orient)?this._maxSize():t.height}_computeDx(t){return Uq(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return Wq(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(e){const i=this._specs[e];this._option.globalInstance.updateFullData(i.data),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})}release(){this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback)}}Yq.builtInTheme={player:Gq},Yq.specKey="player",Yq.type=r.player;class $q extends tj{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,U(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=_R({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:Y(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==ZI.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&u(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}$q.type=r.label;class Xq extends RN{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}render(){}}Xq.type="text",Xq.constructorType="label";const Kq=()=>{ON(),YR.registerMark(Xq.constructorType,Xq)};class qq extends Qz{_initTheme(t,e){return{spec:t,theme:this._theme}}}class Zq extends $q{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=qq,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.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(hI.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(hI.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),nR(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{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),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,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=GR({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},JV(h,r),Object.assign(Object.assign(Object.assign({},H(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[OO])):t=>t.filter((t=>t.data[RO]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?QV(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=y(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=Y(i())[t])}))}return e}}Zq.type=r.label,Zq.specKey="label",Zq.transformerConstructor=qq;class Jq extends $q{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()}reInit(t){super.reInit(t),this._initTextMark()}_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[PO]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return GR({textStyle:{pickable:!0===this._spec.interactive},position:Qq(t,this._baseMark.type,a),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=>"bottom"===a?t.data[OO]:t.data[RO]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>QV({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function Qq(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}Jq.type=r.totalLabel,Jq.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},Jq.specKey="totalLabel";class tZ extends wq{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=Sq(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,f,m,v,_,y,b,x,S,A,k,M,T,w,C,E,B,P,L,R,O;const{itemContent:I={},itemLine:D={},targetSymbol:F={}}=this._spec,z=I,{type:H="text",text:V,symbol:N,image:U,richText:W,customMark:G,textStyle:Y,symbolStyle:$,imageStyle:X,richTextStyle:K,customMarkStyle:q,style:Z={},state:J={}}=z,Q=e(z,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let tt=null,et=null,it={};"text"===H?(tt=null!==(t=null==V?void 0:V.state)&&void 0!==t?t:J,it={dx:0,dy:0},et=gq(Object.assign(Object.assign({},V),{style:j(it,null!==(n=null!==(s=null!==(i=null==V?void 0:V.style)&&void 0!==i?i:null==V?void 0:V.textStyle)&&void 0!==s?s:Y)&&void 0!==n?n:Z)}),this._markerData,this._markAttributeContext)):"richText"===H?(tt=null!==(r=null==W?void 0:W.state)&&void 0!==r?r:J,it={width:100,height:100},et=mq(j(it,null!==(o=null!==(a=null==W?void 0:W.style)&&void 0!==a?a:K)&&void 0!==o?o:Z),this._markerData,this._markAttributeContext)):"symbol"===H?(tt=null!==(l=null==N?void 0:N.state)&&void 0!==l?l:J,it={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},et=nI(mq(j(it,null!==(c=null!==(h=null==N?void 0:N.style)&&void 0!==h?h:$)&&void 0!==c?c:Z),this._markerData,this._markAttributeContext))):"image"===H?(tt=null!==(d=null==U?void 0:U.state)&&void 0!==d?d:J,it={width:80,height:80},et=mq(j(it,null!==(p=null!==(u=null==U?void 0:U.style)&&void 0!==u?u:X)&&void 0!==p?p:Z),this._markerData,this._markAttributeContext)):"custom"===H&&(tt=null!==(g=null==G?void 0:G.state)&&void 0!==g?g:J,et=mq(null!==(m=null!==(f=null==G?void 0:G.style)&&void 0!==f?f:q)&&void 0!==m?m:Z,this._markerData,this._markAttributeContext));const st={zIndex:this.layoutZIndex,interactive:null===(v=this._spec.interactive)||void 0===v||v,hover:null===(_=this._spec.interactive)||void 0===_||_,select:null===(y=this._spec.interactive)||void 0===y||y,position:{x:0,y:0},clipInRange:null!==(b=this._spec.clip)&&void 0!==b&&b,itemContent:Object.assign(Object.assign({type:H,offsetX:vq(I.offsetX,this._relativeSeries.getRegion()),offsetY:vq(I.offsetX,this._relativeSeries.getRegion())},Q),{style:mq(et,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(x=F.offset)&&void 0!==x?x:0,visible:null!==(S=F.visible)&&void 0!==S&&S,size:null!==(A=F.size)&&void 0!==A?A:20,style:mq(F.style,this._markerData,this._markAttributeContext)},state:{line:fq(null!==(M=null===(k=this._spec.itemLine.line)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),lineStartSymbol:fq(null!==(w=null===(T=this._spec.itemLine.startSymbol)||void 0===T?void 0:T.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),lineEndSymbol:fq(null!==(E=null===(C=this._spec.itemLine.endSymbol)||void 0===C?void 0:C.state)&&void 0!==E?E:{},this._markerData,this._markAttributeContext),itemContent:fq(tt,this._markerData,this._markAttributeContext),textBackground:fq(null===(P=null===(B=this._spec.itemContent.text)||void 0===B?void 0:B.labelBackground)||void 0===P?void 0:P.state,this._markerData,this._markAttributeContext),targetItem:fq(null!==(R=null===(L=this._spec.targetSymbol)||void 0===L?void 0:L.state)&&void 0!==R?R:{},this._markerData,this._markAttributeContext)},animation:null!==(O=this._spec.animation)&&void 0!==O&&O,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:nt,line:rt={}}=D,at=e(D,["visible","line"]);st.itemLine=!1!==nt?Object.assign(Object.assign({},at),{visible:!0,lineStyle:nI(rt.style)}):{visible:!1};return new ZP(st)}_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}=pq([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:_q(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:_q(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}=Sq(t);(p(t.coordinate)||e||i||s)&&this._initCommonDataView()}}tZ.specKey="markPoint";const eZ={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}};class iZ extends tZ{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=p(s.x)&&p(s.y),o=p(s.coordinate),l=p(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=aq(n,r,r,r,h))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=hq(n,r,h,s.coordinatesOffset)[0]:l&&(c=uq(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=Sq(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}}}iZ.type=r.markPoint,iZ.coordinateType="cartesian",iZ.builtInTheme={markPoint:eZ};class sZ extends tZ{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=lq(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:ce({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}])]}}}sZ.type=r.polarMarkPoint,sZ.coordinateType="polar",sZ.builtInTheme={polarMarkPoint:eZ};class nZ extends tZ{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}])]}}}nZ.type=r.geoMarkPoint,nZ.coordinateType="geo",nZ.builtInTheme={geoMarkPoint:eZ};const rZ="inBrush",aZ="outOfBrush";class oZ extends tj{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._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return aF(t,this.specKey,this.type,(t=>!1!==t.visible))}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),rZ,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),aZ,t.AttributeLevel.Series))}))}))}_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()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){p(this._spec.regionId)||p(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_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)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild()}_shouldEnableInteractive(){return!1!==this.getOption().getCompiler().getOption().interactive}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new UL(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:nI(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),this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(FL.brushActive,(s=>{this._initMarkBrushState(i,aZ),this._emitEvent(t.ChartEvent.brushActive,e,s)})),a.addEventListener(FL.drawStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener(FL.moveStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener(FL.drawing,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener(FL.moving,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener(FL.brushClear,(s=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)})),a.addEventListener(FL.drawEnd,(s=>{var n;this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:r}=s.detail,{updateElementsState:a=!0}=this._spec;if(null===(n=this._spec)||void 0===n?void 0:n.onBrushEnd)!0===this._spec.onBrushEnd(s)?(this.clearGraphic(),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)):(this._spec.onBrushEnd(s),this._emitEvent(t.ChartEvent.brushEnd,e,s));else{const i=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&i.length>0||!a)&&this._setAxisAndDataZoom(r,e),this._emitEvent(t.ChartEvent.brushEnd,e,s)}})),a.addEventListener(FL.moveEnd,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:s}=i.detail,{updateElementsState:n=!0}=this._spec,r=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&r.length>0||n)&&this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e,i)}))}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a],interactive:this._shouldEnableInteractive()}}_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({},nI(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail;this._operateMask=i;const{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e,i){var s;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},vchart:null===(s=this._option)||void 0===s?void 0:s.globalInstance,event:i})}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(i.addState(rZ,!0),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(i.removeState(rZ),i.addState(aZ,!0),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:_=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(_.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(i.addState(rZ,!0),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(i.removeState(rZ),i.addState(aZ,!0),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Pe(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;s.removeState(rZ),s.removeState(aZ),i&&s.addState(i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_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,g=t.getScale().range(),f=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],m=$(g){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}clearBrushStateAndMask(){this._relativeRegions.forEach(((t,e)=>{this._initMarkBrushState(e,""),this._brushComponents[e].children[0].removeAllChild()}))}}oZ.type=r.brush,oZ.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},oZ.specKey="brush";class lZ extends tj{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}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;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${mO}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=IF({},DF(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(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)}))),p(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,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 Ve).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Ve;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),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}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}lZ.type=r.customMark,lZ.specKey="customMark";class hZ{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._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=>{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=>cZ(t))),a=n.filter((t=>!cZ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>cZ(t))),h=o.filter((t=>!cZ(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 cZ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}hZ.type="grid";const dZ="vchart-tooltip",uZ=`${dZ}-container`,pZ=`${dZ}-title`,gZ=`${dZ}-content-box`,fZ={offsetX:10,offsetY:10},mZ="99999999999999";function vZ(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const _Z=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,yZ=t=>_(t)&&""!==(null==t?void 0:t.trim())||S(t)?vZ(t):"",bZ=(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},xZ={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},SZ=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=xZ[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class AZ extends Cz{constructor(){super(...arguments),this._visible=!0,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._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const _=e.event,{activeType:y,data:b}=t,x="dimension"===y?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:M}=this._option,T=m[y],w=cF(null==T?void 0:T.position,b,e),C=null!==(r=cF(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===y?"mark":"pointer",{width:E=0,height:B=0}=null!=i?i:{},P="canvas"===m.renderMode,L=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==L?void 0:L.width)&&void 0!==o?o:vO,O=null!==(l=null==L?void 0:L.height)&&void 0!==l?l:_O;let I=!1;const D={width:0,height:0};let F,z={x:0,y:0},j={x:0,y:0},H=1,V=1;const N=Yy(this._env);if(N&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=R,D.height=O),N&&!P){const t=this._getParentElement(m);j=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-j.x,y:F.y-j.y},H=_Z(e,F),V=_Z(t,j)}const U=V/H,W={},G={x:w,y:w},Y={x:["left","right"],y:["top","bottom"]},$=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?A:M;if("mark"===i){I=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){I=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(I){const e=Y[n][0],i="x"===n?E:B;switch(SZ(t,n)){case-2:W[e]=a-i*U-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*U/2;break;case-1:W[e]=(a+o)/2-i*U-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*U-c;break;case 2:W[e]=o+c}}},X=["x","y"];if(g(w))if(g(K=w)&&(p(K.left)||p(K.right)||p(K.top)||p(K.bottom))){const{left:t,right:e,top:i,bottom:s}=w;W.left=bZ(t,_),W.top=bZ(i,_),W.right=bZ(e,_),W.bottom=bZ(s,_)}else(t=>g(t)&&(p(t.x)||p(t.y)))(w)&&X.forEach((t=>{const e=w[t];S(e)||d(e)?W[Y[t][0]]=bZ(e,_):$(e,t)}));else p(w)&&($({orient:w,mode:C},"x"),$({orient:w,mode:C},"y"));var K;const q={x:null,y:null};return X.forEach((t=>{var e;const i="x"===t?E:B,s="x"===t?R:O,n="x"===t?A:M,r=SZ(G[t],t);if(k(W[Y[t][0]]))q[t]=W[Y[t][0]];else if(k(W[Y[t][1]]))q[t]=s-i*U-W[Y[t][1]];else{const e="x"===t?_.canvasX:_.canvasY;q[t]=r>0?e+n:0===r?e-i*U/2:e-i*U-n}q[t]*=H,N&&(q[t]+=z[t]),q[t]/=V;const a="x"===t?D.width:D.height,o=m.confine?-(j[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/H)/V:-j[t]/V,l=a/V+o-i;2!==r&&q[t]l&&(q[t]=l)):-2!==r&&q[t]>l&&(I?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",MZ=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=kZ(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=kZ(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},TZ=(t={})=>{const{lineHeight:e}=t;return t.fontSize?LR(e,t.fontSize):0},wZ=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),p(r)&&(o=ai(r),a.padding=kZ(o)),{panelStyle:a,panelPadding:o}};function CZ(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}class EZ extends AZ{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(EZ.type),this.type=kH.dom,this._tooltipContainer=null==Gy?void 0:Gy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(Gy&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:d,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=wZ(l),_={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(_.marginBottom=`${g}px`);const y={width:kZ(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=MZ(h),x=MZ(d),S=MZ(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),u(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),u(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),u(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),y[A]=kZ(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=kZ(null!==(s=d.spacing)&&void 0!==s?s:26),S[A]=kZ(null!==(n=p.spacing)&&void 0!==n?n:0);const M=Math.max(TZ(p),TZ(d));return _.lineHeight=M>0?`${M}px`:"20px",{panelPadding:v,row:_,panel:m,title:b,shape:y,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(pZ))),l=a.find((t=>t.className.includes(gZ)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(pZ),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(CZ(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${dZ}-column`),e.classList.add(`${dZ}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(gZ),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];CZ(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));CZ(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${dZ}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=yZ(e.key),e.keyStyle&&MZ(e.keyStyle,l)):"value"===i?(o.innerHTML=yZ(e.value),e.valueStyle&&MZ(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?vZ(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?vZ(c):m,y=p,b=t=>new Cg({symbolType:t,size:y,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new Ve));let M=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const T=vh.IsGradientStr(u);if(!u||_(u)&&!T||d)return m=d?"none":u?vZ(u):"currentColor",`\n \n \n \n `;const w=T?vh.Parse(u):g(u)?u:null;if(w){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=w.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===w.gradient?t=`\n ${i}\n `:"linear"===w.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),CZ(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(gZ))),h=[...o.children].find((t=>t.className.includes(pZ)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(pZ)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=LR(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,CZ(l,c))}const u=l.children,g=[];if(u){for(let i=0;i{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},ff||(ff=pf.CreateGraphic("richtext",{})),ff.setAttributes(a),ff.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function LZ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:BZ),{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:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const RZ=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};class OZ extends AZ{constructor(){super(OZ.type),this.type=kH.canvas,this._attributes=null}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 XL({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}_getTooltipBoxSize(t,e){var i,s;if(!e||u(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");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:f,valueLabel:m,spaceRow:v,align:_}=l,y=ai(d.padding),b=IR(d.padding),x=LZ(Object.assign({textAlign:"right"===_?"right":"left"},u),i),S=LZ(Object.assign({textAlign:"right"===_?"right":"left"},f),i),A=LZ(m,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:RZ(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,enterable:h,transitionDuration:c,align:_},{title:T={},content:w=[]}=t;let C=b.left+b.right,E=b.top+b.bottom,B=0;const P=!!w.length;let L=0,R=0,O=0,I=0;if(P){const t=[],e=[],i=[],s=[];let n=0;M.content=w.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:M}=r,T={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=GR({},S,LZ(b,void 0,{})),{width:s,height:n,text:r}=PZ(h,i);T.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(m)){const t=GR({},A,LZ(x,void 0,{})),{width:e,height:s,text:n}=PZ(m,t);T.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};M?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,T.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else T.shape={visible:!1};return T.height=o,n+=o,aU.autoWidth&&!1!==U.multiLine;if(j){U=GR({},x,LZ(V,void 0,{})),W()&&(U.multiLine=null===(r=U.multiLine)||void 0===r||r,U.maxWidth=null!==(a=U.maxWidth)&&void 0!==a?a:P?Math.ceil(B):void 0);const{text:t,width:e,height:i}=PZ(H,U);M.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=U.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},U),{text:t}),D=M.title.value.width,F=M.title.value.height,z=F+(P?M.title.spaceRow:0)}return E+=z,M.title.width=D,M.title.height=F,W()?C+=B||D:C+=Math.max(D,B),P&&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-I-L-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})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_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{activeTooltipSpec: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()}}OZ.type=kH.canvas;const IZ=/\{([^}]+)\}/,DZ=/\{([^}]+)\}/g,FZ=/:/;class zZ extends Cz{constructor(){super(zZ.type),this.type="formatterPlugin",this._timeModeFormat={utc:mi.getInstance().timeUTCFormat,local:mi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=ki.getInstance().format,this._numericSpecifier=ki.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[zZ.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)),YR.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=IZ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(DZ,((t,i)=>{if(!FZ.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(xi.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):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}zZ.pluginType="chart",zZ.specKey="formatter",zZ.type="formatterPlugin";tF.useRegisters([()=>{EH(),PH(),RH(),aH(),rH(),Wj(),Ij(),vz(),yz(),UD(),HD(),Cj(),kj(),YR.registerSeries(Gj.type,Gj),YR.registerChart(OH.type,OH)},()=>{EH(),PH(),RH(),rH(),Wj(),Ij(),vz(),FH(),yz(),HH(),Cj(),kj(),YR.registerSeries(NH.type,NH),aH(),YR.registerChart(WH.type,WH)},()=>{EH(),PH(),RH(),rH(),nV(),aH(),YR.registerChart(aV.type,aV)},()=>{EH(),PH(),aH(),rH(),mV(),YR.registerChart(_V.type,_V)},()=>{PH(),pU(),YR.registerChart(oX.type,oX)},()=>{EH(),PH(),aH(),rH(),PU(),YR.registerChart(cX.type,cX)},()=>{EH(),PH(),RH(),aH(),rH(),HU(),YR.registerChart(uX.type,uX)},()=>{EH(),PH(),RH(),aH(),rH(),nV(),YR.registerTransform("bin",Kr),YR.registerChart(_X.type,_X)},()=>{PH(),RV(),AV(),YR.registerSeries(IV.type,IV),YR.registerImplement("registerMap",AI),YR.registerImplement("unregisterMap",kI),VD(),YR.registerChart(eX.type,eX)},()=>{PH(),y$(),YR.registerSeries(x$.type,x$),oU(),eW(),wU(),nW(),YR.registerChart(SX.type,SX)},()=>{PH(),YG(),YR.registerChart(MX.type,MX)},()=>{PH(),uY(),YR.registerChart(wX.type,wX)},()=>{EH(),PH(),RH(),aH(),rH(),cN(),YR.registerChart(jX.type,jX)},()=>{EH(),PH(),aH(),rH(),LN(),YR.registerTransform("boxplot",qr),YR.registerChart(VX.type,VX)},()=>{EH(),PH(),aH(),rH(),nW(),YR.registerChart(bX.type,bX)},()=>{EH(),PH(),aH(),rH(),dW(),YR.registerChart(EX.type,EX)},()=>{EH(),PH(),aH(),rH(),UN(),YR.registerChart(PX.type,PX)},()=>{EH(),PH(),RH(),aH(),rH(),FH(),Cj(),kj(),YR.registerSeries(XN.type,XN),YR.registerChart(GX.type,GX)},()=>{PH(),BY(),YR.registerChart(RX.type,RX)},()=>{PH(),DY(),YR.registerChart(IX.type,IX)},()=>{PH(),h$(),YR.registerChart(FX.type,FX)},()=>{PH(),xo.load(vM),e$(),YR.registerChart(UX.type,UX)},()=>{PH(),C$(),YR.registerChart($X.type,$X)},()=>{PH(),V$(),YR.registerChart(KX.type,KX)},()=>{EH(),PH(),RH(),aH(),YR.registerChart(gX.type,gX),rH()},kj,Cj,()=>{YR.registerGraphicComponent(ej.lineAxis,((t,e)=>new CC(t,e))),YR.registerGraphicComponent(ij.lineAxisGrid,((t,e)=>new zB(t,e))),oj(),YR.registerComponent(Ej.type,Ej)},()=>{YR.registerGraphicComponent(ej.lineAxis,((t,e)=>new CC(t,e))),YR.registerGraphicComponent(ij.lineAxisGrid,((t,e)=>new zB(t,e))),oj(),YR.registerComponent(Bj.type,Bj)},()=>{YR.registerGraphicComponent(ej.lineAxis,((t,e)=>new CC(t,e))),YR.registerGraphicComponent(ij.lineAxisGrid,((t,e)=>new zB(t,e))),oj(),YR.registerComponent(Pj.type,Pj)},EU,wU,()=>{YR.registerComponent(tK.type,tK)},()=>{YR.registerComponent(uK.type,uK)},()=>{YR.registerComponent(SK.type,SK)},()=>{YR.registerComponent(CK.type,CK)},()=>{YR.registerComponent(EK.type,EK)},()=>{YR.registerComponent(WK.type,WK)},()=>{YR.registerComponent(YK.type,YK)},()=>{YR.registerComponent(qK.type,qK)},RV,()=>{YR.registerComponent(Rq.type,Rq),WP()},()=>{YR.registerComponent(zq.type,zq),YP()},()=>{YR.registerComponent(iZ.type,iZ),qP()},()=>{YR.registerComponent(Oq.type,Oq),XP._animate=MP,WP()},()=>{YR.registerComponent(jq.type,jq),KP._animate=wP,YP()},()=>{YR.registerComponent(sZ.type,sZ),qP()},()=>{YR.registerComponent(nZ.type,nZ),qP()},()=>{YR.registerComponent(Iq.type,Iq)},()=>{YR.registerComponent(Yq.type,Yq)},()=>{YR.registerGraphicComponent(Zq.type,(t=>new OB(t))),Kq(),nj(),YR.registerComponent(Zq.type,Zq,!0,1/0)},()=>{YR.registerGraphicComponent(Jq.type,(t=>new OB(t))),Kq(),nj(),YR.registerComponent(Jq.type,Jq,!0)},()=>{YR.registerComponent(oZ.type,oZ)},()=>{YR.registerComponent(lZ.type,lZ)},()=>{xo.load(aT)},()=>{YR.registerLayout(hZ.type,hZ)},()=>{var t;t=OZ,YR.registerComponentPlugin(t.type,t)},()=>{var t;t=zZ,YR.registerChartPlugin(t.type,t)},KD,JD]),tF.useRegisters([()=>{GS(xo)}]),t.DEFAULT_CHART_HEIGHT=_O,t.DEFAULT_CHART_WIDTH=vO,t.DEFAULT_CLOSE_STROKE_JOIN=sF,t.DEFAULT_DATA_INDEX=bO,t.DEFAULT_DATA_KEY=xO,t.DEFAULT_DATA_SERIES_FIELD=SO,t.DEFAULT_KEY=VO,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=iF,t.DEFAULT_MAP_LOOK_UP_KEY=NO,t.DEFAULT_MEASURE_CANVAS_ID=yO,t.DEFAULT_SERIES_STYLE_NAME=AO,t.DEFAULT_SMOOTH_INTERPOLATE=eF,t.Factory=YR,t.MOSAIC_CAT_END_PERCENT=zO,t.MOSAIC_CAT_START_PERCENT=FO,t.MOSAIC_VALUE_END_PERCENT=DO,t.MOSAIC_VALUE_START_PERCENT=IO,t.ManualTicker=class extends hw{constructor(t){super(t),this.lastFrameTime=0,this.status=Ro.RUNNING}setupTickHandler(){const t=new cw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===Ro.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Ro.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Ro.RUNNING,!0}},t.PREFIX=mO,t.SEGMENT_FIELD_END=HO,t.SEGMENT_FIELD_START=jO,t.STACK_FIELD_END=TO,t.STACK_FIELD_END_OffsetSilhouette=BO,t.STACK_FIELD_END_PERCENT=CO,t.STACK_FIELD_KEY=kO,t.STACK_FIELD_START=MO,t.STACK_FIELD_START_OffsetSilhouette=EO,t.STACK_FIELD_START_PERCENT=wO,t.STACK_FIELD_TOTAL=PO,t.STACK_FIELD_TOTAL_BOTTOM=OO,t.STACK_FIELD_TOTAL_PERCENT=LO,t.STACK_FIELD_TOTAL_TOP=RO,t.StreamLight=class extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=Ao.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Wl,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=Ao.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_;const y=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(y){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:qo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(_=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==_?_:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:qo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=cl(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=cl(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;et;var s,n;function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}!function(t){t["desktop-browser"]="desktop-browser",t["mobile-browser"]="mobile-browser",t.node="node",t.worker="worker",t.miniApp="miniApp",t.wx="wx",t.tt="tt",t.harmony="harmony",t["desktop-miniApp"]="desktop-miniApp",t.lynx="lynx"}(s||(s={})),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.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"}(n||(n={}));var a={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 h=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||l(t,"Boolean");var c=t=>"function"==typeof t;var d=t=>null==t;var u=t=>null!=t;var p=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var g=t=>"object"==typeof t&&null!==t;var f=function(t){if(!g(t)||!l(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 m=t=>void 0===t;var v=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||l(t,"String")};var _=t=>Array.isArray?Array.isArray(t):l(t,"Array");var y=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var b=t=>l(t,"Date");var x=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||l(t,"Number")};var S=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>x(t)&&Number.isFinite(t);var A=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var M=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 T=Object.prototype;var C=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||T)};const B=Object.prototype.hasOwnProperty;function E(t){if(d(t))return!0;if(y(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(C(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var P=(t,e,i)=>{const s=v(e)?e.split("."):e;for(let e=0;enull!=t&&R.call(t,e);function I(t,e,i){let s;if(!u(t)||"object"!=typeof t||e&&e(t))return t;const n=_(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:h(t)||x(t)||v(t)?t:b(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=I(r,e,i)}return s}function L(t,e,i=!1,s=!1){if(e){if(t===e)return;if(u(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!u(n[a])||"object"!=typeof n[a]||s&&_(t[a])?F(t,a,n[a]):D(t,e,a,i,s)}}}}function D(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(_(a)){if(s)o=[];else if(_(r))o=r;else if(y(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(v(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function H(t){return Object.prototype.toString.call(t)}function V(t){return Object.keys(t)}function N(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(H(t)!==H(e))return!1;if(c(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 s=t.length-1;s>=0;s--)if(!N(t[s],e[s],i))return!1;return!0}if(!f(t))return!1;const s=V(t),n=V(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!N(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;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;ne?1:t>=e?0:NaN}function tt(t){return Number(t)}function et(t,e,i=tt){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)}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&&x(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(t=nt.None,e){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(...t){this._onErrorHandler.forEach((e=>e(...t)))}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(...t){var e;return this._level>=nt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):st(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=nt.Warn&&st(this._method||"warn","WARN",t),this}info(...t){return this._level>=nt.Info&&st(this._method||"log","INFO",t),this}debug(...t){return this._level>=nt.Debug&&st(this._method||"log","DEBUG",t),this}}function at(t,e,i=0,s){for(d(s)&&(s=t.length);i>>1;Q(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(Q)),et(i,.5)},ct=1e-10,dt=1e-10;function ut(t,e,i=dt,s=ct){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}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(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var mt=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 g=!e&&0!==e&&yt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return g?(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=m(_,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?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(_,e),c?f(t):a}(l);if(d)return o=m(_,e),f(l)}return void 0===o&&(o=m(_,e)),a}return e=+e||0,p(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(g)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:y(Date.now())},b.pending=function(){return void 0!==o},b}function xt(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return p(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),bt(t,e,{leading:s,trailing:n,maxWait:e})}function St(t,e){return i=>t*(1-i)+e*i}function kt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function At(t){if(k(t))return t;const e=+t;return k(e)?e:0}function Mt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}yt=!1;const wt=4294967296;const Tt=t=>e=>P(e,t),Ct=(t,e={})=>{if(c(t))return t;const i=[t];return(e&&e.get||Tt)(i)},Bt=(t,e={})=>{if(_(t)){const i=t.map((t=>Ct(t,e)));return t=>i.map((e=>e(t)))}return Ct(t,e)},Et=(t,e)=>d(t)?e:v(t)?e*parseFloat(t)/100:t,Pt=t=>0,Rt=(t,e)=>{const i=c(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function It(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Lt(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!d(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:u,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)u+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!d(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!d(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:u,b:p},predict:g,rSquared:It(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=Ot(f.min,f);for(let r=0;r=1?zt:t<=-1?-zt:Math.asin(t)}function qt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Zt(t,e){return t[0]*e[1]-t[1]*e[0]}function Jt(t,e){let i=0;for(let s=0;s0?i:0}function ee(t,e){return Qt(t+e,10**Math.max(te(t),te(e)))}function ie(t,e){return Qt(t-e,10**Math.max(te(t),te(e)))}class se{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new se(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 x(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return x(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 ne{static distancePP(t,e){return Xt($t(t.x-e.x,2)+$t(t.y-e.y,2))}static distanceNN(t,e,i,s){return Xt($t(t-i,2)+$t(e-s,2))}static distancePN(t,e,i){return Xt($t(e-t.x,2)+$t(i-t.y,2))}static pointAtPP(t,e,i){return new se((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function re(t){return t*(Math.PI/180)}function ae(t){return 180*t/Math.PI}const oe=(t=0)=>{if(t<0)for(;t<-jt;)t+=jt;else if(t>0)for(;t>jt;)t-=jt;return t};function le(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 he(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function ce(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function de(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ue(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=de(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)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function pe(t){return(t=de(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 ge(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function fe(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function ve(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=ye(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var _e;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(_e||(_e={}));const ye=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function be(t,e,i){if(!t||!e)return _e.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=ye(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function ke(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Ae({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Me(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function we(t,e){const i=e?re(t.angle):t.angle,s=Me(t);return[Ae({x:t.x1,y:t.y1},i,s),Ae({x:t.x2,y:t.y1},i,s),Ae({x:t.x2,y:t.y2},i,s),Ae({x:t.x1,y:t.y2},i,s)]}function Te(t,e,i=!1){const s=we(t,i),n=we(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Me(t),Me(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?re(t.angle):t.angle;let u=i?re(90-t.angle):t.angle+zt;const p=i?re(e.angle):e.angle;let g=i?re(90-e.angle):e.angle+zt;u>Ht&&(u-=Ht),g>Ht&&(g-=Ht);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(ke(n,i)+ke(n,s))/2>ke(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Ce=1e-8;function Be(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Re(t,e){return Math.abs(t-e){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"};function Ie(t,e={},i){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")}class Le{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(),u(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=u(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(d(this._canvas)&&(u(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),d(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&u(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),d(this._context)&&u(this._canvas)){const t=this._canvas.getContext("2d");u(t)&&(t.save(),t.font=Ie(this.textSpec),this._contextSaved=!0,this._context=t)}return!d(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:f=o}=this._userSpec;if(v(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,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(d(t))return{width:0,height:0};if(d(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,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}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(d(this._numberCharSize)){const t=this._standardMethod(Le.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Le.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return d(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Le.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(d(this._letterCharSize)){const t=this._standardMethod(Le.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Le.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return u(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){u(this._canvas)&&(this._canvas=null),u(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Le.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Le.NUMBERS_CHAR_SET="0123456789",Le.FULL_SIZE_CHAR="字";const De=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),Fe=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=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(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=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(t=0,e=0,i=0,s=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(t=0,e=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(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return ze(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 He extends je{}class Ve extends je{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Te(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new Ve(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Ae({x:this.x1,y:this.y1},this.angle,t),Ae({x:this.x2,y:this.y1},this.angle,t),Ae({x:this.x1,y:this.y2},this.angle,t),Ae({x:this.x2,y:this.y2},this.angle,t)]}}class Ne{constructor(t=1,e=0,i=0,s=1,n=0,r=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 Ne,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,f=o*n+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 Ne;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:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ne(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=ae(r.rotateDeg),r}}class We{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 Ue(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 Ge(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 Ye=/^#([0-9a-f]{3,8})$/,Xe={transparent:4294967040},$e={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 Ke(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function qe(t){return x(t)?new ei(t>>16,t>>8&255,255&t,1):_(t)?new ei(t[0],t[1],t[2]):new ei(255,255,255)}function Ze(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Je(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const Qe=(t,e)=>{const i=Ye.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ei((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?qe(t):8===e?new ei(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class ti{static Brighter(t,e=1){return 1===e?t:new ti(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new ti(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof ti?t:new ti(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();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(u(Xe[t]))return function(t){return x(t)?new ei(t>>>24,t>>>16&255,t>>>8&255,255&t):_(t)?new ei(t[0],t[1],t[2],t[3]):new ei(255,255,255,1)}(Xe[t]);if(u($e[t]))return qe($e[t]);const e=`${t}`.trim().toLowerCase(),i=Qe(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new ei(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=Ue(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ei(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ti.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ei(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=Ge(this.color.r,this.color.g,this.color.b),r=Ue(d(t)?n.h:mt(t,0,360),d(e)?n.s:e>=0&&e<=1?100*e:e,d(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new ei(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!d(t)&&(this.color.r=t),!d(e)&&(this.color.g=e),!d(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=Qe(e,!0);return null!=i?i:this}setColorName(t){const e=$e[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(t=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}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new ti(this.color.toString())}copyGammaToLinear(t,e=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,e=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=Ze(t.color.r),this.color.g=Ze(t.color.g),this.color.b=Ze(t.color.b),this}copyLinearToSRGB(t){return this.color.r=Je(t.color.r),this.color.g=Je(t.color.g),this.color.b=Je(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ei{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)),u(s)?this.opacity=isNaN(+s)?1:Math.max(0,Math.min(1,+s)):this.opacity=1}formatHex(){return`#${Ke(this.r)+Ke(this.g)+Ke(this.b)+(1===this.opacity?"":Ke(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}=Ge(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ii(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 ei(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:Ge});function ni(t){if(k(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,s]=t;return[e,i,s,i]}if(4===e)return t}if(p(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 ri(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=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:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}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}const li=1e-10;function hi(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+li)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=pi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=ne.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=ci(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-li,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function ci(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function di(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return ci(t,t-(i*i-e*e+t*t)/(2*i))+ci(e,s)}function ui(t,e){const i=ne.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function pi(t){const e={x:0,y:0};for(let i=0;ithis.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 mi;function vi(t,e){const i=fi(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 _i{constructor(t={}){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 yi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function bi(t){let e;if(e=yi.exec(t))return new _i({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 xi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Si{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 Si.instance||(Si.instance=new Si),Si.instance}newFormat(t){const e=bi(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"):ki[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=ki[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:_,group:y,numerals:b}=this;function x(t){let e,r,x,S=u,k=p,A=t;if("c"===d)k=g(A)+k,A="";else{A=+A;let t=A<0||1/A<0;if(A=isNaN(A)?m:g(Math.abs(A),h),c&&(A=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}(A)),t&&0==+A&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,k=("s"===d?xi[8+mi/3]:"")+k+(t&&"("===n?")":""),f)for(e=-1,r=A.length;++ex||x>57){k=(46===x?_+A.slice(e+1):A.slice(e))+k,A=A.slice(0,e);break}}l&&!a&&(A=y(A,1/0));let M=S.length+A.length+k.length,w=M>1)+S+A+k+w.slice(M);break;default:A=w+S+A+k}return b(A)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=bi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=fi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=xi[8+n/3];return function(t){return s(r*t)+a}}}const ki={"%":(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)=>vi(100*t,e),r:vi,s:function(t,e){const i=fi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(mi=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")+fi(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 Ai(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(_.fx>e.fx?(Ci(y,1+c,v,-c,e),y.fx=t(y),y.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Ci(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=Jt(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Pi(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Ti(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},Ji=Math.sqrt,Qi=Math.tan;function ts(t){return t>1?0:t<-1?Fi:Math.acos(t)}function es(t){return t>1?zi:t<-1?-zi:Math.asin(t)}function is(){}function ss(t,e){t&&rs.hasOwnProperty(t.type)&&rs[t.type](t,e)}var ns={Feature:function(t,e){ss(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sFi?t+Math.round(-t/Hi)*Hi:t,e]}function _s(t,e,i){return(t%=Hi)?e||i?ms(bs(t),xs(e,i)):bs(t):e||i?xs(e,i):vs}function ys(t){return function(e,i){return[(e+=t)>Fi?e-Hi:e<-Fi?e+Hi:e,i]}}function bs(t){var e=ys(t);return e.invert=ys(-t),e}function xs(t,e){var i=Yi(t),s=qi(t),n=Yi(e),r=qi(e);function a(t,e){var a=Yi(e),o=Yi(t)*a,l=qi(t)*a,h=qi(e),c=h*i+o*s;return[Gi(l*n-c*r,o*i-h*s),es(c*n+l*r)]}return a.invert=function(t,e){var a=Yi(e),o=Yi(t)*a,l=qi(t)*a,h=qi(e),c=h*n-l*r;return[Gi(l*n+h*r,o*i+c*s),es(c*i-o*s)]},a}function Ss(t,e){(e=cs(e))[0]-=t,fs(e);var i=ts(-e[1]);return((-e[2]<0?-i:i)+Hi-Di)%Hi}function ks(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:is,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function As(t,e){return Wi(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 Ts(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Os(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 Is(t,e,i,s){return function(n){var r,a,o,l=e(n),h=ks(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Os(a);var t=function(t,e){var i=Ps(e),s=e[1],n=qi(s),r=[qi(i),-Yi(i),0],a=0,o=0;Es.reset(),1===n?s=zi+Di:-1===n&&(s=-zi-Di);for(var l=0,h=t.length;l=0?1:-1,M=A*k,w=M>Fi,T=f*x;if(Es.add(Gi(T*A*qi(M),m*S+T*Yi(M))),a+=w?k+A*Hi:k,w^p>=i^y>=i){var C=us(cs(u),cs(_));fs(C);var B=us(r,C);fs(B);var E=(w^k>=0?-1:1)*es(B[2]);(s>E||s===E&&(C[0]||C[1]))&&(o+=w^k>=0?1:-1)}}return(a<-Di||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(Ls))}return u}}function Ls(t){return t.length>1}function Ds(t,e){return((t=t.x)[0]<0?t[1]-zi-Di:zi-t[1])-((e=e.x)[0]<0?e[1]-zi-Di:zi-e[1])}1===(Cs=Rs).length&&(Bs=Cs,Cs=function(t,e){return Rs(Bs(t),e)});var Fs=Is((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?Fi:-Fi,l=Wi(r-i);Wi(l-Fi)0?zi:-zi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Fi&&(Wi(i-n)Di?Ui((qi(e)*(r=Yi(s))*qi(i)-qi(s)*(n=Yi(e))*qi(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*zi,s.point(-Fi,n),s.point(0,n),s.point(Fi,n),s.point(Fi,0),s.point(Fi,-n),s.point(0,-n),s.point(-Fi,-n),s.point(-Fi,0),s.point(-Fi,n);else if(Wi(t[0]-e[0])>Di){var r=t[0]0,n=Wi(e)>Di;function r(t,i){return Yi(t)*Yi(i)>e}function a(t,i,s){var n=[1,0,0],r=us(cs(t),cs(i)),a=ds(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=us(n,r),u=gs(n,h);ps(u,gs(r,c));var p=d,g=ds(u,p),f=ds(p,p),m=g*g-f*(ds(u,u)-1);if(!(m<0)){var v=Ji(m),_=gs(p,(-g-v)/f);if(ps(_,u),_=hs(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],k=i[1];x0^_[1]<(Wi(_[0]-b)Fi^(b<=_[0]&&_[0]<=x)){var w=gs(p,(-g+v)/f);return ps(w,u),[_,hs(w)]}}}function o(e,i){var n=s?t:Fi-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Is(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],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?Fi:-Fi),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||As(e,p)||As(g,p))&&(g[2]=1),f!==l)c=0,f?(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^f){var v;m&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)))}!f||e&&As(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},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=Yi(e),o=qi(e),l=s*i;null==n?(n=e+s*Hi,r=e-l/2):(n=Ss(a,n),r=Ss(a,r),(s>0?nr)&&(n+=s*Hi));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 Wi(s[0]-t)0?0:3:Wi(s[0]-i)0?2:1:Wi(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,f,m,v,_,y=a,b=ks(),x={point:S,lineStart:function(){x.point=k,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(k(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&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=Os(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&ws(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 k(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&&m)y.point(r,a);else{var l=[g=Math.max(Hs,Math.min(js,g)),f=Math.max(Hs,Math.min(js,f))],b=[r=Math.max(Hs,Math.min(js,r)),a=Math.max(Hs,Math.min(js,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):(m||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Ns(t){return t}var Ws,Us,Gs,Ys,Xs=Ri(),$s=Ri(),Ks={point:is,lineStart:is,lineEnd:is,polygonStart:function(){Ks.lineStart=qs,Ks.lineEnd=Qs},polygonEnd:function(){Ks.lineStart=Ks.lineEnd=Ks.point=is,Xs.add(Wi($s)),$s.reset()},result:function(){var t=Xs/2;return Xs.reset(),t}};function qs(){Ks.point=Zs}function Zs(t,e){Ks.point=Js,Ws=Gs=t,Us=Ys=e}function Js(t,e){$s.add(Ys*t-Gs*e),Gs=t,Ys=e}function Qs(){Js(Ws,Us)}var tn=Ks,en=1/0,sn=en,nn=-en,rn=nn;var an,on,ln,hn,cn={point:function(t,e){tnn&&(nn=t);ern&&(rn=e)},lineStart:is,lineEnd:is,polygonStart:is,polygonEnd:is,result:function(){var t=[[en,sn],[nn,rn]];return nn=rn=-(sn=en=1/0),t}},dn=0,un=0,pn=0,gn=0,fn=0,mn=0,vn=0,_n=0,yn=0,bn={point:xn,lineStart:Sn,lineEnd:Mn,polygonStart:function(){bn.lineStart=wn,bn.lineEnd=Tn},polygonEnd:function(){bn.point=xn,bn.lineStart=Sn,bn.lineEnd=Mn},result:function(){var t=yn?[vn/yn,_n/yn]:mn?[gn/mn,fn/mn]:pn?[dn/pn,un/pn]:[NaN,NaN];return dn=un=pn=gn=fn=mn=vn=_n=yn=0,t}};function xn(t,e){dn+=t,un+=e,++pn}function Sn(){bn.point=kn}function kn(t,e){bn.point=An,xn(ln=t,hn=e)}function An(t,e){var i=t-ln,s=e-hn,n=Ji(i*i+s*s);gn+=n*(ln+t)/2,fn+=n*(hn+e)/2,mn+=n,xn(ln=t,hn=e)}function Mn(){bn.point=xn}function wn(){bn.point=Cn}function Tn(){Bn(an,on)}function Cn(t,e){bn.point=Bn,xn(an=ln=t,on=hn=e)}function Bn(t,e){var i=t-ln,s=e-hn,n=Ji(i*i+s*s);gn+=n*(ln+t)/2,fn+=n*(hn+e)/2,mn+=n,vn+=(n=hn*t-ln*e)*(ln+t),_n+=n*(hn+e),yn+=3*n,xn(ln=t,hn=e)}var En=bn;function Pn(t){this._context=t}Pn.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,Hi)}},result:is};var Rn,On,In,Ln,Dn,Fn=Ri(),zn={point:is,lineStart:function(){zn.point=jn},lineEnd:function(){Rn&&Hn(On,In),zn.point=is},polygonStart:function(){Rn=!0},polygonEnd:function(){Rn=null},result:function(){var t=+Fn;return Fn.reset(),t}};function jn(t,e){zn.point=Hn,On=Ln=t,In=Dn=e}function Hn(t,e){Ln-=t,Dn-=e,Fn.add(Ji(Ln*Ln+Dn*Dn)),Ln=t,Dn=e}var Vn=zn;function Nn(){this._string=[]}function Wn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Un(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),ls(t,i(s))),s.result()}return r.area=function(t){return ls(t,i(tn)),tn.result()},r.measure=function(t){return ls(t,i(Vn)),Vn.result()},r.bounds=function(t){return ls(t,i(cn)),cn.result()},r.centroid=function(t){return ls(t,i(En)),En.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ns):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Nn):new Pn(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 Gn(t){return function(e){var i=new Yn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Yn(){}function Xn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),ls(i,t.stream(cn)),e(cn.result()),null!=s&&t.clipExtent(s),t}function $n(t,e,i){return Xn(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 Kn(t,e,i){return $n(t,[[0,0],e],i)}function qn(t,e,i){return Xn(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 Xn(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)}Nn.prototype={_radius:4.5,_circle:Wn(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=Wn(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}},Yn.prototype={constructor:Yn,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 Jn=16,Qn=Yi(30*Ni);function tr(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&f--){var b=a+u,x=o+p,S=l+g,k=Ji(b*b+x*x+S*S),A=es(S/=k),M=Wi(Wi(S)-1)e||Wi((v*B+_*E)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Ni:0,B()):[m*Vi,v*Vi,_*Vi]},T.angle=function(t){return arguments.length?(y=t%360*Ni,B()):y*Vi},T.reflectX=function(t){return arguments.length?(b=t?-1:1,B()):b<0},T.reflectY=function(t){return arguments.length?(x=t?-1:1,B()):x<0},T.precision=function(t){return arguments.length?(a=tr(o,w=t*t),E()):Ji(w)},T.fitExtent=function(t,e){return $n(T,t,e)},T.fitSize=function(t,e){return Kn(T,t,e)},T.fitWidth=function(t,e){return qn(T,t,e)},T.fitHeight=function(t,e){return Zn(T,t,e)},function(){return e=t.apply(this,arguments),T.invert=e.invert&&C,B()}}function ar(t){var e=0,i=Fi/3,s=rr(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Ni,i=t[1]*Ni):[e*Vi,i*Vi]},n}function or(t,e){var i=qi(t),s=(i+qi(e))/2;if(Wi(s)2?t[2]*Ni:0),e.invert=function(e){return(e=t.invert(e[0]*Ni,e[1]*Ni))[0]*=Vi,e[1]*=Vi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===gr?[[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 mr(t){return Qi((zi+t)/2)}function vr(t,e){var i=Yi(t),s=t===e?qi(t):$i(i/Yi(e))/$i(mr(e)/mr(t)),n=i*Ki(mr(t),s)/s;if(!s)return gr;function r(t,e){n>0?e<-zi+Di&&(e=-zi+Di):e>zi-Di&&(e=zi-Di);var i=n/Ki(mr(e),s);return[i*qi(s*t),n-i*Yi(s*t)]}return r.invert=function(t,e){var i=n-e,r=Zi(s)*Ji(t*t+i*i),a=Gi(t,Wi(i))*Zi(i);return i*s<0&&(a-=Fi*Zi(t)*Zi(i)),[a/s,2*Ui(Ki(n/r,1/s))-zi]},r}function _r(t,e){return[t,e]}function yr(t,e){var i=Yi(t),s=t===e?qi(t):(i-Yi(e))/(e-t),n=i/s+t;if(Wi(s)Di&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Cr.invert=dr(es),Br.invert=dr((function(t){return 2*Ui(t)})),Er.invert=function(t,e){return[-e,2*Ui(Xi(t))-zi]};var Or={exports:{}},Ir=function(t,e){this.p1=t,this.p2=e};Ir.prototype.rise=function(){return this.p2[1]-this.p1[1]},Ir.prototype.run=function(){return this.p2[0]-this.p1[0]},Ir.prototype.slope=function(){return this.rise()/this.run()},Ir.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Ir.prototype.isVertical=function(){return!isFinite(this.slope())},Ir.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Ir.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Ir.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Ir.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)},Ir.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Lr=Ir,Dr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Lr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Dr(t.slice(0,s),e),o=Dr(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},Fr=Dr;!function(t){var e=Fr;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;r{const i=jr(Nr,e),{tolerance:s}=i;return zr(t,s)};var Ur;!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"}(Ur||(Ur={}));const Gr=(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.sort&&(k(l.sortIndex)||(l.sortIndex=0),u(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!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;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,y=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],k=new Set,A=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),k.has(i)||(k.add(i),S.push(i),_(m)?A.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):A.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else y[r][l]+=a;e&&e.includeValues&&!v&&y[r][c].push(t[n]);break}}}let M=0;const w=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=y.length;t0?y[t][l]/M:0,w.push(y[t])}return w},Xr=(t,e)=>{var i,s,n,r,a,o,l,h,c,u;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,y=-1/0;if(e.extent)v=e.extent[0],y=e.extent[1];else for(let e=0;ey&&(y=s))}if(!Number.isFinite(v)||!Number.isFinite(y)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=y;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(y-v>1){const e=Math.floor(v),i=Math.ceil((y-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>y){t=s,m.length=t+1;break}}else{const e=(y-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>y){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",k=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",A=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",M=null!==(u=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==u?u:"percentage",w=_(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],T=_(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],C=T.length?T:void 0,B=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:k,percentageName:M,valuesName:A,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:C});if(!w.length)return Yr(t,B);const E={};return t.forEach((t=>{const e=w.map((e=>null==t?void 0:t[e])).join("-&&-");E[e]?E[e].push(t):E[e]=[t]})),Object.values(E).map((t=>{const e=[...T,...w];return Yr(t,Object.assign(Object.assign({},B),{groupField:e.length?e:void 0,n:t.length}))})).flat()},$r=(t,e)=>{var i,s,n,r,a,o,l,h,c,u,p,g,f,m,v,y;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const k=!!(null==e?void 0:e.includeValues),A=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},M=null!==(n=A.key)&&void 0!==n?n:_(x)?null:null!==(r=x)&&void 0!==r?r:"key",w=null!==(a=A.count)&&void 0!==a?a:"count",T=null!==(o=A.mean)&&void 0!==o?o:"mean",C=null!==(l=A.q1)&&void 0!==l?l:"q1",B=null!==(h=A.median)&&void 0!==h?h:"median",E=null!==(c=A.q3)&&void 0!==c?c:"q3",P=null!==(u=A.iqr)&&void 0!==u?u:"iqr",R=null!==(p=A.min)&&void 0!==p?p:"min",O=null!==(g=A.max)&&void 0!==g?g:"max",I=null!==(f=A.lowerWhisker)&&void 0!==f?f:"lowerWhisker",L=null!==(m=A.upperWhisker)&&void 0!==m?m:"upperWhisker",D=null!==(v=A.outliers)&&void 0!==v?v:"outliers",F=null!==(y=A.values)&&void 0!==y?y:"values",z=new Map,j=new Map,H=new Map,V=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),k&&j.set(r,[]),_(x)?H.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):H.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),k){const t=j.get(r);t&&t.push(i)}}_(S)&&(S=[mt(Math.min.apply(null,S),0,1),mt(Math.max.apply(null,S),0,1)]);const N=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=H.get(t);if(null!==M)f[M]=m;else if(_(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[w]=s,f[T]=o,f[C]=l,f[B]=h,f[E]=c,f[P]=d,f[R]=n,f[O]=r,f[I]=u,f[L]=p,f[D]=g,k&&(f[F]=j.get(t)||[]),N.push(f)}return N};var Kr={},qr={};function Zr(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function Jr(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function Qr(t,e){var i=t+"",s=i.length;return s9999?"+"+Qr(e,6):Qr(e,4))+"-"+Qr(t.getUTCMonth()+1,2)+"-"+Qr(t.getUTCDate(),2)+(r?"T"+Qr(i,2)+":"+Qr(s,2)+":"+Qr(n,2)+"."+Qr(r,3)+"Z":n?"T"+Qr(i,2)+":"+Qr(s,2)+":"+Qr(n,2)+"Z":s||i?"T"+Qr(i,2)+":"+Qr(s,2)+"Z":"")}function ea(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 qr;if(h)return h=!1,Kr;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(;a0}function ua(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=ra(t));var r=[];switch(t.type){case"GeometryCollection":return pa(t,(function(t){fa(t,s)})),t;case"FeatureCollection":return ua(t,(function(t){ua(fa(t,s),(function(t){r.push(t)}))})),oi(r)}return fa(t,s)}function fa(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return pa(t,(function(t){fa(t,e)})),t;case"LineString":return ma(ca(t),e),t;case"Polygon":return va(ca(t),e),t;case"MultiLineString":return ca(t).forEach((function(t){ma(t,e)})),t;case"MultiPolygon":return ca(t).forEach((function(t){va(t,e)})),t;case"Point":case"MultiPoint":return t}}function ma(t,e){da(t)===e&&t.reverse()}function va(t,e){da(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=_a(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Sa=(t,e={},i)=>{i.type=Ur.GEO;const s=jr(ba,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(xa(t))})):e.push(xa(t))})),e})(t);let l=t.features;return o&&(l=ga(t,{reverse:!p(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=ya.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=ya.bounds(t);t.bbox=e}})),t.features=l,t},ka={},Aa=(t,e,i)=>{i.type=Ur.GEO;const s=jr(ba,ka,e),{object:n}=s;if(!v(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 Rr(a,t)}))}:Rr(a,o));var a,o;return Sa(r,s,i)},Ma=(t,e,i)=>{const s=!h(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))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let wa=0;function Ta(t="dataset"){return wa>1e8&&(wa=0),t+"_"+wa++}class Ca{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new o,i=(null==t?void 0:t.name)?t.name:Ta("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()}}class Ba{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new o,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&N(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Ta("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){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,e=!0){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)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}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,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&N(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof Ba||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?z({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!d(this._fields)&&d(i)?(this.dataSet.registerTransform("fields",Gr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Un();const Ea={},Pa={albers:hr,albersusa:function(){var t,e,i,s,n,r,a=hr(),o=lr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=lr().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)}},Ra=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Oa(t,e){return function i(){const s=e();return s.type=t,s.path=Un().projection(s),s.copy=s.copy||function(){const t=i();return Ra.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Ia{static GenAutoIncrementId(){return Ia.auto_increment_id++}}Ia.auto_increment_id=0;class La{constructor(t){this.id=Ia.GenAutoIncrementId(),this.registry=t}}const Da="named",Fa="inject",za="multi_inject",ja="inversify:tagged",Ha="inversify:paramtypes";class Va{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===Da?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var Na=function(t){var e;return function(t){const e="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),s=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),n=new WeakMap;function r(t,e,i){let r=n.get(t);if(h(r)){if(!i)return;r=new s,n.set(t,r)}let a=r.get(e);if(h(a)){if(!i)return;a=new s,r.set(e,a)}return a}function a(t,e,i){if(o(t,e,i))return!0;const s=f(e);return!c(s)&&a(t,s,i)}function o(t,e,i){const s=r(e,i,!1);return!h(s)&&!!s.has(t)}function l(t,e,i){if(o(t,e,i))return function(t,e,i){const s=r(e,i,!1);if(!h(s))return s.get(t)}(t,e,i);const s=f(e);return c(s)?void 0:l(t,s,i)}function h(t){return void 0===t}function c(t){return null===t}function d(t){return"object"==typeof t?null!==t:"function"==typeof t}function u(t,i){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const s=3===i?"string":5===i?"number":"default",n=function(t,e){const i=t[e];if(null!=i){if(!g(i))throw new TypeError;return i}}(t,e);if(void 0!==n){const e=n.call(t,s);if(d(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.valueOf;if(g(i)){const e=i.call(t);if(!d(e))return e}}else{const e=t.valueOf;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.toString;if(g(i)){const e=i.call(t);if(!d(e))return e}}throw new TypeError}(t,"default"===s?"number":s)}function p(t){const e=u(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function g(t){return"function"==typeof t}function f(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const s=t.prototype,n=s&&Object.getPrototypeOf(s);if(null==n||n===Object.prototype)return e;const r=n.constructor;return"function"!=typeof r||r===t?e:r}t("defineMetadata",(function(t,e,i,s){if(!d(i))throw new TypeError;return n=t,a=e,void r(i,s,!0).set(n,a);var n,a})),t("hasMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),l(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function Wa(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};Na.hasOwnMetadata(t,e)&&(r=Na.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,Na.defineMetadata(t,r,e)}(ja,t,i.toString(),s)}function Ua(t){return(e,i,s)=>{Wa(e,0,s,t)}}function Ga(t){return e=>(i,s,n)=>Ua(new Va(t,e))(i,s,n)}const Ya=Ga(Fa),Xa=Ga(za);function $a(){return function(t){return Na.defineMetadata(Ha,null,t),t}}function Ka(t){return Ua(new Va(Da,t))}const qa="Singleton",Za="Transient",Ja="ConstantValue",Qa="DynamicValue",to="Factory",eo="Function",io="Instance",so="Invalid";class no{constructor(t,e){this.id=Ia.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=so,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new no(this.serviceIdentifier,this.scope);return t.activated=t.scope===qa&&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 ro{getConstructorMetadata(t){return{compilerGeneratedMetadata:Na.getMetadata(Ha,t),userGeneratedMetadata:Na.getMetadata(ja,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const ao=(oo=Da,t=>{const e=e=>{if(null==e)return!1;if(e.key===oo&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const co=Symbol("ContributionProvider");class uo{constructor(t,e){this.serviceIdentifier=t,this.container=e,go.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function po(t,e){t(co).toDynamicValue((({container:t})=>new uo(e,t))).inSingletonScope().whenTargetNamed(e)}class go{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}go.store=new Map;class fo{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 mo extends fo{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const vo=Symbol.for("EnvContribution"),_o=Symbol.for("VGlobal"),yo=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Za,this.options=e,this.id=Ia.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new ro}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,Da,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new no(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new ho(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[Fa],multiInject:s[za]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:a,metadata:e,bindings:l};n.push(t)}}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 eo:e=t.cache;break;case io: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===qa&&(t.cache=e,t.activated=!0)}},bo=Symbol.for("RenderService");const xo=new class{get renderService(){return this._renderService||(this._renderService=yo.get(bo)),this._renderService}};let So=0;class ko{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=xo.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++So,t),this.tryRunAnimationFrameNextFrame(),So}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class Ao{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var Mo=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wo=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},To=function(t,e){return function(i,s){e(i,s,t)}},Co=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 Bo=class extends Ao{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}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){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Ia.GenAutoIncrementId(),this.hooks={onSetEnv:new mo(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}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)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new ko);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}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)}loadFont(t,e,i){return Co(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}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,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var Eo,Po,Ro,Oo;Bo=Mo([$a(),To(0,Ya(co)),To(0,Ka(vo)),wo("design:paramtypes",[Object])],Bo),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(Eo||(Eo={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(Po||(Po={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(Ro||(Ro={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(Oo||(Oo={}));const Io=jt-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)>Io)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%=jt)<0&&(s+=jt),(n%=jt)<0&&(n+=jt),nn;++o,a-=zt)g(a);else for(a=s-s%zt+zt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const Fo=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,zo={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},jo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let Ho,Vo,No,Wo,Uo,Go;var Yo,Xo,$o,Ko,qo,Zo;function Jo(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),f=Math.cos(n),m=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+f,k=i+m,A=S+y*m,M=k-y*f;return[h*b+c*x,d*b+u*x,h*A+c*M,d*A+u*M,h*S+c*k,d*S+u*k]}function Qo(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=re(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 f=d/i,m=c/i,v=-c/s,_=d/s,y=f*o+m*l,b=v*o+_*l,x=f*t+m*e,S=v*t+_*e;let k=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;k<0&&(k=0);let A=Math.sqrt(k);r===n&&(A=-A);const M=.5*(y+x)-A*(S-b),w=.5*(b+S)+A*(x-y),T=Math.atan2(b-w,y-M);let C=Math.atan2(S-w,x-M)-T;C<0&&1===r?C+=jt:C>0&&0===r&&(C-=jt);const B=Math.ceil(Math.abs(C/(zt+.001))),E=[];for(let t=0;te.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 el(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=ll(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Ut(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Ut(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function cl(t,e){const{p0:i,p1:s}=t,n=ne.pointAtPP(i,s,e);return[new dl(i,n),new dl(n,s)]}class dl extends il{constructor(t,e){super(),this.type=qo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return ne.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Nt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?ne.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Ko.ROW?Vt(this.p0.x-this.p1.x):t===Ko.COLUMN?Vt(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class ul{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new hl(new se(this._lastX,this._lastY),new se(t,e),new se(i,s),new se(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new dl(new se(this._lastX,this._lastY),new se(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===Ko.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Vt(t.p0.y-s.y)}if(t===Ko.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Vt(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class pl extends ul{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 gl(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function fl(t,e,i){const s=null!=e?e:Vt(i[i.length-1].x-i[0].x)>Vt(i[i.length-1].y-i[0].y)?Ko.ROW:Ko.COLUMN;return"monotoneY"===t?new pl(t,s):new ul(t,s)}class ml{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 vl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=fl("linear",i,t);return function(t,e){gl(t,e,1)}(new ml(n,s),t),n}function _l(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 yl{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&&_l(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:_l(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 bl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return vl(t,e);const n=fl("basis",i,t);return function(t,e){gl(t,e,2)}(new yl(n,s),t),n}function xl(t){return t<0?-1:1}function Sl(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(xl(r)+xl(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function kl(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Al(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 Ml{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:Al(this,this._t0,kl(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,Al(this,kl(this,e=Sl(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Al(this,this._t0,e=Sl(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 wl extends Ml{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Tl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return vl(t,e);const n=fl("monotoneX",i,t);return function(t,e){gl(t,e,2)}(new Ml(n,s),t),n}function Cl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return vl(t,e);const n=fl("monotoneY",i,t);return function(t,e){gl(t,e,2)}(new wl(n,s),t),n}let Bl=class{constructor(t,e=.5,i){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;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):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()}};class El extends Bl{lineEnd(){this.context.closePath()}}function Pl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new ul("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?Ko.ROW:Ko.COLUMN);return Rl(new Bl(r,e,n),t),r}function Rl(t,e){return gl(t,e,1)}class Ol extends ml{lineEnd(){this.context.closePath()}}function Il(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=fl("linear",i,t);return function(t,e){gl(t,e,1)}(new Ol(n,s),t),n}function Ll(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Dt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>Dt){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function Dl(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return vl(i,n);const o=fl(t,r,i);return gl(new e(o,s,a),i,2),o}}const Fl=Dl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:Ll(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const zl=Dl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:Ll(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class jl extends il{constructor(t,e,i){super(),this.type=qo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return ol(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,sl([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===Ko.ROW?Vt(this.p0.x-this.p2.x):t===Ko.COLUMN?Vt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Ut(t-.01,0),i=Gt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Nt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=ol(i,s,n,e),a=ne.pointAtPP(i,s,e),o=ne.pointAtPP(s,n,e);return[new jl(i,a,r),new jl(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Hl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new dl(new se(this._lastX,this._lastY),new se(t,e))}quadraticCurveTo(t,e,i,s){const n=new jl(new se(this._lastX,this._lastY),new se(t,e),new se(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new hl(new se(this._lastX,this._lastY),new se(t,e),new se(i,s),new se(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Vl(t,e,i){var s,n;switch(e){case"linear":default:return vl(t,i);case"basis":return bl(t,i);case"monotoneX":return Tl(t,i);case"monotoneY":return Cl(t,i);case"step":return Pl(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new ul("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?Ko.ROW:Ko.COLUMN);return Rl(new El(r,e,n),t),r}(t,.5,i);case"stepBefore":return Pl(t,0,i);case"stepAfter":return Pl(t,1,i);case"catmullRom":return Fl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return zl(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return Il(t,i)}}class Nl extends Do{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Lo(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([jo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([jo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([jo.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([jo.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([jo.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([jo.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([jo.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([jo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([jo.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()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Hl(this);el(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[jo.M]=t=>`M${t[1]} ${t[2]}`,t[jo.L]=t=>`L${t[1]} ${t[2]}`,t[jo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[jo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[jo.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3];((t,e,i,s,n,r,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;e`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[jo.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;tGo){let t,e=No;for(let s=1,r=i.length;s{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,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),el(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Ko.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.y-e.p1.y)}if(this.direction===Ko.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{rt.getInstance().warn("空函数")}}),ah=Object.assign(Object.assign({},Jl),{points:[],cornerRadius:0,closePath:!0}),oh=Object.assign(Object.assign({},Jl),{width:100,height:100,spikes:5,thickness:.5}),lh=Object.assign(Object.assign({},Jl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},Jl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const hh=Object.assign(Object.assign({},Jl),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),ch=Object.assign(Object.assign(Object.assign({},Jl),Kl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),dh=Object.assign(Object.assign(Object.assign({},Jl),Kl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",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}),uh=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0,maxWidth:500,maxHeight:500},Jl),{fill:!0,cornerRadius:0,cornerType:"round"}),ph=Object.assign(Object.assign({},uh),{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}),gh=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 m("directional",t.sideOrCorner,1)||m("angular",t.angleValue,1)}function a(){return m("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=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 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=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 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 fh{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(fh.IsGradientStr(t))try{const e=gh(t)[0];if(e){if("linear"===e.type)return fh.ParseLinear(e);if("radial"===e.type)return fh.ParseRadial(e);if("conic"===e.type)return fh.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Ft/2,n=parseFloat(e.value)/180*Ft-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Ht,stops:fh.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:fh.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Ft/2;let n="angular"===e.type?parseFloat(e.value)/180*Ft:0;for(;n<0;)n+=Ht;for(;n>=Ht;)n-=Ht;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}const _h={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"}},yh=!0,bh=!1,xh=/\w|\(|\)|-/,Sh=/[.?!,;:/,。?!、;:]/,kh=/\S/,Ah=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function Mh(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=xo.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=wh(t,a)),a}function wh(t,e,i=!1){let s=e;for(;xh.test(t[s-1])&&xh.test(t[s])||Sh.test(t[s]);)if(s--,s<=0)return i?Th(t,e):e;return s}function Th(t,e){let i=e;for(;xh.test(t[i+1])&&xh.test(t[i])||Sh.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Ch(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=xo.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}var Bh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Eh=class{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=ch.fontSize}){let i=0,s=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 a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=wh(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_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){if(s===n){rt.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}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),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);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}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,a=!1){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=wh(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}};Eh=Bh([$a()],Eh);var Ph=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Rh=Symbol.for("TextMeasureContribution");let Oh=class extends Eh{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}};Oh=Ph([$a()],Oh);const Ih=Symbol.for("CanvasFactory"),Lh=Symbol.for("Context2dFactory");function Dh(t){return yo.getNamed(Ih,xo.global.env)(t)}const Fh=1e-4,zh=Math.sqrt(3),jh=1/3;function Hh(t){return t>-Qh&&tQh||t<-Qh}const Nh=[0,0],Wh=[0,0],Uh=[0,0];function Gh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Yh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function Xh(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 $h(t){return(t%=Ht)<0&&(t+=Ht),t}function Kh(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+=Ht);let d=Math.atan2(l,o);return d<0&&(d+=Ht),d>=s&&d<=n||d+Ht>=s&&d+Ht<=n}function Jh(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(Hh(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 ec=[-1,-1,-1],ic=[-1,-1];function sc(){const t=ic[0];ic[0]=ic[1],ic[1]=t}function nc(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(Hh(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,jh):Math.pow(i,jh),s=s<0?-Math.pow(-s,jh):Math.pow(s,jh);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+zh*Math.sin(e)))/(3*a),h=(-o+i*(s-zh*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,ec);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&sc(),p=Xh(e,s,r,o,ic[0]),u>1&&(g=Xh(e,s,r,o,ic[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Hh(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,ec);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=Yh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);ec[0]=-l,ec[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Ht-1e-4){s=0,n=Ht;const e=r?1:-1;return a>=ec[0]+t&&a<=ec[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Ht,n+=Ht);let c=0;for(let e=0;e<2;e++){const i=ec[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Ht+t),(t>=s&&t<=n||t+Ht>=s&&t+Ht<=n)&&(t>Ft/2&&t<1.5*Ft&&(e=-e),c+=e)}}return c}function oc(t){return Math.round(t/Ft*1e8)/1e8%2*Ft}function lc(t,e){let i=oc(t[0]);i<0&&(i+=Ht);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Ht?n=i+Ht:e&&i-n>=Ht?n=i-Ht:!e&&i>n?n=i+(Ht-oc(i-n)):e&&i1&&(i||(h+=Pe(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],v=a[2],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,k=b;hc[0]=S,hc[1]=k,lc(hc,Boolean(a[6])),S=hc[0],k=hc[1];const A=S,M=k-S,w=!!(1-(a[6]?0:1)),T=(s-m)*_/_+m;switch(f){case jo.M:u=m,p=v,c=u,d=p;break;case jo.L:if(i){if(Jh(c,d,m,v,e,s,n))return!0}else h+=Pe(c,d,m,v,s,n)||0;c=m,d=v;break;case jo.C:if(i){if(qh(c,d,m,v,_,y,b,x,e,s,n))return!0}else h+=nc(c,d,m,v,_,y,b,x,s,n)||0;c=b,d=x;break;case jo.Q:if(i){if(Kh(c,d,m,v,_,y,e,s,n))return!0}else h+=rc(c,d,m,v,_,y,s,n)||0;c=_,d=y;break;case jo.A:if(o=Math.cos(A)*_+m,l=Math.sin(A)*_+v,g?(u=o,p=l):h+=Pe(c,d,o,l,s,n),i){if(Zh(m,v,_,A,A+M,w,e,T,n))return!0}else h+=ac(m,v,_,A,A+M,w,T,n);c=Math.cos(A+M)*_+m,d=Math.sin(A+M)*_+v;break;case jo.R:if(u=c=m,p=d=v,o=u+_,l=p+y,i){if(Jh(u,p,o,p,e,s,n)||Jh(o,p,o,l,e,s,n)||Jh(o,l,u,l,e,s,n)||Jh(u,l,u,p,e,s,n))return!0}else h+=Pe(o,p,o,l,s,n),h+=Pe(u,l,u,p,s,n);break;case jo.Z:if(i){if(Jh(c,d,u,p,e,s,n))return!0}else h+=Pe(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},pc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const gc=Symbol.for("VWindow"),fc=Symbol.for("WindowHandlerContribution");let mc=class extends Ao{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(){super(),this.hooks={onChange:new mo(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(yo.getNamed(fc,t.env).configure(this,t),this.actived=!0)},this._uid=Ia.GenAutoIncrementId(),this.global=xo.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}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.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}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&&ut(this.width,t.width())&&ut(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)}};mc=uc([$a(),pc("design:paramtypes",[])],mc);var vc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},yc=function(t,e){return function(i,s){e(i,s,t)}};let bc=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=xo.global,this._textMeasureMap=new Map,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}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||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=dc.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="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:Kl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Le(Object.assign({defaultFontParams:{fontFamily:Kl.fontFamily,fontSize:Kl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Le.ALPHABET_CHAR_SET+Le.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=yo.get(gc),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 xc;bc=vc([$a(),yc(0,Ya(co)),yc(0,Ka(Rh)),_c("design:paramtypes",[Object])],bc),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(xc||(xc={}));const Sc=new Ne;let kc=class{constructor(){this.matrix=new Ne}init(t){return this.mode=xc.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=xc.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Sc.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(Sc.a,Sc.b,Sc.c,Sc.d,Sc.e,Sc.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Sc.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(Sc.a,Sc.b,Sc.c,Sc.d,Sc.e,Sc.f),this}scale(t,e,i){return this.mode===xc.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===xc.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Sc.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Sc.a,Sc.b,Sc.c,Sc.d,Sc.e,Sc.f),this}translate(t,e){return this.mode===xc.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===xc.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};kc=vc([$a(),_c("design:paramtypes",[])],kc);const Ac={arc:Ql,area:th,circle:eh,line:nh,path:rh,symbol:hh,text:ch,rect:lh,polygon:ah,star:oh,richtext:dh,richtextIcon:ph,image:uh,group:ih,glyph:sh},Mc=Object.keys(Ac);function wc(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Tc={arc:Object.assign({},Ac.arc),area:Object.assign({},Ac.area),circle:Object.assign({},Ac.circle),line:Object.assign({},Ac.line),path:Object.assign({},Ac.path),symbol:Object.assign({},Ac.symbol),text:Object.assign({},Ac.text),rect:Object.assign({},Ac.rect),polygon:Object.assign({},Ac.polygon),star:Object.assign({},Ac.star),richtext:Object.assign({},Ac.richtext),richtextIcon:Object.assign({},Ac.richtextIcon),image:Object.assign({},Ac.image),group:Object.assign({},Ac.group),glyph:Object.assign({},Ac.glyph)};class Cc{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Mc.forEach((t=>{this._defaultTheme[t]=Object.create(Tc[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,i=!1){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;Mc.forEach((s=>{const n=Object.create(Tc[s]);t&&t[s]&&wc(n,t[s]),i[s]&&wc(n,i[s]),e[s]&&wc(n,e[s]),this.combinedTheme[s]=n})),e.common&&Mc.forEach((t=>{wc(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 Bc=new Cc;function Ec(t,e){return t.glyphHost?Ec(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)):Bc.getTheme()}return null}(t)||t.attachedThemeGraphic&&Ec(t.attachedThemeGraphic)||Bc.getTheme()}var Pc=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 Rc extends o{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=Ia.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){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,e=!1){return Pc(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,e=!0){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,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)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===t||t===e)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===t)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,e=!1){let 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,e=!1){let 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,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Lc))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(jc(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 Lc))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=jc(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 Lc))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=jc(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 Lc))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=jc(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 Lc))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=zc.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(jc(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(jc(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,jc(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(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 Lc))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"):jc(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 Dc))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=zc.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.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),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 Hc(s,{clickInterval:a,supportsTouchEvents:o}),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 Lc,this.rootWheelEvent=new Dc,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&&v(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.addEventListener("pointermove",this.onPointerMove,!0),t.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.addEventListener("mousemove",this.onPointerMove,!0),t.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.removeEventListener("pointermove",this.onPointerMove,!0),t.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.removeEventListener("mousemove",this.onPointerMove,!0),t.removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}class Uc{static GetImage(t,e){var i;const s=Uc.cache.get(t);s?"fail"===s.loadState?xo.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):Uc.loadImage(t,e)}static GetSvg(t,e){var i;let s=Uc.cache.get(t);s?"fail"===s.loadState?xo.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"},Uc.cache.set(t,s),s.dataPromise=xo.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.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Uc.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Uc.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=xo.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=xo.global.loadBlob(t):"json"===e&&(i.dataPromise=xo.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Uc.isLoading&&Uc.toLoadAueue.length){Uc.isLoading=!0;const t=Uc.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Uc.cache.set(i,n),n.dataPromise=xo.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))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Uc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Uc.loading()})).catch((t=>{console.error(t),Uc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Uc.loading()}))}}),0)}static loadImage(t,e){const i=Gc(t,Uc.toLoadAueue);if(-1!==i)return Uc.toLoadAueue[i].marks.push(e),void Uc.loading();Uc.toLoadAueue.push({url:t,marks:[e]}),Uc.loading()}static improveImageLoading(t){const e=Gc(t,Uc.toLoadAueue);if(-1!==e){const t=Uc.toLoadAueue.splice(e,1);Uc.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Gc(t,e){for(let i=0;it?_(t)?0===t.length?0:1===t.length?t[0]:2===t.length?($c[0]=t[0],$c[2]=t[0],$c[1]=t[1],$c[3]=t[1],$c):t:t:0,qc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Zc=[1,2,3,0,1,2,3,0];function Jc(t,e,i,s){for(;t>=Ht;)t-=Ht;for(;t<0;)t+=Ht;for(;t>e;)e+=Ht;qc[0].x=i,qc[1].y=i,qc[2].x=-i,qc[3].y=-i;const n=Math.ceil(t/zt)%4,r=Math.ceil(e/zt)%4;if(s.add(Wt(t)*i,Yt(t)*i),s.add(Wt(e)*i,Yt(e)*i),n!==r||e-t>Ft){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new se(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new se(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{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)}}id.TimeOut=1e3/60;const sd=new id,nd=(t,e)=>{const i=((t,e)=>v(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};class rd{bounds(t,e){if(x(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}parseSize(t){return x(t)?t:Math.min(t[0],t[1])}}function ad(t,e,i,s,n){return n?t.arc(i,s,e,0,jt,!1,n):t.arc(i,s,e,0,jt),!1}var od=new class extends rd{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 ad(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return ad(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(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 ld=new class extends rd{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,this.parseSize(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,this.parseSize(e)/6,i,s,n,r)}};function hd(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 cd=new class extends rd{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 hd(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return hd(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return hd(t,this.parseSize(e)/2+n,i,s,r)}};function dd(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var ud=new class extends rd{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return dd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return dd(t,this.parseSize(e)/2+n,i,s)}};function pd(t,e,i,s,n=0){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}class gd extends rd{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 pd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return pd(t,this.parseSize(e)/2,i,s,n)}}var fd=new gd;var md=new class extends gd{constructor(){super(...arguments),this.type="triangle"}};const vd=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),_d=Math.sin(jt/10)*vd,yd=-Math.cos(jt/10)*vd;function bd(t,e,i,s){const n=_d*e,r=yd*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=jt*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 xd=new class extends rd{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 bd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return bd(t,this.parseSize(e)/2+n,i,s)}};const Sd=Xt(3);function kd(t,e,i,s){const n=e,r=n/Sd,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 Ad=new class extends rd{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 kd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return kd(t,this.parseSize(e)/2+n,i,s)}};function Md(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 wd=new class extends rd{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Md(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Md(t,this.parseSize(e)/2+n,i,s)}};function Td(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Cd=new class extends rd{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Td(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Td(t,this.parseSize(e)/2+n,i,s)}};const Bd=-.5,Ed=Xt(3)/2,Pd=1/Xt(12);function Rd(t,e,i,s){const n=e/2,r=e*Pd,a=n,o=e*Pd+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(Bd*n-Ed*r+i,Ed*n+Bd*r+s),t.lineTo(Bd*a-Ed*o+i,Ed*a+Bd*o+s),t.lineTo(Bd*l-Ed*h+i,Ed*l+Bd*h+s),t.lineTo(Bd*n+Ed*r+i,Bd*r-Ed*n+s),t.lineTo(Bd*a+Ed*o+i,Bd*o-Ed*a+s),t.lineTo(Bd*l+Ed*h+i,Bd*h-Ed*l+s),t.closePath(),!1}var Od=new class extends rd{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 Rd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Rd(t,this.parseSize(e)/2+n,i,s)}};function Id(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}var Ld=new class extends rd{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 Id(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Id(t,this.parseSize(e)/2,i,s,n)}};function Dd(t,e,i,s,n=0){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}var Fd=new class extends rd{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 Dd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Dd(t,this.parseSize(e)/2,i,s,n)}};function zd(t,e,i,s,n=0){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}var jd=new class extends rd{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 zd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return zd(t,this.parseSize(e)/2,i,s,n)}};const Hd=Xt(3);function Vd(t,e,i,s){const n=e*Hd;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var Nd=new class extends rd{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Vd(t,this.parseSize(e)/2/Hd,i,s)}drawOffset(t,e,i,s,n){return Vd(t,this.parseSize(e)/2/Hd+n,i,s)}};function Wd(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 Ud=new class extends rd{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 Wd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Wd(t,this.parseSize(e)/4+n,i,s)}};function Gd(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 Yd=new class extends rd{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 Gd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Gd(t,this.parseSize(e)/4+n,i,s)}};function Xd(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 $d=new class extends rd{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 Xd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Xd(t,this.parseSize(e)/4+n,i,s)}};function Kd(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 qd=new class extends rd{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 Kd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Kd(t,this.parseSize(e)/4+n,i,s)}};function Zd(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var Jd=new class extends rd{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return Zd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Zd(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function Qd(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var tu=new class extends rd{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return Qd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Qd(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function eu(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 iu=new class extends rd{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 eu(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return eu(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function su(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function nu(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var ru=new class extends rd{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 x(e)?nu(t,e,i,s):su(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){x(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return x(e)?nu(t,e+2*n,i,s):su(t,[e[0]+2*n,e[1]+2*n],i,s)}};const au=new He;class ou{constructor(t,e,i=!1){this.pathStr="",this.type=t,_(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),el(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(el(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return x(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{au.x1=i.bounds.x1*t,au.y1=i.bounds.y1*t,au.x2=i.bounds.x2*t,au.y2=i.bounds.y2*t,e.union(au)}))}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 lu={};[od,ld,cd,ud,Nd,md,xd,Ad,wd,Cd,Od,Ld,Fd,fd,jd,Ud,Yd,$d,qd,ru,Jd,tu,iu].forEach((t=>{lu[t.type]=t}));const hu={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"};class cu{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 du(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function uu(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",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=uu(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=du(t,"--\x3e",r+4,"Comment is not closed.");else{const a=uu(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 cu(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 cu(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 fu(t,e){return mu(t)}function mu(t,e){const i={};for(let e=0;eMu.set(t,!0)));const wu=new Map;function Tu(t){if(Mu.has(t))return!0;if(wu.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>wu.set(t,!0)));const Cu=ku(),Bu=ku(),Eu=ku(),Pu=ku(),Ru=ku(),Ou=ku(),Iu=ku(),Lu=ku(),Du=ku(),Fu=ku();ku();const zu=ku();ku();const ju=ku();ku();const Hu=ku(),Vu=ku(),Nu=Symbol.for("GraphicService"),Wu=Symbol.for("GraphicCreator"),Uu={"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"},Gu=Object.keys(Uu),Yu={duration:200,easing:"cubicOut"};function Xu(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}function $u(t,e,i){const s=i[0],n=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]*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],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*s+c*n+g*r+e[12],t[13]=o*s+d*n+f*r+e[13],t[14]=l*s+u*n+m*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function Ku(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 qu(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],f=e[12],m=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*f,t[1]=y*n+b*l+x*u+S*m,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*f,t[5]=y*n+b*l+x*u+S*m,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*f,t[9]=y*n+b*l+x*u+S*m,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*f,t[13]=y*n+b*l+x*u+S*m,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function Zu(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 Ju{constructor(){this.pools=[]}static identity(t){return Xu(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 Ju.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},ip=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const sp=new Ne(1,0,0,1,0,0),np={x:0,y:0};let rp=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new Ne(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ne(1,0,0,1,0,0),this.path=new Nl,this._clearMatrix=new Ne(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Qu.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ne(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(Qu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Qu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){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,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=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(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){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},np),function(t,e,i){return cc(t,0,!1,e,i)}(this.path.commandList,np.x,np.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},np);const i=mh(this,this.lineWidth,this.dpr);return function(t,e,i,s){return cc(t,e,!0,i,s)}(this.path.commandList,i,np.x,np.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(t=!0,e=this.dpr){this.setTransformFromMatrix(sp,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Qu.free(t))),this.stack.length=0}};rp=ep([$a(),ip("design:paramtypes",[Object,Number])],rp);const ap={WIDTH:500,HEIGHT:500,DPR:1};class op{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}set nativeCanvas(t){this._nativeCanvas=t}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=ap.WIDTH,height:n=ap.HEIGHT,dpr:r=ap.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(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var lp;op.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(lp||(lp={}));class hp{static Get(t,e=lp.Color1,i=[0,0,0,1]){if(e===lp.Color1){const e=hp.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ti.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];hp.store1[t]=e,hp.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=hp.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ti.parseColorString(t);return n&&(hp.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],hp.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===lp.Color1){if(hp.store1[t])return;hp.store1[t]=i,hp.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(hp.store255[t])return;hp.store255[t]=i,hp.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function cp(t,e=!1){return Array.isArray(t)&&x(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 dp(t,e,i,s,n){return Array.isArray(t)&&!x(t[0])||Array.isArray(e)&&!x(e[0])?new Array(4).fill(0).map(((n,r)=>{var a,o;return up(_(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,_(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):up(t,e,i,s,n)}function up(t,e,i,s,n){if(!t||!e)return t&&cp(t)||e&&cp(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=hp.Get(t,lp.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=hp.Get(e,lp.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:cp(a)})))});return o?dp(r,l,i,s,n):dp(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:mp(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:mp(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:mp(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),cp(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)}function pp(t,e,i){return`rgba(${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})`}hp.store255={},hp.store1={};const gp=[0,0,0,0],fp=[0,0,0,0];function mp(t,e,i){return hp.Get(t,lp.Color255,gp),hp.Get(e,lp.Color255,fp),`rgba(${Math.round(gp[0]+(fp[0]-gp[0])*i)},${Math.round(gp[1]+(fp[1]-gp[1])*i)},${Math.round(gp[2]+(fp[2]-gp[2])*i)},${gp[3]+(fp[3]-gp[3])*i})`}class vp{static GetCanvas(){try{return vp.canvas||(vp.canvas=xo.global.createCanvas({})),vp.canvas}catch(t){return null}}static GetCtx(){if(!vp.ctx){const t=vp.GetCanvas();vp.ctx=t.getContext("2d")}return vp.ctx}}class _p extends We{static getInstance(){return _p._instance||(_p._instance=new _p),_p._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=vp.GetCanvas(),s=vp.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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new _p(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class yp{static GetSize(t){for(let e=0;e=t)return yp.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=yp.GenKey(t,e,i,s,n),l=yp.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=yp.GenKey(t,e,i,s,n);yp.cache[l]?yp.cache[l].push({width:a,height:o,pattern:r}):yp.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}yp.cache={},yp.ImageSize=[20,40,80,160,320,640,1280,2560];const bp=new He,xp=new Ne;new He;const Sp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],kp=["x","y"],Ap=["scaleX","scaleY"],Mp=["angle"],wp=new se,Tp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Cp extends Rc{static mixin(t){const e=Object.keys(t);for(let i=0;i10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=lu[t];if(e)return e;if(e=Cp.userSymbolMap[t],e)return e;if(!0===((i=t=hu[t]||t).startsWith("{const e=(new Nl).fromString(t.d),i={};Gu.forEach((e=>{t[e]&&(i[Uu[e]]=t[e])})),n.push({path:e,attribute:i}),bp.union(e.bounds)}));const r=bp.width(),a=bp.height(),o=1/Ut(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new ou(t,n,!0);return Cp.userSymbolMap[t]=l,l}var i;const s=(new Nl).fromString(t),n=s.bounds.width(),r=s.bounds.height(),a=1/Ut(n,r);s.transform(0,0,a,a);const o=new ou(t,s);return Cp.userSymbolMap[t]=o,o}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,s=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:n=e.boundsPadding}=i,r=Kc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new Lo(t);return el(e.commandList,i,0,0),!0}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(t=!0){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(t=!0){return this._transMatrix||(this._transMatrix=new Ne),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&Yo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&Yo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}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===Xo.GLOBAL){const i=new se(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){this.setAttributes(t,e,i),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||s)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,i){t&&((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,e=!1,i){const s=Object.keys(t);for(let e=0;e{i[e]?(o||(o={}),o[e]=t[e]):a[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(r=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==r?r:Yu;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:a,duration:l.duration,easing:l.easing}}]),o&&this.setAttributesAndPreventAnimate(o,!1,{type:$o.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t)}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:$o.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{type:$o.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(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,i;const s=this.attribute[t];return this.animates&&this.animates.size?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=s?s:null===(i=this.finalAttribute)||void 0===i?void 0:i[t]}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){const i=_(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);s.length!==this.currentStates.length&&this.useStates(s,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;this.stateSort&&(t=t.sort(this.stateSort));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,i){const s=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Gl.x,y:e=Gl.y,scaleX:i=Gl.scaleX,scaleY:s=Gl.scaleY,angle:n=Gl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(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=Wt(a),f=Yt(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const _=m-i,y=v-s,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,k=d*g-h*f;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*k,t.e=u+l*m+c*v-b*_-S*y,t.f=p+h*m+d*v-x*_-k*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,!0),xo.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Gl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=xp.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.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:$o.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:xo.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),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 v(t,!0)?this.pathProxy=(new Nl).fromString(t):this.pathProxy=new Nl,this.pathProxy}loadImage(t,e=!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(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",this.stopAnimates(),xo.graphicService.onRelease(this),super.release()}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new Fc(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)}}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||xo.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new rp(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}var Bp;Cp.userSymbolMap={},Cp.mixin(Vc),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Bp||(Bp={}));let Ep=class t extends Cp{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Ou,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 Cc),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Cc)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===Xo.GLOBAL){const i=new se(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;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Gl.x,y:e=Gl.y,dx:i=Gl.dx,dy:s=Gl.dy,scaleX:n=Gl.scaleX,scaleY:r=Gl.scaleY,angle:a=Gl.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()}getGraphicTheme(){return Ec(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return xo.graphicService.updateTempAABBBounds(i),xo.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=Yo.CLEAR_BOUNDS,this._childUpdateTag&=Yo.CLEAR_BOUNDS}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(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().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),this.getGraphicService().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(t=!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=xo.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}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}};function Pp(t){return new Ep(t)}Ep.NOWORK_ANIMATE_ATTR=Tp;class Rp extends Ep{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 Cc,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!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=>{xo.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=>{xo.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 Op=Symbol.for("TransformUtil"),Ip=Symbol.for("GraphicUtil"),Lp=Symbol.for("LayerService"),Dp=Symbol.for("StaticLayerHandlerContribution"),Fp=Symbol.for("DynamicLayerHandlerContribution"),zp=Symbol.for("VirtualLayerHandlerContribution");var jp,Hp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Np=jp=class{static GenerateLayerId(){return`${jp.idprefix}_${jp.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=xo.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?yo.get(Dp):"dynamic"===t?yo.get(Fp):yo.get(zp),e}createLayer(t,e={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 Rp(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:jp.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)}};Np.idprefix="visactor_layer",Np.prefix_count=0,Np=jp=Hp([$a(),Vp("design:paramtypes",[])],Np);var Wp=new La((t=>{t(_o).to(Bo).inSingletonScope(),t(gc).to(mc),t(Ip).to(bc).inSingletonScope(),t(Op).to(kc).inSingletonScope(),t(Lp).to(Np).inSingletonScope()}));function Up(t,e){return!(!t&&!e)}function Gp(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Yp(t,e,i){return i&&t*e>0}function Xp(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function $p(t,e){return t*e>0}function Kp(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function qp(t,e,i,s,n,r,a){const o=t-i,l=e-s,h=(a?r:-r)/Math.sqrt(o*o+l*l),c=h*l,d=-h*o,u=t+c,p=e+d,g=i+c,f=s+d,m=(u+g)/2,v=(p+f)/2,_=g-u,y=f-p,b=_*_+y*y,x=n-r,S=u*f-g*p,k=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let A=(S*y-_*k)/b,M=(-S*_-y*k)/b;const w=(S*y+_*k)/b,T=(-S*_+y*k)/b,C=A-m,B=M-v,E=w-m,P=T-v;return C*C+B*B>E*E+P*P&&(A=w,M=T),{cx:A,cy:M,x01:-c,y01:-d,x11:A*(n/x-1),y11:M*(n/x-1)}}function Zp(t,e,i,s,n){const r=Vt(i-e),a=t.getParsedCornerRadius(),o=_(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,y=Math.max(f,g),b=Math.max(m,v);let x=y,S=b;const k=n*Wt(c),A=n*Yt(c),M=s*Wt(u),w=s*Yt(u);let T,C,B,E;if((b>Dt||y>Dt)&&(T=n*Wt(d),C=n*Yt(d),B=s*Wt(p),E=s*Yt(p),r1?0:P<-1?Ft:Math.acos(P))/2),l=Xt(t[0]*t[0]+t[1]*t[1]);S=Gt(b,(s-l)/(o-1)),x=Gt(y,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:k,yors:A,xirs:B,yirs:E,xore:T,yore:C,xire:M,yire:w,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:y,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function Jp(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(n=Ht-Dt)e.moveTo(i+n*Wt(o),s+n*Yt(o)),e.arc(i,s,n,o,l,!c),r>Dt&&(e.moveTo(i+r*Wt(l),s+r*Yt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:k,outerStartAngle:A,outerEndAngle:M,limitedIcr:w,innerDeltaAngle:T,innerEndAngle:C,innerStartAngle:B,innerCornerRadiusStart:E,innerCornerRadiusEnd:P,maxInnerCornerRadius:R}=Zp(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>Dt){const t=Gt(v,m),r=Gt(_,m),o=qp(g,f,u,p,n,t,Number(c)),l=qp(b,x,S,k,n,r,Number(c));m0&&e.arc(i+o.cx,s+o.cy,t,Nt(o.y01,o.x01),Nt(o.y11,o.x11),!c),e.arc(i,s,n,Nt(o.cy+o.y11,o.cx+o.x11),Nt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Nt(l.y11,l.x11),Nt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Wt(Nt(l.y01,l.x01)),s+l.cy+r*Yt(Nt(l.y01,l.x01))):e.moveTo(i+b,s+n*Yt(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,A,M,!c)):e.moveTo(i+n*Wt(M),s+n*Yt(M));if(!(r>Dt)||T<.001)!a||a[1]?e.lineTo(i+S,s+k):e.moveTo(i+S,s+k),d=!0;else if(w>Dt){const t=Gt(E,w),n=Gt(P,w),o=qp(S,k,b,x,r,-n,Number(c)),l=qp(u,p,g,f,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),w0&&e.arc(i+o.cx,s+o.cy,n,Nt(o.y01,o.x01),Nt(o.y11,o.x11),!c),e.arc(i,s,r,Nt(o.cy+o.y11,o.cx+o.x11),Nt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Nt(l.y11,l.x11),Nt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Wt(Nt(l.y01,l.x01)),s+l.cy+t*Yt(Nt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+k):e.moveTo(i+S,s+k),!a||a[2]?e.arc(i,s,r,C,B,c):e.moveTo(i+r*Wt(B),s+r*Yt(B))}return a?a[3]&&e.lineTo(i+n*Wt(o),s+n*Yt(o)):e.closePath(),d}const Qp=Symbol.for("ArcRenderContribution"),tg=Symbol.for("AreaRenderContribution"),eg=Symbol.for("CircleRenderContribution"),ig=Symbol.for("GroupRenderContribution"),sg=Symbol.for("ImageRenderContribution"),ng=Symbol.for("PathRenderContribution"),rg=Symbol.for("PolygonRenderContribution"),ag=Symbol.for("RectRenderContribution"),og=Symbol.for("SymbolRenderContribution"),lg=Symbol.for("TextRenderContribution"),hg=Symbol.for("InteractiveSubRenderContribution");function cg(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function dg(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}var ug=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},gg=function(t,e){return function(i,s){e(i,s,t)}};function fg(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:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:v}=e.attribute,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(s=m[2])&&void 0!==s?s:0}if(Xu(t),$u(t,t,[n+o,r+l,a+h]),$u(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),$u(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]),f){const i=tp.allocate(),s=[0,0];if(v){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=m[1]}$u(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,f),$u(i,i,[-s[0],-s[1],0]),qu(t,t,i)}}let mg=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new mo(["graphic"]),onSetStage:new mo(["graphic","stage"]),onRemove:new mo(["graphic"]),onRelease:new mo(["graphic"]),onAddIncremental:new mo(["graphic","group","stage"]),onClearIncremental:new mo(["graphic","group","stage"]),beforeUpdateAABBBounds:new mo(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new mo(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new mo(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new He,this.tempAABBBounds2=new He}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)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}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 el(i.commandList,s,0,0),!0}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=x(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=dg(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=x(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=cg(n,e);i.set(s,i.y1,s+e,i.y2)}}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){xu(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;xu(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&&ze(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};mg=ug([$a(),gg(0,Ya(Wu)),pg("design:paramtypes",[Object])],mg);const vg=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},_g=["radius","startAngle","endAngle",...Sp];class yg extends Cp{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=Pu}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)}getGraphicTheme(){return Ec(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=xo.graphicService.updateTempAABBBounds(i);return vg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,xo.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Ht-Dt?i.set(-r,-r,r,r):Jc(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,_g)}needUpdateTag(t){return super.needUpdateTag(t,_g)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Nl,s.arc(0,0,r,a,o),s}clone(){return new yg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return yg.NOWORK_ANIMATE_ATTR}}function bg(t){return new yg(t)}yg.NOWORK_ANIMATE_ATTR=Tp;class xg{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Eo.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,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;a{t+=e.str})),(Array.isArray(r)?r.join(""):r).toString()!==t}return"vertical"===s.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==s.text.toString():null!=this.clipedText&&this.clipedText!==s.text.toString()}get multilineLayout(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=Vu,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}getGraphicTheme(){return Ec(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new kg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Ae(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=xo.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){xu(n,o/Math.abs(r+a),!0,l),i.union(n)}return xo.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||xo.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,ze(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:_=s.ignoreBuf,keepCenterInLine:y=s.keepCenterInLine}=n,b=_?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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(f/2),this._AABBBounds}const S=xo.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),k=new xg(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:y}),{bbox:A}=k;return this.cache.layoutData=k,this.clearUpdateShapeTag(),this._AABBBounds.set(A.xOffset,A.yOffset,A.xOffset+A.width,A.yOffset+A.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{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,measureMode:v=r.measureMode,suffixPosition:y=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,k=m?0:this.guessLineHeightBuf(h),A=this.getLineHeight(this.attribute,r,k);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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 M=xo.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),w={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:A},T=new xg(a,w,M),C=_(t)?t.map((t=>t.toString())):[t.toString()],B=[],E=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/A),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),E[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Ut(e,a)}));const t=cg(_,a),e=this.cache.verticalList.length*v,i=dg(y,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>function(t){const e=[];let i=0,s="";for(let n=0;n{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===Au.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))})),this.cache.verticalList=b,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Ut(e,a)}));const x=cg(_,a),S=this.cache.verticalList.length*v,k=dg(y,S,d);return this._AABBBounds.set(k,x,k+S,x+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=nd(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=Sg){return super.needUpdateTags(t,e)}needUpdateTag(t,e=Sg){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new kg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return kg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return kg.baselineMapAlign}getAlignMapBaseline(){return kg.alignMapBaseline}}function Ag(t){return new kg(t)}kg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Tp),kg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},kg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Mg=["symbolType","size",...Sp];let wg=class t extends Cp{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=Hu}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}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{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return Ec(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=xo.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;xu(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){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){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,Mg)}needUpdateTag(t){return super.needUpdateTag(t,Mg)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new Nl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Nl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Tg(t){return new wg(t)}wg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Tp);const Cg=["segments","points","curveType","curveTension",...Sp];let Bg=class t extends Cp{constructor(t={}){super(t),this.type="line",this.numberType=Lu}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=td(i,s,e))}getGraphicTheme(){return Ec(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),xo.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Cg)}needUpdateTag(t){return super.needUpdateTag(t,Cg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Nl;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Eg(t){return new Bg(t)}Bg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Tp);const Pg=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=d(t.width)?t.x1-t.x:t.width,i=d(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}},Rg=["width","x1","y1","height","cornerRadius",...Sp];class Og extends Cp{constructor(t){super(t),this.type="rect",this.numberType=zu}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Ec(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=xo.graphicService.updateTempAABBBounds(i);return vg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,xo.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Rg)}needUpdateTag(t){return super.needUpdateTag(t,Rg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=Pg(e);return t=new Nl,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new Og(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Og.NOWORK_ANIMATE_ATTR}}function Ig(t){return new Og(t)}Og.NOWORK_ANIMATE_ATTR=Tp;class Lg extends Cp{constructor(t){super(t),this.type="glyph",this.numberType=Ru,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,e=!1,i){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}getGraphicTheme(){return Ec(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}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(),this.stateSort&&(t=t.sort(this.stateSort));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.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Lg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Lg.NOWORK_ANIMATE_ATTR}}function Dg(t){return new Lg(t)}Lg.NOWORK_ANIMATE_ATTR=Tp;class Fg{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=_h[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}}}function zg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class jg{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=nd(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Ch(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||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,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r: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}=Ch(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Mh(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Ch(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=zg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Mh(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Ch(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=zg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=zg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=zg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=zg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&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=Mh(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Ch(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const Hg=["width","height","image",...Sp];class Vg extends Cp{constructor(t){super(t),this.type="image",this.numberType=Iu,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}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()})),this.addUpdateBoundTag()}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)}getGraphicTheme(){return Ec(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=xo.graphicService.updateTempAABBBounds(i);return vg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,xo.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return uh[t]}needUpdateTags(t){return super.needUpdateTags(t,Hg)}needUpdateTag(t){return super.needUpdateTag(t,Hg)}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({image:1,repeatX:1,repeatY:1},Tp);class Wg extends Vg{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=Kc(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=Kc(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=uh.width,height:e=uh.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 Ug{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 Wg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=_h[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof jg){const e=kh.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,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Wg)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Ch(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Wg)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Wg)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||bh;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,Ah(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||yh;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?vh(t,s,{AABBBounds:i}):s,Ah(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Wg)break;const{width:n}=Ch(t,s.character,s.ascentDescentMode),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.forEach(((t,e)=>{i+=t instanceof Wg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Gg{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=_h[this.direction]}store(t){if(t instanceof Wg){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 Ug(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,e=!1){t instanceof Wg?"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||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Mh(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new jg(i,t.newLine,t.character,t.ascentDescentMode),new jg(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Yg=!1;try{Yg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Yg=!1}const Xg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...Sp];class $g extends Cp{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=ju,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:dh.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:dh.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:dh.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:dh.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:dh.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:dh.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:dh.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:dh.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Ec(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&v(t.text)&&$g.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&v(t.text)&&$g.splitText(t.text).length>1)))}static splitText(t){if(Yg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=$g.splitText(t.text.toString());if(v(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),xo.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||xo.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,xo.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Xg)}needUpdateTag(t){return super.needUpdateTag(t,Xg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!$g.AllSingleCharacter(_)&&(_=$g.TransformTextConfig2SingleCharacter(_),this.attribute.textConfig=_);const y=[],b=null!=t?t:_;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,y.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(x(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,k="number"==typeof s&&Number.isFinite(s)&&s>0,A="number"==typeof n&&Number.isFinite(n)&&n>0&&(!S||n<=i),M="number"==typeof r&&Number.isFinite(r)&&r>0&&(!k||r<=s),w=new Fg(0,0,(A?n:S?i:0)||0,(M?r:k?s:0)||0,a,o,l,h,c,d||"horizontal",!A&&S,!M&&k,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),T=new Gg(w);if(T.newLine=v,p){let t=0,e=!1;for(let i=0;i{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=w}clone(){return new $g(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(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())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return $g.NOWORK_ANIMATE_ATTR}}function Kg(t){return new $g(t)}$g.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Tp);const qg=["path","customPath",...Sp];class Zg extends Cp{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=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Nl?e.path:(d(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Nl?this.cache:t.path)}getGraphicTheme(){return Ec(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=xo.graphicService.updateTempAABBBounds(i);vg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;v(t.path,!0)?this.cache=(new Nl).fromString(t.path):t.customPath&&(this.cache=new Nl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,qg)}needUpdateTag(t){return super.needUpdateTag(t,qg)}toCustomPath(){return(new Nl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Zg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Zg.NOWORK_ANIMATE_ATTR}}function Jg(t){return new Zg(t)}Zg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Tp);const Qg=["segments","points","curveType","curveTension",...Sp];class tf extends Cp{constructor(t){super(t),this.type="area",this.numberType=Eu}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}getGraphicTheme(){return Ec(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),xo.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),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}_interpolate(t,e,i,s,n){"points"===t&&(n.points=td(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Qg)}needUpdateTag(t){return super.needUpdateTag(t,Qg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Nl;const 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 tf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return tf.NOWORK_ANIMATE_ATTR}}function ef(t){return new tf(t)}tf.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Tp);const sf=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Sp];class nf extends Cp{constructor(t){super(t),this.type="arc",this.numberType=Cu}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=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(x(t,!0)?t:a*parseFloat(t)/100,a/2);if(_(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();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=oe(e),i=e+r,s&&Vt(r)Dt&&o>Dt)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=this.getGraphicTheme(),{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=Xt(a*a+o*o)}=this.attribute,h=Vt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>Dt&&l>Dt){const i=e>t?1:-1;let s=Kt(Number(l)/o*Yt(g)),n=Kt(Number(l)/a*Yt(g));return(f-=2*s)>Dt?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>Dt?(n*=i,c+=n,d-=n):(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}}getGraphicTheme(){return Ec(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=xo.graphicService.updateTempAABBBounds(i);vg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=Dt?i.set(0,0,0,0):Math.abs(o-l)>Ht-Dt?i.set(-s,-s,s,s):(Jc(l,o,s,i),Jc(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,sf)}needUpdateTag(t){return super.needUpdateTag(t,sf)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Vt(o-a),d=o>a;if(h=Ht-Dt)n.moveTo(0+h*Wt(a),0+h*Yt(a)),n.arc(0,0,h,a,o,!d),l>Dt&&(n.moveTo(0+l*Wt(o),0+l*Yt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Wt(a),e=h*Yt(a),i=l*Wt(o),s=l*Yt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new nf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return nf.NOWORK_ANIMATE_ATTR}}function rf(t){return new nf(t)}nf.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Tp);const af=["points","cornerRadius",...Sp];class of extends Cp{constructor(t){super(t),this.type="polygon",this.numberType=Fu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Ec(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),xo.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=td(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,af)}needUpdateTag(t){return super.needUpdateTag(t,af)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Nl,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new of(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return of.NOWORK_ANIMATE_ATTR}}function lf(t){return new of(t)}of.NOWORK_ANIMATE_ATTR=Tp;class hf extends Ep{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!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 cf(t){return new hf(t)}const df=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 uf,pf;function gf(t){return uf||(uf=df.CreateGraphic("text",{})),uf.initAttributes(t),uf.AABBBounds}var ff=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},vf=function(t,e){return function(i,s){e(i,s,t)}};class _f{constructor(){this.time=Zo.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:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit,backgroundKeepAspectRatio:y=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:k=l.backgroundClip}=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=Ec(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}k&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:_,backgroundKeepAspectRatio:y,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s){const{backgroundMode:n,backgroundFit:r,backgroundKeepAspectRatio:a,backgroundScale:o=1,backgroundOffsetX:l=0,backgroundOffsetY:h=0}=s,c=i.width(),d=i.height();let u=c,p=d;if("no-repeat"===n)if(r)if(a){const s=Math.max(c/e.width,d/e.height);t.drawImage(e,i.x1+l,i.y1+h,e.width*s*o,e.height*s*o)}else t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const s=e.width*o,n=e.height*o;t.drawImage(e,i.x1+l,i.y1+h,s,n)}else{if(r&&"repeat"!==n&&(e.width||e.height)){const i=e.width,s=e.height;"repeat-x"===n?(u=i*(d/s),p=d):"repeat-y"===n&&(p=s*(c/i),u=c);const r=t.dpr,a=dc.allocate({width:u,height:p,dpr:r}),o=a.getContext("2d");o&&(o.inuse=!0,o.clearMatrix(),o.setTransformForCurrent(!0),o.clearRect(0,0,u,p),o.drawImage(e,0,0,u,p),e=a.nativeCanvas),dc.free(a)}const s=t.dpr,a=t.createPattern(e,n);a.setTransform&&a.setTransform(new DOMMatrix([1/s,0,0,1/s,0,0])),t.fillStyle=a,t.translate(i.x1,i.y1),t.fillRect(0,0,c,d),t.translate(-i.x1,-i.y1)}}}const yf=new _f;let bf=class{constructor(t){this.subRenderContribitions=t,this.time=Zo.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)}))}};bf=ff([$a(),vf(0,Ya(co)),vf(0,Ka(hg)),mf("design:paramtypes",[Object])],bf);const xf=new class{constructor(){this.time=Zo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),_=t.AABBBounds,y=null!==(p=t.attribute.width)&&void 0!==p?p:_.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:_.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[y,b],i+y/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const Sf=new class{constructor(){this.time=Zo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}};class kf{constructor(){this.time=Zo.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=dc.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])),dc.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,Ht),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:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h;const{textureRatio:c=r.textureRatio,textureOptions:d=null}=e.attribute;let u=this.textureMap.get(t);if(!u)switch(t){case"circle":u=this.createCirclePattern(o,l,a,i);break;case"diamond":u=this.createDiamondPattern(o,l,a,i);break;case"rect":u=this.createRectPattern(o,l,a,i);break;case"vertical-line":u=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":u=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":u=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":u=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":u=this.createGridPattern(o,l,a,i)}if(d&&d.dynamicTexture){const{gridConfig:u={},useNewCanvas:p}=d,g=e.AABBBounds;s=g.x1,n=g.y1;const f=i;let m;if(p){m=dc.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=m.getContext("2d");t.clearRect(0,0,g.width(),g.height()),s=0,n=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,s,n,r),f.clip();const v=g.width(),_=g.height(),y=l,b=o,x=u.columns?u.columns:Math.ceil(v/b),S=u.rows?u.rows:Math.ceil(_/b),k=u.gutterColumn?u.gutterColumn:2*y,A=u.gutterRow?u.gutterRow:2*y;this._tempSymbolGraphic||(this._tempSymbolGraphic=Tg({}));const M=u.columns?v/u.columns:b,w=u.rows?_/u.rows:b;this._tempSymbolGraphic.setAttributes({size:[M-k,w-A],symbolType:t});const T=this._tempSymbolGraphic.getParsedPath();for(let t=0;t{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:mh(e,o,e.dpr),c=o/T,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:T+u*h,innerRadius:w-u*h,startAngle:_-u*c,endAngle:y+u*c}),e.beginPath(),Jp(t,e,i,s,T+u*h,w-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/k,(S-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder"),t.setAttributes({outerRadius:T,innerRadius:w,startAngle:_,endAngle:y})}},wf=Af,Tf=yf;const Cf=new class{constructor(){this.time=Zo.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,f=p&&!1!==p.visible;if(!g&&!f)return;const{radius:m=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:k=l.scaleY,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:mh(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),f&&M(p,"innerBorder")}},Bf=Af,Ef=yf;const Pf=new class extends _f{constructor(){super(...arguments),this.time=Zo.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,backgroundKeepAspectRatio:f=l.backgroundKeepAspectRatio,backgroundScale:m=l.backgroundScale,backgroundOffsetX:v=l.backgroundOffsetX,backgroundOffsetY:_=l.backgroundOffsetY}=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,{backgroundMode:p,backgroundFit:g,backgroundKeepAspectRatio:f,backgroundScale:m,backgroundOffsetX:v,backgroundOffsetY:_}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Rf=Ft/2;function Of(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),x(r,!0))l=[r=Vt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Vt(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Vt(t[0]),i=Vt(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Vt(l[0]),l[1]=Vt(l[1]),l[2]=Vt(l[2]),l[3]=Vt(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],_=[c[0],c[1]+g[1]],y=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],S=[u[0]+g[3],u[1]],k=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!K(v,_)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Rf,0,!1)}if(o&&o[1]?o[1](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!K(y,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Rf,!1)}if(o&&o[2]?o[2](y[0],y[1],S[0],S[1]):t.lineTo(S[0],S[1]),!K(S,k)){const e=S[0],i=S[1]-g[3];o&&o[2]&&t.moveTo(S[0],S[1]),t.arc(e,i,g[3],Rf,Ft,!1)}if(o&&o[3]?o[3](k[0],k[1],m[0],m[1]):t.lineTo(m[0],m[1]),!K(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],Ft,Ft+Rf,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),o&&o[2]?o[2](y[0],y[1],S[0],S[1]):t.lineTo(S[0],S[1]),o&&o[2]?o[2](S[0],S[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}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};class Lf{constructor(){this.time=Zo.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,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:k=l.scaleY,x1:A,y1:M,keepStrokeScale:w=l.keepStrokeScale}=t.attribute;let{width:T,height:C}=t.attribute;T=(null!=T?T:A-i)||0,C=(null!=C?C:M-s)||0;const B=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=w?h:mh(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||_(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,T-o*g,C-o*g)):(e.beginPath(),Of(e,u,p,T-o*g,C-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&B(u,"outerBorder"),f&&B(p,"innerBorder")}}let Df=class{constructor(){this.time=Zo.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)}};Df=If([$a()],Df);let Ff=class{constructor(){this.time=Zo.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:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:y=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||_(v)&&v.every((t=>0===t)))){let n,r=0;return Of(e,i,s,b,x,v,"bevel"!==y,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};Ff=If([$a()],Ff);const zf=new Lf,jf=Af,Hf=yf;const Vf=new class extends Lf{constructor(){super(...arguments),this.time=Zo.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)}},Nf=yf;const Wf=new class{constructor(){this.time=Zo.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,f=p&&!1!==p.visible,m=g&&!1!==g.visible;if(!f&&!m)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,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,A=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:mh(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(y-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&A(p,"outerBorder"),m&&A(g,"innerBorder")}},Uf=new class{constructor(){this.time=Zo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:_=l.scaleX,scaleY:y=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/_,(f-s)/y,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/_,(f-s)/y,l),e.stroke())))}},Gf=Af,Yf=yf;const Xf={x:0,y:0,z:0,lastModelMatrix:null};class $f{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(xf),this.builtinContributions.push(Sf),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===Zo.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Zo.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}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)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Ec(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,_=Yp(d,u,h),y=$p(d,g),b=Up(h),x=Gp(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(_||y||a||o))return!0;e.beginPath();return el(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),!0}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=Yp(o,l,n),p=$p(o,c),g=Up(n,r),f=Gp(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){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;Xf.x=n,Xf.y=r,Xf.z=a,Xf.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=tp.allocate(),n=tp.allocate();fg(n,t,e),qu(s,d||s,n),Xf.x=0,Xf.y=0,Xf.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),tp.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Xf.x+=s.x,Xf.y+=s.y,Xf.z=a,i.setTransformForCurrent()}else if(p)Xf.x=0,Xf.y=0,Xf.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Xf.x+=s.x,Xf.y+=s.y,this.transformWithoutTranslate(i,Xf.x,Xf.y,Xf.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Xf.x=0,Xf.y=0,Xf.z=0;return Xf}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,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,_=(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,f,m,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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&tp.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}var Kf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zf=function(t,e){return function(i,s){e(i,s,t)}};let Jf=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Cu,this.builtinContributions=[Mf,Tf,wf],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=d>c;let p=!1;if(nDt){const t=Gt(b,y),r=Gt(x,y),a=qp(v,_,f,m,n,t,Number(u)),o=qp(k,A,M,w,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,Nt(o.y11,o.x11),Nt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>Dt)||C<.001)e.lineTo(i+M,s+w),p=!0;else if(T>Dt){const t=Gt(E,T),n=Gt(P,T),a=qp(M,w,k,A,r,-n,Number(u)),o=qp(f,m,v,_,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),T0&&e.arc(i+a.cx,s+a.cy,n,Nt(a.y01,a.x01),Nt(a.y11,a.x11),!u);const t=Nt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Wt(B),s+r*Yt(B));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Ec(t,null==r?void 0:r.theme).arc;const{fill:c=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:k=l.forceShowCap}=t.attribute;let{outerRadius:A=l.outerRadius,innerRadius:M=l.innerRadius}=t.attribute;A+=b,M-=x;let w=0;const T=(h(S)&&S||S[0])&&"conical"===c.gradient;if(T){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Vt(s-i){var e;let i=!0;if(h(t,!0)){for(let s=0;s<4;s++)Xc[s]=t,i&&(i=!(null!==(e=Xc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Xc[e]=!!t[e],i&&(i=!!Xc[e]);else Xc[0]=!1,Xc[1]=!1,Xc[2]=!1,Xc[3]=!1;return{isFullStroke:i,stroke:Xc}})(d);if((_||B)&&(e.beginPath(),Jp(t,e,i,s,A,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),g?(this._runStroke(t,e,i,s,l,y,B,v,o),this._runFill(t,e,i,s,l,_,m,u,p,a)):(this._runFill(t,e,i,s,l,_,m,u,p,a),this._runStroke(t,e,i,s,l,y,B,v,o))),!B&&y&&(e.beginPath(),Jp(t,e,i,s,A,M,E),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(h(S)&&S||S[1])&&k){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Vt(h-r)>=Ht-Dt){e.beginPath();const r=Math.abs(A-M)/2/A,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,A,M,d,d+r),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o);const u=()=>{if(_){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+=Ht;for(;i>Ht;)i-=Ht;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),dp(o.color,l.color,h,!1)}(0,0,h,n);a||Yp&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}},p=()=>{y&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};u(),p()}}this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),T&&(c.startAngle+=w,c.endAngle+=w)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}};Jf=Kf([$a(),Zf(0,Ya(co)),Zf(0,Ka(Qp)),qf("design:paramtypes",[Object])],Jf);var Qf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},em=function(t,e){return function(i,s){e(i,s,t)}};let im=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Pu,this.builtinContributions=[Cf,Ef,Bf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Ec(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,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f;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,_,y,m,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{y&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o)}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function sm(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]=ll(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 nm(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function rm(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=nm(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),sm(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=Ko.ROW:"y"===s?u=Ko.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.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 om=class extends $f{constructor(){super(...arguments),this.numberType=Lu}draw(t,e,i,s){const n=Ec(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 f;if(!e)return;t.beginPath();rm(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),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:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!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:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===_)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}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=Vl(x(t.points,v),_,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===_){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===y){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],y,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=y*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Gt(_,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,y,b,i,s,t,a,o)}};function lm(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),sm(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),sm(t,l,1,s),o=!1):o=!0}t.closePath()}om=am([$a()],om);const hm=new class extends kf{constructor(){super(...arguments),this.time=Zo.afterFillStroke}drawShape(t,e,i,s,n,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:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:ed(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:ed(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:ed(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:ed(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},cm=yf;var dm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},um=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pm=function(t,e){return function(i,s){e(i,s,t)}};let gm=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Eu,this.builtinContributions=[hm,cm],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,y=m[0];e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const i=m[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,v)}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:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(_(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Ec(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:k}=S,A=S.doStroke&&S.sVisible,{clipRange:M=g.clipRange,closePath:w,points:T,segments:C}=t.attribute;let{curveType:B=g.curveType}=t.attribute;function E(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(w&&"linear"===B&&(B="linearClosed"),1===M&&!C&&!T.some((t=>!1===t.defined))&&"linear"===B)return this.drawLinearAreaHighPerformance(t,e,!!f,A,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(C&&C.length){let e,i;const s=C.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=Vl(E(t.points,x),B,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=C.length-1;t>=0;t--){const e=C[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=C[t-1].points,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=Vl(E(i,x),"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!T||!T.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=E(T,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Vl(e,B,{curveTension:b}),n=Vl(i,"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===M){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,k,v,A,y,r[c],[g,t.attribute],M,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=M*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,k,v,A,y,r[u],[g,t.attribute],Gt(f,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,k,v,A,y,t.attribute,g,M,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Ec(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,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let y,b,x=Ko.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],y=t.points[t.points.length-1]}else b=m[0],y=m[m.length-1];const S=Vt(y.x-b.x),k=Vt(y.y-b.y);x=null==y.x1?Ko.ROW:null==y.y1?Ko.COLUMN:Number.isFinite(S+k)?S>k?Ko.ROW:Ko.COLUMN:Ko.ROW,function(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?Ko.ROW:Ko.COLUMN,Number.isFinite(c)||(o=Ko.COLUMN),Number.isFinite(d)||(o=Ko.ROW);const u=i*(o===Ko.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;_(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),rm(t,i[0]?e.top:e.bottom,l,x===Ko.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,A-h,M-c,o),t.stroke()}})(),!1}};gm=dm([$a(),pm(0,Ya(co)),pm(0,Ka(tg)),um("design:paramtypes",[Object])],gm);const fm=Af,mm=yf;var vm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},ym=function(t,e){return function(i,s){e(i,s,t)}};let bm=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Du,this.builtinContributions=[mm,fm],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:Ec(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:_,doFill:y,doStroke:b}=m;if(e.beginPath(),t.pathShape)el(t.pathShape.commandList,e,i,s,1,1,f);else{el((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,y,b,v,_,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):_&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{y&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,y,b,v,_,d,n,a,o)}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};bm=vm([$a(),ym(0,Ya(co)),ym(0,Ka(ng)),_m("design:paramtypes",[Object])],bm);var xm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},km=function(t,e){return function(i,s){e(i,s,t)}};let Am=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=zu,this.builtinContributions=[zf,Hf,jf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Ec(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:y=l.visible,x1:b,y1:x,x:S=l.x,y:k=l.y,fillStrokeOrder:A=l.fillStrokeOrder,drawStrokeWhenZeroWH:M=l.drawStrokeWhenZeroWH}=t.attribute;let{width:w,height:T}=t.attribute;w=(null!=w?w:b-S)||0,T=(null!=T?T:x-k)||0;const C=Xp(g,f,w,T,h),B=Kp(g,v,w,T,M),E=Up(h,c),P=Gp(d,m);if(!t.valid||!y)return;if(!E&&!P)return;if(!(C||B||a||o||c))return;0===u||_(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,w,T)):(e.beginPath(),Of(e,i,s,w,T,u,"bevel"!==p));const R={doFill:E,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,E,P,C,B,l,n,a,o,R),A?(this._runStroke(t,e,i,s,l,R,B,S,k,o),this._runFill(t,e,i,s,l,R,C,S,k,a)):(this._runFill(t,e,i,s,l,R,C,S,k,a),this._runStroke(t,e,i,s,l,R,B,S,k,o)),this.afterRenderStep(t,e,i,s,E,P,C,B,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}};Am=xm([$a(),km(0,Ya(co)),km(0,Ka(ag)),Sm("design:paramtypes",[Object])],Am);var Mm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tm=function(t,e){return function(i,s){e(i,s,t)}};let Cm=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Hu,this.builtinContributions=[Wf,Yf,Gf,Uf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:Ec(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v,k=t.getParsedPath();if(!k)return;const{keepDirIn3d:A=l.keepDirIn3d}=t.attribute,M=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let w=i,T=s,C=M;const B=e.camera;if(A&&B&&e.project){const t=e.project(i,s,M);e.camera=null,_(c)&&(c[0],c[1]),w=t.x,T=t.y,C=void 0}!1===k.draw(e,c,w,T,C,((n,r)=>{var h,c,v,_;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(_=r.lineWidth)&&void 0!==_?_:t.attribute.lineWidth,r=e}const y=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),y()):(y(),x())}))&&e.closePath(),e.camera=B,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,y,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,k,m,p,g,o),this._runFill(t,e,i,s,l,x,y,d,u,k,a)):(this._runFill(t,e,i,s,l,x,y,d,u,k,a),this._runStroke(t,e,i,s,l,S,b,d,u,k,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,y,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Cm=Mm([$a(),Tm(0,Ya(co)),Tm(0,Ka(og)),wm("design:paramtypes",[Object])],Cm);const Bm=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new He)}allocate(t,e,i,s){if(!this.pools.length)return(new He).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 He(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(...t){this.pools=[]}};const Em=new class extends _f{constructor(){super(...arguments),this.time=Zo.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,g,f,m,v,_,y,b,x,S;const{backgroundMode:k=l.backgroundMode,backgroundFit:A=l.backgroundFit,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio}=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 B;"richtext"===t.type&&(w=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const E=p(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!==(g=T.dx)&&void 0!==g?g:0),s=(null!==(f=T.y)&&void 0!==f?f:e.y1)+(null!==(m=T.dy)&&void 0!==m?m:0),n=null!==(v=T.width)&&void 0!==v?v:e.width(),r=null!==(_=T.height)&&void 0!==_?_:e.height();if(B=Bm.allocate(i,s,i+n,s+r),T=T.background,!P){const t=B.width(),e=B.height();B.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 B=t.AABBBounds,P||(B=gf(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 C();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,B,{backgroundMode:k,backgroundFit:A,backgroundKeepAspectRatio:M}),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=T,n?(Of(e,B.x1,B.y1,B.width(),B.height(),n,!0),e.fill()):e.fillRect(B.x1,B.y1,B.width(),B.height()),e.highPerformanceRestore()}E&&Bm.free(B),C()}};var Pm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Om=function(t,e){return function(i,s){e(i,s,t)}};let Im=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Vu,this.builtinContributions=[Em],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Ec(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,fontSize:v=d.fontSize,verticalMode:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute,x=null!==(l=nd(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:k,sVisible:A,doFill:M,doStroke:w}=S,T=!f,C=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,M,w,k,A,d,n,a,o),T&&this.transformUseContext2d(t,d,C,e);const B=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=Qu.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),Qu.free(t)}w&&(o?o(e,t.attribute,d):A&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,C))),M&&(a?a(e,t.attribute,d):k&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,C))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,C),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;w&&(o?o(e,t.attribute,d):A&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,C)})))),M&&(a?a(e,t.attribute,d):k&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,C),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,C,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!_){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Ut(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;B(i,a-(e+1)*x+u,r,n),r+=s}))}))}T&&this.restoreTransformUseContext2d(t,d,C,e),this.afterRenderStep(t,e,i,s,M,w,k,A,d,n,a,o)}draw(t,e,i,s){const n=Ec(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,l,h,c){if(e+t<=0)return;const{textAlign:u=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,_=!d(c),y=_?c.width:i.clipedWidth,b=_?0:cg(u,y),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+y,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+y,t,o),h.stroke()}}};function Lm(t,e,i,s){if(e&&e.length){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},Vm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nm=function(t,e){return function(i,s){e(i,s,t)}};let Wm=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Fu,this.builtinContributions=[jm,zm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Ec(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,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:b}=f;e.beginPath(),c<=0||_(c)&&c.every((t=>0===t))?Lm(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Lm(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,f=(Math.atan2(u,d)-Math.atan2(g,p))/2,m=Math.abs(Math.tan(f));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,_=v/m;const y=Dm(d,u),b=Dm(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*m);const S=Fm(h,_,y,d,u),k=Fm(h,_,b,p,g),A=2*h.x-S.x-k.x,M=2*h.y-S.y-k.y,w=Dm(A,M),T=Fm(h,Dm(_,v),w,A,M);let C=Math.atan2(S.y-T.y,S.x-T.x);const B=Math.atan2(k.y-T.y,k.x-T.x);let E=B-C;E<0&&(C=B,E=-E),E>Math.PI&&(E-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),E&&t.arcTo(h.x+i,h.y+s,k.x+i,k.y+s,v),t.lineTo(k.x+i,k.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,y,b,m,v,l,n,a,o);const x=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,y,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Wm=Hm([$a(),Nm(0,Ya(co)),Nm(0,Ka(rg)),Vm("design:paramtypes",[Object])],Wm);var Um=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Gm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ym=function(t,e){return function(i,s){e(i,s,t)}};let Xm=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Ou}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Pf)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:Ec(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:y=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:k=l.fillStrokeOrder,cornerType:A=l.cornerType,x:M=l.x,y:w=l.y}=t.attribute,T=Xp(p,m,g,f,c),C=Kp(p,v,g,f),B=Up(c,u),E=Gp(d,x);if(!t.valid||!S)return;if(!h){if(!B&&!E)return;if(!(T||C||a||o||u))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||_(y)&&y.every((t=>0===t))?(e.beginPath(),e.rect(i,s,g,f)):(e.beginPath(),Of(e,i,s,g,f,y,"bevel"!==A));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Pf));const P={doFill:B,doStroke:E};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===Zo.beforeFillStroke&&r.drawShape(t,e,i,s,B,E,T,C,l,n,a,o,P)})),h&&e.clip();const R=()=>{P.doFill&&(a?a(e,t.attribute,l):T&&(e.setCommonStyle(t,t.attribute,M-i,w-s,l),e.fill()))},O=()=>{P.doStroke&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,M-i,w-s,l),e.stroke()))};k?(O(),R()):(R(),O()),this._groupRenderContribitions.forEach((r=>{r.time===Zo.afterFillStroke&&r.drawShape(t,e,i,s,B,E,T,C,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=xo.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=Ec(t,null==s?void 0:s.theme).group,i=tp.allocate(),n=tp.allocate();fg(n,t,e),qu(i,p||i,n),a.modelMatrix=i,tp.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&tp.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}};Xm=Um([$a(),Ym(0,Ya(co)),Ym(0,Ka(ig)),Gm("design:paramtypes",[Object])],Xm);var $m=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},qm=function(t,e){return function(i,s){e(i,s,t)}};const Zm=["","repeat-x","repeat-y","repeat"];let Jm=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Iu,this.builtinContributions=[Vf,Nf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Ec(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,image:m}=t.attribute,v=this.valid(t,l,a);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v;if(!m||!t.resources)return;const k=t.resources.get(m);if("success"!==k.state)return;const A=t.width,M=t.height;e.beginPath();let w=!1;0===p||_(p)&&p.every((t=>0===t))?e.rect(i,s,A,M):(Of(e,i,s,A,M,p,"bevel"!==f),w=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const T=()=>{if(x)if(a)a(e,t.attribute,l);else if(y){e.setCommonStyle(t,t.attribute,i,s,l);let n=0;if("repeat"===h&&(n|=1),"repeat"===c&&(n|=2),n){const t=e.createPattern(k.data,Zm[n]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,A,M),e.translate(-i,-s,!0)}else e.drawImage(k.data,i,s,A,M)}},C=()=>{S&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(C(),w&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,y,!1,l,n,a),T(),w&&e.restore()):(w&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,y,!1,l,n,a),T(),w&&e.restore(),C()),this.afterRenderStep(t,e,i,s,x,!1,y,!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&&v(s))return void Uc.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Ec(t).image;this._draw(t,a,!1,i)}};Jm=$m([$a(),qm(0,Ya(co)),qm(0,Ka(sg)),Km("design:paramtypes",[Object])],Jm);const Qm=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"),fv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Bu,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];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+=Ht;for(;o<0;)o+=Ht;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};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},vv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const _v=Symbol.for("DrawItemInterceptor"),yv=new He,bv=new He;class xv{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){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,Qu.allocate(1,0,0,1,0,0)),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 kv=class{constructor(){this.order=1,this.interceptors=[new xv,new Mv,new Av,new Sv]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&tp.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var wv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Cv=function(t,e){return function(i,s){e(i,s,t)}};let Bv=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))}reInit(){this.drawContribution.reInit()}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}};Bv=wv([$a(),Cv(0,Ya(gv)),Tv("design:paramtypes",[Object])],Bv);var Ev=new La((t=>{t(bo).to(Bv)}));const Pv=Symbol.for("PickerService"),Rv=Symbol.for("GlobalPickerService"),Ov=Symbol.for("PickItemInterceptor"),Iv=Symbol.for("PickServiceInterceptor");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};let Dv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};Dv=Lv([$a()],Dv);let Fv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Ec(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=Qu.allocateByObj(a),u=new se(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};Fv=Lv([$a()],Fv);let zv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new se(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}};zv=Lv([$a()],zv);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){const a=fv(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};jv=Lv([$a()],jv);var Hv=new La(((t,e,i)=>{i(Pv)||(t(Rv).toSelf(),t(Pv).toService(Rv)),t(jv).toSelf().inSingletonScope(),t(Ov).toService(jv),t(Fv).toSelf().inSingletonScope(),t(Ov).toService(Fv),t(zv).toSelf().inSingletonScope(),t(Ov).toService(zv),po(t,Ov),t(Dv).toSelf().inSingletonScope(),t(Iv).toService(Dv),po(t,Iv)})),Vv=new La((t=>{t(Nu).to(mg),t(Wu).toConstantValue(df)}));const Nv=Symbol.for("AutoEnablePlugins"),Wv=Symbol.for("PluginService");var Uv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Yv=function(t,e){return function(i,s){e(i,s,t)}};let Xv=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&&yo.isBound(Nv)&&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(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Xv=Uv([$a(),Yv(0,Ya(co)),Yv(0,Ka(Nv)),Gv("design:paramtypes",[Object])],Xv);var $v=new La((t=>{t(Wv).to(Xv),function(t,e){t(co).toDynamicValue((({container:t})=>new uo(e,t))).whenTargetNamed(e)}(t,Nv)})),Kv=new La((t=>{po(t,vo)})),qv=new La((t=>{t(Rh).to(Oh).inSingletonScope(),po(t,Rh)})),Zv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Qv=class{constructor(){this.type="static",this.offscreen=!1,this.global=xo.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=Dh({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()}};Qv=Zv([$a(),Jv("design:paramtypes",[])],Qv);var t_=new La((t=>{t(Qv).toSelf(),t(Dp).toService(Qv)}));var e_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function i_(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function s_(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=i_(t,e,s);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;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=i_(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var a_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},o_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},l_=function(t,e){return function(i,s){e(i,s,t)}};let h_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):s_(e,Jl.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new je,this.backupDirtyBounds=new je,this.global=xo.global,this.layerService=xo.layerService,_(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}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){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=ve(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.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,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Jl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Jl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Qu.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=r_(e,i,Jl.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&&!xe(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Bm.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Qu.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Bm.free(n),Qu.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||yo.get(Qm);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let d_=class extends om{constructor(){super(...arguments),this.numberType=Lu}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=Ec(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=Yp(u,p,c),_=$p(u,g),y=Up(c),b=Gp(d,f);if(!t.valid||!m)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())}};d_=c_([$a()],d_);var u_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 p_=class extends gm{constructor(){super(...arguments),this.numberType=Eu}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=Ec(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Yp(u,d,c),f=Up(c);if(!t.valid||!p)return;if(!f)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())}};p_=u_([$a()],p_);var g_,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},m_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},v_=function(t,e){return function(i,s){e(i,s,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"}(g_||(g_={}));let y_=class extends h_{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=g_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new mo([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return __(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:Jl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Jl.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 __(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return __(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>__(this,void 0,void 0,(function*(){if(2!==t.count)yield n_(t,Jl.zIndex,((i,s)=>{if(this.status===g_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return __(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return __(this,void 0,void 0,(function*(){this.rendering&&(this.status=g_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=g_.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 __(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:()=>__(this,void 0,void 0,(function*(){yield n_(t,Jl.zIndex,(t=>__(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};y_=f_([$a(),v_(0,Xa(sv)),v_(1,Ya(d_)),v_(2,Ya(p_)),v_(3,Ya(co)),v_(3,Ka(_v)),m_("design:paramtypes",[Array,Object,Object,Object])],y_);var b_=new La((t=>{t(_f).toSelf().inSingletonScope(),t(kf).toSelf().inSingletonScope(),t(gv).to(h_),t(Qm).to(y_),t(nv).to(Xm).inSingletonScope(),t(sv).toService(nv),po(t,ig),t(bf).toSelf().inSingletonScope(),po(t,hg),po(t,sv),t(kv).toSelf().inSingletonScope(),t(_v).toService(kv),po(t,_v)}));function x_(){x_.__loaded||(x_.__loaded=!0,yo.load(Wp),yo.load(Vv),yo.load(Ev),yo.load(Hv),yo.load($v),function(t){t.load(Kv),t.load(qv),t.load(t_)}(yo),function(t){t.load(b_)}(yo))}x_.__loaded=!1,x_();const S_=yo.get(_o);xo.global=S_;const k_=yo.get(Ip);xo.graphicUtil=k_;const A_=yo.get(Op);xo.transformUtil=A_;const M_=yo.get(Nu);xo.graphicService=M_;const w_=yo.get(Lp);xo.layerService=w_;class T_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class C_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=xo.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=xo.global.getRequestAnimationFrame();this.rafId=t((()=>{xo.global.devicePixelRatio!==this.dpr&&(this.dpr=xo.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=xo.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class B_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.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))})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,xo.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())}}const E_=new He;class P_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Ia.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()}));const e=this.pluginService.stage;e&&(e.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&&(E_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(E_,t.parent&&t.parent.globalTransMatrix)))})),e.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))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let R_;function O_(){!function(){if(null==R_)try{const t=document.createElement("canvas"),e=t.getContext("2d");R_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),R_&&(R_=!!document.createElement)}catch(t){R_=!1}}();const t=xo.global&&xo.global.env;return t?"browser"===t:R_}let I_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};I_._pluginClasses={};const L_="white";class D_ extends Ep{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:L_}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={}){var e,i;super({}),this.tickedBeforeRender=!0,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._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Cc,this.hooks={beforeRender:new mo(["stage"]),afterRender:new mo(["stage"]),afterClearScreen:new mo(["stage"]),afterClearRect:new mo(["stage"])},this.global=xo.global,!this.global.env&&O_()&&this.global.setEnv("browser"),this.window=yo.get(gc),this.renderService=yo.get(bo),this.pluginService=yo.get(Wv),this.layerService=yo.get(Lp),this.graphicService=yo.get(Nu),this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],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:L_,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(),t.autoRefresh&&this.enableAutoRefresh(),!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),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&v(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(i=t.rafId)&&void 0!==i?i:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new Wc(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(t=!1){t&&(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:f=[1,1,-1],color:m="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,k=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+y,k=Math.cos(d)*Math.cos(u)*1);const A=I_.getPlugin("DirectionalLight");A&&(this.light=new A(f,m,v));const M={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,k],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=M;else{const t=I_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=I_.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}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 T_))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new C_))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new B_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new je;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new P_,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=I_.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=I_.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=I_.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();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.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();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===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),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.dirtyBounds&&this.dirtyBounds.clear(),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,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new se(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;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.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=yo.get(gc),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=yo.get(Pv)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}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},z_=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 j_=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new He}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}}loadFont(t,e,i){return z_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}};j_=F_([$a()],j_);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},V_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let N_=class{constructor(){this._uid=Ia.GenAutoIncrementId(),this.viewBox=new He,this.modelMatrix=new Ne(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){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}};N_=H_([$a(),V_("design:paramtypes",[])],N_);var W_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},U_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},G_=function(t,e){return function(i,s){e(i,s,t)}};let Y_=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=xo.global}reInit(){this._init()}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.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 He).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 Ne(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),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new se(e.x,e.y),a=Ec(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 se(e.x,e.y);l.transformPoint(a,a);const o=Ec(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&&tp.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),Qu.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function X_(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 $_(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function ty(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;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&&x(t.x)&&x(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}))),ry=(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]},ay=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new je;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 ry(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return ry(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);ay(n[0],s,i),ay(n[1],e-s,i)}};let oy=!1;const ly=new La((t=>{oy||(oy=!0,t(Jf).toSelf().inSingletonScope(),t(tv).to(Jf).inSingletonScope(),t(sv).toService(tv),t(Qp).toService(bf),po(t,Qp))}));let hy=!1;const cy=new La((t=>{hy||(hy=!0,t(Am).toSelf().inSingletonScope(),t(lv).to(Am).inSingletonScope(),t(sv).toService(lv),t(Ff).toSelf(),t(Df).toSelf(),t(ag).toService(Ff),t(ag).toService(Df),t(ag).toService(bf),po(t,ag))}));let dy=!1;const uy=new La((t=>{dy||(dy=!0,t(om).toSelf().inSingletonScope(),t(d_).toSelf().inSingletonScope(),t(rv).to(om).inSingletonScope(),t(sv).toService(rv))}));let py=!1;const gy=new La((t=>{py||(py=!0,t(gm).toSelf().inSingletonScope(),t(ev).to(gm).inSingletonScope(),t(sv).toService(ev),t(tg).toService(bf),po(t,tg),t(p_).toSelf().inSingletonScope())}));let fy=!1;const my=new La((t=>{fy||(fy=!0,t(Cm).toSelf().inSingletonScope(),t(hv).to(Cm).inSingletonScope(),t(sv).toService(hv),t(og).toService(bf),po(t,og))}));let vy=!1;const _y=new La((t=>{vy||(vy=!0,t(im).toSelf().inSingletonScope(),t(iv).to(im).inSingletonScope(),t(sv).toService(iv),t(eg).toService(bf),po(t,eg))}));let yy=!1;const by=new La((t=>{yy||(yy=!0,t(cv).to(Im).inSingletonScope(),t(sv).toService(cv),t(lg).toService(bf),po(t,lg))}));let xy=!1;const Sy=new La((t=>{xy||(xy=!0,t(bm).toSelf().inSingletonScope(),t(av).to(bm).inSingletonScope(),t(sv).toService(av),t(ng).toService(bf),po(t,ng))}));let ky=!1;const Ay=new La((t=>{ky||(ky=!0,t(ov).to(Wm).inSingletonScope(),t(sv).toService(ov),t(rg).toService(bf),po(t,rg))}));var My=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 wy=class{constructor(){this.numberType=Ru}reInit(){}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=Ec(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};wy=My([$a()],wy);let Ty=!1;const Cy=new La((t=>{Ty||(Ty=!0,t(uv).to(wy).inSingletonScope(),t(sv).toService(uv))}));var By=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)};let Py=class extends $f{constructor(){super(),this.numberType=ju,this.builtinContributions=[Em],this.init()}drawShape(t,e,i,s,n){const r=Ec(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=Yp(o,l,!0),d=Yp(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),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=Ec(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:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),Of(e,i-t,s-n,v,_,f,!0)),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=Ec(t).richtext;this._draw(t,s,!1,i)}};Py=By([$a(),Ey("design:paramtypes",[])],Py);let Ry=!1;const Oy=new La((t=>{Ry||(Ry=!0,t(dv).to(Py).inSingletonScope(),t(sv).toService(dv))}));let Iy=!1;const Ly=new La((t=>{Iy||(Iy=!0,t(pv).to(Jm).inSingletonScope(),t(sv).toService(pv),t(sg).toService(bf),po(t,sg))}));function Dy(t){const e=[];for(let i=0;i=0&&n>=0&&srt.getInstance().info(`[VChart log]: ${t}`,...e),jy=(t,e)=>(c(Vy.warnHandler)&&Vy.warnHandler.call(null,t,e),e?rt.getInstance().warn(`[VChart warn]: ${t}`,e):rt.getInstance().warn(`[VChart warn]: ${t}`)),Hy=(t,e,i)=>{if(!c(Vy.errorHandler))throw new Error(t);Vy.errorHandler.call(null,t,e)},Vy={silent:!1,warnHandler:!1,errorHandler:!1},Ny=O_(),Wy=Ny&&globalThis?globalThis.document:void 0;function Uy(t){return("desktop-browser"===t||"mobile-browser"===t)&&Ny}function Gy(t){return Yy(t)||"mobile-browser"===t}function Yy(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let Xy=0;function $y(){return Xy>=9999999&&(Xy=0),Xy++}function Ky(t){return null!=t&&""!==t&&(!!x(t)||+t==+t)}function qy(t){return!(!t||0===t.length)&&(!d(t[0])&&!d(t[0].dataId)&&_(t[0].fields))}const Zy=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Jy extends Ep{constructor(t,e){super(t),this._skipRenderAttributes=Zy,(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,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);f(this.attribute[t])&&f(e)&&!c(this.attribute[t])&&!c(e)?z(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.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,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.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){d(e)&&(e=Object.keys(t));for(let i=0;i{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"},wb=(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 Tb extends o{constructor(t,e={}){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.startTime=zc.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.pressTimeout=null}),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=zc.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||Mb(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=wb(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=zc.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=wb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=Mb(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&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("pointerleave",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("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=zc.now()-i>this.config.press.time&&wb(s[0],t){xo.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;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){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){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},Bb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Eb=[0,0,0];let Pb=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t: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(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},Yl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},$l),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Kl),{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 Ne(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ne(1,0,0,1,0,0),this._clearMatrix=new Ne(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&rt.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ne(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&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 Qu.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&&(Qu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(Qu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){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,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=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(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){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-=Ht;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(f,-2*y),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&&yp.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&&(Zu(Eb,[t,e,i],this.modelMatrix),t=Eb[0],e=Eb[1],i=Eb[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&&(Zu(Eb,[t,e,i],this.modelMatrix),t=Eb[0],e=Eb[1],i=Eb[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Zu(Eb,[e,i,s],this.modelMatrix),e=Eb[0],i=Eb[1],s=Eb[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,e=xo.global.measureTextMethod){var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=xo.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Kl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Kl.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&&(Zu(Eb,[e,i,s],this.modelMatrix),e=Eb[0],i=Eb[1],s=Eb[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=vh(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:mh(this,a,this.dpr),r.strokeStyle=vh(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=Ie(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?this.font=t.font:this.font=Ie(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(t=!0,e=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(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Qu.free(t))),this.stack.length=0}};Pb.env="browser",Pb=Cb([$a(),Bb("design:paramtypes",[Object,Number])],Pb);var Rb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ob=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ib=class extends op{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=xo.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new Pb(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 Lb(t,e){return new La((i=>{i(Ih).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Lh).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Ib.env="browser",Ib=Rb([$a(),Ob("design:paramtypes",[Object])],Ib);const Db=Lb(Ib,Pb);var Fb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jb=function(t,e){return function(i,s){e(i,s,t)}};let Hb=class extends Y_{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,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=dc.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 Nb=class{constructor(){this.type="group",this.numberType=Ou}contains(t,e,i){return!1}};Nb=Vb([$a()],Nb);const Wb=new La(((t,e,i,s)=>{Wb.__vloaded||(Wb.__vloaded=!0,t(kb).to(Nb).inSingletonScope(),t(Ab).toService(kb),po(t,Ab))}));Wb.__vloaded=!1;var Ub=Wb;const Gb=new La(((t,e,i,s)=>{i(Hb)||t(Hb).toSelf().inSingletonScope(),i(Pv)?s(Pv).toService(Hb):t(Pv).toService(Hb)}));var Yb,Xb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$b=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Kb=Yb=class extends N_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Yb.idprefix}_${Yb.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=xo.global,this.viewBox=new He,this.modelMatrix=new Ne(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:Yb.GenerateCanvasId(),canvasControled:!0};this.canvas=new Ib(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 Ib({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)}};Kb.env="browser",Kb.idprefix="visactor_window",Kb.prefix_count=0,Kb=Yb=Xb([$a(),$b("design:paramtypes",[])],Kb);const qb=new La((t=>{t(Kb).toSelf(),t(fc).toDynamicValue((t=>t.container.get(Kb))).whenTargetNamed(Kb.env)}));var Zb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qb=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 tx{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function ex(t,e=!1){const i=document.createElement("img");if(xo.global.isImageAnonymous&&(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 ix=class extends j_{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 tx(t)}return new He}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(v(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=v(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return ex(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return ex(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const s=document.createElement("canvas");t.id&&(s.id=null!==(e=t.id)&&void 0!==e?e:Ia.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(...t){}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}}loadFont(t,e,i){return Qb(this,void 0,void 0,(function*(){return new FontFace(t,v(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}};ix=Zb([$a(),Jb("design:paramtypes",[])],ix);const sx=new La((t=>{sx.isBrowserBound||(sx.isBrowserBound=!0,t(ix).toSelf().inSingletonScope(),t(vo).toService(ix))}));function nx(t,e=!0){nx.__loaded||(nx.__loaded=!0,t.load(sx),t.load(Db),t.load(qb),e&&function(t){t.load(Ub),t.load(Gb)}(t))}sx.isBrowserBound=!1,nx.__loaded=!1;var rx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},ox=function(t,e){return function(i,s){e(i,s,t)}};let lx=class extends Y_{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,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 rp(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}};lx=rx([$a(),ox(0,Ya(co)),ox(0,Ka(Qy)),ox(1,Ya(co)),ox(1,Ka(Ov)),ox(2,Ya(co)),ox(2,Ka(Iv)),ax("design:paramtypes",[Object,Object,Object])],lx);const hx=new La((t=>{hx.__vloaded||(hx.__vloaded=!0,po(t,Qy))}));hx.__vloaded=!1;var cx=hx;class dx{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();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,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:mh(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}var ux=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},px=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gx=function(t,e){return function(i,s){e(i,s,t)}};let fx=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Cu}};fx=ux([$a(),gx(0,Ya(tv)),px("design:paramtypes",[Object])],fx);let mx=!1;const vx=new La(((t,e,i,s)=>{mx||(mx=!0,t(tb).to(fx).inSingletonScope(),t(Qy).toService(tb))}));var _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)},bx=function(t,e){return function(i,s){e(i,s,t)}};let xx=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Eu}};xx=_x([$a(),bx(0,Ya(ev)),yx("design:paramtypes",[Object])],xx);let Sx=!1;const kx=new La(((t,e,i,s)=>{Sx||(Sx=!0,t(eb).to(xx).inSingletonScope(),t(Qy).toService(eb))}));var Ax=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wx=function(t,e){return function(i,s){e(i,s,t)}};let Tx=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Pu}};Tx=Ax([$a(),wx(0,Ya(iv)),Mx("design:paramtypes",[Object])],Tx);let Cx=!1;const Bx=new La(((t,e,i,s)=>{Cx||(Cx=!0,t(ib).to(Tx).inSingletonScope(),t(Qy).toService(ib))}));class Ex{constructor(){this.type="glyph",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=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}}var Px=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Ox=function(t,e){return function(i,s){e(i,s,t)}};let Ix=class extends Ex{constructor(t){super(),this.canvasRenderer=t}};Ix=Px([$a(),Ox(0,Ya(uv)),Rx("design:paramtypes",[Object])],Ix);let Lx=!1;const Dx=new La(((t,e,i,s)=>{Lx||(Lx=!0,t(cb).to(Ix).inSingletonScope(),t(Ix).toService(cb))}));var Fx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 zx=class{constructor(){this.type="image",this.numberType=Iu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};zx=Fx([$a()],zx);let jx=!1;const Hx=new La(((t,e,i,s)=>{jx||(jx=!0,t(sb).to(zx).inSingletonScope(),t(zx).toService(sb))}));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)},Wx=function(t,e){return function(i,s){e(i,s,t)}};let Ux=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Lu}};Ux=Vx([$a(),Wx(0,Ya(rv)),Nx("design:paramtypes",[Object])],Ux);let Gx=!1;const Yx=new La(((t,e,i,s)=>{Gx||(Gx=!0,t(nb).to(Ux).inSingletonScope(),t(Qy).toService(nb))}));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},$x=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kx=function(t,e){return function(i,s){e(i,s,t)}};let qx=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Fu}};qx=Xx([$a(),Kx(0,Ya(ov)),$x("design:paramtypes",[Object])],qx);let Zx=!1;const Jx=new La(((t,e,i,s)=>{Zx||(Zx=!0,t(hb).to(qx).inSingletonScope(),t(Qy).toService(hb))}));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 extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Du}};iS=Qx([$a(),eS(0,Ya(av)),tS("design:paramtypes",[Object])],iS);let sS=!1;const nS=new La(((t,e,i,s)=>{sS||(sS=!0,t(rb).to(iS).inSingletonScope(),t(Qy).toService(rb))})),rS=new He;class aS{constructor(){this.type="rect",this.numberType=zu}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=t.getGraphicTheme(),{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||x(r,!0)&&0!==r||_(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,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:mh(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;rS.setValue(i.x1,i.y1,i.x2,i.y2),rS.expand(-r/2),h=!rS.containsPoint(e)}}return s.highPerformanceRestore(),h}}var oS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hS=function(t,e){return function(i,s){e(i,s,t)}};let cS=class extends aS{constructor(t){super(),this.canvasRenderer=t}};cS=oS([$a(),hS(0,Ya(lv)),lS("design:paramtypes",[Object])],cS);let dS=!1;const uS=new La(((t,e,i,s)=>{dS||(dS=!0,t(ab).to(cS).inSingletonScope(),t(Qy).toService(ab))}));let pS=!1;const gS=new La(((t,e,i,s)=>{pS||(pS=!0,t(sb).to(zx).inSingletonScope(),t(zx).toService(sb))}));var fS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mS=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 extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Hu}};_S=fS([$a(),vS(0,Ya(hv)),mS("design:paramtypes",[Object])],_S);let yS=!1;const bS=new La(((t,e,i,s)=>{yS||(yS=!0,t(ob).to(_S).inSingletonScope(),t(Qy).toService(ob))}));var xS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let SS=class{constructor(){this.type="text",this.numberType=Vu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};SS=xS([$a()],SS);let kS=!1;const AS=new La(((t,e,i,s)=>{kS||(kS=!0,t(lb).to(SS).inSingletonScope(),t(Qy).toService(lb))})),MS=new La(((t,e,i,s)=>{i(lx)||t(lx).toSelf().inSingletonScope(),i(Pv)?s(Pv).toService(lx):t(Pv).toService(lx)}));class wS{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 TS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)};let BS=class extends Pb{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 Ne(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};BS.env="node",BS=TS([$a(),CS("design:paramtypes",[Object,Number])],BS);var ES=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},PS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let RS=class extends op{constructor(t){super(t)}init(){this._context=new BS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&c(this._nativeCanvas.release)&&this._nativeCanvas.release()}};RS.env="node",RS=ES([$a(),PS("design:paramtypes",[Object])],RS);const OS=Lb(RS,BS);var IS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},LS=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 FS=class extends N_{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:Ia.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new RS(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new RS({width:n,height:r,dpr:s,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}getImageBuffer(t="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){}};FS.env="node",FS=IS([$a(),DS(0,Ya(_o)),LS("design:paramtypes",[Object])],FS);const zS=new La((t=>{t(FS).toSelf(),t(fc).toDynamicValue((t=>t.container.get(FS))).whenTargetNamed(FS.env)}));var jS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let HS=class extends j_{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 sd.call(t)}}getCancelAnimationFrame(){return t=>{sd.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};HS=jS([$a()],HS);const VS=new La((t=>{VS.isNodeBound||(VS.isNodeBound=!0,t(HS).toSelf().inSingletonScope(),t(vo).toService(HS))}));function NS(t,e=!0){NS.__loaded||(NS.__loaded=!0,t.load(VS),t.load(OS),t.load(zS))}VS.isNodeBound=!1,NS.__loaded=!1;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};let US=class extends Pb{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_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,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:mh(this,l,this.dpr),r.strokeStyle=vh(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||(d&&r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=xo.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,xo.global.devicePixelRatio),super.measureText(t,e)}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;let r="";r=t.font?t.font:Ie(t,e,n&&this.camera&&this.camera.getProjectionScale(i)),s.font=(r||"").replace("px","vp");const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes);let a="";a=t.font?t.font:Ie(t,e,this.camera&&this.camera.getProjectionScale(i)),r.font=(a||"").replace("px","vp");const{fontFamily:o=e.fontFamily,fontSize:l=e.fontSize}=t;this.fontFamily=o,this.fontSize=l,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}createPattern(t,e){return null}drawImage(){const t=this.nativeContext,e=arguments;e[0].drawImage&&(e[0]=e[0].transferToImageBitmap()),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])}draw(){}};US.env="harmony",US=WS([$a()],US);var GS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},YS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let XS=class extends op{constructor(t){super(t)}init(){this._context=new US(this,this._dpr)}resize(t,e){}release(...t){}};XS.env="harmony",XS=GS([$a(),YS("design:paramtypes",[Object])],XS);var $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},KS=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)}};class ZS{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 JS=class extends N_{get container(){return null}constructor(t){super(),this.global=t,this.type="harmony",this.eventManager=new ZS}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{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:Ia.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new XS(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}this.canvas=new XS({width:i,height:s,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}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){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()}};JS.env="harmony",JS=$S([$a(),qS(0,Ya(_o)),KS("design:paramtypes",[Object])],JS);const QS=new La((t=>{t(JS).toSelf(),t(fc).toDynamicValue((t=>t.container.get(JS))).whenTargetNamed(JS.env)})),tk=Lb(XS,US);var ek=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ik=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let sk=class extends j_{constructor(){super(),this.type="harmony",this.supportEvent=!0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0,this.rafSTO=new id(0)}configure(t,e){t.env===this.type&&t.setActiveEnvContribution(this)}getDynamicCanvasCount(){return 9999}getStaticCanvasCount(){return 9999}loadImage(t){}loadSvg(t){return Promise.reject()}createCanvas(t){return function(t,e,i){const s=new OffscreenCanvas(t,e),n=s.getContext("2d");return new wS({width:t,height:e,context:n,_c:s,getBoundingClientRect:()=>({width:t,height:e}),getContext:()=>n},n,1,t,e,i)}(t.width,t.height,t.id)}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return t=>this.rafSTO.call(t)}getCancelAnimationFrame(){return t=>{this.rafSTO.clear(t)}}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return null}getRootElement(){return null}getDocument(){return null}release(...t){}};sk=ek([$a(),ik("design:paramtypes",[])],sk);const nk=new La((t=>{nk.isHarmonyBound||(nk.isHarmonyBound=!0,t(sk).toSelf().inSingletonScope(),t(vo).toService(sk))}));function rk(t,e=!0){rk.__loaded||(rk.__loaded=!0,t.load(nk),t.load(tk),t.load(QS),e&&function(t){t.load(cx),t.load(MS),t.load(vx),t.load(kx),t.load(Bx),t.load(Dx),t.load(Hx),t.load(Yx),t.load(Jx),t.load(nS),t.load(uS),t.load(gS),t.load(bS),t.load(AS)}(t))}nk.isHarmonyBound=!1,rk.__loaded=!1;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 extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Cu}};hk=ak([$a(),lk(0,Ya(tv)),ok("design:paramtypes",[Object])],hk);let ck=!1;const dk=new La(((t,e,i,s)=>{ck||(ck=!0,t(db).to(hk).inSingletonScope(),t(Ab).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 fk=class extends aS{constructor(t){super(),this.canvasRenderer=t}};fk=uk([$a(),gk(0,Ya(lv)),pk("design:paramtypes",[Object])],fk);let mk=!1;const vk=new La(((t,e,i,s)=>{mk||(mk=!0,t(vb).to(fk).inSingletonScope(),t(Ab).toService(vb))}));class _k extends $f{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=t.getGraphicTheme(),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,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:mh(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&tp.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var yk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xk=function(t,e){return function(i,s){e(i,s,t)}};let Sk=class extends _k{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Lu}};Sk=yk([$a(),xk(0,Ya(rv)),bk("design:paramtypes",[Object])],Sk);let kk=!1;const Ak=new La(((t,e,i,s)=>{kk||(kk=!0,t(fb).to(Sk).inSingletonScope(),t(Ab).toService(fb))}));var Mk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wk=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 Ck=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Eu}};Ck=Mk([$a(),Tk(0,Ya(ev)),wk("design:paramtypes",[Object])],Ck);let Bk=!1;const Ek=new La(((t,e,i,s)=>{Bk||(Bk=!0,t(ub).to(Ck).inSingletonScope(),t(Ab).toService(ub))}));class Pk extends $f{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();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,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&tp.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var Rk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Ik=function(t,e){return function(i,s){e(i,s,t)}};let Lk=class extends Pk{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Hu}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=t.getGraphicTheme(),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,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:mh(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&tp.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};Lk=Rk([$a(),Ik(0,Ya(hv)),Ok("design:paramtypes",[Object])],Lk);let Dk=!1;const Fk=new La(((t,e,i,s)=>{Dk||(Dk=!0,t(_b).to(Lk).inSingletonScope(),t(Ab).toService(_b))}));var zk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hk=function(t,e){return function(i,s){e(i,s,t)}};let Vk=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Pu}};Vk=zk([$a(),Hk(0,Ya(iv)),jk("design:paramtypes",[Object])],Vk);let Nk=!1;const Wk=new La(((t,e,i,s)=>{Nk||(Nk=!0,t(pb).to(Vk).inSingletonScope(),t(Ab).toService(pb))}));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},Gk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Yk=function(t,e){return function(i,s){e(i,s,t)}};let Xk=class extends Pk{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=t.getGraphicTheme(),{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(),f=l.width(),m=dg(a,u,n),v=cg(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,s.modelMatrix!==u&&tp.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};Xk=Uk([$a(),Yk(0,Ya(cv)),Gk("design:paramtypes",[Object])],Xk);let $k=!1;const Kk=new La(((t,e,i,s)=>{$k||($k=!0,t(yb).to(Xk).inSingletonScope(),t(Ab).toService(yb))}));var qk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zk=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 Qk=class extends _k{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Du}};Qk=qk([$a(),Jk(0,Ya(av)),Zk("design:paramtypes",[Object])],Qk);let tA=!1;const eA=new La(((t,e,i,s)=>{tA||(tA=!0,t(mb).to(Qk).inSingletonScope(),t(Ab).toService(mb))}));var iA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},nA=function(t,e){return function(i,s){e(i,s,t)}};let rA=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Fu}};rA=iA([$a(),nA(0,Ya(ov)),sA("design:paramtypes",[Object])],rA);let aA=!1;const oA=new La(((t,e,i,s)=>{aA||(aA=!0,t(bb).to(rA).inSingletonScope(),t(Ab).toService(bb))}));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},hA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cA=function(t,e){return function(i,s){e(i,s,t)}};let dA=class extends Ex{constructor(t){super(),this.canvasRenderer=t}};dA=lA([$a(),cA(0,Ya(uv)),hA("design:paramtypes",[Object])],dA);let uA=!1;const pA=new La(((t,e,i,s)=>{uA||(uA=!0,t(Sb).to(dA).inSingletonScope(),t(Ab).toService(Sb))}));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},fA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mA=function(t,e){return function(i,s){e(i,s,t)}};let vA=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=ju}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};vA=gA([$a(),mA(0,Ya(dv)),fA("design:paramtypes",[Object])],vA);let _A=!1;const yA=new La(((t,e,i,s)=>{_A||(_A=!0,t(xb).to(vA).inSingletonScope(),t(Ab).toService(xb))}));var bA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},SA=function(t,e){return function(i,s){e(i,s,t)}};let kA=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=Iu}};kA=bA([$a(),SA(0,Ya(pv)),xA("design:paramtypes",[Object])],kA);let AA=!1;const MA=new La(((t,e,i,s)=>{AA||(AA=!0,t(gb).to(kA).inSingletonScope(),t(Ab).toService(gb))})),wA=O_();function TA(){TA.__loaded||(TA.__loaded=!0,df.RegisterGraphicCreator("arc",rf),yo.load(ly),yo.load(wA?dk:vx))}TA.__loaded=!1;const CA=TA;function BA(){BA.__loaded||(BA.__loaded=!0,df.RegisterGraphicCreator("area",ef),yo.load(gy),yo.load(wA?Ek:kx))}BA.__loaded=!1;const EA=BA;function PA(){PA.__loaded||(PA.__loaded=!0,df.RegisterGraphicCreator("circle",bg),yo.load(_y),yo.load(wA?Wk:Bx))}PA.__loaded=!1;const RA=PA;function OA(){OA.__loaded||(OA.__loaded=!0,df.RegisterGraphicCreator("glyph",Dg),yo.load(Cy),yo.load(wA?pA:Dx))}OA.__loaded=!1;const IA=OA;function LA(){LA.__loaded||(LA.__loaded=!0,df.RegisterGraphicCreator("group",Pp))}LA.__loaded=!1;const DA=LA;function FA(){FA.__loaded||(FA.__loaded=!0,df.RegisterGraphicCreator("image",Ng),yo.load(Ly),yo.load(wA?MA:Hx))}FA.__loaded=!1;const zA=FA;function jA(){jA.__loaded||(jA.__loaded=!0,df.RegisterGraphicCreator("line",Eg),yo.load(uy),yo.load(wA?Ak:Yx))}jA.__loaded=!1;const HA=jA;function VA(){VA.__loaded||(VA.__loaded=!0,df.RegisterGraphicCreator("path",Jg),yo.load(Sy),yo.load(wA?eA:nS))}VA.__loaded=!1;const NA=VA;function WA(){WA.__loaded||(WA.__loaded=!0,df.RegisterGraphicCreator("polygon",lf),yo.load(Ay),yo.load(wA?oA:Jx))}WA.__loaded=!1;const UA=WA;function GA(){GA.__loaded||(GA.__loaded=!0,df.RegisterGraphicCreator("rect",Ig),yo.load(cy),yo.load(wA?vk:uS))}GA.__loaded=!1;const YA=GA;function XA(){XA.__loaded||(XA.__loaded=!0,df.RegisterGraphicCreator("richtext",Kg),yo.load(Oy),yo.load(wA?yA:gS))}XA.__loaded=!1;const $A=XA;function KA(){KA.__loaded||(KA.__loaded=!0,df.RegisterGraphicCreator("shadowRoot",cf))}KA.__loaded=!1;const qA=KA;function ZA(){ZA.__loaded||(ZA.__loaded=!0,df.RegisterGraphicCreator("symbol",Tg),yo.load(my),yo.load(wA?Fk:bS))}ZA.__loaded=!1;const JA=ZA;function QA(){QA.__loaded||(QA.__loaded=!0,df.RegisterGraphicCreator("text",Ag),yo.load(by),yo.load(wA?Kk:AS))}QA.__loaded=!1;const tM=QA;function eM(){DA(),YA()}const iM=-.5*Math.PI,sM=1.5*Math.PI,nM="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 rM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(rM||(rM={}));const aM={[rM.selectedReverse]:{},[rM.selected]:{},[rM.hover]:{},[rM.hoverReverse]:{}},oM={container:"",width:30,height:30,style:{}},lM="scrollDrag";function hM(){return"browser"===S_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const cM={debounce:bt,throttle:xt};eM();let dM=class t extends Jy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{u(this._prePos)&&t.preventDefault()},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=mt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=mt(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=>{this._clearDragEvents();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});const r=hM(),a="browser"===S_.env?S_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=mt(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},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=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:vt(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){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(lM,{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),("browser"===S_.env?S_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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:ni(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,[s,n,r,a]=ni(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,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=mt(t[0],0,1),c=mt(t[1],0,1),d=mt(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_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)}_clearDragEvents(){const t=hM(),e="browser"===S_.env?S_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===S_.env?S_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};dM.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,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};var uM,pM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 gM=uM=class{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new je).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Vt(t.deltaX)>Vt(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new He,e.addEventListener("wheel",this.scroll),this.params=uM.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(lM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new dM(v),h.name=a,e.add(h),h.isScrollBar=!0);const _=this.childrenBounds,{scrollX:y,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/_.width(),1),e=Math.max(Math.min(y/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/_.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=i{i(gM)||(t(gM).toSelf(),t(Nv).toService(gM))}));function mM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&mM(t,e)}))}const vM=t=>!d(t)&&!1!==t.visible;function _M(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function yM(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 xM=["#ffffff","#000000"];function SM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ti(t).toHex(),o=new ti(e).toHex();return kM(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(...xM);for(const n of a)if(t!==n&&kM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function kM(t,e,i,s,n){if("lightness"===n){const i=ti.getColorBrightness(new ti(e));return ti.getColorBrightness(new ti(t))<.5?i>=.5:i<.5}return s?AM(t,e)>s:"largeText"===i?AM(t,e)>3:AM(t,e)>4.5}function AM(t,e){const i=MM(t),s=MM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function MM(t){const e=ii(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function wM(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function TM(t,e){return[t[0]*e,t[1]*e]}function CM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function BM(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=Zt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const EM=(t,e,i,s)=>new Le(Object.assign({defaultFontParams:Object.assign({fontFamily:nM,fontSize:14},s),getTextBounds:i?void 0:gf,specialCharSet:"-/: .,@%'\"~"+Le.ALPHABET_CHAR_SET+Le.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function PM(t,e,i={}){if(!t)return{width:0,height:0};const s=gf({text:t,fontFamily:e.fontFamily||i.fontFamily||nM,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 RM(t,e="type"){var i,s;return p(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 OM(t){var e,i;return u(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function IM(t,e="type"){const i=RM(t,e);return"rich"===i?df.richtext(OM(t)):("html"===i?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"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),df.text(t))}function LM(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 DM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function FM(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 zM(t,e){const{dx:i,dy:s}=FM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function jM(){DA(),YA(),JA(),$A(),tM()}var HM=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);nc&&(w=c,O.setAttribute("maxLineWidth",c-b[1]-b[2]))),A=0,M=0;let H=0;"left"===z||"start"===z?H=1:"right"===z||"end"===z?H=-1:"center"===z&&(H=0),H?H<0?(A-=w,k&&k.setAttribute("x",(k.attribute.x||0)-I),S.setAttribute("x",-b[1]-B)):H>0&&S.setAttribute("x",b[3]):(A-=w/2,k&&k.setAttribute("x",(k.attribute.x||0)-I/2),S.setAttribute("x",-B/2));const V="right"===y||"end"===y,N="left"===y||"start"===y,W=(t,e)=>{"richtext"===O.type?O.setAttributes({x:t,textAlign:e,textConfig:G(O.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):O.setAttributes({x:t,textAlign:e})};if((y?"center"===y:_)&&H){const t=w-b[1]-b[3],e=I+B,i=1===H?(t-e)/2+B+I/2:b[0]+B-(w/2+e/2-B)+I/2;if(W(i,"center"),k){const t=i-I/2-B+F/2;k.setAttributes({x:t})}}if(N&&1!==H){const t=w-b[1]-b[3],e=0===H?-t/2+B/2:-w+b[3]+b[1]+B;if(W(e+B,"left"),k){const t=e+F/2;k.setAttributes({x:t})}}if(V&&-1!==H){const t=w-b[1]-b[3],e=0===H?t/2+B/2:t;if(W(e,"right"),k){const t=e-I-B+F/2;k.setAttributes({x:t})}}"middle"===j?(M-=T/2,k&&k.setAttribute("y",0)):"bottom"===j?(M-=T,k&&k.setAttribute("y",-L/2),S.setAttribute("y",-b[2])):"top"===j&&(S.setAttribute("y",b[0]),k&&k.setAttribute("y",L/2)),E(null==m?void 0:m.text)||(O.states=m.text);const{visible:U}=a,Y=HM(a,["visible"]);if(f&&h(U)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},Y),{visible:U&&!!s,width:w,height:T,x:A,y:M}),"rect");if(E(null==m?void 0:m.panel)||(t.states=m.panel),Y.customShape){const e=Y.customShape;t.pathProxy=t=>e(this,t,new Nl)}this._bgRect=t}this._textShape=O,this._symbol=k,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:z({},VM.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}VM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const NM={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}},WM={poptip:z({},NM)};var UM=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);nk?q=k:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(_(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),L.setAttribute("x",L.attribute.x+e),o.setAttribute("dx",Gt(Ut(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),L.setAttribute("y",L.attribute.y+e),o.setAttribute("dy",Gt(Ut(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?Ft/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:Ft/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?Ft/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?Ft/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:Ft/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?Ft/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?Ft:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:Ft,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?Ft:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}ZM.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"},panel:{},maxWidthPercent:.8,space:8,padding:10};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};let QM=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};z(s,ZM.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new ZM(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};z(e,WM.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,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),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}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}};QM=JM([$a()],QM);var tw=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 ew{constructor(){this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(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)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}let iw=class extends ew{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};iw=tw([$a()],iw);let sw=class extends ew{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}};sw=tw([$a()],sw);const nw=new La(((t,e,i,s)=>{i(QM)||(t(QM).toSelf().inSingletonScope(),t(hg).toService(QM)),i(iw)||(t(iw).toSelf(),t(Nv).toService(iw)),i(sw)||(t(sw).toSelf(),t(Nv).toService(sw))}));class rw extends Jy{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}DA(),HA();class aw extends rw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},aw.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})}}aw.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},DA(),YA();class ow extends rw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ow.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})}}ow.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},DA(),CA();class lw extends rw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},lw.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=ne.distancePP(t,e);this.setAttribute("radius",i)}}lw.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},DA(),CA();class hw extends rw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},hw.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=iM,endAngle:s=sM}=this.attribute,n=s-i,r=ae(ce(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}hw.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},DA(),NA();class cw extends rw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},cw.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=le(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=ne.distancePP(t,e);this.setAttribute("radius",i)}}function dw(){DA(),HA(),UA(),JA()}function uw(){DA(),HA(),CA(),JA()}cw.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},dw();class pw extends Jy{getStartAngle(){return de(this._startAngle)}getEndAngle(){return de(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},pw.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(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 n,r;const a=df.line(Object.assign(Object.assign({points:t},_(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),E(null==s?void 0:s.line)||(a.states=_(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=df.line;G(i)[0].cornerRadius&&(t=df.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},G(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),E(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:f=12}=t;let m,v;"start"===i?(m={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)):(m={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=df.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),E(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?E(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):E(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]:Z(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}}pw.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}}},uw();class gw extends pw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},pw.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=df.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"),E(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var fw,mw;!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.labelHoverOnAxis="axis-label-hover-on-axis",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",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(fw||(fw={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(mw||(mw={}));const vw={[mw.selectedReverse]:{},[mw.selected]:{},[mw.hover]:{},[mw.hoverReverse]:{}},_w={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}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},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}}},yw={size:8,stroke:"#000",lineWidth:1,zIndex:1};const bw=Math.sin(Math.PI/10);function xw(t,e=bw){const i=!d(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function Sw(t,e=bw){const i=!d(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function kw(t){const e={};return mM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function Aw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function Mw(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return TM(r,(s?-1:1)*(n?-1:1)*t/CM(r))}function ww(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function Cw(t,e,i){var s;if(Sw(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>De(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>De(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>Fe(n,r)}function Bw(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!E(s.states)?(s.addState(rM.hover,!0),mM(e,(t=>{t!==s&&t.name&&!E(t.states)&&t.addState(rM.hoverReverse,!0)})),s):i},Pw=(t,e,i)=>i?(mM(e,(t=>{t.name&&!E(t.states)&&(t.removeState(rM.hoverReverse),t.removeState(rM.hover))})),null):i,Rw=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(rM.selected)?(mM(e,(t=>{t.name&&!E(t.states)&&(t.removeState(rM.selectedReverse),t.removeState(rM.selected))})),null):s.name&&!E(s.states)?(s.addState(rM.selected,!0),mM(e,(t=>{t!==s&&t.name&&!E(t.states)&&t.addState(rM.selectedReverse,!0)})),s):i};class Ow extends Jy{_prepareAnimate(t){if(!1!==this.attribute.animation){const{animation:e,animationEnter:i,animationExit:s,animationUpdate:n}=this.attribute,r=p(e)?e:{};this._animationConfig={enter:!1!==i&&z({},t,r,null!=i?i:{}),exit:!1!==s&&z({},t,r,null!=s?s:{}),update:!1!==n&&(_(n)?n:z({},t,r,null!=n?n:{}))}}else this._animationConfig={enter:!1,exit:!1,update:!1}}}const Iw={type:"default",duration:300,easing:"linear"};class Lw extends Ow{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=Ew(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=Pw(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=Rw(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=df.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._prepare(),this._prevInnerView=this._innerView&&kw(this._innerView),this.removeAllChild(!0),this._innerView=df.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation()}_prepare(){this._prepareAnimate(Iw)}_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=df.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=fw.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=df.group({x:0,y:0,pickable:!1});t.name=fw.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",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=df.group({x:0,y:0,pickable:!1});i.name=fw.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=df.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=fw.tick,r.id=this._getNodeId(t.id),E(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=aM;else{const t=this.data[s],e=z({},aM,this.attribute.tick.state);Object.keys(e).forEach((i=>{c(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=df.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=fw.subTick,r.id=this._getNodeId(`${n}`),E(s.state))r.states=aM;else{const i=z({},aM,s.state);Object.keys(i).forEach((s=>{c(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&&c(s)&&(e=s(e,i));const n=this._transformItems(e),r=df.group({x:0,y:0,pickable:!1});return r.name=`${fw.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=IM(this._getLabelAttribute(t,e,n,i));if(a.name=fw.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),E(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=aM;else{const s=z({},aM,this.attribute.label.state);Object.keys(s).forEach((r=>{c(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new VM(Object.assign({},e));i.name=fw.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return Aw(t,this.getVerticalVector(e,i,t))}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&&c(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;Vt(s[0])>Vt(s[1])?o=Ft/2*(l.x>e.x?1:-1):h=Ft/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+P(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+P(this.attribute,"label.space",4))*s);const f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:_}=this.attribute.label;_=c(_)?z({},_w.label.style,_(t,e,i,s)):_;_=z(this.getLabelAlign(m,o,_.angle),_),c(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let y=_.react;return c(y)&&(y=y(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,_)),{text:null!=d?d:v,_originText:t.label,lineHeight:null==_?void 0:_.fontSize,type:h}),_),{react:y})}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}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},mM(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(e.setFinalAttributes(e.attribute),r){r.release();const i=r.attribute,a=e.getFinalAttribute(),o=function(t,e,i){const s={};for(const i in e)i in t&&N(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}(i,a);let l=Object.keys(o).length>0;if("opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l){this._newElementAttrMap[e.id]={state:"update",node:e,attrs:e.attribute};const i=r.attribute;e.setAttributes(i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}])}}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const Dw={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&&Cw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function Fw(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function zw(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=c(n)?n:Dw[n]||Dw.parity;if(s.length>=3&&Bw(s,r)){do{s=a(s,r)}while(s.length>=3&&Bw(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=Y(i);Cw(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),zw(l,s,n,(t=>Cw(t,l,r))),zw(h,s,o,(t=>Cw(t,h,r)||!(!n||t===l)&&Cw(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function Hw(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},Ww(t,e.attribute.angle)),{angle:Nw(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({},Uw(t,e.attribute.angle)),{angle:Nw(e.attribute.angle)}))}))}(t,e),function(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=Ae({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function Nw(t=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 Ww(t,e=0){let 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=Nw(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 Uw(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=Nw(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 Gw(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(E(t)||!k(i))return;const o=function(t){return k(t)?{left:t,right:t}:p(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!d(h),u=c?Math.cos(h):1,g=c?Math.sin(h):0,f=Sw(h),m=xw(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/g);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===_||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=g/u,l=Math.abs(i/g);if(y&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(u);r=Math.min(t,l)}else if(y&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(u);r=Math.min(t,l)}else r=l}else r=Math.abs(i/u);k(t.attribute.maxLineWidth)&&(r=k(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function Yw(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class Xw{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,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=CM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return TM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class $w{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-$w.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*$w.bounceIn(2*t):.5*$w.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ht*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ht/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ht*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Ht/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Ht*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ht/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Ht/e)*.5+1}}static registerFunc(t,e){$w[t]=e}}function Kw(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}$w.quadIn=$w.getPowIn(2),$w.quadOut=$w.getPowOut(2),$w.quadInOut=$w.getPowInOut(2),$w.cubicIn=$w.getPowIn(3),$w.cubicOut=$w.getPowOut(3),$w.cubicInOut=$w.getPowInOut(3),$w.quartIn=$w.getPowIn(4),$w.quartOut=$w.getPowOut(4),$w.quartInOut=$w.getPowInOut(4),$w.quintIn=$w.getPowIn(5),$w.quintOut=$w.getPowOut(5),$w.quintInOut=$w.getPowInOut(5),$w.backIn=$w.getBackIn(1.7),$w.backOut=$w.getBackOut(1.7),$w.backInOut=$w.getBackInOut(1.7),$w.elasticIn=$w.getElasticIn(1,.3),$w.elasticOut=$w.getElasticOut(1,.3),$w.elasticInOut=$w.getElasticInOut(1,.3*1.5),$w.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),$w.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},$w.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)$w[`flicker${t}`]=e=>Kw(e,t);for(let t=2;t<10;t++)$w[`aIn${t}`]=e=>t*e*e+(1-t)*e;function qw(t,e,i){return t+(e-t)*i}const Zw=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=qw(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=qw(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=qw(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=qw(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=qw(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=qw(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=qw(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=qw(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=qw(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=dp(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?pp(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=dp(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?pp(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=qw(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=qw(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=qw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=qw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=qw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=qw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=qw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=qw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=qw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=qw(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=qw(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=qw(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=qw(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=qw(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=qw(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=qw(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=td(e,i,s),r.addUpdateBoundTag()}}};function Jw(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.setAttributes(this.target.attribute)},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=$w[s])&&void 0!==n?n:$w.linear:$w.linear,"wait"===t&&(this.onUpdate=Qw),this.id=Ia.GenAutoIncrementId(),this.syncAttributeUpdate=Qw}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(v(i)&&v(s)){const n=hp.Get(i,lp.Color255),r=hp.Get(s,lp.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(Zw["fill"===e?"fillPure":"strokePure"])}else Zw[e]?t.push(Zw[e]):t.push(Jw)}else Zw[e]?t.push(Zw[e]):t.push(Jw)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate;this.target.animates.forEach((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const i=e.getStartProps();this.propKeys.forEach((t=>{null!=i[t]&&e.preventAttr(t)}))}))}deleteSelfAttr(t){var e;delete this.props[t],this.fromProps&&delete this.fromProps[t];const i=this.propKeys.indexOf(t);-1!==i&&(this.propKeys.splice(i,1),null===(e=this.interpolateUpdateFunctions)||void 0===e||e.splice(i,1))}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){this.target.setAttributes(this.props),t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class eT extends tT{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();this.target.setAttributes(t)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class iT extends o{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Ia.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Oo.END?this.removeAnimate(t,!0):t.status!==Oo.RUNNING&&t.status!==Oo.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const sT=new iT;sT.isGlobal=!0;class nT{constructor(t=Ia.GenAutoIncrementId(),e=sT,i){this.id=t,this.status=Oo.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){return this.target=t,this.target.animates||(this.target.animates=new Map),this.target.animates.set(this.id,this),this.onRemove((()=>{this.stop(),this.target.animates.delete(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new tT(Ro.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new eT(Ro.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new tT(Ro.from,t,e,i);return this._firstStep?(this._lastStep.append(s),this._lastStep=s):(this._firstStep=s,this._lastStep=s),this.updateDuration(),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Oo.RUNNING&&(this.status=Oo.PAUSED)}resume(){this.status===Oo.PAUSED&&(this.status=Oo.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this._preventAttrs.add(t),delete this._startProps[t],delete this._endProps[t];let e=this._firstStep;for(;e;)e.deleteSelfAttr(t),e=e.next}preventAttrs(t){t.forEach((t=>this._preventAttrs.add(t)))}validAttr(t){return!this._preventAttrs.has(t)}runCb(t){var e;return null===(e=this._lastStep)||void 0===e||e.onEnd(t),this}startAt(t){return this._startTime=t,this}customInterpolate(t,e,i,s,n,r){return!1}getFromValue(){return this._startProps}getToValue(){return this._endProps}stop(t){let e=this._firstStep;for(;e;)e.stop(),e=e.next;this.status!==Oo.END&&this.onEnd(),this.status=Oo.END,this.target&&("start"===t?this.target.setAttributes(this._startProps):"end"===t?this.target.setAttributes(this._endProps):t&&this.target.setAttributes(t))}release(){this.status=Oo.END,this._onRemove&&this._onRemove.forEach((t=>t())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Oo.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),void(this.status=Oo.END);this.status=Oo.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&this.target.setAttributes(this._startProps);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const rT=new ko;class aT{constructor(){this.released=!1}tick(t,e){rT.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class oT extends o{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Po.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Po.INITIAL,xo.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),xo.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new aT;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Po.INITIAL&&(this.status=Po.PAUSE,!0)}resume(){return this.status!==Po.INITIAL&&(this.status=Po.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Po.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Po.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Po.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Po.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Po.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Po.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,xo.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}function dT(t){if(!t||!c(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1}return 2}cT.getInstance();class uT{static registerBuiltInAnimate(t,e){uT.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;_(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:uT.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=dT(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:uT.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=dT(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=k(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){Array.isArray(t)?t.forEach((t=>this._execute(t))):this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,d,u;const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:_=0,duration:y=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:k,priority:A=0,options:M,custom:w,customType:T,controlOptions:C}=t,B=e.animate();B.priority=A;const E=c(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],R=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&R&&(i=null!==(h=P[R])&&void 0!==h?h:i),B.startAt(b);const O=i*x+E;O>0&&B.wait(O);let I=null,L=t.to,D=t.from;L||(I||(I=this.createPropsFromChannel(g,e)),L=I.props),D||(I||(I=this.createPropsFromChannel(g,e)),D=I.from),I.attrOutChannel&&e.setAttributes(I.attrOutChannel),this._handleRunAnimate(B,w,T,D,L,y,m,f,C,M,p,e);let F=0;x&&(F=x*(s-i-1));const z=c(_)?_(null===(u=null===(d=e.context)||void 0===d?void 0:d.data)||void 0===u?void 0:u[0],e,{}):_;return z>0&&(F+=z),F>0&&B.wait(F),S&&S>0&&B.loop(S),k&&B.bounce(!0),B}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,d,u){var p,g,f,m,v,_,y,b;if(e&&i){i=dT(e);let d=this.resolveValue(o,u);"function"==typeof d&&(d=d(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),d=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},d);const x=c(h)?h.call(null,null!==(_=d&&(null===(v=d.data)||void 0===v?void 0:v[0]))&&void 0!==_?_:null===(b=null===(y=u.context)||void 0===y?void 0:y.data)||void 0===b?void 0:b[0],u,d):h;d.options=x,d.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,d):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,d)}else"to"===d?t.to(n,r,a):"from"===d&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:d=0,delayAfter:u=0}=t,p=c(d)?d(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):d,g=c(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;u||(d||(d=this.createPropsFromChannel(a,i)),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i)),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const g=null!==(n=t.custom)&&void 0!==n?n:uT.builtInAnimateMap[r],f=t.custom?t.customType:dT(g);this._handleRunAnimate(e,g,f,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e){var i;const s={};let n=null;if(!t)return{from:n,props:s,attrOutChannel:null};const r={};let a=!1;const o=null===(i=e.context)||void 0===i?void 0:i.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===o[e]||(t[e]={to:o[e]}),t)),{})),Object.keys(t).forEach((i=>{var r,a,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?s[i]=h.to(null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,{}):s[i]=h.to),void 0!==h.from&&(n||(n={}),"function"==typeof h.from?n[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):n[i]=h.from)})),o)for(const t in o){const e=o[t];void 0!==e&&(s.hasOwnProperty(t)||(r[t]=e,a=!0))}return{from:n,props:s,attrOutChannel:a?r:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}executeItem(t,e,i=0,s=1){return Array.isArray(t)?t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean):[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Oo.END),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}uT.builtInAnimateMap={};const pT="appear",gT="disappear",fT="update",mT="highlight",vT="unhighlight";class _T{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class yT{constructor(t){this.stateList=null,this.graphic=t}applyState(t,e,i){const s=cT.getInstance(),n=[],r=[];if(this.stateList&&this.stateList.length?t.forEach(((t,i)=>{const a={allowTransition:!0,stopOriginalTransition:!0};this.stateList.forEach((e=>{const i=s.isTransitionAllowed(e.state,t,this.graphic);a.allowTransition=a.allowTransition&&i.allowTransition})),a.allowTransition&&(r.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new uT(this.graphic)}),this.stateList.forEach((e=>{s.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&n.push(e)})))})):t.forEach(((t,i)=>{r.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new uT(this.graphic)})})),n.forEach((t=>{t.executor.stop(null,!1)})),r.length){r[0].executor.execute(r[0].animationConfig);for(let t=0;t{e&&e.executor.execute(e.animationConfig),this.stateList=this.stateList.filter((t=>t!==s)),t===r.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!n.includes(t))):this.stateList=[],this.stateList.push(...r)}applyAppearState(t,e){this.applyState([pT],[{name:pT,animation:t}],e)}applyDisappearState(t,e){this.applyState([gT],[{name:gT,animation:t}],e)}applyUpdateState(t,e){this.applyState([fT],[{name:fT,animation:t}],e)}applyHighlightState(t,e){this.applyState([mT],[{name:mT,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([vT],[{name:vT,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class bT{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new yT(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new _T(t)),t._animationStateStore}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return(new bT)._getAnimationStateManager(t),t}}class xT{getAttributes(t=!1){return t&&this.finalAttribute?this.finalAttribute:this.attribute}animate(t){var e,i,s;const n=new nT(null==t?void 0:t.id,null!==(i=null!==(e=null==t?void 0:t.timeline)&&void 0!==e?e:this.stage&&this.stage.getTimeline())&&void 0!==i?i:sT,null==t?void 0:t.slience);if(n.bind(this),t){const{onStart:e,onEnd:i,onRemove:s}=t;null!=e&&n.onStart(e),null!=i&&n.onEnd(i),null!=s&&n.onRemove(s)}return null===(s=this.stage)||void 0===s||s.ticker.start(),n}createTimeline(){return new iT}createTicker(t){return new oT(t)}setFinalAttributes(t){this.finalAttribute||(this.finalAttribute={}),Object.assign(this.finalAttribute,t)}initFinalAttributes(t){this.finalAttribute=t}initAnimateExecutor(){this._animateExecutor||(this._animateExecutor=new uT(this))}executeAnimation(t){return this.initAnimateExecutor(),this._animateExecutor.execute(t),this}executeAnimations(t){return this.initAnimateExecutor(),t.forEach((t=>{this._animateExecutor.execute(t)})),this}getFinalAttribute(){return this.finalAttribute}getGraphicAttribute(t,e=!1){return!e&&this.finalAttribute?this.finalAttribute[t]:this.attribute[t]}pauseAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function ST(){U(Cp,bT),U(Cp,xT)}class kT extends tT{constructor(t,e,i,s,n){super("customAnimate",e,i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class AT extends kT{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class MT extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0,this.checkStatusAfterRender=!0,this._beforeStageRender=()=>{if(!this.willCallBeforeStageRender)return;this.willCallBeforeStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.beforeStageRender(t,e);i&&this.renderToStage(t,i)},this._afterStageRender=()=>{if(!this.willCallAfterStageRender)return;this.willCallAfterStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.afterStageRender(t,e);i&&this.renderToStage(t,i),this.checkStatusAfterRender&&this.animate.status===Oo.END&&this.animate.timeline.removeAnimate(this.animate)},this.props={}}beforeStageRender(t,e){return!1}afterStageRender(t,e){return!1}onFirstRun(){super.onFirstRun(),this.target.stage.setBeforeRender(this._beforeStageRender),this.target.stage.setAfterRender(this._afterStageRender),this.target.stage.disableDirtyBounds()}stop(){super.stop(),this.target.stage.removeBeforeRender(this._beforeStageRender),this.target.stage.removeAfterRender(this._afterStageRender)}onUpdate(t,e,i){super.onUpdate(t,e,i),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0}renderToStage(t,e){const i=t.window.getContext().canvas.nativeCanvas,s=i.getContext("2d");return!!s&&(s.clearRect(0,0,i.width,i.height),s.drawImage(e,0,0),i)}}class wT{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new uT(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttr(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function TT(t){return new wT(t)}class CT extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,this.target.setAttribute("text",n)}}const BT=1e3,ET="quadInOut",PT=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],RT=(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=dp(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},OT=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?Q_(t):[],n=Q_(e);i&&s&&(i.fromTransform&&ty(s,i.fromTransform.clone().getInverse()),ty(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})))},LT=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],DT=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!LT.includes(n))return;const r=e[n];if(!d(r)&&!d(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?hp.Get(t,lp.Color255):t;i.push({from:_(t[n])?t[n].map(e):e(t[n]),to:_(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class FT extends kT{constructor(t,e,i){super({},{},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;OT(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&RT(this.otherAttrs,i,e),this.target.setAttributes(i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const zT=(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=IT(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=DT(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new FT({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:BT,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:ET);return c.play(d),c};class jT extends kT{constructor(t,e,i){super({},{},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;OT(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&&RT(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const HT=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>PT.includes(t))(i)||(e[i]=t[i])})),e},VT=(t,e,i)=>{const s=HT(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),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=xo.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},NT=(t,e,i)=>{const s=[],n=i?null:HT(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:HT(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=Pg(t.attribute),n=iy(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(xo.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=iy(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(xo.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=iy(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(xo.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 sy(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 sy(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(xo.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:ny(i)}];const s=[];return ay(i,e,s),s})(t,e).forEach((t=>{s.push(xo.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&&x(t.x)&&x(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 ay(l,e,h),h})(t,e).forEach((t=>{s.push(xo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=Q_(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(xo.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(xo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&VT(t,s,e),s};class UT extends kT{constructor(t,e,i,s,n){super(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(){super.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:$o.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:$o.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:$o.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class GT extends UT{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;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 k=0,A=0;"anticlockwise"===S?(A="in"===b?x+2*Math.PI:x,A=x+2*Math.PI):(k=x,A="out"===b?x+2*Math.PI:x);const M=xo.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!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:y/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(_+y)/2,innerRadius:0,startAngle:k,endAngle:A,fill:!0});let w,T;"anticlockwise"===S?(w={startAngle:x+2*Math.PI},T={startAngle:x}):(w={endAngle:x},T={endAngle:x+2*Math.PI}),super("in"===b?w:T,"in"===b?T:w,i,s,{group:null==n?void 0:n.group,clipGraphic:M})}}class YT extends UT{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:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=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=xo.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:f,height:"in"===v&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===y?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class XT extends kT{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){super.onBind();const{points:t,segments:e}=this.target.attribute,{points:i,segments:s}=this.target.getFinalAttribute();this.from={points:t,segments:e},this.to={points:i,segments:s},this.props=this.to;const n=this.getPoints(this.from),r=this.getPoints(this.to,!0);this.fromPoints=n?Array.isArray(n)?n:[n]:[],this.toPoints=r?Array.isArray(r)?r:[r]:[];const a=new Map;this.fromPoints.forEach((t=>{t.context&&a.set(t.context,t)}));let o,l,h=1/0,c=-1/0;for(let t=0;t=0;t-=1)if(a.has(this.toPoints[t].context)){c=t,l=a.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(c)?(this.clipRange=this.toPoints[c][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[c][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=mt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let d=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=a.get(t.context);return i?(d=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ec&&l?[l,t]:[d,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new se(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(t)return Object.keys(this.to).forEach((t=>{this.target.attribute[t]=this.to[t]})),this.target.addUpdatePositionTag(),void this.target.addUpdateShapeAndBoundsTag();if(this.points=this.points.map(((t,i)=>{const s=Qc(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));this.target.setAttributes({clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.target.attribute.segments=e}else this.target.attribute.points=this.points;this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class $T extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0}));const o=this.target.getFinalAttribute();o&&this.target.setAttributes(o),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(a)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class KT extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Object.assign(this.target.attribute,i),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class qT extends $T{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class ZT extends KT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}class JT extends $T{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"],this.from={opacity:0,fillOpacity:0,strokeOpacity:0}}}class QT extends KT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"]}}const tC=(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.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=x(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=x(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.getFinalAttribute();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)};class eC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this._updateFunction=null}updateStartAngle(t){this.target.attribute.startAngle=this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t}updateEndAngle(t){this.target.attribute.endAngle=this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class iC extends eC{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=tC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r),this.determineUpdateFunction()}}class sC extends eC{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=x(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class nC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:u(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:u(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return u(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),u(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:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class rC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:u(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:u(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return u(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),u(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const aC=(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,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?x(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=x(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:d(l)?void 0:c,height:d(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class oC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=aC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class lC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?x(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=x(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:d(o)?void 0:h,height:d(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const hC=(t,e,i)=>{const s=t.getFinalAttribute().points,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.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class cC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(this.target.attribute.points=r.map(((t,i)=>Qc(r[i],a[i],e))),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class dC extends cC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:hC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class uC extends cC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:hC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const pC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class gC extends cC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:pC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class fC extends cC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:pC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const mC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class vC extends cC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:mC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class _C extends cC{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:mC(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const yC=(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.getFinalAttribute(),n=x(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.getFinalAttribute();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)};class bC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class xC extends bC{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=yC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}}class SC extends bC{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const kC=(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.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?x(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=x(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:d(a)?void 0:l,width:d(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class AC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=kC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class MC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?x(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=x(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class wC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c;let d,u;super.onBind();const p=this.target.getFinalAttribute(),g=null!==(t=this.target.attribute)&&void 0!==t?t:{};switch(null===(e=this.params)||void 0===e?void 0:e.direction){case"x":d={scaleX:null!==(i=g.scaleX)&&void 0!==i?i:0},u={scaleX:null!==(s=null==p?void 0:p.scaleX)&&void 0!==s?s:1},this._updateFunction=this.updateX;break;case"y":d={scaleY:null!==(n=g.scaleY)&&void 0!==n?n:0},u={scaleY:null!==(r=null==p?void 0:p.scaleY)&&void 0!==r?r:1},this._updateFunction=this.updateY;break;default:d={scaleX:null!==(a=g.scaleX)&&void 0!==a?a:0,scaleY:null!==(o=g.scaleY)&&void 0!==o?o:0},u={scaleX:null!==(l=null==p?void 0:p.scaleX)&&void 0!==l?l:1,scaleY:null!==(h=null==p?void 0:p.scaleY)&&void 0!==h?h:1},this._updateFunction=this.updateXY}const f=this.target.getFinalAttribute();f&&this.target.setAttributes(f),this.props=u,this.from=d,this.to=u,!1!==(null===(c=this.params.controlOptions)||void 0===c?void 0:c.immediatelyApply)&&this.target.setAttributes(d)}onEnd(t){super.onEnd(t)}updateX(t){this.target.attribute.scaleX=this.from.scaleX+(this.to.scaleX-this.from.scaleX)*t}updateY(t){this.target.attribute.scaleY=this.from.scaleY+(this.to.scaleY-this.from.scaleY)*t}updateXY(t){this.updateX(t),this.updateY(t)}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateXY:"scaleX"===this.propKeys[0]?this._updateFunction=this.updateX:"scaleY"===this.propKeys[0]?this._updateFunction=this.updateY:this._updateFunction=null}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag())}}class TC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n;let r,a;super.onBind();const o=this.target.attribute;switch(null===(t=this.params)||void 0===t?void 0:t.direction){case"x":r={scaleX:null!==(e=null==o?void 0:o.scaleX)&&void 0!==e?e:1},a={scaleX:0};break;case"y":r={scaleY:null!==(i=null==o?void 0:o.scaleY)&&void 0!==i?i:1},a={scaleY:0};break;default:r={scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1,scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1},a={scaleX:0,scaleY:0}}this.props=a,this.from=r,this.to=a}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}}class CC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}class BC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e;super.onBind();let{diffAttrs:i={}}=null!==(t=this.target.context)&&void 0!==t?t:{};const{options:s}=this.params;i=Object.assign({},i),(null===(e=null==s?void 0:s.excludeChannels)||void 0===e?void 0:e.length)&&s.excludeChannels.forEach((t=>{delete i[t]})),this.props=i}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i)}}class EC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class PC extends EC{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:d,excludeChannels:u=[],layoutRect:p={}}=null!=e?e:{};let g=0,f=0;"negative"===l&&(g=null!==(s=p.width)&&void 0!==s?s:t.stage.viewWidth,f=null!==(n=p.height)&&void 0!==n?n:t.stage.viewHeight),g+=o,f+=o;const m=c(d)?d.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):d,v=t.getGraphicAttribute("x"),_=t.getGraphicAttribute("y"),y=u.includes("x")?v:m&&k(m.x)?m.x:g,b=u.includes("y")?_:m&&k(m.y)?m.y:f;switch(h){case"x":return{from:{x:u.includes("x")?v:y},to:{x:v}};case"y":return{from:{y:b},to:{y:_}};default:return{from:{x:y,y:b},to:{x:v,y:_}}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}}class RC extends EC{onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:d}=null!=e?e:{},u=i.group?i.group.AABBBounds:null,p=null!==(s=u.width())&&void 0!==s?s:i.width,g=null!==(n=u.height())&&void 0!==n?n:i.height,f=("negative"===l?p:0)+o,m=("negative"===l?g:0)+o,v=c(d)?d.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):d,_=v&&k(v.x)?v.x:f,y=v&&k(v.y)?v.y:m;switch(h){case"x":return{from:{x:t.getGraphicAttribute("x")},to:{x:_}};case"y":return{from:{y:t.getGraphicAttribute("y")},to:{y:y}};default:return{from:{x:t.getGraphicAttribute("x"),y:t.getGraphicAttribute("y")},to:{x:_,y:y}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=t,this.to=e}}class OC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class IC extends OC{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=ut(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(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:n},to:{angle:s}}})(this.target,this.params.options);this.props=i,this.propKeys=["angle"],this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}}class LC extends OC{onBind(){super.onBind();const{from:t,to:e}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=ut(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(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:n}}})(this.target,this.params.options);this.props=e,this.propKeys=["angle"],this.from=t,this.to=e}}class DC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.from=null!=t?t:{}}onBind(){var t,e;super.onBind(),Object.keys(this.from).forEach((t=>{null==this.props[t]&&(this.props[t]=this.target.getGraphicAttribute(t))}));const i=this.target.getFinalAttribute();"appear"===(null===(t=this.target.context)||void 0===t?void 0:t.animationState)&&i&&this.target.setAttributes(i),!1!==(null===(e=this.params.controlOptions)||void 0===e?void 0:e.immediatelyApply)&&this.target.setAttributes(this.from)}onFirstRun(){this.from=Object.assign(Object.assign({},this.getLastProps()),this.from);const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.from[e]=null!==(i=this.from[e])&&void 0!==i?i:t[e]})),this.target.setAttributes(this.from)}deleteSelfAttr(t){super.deleteSelfAttr(t),delete this.from[t]}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.from,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.from[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}class FC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=xo.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Nl,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=xo.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_;const y=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(y){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:$o.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(_=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==_?_:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:$o.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=ll(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=ll(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(ne.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(ne.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;e{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=df.group({zIndex:999});e.name=fw.axisBreak,e.id=this._getNodeId(`${fw.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=z({},yw,s),a=null!==(e=r.size)&&void 0!==e?e:yw.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=df.symbol(Object.assign({x:s.x,y:s.y},o));l.name=fw.axisBreakSymbol;const h=df.symbol(Object.assign({x:n.x,y:n.y},o));h.name=fw.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=df.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=fw.background,n.id=this._getNodeId("background"),n.states=z({},vw,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new VM(Object.assign({},t));e.name=fw.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=VC(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];E(l)||(c.state={line:z({},vw,l),symbol:z({},vw,l)});const d=new pw(c);d.name=fw.line,d.id=this._getNodeId("line"),t.add(d)}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}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:u}=s,p=VC(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),_=this.getRelativeVector();let y=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+P(this.attribute,"label.space",4);y+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===_[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?y+=i+(e-1)*t:y=0}else if(0===_[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;y+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}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.getActualOffset(x),A=this.getVerticalCoord(v,S,!1),M=this.getVerticalVector(S,!1,{x:0,y:0});let w,T,{angle:C}=p;if(w="start"===n?"start":"end"===n?"end":"center",d(C)&&o){C=BM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;T=1==-1*t?"bottom":"top"}else w=this.getTextAlign(M),T=this.getTextBaseline(M,!1);let B=u;if(d(B)){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(C!==Math.PI/2){const t=Math.abs(Math.cos(null!=C?C:0));B=t<1e-6?1/0:this.attribute.end.x/t}else B=s-S;else if(C&&0!==C){const t=Math.abs(Math.sin(C));B=t<1e-6?1/0:this.attribute.end.y/t}else B=s-S}const E=Object.assign(Object.assign(Object.assign({},A),p),{maxWidth:B,textStyle:Object.assign({textAlign:w,textBaseline:T},a),state:{text:z({},vw,c.text),shape:z({},vw,c.shape),panel:z({},vw,c.background)}});return E.angle=C,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}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:u}=s,p=VC(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),_=this.getVerticalVector(m,!1,{x:0,y:0});let y,{angle:b}=p,x="center";if(d(b)&&a){b=BM(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;y=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(_,!1,o.angle);x=t,y=e}const S=u,k=h?h(c):c,A=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:y},o),text:k});return A.angle=b,l&&l.visible&&(A.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),A}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 Ww(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return Uw(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=Y(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(E(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:d,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(c(h))h(t,e,s,this);else{if(d)!function(t,e){if(E(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,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=re(e)})),Vw(i,t),!Hw(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(E(t)||!k(i))return;const a=t[0].attribute.angle,o=Sw(a),l=xw(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=Yw(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);k(i)&&(c=Gt(c,i))}}else{if(l){const i=Yw(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);k(i)&&(c=Gt(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&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);Gw(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||d?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&jw(t,{orient:o,method:m,separation:v,lastVisible:_,firstVisible: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=df.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=fw.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(u(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(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 f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=PM(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=ni(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(){super.release(),this._breaks=null}}NC.defaultAttributes=_w,U(NC,Xw);class WC{isInValidValue(t){const{startAngle:e=iM,endAngle:i=sM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=iM,endAngle:i=sM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return le(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return Mw(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function UC(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=UC(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var XC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),k(l)&&l>=3){const t=ww(n,l,c,e,i);h=df.path(Object.assign(Object.assign({},a.style),{path:Tw(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=df.circle(t)}h.name=fw.line,h.id=this._getNodeId("line"),E(a.state)||(h.states=z({},vw,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:u={}}=a,p=XC(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=P(this.attribute.label,"style.fontSize",12)+P(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=n+m+f+o;let _="middle",{position:y}=this.attribute.title;d(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({},vw,u.text),shape:z({},vw,u.shape),panel:z({},vw,u.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;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(ut(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=UC(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&GC(e,c,i)}else e.AABBBounds.width()>r&&GC(e,r,i)}else o>a.x&&h.x2>n.x2?(GC(e,n.x2-o,i),r&&YC(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return ut(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}$C.defaultAttributes=_w,U($C,WC);const KC=t=>t.map(((t,e)=>({index:e,value:t}))),qC=(t,e,i=0)=>{const s=new He(t).expand(i/2),n=new He(e).expand(i/2);return s.intersects(n)},ZC=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=re(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,m=0;u||(p?(g=0,m=1):c&&(g=Math.cos(c),m=-Math.sin(c)));const v=EM(a),_=t.range();let y=[];for(let i=0;i{tB[t]=!0}));const rB=t=>-Math.log(-t),aB=t=>-Math.exp(-t),oB=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,lB=t=>10===t?oB:t===Math.E?Math.exp:e=>Math.pow(t,e),hB=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),cB=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),dB=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function uB(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 pB(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function gB(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function fB(t,e,i,s){return 1===i&&(i=0),gB(t,i,s)*(e/(1-i))}function mB(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function vB(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=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 yB{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=mB(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):u(this._rangeFactorStart)&&u(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return d(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(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 d(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(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=mt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=d(s)?(l-o)*i:s;let u=Math.exp(e);u=u/(u-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=u*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const bB=Symbol("implicit");class xB extends yB{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=QC.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=bB}clone(){const t=(new xB).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return u(this._rangeFactorStart)&&u(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!==bB)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&&a>1;)a-=1,r=Math.floor((e-t)/a);return SB(t,e,r,n)}class AB extends xB{constructor(t){super(),this.type=QC.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=fB(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(u(this._rangeFactorStart)&&u(this._rangeFactorEnd)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("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),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]}}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(u(this._rangeFactorStart)&&u(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=[tt(t[0]),tt(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[tt(t[0]),tt(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:kB(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=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(t=10){const e=this.calculateVisibleDomain(this._range);return kB(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=_t(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,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 d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return d(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&&x(this._userBandwidth)}clone(){var t,e,i;return new AB(!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:MB}=si;function wB(t,e){const i=typeof e;let s;if(d(e)||"boolean"===i)return()=>e;if("number"===i)return St(t,e);if("string"===i){if(s=ti.parseColorString(e)){const e=MB(ti.parseColorString(t),s);return t=>e(t).formatRgb()}return St(Number(t),Number(e))}return e instanceof ei?MB(t,e):e instanceof ti?MB(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 TB extends yB{constructor(t=nB,e=nB){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=nB,this._piecewise=pB,this._interpolate=wB}calculateVisibleDomain(t){var e;return u(this._rangeFactorStart)&&u(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,tt);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=_t(i[0],i[r-1])),this._piecewise=r>2?vB:pB,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:nB),this.rescale(i)):this._clamp!==nB}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=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 d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const CB=Math.sqrt(50),BB=Math.sqrt(10),EB=Math.sqrt(2),PB=[1,2,5,10],RB=(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=DB(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)),J(0,e).map((t=>n+t*s))):t>0?IB(0,-(e-1)/s,s):IB((e-1)/s,0,s)},OB=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 RB(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return RB(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=IB(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=IB(t,e,l);return n&&r.reverse(),r})),DB=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=PB[0];return i>=CB?s=PB[3]:i>=BB?s=PB[2]:i>=EB&&(s=PB[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function FB(t,e,i){const s=(e-t)/Math.max(0,i);return DB(s)}function zB(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;e0;){if(s=FB(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function HB(t,e){const i=x(e.forceMin),s=x(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:x(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:x(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),x(r[0])&&x(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=x(r[0])||x(r[1])?x(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const VB=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),NB=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})),WB=ft(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=LB(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?VB(t,e,n):VB(t,e,_B(n)),h=VB(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),UB=ft(((t,e,i,s,n)=>zB(s(t),s(e),i).map((t=>_B(n(t))))));class GB extends TB{constructor(){super(...arguments),this.type=QC.Linear}clone(){var t;const e=new GB;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return OB(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(c(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(u(this._rangeFactorStart)&&u(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=LB(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(t=10){const e=this.calculateVisibleDomain(this._range);return zB(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(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r: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}}function XB(t){return e=>-t(-e)}function $B(t=Number.EPSILON){return e=>Math.max(e,t)}class KB extends TB{constructor(){super(hB(10),lB(10)),this.type=QC.Log,this._limit=$B(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new KB).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=hB(this._base),s=lB(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=XB(i),this._pows=XB(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=rB,this.untransformer=aB):(this._logs=i,this._pows=s,this._limit=$B(),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 nB}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return NB(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return WB(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return UB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return UB(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{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))))}}}U(KB,YB);class qB extends GB{constructor(){super(cB(1),dB(1)),this.type=QC.Symlog,this._const=1}clone(){return(new qB).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=cB(t),this.untransformer=dB(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return NB(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return WB(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return UB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return UB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}U(qB,YB);class ZB{constructor(){this.type=QC.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!d(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 ZB).domain(this._domain).range(this._range).unknown(this._unknown)}}function JB(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function QB(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!eB(t.type))return KC(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return KC([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:d,noDecimals:p=!1,labelStyle:g,breakData:f}=e;let m;if(u(d))v=t.stepTicks(d),_=f&&f()?f().breakDomains:null,m=_&&_.length?v.filter((t=>_.every((e=>te[1])))):v;else if(u(h))m=JB(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=c(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=JB(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:p}):t.d3Ticks(e,{noDecimals:p})))}else{const i=null!==(s=c(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=c(e.tickMode)?e.tickMode:void 0;m=JB(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:p,customTicks:n}):t.ticks(e,{noDecimals:p,customTicks:n})))}var v,_;const y=t.domain();if(e.labelFirstVisible&&y[0]!==m[0]&&!m.includes(y[0])&&m.unshift(y[0]),e.labelLastVisible&&y[y.length-1]!==m[m.length-1]&&!m.includes(y[y.length-1])&&m.push(y[y.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=JC(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=JC(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=Y(l),r=f&&f()?eE.greedy:eE.parity;for(;l.length>=3&&Bw(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;Cw(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),QB(t,l,a,(e=>Cw(e,t,i))),QB(n,l,o,(e=>Cw(e,n,i)||!(!a||e===t)&&Cw(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),Y(h)!==Y(m)&&h.push(Y(m))),m=h}}return KC(m)},eE={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&Cw(i,t,e)||(i=t,0))))}},iE=(t,e,i,s)=>{const n=JC(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},sE=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,nE=(t,e)=>t[1]{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,p=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?KC([s[s.length-1]]):KC([s[0]]);let m;if(u(a))m=t.stepTicks(a);else if(u(r))m=t.forceTicks(r);else if(u(n)){const e=c(n)?n({axisLength:f,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=$(g),a=X(g);if(s.length<=f/n){const i=iE(t,s,e,p);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=aE(s,i,o,e.labelLastVisible,Math.floor(n/l),!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=iE(t,i,e,p);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!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])){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&&!sE(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?nE(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{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=EM(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=le({x:0,y:0},i,t),a=Aw(r,Mw(s,r,e,n));return o=a,l=Mw(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return _.align||(ut(y,f.x)?_.baseline||(_.baseline=b>f.y?"top":"bottom"):y>f.x?_.align="left":y{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||h<=0)return KC(t.domain());let d;if(u(n))d=t.stepTicks(n);else if(u(s))d=t.forceTicks(s);else if(u(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=c(i)?i({axisLength:s,labelStyle:l}):i;d=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=oE(t,i,e),r=$(s),l=X(s),c=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=hE(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/c));d=t.stepTicks(u),d=d.slice(0,d.length-p)}else d=t.domain();return KC(d)},hE=(t,e,i,s)=>{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&&qC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},cE=new Uint32Array(33),dE=new Uint32Array(33);dE[0]=0,cE[0]=~dE[0];for(let t=1;t<=32;++t)dE[t]=dE[t-1]<<1|1,cE[t]=~dE[t];function uE(t,e,i={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:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&cE[31&o]&dE[1+(31&l)])return!0}else{if(i[h]&cE[31&o])return!0;if(i[c]&dE[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,cE[31&o]&dE[1+(31&l)]);else for(s(h,cE[31&o]),s(c,dE[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,dE[31&a]|cE[1+(31&o)]);else for(n(l,dE[31&a]),n(h,cE[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=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 pE(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=mt(i,-o,t.width+l),d=mt(s,-o,t.width+l),u=mt(n,-a,t.height+h),p=mt(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function gE(t,e,i=!1){return i?pE(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function fE(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=gE(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=pE(t,r)),e.getRange(r)))}function mE(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>u(t))),p=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return mE(t,e,n,o,h,d,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?c(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return mE(t,e,n,s,h,d)}if("moveX"===i.type){const s=(i.offset?c(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return mE(t,e,n,s,h,d)}return!1}const _E=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],yE=["top","inside-top","inside"];function bE(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let _=0,y=0;return u<0-h?_=-u:p>m&&(_=m-p),g<0-l?y=-g:f>v&&(y=v-f),{dx:_,dy:y}}const xE={mode:"same-time",duration:300,easing:"linear"};function SE(t){return 3===t||4===t}function kE(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 AE=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 ME(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)}}var wE=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{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const BE=(t,e)=>Math.ceil(t)>Math.floor(e),EE=([t,e],[i,s])=>s>t&&e>i;function PE(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}var RE=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{const e=t.target;e===this._lastHover||E(e.states)||(e.addState(rM.hover,!0),mM(this,(t=>{t===e||E(t.states)||t.addState(rM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(mM(this,(t=>{E(t.states)||(t.removeState(rM.hoverReverse),t.removeState(rM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void mM(this,(t=>{E(t.states)||(t.removeState(rM.selectedReverse),t.removeState(rM.selected))}));E(e.states)||(e.addState(rM.selected,!0),mM(this,(t=>{t===e||E(t.states)||t.addState(rM.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)===$o.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===$o.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(xe(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,f=p-d;return[ME(g,f,c,d,a,o),ME(-g,-f,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds)}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=df.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Nl)}return e&&e.getAttributes(!0).fill&&s.setAttribute("stroke",e.getAttributes(!0).fill),this.attribute.line&&!E(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),d(this._idToGraphic)||this._isCollectionBase&&d(this._idToPoint))return;const t=[];!1!==this._enableAnimation&&this._baseMarks.forEach((e=>{t.push(e.attribute),e.initAttributes(e.getAttributes(!0))}));const{overlap:e,smartInvert:i,dataFilter:s,customLayoutFunc:n,customOverlapFunc:r}=this.attribute;let a=this.attribute.data;if(c(s)&&(a=s(a)),a&&a.length){const t=new Set;a=a.filter((e=>!t.has(e.id)&&t.add(e.id)))}let o=this._initText(a);o=c(n)?n(a,o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(o);const l=[],u=o;if(!h(e)&&c(null==e?void 0:e.filterBeforeOverlap)){const t=this.getRelatedGraphic.bind(this);o.forEach((i=>{e.filterBeforeOverlap(i,t,this)?u.push(i):l.push(i)}))}c(r)?o=r(u,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(l):!1!==e&&(o=this._overlapping(u).concat(l)),c(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),o&&o.length&&o.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==i&&this._smartInvert(o),this._renderLabels(o),!1!==this._enableAnimation&&this._baseMarks.forEach(((e,i)=>{e.initAttributes(t[i])}))}_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&&!E(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!E(e)&&(t.states=e)}_createLabelText(t){var e,i;return IM(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;const i=[];let s;if(s=c(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),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&BE(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&BE(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(ut(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(PE([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!EE([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let y=0,b=t.length-1;for(;y<=b;)y===b?_.push(t[y]):(_.push(t[y]),_.push(t[b])),y++,b--;return _}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&s.setRange(gE(i,t.AABBBounds,!0))}))),h.length>0&&h.forEach((t=>{v(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&&s.setRange(gE(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(gE(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){var s;if(t){if(!1!==t.attribute.visible){if(null===(s=t.context)||void 0===s?void 0:s.animationState){const e=t.clone();return Object.assign(e.attribute,t.getAttributes(!0)),e.AABBBounds}return t.AABBBounds}const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:n,y:r}=e;return{x1:n,x2:n,y1:r,y2:r}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=p(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:g}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{IE[t]=e};var DE=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{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,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*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}FE.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const zE=()=>{LE("symbol",FE),LE("line-data",FE)};var jE=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{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}})(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}}}HE.tag="rect-label",HE.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var VE=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{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=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}}(t,e,i,s)}};NE.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const WE=()=>{LE("line",NE),LE("area",NE)};var UE=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);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=c(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=c(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const d=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}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),h=l.getAttributes(!0),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!d(s[i])&&!d(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,d=h.endAngle-h.startAngle,p=pe(h.endAngle-d/2),g=le(c,h.outerRadius,o),f=le(c,a+e.line.line1MinLength,o),m=new GE(t,g,f,p,d,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=le(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(u=m.quadrant)||2===u?this._arcRight.set(m.refDatum,m):SE(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var u}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":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 f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,_=0;if("inside"===o&&(_="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=le(t.circleCenter,v,t.middleAngle),t.labelLimit=f,pt(f,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.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=SE(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=SE(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.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 c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(gt(t.pointB.x,this._line2MinLength+h)||pt(t.pointB.x,c-this._line2MinLength-h))&&(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(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;k(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=SE(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-y-c:0+y+c;break;default:m=p.x+f*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+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?d(h)||"auto"===h?"edge"===c?SE(t.quadrant)?"left":"right":SE(t.quadrant)?"right":"left":h:d(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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*(SE(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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,f,m;if(ut(l/2,u))g=0,f=1,m=-p;else if(ut(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,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,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?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.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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;e{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 KE(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=ne.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 qE(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=Tw(t,!!n),o=Tw(r,!!n);const h=ne.distancePP(s,l),c=ne.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=KE(e,t,!1,!!n),o=KE(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=Tw(t,!!n),o=Tw(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}$E.defaultAttributes={pickable:!1};class ZE extends Jy{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&kw(this._innerView),this.removeAllChild(!0),this._innerView=df.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 Aw(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?`${fw.grid}-sub`:`${fw.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let d="";if("line"===s||"polygon"===s)d=Tw(o,!!a);else if("circle"===s){const{center:t}=this.attribute;d=KE(t,o,!1,!!a)}const u=df.path(Object.assign({path:d,z:l},c(r)?z({},this.skipDefault?null:ZE.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 d=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(d*d+u*u),g=l/p;o.push({x:n[0].x+d*g,y:n[0].y+u*g});const f=Tw(o,!!a),m=Vt(o[0].x-o[1].x),v=Vt(o[0].y-o[1].y),_=df.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*Ft/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},c(r)?z({},this.skipDefault?null:ZE.defaultAttributes.style,r(t,i)):r));_.name=`${h}-line`,_.id=this._getNodeId(`${h}-path-${s}`),e.add(_)})),n.length>1&&o){const t=_(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!ut(a.value,0)&&!ut(l.value,0),d=!ut(a.value,1)&&!ut(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}ZE.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},DA(),NA();class JE extends ZE{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ZE.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=iM,endAngle:r=sM}=this.attribute;i=ww(t,s,ne.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=z({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}U(JE,Xw);var QE,tP,eP,iP=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){const e=this._getPointsOfSubGrid(p,d);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(sP,WC),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(QE||(QE={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(tP||(tP={})),function(t){t.dataZoomChange="dataZoomChange"}(eP||(eP={}));const nP="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",rP={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:nP,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:nP,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},aP={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}},oP=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var lP=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;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto"},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,k,A,M,w;const{orient:T,middleHandlerStyle:C={},startHandlerStyle:B={},endHandlerStyle:E={},zoomLock:P}=this.attribute,{start:R,end:O}=this._getState(),{position:I,width:L,height:D}=this._getLayoutAttrFromConfig(),F=null!==(t=B.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=E.triggerMinSize)&&void 0!==e?e:40,j=this._getContainer();if(this._isHorizontal){if(C.visible){const t=(null===(i=C.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:I.x+R*L,y:I.y-t,width:(O-R)*L,height:t},null===(s=C.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=C.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:I.x+(R+O)/2*L,y:I.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=C.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square"},C.icon),{pickable:!P&&(null===(h=C.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:I.x+R*L,y:I.y+D/2,size:D,symbolType:null!==(c=B.symbolType)&&void 0!==c?c:"square"},aP.horizontal),B),{pickable:!P&&(null===(d=B.pickable)||void 0===d||d)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:I.x+O*L,y:I.y+D/2,size:D,symbolType:null!==(u=E.symbolType)&&void 0!==u?u:"square"},aP.horizontal),E),{pickable:!P&&(null===(p=E.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+R*L-t/2,y:I.y+D/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:999},aP.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+O*L-g/2,y:I.y+D/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:999},aP.horizontal),{pickable:!P}),"rect")}else{if(C.visible){const t=(null===(g=C.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===T?I.x-t:I.x+L,y:I.y+R*D,width:t,height:(O-R)*D},null===(f=C.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(_=null===(v=null===(m=C.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===_||_)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===T?I.x-t/2:I.x+L+t/2,y:I.y+(R+O)/2*D,angle:Math.PI/180*90,symbolType:null!==(b=null===(y=C.icon)||void 0===y?void 0:y.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0},C.icon),{pickable:!P&&(null===(S=null===(x=C.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:I.x+L/2,y:I.y+R*D,size:L,symbolType:null!==(k=B.symbolType)&&void 0!==k?k:"square"},aP.vertical),B),{pickable:!P&&(null===(A=B.pickable)||void 0===A||A)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:I.x+L/2,y:I.y+O*D,size:L,symbolType:null!==(M=E.symbolType)&&void 0!==M?M:"square"},aP.vertical),E),{pickable:!P&&(null===(w=E.pickable)||void 0===w||w)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+L/2+t/2,y:I.y+R*D-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},aP.vertical),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+L/2+i/2,y:I.y+O*D-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},aP.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move"},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move"},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_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))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){return t.length<=10||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,void 0!==e?e*e:1)}(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(t);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(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){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 je).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)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=lP(c,["formatMethod"]),{formatMethod:g}=d,f=lP(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:_,width:y,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,k={x1:_.x,y1:_.y,x2:_.x+y,y2:_.y+b};let A,M,w,T;this._isHorizontal?(A={x:_.x+m*y,y:_.y+b/2},M={x:_.x+v*y,y:_.y+b/2},w={textAlign:oP(k,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},T={textAlign:oP(k,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(A={x:_.x+y/2,y:_.y+m*b},M={x:_.x+y/2,y:_.y+v*b},w={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:oP(k,t,"start",this._isHorizontal)?"top":"bottom"},T={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:oP(k,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),z({},p,{text:x,x:A.x,y:A.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),z({},f,{text:S,x:M.x,y:M.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new VM(e),s.name=i,t.add(s)),s}}const cP={debounce:bt,throttle:xt};class dP extends o{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=QE.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=QE.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=QE.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=QE.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=QE.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===S_.env?S_:this.stage,s=hM();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===QE.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===QE.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===QE.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===QE.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(tP.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(tP.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(tP.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===QE.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(tP.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(tP.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:cP[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===S_.env?S_:this.stage,e=hM();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===S_.env?S_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===S_.env?S_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:mt(e+t,0,1),end:mt(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=QE.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}jM(),YA(),JA(),EA(),HA();let uP=class t extends Jy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,_;h.visible?this._isHorizontal?(m=p,v=g-f,_={x:a.x,y:a.y+f}):(m=p-f,v=g,_={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(y+b)/2,_={x:_.x+y/2,y:_.y}):(v-=(y+b)/2,_={x:_.x,y:_.y+y/2})),v+=(null!==(n=u.lineWidth)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:_,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new hP(this._getRendererAttrs()),this._interaction=new dP(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(tP.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(tP.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(eP.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(tP.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;u(t)&&u(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(eP.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.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,...G(a))}setPreviewPointsX(t){c(t)&&(this._renderer.previewPointsX=t)}setPreviewPointsY(t){c(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){c(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){c(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){c(t)&&(this._renderer.statePointToData=t)}};var pP,gP,fP,mP;function vP(){DA(),jM(),ST()}uP.defaultAttributes=rP,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"}(pP||(pP={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(gP||(gP={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(fP||(fP={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(mP||(mP={}));class _P extends Jy{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=Ew(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=Pw(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=Rw(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=p(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=df.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=df.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=df.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 yP(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 bP(t,e,i,s){t&&(yP(t.startSymbol,e,i,s),t.lines.forEach((t=>yP(t,e,i,s))),yP(t.line,e,i,s),yP(t.endSymbol,e,i,s))}function xP(t,e,i,s){t&&(yP(t.getTextShape(),e,i,s),yP(t.getBgRect(),e,i,s))}function SP(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 kP(t,e,i,s){t&&(SP(t.startSymbol,e,i,s),t.lines.forEach((t=>SP(t,e,i,s))),SP(t.line,e,i,s),SP(t.endSymbol,e,i,s))}function AP(t,e,i,s){t&&(SP(t.getTextShape(),e,i,s),SP(t.getBgRect(),e,i,s))}function MP(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;yP(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)})),yP(t.endSymbol,s+r+a,o,n),G(e).forEach((t=>{const e=s+r+a+o;yP(t.getTextShape(),e,l,n),yP(t.getBgRect(),e,l,n)}))}function wP(t,e,i,s,n){bP(t,s,i,n),G(e).forEach((t=>{xP(t,s,i,n)}))}function TP(t,e,i,s,n){yP(t,s,i,n),G(e).forEach((t=>{xP(t,s,i,n)}))}function CP(t,e,i,s,n){yP(t,s,i,n),G(e).forEach((t=>{xP(t,s,i,n)}))}function BP(t,e,i,s,n,r){var a;bP(t,n,s,r),yP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?xP(i,n,s,r):yP(i,n,s,r)}function EP(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;yP(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)})),yP(e,n+o+l,h,r),yP(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(yP(i.getTextShape(),n+o+l+h+c,d,r),yP(i.getBgRect(),n+o+l+c,d,r)):yP(i,n+o+l+c,d,r)}function PP(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?MP(t,e,s,r,a):"fadeIn"===i&&wP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?MP(t,e,s,n,a):"fadeIn"===i&&wP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){kP(t,s,i,n),G(e).forEach((t=>{AP(t,s,i,n)}))}(t,e,i,s,n)}}function RP(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&&TP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&TP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){SP(t,s,i,n),G(e).forEach((t=>{AP(t,s,i,n)}))}(t,e,i,s,n)}}function OP(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&&CP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&CP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){SP(t,s,i,n),G(e).forEach((t=>{AP(t,s,i,n)}))}(t,e,i,s,n)}}function IP(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?BP(n,r,e,i,s,o):"callIn"===t&&EP(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?BP(n,r,e,i,s,a):"callIn"===t&&EP(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;kP(t,n,s,r),SP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?AP(i,n,s,r):SP(i,n,s,r)}(n,r,e,t,i,s)}}const LP={type:"clipIn",duration:500,easing:"linear",delay:0},DP={type:"fadeIn",duration:500,easing:"linear",delay:0},FP={type:"callIn",duration:500,easing:"linear",delay:0},zP={type:"fadeOut",duration:500,easing:"linear",delay:0};class jP{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=G(null==n?void 0:n.label),a=G(null==n?void 0:n.labelBackground),o=G(s).map(((s,n)=>{var o,l;const h=z({},i,s),c=new VM(Object.assign(Object.assign({},h),{state:{panel:z({},aM,null!==(o=a[n])&&void 0!==o?o:Y(a)),text:z({},aM,null!==(l=r[n])&&void 0!==l?l:Y(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===G(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=G(this._label),n=G(null==i?void 0:i.label),r=G(null==i?void 0:i.labelBackground);if(s.length){const i=G(e);s.forEach(((e,s)=>{var a,o;const l=z({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:z({},aM,null!==(a=r[s])&&void 0!==a?a:Y(r)),text:z({},aM,null!==(o=n[s])&&void 0!==o?o:Y(n))}})),this.setLabelPos(e,l)}))}}}class HP extends _P{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=LP,this.defaultExitAnimation=zP}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;zM(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}U(HP,jP);const VP=.001,NP={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:pP.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]}},WP={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"}}},UP={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:{autoRotate:!0,position:fP.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]}},GP={interactive:!0,label:{position:gP.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}},YP={interactive:!0,label:{autoRotate:!0,position:fP.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}},XP={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"}},$P={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"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},KP={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 qP(){ZP._animate=PP}vP(),dw(),ST();class ZP extends HP{markerAnimate(t){ZP._animate&&this._animationConfig&&ZP._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ZP.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i: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,e){var i;return(_M(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return yM(Math.abs(e),Math.PI/2,VP)||yM(Math.abs(e),3*Math.PI/2,VP)?bM(i,e,t):_M(e)?WP.postiveXAxis[t]:WP.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new pw({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},aM,null==a?void 0:a.line),startSymbol:z({},aM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},aM,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({},aM,null==a?void 0:a.line),startSymbol:z({},aM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},aM,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}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",ZP.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(ZP.defaultAttributes.label)}}function JP(){QP._animate=RP}ZP.defaultAttributes=NP,vP(),UA(),ST();class QP extends _P{markerAnimate(t){QP._animate&&this._animationConfig&&QP._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},QP.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=DP,this.defaultExitAnimation=zP}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},$P[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;zM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=df.polygon(Object.assign({points:e},i));n.states=z({},aM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",QP.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=z({},aM,null==i?void 0:i.area)),this._updateMarkLabels(QP.defaultAttributes.label)}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}}QP.defaultAttributes=GP,U(QP,jP),vP(),uw(),ST();class tR extends HP{markerAnimate(t){tR._animate&&this._animationConfig&&tR._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},tR.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case fP.arcInnerStart:l=n;case fP.arcOuterStart:l=n;break;case fP.arcInnerEnd:l=r;case fP.arcOuterEnd:l=r;break;case fP.center:case fP.arcInnerMiddle:case fP.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return XP[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new gw({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},aM,null==o?void 0:o.line),startSymbol:z({},aM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},aM,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({},aM,null==o?void 0:o.line),startSymbol:z({},aM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},aM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",tR.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(tR.defaultAttributes.label)}}tR.defaultAttributes=UP,vP(),CA(),ST();class eR extends _P{markerAnimate(t){eR._animate&&this._animationConfig&&eR._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},eR.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=DP,this.defaultExitAnimation=zP}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case fP.center:h=(s+n)/2,c=(r+a)/2;break;case fP.arcInnerStart:h=s,c=r;break;case fP.arcOuterStart:h=n,c=r;break;case fP.arcInnerEnd:h=s,c=a;break;case fP.arcOuterEnd:h=n,c=a;break;case fP.arcInnerMiddle:h=s,c=(r+a)/2;break;case fP.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},XP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;zM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=df.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=z({},aM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",eR.defaultAttributes.label)}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({},aM,null==o?void 0:o.area)),this._updateMarkLabels(eR.defaultAttributes.label)}isValidPoints(){return!0}}function iR(){sR._animate=IP}eR.defaultAttributes=YP,U(eR,jP),vP(),dw(),uw(),JA(),zA(),HA(),ST();class sR extends _P{markerAnimate(t){sR._animate&&this._animationConfig&&sR._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},sR.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=FP,this.defaultExitAnimation=zP,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return yM(Math.abs(s),Math.PI/2,VP)||yM(Math.abs(s),3*Math.PI/2,VP)?bM(t,s,n):_M(s)?KP.postiveXAxis[n]:KP.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,style:d,position:u=mP.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-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,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:z({},aM,null==p?void 0:p.textBackground),text:z({},aM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=z({},aM,null==p?void 0:p.itemContent));const v=_M(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+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",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=df.symbol(Object.assign(Object.assign({},i),r)),o.states=z({},aM,null==s?void 0:s.itemContent)):"text"===n?o=new VM(Object.assign(Object.assign({},i),{state:{panel:z({},aM,null==s?void 0:s.textBackground),text:z({},aM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=df.richtext(Object.assign(Object.assign({},i),r)),o.states=z({},aM,null==s?void 0:s.itemContent)):"image"===n?(o=df.image(Object.assign(Object.assign({},i),r)),o.states=z({},aM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=z({},aM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}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=yM(c,0,VP)||yM(d,0,VP),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=DM(e-u,t-d),o=DM(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*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(uR.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(uR.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===uR.focus||"focus"===o){const s=a.hasState(cR.focus);a.toggleState(cR.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[cR.unSelected,cR.unSelectedHover,cR.focus],t),this._setLegendItemState(e,cR.selected,t)})):(this._setLegendItemState(a,cR.selected,t),this._removeLegendItemState(a,[cR.unSelected,cR.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[cR.selected,cR.selectedHover,cR.focus],t),this._setLegendItemState(e,cR.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(cR.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(cR.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(dR.legendItemClick,a,t);i?(this._removeLegendItemState(a,[cR.selected,cR.selectedHover],t),this._setLegendItemState(a,cR.unSelected,t)):(this._setLegendItemState(a,cR.selected,t),this._removeLegendItemState(a,[cR.unSelected,cR.unSelectedHover],t))}else this._setLegendItemState(a,cR.selected,t),this._removeLegendItemState(a,[cR.unSelected,cR.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[cR.selected,cR.selectedHover],t),this._setLegendItemState(e,cR.unSelected,t))}))}this._dispatchLegendEvent(dR.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,cR.selected),this._removeLegendItemState(e,[cR.unSelected,cR.unSelectedHover])):(this._removeLegendItemState(e,[cR.selected,cR.selectedHover]),this._setLegendItemState(e,cR.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=oR,spaceRow:l=lR,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:p,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:p?i:e,v=this._contentMaxHeight;let y,{doWrap:b,maxWidthInCol:x,startX:S,startY:k,pages:A}=this._itemContext,M=0,w=0;const T=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),y=d[t],y.id||(y.id=y.label),y.index=t;let e=!0;_(n)&&(e=n.includes(y.label));const i=this._renderEachItem(y,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),p?(u(s)&&(f&&a?(A=Math.ceil((S+g)/s),b=A>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||T.forEach((t=>{t.setAttributes({y:t.attribute.y+(w-t.attribute.height)/("middle"===h?2:1)})})),A+=1,S=0,k+=w+l,w=0,T.length=0))),0===S&&0===k||i.setAttributes({x:S,y:k}),S+=o+g,w=Math.max(w,m),T.push(i)):(u(v)&&(f&&a?(A=Math.ceil((k+m)/v),b=A>1):v<=m?(A+=1,b=!0,k=0,t>0&&(S+=M+o)):v{t.setAttributes({y:t.attribute.y+(w-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=k,this._itemContext.maxWidthInCol=x,this._itemContext.pages=A,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=A),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||E(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=df.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:p}=t,g=[];u(c)&&g.push(c),u(d)&&g.push(d),g.length&&(u(s)&&g.push(s),this._itemWidthByUser=$(g)),u(p)&&(this._itemHeightByUser=p);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";p(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";p(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,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:p,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,s),k=this._handleStyle(y,t,e,i,s),A=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),w=ni(c);let T;!1===x.visible?(T=df.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(T,uR.item,t,T)):(T=df.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(T,uR.item,t,T,M.state)),T.id=`${null!=a?a:o}-${i}`,T.addState(e?cR.selected:cR.unSelected);const C=df.group({x:0,y:0,pickable:!1});T.add(C);let B,E=0,R=0,O=0;if(v&&!1!==v.visible){const i=P(S,"style.size",10);R=_(i)?i[0]||0:i,O=P(v,"space",8);const s=df.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&&d(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&d(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,uR.itemShape,t,T,S.state),s.addState(e?cR.selected:cR.unSelected),C.add(s)}let I=0;if(p){const e=P(g,"size",10);B=df.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:w},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(B,uR.focus,t,T),I=e}const L=y.formatMethod?y.formatMethod(o,t,i):o,D=IM(Object.assign(Object.assign({x:R/2+O,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=k.style)||void 0===r?void 0:r.fontSize},k.style),{text:L,_originText:y.formatMethod?o:void 0}));this._appendDataToShape(D,uR.itemLabel,t,T,k.state),D.addState(e?cR.selected:cR.unSelected),C.add(D);const F=P(y,"space",8);if(u(l)){const s=P(b,"space",p?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=IM(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:A.style.fontSize},A.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,uR.itemValue,t,T,A.state),r.addState(e?cR.selected:cR.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-w[1]-w[3]-R-O-F-I-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-R/2-w[1]-w[3]-I-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));E=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-w[1]-w[3]-R-O-I),E=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):E=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);B&&(B.setAttribute("x",E),C.add(B));const z=C.AABBBounds,j=z.width();if("right"===f){const t=z.x2,e=z.x1;C.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===B?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=z.height(),V=u(this.attribute.item.width)?this.attribute.item.width:j+w[1]+w[3],N=this._itemHeightByUser||H+w[0]+w[2];return T.attribute.width=V,T.attribute.height=N,B&&B.setAttribute("visible",!1),C.translateTo(-z.x1+w[3],-z.y1+w[0]),T}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new aR(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},z({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new aR(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new dM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new dM(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?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 i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",xt(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=oR,spaceRow:o=lR}=n,l=this._itemsContainer,{space:h=hR,defaultCurrent:c=1}=r,d=mR(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,_=0,y=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v0&&(y=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:y,y:b}),y+=a+i})),this._itemContext.startX=y,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),_=p-g.AABBBounds.height()-h-t,_<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;_0&&(b=0,y+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:y,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=df.group({x:0,y:t,width:u?v:f,height:u?m:_,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=oR,spaceRow:a=lR}=s,o=this._itemsContainer,{space:l=hR,defaultCurrent:h=1}=n,c=mR(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const _=df.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=df.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];ut(mt(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),ut(mt(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(cR.selected)?this._setLegendItemState(t,cR.selectedHover,e):this._setLegendItemState(t,cR.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===uR.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(dR.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(cR.unSelectedHover)||t.hasState(cR.selectedHover))&&(i=!0),t.removeState(cR.unSelectedHover),t.removeState(cR.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(cR.unSelectedHover)&&!t.hasState(cR.selectedHover)||(i=!0),t.removeState(cR.unSelectedHover),t.removeState(cR.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===uR.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(dR.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(dR.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!==uR.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(dR.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!==uR.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(dR.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(cR.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=z({},vR,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(cR.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(c(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]&&(c(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var yR;function bR(t){return _(t)?t:[t,t]}function xR(t){return t?"ew-resize":"ns-resize"}_R.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:oR,spaceRow:lR,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:hR,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"}(yR||(yR={})),gR();class SR extends Jy{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({},SR.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=mt(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=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=hM(),n="browser"===S_.env?S_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;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=mt(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=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=hM(),n="browser"===S_.env?S_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{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?mt(t+p,h,c):mt(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?mt(t+p,0,c-h):mt(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=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),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(u(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]=G(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:p}=this.attribute;d(p)&&(p=[o,l]),this._currentValue={startValue:bR(p)[0],endValue:bR(p)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=df.group({x:0,y:0});f.name=yR.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=df.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)),m.name=yR.startText,f.add(m);const e=u(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const _=df.group({x:g?v:0,y:g?0:v});f.add(_);const y=df.group({x:0,y:0});let b;if(y.name=yR.railContainer,this._railContainer=y,_.add(y),this._mainContainer=_,this._renderRail(y),v+=g?s:n,a&&a.visible){const t=u(a.space)?a.space:0;b=df.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=yR.endText,f.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=df.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=yR.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;d(c)&&(c=[i,s]);const u=a&&a.visible,p=this._isHorizontal,[g,f]=bR(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":xR(p)},r));if(v.name=yR.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,u){const i=this._renderHandlerText(g,e?"start":"end");i.name=yR.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":xR(p)},r));if(i.name=yR.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,u){const e=this._renderHandlerText(f,"end");e.name=yR.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,u;if(d(h))e?(c=i,u=s):c=u=i;else if(e){const t=vt(h,i,s);c=t[0],u=t[1]}else c=i,u=mt(h,i,s);const g=this._isHorizontal;e||(c=i);const f=df.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=yR.trackContainer;const m=p(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":xR(g);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(u,e?"end":"start"),b=df.rect(Object.assign({x:g?Math.min(_,y):0,y:g?0:Math.min(_,y),width:g?Math.abs(y-_):r,height:g?n:Math.abs(y-_),cursor:v},a));b.name=yR.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return df.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":xR(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),df.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=df.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=df.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),p(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown),("browser"===S_.env?S_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=hM(),e="browser"===S_.env?S_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_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===yR.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===yR.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===yR.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===yR.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}}release(t){super.release(t),("browser"===S_.env?S_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}SR.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}}},fR(),gR();class kR extends pR{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},kR.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!d(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:f,handlerText:m,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:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function AR(t="bottom"){let 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`}kR.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"}}},fR(),gR(),NA();class MR extends pR{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},MR.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:f,showTooltip:m,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=df.group({x:0,y:0});this._innerView.add(x);const S=new SR({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:AR(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,disableTriggerEvent:y,inverse:b});x.add(S);let k,A=0;"horizontal"===e?"top"===i?(k=`M0,0L${a},0L${b?0:a},12Z`,A=o):(k=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?k=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(k=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const M=df.path(Object.assign(Object.assign({x:0,y:A,path:k},_),{zIndex:0}));x.add(M);const w=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,w-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}MR.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)"}},DA(),tM(),$A();let wR=class t extends Jy{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,p,g,f,m,v,y,b,x;const{textType:S,text:k,subtextType:A,textStyle:M={},subtext:w,subtextStyle:T={},width:C,height:B,minWidth:E,maxWidth:P,minHeight:R,maxHeight:O,align:I,verticalAlign:L,padding:D=0}=this.attribute,F=ni(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),j=null!==(t=M.height)&&void 0!==t?t:B;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:p="break-word",maxWidth:g,lineClamp:f}=M;if("rich"===S||u(M.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:C)&&void 0!==e?e:0,height:null!=j?j:0,ellipsis:null==d||d,wordBreak:null!=p?p:"break-word",maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:null!==(i=M.character)&&void 0!==i?i:k},M);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:k},oM),M),x:h,y:c,width:null!==(s=null!=t?t:C)&&void 0!==s?s:0,height:null!=j?j:0,ellipsis:d,wordBreak:p,maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:[]},M);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else u(k)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:_(k)?k:[k],whiteSpace:"normal"},M),{maxLineWidth:null!==(r=null!==(n=M.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:C,heightLimit:null!==(a=M.height)&&void 0!==a?a:O,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const H=this._mainTitle?this._mainTitle.AABBBounds.height():0,V=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==T.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=T,v=Math.max(Number.MIN_VALUE,O-H);if("rich"===A||u(T.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:C)&&void 0!==o?o:0,height:null!==(l=null!=e?e:B)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=T.character)&&void 0!==h?h:w},T);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===A){const o=Object.assign({html:Object.assign(Object.assign({dom:w},oM),T),x:n,y:r,width:null!==(c=null!=t?t:C)&&void 0!==c?c:0,height:null!==(d=null!=e?e:B)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},T);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else u(w)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:_(w)?w:[w],whiteSpace:"normal"},T),{maxLineWidth:null!==(p=T.maxLineWidth)&&void 0!==p?p:C,heightLimit:null!==(g=T.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:H}),"text"))}const N=this._subTitle?this._subTitle.AABBBounds.height():0,W=this._subTitle?this._subTitle.AABBBounds.width():0;let U=Math.max(V,W),G=H+(null!==(f=T.height)&&void 0!==f?f:N);if(u(C)&&(U=C),u(B)&&(G=B),u(E)&&UP&&(U=P),u(R)&&GO&&(G=O),z.attribute.width=U,z.attribute.height=G,z.attribute.boundsPadding=F,this._mainTitle){if(u(I)||u(M.align)){const t=M.align?M.align:I,e=null!==(m=M.width)&&void 0!==m?m:U;"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")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:L,e=null!=j?j:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"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")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(u(I)||u(T.align)){const t=T.align?T.align:I,e=null!==(y=null!==(v=T.width)&&void 0!==v?v:M.width)&&void 0!==y?y:U;"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")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=T.verticalAlign?T.verticalAlign:L,e=this._mainTitle?u(j)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),j):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=T.height)&&void 0!==b?b:B)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"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")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};wR.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 TR={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"}}};DA(),tM(),$A();let CR=class extends Jy{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=z({},P(TR,n),e.style,{visible:e.visible});a.lineHeight=u(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=IM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{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,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(u(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),u(s)){const t=G(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e: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 p=PM(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(p>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/p,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",u(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 p=null!==(o=d.space)&&void 0!==o?o:0;if(c+=p,G(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,f=c/2,m=g**2+1,v=2*f*g,_=f**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*m*_))/(2*m))+f),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",u(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;G(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 BR extends wg{constructor(t){super(t)}}var ER,PR;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(ER||(ER={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(PR||(PR={}));class RR extends Jy{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},RR.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"},RR.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"},RR.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},RR.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},RR.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=()=>{d(this._playController)&&(this._playController=new BR(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{d(this._backwardController)&&(this._backwardController=new BR(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{d(this._forwardController)&&(this._forwardController=new BR(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(ER.OnPlay)},this.pause=()=>{this._dispatchEvent(ER.OnPause)},this.forward=()=>{this._dispatchEvent(ER.OnForward)},this.backward=()=>{this._dispatchEvent(ER.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()}}RR.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},RR.defaultAttributes={[PR.Start]:{},[PR.Pause]:{},[PR.Backward]:{},[PR.Forward]:{}};const OR={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},IR=[200,10];var LR,DR;!function(t){t.Default="default",t.Reverse="reverse"}(LR||(LR={})),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"}(DR||(DR={}));const FR=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===LR.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===LR.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),zR=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===LR.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===LR.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),jR=t=>"top"===t||"bottom"===t;class HR extends Jy{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},HR.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=Ut(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(jR(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:IR[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:IR[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 SR(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 t.layout=jR(this._orient)?"horizontal":"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 RR(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=jR(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:IR[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=x(i)?i:Ut(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(jR(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=x(n)?n:Ut(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:jR(this._orient)?t+s:(this._size.width-r)/2,y:jR(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:jR(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:jR(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=x(n)?n:Ut(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:jR(this._orient)?t+s:(this._size.width-r)/2,y:jR(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]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function VR(){gR(),DA(),JA()}HR.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({},OR),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},OR),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},OR),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},OR),{key:"backward",position:"start"})}},VR();class NR extends HR{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:LR.Default},this._initDataIndex=()=>{var t;this._dataIndex=d(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(ER.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(ER.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(ER.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(ER.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(DR.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(FR({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||zR({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===LR.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(DR.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=S_.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(DR.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(DR.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=S_.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(),S_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(DR.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,S_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(DR.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(DR.change),this.dispatchCustomEvent(DR.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var WR,UR=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())}))};VR();class GR extends HR{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(ER.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(ER.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(ER.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(ER.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(DR.change))},this.play=()=>UR(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(DR.play),this._rafId=S_.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=S_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,S_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(DR.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,S_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(DR.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(DR.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(DR.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.brushActive="brushActive",t.brushClear="brushClear"}(WR||(WR={}));const YR={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],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:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},XR=5;const $R={debounce:bt,throttle:xt};DA(),UA();let KR=class t extends Jy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=YR.updateTrigger,endTrigger:i=YR.endTrigger,brushMoved:s=!0}=this.attribute;G(e).forEach((t=>this.stage.addEventListener(t,this._onBrushingWithDelay))),G(i).forEach((t=>this.stage.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos]},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:$R[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(WR.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const{trigger:t=YR.trigger,resetTrigger:e=YR.resetTrigger}=this.attribute;G(t).forEach((t=>this.stage.addEventListener(t,this._onBrushStart))),G(e).forEach((t=>this.stage.addEventListener(t,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(WR.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;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,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(WR.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=XR}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(WR.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(WR.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;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._dispatchBrushEvent(WR.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=XR}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(WR.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(WR.brushClear,t)):Math.abs(r-s)this.stage.removeEventListener(t,this._onBrushStart))),G(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents()}_releaseBrushUpdateEvents(){const{updateTrigger:t=YR.updateTrigger,endTrigger:e=YR.endTrigger}=this.attribute;G(t).forEach((t=>this.stage.removeEventListener(t,this._onBrushingWithDelay))),G(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushEnd)))}_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=df.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}_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(Ee(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_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.ythis._brushMaskAABBBoundsDict[t].empty()))}};KR.defaultAttributes=YR;const qR=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return z(t,...e,{shape:i.every(d)?void 0:z({},...i),key:s.every(d)?void 0:z({},...s),value:n.every(d)?void 0:z({},...n)})},ZR=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:G(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}},JR={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:nM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:nM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:nM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new He).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},QR=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];DA(),YA(),JA(),tM(),$A();let tO=class t extends Jy{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=ni(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 p=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",z({symbolType:"circle"},p.shape,{visible:vM(p)&&vM(p.shape)}),"symbol"),"object"!=typeof p.value.text||null===p.value.text||"rich"!==p.value.text.type&&"html"!==p.value.text.type?p.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:vM(p)&&vM(p.value)},ZR(p.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=p.value.text)&&void 0!==e?e:"",visible:vM(p)&&vM(p.value)},p.value),"text"):"rich"===p.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:vM(p)&&vM(p.value)},ZR(p.value)),"richtext"):"html"===p.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:p.value.text.text},oM),p.value),visible:vM(p)&&vM(p.value),width:p.value.width,height:p.value.height,wordBreak:p.value.wordBreak,textAlign:p.value.textAlign,textBaseline:p.value.textBaseline,singleLine:!1,textConfig:[]},p.value),"richtext"));const g=vM(p.shape)?p.shape.size+p.shape.spacing:0,{textAlign:f,textBaseline:m}=p.value,v=n.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",p.height):"middle"===m?this._tooltipTitle.setAttribute("y",p.height/2):this._tooltipTitle.setAttribute("y",0);const _=vM(p)?p.height+p.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(!vM(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 p="right"===c?(o?d:0)+(vM(n.key)?r+n.key.spacing:0)+(vM(n.value)?a:0):0;this._createShape("right"===c?p-n.shape.size/2:p+n.shape.size/2,n,h,l),o&&("right"===c?p-=d:p+=d);const g=this._createKey(n,h,l);g&&(LM(c,g,n.key.textAlign,p,r),g.setAttribute("y",0),"right"===c?p-=r+n.key.spacing:p+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";u(n.value.textAlign)?t=n.value.textAlign:vM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),LM(c,f,t,p,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(vM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=nd(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(vM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},ZR(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},ZR(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},oM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(vM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},ZR(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},ZR(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=>QR.includes(t)))?(this._mergeAttributes(e,s),d(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)&&vM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=vM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=EM(d),_=EM(u);let y=0;if(vM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),y=Math.max(y,e)}if(vM(u)){const{width:t,height:e}=_.quickMeasure(u.text);h.push(t),y=Math.max(y,e)}f&&lu[m]&&(t=!0,r.push(p.size),y=Math.max(p.size,y)),e.height=y,o+=y,a{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 qR({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return qR({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};tO.defaultAttributes=JR;const eO=ut;function iO(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:$(i)}function sO(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function nO(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function rO(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 aO(t,e){const i=rO(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 oO(t,e){const i=lO(t),s=lO(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 lO(t,e={x:0,y:0}){return ne.distancePP(t,e)}function hO(t){return k(t.x)&&k(t.y)}function cO(t,e,i){let s=!1;if(e&&c(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 dO(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const uO=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function gO(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&gO(t[i],e)}}var fO,mO,vO;function _O(t){var e,i;const{type:s}=t;return s===mO.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!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.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_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"}(fO||(fO={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",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",t.mosaic="mosaic",t.pictogram="pictogram"}(mO||(mO={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",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.transform="transform",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.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.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(vO||(vO={}));const yO={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},bO={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function xO(t,e){var i;if(!t)return[];const s=CO(t,e);if(!s||_(s))return null!==(i=s)&&void 0!==i?i:[];if(p(s)){const{dataScheme:i}=s;return i?wO(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>MO(i)?kO(t,i,e):i)).filter(u)}))):i.map((i=>MO(i)?kO(t,i,e):i)).filter(u):[]}return[]}function SO(t,e){var i,s;return wO(t)?null!==(s=null===(i=t.find((t=>u(t.isAvailable)?c(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!u(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 kO(t,e,i){var s;const n=CO(t,i);if(!n)return;let r;const{palette:a}=n;if(p(a)&&(r=null!==(s=function(t,e){const i=yO[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=bO[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(d(e.a)&&d(e.l)||!v(r))return r;let o=new ti(r);if(u(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Ge(t,i,s),a=Ue(n,r,e.l),l=new ti(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return u(e.a)&&o.setOpacity(e.a),o.toRGBA()}const AO=(t,e)=>{if(e&&MO(t)){const i=kO(e,t);if(i)return i}return t};function MO(t){return t&&"palette"===t.type&&!!t.key}function wO(t){return!(!_(t)||0===t.length)&&t.every((t=>u(t.scheme)))}function TO(t){return _(t)?{dataScheme:t}:t}function CO(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||d(n))r=null==t?void 0:t.default;else{const a=_O(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 BO extends xB{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(!wO(this._range))return void super.range(this._range);const t=SO(this._range,this._domain);super.range(t)}}const EO={linear:GB,band:AB,point:class extends AB{constructor(t){super(!1),this.type=QC.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:xB,threshold:ZB,colorOrdinal:BO};function PO(t){const e=EO[t];return e?new e:null}function RO(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function OO(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function IO(t){return u(null==t?void 0:t.field)&&u(null==t?void 0:t.scale)}function LO(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function DO(t){return!!v(t)&&(!!t.endsWith("%")&&Ky(t.substring(0,t.length-1)))}function FO(t){return!!p(t)&&("percent"in t||"offset"in t)}function zO(t,e,i,s=0){var n,r;return x(t)?t:DO(t)?Number(t.substring(0,t.length-1))*e/100:c(t)?t(i):p(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function jO(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>x(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]=zO(t[s],e.size,i)}))})),o}function HO(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}}function VO(t){let e={};return _(t)?(d(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),d(t[1])||(e.left=e.right=t[1]),d(t[2])||(e.bottom=t[2]),d(t[3])||(e.left=t[3]),e):x(t)||DO(t)||c(t)||FO(t)?(e.top=e.left=e.bottom=e.right=t,e):p(t)?(e=Object.assign({},t),e):e}function NO(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const WO=(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},UO=[{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"]}];function GO(t,e){return t&&e.key in t?t[e.key]:e.default}function YO(t){return t&&"token"===t.type&&!!t.key}const XO={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%"},$O={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:UO,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)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:XO,component:{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}}},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:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},KO={name:"dark",colorScheme:{default:{dataScheme:UO,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",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},qO=(t,e)=>t===e||!c(t)&&!c(e)&&(_(t)&&_(e)?e.every((e=>t.some((t=>qO(t,e))))):!(!p(t)||!p(e))&&Object.keys(e).every((i=>qO(t[i],e[i])))),ZO=(t,e,i)=>{if(d(e))return t;const s=e[0];return d(s)?t:1===e.length?(t[s]=i,t):(d(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),ZO(t[s],e.slice(1),i))},JO=t=>t instanceof Ba||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)))}}(t);function QO(t,e=["data"]){return I(t,JO,e)}function tI(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=TO(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}eI._charts={},eI._series={},eI._components={},eI._graphicComponents={},eI._marks={},eI._regions={},eI._animations={},eI._implements={},eI._chartPlugin={},eI._vChartPlugin={},eI._componentPlugin={},eI.transforms={fields:Gr,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}},eI.dataParser={csv:(t,e={},i)=>(i.type=Ur.DSV,ia(t)),dsv:(t,e={},i)=>{i.type=Ur.DSV;const s=jr(na,e),{delimiter:n}=s;if(!v(n))throw new TypeError("Invalid delimiter: must be a string!");return ea(n).parse(t)},tsv:(t,e={},i)=>(i.type=Ur.DSV,sa(t))},eI._layout={},eI._grammarTransforms={},eI._stageEventPlugins={},eI.registerStageEventPlugin=(t,e)=>{eI._stageEventPlugins[t]=e},eI.getStageEventPlugin=t=>eI._stageEventPlugins[t],eI._interactionTriggers={},eI.registerInteractionTrigger=(t,e)=>{eI._interactionTriggers[t]=e},eI._composedEventMap={},eI.registerComposedEvent=(t,e)=>{eI._composedEventMap[t]=e},eI._tooltipProcessors={},eI.registerTooltipProcessor=(t,e)=>{eI._tooltipProcessors[t]=e},eI.createTooltipProcessor=(t,e)=>{const i=eI._tooltipProcessors[t];return i?new i(e):null};const nI=t=>{const e={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"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},rI=nI(),aI={[$O.name]:$O},oI=$O.name,lI=new Map(Object.keys(aI).map((t=>[t,aI[t]]))),hI=new Map,cI=new Map(Object.keys(aI).map((t=>[t,t===oI]))),dI=(t,e)=>{if(!t)return;const i=fI(e);lI.set(t,i),cI.set(t,!0)},uI=(t=oI)=>(cI.has(t)&&!cI.get(t)&&dI(t,lI.get(t)),lI.get(t)),pI=t=>lI.delete(t)&&hI.delete(t)&&cI.delete(t),gI=t=>!!v(t)&&lI.has(t),fI=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:oI;return iI({},uI(i),t)};class mI{static registerInstance(t){mI.instances.set(t.id,t)}static unregisterInstance(t){mI.instances.delete(t.id)}static getInstance(t){return mI.instances.get(t)}static instanceExist(t){return mI.instances.has(t)}static forEach(t,e=[],i){const s=G(e);return mI.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}mI.instances=new Map;class vI{static registerTheme(t,e){dI(t,e)}static getTheme(t,e=!1){return uI(t)}static removeTheme(t){return pI(t)}static themeExist(t){return gI(t)}static getDefaultTheme(){return vI.themes.get(oI)}static setCurrentTheme(t){vI.themeExist(t)&&(vI._currentThemeName=t,mI.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return vI.getTheme(vI._currentThemeName,t)}static getCurrentThemeName(){return vI._currentThemeName}}function _I(t){return v(t)?vI.themeExist(t)?vI.getTheme(t):{}:p(t)?t:{}}vI.themes=lI,vI._currentThemeName=oI;const yI=["animationThreshold","colorScheme","name","padding"];function bI(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];yI.includes(n)?s[n]=r:f(r)?MO(r)?s[n]=AO(r,e):YO(r)?s[n]=GO(i,r):s[n]=bI(r,e,i):s[n]=r})),s}function xI(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]=xI(t[s],e)}return i}return _(t)?t.map((t=>xI(t,e))):t}function SI(t,e){if(!t)return t;if(f(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(v(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=SI(t[s],e)}return i}return _(t)?t.map((t=>SI(t,e))):t}function kI(t,...e){return c(t)?t(...e):t}const AI=(t,e,i,s)=>((t,e,i)=>EM(t,e,i,{fontFamily:XO.fontFamily,fontSize:XO.fontSize}))(e,i,s).measure(t),MI="__VCHART",wI=500,TI=500,CI=`${MI}_MEASURE_CANVAS_ID`,BI=`${MI}_DEFAULT_DATA_INDEX`,EI=`${MI}_DEFAULT_DATA_KEY`,PI=`${MI}_DEFAULT_DATA_SERIES_FIELD`,RI=`${MI}_DEFAULT_SERIES_STYLE_NAME`,OI=`${MI}_STACK_KEY`,II=`${MI}_STACK_START`,LI=`${MI}_STACK_END`,DI=`${MI}_STACK_START_PERCENT`,FI=`${MI}_STACK_END_PERCENT`,zI=`${MI}_STACK_START_OffsetSilhouette`,jI=`${MI}_STACK_END_OffsetSilhouette`,HI=`${MI}_STACK_TOTAL`,VI=`${MI}_STACK_TOTAL_PERCENT`,NI=`${MI}_STACK_TOTAL_TOP`,WI=`${MI}_STACK_TOTAL_BOTTOM`,UI=`${MI}_MOSAIC_VALUE_START_PERCENT`,GI=`${MI}_MOSAIC_VALUE_END_PERCENT`,YI=`${MI}_MOSAIC_CAT_START_PERCENT`,XI=`${MI}_MOSAIC_CAT_END_PERCENT`,$I=`${MI}_SEGMENT_START`,KI=`${MI}_SEGMENT_END`,qI=`${MI}_KEY`,ZI=`${MI}_MAP_LOOK_UP_KEY`;function JI(t,e){for(let i=0;it.key===e))}function tL(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 eL(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:{groupField:a.groupField,nodes:{}},aL(t,a,n[o],l,e,r))})),s?iL(n):n}function iL(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))):iL(t[e].nodes);return t}function sL(t,e){if("values"in t&&t.values.length){const i=nO(t.values,e),s=sO(t.values,FI);t.values.forEach((t=>{t[HI]=i,t[VI]=s}))}else for(const i in t.nodes)sL(t.nodes[i],e)}function nL(t){if(!t.values.length)return;const e=t.values[t.values.length-1][LI]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)rL(t.nodes[r],e,i,s,n)}function aL(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[LI]=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 l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},u(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),aL(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const oL=(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]=hL(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function cL(t={}){const e=Object.assign({},t);if(c(t.style)?e.style=(e,i,s,n)=>pL(t.style(e,i,s,n)):E(t.style)||(e.style=pL(t.style)),!E(t.state)){const i={};Object.keys(t.state).forEach((e=>{c(t.state[e])?i[e]=(i,s,n,r)=>pL(t.state[e](i,s,n,r)):E(t.state[e])||(i[e]=pL(t.state[e]))})),e.state=i}return e}function dL(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{c(t[i])?e[i]=(e,s,n,r)=>pL(t[i](e,s,n,r)):E(t[i])||(e[i]=pL(t[i]))})),e}function uL(t,e){if(E(t))return null;const i={};return Object.keys(t).forEach((s=>{c(t[s])?i[s]=t[s](e):i[s]=t[s]})),pL(i)}function pL(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:re(t.angle)}):t}const gL=t=>"line"===t||"area"===t,fL=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return gL(i)?e:null==e?void 0:e[0]},mL=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let vL=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},n=eI.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{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(eI.getComposedEvent(t))if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};var _L;!function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(_L||(_L={}));const yL=["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 bL,xL,SL;!function(t){t.initialized="initialized",t.rendered="rendered",t.renderFinished="renderFinished",t.animationFinished="animationFinished",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleRawDomainUpdate="scaleRawDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",t.layoutRectUpdate="layoutRectUpdate",t.playerPlay="playerPlay",t.playerPause="playerPause",t.playerEnd="playerEnd",t.playerChange="playerChange",t.playerForward="playerForward",t.playerBackward="playerBackward",t.scrollBarChange="scrollBarChange",t.brushStart="brushStart",t.brushChange="brushChange",t.brushEnd="brushEnd",t.brushClear="brushClear",t.brushActive="brushActive",t.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.tooltipShow="tooltipShow",t.tooltipHide="tooltipHide",t.tooltipRelease="tooltipRelease",t.afterResize="afterResize",t.afterRender="afterRender",t.afterLayout="afterLayout",t.afterMarkLayoutEnd="afterMarkLayoutEnd",t.afterWordcloudShapeDraw="afterWordcloudShapeDraw"}(bL||(bL={})),function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(xL||(xL={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(SL||(SL={}));const kL=[SL.mark,SL.model,SL.chart,SL.vchart];class AL{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(SL.vchart,[]),this._levelNodes.set(SL.chart,[]),this._levelNodes.set(SL.model,[]),this._levelNodes.set(SL.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const ML={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"};class wL{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=u(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=u(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=P(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>fL(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||xL.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||xL.chart);o.get(t)||o.set(t,new AL);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||xL.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||xL.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||xL.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||xL.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?kL.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[xL.chart,xL.window,xL.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(c(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&P(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 ML[a]&&(a=ML[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))&&(!u(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:u(t.id)?SL.model:SL.vchart:SL.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=xt(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=bt(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=xL.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==SL.model&&s!==SL.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),u(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=SL.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case xL.chart:return this._viewBubbles;case xL.window:return this._windowBubbles;case xL.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case xL.chart:return this._viewListeners;case xL.window:return this._windowListeners;case xL.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return yL.includes(t)||Object.values(_L).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&eI.hasInteractionTrigger(e)}}function TL(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function CL(t,e,i){t.getParser(e)||t.registerParser(e,i)}const BL=new Map;let EL;function PL(){EL||(EL=new Ca,CL(EL,"geojson",Sa),CL(EL,"topojson",Aa),TL(EL,"simplify",Wr))}function RL(t,e,i={type:"geojson",centroid:!0}){BL.has(t)&&jy(`map type of '${t}' already exists, will be overwritten.`),PL();const s=new Ba(EL),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"}):p(r)&&s.transform({type:"simplify",options:r}),BL.set(t,s)}function OL(t){BL.has(t)?BL.delete(t):jy(`map type of '${t}' does not exists.`)}function IL(t,e=!1){let i=e;return t.latestData instanceof Ba&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const LL=(t,e)=>0===t.length?[]:1===t.length?IL(t[0],null==e?void 0:e.deep):t.map((t=>IL(t,null==e?void 0:e.deep)));function DL(t,e,i){TL(e=e instanceof Ca?e:t.dataSet,"copyDataView",LL);const s=new Ba(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:jL.copyDataView}),s}function FL(t,e,i=[]){var s;if(t instanceof Ba)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new Ba(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return jy(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return jy(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!v(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),jy("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function zL(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var jL,HL,VL,NL;!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"}(jL||(jL={})),function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(HL||(HL={})),function(t){t.data="data",t.mark="mark"}(VL||(VL={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(NL||(NL={}));const WL=["line","area","trail"];function UL(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(qI,i?t.slice().sort(i):t.slice()),{keys:[qI],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const GL=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function YL(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{YL(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function $L(t,e,i,s){const n=UL(t,(t=>i(t))),r=UL(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!d(t)){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}}const KL=`${MI}_BuiltIn_CallBack_Disappear`;var qL;!function(t){t.render="render",t.disappear="disappear"}(qL||(qL={}));class ZL{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(t,e){this._count=0,this._rootMarks=[],this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(bL.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(bL.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var t,e,i,s;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(t=this._compileChart.getEvent())||void 0===t||t.emit(bL.renderFinished,{chart:this._compileChart,vchart:null===(e=this._compileChart.getOption())||void 0===e?void 0:e.globalInstance})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterVRenderDraw)||void 0===s||s.call(i,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=t,this._option=e}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var t,e,i,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:g,background:f}=this._option;S_.setEnv(function(t){switch(t){case s["desktop-browser"]:case s["mobile-browser"]:return"browser";case s.node:case s.worker:return"node";case s.miniApp:case s["desktop-miniApp"]:return"feishu";case s.lynx:return"lynx";case s.wx:return"wx";case s.tt:return"tt";case s.harmony:return"harmony"}return"browser"}(o),null!=l?l:{}),this._stage=null!==(t=this._option.stage)&&void 0!==t?t:new D_(Object.assign({background:f,width:this._width,height:this._height,container:null!==(e=this._container.dom)&&void 0!==e?e:null,canvas:null!==(i=this._container.canvas)&&void 0!==i?i:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:g},ReactDOM:this._option.ReactDOM,autoRefresh:u(r)?r:!u(a)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{})),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const m=Pp({x:0,y:0,width:this._width,height:this._height});m.name="root",this._stage.defaultLayer.appendChild(m),this._rootGroup=m;const v=(u(h)?h:Gy(o))&&!1!==c&&eI.getStageEventPlugin("gesture");v&&(this._gestureController=new v(this._stage,p(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=NL.before}_setCanvasStyle(){if(this._stage&&this._container.dom&&!v(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(S_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=S_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>YL(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>YL(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{YL(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;this._hasCommitedMark()&&(zy(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),this._rootMarks.forEach((t=>{t.render()})),this._layoutState===NL.before&&(this._layoutState=NL.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=NL.reevaluate,this._hasCommitedMark()&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),this.findProgressiveMarks(),this.updateStateAnimation(),this._doRender(!0),this.doPreProgressive(),zy(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=XL(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=$L(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=$L(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=UL(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=UL(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}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];_(s)?e[i]="disappear"===i?s.map((t=>{return"function"==typeof(e=t.callBack)&&/^class\s/.test(e.toString())?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:KL,customParameters:{callBack:t.callBack}});var e})):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{YL(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===HL.appear))?HL.appear:e.every((t=>t===HL.disappear))?HL.disappear:HL.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===xL.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=u(a.context)?a:((t,e)=>{let i=e;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=i.parent,i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=u(l.markId)?l.markId:null,c=u(l.modelId)?l.modelId:null,d=u(l.modelUserId)?l.modelUserId:null,p=u(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:fL(o),markId:h,modelId:c,markUserId:p,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===xL.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===xL.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===xL.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===xL.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===xL.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this.releaseGrammar(!0),this._stage!==(null===(t=this._option)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{YL(t,(t=>{t.removeProduct()}),null,!0)})):this._cachedMarks=XL(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return Uy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&function(t){return bu(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{xo.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()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{YL(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=S_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){S_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function JL(t,i){var s;return e(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==i?void 0:i.onError)&&void 0!==s?s:Hy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function QL(t){t.crosshair=G(t.crosshair||{}).map((e=>tI({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function tD(t,e,i){var s;const{width:n,height:r}=t;if(u(n)&&u(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}=ri(l,i.width,i.height);a=t,o=e}else if(h&&Uy(e.mode)){let t;t=v(h)?S_.getElementById(h):h;const{width:e,height:s}=ri(t,i.width,i.height);a=e,o=s}else if(Yy(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 eD(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function iD(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}}const sD=9,nD=0,rD=-1;var aD,oD,lD,hD,cD,dD;!function(t){t[t.SeriesGroup=0]="SeriesGroup",t[t.Axis_Grid=50]="Axis_Grid",t[t.CrossHair_Grid=100]="CrossHair_Grid",t[t.Region=450]="Region",t[t.Mark=300]="Mark",t[t.Node=400]="Node",t[t.Axis=100]="Axis",t[t.MarkLine=500]="MarkLine",t[t.MarkArea=100]="MarkArea",t[t.MarkPoint=500]="MarkPoint",t[t.DataZoom=500]="DataZoom",t[t.ScrollBar=500]="ScrollBar",t[t.Player=500]="Player",t[t.Legend=500]="Legend",t[t.CrossHair=500]="CrossHair",t[t.Indicator=500]="Indicator",t[t.Title=500]="Title",t[t.Label=500]="Label",t[t.Brush=500]="Brush",t[t.CustomMark=500]="CustomMark",t[t.Interaction=700]="Interaction"}(aD||(aD={})),function(t){t[t.Indicator=10]="Indicator",t[t.Region=20]="Region",t[t.Axis=30]="Axis",t[t.DataZoom=40]="DataZoom",t[t.Player=40]="Player",t[t.ScrollBar=40]="ScrollBar",t[t.Legend=50]="Legend",t[t.Title=70]="Title",t[t.CustomMark=70]="CustomMark"}(oD||(oD={})),function(t){t[t.Default=0]="Default",t[t.Theme=1]="Theme",t[t.Chart=2]="Chart",t[t.Base_Series=3]="Base_Series",t[t.Series=4]="Series",t[t.Mark=5]="Mark",t[t.User_Chart=6]="User_Chart",t[t.User_Series=7]="User_Series",t[t.User_Mark=8]="User_Mark",t[t.User_SeriesStyle=9]="User_SeriesStyle",t[t.Built_In=99]="Built_In"}(lD||(lD={}));class uD{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){d(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,z({},uD.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=G(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]))))}}uD.defaultMarkInfo={};class pD{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class gD{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=>tI({},i,s,t);return _(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 fD extends pD{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}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=gD,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new uD,this._lastLayoutRect=null,this.id=$y(),this.userId=t.id,this._spec=t,this.effect={},this.event=new vL(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){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}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){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_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){u(t)&&u(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!u(t)||!u(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${MI}_${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(e,i={},s){const{type:n,name:r}=e,{parent:a}=i,o=t(i,["parent"]),l=eI.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_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(!d(e))return P(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}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class mD{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}get lastComputeRect(){return this._lastComputeRect}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}get willLayoutTag(){return this._willLayoutTag}constructor(t,e){var i;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=oD.Region,this._willLayoutTag=!0,this._model=t,this._option=e,this.layoutLevel=e.layoutLevel,this.layoutType=e.layoutType,e.layoutOrient&&(this.layoutOrient=e.layoutOrient),this._spec=null===(i=null==t?void 0:t.getSpec)||void 0===i?void 0:i.call(t)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=jO(VO(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=d(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:zO(t.minHeight,e.height,e),this._maxHeight=d(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:zO(t.maxHeight,e.height,e),this._minWidth=d(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:zO(t.minWidth,e.width,e),this._maxWidth=d(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:zO(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:zO(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:zO(t.height,e.height,e)},{height:9}),d(t.offsetX)||(this.layoutOffsetX=zO(t.offsetX,e.width,e)),d(t.offsetY)||(this.layoutOffsetY=zO(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){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{d(this._spec[i])||(e[i]=zO(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};d(s)||(r.width-=s),d(n)||(r.width-=n),d(e)||(r.height-=e),d(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):(d(s)?d(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,d(e)?d(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?(d(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),d(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(d(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),d(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(HO(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class vD extends fD{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,this._transformLayoutPadding=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 mD(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&N(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.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 _D extends gD{_initTheme(t,e){return{spec:t,theme:this._theme}}}class yD extends vD{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(t,e){var i;super(t,e),this.transformerConstructor=_D,this.modelType="region",this.specKey="region",this.type=yD.type,this._series=[],this.layoutType="region",this.layoutZIndex=aD.Region,this.seriesDataFilterOver=()=>{this.event.emit(bL.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=t.id,this.coordinate=null!==(i=t.coordinate)&&void 0!==i?i:"cartesian"}_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 t,e;this.initLayout(),super.created();const i=null!==(t=this._spec.clip)&&void 0!==t?t:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(e=this.userId)&&void 0!==e?e:this.type)+"_interaction",aD.Interaction),E(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",lD.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:aD.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:aD.Mark+1}))}_createGroupMark(t,e,i){var s,n;const r=this._createMark({type:"group",name:t});r.setUserId(e),r.setMarkConfig({zIndex:i});const a=null!==(s=this._spec.clip)&&void 0!==s?s:this._getClipDefaultValue();return this.setMarkStyle(r,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:a},"normal",lD.Built_In),this.setMarkStyle(r,{cornerRadius:null===(n=this._spec.style)||void 0===n?void 0:n.cornerRadius},"normal",lD.User_Mark),this._marks.addMark(r),r}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var t,e;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(t=this._spec.style)||void 0===t?void 0:t.fill)?1:0},this._spec.style),"normal",lD.User_Mark),(null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",lD.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",lD.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return N(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||G(t.userId).includes(e.userId))&&(!u(t.specIndex)||G(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})}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=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function bD(t){const e=[],i=[],s=[];return t.forEach((t=>{d(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 xD(t,e,i){e?t.forEach((t=>{const e=Y(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=Y(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 SD(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 kD(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=TD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),SD(d,!0,p,l),s&&xD(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function AD(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=TD(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=TD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),SD(d,!1,p,o),s&&xD(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function wD(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=TD(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_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){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_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,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=TD(t,this,e);"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,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=bD(t);n.length&&kD(n,e,i,!1,"left",s),r.length&&kD(r,e,i,!0,"left",s),a.length&&AD(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=bD(t);n.length&&MD(n,e,i,!1,"top",s),r.length&&MD(r,e,i,!0,"top",s),a.length&&wD(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=bD(t);n.length&&kD(n,e,i,!1,"right",s),r.length&&kD(r,e,i,!0,"right",s),a.length&&AD(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=bD(t);n.length&&MD(n,e,i,!1,"bottom",s),r.length&&MD(r,e,i,!0,"bottom",s),a.length&&wD(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=TD(t,this,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=>{N(i.getLayoutRect(),e.rect)||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{rect:i}=TD(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);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+c-l})}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+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&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:Hy)("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}}}CD.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(hD||(hD={})),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",t.STATE_HIGHLIGHT="highlight",t.STATE_BLUR="blur",t.STATE_ACTIVE="active"}(cD||(cD={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(dD||(dD={}));const BD=["linear","radial","conical"],ED={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const PD={};Object.values(cD).forEach((t=>{PD[t]=!0})),cD.STATE_HOVER,cD.STATE_HOVER_REVERSE,cD.STATE_SELECTED,cD.STATE_SELECTED_REVERSE,cD.STATE_DIMENSION_HOVER,cD.STATE_DIMENSION_HOVER_REVERSE;class RD extends pD{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(z(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class OD extends RD{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];u(s.domain)&&(n.domain=s.domain),u(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:{}})}))}_isMultiMark(){return!this._mark||(t=this._mark.type,WL.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(u(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!PD[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(_(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(MI)));i=t.datums.some((t=>e&&_(null==t?void 0:t.items)?n.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])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(p(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(MI))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(eB(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class ID extends pD{constructor(){super(...arguments),this.id=$y(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=eI.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class LD extends ID{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}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._data=null,this._data=e}removeProduct(){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const DD=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,FD=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=DD(l.delay,n,a,o),d=DD(l.duration,n,a,o),u=DD(l.oneByOne,n,a,o),p=DD(l.splitPath,n,a,o),g=k(u)&&u>0?t=>x(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)?NT:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:WT)(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);zT(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{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)?NT:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:WT)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>IT(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>DT(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:$o.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 FT({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:BT,null!==(l=i.easing)&&void 0!==l?l:ET))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:$o.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new jT({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:BT,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:ET))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):zT(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},zD=(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))))},jD=t=>{const e=t.getMarkConfig();if(u(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}};class HD extends ID{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){u(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){d(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&u(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];_(n)?s[e]=n.map(i):u(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=G(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=G(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new LD(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(u(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}d(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else u(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=Pp("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){d(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(){this._product&&this._product.parent&&this._product.parent.removeChild(this._product),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(t,e){var i;super(e),this.type=void 0,this.name="mark",this._markConfig={zIndex:aD.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Nl)),i&&(c(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==hD.enter&&t.context.diffState!==hD.update||(t.stateProxy=(e,i)=>{var s;return this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)},t.context.states&&t.useStates(t.context.states,e))},this.name=t,this.model=e.model,this.key=e.key,this.state=new OD(e,this),this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(u(t.id)&&(this._userId=t.id),h(t.interactive)&&(this._markConfig.interactive=t.interactive),u(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),h(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_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,re)}isUserLevel(t){return[lD.User_Mark,lD.User_Series,lD.User_Chart,lD.User_SeriesStyle].includes(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];d(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}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){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[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"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;u(r)&&r<=s&&tI(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(iB(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return v(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=PO(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),e.clamp&&t.clamp&&t.clamp(e.clamp))}(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=c(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):BD.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):iB(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t){t.style&&this.setStyle(t.style,"normal",lD.User_Mark);const e=t.state;e&&Object.keys(e).forEach((t=>{const i=e[t];if("style"in i){const e=i.style;let s={stateValue:t};"level"in i&&(s.level=i.level),"filter"in i&&(s=c(i.filter)?Object.assign({filter:i.filter},s):Object.assign(Object.assign({},i.filter),s)),this.state.addStateInfo(s),this.setStyle(e,t,lD.User_Mark)}else this.setStyle(i,t,lD.User_Mark)}))}_computeGradientAttr(e){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=e,d=t(e,["gradient","scale","field"]);let p=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(p=t),g||(g=e)}const f=SO(xO(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},ED[o]),d);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==p?void 0:p.scale(t[g]);return c(n)&&(a=n(t,this._attributeContext,i)),u(s)&&(a=ti.SetOpacity(a,s)),{offset:c(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):c(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(e){const{scale:i,field:s}=e,n=t(e,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];c(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)BD.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=SO(xO(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return UL(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._graphics=t.getGraphics(),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear)}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return eI.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=c(this.key)?this.key:u(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[EI],this._groupKeyGetter=u(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=UL(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===HL.appear))?HL.appear:t.every((t=>t===HL.disappear))?HL.disappear:t[0];return null!=e?e:HL.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{jD(t),s.push(...t.getGraphics())})),e.forEach((t=>{jD(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);FD([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=zD(e,n),r=zD(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===HL.exit?HL.exit:i===HL.update?HL.update:HL.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===hD.exit&&(t.context.reusing=!0,t.animates&&t.animates.forEach((t=>t.stop())))}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===hD.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,u,p,g;let f,m;return d(e)?(f=this._graphicMap.get(t),f&&(m=hD.exit)):d(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=hD.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=hD.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(u=f.context)||void 0===u?void 0:u.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=HL.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=HL.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return GL(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=GL(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(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||(!!c(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach(((t,e)=>{var i,n;let r=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i.update,t);null===(n=t.currentStates)||void 0===n||n.forEach((e=>{var i;const s=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i[e],t);r=Object.assign(Object.assign({},r),s)})),d(this._markConfig.interactive)||(r.pickable=this._markConfig.interactive);const a=this._transformGraphicAttributes(t,r,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=a}))}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r,a;const o=i.context.finalAttrs,l=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=mL(i,o);i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes({}),i.context.reusing=!1):l||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),!(null===(a=this.renderContext)||void 0===a?void 0:a.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i),e&&i.setFinalAttributes(o)}else{const a=i;i=this._createGraphic(o),e&&(null===(n=i.setFinalAttributes)||void 0===n||n.call(i,o)),i.context=a.context,i.context.diffAttrs=o,i.stateSort=this._stateSort;const l=this._graphics===t?s:s+this._graphics.length-t.length;if(l>=0&&(this._graphics[l]=i),null===(r=this.renderContext)||void 0===r?void 0:r.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,l),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const t={};Object.keys(this.stateStyle).forEach((e=>{if(e===cD.STATE_NORMAL){const{groupStyles:i,updateStyles:s}=this._separateNormalStyle(this.stateStyle[e]);t.group=this._getEncoderOfStyle(e,i),t.update=this._getEncoderOfStyle(e,s)}else t[e]=this._getEncoderOfStyle(e,this.stateStyle[e])})),this._encoderOfState=t}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(d(e)||(t.zIndex=e),d(i)||(t.clip=i),!d(s)){const e=_(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return d(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=eI.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=eI.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=G(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===NL.before||(zy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{"in"===this.state.checkOneState(i,i.context.data,e)?i.addState(t,!0,this.hasAnimationByState("state")):i.removeState(t,this.hasAnimationByState("state"))}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===hD.exit&&!e.isExiting)if(e.context.animationState===hD.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:hD.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=Pp({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||p(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}}var VD;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(VD||(VD={}));class ND extends HD{constructor(){super(...arguments),this.type=ND.type,this._marks=[],this._diffState=hD.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(jy("Mark already exists, add mark failed."),!1):(this._marks.push(t),!0)}removeMark(t){const e=this._marks.findIndex((e=>e.id===t.id||e.name===t.name));return-1===e?(jy("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInUserId(t){let e;return YL(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.diffState===hD.update){const t=this.hasAnimation(),e=mL(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e)),t&&this._product.setFinalAttributes(i)}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=hD.update}render(){this._isCommited&&(zy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct()}}ND.type="group";const WD={measureText:AI};class UD{static instance(){return UD.instance_||(UD.instance_=new UD),UD.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 GD{constructor(){this.id=$y(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?jy("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class YD extends GD{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)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const XD={type:"fadeIn"};function $D(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 XD;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}class KD extends MT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.currentAnimationRatio=0,this.animationTime=0}onUpdate(t,e,i){super.onUpdate(t,e,i),this.currentAnimationRatio=e,this.animationTime=e*Math.PI*2}getAnimationTime(){return this.currentAnimationRatio>0?this.animationTime:Date.now()/1e3}afterStageRender(t,e){var i,s;return null===(s=null===(i=this.params)||void 0===i?void 0:i.callBack)||void 0===s?void 0:s.call(i,t,e,this.currentAnimationRatio,this.animationTime)}}const qD={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"},state:{duration:300,easing:"linear"}},ZD={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},JD={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},QD=()=>{eI.registerAnimation("scaleInOut",(()=>ZD))},tF=()=>{eI.registerAnimation("fadeInOut",(()=>JD))},eF=(t,e)=>({appear:$D(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:XT,duration:qD.update.duration,easing:qD.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),iF=()=>{eI.registerAnimation("line",eF)},sF=()=>{uT.registerBuiltInAnimate("growPointsIn",dC),uT.registerBuiltInAnimate("growPointsOut",uC),uT.registerBuiltInAnimate("growPointsXIn",gC),uT.registerBuiltInAnimate("growPointsXOut",fC),uT.registerBuiltInAnimate("growPointsYIn",vC),uT.registerBuiltInAnimate("growPointsYOut",_C),uT.registerBuiltInAnimate("clipIn",qT),uT.registerBuiltInAnimate("clipOut",ZT)},nF=()=>{ST(),uT.registerBuiltInAnimate("scaleIn",wC),uT.registerBuiltInAnimate("scaleOut",TC),uT.registerBuiltInAnimate("fadeIn",JT),uT.registerBuiltInAnimate("fadeOut",QT),uT.registerBuiltInAnimate("moveIn",PC),uT.registerBuiltInAnimate("moveOut",RC),uT.registerBuiltInAnimate("rotateIn",IC),uT.registerBuiltInAnimate("rotateOut",LC),uT.registerBuiltInAnimate("update",BC),uT.registerBuiltInAnimate("state",CC),uT.registerBuiltInAnimate("fromTo",DC),uT.registerBuiltInAnimate(KL,KD)},rF=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};cD.STATE_HIGHLIGHT,cD.STATE_BLUR;class aF{constructor(t){this._markSet=new uD,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){_(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.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 oF={highlightState:cD.STATE_HIGHLIGHT,blurState:cD.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class lF extends aF{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},oF,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return v(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll(e)}}lF.type="element-highlight",lF.defaultOptions=oF;const hF=()=>{eI.registerInteractionTrigger(lF.type,lF)},cF={state:cD.STATE_SELECTED,trigger:"click"};class dF extends aF{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},cF,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=G(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):v(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):x(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(_(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),t.addState(i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll(e)}}dF.type="element-select",dF.defaultOptions=cF;const uF=()=>{eI.registerInteractionTrigger(dF.type,dF)};class pF extends GD{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class gF{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>eI.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>eI.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>eI.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return eI.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>eI.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){eI.registerTransform(t,e)}static registerFunction(t,e){t&&e&&UD.instance().registerFunction(t,e)}static unregisterFunction(t){t&&UD.instance().unregisterFunction(t)}static getFunction(t){return t?UD.instance().getFunction(t):null}static getFunctionList(){return UD.instance().getFunctionNameList()}static registerMap(t,e,i){const s=eI.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=eI.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,BL.get(e);var e}static registerSVG(t,e,i){const s=eI.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=eI.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){mI.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}get event(){return this._event}getDataSet(){return this._dataSet}constructor(e,i){var n,r,a,o,l,h,c,d,p;this.id=$y(),this._userEvents=[],this._autoSize=!0,this._option={mode:s["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._renderState=qL.render,this._disableDimensionHoverEvent=!1,this._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))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;N(n.theme,this._spec.theme)?N(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=eD(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?eI.getSeriesBuiltInTheme(e):eI.getComponentBuiltInTheme(e);i=i?tI({},s,i[e]):s}s===t.length-1&&u(i)&&(i=bI({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},gO(i),this._option=Object.assign(Object.assign({},this._option),i),(null==i?void 0:i.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),i.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:_,stage:y,poptip:b}=g,x=t(g,["dom","renderCanvas","mode","stage","poptip"]),S=Uy(_);if(S?nx(yo):"node"===_&&NS(yo),S&&f&&(this._container=v(f)?S_.getElementById(f):f),m&&(this._canvas=m),y&&(this._stage=y),"node"!==_&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=vI.getCurrentThemeName(),this._setNewSpec(e),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const k=[];!1!==b&&k.push("poptipForText"),"sankey"===e.type&&k.push("scrollbar");const A=new rt(null!==(a=this._option.logLevel)&&void 0!==a?a:nt.Error);rt.setInstance(A),(null===(o=this._option)||void 0===o?void 0:o.onError)&&A.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._compiler=new ZL({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:y,pluginList:k},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new wL(this,this._compiler),this._event=new vL(this._eventDispatcher,_),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=e.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),mI.registerInstance(this),null===(p=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===p||p.call(d,this)}_setNewSpec(t,e){return!!t&&(v(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=tI({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=xI(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;gF.getFunctionList()&&gF.getFunctionList().length&&(t=SI(t,gF)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=eI.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=eI.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(t){var e,i,s;if(!this._compiler)return void(null===(e=this._option)||void 0===e||e.onError("compiler is not initialized"));if(this._chart)return void(null===(i=this._option)||void 0===i||i.onError("chart is already initialized"));const n=eI.createChart(t.type,t,this._getChartOption(t.type));n?(this._chart=n,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(bL.initialized,{chart:n,vchart:this})):null===(s=this._option)||void 0===s||s.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var t,e;this._compiler&&(null===(e=null===(t=this._compiler.getStage())||void 0===t?void 0:t.getTimeline())||void 0===e||e.on("animationEnd",(()=>{this._event.emit(bL.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=xt(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.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 tD(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:wI,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:TI})}_initDataSet(t){this._dataSet=t instanceof Ca?t:new Ca,CL(this._dataSet,"dataview",Ma),CL(this._dataSet,"array",i),TL(this._dataSet,"copyDataView",LL);for(const t in eI.transforms)TL(this._dataSet,t,eI.transforms[t]);for(const t in eI.dataParser)CL(this._dataSet,t,eI.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return c(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake?(null===(n=this._compiler)||void 0===n||n.releaseGrammar(),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.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.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),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),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(bL.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return e(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return e(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?HL.none:HL.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}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._cachedProcessedTheme=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,mI.unregisterInstance(this)}updateData(t,i,s,n){return e(this,void 0,void 0,(function*(){return this.updateDataSync(t,i,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):_(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return e(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=G(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._reSetRenderState(),d(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=G(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=G(this._spec.data);return G(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof Ba?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,u(n)&&(a.parser=n),u(r)&&(a.fields=r));else{const e=FL(t,this._dataSet,s);_(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,i=!0){return e(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,i)}))}updateSpec(t,i=!1,s,n){return e(this,void 0,void 0,(function*(){const e=this._updateSpec(t,i,n);return e?(yield this.updateCustomConfigAndRerender(e,!1,{morphConfig:s,transformSpec:e.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,i,s=!1,n){return e(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,i,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(v(e)&&(e=JSON.parse(e)),c(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(p(e))e.type===n&&(_(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?tI({},t[n][e.index],i):i):t[n]=s?tI({},t[n],i):i);else if(_(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?tI({},t[n][r],i):i)}else t.id===e&&(t[n]=s?tI({},t[n],i):i)}))}(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=tI({},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,i){return e(this,void 0,void 0,(function*(){return this.resizeSync(t,i)}))}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),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,this),!0)}_afterResize(){return this._isReleased||this._event.emit(bL.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)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=iI({},e,e.chart[t])),e};let l;if(E(n)&&E(r))l=_I(this._currentThemeName),this._currentTheme=o(a,l);else if(v(n)&&(!r||v(r))||v(r)&&(!n||v(n))){const t=iI({},_I(this._currentThemeName),_I(n),_I(r));this._currentTheme=o(a,t)}else{const t=iI({},_I(this._currentThemeName),_I(n),_I(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),z(WM.poptip,NM,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;d(this._spec.width)?!d(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),d(this._spec.height)?!d(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!Uy(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||p(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return _I(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return e(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!vI.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),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}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(n.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=u(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(n.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(n.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(n.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return e(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield JL(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var i,s;return e(this,void 0,void 0,(function*(){if(!Uy(this._option.mode))return void(null===(i=this._option)||void 0===i||i.onError(new TypeError("non-browser environment can not export img")));const e=yield this.getDataURL();e?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,e):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;this._chart.resetLayoutItemTag(),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(u(this._container))return this._container;let e;return e=v(this._canvas)?S_.getElementById(this._canvas):this._canvas,u(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)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(E(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(u(r)?o=this._chart.getSeriesInUserId(r):u(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?NO(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||d(t)||E(e))return null;if(!_(t)){const{axisId:n,axisIndex:r}=e;let a;if(u(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):u(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return jy("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return u(r)?o=this._chart.getSeriesInUserId(r):u(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?NO(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(jy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return UD.instance().getFunction(t)}registerFunction(t,e){t&&e&&UD.instance().registerFunction(t,e)}unregisterFunction(t){t&&UD.instance().unregisterFunction(t)}getFunctionList(){return UD.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(n.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,r;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(r=this._chart)||void 0===r?void 0:r.getComponentsByType(n.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=eI.getChartPlugins();t.length>0&&(this._chartPlugin=new YD(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=eI.getVChartPlugins();e.length>0&&(this._vChartPlugin=new pF(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||s["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_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,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=qL.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){this._renderState=qL.render,this.getStage().eventSystem.resumeTriggerEvent()}}gF.InstanceManager=mI,gF.ThemeManager=vI,gF.globalConfig={uniqueTooltip:!0},gF.Utils=WD,gF.vglobal=S_;eI.registerRegion("region",yD),eI.registerLayout("base",CD),qA(),DA(),eI.registerMark(ND.type,ND),eI.registerStageEventPlugin("gesture",Tb),hF(),uF(),dI(KO.name,KO);const fF="monotone",mF="linear",vF="bevel";var _F;function yF(t,e){return e("component",t)}function bF(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=eI.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}!function(t){t.vertical="vertical",t.horizontal="horizontal"}(_F||(_F={}));const xF=(t,e,i,s)=>{if(d(t[e]))return;const n=_(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},SF=(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(c(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(d(i))for(let i=0;i(l(t),t)))},kF="2.0.19",AF=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},MF=(t,e,i,s)=>{let n;if(n=c(t)?t(e,i):f(t)&&u(t.field)?P(e,t.field):t,s){const{formatFunc:i,args:r}=bF(void 0,s,t,e);i&&r&&(n=i(...r))}return n},wF=(t,e,i)=>d(t)?t:c(t)?t(e,i):t;const TF=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(_(e.activeType)?e.activeType.includes(t):e.activeType===t)));function CF(e,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=d(i.key)&&d(i.value)&&!E(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:p,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:_}=l,y=t(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=EF(MF(h,r,a,c),p,g),o.value=EF(MF(f,r,a,m),v,_),Object.keys(y).forEach((t=>{o[t]=MF(l[t],r,a)})),!1!==o.visible&&(u(o.key)||u(o.value))&&e.push(o)}};_(i)?i.forEach((t=>{o(t)})):o(i)}function BF(t,e,i,s,n,r,a){if(c(e)){CF(t,e(n,a),i,s,r,a)}else e&&CF(t,e,i,s,r,a)}const EF=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=gi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class PF{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:u(n)?G(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(u(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 G(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(u(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.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{_(t)?t.forEach((t=>{BF(a,t,e,i,s,n,r)})):c(t)?BF(a,t,e,i,s,n,r):t&&CF(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=c(e)?e(s,n):e;if(r?d(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){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}(s),e={visible:MF(r.visible,t,n),value:EF(MF(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:MF(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=MF(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&TF(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const RF={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}},OF=(t,e)=>{var i,s;let n=e.fields;if(c(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=JI([],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 IF(a,n,o)},IF=(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&&t.forEach((t=>{t&&n.push(t[a])}));const u=n.length;if(h){r.length=0,n.forEach(((t,e)=>{Ky(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===u}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{Ky(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&&!0===o.lockStatisticsByDomain&&!d(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=RF[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},LF=(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=>{Ky(t[e])||(t[e]=0)}))})),t},DF=`${MI}_HIERARCHY_DEPTH`,FF=`${MI}_HIERARCHY_ROOT`,zF=`${MI}_HIERARCHY_ROOT_INDEX`;function jF(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function HF(t,e,i){t&&(i.needDefaultSeriesField&&(t[PI]=i.defaultSeriesField),t[BI]=e,t[EI]=i.getKey(t,e,i))}function VF(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function NF(t,e,i,s=0,n,r){void 0===r&&(r=e),HF(t,e,i),t[DF]=s,t[FF]=n||t[i.categoryField],t[zF]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>NF(e,s,i,t[DF]+1,t[FF],r)))}const WF={label:{name:"label",type:"text"}},UF=`${MI}_rect_x`,GF=`${MI}_rect_x1`,YF=`${MI}_rect_y`,XF=`${MI}_rect_y1`,$F={data:!0},KF={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},qF=[...Object.keys(qD),"normal"];function ZF(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=_(a)?a.map(((t,e)=>{var s;let n=t;return iz(n)&&delete n.type,n.oneByOne&&(n=QF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:tz,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=tI({},o[e],a);return iz(n)&&delete n.type,n.oneByOne&&(n=QF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:tz,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function JF(t,e,i){var s,n,r,a,o,l;const h={};return u(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),u(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),u(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),u(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),u(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),u(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=I(t,null,i),sz(t,(t=>{var i;if(c(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function QF(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=c(n)?n(t,i,a):k(n)?n:0,h=c(r)?r(t,i,a):k(r)?r:0;let d=c(s)?s(t,i,a):s;return!1===d?h:(d=!0===d?0:d,h+o*(l+d))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=c(n)?n(t,r,o):k(n)?n:0,d=c(a)?a(t,r,o):k(a)?a:0;let u=c(s)?s(t,r,o):s;if(!1===u)return d;return u=!0===u?0:u,d+((i?i():r.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function tz(t,e){var i;return null!==(i=null==t?void 0:t[BI])&&void 0!==i?i:e.context.graphicIndex}function ez(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 iz(t){return!function(t){return u(t.timeSlices)}(t)&&u(t.channel)}function sz(t,e,i=[]){if(_(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),sz(t[n],e,i)}));else if(p(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),sz(t[s],e,i))}function nz(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class rz extends gD{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=G(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=_O(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=eI.getSeriesMarkMap(o)?function(t,e,i){const s=eI.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=tI({},i("mark",G(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return tI({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_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){h(t.stack)&&(this.stack=t.stack),h(t.percent)&&(this.stack=t.percent||this.stack),d(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;G(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:d=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(c(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&d)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,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 u(s)&&(i.outerRadius=s),u(n)&&(i.innerRadius=n),u(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=tI({},i,s,t),n=i.label;return n&&p(n)&&_(e.label)&&(e.label=e.label.map((t=>tI({},n,t)))),e};return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class az extends fD{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){u(t)&&(this._seriesField=t)}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:`${MI}_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=rz,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=aD.SeriesGroup,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(bL.afterInitData,{model:this}),this.initRootMark(),this.initMark();const t=nz(this);this._initExtensionMark({hasAnimation:t}),this.initMarkStyle(),this.initMarkState(),t&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(bL.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 d(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),u(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)&&(TL(this._rawData.dataSet,"invalidTravel",LF),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;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=FL(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=DL(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=DL(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new LD(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(d(this._rawStatisticsCache[t].min)||d(this._rawStatisticsCache[t].max))||!e&&d(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=$(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=IF(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=z(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){TL(this._dataSet,"dimensionStatistics",OF);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new Ba(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&&JI(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){TL(this._dataSet,"dimensionStatistics",OF);const s=new Ba(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=JI(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&JI(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new Ba(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 d(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)}`)}:v(t)?e=>e[t]:_(t)&&t.every((t=>v(t)))?e=>t.map((t=>e[t])).join("-"):c(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)&&(TL(this._rawData.dataSet,"addVChartProperty",AF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:jF.bind(this),call:HF}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){var e;null===(e=this._rawDataStatistics)||void 0===e||e.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(bL.rawDataUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(bL.viewDataFilterOver,{model:this})}viewDataUpdate(t){var e;this.event.emit(bL.viewDataUpdate,{model:this}),null===(e=this._data)||void 0===e||e.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(bL.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||d(e)?null:t[e]}getDatumPositionValues(t,e){return!t||d(e)?[]:v(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;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.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(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:u(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(u(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=ZF({},JF(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)}))),!d(t.dataId)||!d(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(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:u(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(t){if(!(null==t?void 0:t.length))return[];const e=(i=this._option.mode)===s["desktop-browser"]||i===s["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:Gy(i)||Yy(i)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var i;let n=Object.assign({},null==e?void 0:e.hover),r=Object.assign({},null==e?void 0:e.select);const a=this._spec.hover;h(a)?n.enable=a:p(a)&&(n.enable=!0,n=tI(n,a));const o=this._spec.select;h(o)?r.enable=o:p(o)&&(r.enable=!0,r=tI(r,o));const l=[{trigger:{type:"dimension-hover"},marks:t}];if(n.enable){const e=rF(n,t);e.length&&l.push({trigger:this._defaultHoverConfig(n),marks:e})}if(r.enable){const e=rF(r,t);e.length&&l.push({trigger:this._defaultSelectConfig(r),marks:e})}return l}_defaultHoverConfig(t){return{type:"element-highlight",trigger:t.trigger,triggerOff:t.triggerOff,blurState:cD.STATE_HOVER_REVERSE,highlightState:cD.STATE_HOVER}}_defaultSelectConfig(t){const e="multiple"===t.mode,i=u(t.triggerOff)?t.triggerOff:e?["empty"]:["empty",t.trigger];return{type:"element-select",trigger:t.trigger,triggerOff:i,reverseState:cD.STATE_SELECTED_REVERSE,state:cD.STATE_SELECTED,isMultiple:e}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=rF(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}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:PI;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:RI,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],u(o)?o:t.getAttribute(e,s)}})),this.setMarkStyle(t,a,RI,lD.User_SeriesStyle)}))}afterInitMark(){this.event.emit(bL.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{var e,i;(null===(i=null===(e=t.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&t.setAttribute("stroke",this.getColorAttribute(),"normal",lD.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.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()}initTooltip(){this._tooltipHelper=new PF(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||e.visible!==t[i].visible))?i.reMake=!0:!i.reCompile&&e.some(((e,i)=>!N(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!N(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},$F),KF),i),{extensionMark:!0,label:!0,totalLabel:!0});return this._compareExtensionMarksSpec(G(t.extensionMark),G(e.extensionMark),s),!s.reMake&&this._compareLabelSpec(G(t.label),G(e.label),s),!s.reMake&&this._compareLabelSpec(G(t.totalLabel),G(e.totalLabel),s),s.reMake?s:(!s.reCompile&&this._marks.getMarks().some((i=>{var s,n;return r[i.name]=!0,(null===(s=e[i.name])||void 0===s?void 0:s.visible)!==(null===(n=t[i.name])||void 0===n?void 0:n.visible)}))&&(s.reCompile=!0),!s.reCompile&&n.some((i=>KF[i]&&!N(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!N(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Ba||zL(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.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();nz(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),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:PI,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new BO).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return xO(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:PI}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:p={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:_=!1}=e,y=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:_,parent:!1!==m?null!=m?m:this._rootMark:null});if(u(y)){const e=this.getSpec()||{};this._marks.addMark(y,{name:t.name}),v&&(this._seriesMark=y),d(f)?y.setData(this._data):!1!==f&&y.setDataView(f),y.setSkipBeforeLayouted(!1!==c),d(h)||y.setGroupKey(h);const l=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:null!==(s=i.morph)&&void 0!==s&&s,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(n=i.support3d)&&void 0!==n?n:e.support3d||!!e.zField,morphKey:(null===(r=e.morph)||void 0===r?void 0:r.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});y.setMarkConfig(l),this.initMarkStyleWithSpec(y,tI({},p,g||e[y.name]))}return y}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:EI}_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!==LI&&t!==FI&&t!==II&&t!==DI||(t=this.getStackValueField()),null!==(e=tL(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>Ky(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:PI]}}function oz(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();eB(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 lz(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}}}az.mark=WF,az.transformerConstructor=rz;class hz extends az{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=G(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=G(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&G(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);eB(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:`${MI}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?G(this._spec.xField)[0]:G(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(LI),this.setFieldX2(II)):(this.setFieldY(LI),this.setFieldY2(II))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(FI),this.setFieldX2(DI)):(this.setFieldY(FI),this.setFieldY2(DI))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(jI),this.setFieldX2(zI)):(this.setFieldY(jI),this.setFieldY2(zI))}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=G(this._spec.xField),this._specYField=G(this._spec.yField),u(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(),u(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(G(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(G(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(bL.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)&&(oz("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()!==n.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==n.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)}}function cz(t){return"bottom"===t||"top"===t}function dz(t){return"left"===t||"right"===t}function uz(t){return"z"===t}function pz(t,e){return LO(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function gz(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function fz(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?cz(t)?"linear":"band":cz(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${n.cartesianAxis}-${s}`}}const mz=(t,e,i)=>{var s;const n=null!==(s="band"===e?yF("axisBand",i):["linear","log","symlog"].includes(e)?yF("axisLinear",i):{})&&void 0!==s?s:{},r=cz(t)?yF("axisX",i):dz(t)?yF("axisY",i):yF("axisZ",i);return tI({},yF("axis",i),n,r)};class vz{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:Hy)("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:Hy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;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)))),r=n.filter((t=>sB(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return cz(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class _z extends vz{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(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:xL.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const yz=(t,e)=>{var i,s;return t===e||!d(t)&&!d(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))},bz=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},xz=(t,e,i,s)=>{var n;const r=e.getScale(),a=sB(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=G(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.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))})),o.push({series:h,datum:e,key:Sz(h,s)})}else if(u(i[1])){const e=[],s=[];l.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||u(n[i[0]])&&u(n[i[1]])&&t>=n[i[0]]&&t{if(u(e[i[0]])){const r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{if(u(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,kz=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(G(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};class Az extends vz{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!yz(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:xL.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:xL.canvas}),callback:this.onMouseOut}),Gy(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:xL.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Gy(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var Mz;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Mz||(Mz={}));const wz={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class Tz{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",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.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(wz.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(t,e){var i,s;const n=this._lineMark;if(n){if(this.setMarkStyle(n,{stroke:this.getColorAttribute()},"normal",lD.Series),"zero"!==this._invalidType&&this.setMarkStyle(n,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",lD.Series),this.event.on(bL.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(n,"defined")})),"polar"===this.coordinate)this.setMarkStyle(n,{lineJoin:vF,curveType:mF,closePath:!0},"normal",lD.Series);else{const r=null!=e?e:null===(s=null===(i=this.getSpec().line)||void 0===i?void 0:i.style)||void 0===s?void 0:s.curveType,a=r===fF?"horizontal"===t?"monotoneY":"monotoneX":r;this.setMarkStyle(n,{curveType:a},"normal",lD.Built_In)}this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",lD.Series)}return n}_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){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(wz.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:ez(this._spec,wz.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new Ba(this._option.dataSet,{name:`${MI}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const t=this._symbolMark;if(!t)return this._initSymbolActiveMarkAlone(),t;if(this._initSymbolMark(t),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(Mz.dimensionHover,this._dimensionTrigger.bind(this));for(const e in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[e]={};for(const i in this._symbolMark.stateStyle[e])"visible"!==i&&(this._symbolActiveMark.stateStyle[e][i]={style:null,level:lD.Series,referer:t})}this._symbolActiveMark.state.changeStateInfo({stateValue:cD.STATE_DIMENSION_HOVER,filter:()=>!0})}return t}_initSymbolMark(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",lD.Series),this.setMarkStyle(t,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",lD.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[wz.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(Mz.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,tI({},this._spec[wz.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:cD.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(t){var e;t&&("symbol"!==(null===(e=t.getTarget())||void 0===e?void 0:e.type)&&t.setRule("line-data"),this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},"normal",lD.Series),this.event.on(bL.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(t,e){var i,s,n,r;if(!t)return;const a=this._isFieldAllValid();if("zero"===this._invalidType||a){if(!0===(null===(s=null===(i=t.stateStyle.normal)||void 0===i?void 0:i[e])||void 0===s?void 0:s.style))return;this.setMarkStyle(t,{[e]:!0},"normal",lD.Series)}else{if(!0!==(null===(r=null===(n=t.stateStyle.normal)||void 0===n?void 0:n[e])||void 0===r?void 0:r.style))return;this.setMarkStyle(t,{[e]:this._getInvalidDefined.bind(this)},"normal",lD.Series)}t.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const Cz=Object.assign(Object.assign({},WF),wz),Bz=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(v(t))return!1;if(_(t))return t.length===e.length&&t.every(((t,i)=>Bz(t,e[i])));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]))},Ez=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class Pz extends HD{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return Ez}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(d(o)||s.includes(a))return;r&&n.includes(a)&&(iB(null==o?void 0:o.type)||(null==o?void 0:o.scale)||c(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!d(t)||!d(e))||!d(t)&&!d(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?Bz(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,d(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n,r;const a=e.context.data,o=[],l=[],h={},c=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,d=c&&0===c.currentIndex;if(a.forEach(((e,i)=>{var s;l[i]={},o[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?l[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!c?o[i][s]=t[s](e):0!==i||c&&!d||(h[s]=t[s](e))})),l[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),c){const t=null!==(r=null===(n=e.attribute)||void 0===n?void 0:n.segments)&&void 0!==r?r:[];return t.push({points:l}),d?Object.assign(Object.assign({},h),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(o,l);if(t)return Object.assign(Object.assign(Object.assign({},h),o[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},h),o[0]),{points:l,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:hD.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[EI]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}class Rz extends Pz{constructor(){super(...arguments),this.type=Rz.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)===mO.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}Rz.type="line";const Oz=()=>{eI.registerMark(Rz.type,Rz),qA(),HA(),WE(),zE(),sF(),eI.registerGraphicComponent("line",Eg)};class Iz extends HD{constructor(){super(...arguments),this.type=Iz.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="circle":a.symbolType=o,a}}Iz.type="symbol";const Lz=()=>{eI.registerMark(Iz.type,Iz),qA(),JA(),zE(),eI.registerGraphicComponent("symbol",Tg)};class Dz extends rz{_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)}}function Fz(t){return t.length>=2&&k(t[0])&&k(Y(t))&&Y(t)>=t[0]}function zz(t,e){var i;const s=Y(e)-e[0],n=Y(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=Y(e)>0?Y(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!k(o.min),extendable_max:!k(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):Y(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function jz(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 Hz(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 Vz(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 Nz(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 Wz=(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=>t.type.includes("ticks"))))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=Y(p)-p[0];if(0===g)return t;const f=c.domain(),m=Y(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=ie(t,e),a=Math.max(te(i),te(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return KC(v)};class Uz{constructor(t){this.id=$y(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class Gz extends Uz{constructor(){super(Gz.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!eB(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(t,e){const i=this._checkEnableSync(e);if(!i)return;if(!i.zeroAlign)return;const s=this._getTargetAxis(e,i);s&&e.event.on(bL.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id||t.id===s.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&&Fz(c)&&Fz(d)))return;const u=zz(t,c),p=zz(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:k}=p;if(0===g&&0===f){if(!Hz(u,p))return}else if(0===y&&0===b){if(!Hz(p,u))return}else if(_||k)if(_&&!k){if(!jz(u,p))return}else if(k&&!_){if(!jz(p,u))return}else{if(f===b)return;if(f>b){if(!Vz(u,p))return}else if(!Vz(p,u))return}else{if(0===f&&0===y){if(!Nz(u,p))return}else if(0===b&&0===g&&!Nz(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===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)})(s,e)}))}onDidCompile(t,e){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){TL(e.getOption().dataSet,"tickAlign",Wz);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}Gz.pluginType="component",Gz.type="AxisSyncPlugin";const Yz={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function Xz(t){let e=0;return P(t,"tick.visible")&&(e+=P(t,"tick.tickSize")),P(t,"label.visible")&&(e+=P(t,"label.space")),e}function $z(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 Kz(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const qz=t=>"band"===t||"ordinal"===t||"point"===t;function Zz(t,e){return{id:t,label:t,value:e,rawValue:t}}function Jz(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class Qz extends GD{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const tj=`${MI}_ARC_TRANSFORM_VALUE`,ej=`${MI}_ARC_RATIO`,ij=`${MI}_ARC_START_ANGLE`,sj=`${MI}_ARC_END_ANGLE`,nj=`${MI}_ARC_K`,rj=`${MI}_ARC_MIDDLE_ANGLE`,aj=`${MI}_ARC_QUADRANT`,oj=`${MI}_ARC_RADIAN`,lj=-Math.PI/2,hj=3*Math.PI/2,cj=.6,dj=(t,e,i,s)=>{const n=t();if(x(n))return n;if(c(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return ue(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},uj=(t,e,i)=>{var s;const n=null!==(s="band"===e?yF("axisBand",i):"linear"===e?yF("axisLinear",i):{})&&void 0!==s?s:{},r=yF("angle"===t?"axisAngle":"axisRadius",i);return tI({},yF("axis",i),n,r)};function pj(t,e,i,s){switch(t){case n.cartesianBandAxis:return mz(pz(i,["z"]),"band",e);case n.cartesianLinearAxis:return mz(pz(i,["z"]),"linear",e);case n.cartesianLogAxis:return mz(pz(i,["z"]),"log",e);case n.cartesianSymlogAxis:return mz(pz(i,["z"]),"symlog",e);case n.cartesianAxis:case n.cartesianTimeAxis:return mz(pz(i),void 0,e);case n.polarBandAxis:return uj(i.orient,"band",e);case n.polarLinearAxis:return uj(i.orient,"linear",e);case n.polarAxis:return uj(i.orient,void 0,e);case n.cartesianCrosshair:return((t,e)=>{var i,s;const r=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:d}=null!==(s=yF(n.crosshair,t))&&void 0!==s?s:{},p=r.find((t=>cz(t.orient)));let g;g=u(p)?tI({},qz(p.type)?a:o,l):l;const f=r.find((t=>dz(t.orient)));let m;return m=u(f)?tI({},sB(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(e,s);case n.polarCrosshair:return((t,e)=>{var i,s;const r=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:d}=null!==(s=yF(n.crosshair,t))&&void 0!==s?s:{},p=r.find((t=>"angle"===t.orient));let g;g=u(p)?tI({},qz(p.type)?a:o,l):l;const f=r.find((t=>"radius"===t.orient));let m;return m=u(f)?tI({},sB(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case n.colorLegend:case n.sizeLegend:case n.discreteLegend:case n.dataZoom:case n.scrollBar:return gj(i,yF(t,e));default:return yF(t,e)}}const gj=(t,e)=>{var i;const s=tI({},e,e[gz(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class fj extends gD{getTheme(t,e){return pj(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({},VO(e)),{[s]:0}))}}class mj extends vD{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=fj,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof Fc||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:xL.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new Qz(this)}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)))}_getNeedClearVRenderComponents(){return[]}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=>!N(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&&(t.release(!0),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=>{e.compile({group:t,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}}getDatum(t){}}var vj,_j;mj.transformerConstructor=fj,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(vj||(vj={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(_j||(_j={}));class yj extends HD{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}clearComponent(){this._component&&(this._component.parent&&this._component.parent.removeChild(this._component),this._component=null)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=eI.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(_L.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){super.release(),this.removeProduct()}}yj.type="component";const bj=()=>{eI.registerMark(yj.type,yj)},xj=t=>t;class Sj extends mj{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._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(u)}created(){var t,e,i,s,n,r,a,o,l,h,c,d,p,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()?vj.circleAxis:vj.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(b),this._axisMark=b,b.setMarkConfig({zIndex:this.layoutZIndex}),u(this._spec.id)&&b.setUserId(this._spec.id),b.setMarkConfig({interactive:null!==(t=this._spec.interactive)&&void 0!==t?t:this.getDefaultInteractive()}),this._marks.addMark(b),null===(e=this._spec.grid)||void 0===e?void 0:e.visible){const t=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?_j.circleAxisGrid:_j.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(t),t.setMarkConfig({zIndex: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:aD.Axis_Grid,interactive:!1}),this._marks.addMark(t),this._gridMark=t}if((null===(o=this._option.globalInstance)||void 0===o?void 0:o.isAnimationEnable())&&!1!==P(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=ZF(null===(l=eI.getAnimationInKey("axis"))||void 0===l?void 0:l(),{appear:null!==(c=null!==(h=this._spec.animationAppear)&&void 0!==h?h:P(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==c?c:P(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(p=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:P(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==p?p:P(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(f=null!==(g=this._spec.animationEnter)&&void 0!==g?g:P(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==f?f:P(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(v=null!==(m=this._spec.animationExit)&&void 0!==m?m:P(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==v?v:P(this._option.getChart().getSpec(),"animationExit"),update:null!==(y=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:P(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==y?y:P(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()),e=new LD(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return cO(this._regions,(s=>{var r;let a=this.collectSeriesField(t,s);if(a=_(a)?eB(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!eB(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(r=s.getViewDataStatistics)||void 0===r?void 0:r.call(s),o=this.type===n.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return cO(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:s}=this._spec;u(t)&&(this._seriesUserId=G(t)),u(i)&&(this._regionUserId=G(i)),u(e)&&(this._seriesIndex=G(e)),u(s)&&(this._regionIndex=G(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(bL.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const t=dO(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));t.length>1?this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()})):1===t.length&&t[0].target.addListener("change",(()=>{this.updateScaleDomain()})),cO(this._regions,(t=>{t.event.on(bL.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(bL.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&N(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):cO(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(cO(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_getAxisAttributes(){const e=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&e.select,hover:!0!==this._option.disableTriggerEvent&&e.hover};var s;if(e.domainLine&&e.domainLine.visible?i.line=((s=cL(s=e.domainLine)).startSymbol=cL(s.startSymbol),s.endSymbol=cL(s.endSymbol),s):i.line={visible:!1},e.label&&e.label.visible){const t=j(e.label,["style","formatMethod","state"]);i.label=t,e.label.style&&(i.label.style=c(e.label.style)?(t,i,s,n)=>{var r;const a=e.label.style(t.rawValue,i,t,s,n);return pL(tI({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:pL(e.label.style)),(e.label.formatMethod||e.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),e.label.state&&(i.label.state=function(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{c(t[i])?e[i]=(e,s,n,r)=>pL(t[i](e.rawValue,s,e,n,r)):E(t[i])||(e[i]=pL(t[i]))})),e}(e.label.state)),c(e.label.dataFilter)&&(i.label.dataFilter=(t,i)=>e.label.dataFilter(t,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(e.tick&&e.tick.visible?(i.tick={visible:e.tick.visible,length:e.tick.tickSize,inside:e.tick.inside,alignWithLabel:e.tick.alignWithLabel,dataFilter:c(e.tick.dataFilter)?t=>e.tick.dataFilter(t,{vchart:this._option.globalInstance}):void 0},e.tick.style&&(i.tick.style=c(e.tick.style)?(t,i,s,n)=>{var r;const a=e.tick.style(t,i,s,n);return pL(tI({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:pL(e.tick.style)),e.tick.state&&(i.tick.state=dL(e.tick.state))):i.tick={visible:!1},e.subTick&&e.subTick.visible?(i.subTick={visible:e.subTick.visible,length:e.subTick.tickSize,inside:e.subTick.inside,count:e.subTick.tickCount},e.subTick.style&&(i.subTick.style=c(e.subTick.style)?(t,i,s,n)=>{var r;const a=e.subTick.style(t,i,s,n);return pL(tI({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:pL(e.subTick.style)),e.subTick.state&&(i.subTick.state=dL(e.subTick.state))):i.subTick={visible:!1},e.title&&e.title.visible){const s=e.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=t(s,["autoRotate","angle","style","background","state","shape"]);let u,p=r;"left"!==e.orient&&"right"!==e.orient||n&&d(p)&&(p="left"===e.orient?-90:90,u=Yz[e.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?re(p):null,textStyle:tI({},u,pL(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:pL(h.style)}),h.state&&(i.title.state.shape=dL(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:pL(o.style)}),o.state&&(i.title.state.background=dL(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=dL(l))}else i.title={visible:!1};return e.background&&e.background.visible?(i.panel={visible:!0},e.background.style&&(i.panel.style=pL(e.background.style)),e.background.state&&(i.panel.state=dL(e.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:kI(t.grid.alternateColor),alignWithLabel:t.grid.alignWithLabel,style:c(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 pL(tI({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:pL(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:kI(t.subGrid.alternateColor),style:pL(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=bF(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){CL(this._option.dataSet,"scale",xj);const i=this.registerTicksTransform();return new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,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)}getDatum(t){var e;return t&&t.name===fw.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}Sj.specKey="axes";const kj=()=>{bj(),eI.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},Aj=[Gz];class Mj extends Sj{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}constructor(e,i){super(e,i),this.type=n.cartesianAxis,this.name=n.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=aD.Axis,this.layoutLevel=oD.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),cO(this._regions,(t=>{const e=this.getOrient();cz(e)?Jz(t.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):dz(e)?Jz(t.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):uz(e)&&Jz(t.getZAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&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._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{const e=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=t(i,["grid"]),r=tI({x:e.x,y:e.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(tI({x:e.x,y:e.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=cz(this.getOrient()),n=t=>{var e;return(s?!cz(t.getOrient()):cz(t.getOrient()))&&eB(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&&Y(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(u(t))a=r.find((e=>e.id===t));else if(u(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=pz(e,["z"]),uz(this._orient)&&(this.layoutType="absolute"),this._dataSet=i.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!_(e)){if(!Kz(e))return null;const{axisType:t,componentName:s}=fz(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=>dz(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(!Kz(t))return;const{axisType:s,componentName:n}=fz(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]),r=eI.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}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return cz(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):uz(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(Aj.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){cz(this.getOrient())?m(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):m(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&&!cz(t.orient)&&(i=!u(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!uz(this.getOrient())&&this._spec.innerOffset){const t=this._spec;dz(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=zO(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=zO(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=cz(this.getOrient())?t.fieldX:uz(this.getOrient())?t.fieldZ:t.fieldY,eB(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;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,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:eB(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 t;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(_L.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(cz(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._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=cz(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)}))}collectScale(){const t=[];return cO(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]:cz(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:uz(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();cO(this._regions,(e=>{cz(t)?Jz(e.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):dz(t)?Jz(e.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):uz(t)&&Jz(e.getZAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(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=cz(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 s={skipLayout:!1},n=cz(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)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=tI(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new je).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=cz(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?mt(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):mt(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-Y(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&d(null===(e=a.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=a.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 o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return Zz(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:eB(this._scale.type)?i>=s[0]&&i<=Y(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(bL.layoutEnd,this._updateAxisLayout),this.event.on(bL.layoutEnd,this._fixAxisOnZero),this.event.on(bL.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 i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}Mj.type=n.cartesianAxis,Mj.specKey="axes";const wj=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function Tj(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,Bj=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function Ej(t,e,i="count"){const s=Bj(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const Pj=Math.sqrt(50),Rj=Math.sqrt(10),Oj=Math.sqrt(2);class Ij{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){u(this._spec.nice)&&(this._nice=this._spec.nice),u(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=$z(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(i.forceTickCount))e=i.forceTickCount;else if(c(i.tickCount)){const t=this._scale.range();let s=Math.abs(Y(t)-t[0]);if(1===s&&this._option){s=cz(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=k(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return d(s)&&d(n)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice(e):(u(s)||u(this._softMinValue))&&d(n)&&d(this._softMaxValue)?this._scale.niceMax(e):!(!d(s)||!d(this._softMinValue)||!u(n)&&!u(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return d(e)&&d(i)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice():(u(e)||u(this._softMinValue))&&d(i)&&d(this._softMaxValue)?this._scale.niceMax():!(!d(e)||!d(this._softMinValue)||!u(i)&&!u(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=d(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(Cj),e.sort(Cj),{domain:Tj(t,e),scope:Ej(t,e,i)}}(r,Dy(t),this._spec.breaks[0].scopeType);e=Dy(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=Y(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),u(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),u(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=$z(this._spec);if(u(e)||u(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[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=Pj?10:n>=Rj?5:n>=Oj?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(Y(t),0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();if(this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(bL.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=Y(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}updateScaleDomainByModel(t){if(t=null!=t?t:this._scale.domain(),this.extendDomain(t),this.includeZero(t),this.setDomainMinMax(t),this.niceDomain(t),this._scale.domain(t,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(t),this._domainAfterSpec=this._scale.domain(),this.event.emit(bL.scaleDomainUpdate,{model:this}),this.event.emit(bL.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(Y(t)-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}_updateRawDomain(){const t=this.collectData(0,!0),e=this.computeLinearDomain(t);this._rawDomain=e,this.event.emit(bL.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}const Lj={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},Dj={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}}},Fj={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}}},zj={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}}};class jj extends Mj{constructor(){super(...arguments),this.type=n.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new GB}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];u(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),u(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!uz(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=cz(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=DO(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=Dy(this._break.scope).map((t=>i[0]+(Y(i)-i[0])*t))),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}registerTicksTransform(){const t=`${this.type}-ticks`;return TL(this._option.dataSet,t,tE),t}}jj.type=n.cartesianLinearAxis,jj.specKey="axes",jj.builtInTheme={axis:zj,axisLinear:Lj,axisX:Dj,axisY:Fj},U(jj,Ij);const Hj=()=>{eI.registerGraphicComponent(vj.lineAxis,((t,e)=>new NC(t,e))),eI.registerGraphicComponent(_j.lineAxisGrid,((t,e)=>new JE(t,e))),kj(),eI.registerComponent(jj.type,jj)};class Vj{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new LD(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{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(bL.scaleDomainUpdate,{model:this}),this.event.emit(bL.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).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=G(e).concat(i);if(n.push(r),o){const e=Zz(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=>Zz(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const t=this._spec.domain;for(let e=0;ethis._rawDomainIndex[e][t]=i))}this.event.emit(bL.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const Nj={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}};class Wj extends Mj{constructor(){super(...arguments),this.type=n.cartesianBandAxis,this._scale=new AB}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}}registerTicksTransform(){const t=`${this.type}-ticks`;return TL(this._option.dataSet,t,rE),t}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=fB(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(),p=e=>{const i=t===n?a:0;if(d(r)||t{eI.registerGraphicComponent(vj.lineAxis,((t,e)=>new NC(t,e))),eI.registerGraphicComponent(_j.lineAxisGrid,((t,e)=>new JE(t,e))),kj(),eI.registerComponent(Wj.type,Wj,!1)};class Gj extends jj{constructor(){super(...arguments),this.type=n.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),cO(this._regions,(t=>{cz(this.getOrient())?Jz(t.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):Jz(t.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=tI({},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 Ba(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.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 LD(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=gi.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=>Zz(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=>Zz(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return TL(this._option.dataSet,t,tE),t}transformScaleDomain(){}}Gj.type=n.cartesianTimeAxis,Gj.specKey="axes",Gj.builtInTheme={axis:zj,axisX:Dj,axisY:Fj};const Yj=()=>{eI.registerGraphicComponent(vj.lineAxis,((t,e)=>new NC(t,e))),eI.registerGraphicComponent(_j.lineAxisGrid,((t,e)=>new JE(t,e))),kj(),eI.registerComponent(Gj.type,Gj)};class Xj extends jj{constructor(){super(...arguments),this.type=n.cartesianLogAxis,this._zero=!1,this._scale=new KB}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return TL(this._option.dataSet,t,tE),t}transformScaleDomain(){}}Xj.type=n.cartesianLogAxis,Xj.specKey="axes",Xj.builtInTheme={axis:zj,axisLinear:Lj,axisX:Dj,axisY:Fj},U(Xj,Ij);const $j=()=>{eI.registerGraphicComponent(vj.lineAxis,((t,e)=>new NC(t,e))),eI.registerGraphicComponent(_j.lineAxisGrid,((t,e)=>new JE(t,e))),kj(),eI.registerComponent(Xj.type,Xj)};class Kj extends jj{constructor(){super(...arguments),this.type=n.cartesianSymlogAxis,this._zero=!1,this._scale=new qB}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return TL(this._option.dataSet,t,tE),t}transformScaleDomain(){}}Kj.type=n.cartesianSymlogAxis,Kj.specKey="axes",Kj.builtInTheme={axis:zj,axisLinear:Lj,axisX:Dj,axisY:Fj},U(Kj,Ij);const qj=()=>{eI.registerGraphicComponent(vj.lineAxis,((t,e)=>new NC(t,e))),eI.registerGraphicComponent(_j.lineAxisGrid,((t,e)=>new JE(t,e))),kj(),eI.registerComponent(Kj.type,Kj)},Zj=`${MI}_hide_`;function Jj(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const Qj=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[Zj]&&(Jj(t,!0),t[Zj]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=d(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[Zj]=!0,Jj(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=d(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},tH=()=>{eI.registerGrammarTransform("symbolOverlap",{transform:Qj,runType:"afterEncode"})},eH={min:$,max:X,average:rO,sum:nO};function iH(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}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function sH(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 nH(t,e,i,s){return sH(t,e,i,"min",s)}function rH(t,e,i,s){return sH(t,e,i,"max",s)}function aH(t,e,i,s){return sH(t,e,i,"average",s)}function oH(t,e,i,s){return sH(t,e,i,"sum",s)}const lH=(t,e)=>{let i=c(t.size)?t.size():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=iH;if("min"===n?l=nH:"max"===n?l=rH:"average"===n?l=aH:"sum"===n&&(l=oH),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[]},hH=()=>{eI.registerGrammarTransform("dataSampling",{transform:lH})};class cH extends hz{constructor(){super(...arguments),this.type=mO.line,this.transformerConstructor=Dz,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.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(ZF(null===(i=eI.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),JF("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=lz(this);this._symbolMark.setAnimationConfig(ZF(null===(s=eI.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),JF("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),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]}}cH.type=mO.line,cH.mark=Cz,cH.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},cH.transformerConstructor=Dz,U(cH,Tz);class dH{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=G(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{zL(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof Ba)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];jy(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];jy(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class uH{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)=>{qy(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{JI(e,[{key:t,operations:eB(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&&JI(e,[{key:i.field,operations:eB(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?PO("colorOrdinal"):PO(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(qy(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),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(N(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;if(!N(r.specified,s.specified))return e.reMake=!0,e;s.range&&!N(s.range,n.range())&&(n.range(s.range),e.reRender=!0),qy(s.domain)?e.reRender=!0:N(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(!qy(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=eB(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=eB(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(d(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),d(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;eB(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(d(t.changeDomain)||"none"===t.changeDomain||d(t.seriesId))return void(eB(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=eB(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!E(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)));eB(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(d(t.field)||!d(t.changeDomain)&&"none"!==t.changeDomain&&!d(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class pH{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&t.addState(i,!0,l):a&&t.addState(s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&t.addState(i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{t.removeState(i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&t.removeState(e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}class gH extends pD{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){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=$y(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:wI,height:TI},this._viewRect={width:wI,height:TI},this._viewBox={x1:0,y1:0,x2:wI,y2:TI},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)=>G(t).some((t=>u(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=VO(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new vL(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new dH(this._dataSet),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===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new pH;const t=this.getAllSeries(),e=[],i={};t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=`${n}-${t.type}`;i[r]?s.forEach((t=>{i[r].marks.push(t)})):(i[r]=Object.assign(Object.assign({},t),{marks:s}),e.push(i[r]))}))}})),e.forEach((t=>{const e=eI.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(ZF({},JF("stage",this._spec,{}),null))}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.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||u(t.gradient))return;const e=j(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=eI.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},e),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:aD.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(e,i){if(!e)return;const{spec:s}=i,n=t(i,["spec"]),r=new e(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(e,i){if(!e)return;const{spec:s}=i,n=t(i,["spec"]);let r;if(u(s.regionId)?r=this.getRegionsInUserId(s.regionId):u(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new e(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(v(t))return this.getAllModels().find((e=>e.userId===t));if(c(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){const s=eI.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"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(){var t,e,i,s;if(null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeLayoutWithSceneGraph)||void 0===e||e.call(t,this._option.globalInstance),this.getLayoutTag()){this._event.emit(bL.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const t=this.getLayoutElements();this._layoutFunc(this,t,this._layoutRect,this._viewBox),this._event.emit(bL.afterLayout,{elements:t,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(bL.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterLayoutWithSceneGraph)||void 0===s||s.call(i,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof fD)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 HD))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof HD)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}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){G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&zL(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=tD(this._spec,this._option,{width:wI,height:TI})),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(_(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),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=xO(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new uH(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){eD(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=xO(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0};return Object.keys(t).filter((t=>!e[t])).sort()}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=this._getSpecKeys(this._spec);if(!N(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{eD(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[n.title]:!0,[n.brush]:!0,[n.indicator]:!0};this._components.forEach((s=>{var r,a;if(s.type===n.label||s.type===n.totalLabel)return;i[s.type]&&(i[s.type]=!1);const o=s.specKey||s.type,l=null!==(r=this._spec[o])&&void 0!==r?r:{};_(l)?(e[o]=e[o]||{specCount:l.length,componentCount:0},e[o].componentCount++,eD(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):eD(t,s.updateSpec(l))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}const s=t=>t&&!1!==t.visible;Object.keys(i).forEach((e=>{if(i[e]){const i=this._spec[e];(_(i)?i.some(s):s(i))&&(t.reMake=!0)}}))}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];eD(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(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:s=0,x2:n,y2:r}=t;e={width:n-i,height:r-s}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=jO(this._paddingSpec,e,e),this._layoutRect.width=e.width-this.padding.left-this.padding.right,this._layoutRect.height=e.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(bL.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),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(){this._backgroundMark&&this._backgroundMark.compile()}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._option.globalInstance),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,this._option.globalInstance)}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._option.globalInstance),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,this._option.globalInstance)}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._option.globalInstance),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,this._option.globalInstance)}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(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(E(t[s]))continue;const n=t[s];let r={stateValue:s};r=c(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(cD.STATE_SELECTED,t,e,i)}setHovered(t,e,i){this._setStateInDatum(cD.STATE_HOVER,t,e,i)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(cD.STATE_SELECTED)}clearHovered(){this.clearState(cD.STATE_HOVER)}_initEvent(){[bL.dataZoomChange,bL.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(_L.AFTER_MARK_RENDER_END,e)};this._event.on(_L.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?G(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:fL;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||c(e.filter)&&e.filter(o,l))){if(gL(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let r=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===Mz.dimensionHover||s===Mz.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(r=i)}}));const a=d(t)||!r||r.every((t=>sB(t.axis.getScale().type)&&d(t.index))),o=a||r.every((t=>sB(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(n.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};r.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(n.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(r))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(n.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(n.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),r=[];s.forEach((e=>{const i=t(e);!1!==i&&r.push({axis:e,value:i})})),i.showCrosshair(r)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const fH=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(u(n)){const t=G(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(u(r))return G(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(u)};class mH{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={}),u(t.stackInverse)&&t.region.forEach((e=>{!u(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),u(t.stackSort)&&t.region.forEach((e=>{!u(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):ZO(t,a,c.spec),ZO(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));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=fH(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=fH(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(u(n)){const t=G(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(u(r))return G(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(u)})(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,e,i){var s,n,r,a,o;const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,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},h=this.seriesType;return h&&(l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(eI.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(eI.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,r,a;const o=[],l=eI.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=eI.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=eI.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(r=d.getSpecInfo(t,i))||void 0===r||r.forEach((t=>{o.push(e(d,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):xF(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=xF(t,u.specKey,u.type))||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"];return i.find((i=>{if(!s.includes(i.orient))return!1;if(u(i.seriesId)){if(G(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(u(i.seriesIndex)){if(G(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;x(n)?(t.minBandSize=n,o=!0):x(r)?(t.minBandSize=r,o=!0):x(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:_(a)?a[a.length-1]:a})}}class vH extends mH{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_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;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{d(i[t])&&(i[t]=n[t])})),P(i,"trimPadding")&&tI(i,iD(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class _H extends vH{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),QL(t)}}const yH=(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&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=eL(t,!0);for(const e in o)for(const i in o[e].nodes)rL(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)nL(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&sL(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(bL.regionSeriesDataFilterOver,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class xH{_beforeInit(){this._dataSet&&TL(this._dataSet,"stackSplit",yH)}_initStack(){this._stack=new bH(this),this._stack.init()}}const SH={state:cD.STATE_DIMENSION_HOVER,reverseState:cD.STATE_DIMENSION_HOVER_REVERSE,trigger:Mz.dimensionHover};class kH extends aF{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},SH,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=fL(i);let n;return n=_(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}kH.type="dimension-hover",kH.defaultOptions=SH;const AH=()=>{eI.registerInteractionTrigger(kH.type,kH)},MH=()=>{eI.registerComposedEvent(Mz.dimensionHover,Az),eI.registerComposedEvent(Mz.dimensionClick,_z)},wH=t=>t.fieldX[0],TH=t=>t.fieldY[0],CH=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},BH=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},EH=(t,e)=>t?e?wH:CH:e?TH:BH,PH=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=kz(t,(t=>cz(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=kz(t,(t=>dz(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{sB(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((t=>{if(d.size>0){if(d.has(t)){const s=RH(t,i,EH(e,sB(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=RH(t,i,EH(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},RH=(t,e,i)=>{const s=t.positionToData(e,!0);return d(s)?null:OH(t,s,i)},OH=(t,e,i)=>{const s=t.getScale();if(d(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=xz(e,t,"cartesian",null!=i?i:cz(t.getOrient())?wH:TH);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},IH=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:p,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,_=0,y=null;if(d.size){const t=Array.from(d.values())[0];_=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,y=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(_)&&!Number.isNaN(_),x=s&&!b&&u(p),S=x?p:{coordRange:[0,0],sizeRange:[0,0],coord:_,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:y};let k;S&&(S._isCache=x);let A=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(sB(m.type))k=m.bandwidth(),0===k&&m.step&&(A=m.step());else if(eB(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(k=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):k=1,_=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=Xz(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(a=y.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&y&&null!==(o=y.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(l=y.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&y&&null!==(h=y.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(c=y.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&y&&null!==(d=y.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(u=y.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&y&&null!==(p=y.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};DH(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=_+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=_+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&LH(S.labels[t],t,f.label)}))}t[n].bandSize=null!=k?k:0,t[n].offsetSize=A,t[n].cacheInfo=S})),t),LH=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=bF(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},DH=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},FH=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=zH(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},zH=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},jH=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return IH(c,r,e),c.xField.cacheInfo?FH(c.xField):c.yField.cacheInfo?FH(c.yField):void 0},HH=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],VH=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&HH.forEach((e=>{u(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(NH(s).every((t=>{var e;return!TF("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},NH=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{u(t.series)&&e.push(t.series)}))})),e},WH={dom:`${MI}_TOOLTIP_HANDLER_DOM`,canvas:`${MI}_TOOLTIP_HANDLER_CANVAS`},UH={key:"其他",value:"..."};var GH;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(GH||(GH={}));class YH{constructor(t){this._showTooltipByHandler=(t,e)=>{var i,s,n;if(d(t))return 1;e.changePositionOnly||this.clearCache(),this._updateViewSpec(t,e);const r=this._cacheActiveSpec;if(d(r)||!1===r.visible)return 1;e.tooltipSpec=this.component.getSpec(),e.activeTooltipSpec=r;const{title:a,content:o}=r,l=d(null==a?void 0:a.key)&&d(null==a?void 0:a.value)&&!(null==o?void 0:o.length);if(this.component.event.emit(bL.tooltipShow,Object.assign(Object.assign({},e),{isEmptyTooltip:l,tooltipData:t,activeType:this.activeType,tooltip:this.component})),l)return 1;let h;return(null===(i=r.handler)||void 0===i?void 0:i.showTooltip)?h=r.handler.showTooltip.bind(r.handler):(null===(s=this.component.tooltipHandler)||void 0===s?void 0:s.showTooltip)&&(h=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),h?null!==(n=h(this.activeType,t,e))&&void 0!==n?n:0:1},this.component=t}_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}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:p,model:g}=e;if(!p||!this._cacheActiveSpec){const p=this.component.getSpec();if(this._cacheActiveSpec=VH(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){d(this._cacheActiveSpec.handler)&&u(p.handler)&&(this._cacheActiveSpec.handler=p.handler);const g=null!==(i=p[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},UH),t):UH;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!d(e)&&TF(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class XH extends YH{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)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],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(!sB(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(u(s))break}return u(s)&&s.getDimensionField()[0]===s.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}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const $H=()=>{eI.registerTooltipProcessor("dimension",XH)};class KH extends YH{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,Xo.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(fL(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const qH=()=>{eI.registerTooltipProcessor("mark",KH)};class ZH extends YH{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:G(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?G(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return G(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=G(s)[0][a];return r.filter((t=>t[a]===o))}}const JH=()=>{eI.registerTooltipProcessor("group",ZH)};class QH extends gH{constructor(){super(...arguments),this.transformerConstructor=_H,this.type="line",this.seriesType=mO.line}_setModelOption(){this._modelOption.getDimensionInfo=PH,this._modelOption.getDimensionInfoByValue=OH,this._modelOption.getRectByDimensionData=jH}}QH.type="line",QH.seriesType=mO.line,QH.transformerConstructor=_H,U(QH,xH);const tV=[...Ez,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class eV extends Pz{constructor(){super(...arguments),this.type=eV.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return tV}_getIgnoreAttributes(){return[]}}eV.type="area";const iV=()=>{eI.registerMark(eV.type,eV),qA(),EA(),WE(),zE(),sF(),eI.registerGraphicComponent("area",ef)};class sV extends PF{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of G(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")),u(e))return e}return i}}}const nV=Object.assign(Object.assign(Object.assign({},WF),wz),{area:{name:"area",type:"area"}}),rV=()=>{eI.registerAnimation("area",eF),iF(),QD()};class aV extends Dz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!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,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_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),p=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=u(l.zIndex)||u(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||p&&!d)&&(g=h,f=l),l.style=tI({},f.style,g.style),l.state=tI({},f.state,g.state),!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),t.area=l,t.line=h}}class oV extends hz{constructor(){super(...arguments),this.type=mO.area,this.transformerConstructor=aV,this._sortDataByAxis=!1}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(oV.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var t,e,i,s,n;const r=null!==(i=null===(e=null===(t=this.getSpec().area)||void 0===t?void 0:t.style)||void 0===e?void 0:e.curveType)&&void 0!==i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,a=r===fF?"horizontal"===this._direction?"monotoneY":"monotoneX":r,o=this._areaMark;if(o){const t=this._isAreaVisible(),e=this._isLineVisible();t||e?o.setVisible(!0):o.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return RO(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),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",lD.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return RO(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",lD.Series),this.setMarkStyle(o,{fill:!!t&&this.getColorAttribute(),stroke:!!e&&this.getColorAttribute()},"normal",lD.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",lD.Series),this.getStack()&&this.setMarkStyle(o,{zIndex:t=>-t[LI]},"normal",lD.Series),this.setMarkStyle(o,{curveType:a},"normal",lD.Built_In),Object.keys(o.stateStyle).forEach((t=>{o.stateStyle[t].stroke&&o.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(ZF(null===(e=eI.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),JF("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(ZF(null===(i=eI.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),JF("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=lz(this);this._symbolMark.setAnimationConfig(ZF(null===(s=eI.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),JF("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new sV(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.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(){super.onLayoutEnd(),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&&_(l)?l[0]:l}}}oV.type=mO.area,oV.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},oV.mark=nV,oV.transformerConstructor=aV,U(oV,Tz);class lV extends vH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),QL(t)}}class hV extends gH{constructor(){super(...arguments),this.transformerConstructor=lV,this.type="area",this.seriesType=mO.area}_setModelOption(){this._modelOption.getDimensionInfo=PH,this._modelOption.getDimensionInfoByValue=OH,this._modelOption.getRectByDimensionData=jH}}hV.type="area",hV.seriesType=mO.area,hV.transformerConstructor=lV,U(hV,xH);function cV(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 dV=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:cV(t,e)}),uV=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:cV(t,e)}),pV={type:"fadeIn"},gV={type:"growCenterIn"};function fV(t,e){if(!1===e)return{};switch(e){case"fadeIn":return pV;case"scaleIn":return gV;default:return dV(t)}}class mV extends HD{constructor(){super(...arguments),this.type=mV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}mV.type="rect";const vV=()=>{qA(),YA(),LE("rect",HE),eI.registerMark(mV.type,mV),uT.registerBuiltInAnimate("growHeightIn",oC),uT.registerBuiltInAnimate("growHeightOut",lC),uT.registerBuiltInAnimate("growWidthIn",AC),uT.registerBuiltInAnimate("growWidthOut",MC),uT.registerBuiltInAnimate("growCenterIn",nC),uT.registerBuiltInAnimate("growCenterOut",rC),eI.registerGraphicComponent("rect",Ig)},_V=Object.assign(Object.assign({},WF),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function yV(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;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=WO(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[UF]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):RO(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[GF]):RO(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=RO(this._dataToPosX(t),e,i),n=RO(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[YF]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):RO(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[XF]):RO(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=RO(this._dataToPosY(t),e,i),n=RO(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},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(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},SV.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:ez(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(SV.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",lD.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===n.cartesianBandAxis));let r;if(TL(this._option.dataSet,"addVChartProperty",AF),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=d(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};TL(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();r=new Ba(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:jF.bind(this),call:HF}},!1),null==e||e.target.addListener("change",r.reRunAllTransform)}this._barBackgroundViewData=new LD(this._option,r)}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=XF,s=YF,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=GF,s=UF,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=eL(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)yV(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=RO(this[r](t),l,i),u=RO(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!OO(t[this.getStackValueField()],l)?p=0:pthis._getBarXStart(t,n),x1:t=>this._getBarXEnd(t,n),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",lD.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",lD.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.setMarkConfig({clip:!0,clipPath:()=>{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[II],n=t[LI],r=t[DI],h=t[FI];i=Math.min(i,e,n),s=Math.max(s,e,n),u(r)&&u(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]),{[II]:i,[LI]:s}),a?{[DI]:o,[FI]:l}:void 0),d="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)};t.push(Ig(Object.assign(Object.assign({},d),{cornerRadius:c(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(d,h,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),t}})}initLinearRectMarkStyle(){var t,e,i,s;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);if("horizontal"===this.direction){const t=u(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,r,!0)[0],y1:t=>this._getLinearBarYRange(t,r,!0)[1]}:{y:t=>RO(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,r,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,n,!0),x1:t=>this._getBarXEnd(t,n,!0)},t),"normal",lD.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(n),x1:()=>this._getBarBackgroundXEnd(n)},t),"normal",lD.Series)}else{const t=u(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,n,!0)[0],x1:t=>this._getLinearBarXRange(t,n,!0)[1]}:{x:t=>RO(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,n,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},t),{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r)}),"normal",lD.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},t),{y:()=>this._getBarBackgroundYStart(r),y1:()=>this._getBarBackgroundYEnd(r)}),"normal",lD.Series)}}_initBandBarBackgroundMarkStyle(){var t,e,i,s,n;if(!this._barBackgroundMark)return;const r=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),a=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),o=null!==(n=this._spec.barBackground)&&void 0!==n?n:{},l=d(o.fieldLevel)?void 0:o.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r),y:t=>this._getPosition(this.direction,t,l,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,l),width:()=>{},y1:()=>{}},"normal",lD.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,l,"barBackground"),y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a),width:()=>this._getBarWidth(this._xAxisHelper,l),x1:()=>{},height:()=>{}},"normal",lD.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=$(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=lz(this);this._barMark.setAnimationConfig(ZF(null===(e=eI.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),JF(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=d(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=u(this._spec.barWidth)&&r===n,l=u(this._spec.barMinWidth),h=u(this._spec.barMaxWidth);let c=a;return o&&(c=WO(this._spec.barWidth,a)),l&&(c=Math.max(c,WO(this._spec.barMinWidth,a))),h&&(c=Math.min(c,WO(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,p;"horizontal"===t?(h=this.getYAxisHelper(),c="height",p="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",p="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=d(i)?f:Math.min(f,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,m-1))&&void 0!==r?r:6,_=m===f?this._barMark.getAttribute(c,e):v;if(m>1&&u(this._spec.barGapInGroup)){const t=this._groups.fields,i=G(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=WO(null!==(l=i[r-1])&&void 0!==l?l:Y(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=eB(g.type||"band");return p(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(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}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}}SV.type=mO.bar,SV.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},SV.mark=_V,SV.transformerConstructor=xV;const kV=()=>{hH(),vV(),eI.registerAnimation("bar",((t,e)=>({appear:fV(t,e),enter:dV(t,!1),exit:uV(t,!1),disappear:{duration:qD.disappear.duration}}))),Uj(),Hj(),eI.registerSeries(SV.type,SV)};class AV extends vH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),QL(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=p(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 MV extends gH{constructor(){super(...arguments),this.transformerConstructor=AV,this.type="bar",this.seriesType=mO.bar}_setModelOption(){this._modelOption.getDimensionInfo=PH,this._modelOption.getDimensionInfoByValue=OH,this._modelOption.getRectByDimensionData=jH}}MV.type="bar",MV.seriesType=mO.bar,MV.transformerConstructor=AV,U(MV,xH);const wV=[10,20],TV=QC.Linear,CV="circle",BV=QC.Ordinal,EV=["circle","square","triangle","diamond","star"],PV=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},RV=Object.assign(Object.assign({},WF),{point:{name:"point",type:"symbol"}});class OV extends rz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class IV extends hz{constructor(){super(...arguments),this.type=mO.scatter,this.transformerConstructor=OV,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(c(e))return e;if(_(e)){if(d(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=`${MI}_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(p(e)){if(d(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${MI}_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 d(e)?10:x(e)?e:v(e)&&S(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:TV,defaultRange:wV},"size")}getShapeAttribute(t,e){return d(e)?CV:v(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:BV,defaultRange:EV},"shape")}initMark(){this._symbolMark=this._createMark(IV.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:ez(this._spec,IV.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=lz(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(ZF(null===(i=eI.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),JF("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const t=this._symbolMark;t&&("zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:x(this._size)||c(this._size)?this._size:10,symbolType:v(this._shape)||c(this._shape)?this._shape:CV},cD.STATE_NORMAL,lD.Series),(u(this._sizeField)||u(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},cD.STATE_NORMAL,lD.User_Mark),(u(this._shapeField)||u(this._shape))&&this.setMarkStyle(t,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},cD.STATE_NORMAL,lD.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t);const e=[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||e?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",lD.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",lD.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},cD.STATE_NORMAL,lD.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},cD.STATE_NORMAL,lD.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{if(!t)return;const e=t.getGraphics();e&&e.length&&e.forEach(((t,e)=>{var i,s;const n=null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],r=this.dataToPosition(n);r&&t&&t.translateTo(r.x,r.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){this.handleZoom(t)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}IV.type=mO.scatter,IV.mark=RV,IV.builtInTheme={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"}}}}},IV.transformerConstructor=OV;const LV=()=>{Lz(),eI.registerAnimation("scatter",((t,e)=>Object.assign({appear:PV(0,e)},ZD))),Uj(),Hj(),eI.registerSeries(IV.type,IV)};class DV extends vH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class FV extends gH{constructor(){super(...arguments),this.transformerConstructor=DV,this.type="scatter",this.seriesType=mO.scatter}_setModelOption(){this._modelOption.getDimensionInfo=PH,this._modelOption.getDimensionInfoByValue=OH,this._modelOption.getRectByDimensionData=jH}}FV.type="scatter",FV.seriesType=mO.scatter,FV.transformerConstructor=DV,U(FV,xH);const zV=()=>{$H(),qH(),MH(),AH(),LV(),eI.registerChart(FV.type,FV)};class jV extends az{constructor(){super(...arguments),this.type=mO.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 d(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(d(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return d(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=`${MI}_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 HV=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[BI]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[ZI]=e.nameMap[n]:t[ZI]=n})),t.features);class VV extends PF{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 NV extends HD{constructor(){super(...arguments),this.type=NV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}NV.type="path";const WV=()=>{eI.registerMark(NV.type,NV),qA(),NA(),eI.registerGraphicComponent("path",Jg)},UV=Object.assign(Object.assign({},WF),{area:{name:"area",type:"path"}});class GV{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Oa(i,e):Pa[i]?(Ea[i]||(Ea[i]=Oa(i,Pa[i])),Ea[i]):null}(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 YV{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(){}}class XV{constructor(){this._lastScale=0}clearZoom(){this._lastScale=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 $V(t){return t===s["desktop-browser"]||t===s["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:YV}:Gy(t)||Yy(t)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:XV}:null}const KV={debounce:bt,throttle:xt};class qV{constructor(){this._isGestureListener=!1}initZoomable(t,e=s["desktop-browser"]){this._eventObj=t,this._renderMode=e,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=Gy(this._renderMode)||Yy(this._renderMode),$V(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return $V(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(d(r))return;if(!Se({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{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(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:SL.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:SL.chart,consume:!1}];l.on(...c,KV[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,KV[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||$V(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||$V(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 d(r)&&d(a)?s:Se({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:SL.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:SL.chart,consume:!1}];l.on(...c,KV[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,KV[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){$V(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||$V(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(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:SL.chart},(t=>{if(!t.event)return;const{event:n}=t;Se({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:SL.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||$V(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:SL.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||$V(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:SL.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:SL.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:SL.chart,source:xL.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:SL.chart,source:xL.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=KV[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=KV[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:SL.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:SL.chart,source:xL.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:SL.chart,source:xL.chart},this._handleDragMouseUp)}))}}function ZV(t,e){return`${MI}_${e}_${t}`}class JV extends mj{constructor(){super(...arguments),this.type=n.geoCoordinate,this.name=n.geoCoordinate,this.layoutType="none",this.layoutZIndex=aD.Mark,this._projectionSpec={name:ZV(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;const l=u(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,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,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):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,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(d(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:n.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=tI(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var t,e,i;this.event.on(bL.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:s}=this._spec;if(s){let n=!0,r=!0,a=!1;!0!==s&&(n=null===(t=s.zoom)||void 0===t||t,r=null===(e=s.drag)||void 0===e||e,a=null!==(i=s.blank)&&void 0!==i&&i),n&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!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 GV(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===mO.map||e.type===mO.pictogram?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(d(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(d(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(d(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(d(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(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),cO(this._regions,(t=>{var e;if(t.type===mO.map||t.type===mO.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ne})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==mO.map&&e.type!==mO.pictogram||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[ZI],s=t.getDatumCenter(e);i&&u(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!N(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}JV.type=n.geoCoordinate,U(JV,qV);const QV=()=>{eI.registerComponent(JV.type,JV)};class tN extends rz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class eN extends jV{constructor(){super(...arguments),this.type=mO.map,this.transformerConstructor=tN,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 !`),BL.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),TL(this._dataSet,"copyDataView",LL),TL(this._dataSet,"map",HV),TL(this._dataSet,"lookup",SF);const i=BL.get(this.map);i||null===(t=this._option)||void 0===t||t.onError("no valid map data found!");const s=new Ba(this._dataSet,{name:`map_${this.id}_data`});s.parse([i],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:jL.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:ZI,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 LD(this._option,s)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(eN.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:ez(this._spec,eN.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>{var e,i,s,n;return u(t[null!==(e=this._seriesField)&&void 0!==e?e:PI])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:PI]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",lD.Series),t.setPostProcess("fill",(t=>u(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(t,{smoothScale:!0},"normal",lD.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(ZF(null===(t=eI.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),JF("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new VV(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[BI]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[BI],{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;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ne}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ne}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}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 BI}getActiveMarks(){return[this._pathMark]}}eN.type=mO.map,eN.mark=UV,eN.builtInTheme={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"}}}}},eN.transformerConstructor=tN;const iN=`${MI}_waterfall_default_seriesField`,sN=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n,calculationMode:r}=e,a=[],{dimensionValues:o,dimensionData:l}=n().latestData;let h=Array.from(o[i]);"decrease"===r&&(h=h.reverse());let c={start:0,end:0,positive:0,negative:0,lastIndex:null};return h.forEach(((t,i)=>{const n={start:c.end,end:c.end,lastIndex:c.lastIndex,lastEnd:c.end,index:t,isTotal:!1,positive:c.end,negative:c.end},r=!0===e.stackInverse?l[t].reverse():l[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[NI]=!0:delete t[NI]})),r.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===h.length-1)return!0;return!1};if(r.some((t=>o(t))))return c=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,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=nN([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 f=g[0];let{start:m,end:v}=rN(f,i,s,n,u);i.start=m,i.end=v;let _=m,y=m,b=v-m;const x=p.reduce(((t,e)=>ie(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=ee(_,e)):(t[c]=+y,y=ee(y,e)),t[d]=ee(t[c],e),m=ee(m,e),b=ie(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,n,a,c,h,i,e,o),void a.push(n)}c=nN(r,t,n,a,c,h,i,e),a.push(n)})),a};function nN(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:u,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(u&&"end"!==u.type){if("field"===u.type||"custom"===u.type){if(t[u.tagField]){e=!0;const{start:r,end:a}=rN(t,i,s,n,u);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=ee(i.positive,e)):(t[h]=+i.negative,i.negative=ee(i.negative,e)),t[c]=ee(t[h],e),i.end=ee(i.end,e)}i.isTotal=e,(d(p)||p===iN)&&(t[iN]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function rN(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&&!d(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?jy("total.collectCountField error"):n=e[a].start;o<0?jy("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!d(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!d(t[i.valueField])&&(n=ee(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 aN=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>ee(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?t.unshift(o):t.push(o),t},oN={type:"fadeIn"},lN={type:"growCenterIn"};function hN(t,e){switch(e){case"fadeIn":return oN;case"scaleIn":return lN;default:return dV(t,!1)}}class cN extends HD{constructor(){super(...arguments),this.type=cN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(e,i,s){const n=super._transformGraphicAttributes(e,i,s),{x:r,x1:a,y:o,y1:l}=n,h=t(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return Eg(t)}}cN.type="rule";const dN=()=>{eI.registerMark(cN.type,cN),qA(),HA(),eI.registerGraphicComponent("line",Eg)},uN=Object.assign(Object.assign({},_V),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),pN=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:gN(t.map((t=>t.latestData)).flat(),e.fields,i)}};function gN(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)=>gN(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class fN{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 Ba(e instanceof Ca?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),TL(e,"dimensionTree",pN),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 mN extends xV{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const vN={rect:kN,symbol:xN,arc:MN,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=xN(t);h(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:wN,line:TN,area:TN,rect3d:kN,arc3d:MN,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function _N(t,e){var i;const{labelSpec:s}=e;s.overlap&&!p(s.overlap)&&(s.overlap={});const n=null!==(i=vN[t])&&void 0!==i?i:vN.point;return e.series.type===mO.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=bN(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;v(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!v(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:CN(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function yN(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==mO.sankey){const{formatFunc:t,args:n}=bF(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function bN(t){return c(t)?e=>t(e.data):t}function xN(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=bN(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:SN(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function SN(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function kN(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=bN(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;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:AN(o)};let g=!1;return v(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function AN(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 MN(t){var e;const{labelSpec:i}=t,s=null!==(e=bN(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:v(s)&&s.includes("inside"),{position:n,smartInvert:r}}function wN(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=yN(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),Ag(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 TN(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}))):[{index:0,[PI]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function CN(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class BN extends SV{constructor(){super(...arguments),this.type=mO.waterfall,this.transformerConstructor=mN,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&sL(t,e)}}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 fN(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]],d(this._seriesField)&&(this._seriesField=iN)}getSeriesKeys(){return this._seriesField===iN?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t,e,i;super.initData(),TL(this._dataSet,"waterfallFillTotal",aN),TL(this._dataSet,"waterfall",sN),(d(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,calculationMode:null!==(e=this._spec.calculationMode)&&void 0!==e?e:"increase",stackInverse:this.getRegion().getStackInverse()}},!1));const s=DL(this.getViewData(),this._dataSet,{name:`${MI}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",s.reRunAllTransform),this._totalData=new LD(this._option,s),s.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:II,endAs:LI,total:this._spec.total,calculationMode:null!==(i=this._spec.calculationMode)&&void 0!==i?i:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}},!1),s.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}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=lz(this);this._barMark.setAnimationConfig(ZF(null===(i=eI.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),JF("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(ZF(null===(s=eI.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),JF("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(){super.initMark();const t=this._createMark(BN.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:ie(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:ie(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return wN(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?RO(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):RO(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle();const t="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:e=>e.lastIndex?this.totalPositionY(e,"lastIndex",t?0:1):0,y1:e=>this.totalPositionY(e,"index",t?1:0)},"normal",lD.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:e=>e.lastIndex?this.totalPositionX(e,"lastIndex",t?0:1):0,x1:e=>this.totalPositionX(e,"index",t?1:0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",lD.Series))}isVisibleLeaderLine(t){return!d(t.lastIndex)&&OO([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}BN.type=mO.waterfall,BN.mark=uN,BN.builtInTheme={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}}}},BN.transformerConstructor=mN;const EN=()=>{dN(),vV(),eI.registerAnimation("waterfall",((t,e)=>({appear:hN(t,e),enter:dV(t,!1),exit:uV(t,!1),disappear:{duration:qD.disappear.duration}}))),tF(),Uj(),Hj(),eI.registerSeries(BN.type,BN)},PN=`${MI}_BOX_PLOT_OUTLIER_VALUE`;var RN;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(RN||(RN={}));const ON=(t,e)=>{const i=[],{outliersField:s,dimensionField:n,seriesField:r}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];_(e)||(e=[e]),i.push(...e.map((e=>{const i={[PN]:e};return n.forEach((e=>{i[e]=t[e]})),u(r)&&(i[r]=t[r]),i})))})),i};class IN extends PF{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===RN.OUTLIER)return this.series.getOutliersField();if(t===RN.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case RN.MIN:return this.series.getMinField();case RN.MAX:return this.series.getMaxField();case RN.MEDIAN:return this.series.getMedianField();case RN.Q1:return this.series.getQ1Field();case RN.Q3:return this.series.getQ3Field();case RN.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===RN.OUTLIER)return e[PN];if(t===RN.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case RN.MIN:return e[this.series.getMinField()];case RN.MAX:return e[this.series.getMaxField()];case RN.MEDIAN:return e[this.series.getMedianField()];case RN.Q1:return e[this.series.getQ1Field()];case RN.Q3:return e[this.series.getQ3Field()];case RN.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,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>u(t[PN])}getDefaultContentList(t){return[{key:this.getContentKey(RN.OUTLIER),value:this.getContentValue(RN.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(RN.MAX),value:this.getContentValue(RN.MAX)},{key:this.getContentKey(RN.Q3),value:this.getContentValue(RN.Q3)},{key:this.getContentKey(RN.MEDIAN),value:this.getContentValue(RN.MEDIAN)},{key:this.getContentKey(RN.Q1),value:this.getContentValue(RN.Q1)},{key:this.getContentKey(RN.MIN),value:this.getContentValue(RN.MIN)},{key:this.getContentKey(RN.SERIES_FIELD),value:this.getContentValue(RN.SERIES_FIELD)}]}}class LN extends HD{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==hD.enter&&t.context.diffState!==hD.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;return this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?z(r,i):i}})),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=Dg(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=eI.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const DN=()=>{eI.registerGraphicComponent("glyph",Dg),qA(),IA()},FN=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],zN=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class jN extends LN{constructor(){super(...arguments),this.type=jN.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=FN,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=zN,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}jN.type="boxPlot";const HN=Object.assign(Object.assign({},WF),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),VN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},NN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},WN=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),UN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,M;if(i&&k(i.center))return i.center;let w,T,C,B,E;if("horizontal"===e){w=null===(r=null===(n=(null===(s=WN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,T=null===(h=null===(l=null===(o=null===(a=WN(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,C=null===(p=null===(u=null===(d=null===(c=WN(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=WN(t,"box").attribute.width,i=WN(t,"box").attribute.x;B=i,E=i+e}else{w=null===(m=null===(f=(null===(g=WN(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,T=null===(b=null===(y=null===(_=null===(v=WN(t,"max"))||void 0===v?void 0:v.attribute)||void 0===_?void 0:_.points)||void 0===y?void 0:y[0])||void 0===b?void 0:b.y,C=null===(M=null===(A=null===(S=null===(x=WN(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===M?void 0:M.y;const e=WN(t,"box").attribute.height,i=WN(t,"box").attribute.y;B=i,E=i+e}return k(w)?w:k(B)&&k(E)?(B+E)/2:k(T)&&k(C)?(T+C)/2:k(C)?C:k(T)?T:NaN},GN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,_,y,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=WN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=WN(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=WN(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;y=i,_=i+e;const c=(null===(l=WN(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=WN(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=WN(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=WN(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=WN(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;y=i,_=i+e;const s=(null===(f=WN(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=WN(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(_)&&k(y)?(_+y)/2:k(y)?y:k(_)?_:NaN};class YN extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return VN(UN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class XN extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return NN(UN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class $N extends YN{computeAttribute(){return VN(GN)(this.target,this.params,this.params.options)}}class KN extends XN{computeAttribute(){return NN(GN)(this.target,this.params,this.params.options)}}class qN extends rz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}class ZN extends hz{constructor(){super(...arguments),this.type=mO.boxPlot,this.transformerConstructor=qN,this._bandPosition=0}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,r,a;super.setAttrFromSpec();const o=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=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(ZN.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(ZN.mark.outlier,{key:BI,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var t,e,i,s,n,r;const a=this._boxPlotMark;if(a){const i={lineWidth:this._lineWidth,fill:null!==(t=this._boxFillColor)&&void 0!==t?t:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(e=this._strokeColor)&&void 0!==e?e:"line"!==this._shaftShape?"#000":this.getColorAttribute()};a.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const s="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return WO(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return WO(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return WO(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return WO(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return WO(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return WO(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return WO(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return WO(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(a,i,cD.STATE_NORMAL,lD.Series),this.setMarkStyle(a,s,cD.STATE_NORMAL,lD.Built_In)}const o=this._outlierMark;o&&this.setMarkStyle(o,{fill:null!==(n=null!==(s=null===(i=this._outliersStyle)||void 0===i?void 0:i.fill)&&void 0!==s?s:this._boxFillColor)&&void 0!==n?n:this.getColorAttribute(),stroke:this.getColorAttribute(),size:x(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10},cD.STATE_NORMAL,lD.Series)}initBoxPlotMarkStyle(){var t,e;const i=this._boxPlotMark,s="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(i&&s){const{dataToPosition:e}=s,n=null===(t=null==s?void 0:s.getScale)||void 0===t?void 0:t.call(s,0);this.setMarkStyle(i,{min:t=>RO(e(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>RO(e(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>RO(e(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>RO(e(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>RO(e(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},cD.STATE_NORMAL,lD.Series)}const n=this._outlierMark;if(n&&s){const{dataToPosition:t}=s,i=null===(e=null==s?void 0:s.getScale)||void 0===e?void 0:e.call(s,0),r="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),x:e=>RO(t(this.getDatumPositionValues(e,PN),{bandPosition:this._bandPosition}),i)}:{x:t=>this._getPosition(this.direction,t),y:e=>RO(t(this.getDatumPositionValues(e,PN),{bandPosition:this._bandPosition}),i)};this.setMarkStyle(n,r,cD.STATE_NORMAL,lD.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;TL(this._dataSet,"foldOutlierData",ON),TL(this._dataSet,"addVChartProperty",AF);const t=new Ba(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${MI}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField}}),t.transform({type:"addVChartProperty",options:{beforeCall:jF.bind(this),call:HF}},!1),this._outlierData=new LD(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t;if(this._autoBoxWidth)return this._autoBoxWidth;const e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,i=this._groups?this._groups.fields.length:1,s=null===(t=e.getBandwidth)||void 0===t?void 0:t.call(e,i-1);let n=s;return u(this._spec.boxWidth)&&(n=WO(this._spec.boxWidth,s)),u(this._spec.boxMinWidth)&&(n=Math.max(n,WO(this._spec.boxMinWidth,s))),u(this._spec.boxMaxWidth)&&(n=Math.min(n,WO(this._spec.boxMaxWidth,s))),this._autoBoxWidth=n,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r;let a,o,l;"horizontal"===t?(a=this.getYAxisHelper(),o="boxHeight",l=this.dataToPositionY.bind(this)):(a=this.getXAxisHelper(),o="boxWidth",l=this.dataToPositionX.bind(this));const h=a.getScale(0),c=this._groups?this._groups.fields.length:1,d=null===(i=a.getBandwidth)||void 0===i?void 0:i.call(a,c-1),p=this._boxPlotMark.getAttribute(o,e);if(c>1&&u(this._spec.boxGapInGroup)){const t=this._groups.fields,i=G(this._spec.boxGapInGroup);let o=0,l=0;for(let h=t.length-1;h>=1;h--){const c=t[h],u=null!==(n=null===(s=a.getScale(h))||void 0===s?void 0:s.domain())&&void 0!==n?n:[],g=u.length,f=WO(null!==(r=i[h-1])&&void 0!==r?r:Y(i),d),m=u.indexOf(e[c]);h===t.length-1?(o+=g*p+(g-1)*f,l+=m*(p+f)):(l+=m*(o+f),o+=o+(g-1)*f)}return h.scale(e[t[0]])+a.getBandwidth(0)/2-o/2+l+p/2}const g=eB(h.type||"band");return l(e)+.5*d+(g?-d/2:0)}onLayoutEnd(){super.onLayoutEnd(),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="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=lz(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=eI.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(JF("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(ZF(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(ZF(null===(a=eI.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new IN(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}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}ZN.type=mO.boxPlot,ZN.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},ZN.mark=HN,ZN.transformerConstructor=qN;const JN=()=>{DN(),HA(),YA(),eI.registerGraphicComponent("line",(t=>Eg(t))),eI.registerGraphicComponent("rect",(t=>Ig(t))),eI.registerMark(jN.type,jN),Lz(),QD(),Uj(),Hj(),uT.registerBuiltInAnimate("boxplotScaleIn",YN),uT.registerBuiltInAnimate("boxplotScaleOut",XN),uT.registerBuiltInAnimate("barBoxplotScaleIn",$N),uT.registerBuiltInAnimate("barBoxplotScaleOut",KN),eI.registerSeries(ZN.type,ZN)};class QN extends HD{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=QN.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return p(n)&&u(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?Kg(t):Ag(t)}}QN.type="text";const tW=()=>{eI.registerMark(QN.type,QN),qA(),tM(),$A(),eI.registerGraphicComponent("text",Ag),eI.registerGraphicComponent("richtext",Kg)};class eW extends PF{constructor(){super(...arguments),this._getMeasureData=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]]}}const iW=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),sW={type:"fadeIn"},nW=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function rW(t,e){return"fadeIn"===e?sW:iW(t)}const aW=Object.assign(Object.assign({},_V),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class oW extends xV{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 lW extends SV{constructor(){super(...arguments),this.type=mO.rangeColumn,this._barMarkType="rect",this._barName=mO.bar,this.transformerConstructor=oW}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(lW.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:ez(this._spec,lW.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(lW.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(lW.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(t,e,i,s){var n,r,a,o;if(t){this.setMarkStyle(t,{fill:null!==(r=null===(n=null==e?void 0:e.style)||void 0===n?void 0:n.fill)&&void 0!==r?r:this.getColorAttribute(),text:t=>{const s="horizontal"===this._spec.direction?t[this._spec.xField[i]]:t[this._spec.yField[i]];return(null==e?void 0:e.formatMethod)?e.formatMethod(s,t):s}});!function(t,e,i,s,n,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if("vertical"===l())return"center";const e=n(t),s=r(t);if("middle"===i)return"center";if(e>=s){if("start"===i)return"left";if("end"===i)return"right";if("outside"===i)return"left"}else{if("start"===i)return"right";if("end"===i)return"left";if("outside"===i)return"right"}return"center"},textBaseline:t=>{if("horizontal"===l())return"middle";const e=a(t),s=o(t);if("middle"===i)return"middle";if(s>=e){if("start"===i)return"bottom";if("end"===i)return"top";if("outside"===i)return"bottom"}else{if("start"===i)return"top";if("end"===i)return"bottom";if("outside"===i)return"top"}return"middle"}}),t.setMarkStyle(e,{x:t=>{const e=l(),a=n(t),o=r(t);if("vertical"===e)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+s;if("end"===i)return a-s;if("outside"===i)return a+s}else{if("start"===i)return o-s;if("end"===i)return a+s;if("outside"===i)return a-s}return(a+o)/2},y:t=>{const e=l(),n=a(t),r=o(t);if("horizontal"===e)return(n+r)/2;if("middle"===i)return(n+r)/2;if(n>=r){if("start"===i)return r+s;if("end"===i)return n-s;if("outside"===i)return n+s}else{if("start"===i)return r-s;if("end"===i)return n+s;if("outside"===i)return n-s}return(n+r)/2}},"normal",lD.Series)}(this,t,null!==(a=null==e?void 0:e.position)&&void 0!==a?a:s,null!==(o=null==e?void 0:e.offset)&&void 0!==o?o:"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=lz(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(ZF(null===(i=eI.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),JF("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(ZF(null===(s=eI.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),JF("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(ZF(null===(n=eI.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),JF("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new eW(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)}}lW.type=mO.rangeColumn,lW.mark=aW,lW.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},lW.transformerConstructor=oW;const hW=()=>{vV(),tW(),eI.registerAnimation("rangeColumn",((t,e)=>({appear:rW(t,e),enter:iW(t),exit:nW(t),disappear:{duration:qD.disappear.duration}}))),tF(),Uj(),Hj(),eI.registerSeries(lW.type,lW)};var cW,dW;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(cW||(cW={})),function(t){t.middle="middle",t.start="start",t.end="end"}(dW||(dW={}));class uW extends PF{constructor(){super(...arguments),this._getMeasureData=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]]}}const pW=Object.assign({},nV);class gW extends oV{constructor(){super(...arguments),this.type=mO.rangeArea}initMark(){this._areaMark=this._createMark(gW.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const t=this._areaMark;t&&(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",lD.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",lD.Series),this.setMarkStyle(t,{stroke:!1},"normal",lD.Series))}initTooltip(){this._tooltipHelper=new uW(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}gW.type=mO.rangeArea,gW.mark=pW;class fW extends az{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=cj,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=u(t)?G(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=u(t)?G(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=G(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(d(t)||d(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(G(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(G(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}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:[]};eB(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:[]};eB(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),u(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),u(this._spec.radius)&&(this._outerRadius=this._spec.radius),u(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),u(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(bL.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)&&oz(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}}function mW(t){return Ky(t)?Number.parseFloat(t):0}const vW=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&_W(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=pe(e+a/2)};let _=0,y=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let k=p,A=S,M=0;const w=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))}(x);if(m.forEach(((t,e)=>{const i=t[tj],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=A/M;k=p,m.forEach((e=>{const i=e[r]===f?f:e[tj]*t;v(e,k,i),k+=i}))}if(0!==_&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},_W=(t,e,i)=>!!d(t)||(0===t.length||(!!t.every((t=>0===mW(t[e])))||!i&&0===t.reduce(((t,i)=>t+mW(i[e])),0)));function yW(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const bW=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:yW(t,!0,HL.appear)}),xW={type:"fadeIn"},SW=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:yW(t,!0,HL.enter)}),kW=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:yW(t,!0,HL.exit)});function AW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return xW;case"growRadius":return bW(Object.assign(Object.assign({},t),{growField:"radius"}));default:return bW(Object.assign(Object.assign({},t),{growField:"angle"}))}}class MW extends HD{constructor(t,e){super(t,e),this.type=wW.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>le({x:0,y:0},this.getAttribute("centerOffset",e,i),e[rj])[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 wW extends MW{constructor(){super(...arguments),this.type=wW.type}}wW.type="arc";const TW=()=>{qA(),CA(),LE("arc",YE),uT.registerBuiltInAnimate("growRadiusIn",xC),uT.registerBuiltInAnimate("growRadiusOut",SC),uT.registerBuiltInAnimate("growAngleIn",iC),uT.registerBuiltInAnimate("growAngleOut",sC),eI.registerGraphicComponent("arc",rf),eI.registerMark(wW.type,wW)},CW=Object.assign(Object.assign({},WF),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class BW extends rz{_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=tI({},this._theme,i,t);const n=(t,e)=>tI({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);_(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 u(s)&&(i.centerX=s),u(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const EW=`${MI}_LABEL_VISIBLE`;class PW extends fW{constructor(){super(...arguments),this.transformerConstructor=BW,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:zO(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:zO(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=lj,this._endAngle=hj,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[rj];if(d(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return le(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;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 a=function(t,e){let i=0,s=2*Math.PI;const n=u(t),r=u(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}}(u(this._spec.startAngle)?re(this._spec.startAngle):this._startAngle,u(this._spec.endAngle)?re(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=u(this._spec.padAngle)?re(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=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;TL(this._dataSet,"pie",vW),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>u(this._spec.minAngle)?re(this._spec.minAngle):0,asStartAngle:ij,asEndAngle:sj,asRatio:ej,asMiddleAngle:rj,asRadian:oj,asQuadrant:aj,asK:nj,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new Ba(this._dataSet,{name:`${MI}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new LD(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},PW.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:EI,groupKey:this._seriesField,isSeriesMark:!0},{morph:ez(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return pO(ij)(t)}endAngleScale(t){return pO(sj)(t)}_computeLayoutRadius(){return dj((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const t={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:IO(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:IO(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},e=this._pieMark;e&&this.setMarkStyle(e,t,"normal",lD.Series);const i=this._emptyArcMark;i&&this.setMarkStyle(i,Object.assign(Object.assign({},t),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",lD.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(t,e){if(super.initMarkStyleWithSpec(t,e),t.name===this._pieMarkName){const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,lD.User_Mark)}"emptyCircle"===t.name&&this.setMarkStyle(t,this.generateRadiusStyle(e.style),"normal",lD.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:pO(EW).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(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(bL.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*(d(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[rj];if(d(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return le(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===HL.appear)return this._startAngle;if(i===HL.disappear)return this._endAngle;const r=[HL.disappear,HL.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[BI];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[BI]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[BI])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[BI])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+le({x:0,y:0},a,e[rj]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+le({x:0,y:0},a,e[rj]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+le({x:0,y:0},a,e[rj]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+le({x:0,y:0},a,e[rj]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=ZF(null===(i=eI.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}PW.transformerConstructor=BW,PW.mark=CW,PW.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class RW extends PW{constructor(){super(...arguments),this.type=mO.pie}}RW.type=mO.pie;const OW=()=>{TW(),eI.registerAnimation("pie",((t,e)=>({appear:AW(t,e),enter:SW(t),exit:kW(t),disappear:{duration:qD.disappear.duration}}))),eI.registerAnimation("emptyCircle",((t,e)=>({appear:AW(t,e)}))),eI.registerSeries(RW.type,RW)};function IW(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const LW=t=>({type:IW(t.growField),options:{overall:!0}}),DW={type:"fadeIn"},FW=t=>({type:IW(t.growField)}),zW=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function jW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return DW;case"growAngle":return LW(Object.assign(Object.assign({},t),{growField:"angle"}));default:return LW(Object.assign(Object.assign({},t),{growField:"radius"}))}}class HW extends fW{getStackGroupFields(){return this._angleField}getStackValueField(){return G(this._spec.valueField)[0]||G(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(LI),this.setInnerRadiusField(II)}setValueFieldToPercent(){this.setRadiusField(FI),this.setInnerRadiusField(DI)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const VW=Object.assign(Object.assign({},WF),{rose:{name:"rose",type:"arc"}});class NW extends rz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class WW extends Sj{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=_(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let r,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:p,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((t,e)=>{var i,s,r,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${n.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,p=null!==(r=t.endAngle)&&void 0!==r?r:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=p?p:u(d)?d+360:270,center:u(e.center)?e.center:u(null==e?void 0:e.centerX)||u(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.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=p,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const _={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(_),"radius"===i.orient?(o.push(_),a=h):(l.push(_),r=h)})),o.forEach((t=>{t.angleAxisIndex=r})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]),r=eI.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(t,e){super(t,e),this.type=n.polarAxis,this.name=n.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=aD.Axis,this._tick=void 0,this._center=null,this._startAngle=lj,this._endAngle=hj,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),cO(this._regions,(t=>{"radius"===this.getOrient()?Jz(t.radiusAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):Jz(t.angleAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(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.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:zO(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:zO(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this.visible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=re(this._spec.startAngle),this._endAngle=re(this._spec.endAngle),this._inverse=this._spec.inverse}_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:Xz(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}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(){cO(this._regions,(t=>{"radius"===this.getOrient()?Jz(t.radiusAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):Jz(t.angleAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(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 eB(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:eB(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 le(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return he(t,this.getCenter(),this._startAngle,this._endAngle)}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=>Zz(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_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=ne.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",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(u(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return dj((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=cj,e=0;const i=this.getChart().getSpec();return cO(this.getRegions(),(s=>{const n=s;if(r=n.type,[mO.rose,mO.radar,mO.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(e){const{grid:i}=e,s=t(e,["grid"]);if(this._axisMark.getComponent().setAttributes(tI({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(tI({},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)}}WW.type=n.polarAxis,WW.specKey="axes";const UW={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},GW={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class YW extends WW{constructor(){super(...arguments),this.type=n.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new GB}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}registerTicksTransform(){const t=`${this.type}-ticks`;return TL(this._option.dataSet,t,tE),t}}YW.type=n.polarLinearAxis,YW.specKey="axes",YW.builtInTheme={axis:zj,axisLinear:Lj,axisAngle:GW,axisRadius:UW},U(YW,Ij);const XW=()=>{eI.registerGraphicComponent(vj.lineAxis,((t,e)=>new NC(t,e))),eI.registerGraphicComponent(_j.lineAxisGrid,((t,e)=>new JE(t,e))),eI.registerGraphicComponent(vj.circleAxis,((t,e)=>new $C(t,e))),eI.registerGraphicComponent(_j.circleAxisGrid,((t,e)=>new sP(t,e))),kj(),eI.registerComponent(YW.type,YW)};class $W extends WW{constructor(){super(...arguments),this.type=n.polarBandAxis,this._scale=new AB}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)}registerTicksTransform(){const t=`${this.type}-ticks`;return TL(this._option.dataSet,t,lE),t}transformScaleDomain(){}}$W.type=n.polarBandAxis,$W.specKey="axes",$W.builtInTheme={axis:zj,axisBand:Nj,axisAngle:GW,axisRadius:UW},U($W,Vj);const KW=()=>{eI.registerGraphicComponent(vj.lineAxis,((t,e)=>new NC(t,e))),eI.registerGraphicComponent(_j.lineAxisGrid,((t,e)=>new JE(t,e))),eI.registerGraphicComponent(vj.circleAxis,((t,e)=>new $C(t,e))),eI.registerGraphicComponent(_j.circleAxisGrid,((t,e)=>new sP(t,e))),kj(),eI.registerComponent($W.type,$W)};class qW extends HW{constructor(){super(...arguments),this.type=mO.rose,this.transformerConstructor=NW,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(){this._roseMark=this._createMark(qW.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:ez(this._spec,qW.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}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=>RO(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=RO(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(ZF(null===(i=eI.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),JF("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}qW.type=mO.rose,qW.mark=VW,qW.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},qW.transformerConstructor=NW;const ZW=()=>{eI.registerSeries(qW.type,qW),TW(),eI.registerAnimation("rose",((t,e)=>({appear:jW(t,e),enter:FW(t),exit:zW(t),disappear:{duration:qD.disappear.duration}}))),KW(),XW()};class JW extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:le(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=he(this.from,this._prevCenter),{angle:i,radius:s}=he(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,eO(this._fromAngle,this._toAngle)&&eO(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=le({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class QW extends XT{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!hO(t)&&!hO(e))return e;const s=he(t,this._prevCenter),n=he(e,this._center);let r=de(s.angle),a=de(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return le({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new se(s,n,r,a);return o.defined=e.defined,o}}const tU=t=>({type:"in"===t?"fadeIn":"fadeOut"});function eU(t,e,i){return"fadeIn"===e?tU(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function iU(t,e,i){return"fadeIn"===e?tU(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 sU=(t,e)=>({custom:GT,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),nU=Object.assign(Object.assign(Object.assign({},WF),wz),{area:{name:"area",type:"area"}});class rU extends HW{constructor(){super(...arguments),this.type=mO.radar,this.transformerConstructor=Dz,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!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),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(rU.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const t=this._areaMark;t&&(this.setMarkStyle(t,{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:mF,closePath:!0},"normal",lD.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",lD.Series),this.event.on(bL.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.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:u(this._spec.startAngle)?re(this._spec.startAngle):lj},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(ZF(null===(s=eI.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),JF("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(u(t)){const i=eI.getAnimationInKey(e);t.setAnimationConfig(ZF(null==i?void 0:i(n,r),JF(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&&_(a)?a[0]:a}}}rU.type=mO.radar,rU.mark=nU,rU.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},rU.transformerConstructor=Dz,U(rU,Tz);const aU=()=>{eI.registerSeries(rU.type,rU),iV(),Oz(),Lz(),eI.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:eU(t,e,"in"),enter:eU(t,e,"in"),exit:eU(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:qD.disappear.duration},update:[{channel:["points","center"],custom:QW,customParameters:t,duration:qD.update.duration,easing:qD.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),eI.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:iU(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:qD.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:JW,customParameters:t,duration:qD.update.duration,easing:qD.update.easing}]}))),eI.registerAnimation("radarGroup",((t,e)=>({appear:sU(t,"in"),disappear:{duration:qD.disappear.duration}}))),CA(),KW(),XW()};class oU extends PF{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>gi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const lU=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(MI)||(i[n]=t[n],s=u(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[BI]:r,[EI]:`${s}_${e}`})),r++}))})),n},hU={fill:"#bbb",fillOpacity:.2},cU=Object.assign(Object.assign({},WF),{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"}});class dU extends hz{constructor(){super(...arguments),this.type=mO.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){u(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){u(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){u(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){u(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){u(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){u(t)&&(this._gridBackground=t)}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),TL(this._option.dataSet,"objFlat",lU),TL(this._option.dataSet,"copyDataView",LL),CL(this._option.dataSet,"dataview",Ma),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:jL.dotObjFlat},!1)}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(tI(hU,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(dU.mark.group),this._containerMark=this._createMark(dU.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(dU.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(dU.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(dU.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(dU.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(dU.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(dU.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var t;const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-(null!==(t=this._spec.leftAppendPadding)&&void 0!==t?t:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",lD.Series),e.setMarkConfig({interactive:!1,clip:!0}));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",lD.Series),i.setMarkConfig({interactive:!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",lD.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",lD.Series);const r=this._dotMark;r&&this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",lD.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",lD.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",lD.Series);const l=this._symbolMark;l&&this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",lD.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(){var t,e;super.onLayoutEnd();const i=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.leftAppendPadding)&&void 0!==e?e:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+i},"normal",lD.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:PI}}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 BO).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:PI}}initTooltip(){this._tooltipHelper=new oU(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}dU.type=mO.dot,dU.mark=cU,dU.builtInTheme={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"}}}}};class uU extends PF{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>gi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const pU=Object.assign(Object.assign({},WF),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),gU=(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 fU extends hz{constructor(){super(...arguments),this.type=mO.link}getFromField(){return this._fromField}setFromField(t){u(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){u(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){u(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){u(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(),TL(this._option.dataSet,"linkDotInfo",gU),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:jL.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(fU.mark.group),this._containerMark=this._createMark(fU.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(fU.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(fU.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var t,e,i,s;const n=this._clipMark;n&&(this.setMarkStyle(n,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",lD.Series),n.setMarkConfig({interactive:!1,clip:!0}));const r=this._containerMark;r&&(this.setMarkStyle(r,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",lD.Series),r.setMarkConfig({interactive:!1}));const a=this._linkMark;a&&this.setMarkStyle(a,{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",lD.Series);const o=this._arrowMark;if(o){const n=null!==(s=null===(i=null===(e=null===(t=this._theme)||void 0===t?void 0:t.arrow)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size)&&void 0!==s?s:10;this.setMarkStyle(o,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,n),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:n,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",lD.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:PI}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new uU(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}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]}}fU.type=mO.link,fU.mark=pU,fU.builtInTheme={link:{arrow:{style:{size:10}}}};const mU=Object.assign(Object.assign({},WF),{group:{name:"group",type:"group"}});class vU extends fW{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()?II:$I],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=re(i.offsetAngle);let o;if(u(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 d(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()?LI:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=re(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=u(n)?re(n):lj;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=u(r)?re(r):hj,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)||u(null==s?void 0:s.startAngle)||u(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=RO(this.angleAxisHelper.dataToPosition([t[II]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=RO(this.angleAxisHelper.dataToPosition([t[LI]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?RO(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(vU.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const t=this._arcGroupMark;t.created(),this.setMarkStyle(t,{x:0,y:0},"normal",lD.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+re(a),o=re(r)/2;return rf(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[Ig({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_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 xU=()=>{eI.registerAnimation("circularProgress",((t,e)=>({appear:bU(t,e),enter:{type:"growAngleIn"},disappear:{duration:qD.disappear.duration}})))};class SU extends rz{constructor(){super(...arguments),this._supportStack=!0}}class kU extends vU{constructor(){super(...arguments),this.type=mO.circularProgress,this.transformerConstructor=SU,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(){return this._progressMark=this._createMark(kU.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:ez(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var t;const e=this._progressMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",lD.Series)}getInteractionTriggers(){const t=[];return 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(){return this._trackMark=this._createMark(kU.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&this.setMarkStyle(t,{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()?II:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?LI: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",lD.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(ZF(null===(i=eI.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),JF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(ZF(null===(s=eI.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),JF("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}kU.type=mO.circularProgress,kU.mark=_U,kU.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},kU.transformerConstructor=SU;const AU=()=>{eI.registerSeries(kU.type,kU),TW(),xU(),tF(),KW(),XW()};function MU(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const wU={type:"fadeIn"};function TU(t,e="grow"){return!1===e?{}:"fadeIn"===e?wU:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:MU(t)}))(t)}class CU extends PF{enableByType(t){return"dimension"!==t}}const BU=Object.assign(Object.assign({},WF),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class EU extends hz{constructor(){super(...arguments),this.type=mO.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=u(e.width)?e.width:e.x1-e.x,o=u(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(EU.mark.progress,{isSeriesMark:!0}),d(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var t,e,i,s;const n=this._progressMark;if(n)if("vertical"===this._spec.direction){const i=this._spec.progress||{},s=null!==(t=i.leftPadding)&&void 0!==t?t:0,r=null!==(e=i.rightPadding)&&void 0!==e?e:0;this.setMarkStyle(n,{x:t=>{var e,i;return RO(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),!0)-this._spec.bandWidth/2+s},y1:t=>{var e,i;return RO(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))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?RO(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-s-r,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",lD.Series)}else{const t=this._spec.progress||{},e=null!==(i=t.topPadding)&&void 0!==i?i:0,r=null!==(s=t.bottomPadding)&&void 0!==s?s:0;this.setMarkStyle(n,{x1:t=>{var e,i;return RO(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))},y:t=>{var i,s;return RO(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),!0)-this._spec.bandWidth/2+e},height:this._spec.bandWidth-e-r,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?RO(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",lD.Series)}}_initTrackMark(){return this._trackMark=this._createMark(EU.mark.track),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>{var e,i;return RO(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),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",lD.Series):this.setMarkStyle(t,{x:0,y:t=>{var e,i;return RO(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),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",lD.Series))}getInteractionTriggers(){const t=[];return 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(ZF(null===(i=eI.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),JF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(ZF(null===(s=eI.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),JF("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new CU(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}EU.type=mO.linearProgress,EU.mark=BU,EU.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const PU=()=>{vV(),eI.registerAnimation("linearProgress",((t,e)=>({appear:TU(t,e),enter:TU(t),disappear:{duration:qD.disappear.duration}}))),tF(),eI.registerSeries(EU.type,EU)},RU=[0],OU=[20,40],IU=[200,500],LU={shrink:!1,enlarge:!1,fontSizeLimitMin:0},DU=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class FU{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const zU=`${MI}_WORD_CLOUD_TEXT`,jU=Object.assign(Object.assign({},WF),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),HU={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic",scaleX:1,scaleY:1}}};class VU extends az{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},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._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){u(t)&&(this._valueField=t)}setFontSizeRange(t){u(t)?this._fontSizeRange=t:this._fontSizeRange=OU}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,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:IU,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:RU,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?zU:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:LU},this._spec.wordCloudConfig),r&&!d(r.layoutMode)||Uy(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:RU,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!DU.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new FU(1e3))}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",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var t;this._wordMark=this._createMark(VU.mark.word,{key:EI,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(t=this._spec.wordMask)||void 0===t?void 0:t.visible)&&(this._maskMark=this._createMark(VU.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:aD.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",lD.Series)}initMarkStyleOfWord(t,e,i,s,n){var r,a;t&&(this.setMarkStyle(t,{text:(null==e?void 0:e.formatMethod)?t=>e.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",lD.Series),this.setMarkStyle(t,{fill:null!==(a=null===(r=null==e?void 0:e.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",lD.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(ZF(eI.getAnimationInKey("wordCloud")(n,s),JF("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 BO).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:PI])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new GB).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new GB).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[BI])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var t,e,i,s,n;const{width:r,height:a}=this._region.getLayoutRect(),o=null!==(t=this._spec.word)&&void 0!==t?t:{},l=null!==(e=o.style)&&void 0!==e?e:{};return{size:[r,a],shape:p(this._maskShape)&&"text"===this._maskShape.type&&d(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const t=()=>{var e,i,s,n;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((e=>e.fn!==t)),null===(i=(e=this._option).dispatchEvent)||void 0===i||i.call(e,bL.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(n=null===(s=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===s?void 0:s.afterWordcloudShapeDraw)||void 0===n||n.call(s,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:t})},dataIndexKey:EI,text:o.formatMethod?t=>o.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(s=null===(i=this._spec.word)||void 0===i?void 0:i.padding)&&void 0!==s?s:1,fontFamily:u(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(n=l.fontFamily)&&void 0!==n?n:this._defaultFontFamily,fontWeight:u(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:u(l.fontWeight)?l.fontWeight:u(this._valueField)?this._calculateFontWeight:"normal",fontStyle:u(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:l.fontStyle,createCanvas:S_.createCanvas.bind(S_),getTextBounds:gf}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,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,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:Ng,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:u(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:u(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:u(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}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(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}VU.mark=jU,VU.builtInTheme={wordCloud:HU};function NU(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||qD.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,u;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(u=t.children)||void 0===u?void 0:u.length){p.children=[],p.isLeaf=!1;const e=WU(t.children,p.children,i+1,l,p,r,a);p.value=d(t[a])?e.sum:Math.max(e.sum,At(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=At(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},UU=(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=UU(t.children,e,t,n))})),s},GU=(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=GU(t.children,e,t,n)),n=e(t,s,i,n)})),n},YU=(t,e=[],i)=>{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):YU(t.children,e,i)))})),e};function XU(t,e){let i,s;if(qU(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function qU(t,e){for(let i=0;i1e-6?(T+Math.sqrt(T*T-4*w*C))/(2*w):C/T);return{x:s+S+k*B,y:n+A+M*B,radius:B}}function tG(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 eG(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 iG(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 sG(t){return{_:t,next:null,prev:null}}function nG(t,e){const i=(t=G(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];tG(n,s,r);let a,o,l,h,c,d,u,p=sG(s),g=sG(n),f=sG(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:_(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=WU(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%wt)/wt}(),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:d,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=c(l)?this.options.nodeKey:lG.defaultOpionts.nodeSort;UU([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)UU([o],rG(h)),GU([o],aG(this._getPadding,.5,a)),UU([o],oG(1,this._maxDepth));else{const t=Math.min(s.width,s.height);UU([o],rG(lG.defaultOpionts.setRadius)),GU([o],aG(Pt,1,a)),d&&GU([o],aG(this._getPadding,o.radius/t,a)),UU([o],oG(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}lG.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const hG=t=>{let e=0;return t.forEach(((t,i)=>{var s;d(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=hG(t.children):t.value=0),e+=Math.abs(t.value)})),e};function cG(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){hG(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=d(t.value)?0:At(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=j(t,["parents"]);if(a.parents=t.parents.map((t=>j(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=At(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function dG(t){return t.depth}function uG(t,e){return e-1-t.endDepth}const pG=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),gG=(t,e)=>{if(d(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(d(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},fG={left:dG,right:uG,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:dG,end:uG},mG=_t(0,1);class vG{constructor(t){this._ascendingSourceBreadth=(t,e)=>pG(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>pG(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},vG.defaultOptions,t);const e=this.options.nodeKey,i=c(e)?e:e?Bt(e):null;this._getNodeKey=i,this._logger=rt.getInstance(),this._alignFunc=c(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):fG[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)};"vertical"===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<=0)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!d(t.source)&&!d(t.target))),t.targetLinks=t.targetLinks.filter((t=>!d(t.source)&&!d(t.target)))})),r=r.filter((t=>!d(t.source)&&!d(t.target))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;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}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return 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){return cG(t,this._getNodeKey)}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=!d(r.source),l=!d(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&&d(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=[gG(s[t.source]),gG(s[t.target],!0)].filter((t=>!d(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){return function(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=At(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=At(e.value))&&void 0!==i?i:0)}),0))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=c(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}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(v(e)){const t=mt(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(x(e)){if(r=e,x(i))a=i;else if(d(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else c(e)&&x(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,u=null;if(c(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)u=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=x(this.options.nodeHeight)?t=>this.options.nodeHeight:c(this.options.nodeHeight)?this.options.nodeHeight:u>0?t=>u:t=>Math.max(t.value*l,0),m=x(this.options.linkHeight)?()=>this.options.linkHeight:c(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*mG(t.value/e.value):0,n,0),o);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;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,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)}d(this.options.nodeSortBy)&&n.sort(pG),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(pG),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{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];_G(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),yG);const s=_(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,h(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},bG.defaultOpionts,t):Object.assign({},bG.defaultOpionts);const e=this.options.nodeKey,i=c(e)?e:e?Bt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Et(this.options.center[0],t.width),s=t.y0+Et(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=_(r),l=o?r.map((t=>Et(t,n))):Et(r,n),h=_(a),c=this.options.gapRadius,u=h?a.map((t=>Et(t,n))):Et(a,n),p=J(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return d(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=u[i])&&void 0!==s?s:n:id(u[e])?n:u[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(_(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=Et(r,n),i=(u-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-(_(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=WU(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=le({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)}}}function xG(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(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,f,m,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,_=Math.max(v/x,x/m),_>y){f-=h;break}y=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{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*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:_G,slice:xG,sliceDice:function(t,e,i,s,n){(t.depth%2==1?xG:_G)(t,e,i,s,n)}};class AG{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=_(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=_(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=_(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=_(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({},AG.defaultOpionts,t);const i=this.options.nodeKey,s=c(i)?i:i?Bt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?SG(this.options.aspectRatio):null!==(e=kG[this.options.splitType])&&void 0!==e?e:kG.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=WU(t,n,0,-1,null,this._getNodeKey,this.options.valueField);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(x(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(x(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)}))}}function MG(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+li?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return rt.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=MG(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=wi(o.map(wi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rMt(e)));u=Pi(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=wG(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&rt.getInstance().error("Area "+r+" not represented on screen")}return i}function OG(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Bi((function(i){return-1*IG({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},DG=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=G(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!E(G(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:G(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||CG,s=e.lossFunction||TG,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=G(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];hi(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rne.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:LG(f),arcs:f})}))},FG={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:zG,triangle:zG,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.955)%(2*Math.PI/5)-2*Math.PI/10>=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 zG(){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 jG(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*.4),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"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const HG=t=>FG[t]?FG[t]():FG.circle(),VG=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function NG(t){return c(t)?t:function(){return t}}class WG{constructor(t){var e,i;switch(this.options=z({},WG.defaultOptions,t),c(this.options.shape)?this.shape=this.options.shape:this.shape=HG(this.options.shape),this.getText=null!==(e=NG(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=NG(this.options.fontWeight),this.getTextFontSize=NG(this.options.fontSize),this.getTextFontStyle=NG(this.options.fontStyle),this.getTextFontFamily=NG(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>VG(10,50);break;case"random-light":this.getTextColor=()=>VG(50,90);break;default:this.getTextColor=NG(this.options.color)}if(d(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=c(this.options.rotate)?t=>{var e;return re(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=G(this.options.rotate),s=this.options.random?Math.random():Mt(e);return re(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+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:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1: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&&!d(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 GG extends WG{constructor(t){var e;super(z({},GG.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<=GG.defaultOptions.minFontSize&&(this.options.minFontSize=GG.defaultOptions.minFontSize),this.spiral=v(this.options.spiral)?null!==(e=UG[this.options.spiral])&&void 0!==e?e:UG.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=NG(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}=jG(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,f,m;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,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,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._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=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(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=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}));if(this.originalData=s,this.data=s,this.progressiveRun(),!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._originSize[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],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});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 f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);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*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(KG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if($G(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}KG(p,this._size)&&(p=qG(p,this._size))}else if(KG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||XG(p,i))&&(!i||!YG(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 YG(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 XG(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,KG=(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 qG(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{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const p=n.measureText(h),g="normal"!==o?1.1:1,f=u(p.actualBoundingBoxRight)&&u(p.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(p.actualBoundingBoxRight)+Math.abs(p.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(p.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},JG=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>le(t,e,i+r*n)))},QG=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},tY=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=jG(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=HG("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return le(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)QG(n,JG({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)QG(n,JG({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)QG(n,JG({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)QG(n,JG({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)QG(n,JG({x:l,y:h},o,0,3));else if("star"===t.shape){const t=JG({x:l,y:h},o,-Math.PI/2,5),e=JG({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);QG(n,i)}else n.fillRect(0,0,i,s)}; +function t(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 s,n;function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}!function(t){t["desktop-browser"]="desktop-browser",t["mobile-browser"]="mobile-browser",t.node="node",t.worker="worker",t.miniApp="miniApp",t.wx="wx",t.tt="tt",t.harmony="harmony",t["desktop-miniApp"]="desktop-miniApp",t.lynx="lynx"}(s||(s={})),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.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"}(n||(n={}));var a={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 h=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||l(t,"Boolean");var c=t=>"function"==typeof t;var d=t=>null==t;var u=t=>null!=t;var p=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var g=t=>"object"==typeof t&&null!==t;var f=function(t){if(!g(t)||!l(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 m=t=>void 0===t;var v=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||l(t,"String")};var _=t=>Array.isArray?Array.isArray(t):l(t,"Array");var y=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var b=t=>l(t,"Date");var x=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||l(t,"Number")};var S=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>x(t)&&Number.isFinite(t);var A=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var M=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 T=Object.prototype;var C=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||T)};const B=Object.prototype.hasOwnProperty;function E(t){if(d(t))return!0;if(y(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(C(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var P=(t,e,i)=>{const s=v(e)?e.split("."):e;for(let e=0;enull!=t&&R.call(t,e);function I(t,e,i){let s;if(!u(t)||"object"!=typeof t||e&&e(t))return t;const n=_(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:h(t)||x(t)||v(t)?t:b(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=I(r,e,i)}return s}function L(t,e,i=!1,s=!1){if(e){if(t===e)return;if(u(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!u(n[a])||"object"!=typeof n[a]||s&&_(t[a])?F(t,a,n[a]):D(t,e,a,i,s)}}}}function D(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(_(a)){if(s)o=[];else if(_(r))o=r;else if(y(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(v(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function H(t){return Object.prototype.toString.call(t)}function V(t){return Object.keys(t)}function N(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(H(t)!==H(e))return!1;if(c(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 s=t.length-1;s>=0;s--)if(!N(t[s],e[s],i))return!1;return!0}if(!f(t))return!1;const s=V(t),n=V(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!N(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;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;ne?1:t>=e?0:NaN}function tt(t){return Number(t)}function et(t,e,i=tt){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)}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&&x(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(t=nt.None,e){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(...t){this._onErrorHandler.forEach((e=>e(...t)))}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(...t){var e;return this._level>=nt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):st(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=nt.Warn&&st(this._method||"warn","WARN",t),this}info(...t){return this._level>=nt.Info&&st(this._method||"log","INFO",t),this}debug(...t){return this._level>=nt.Debug&&st(this._method||"log","DEBUG",t),this}}function at(t,e,i=0,s){for(d(s)&&(s=t.length);i>>1;Q(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(Q)),et(i,.5)},ct=1e-10,dt=1e-10;function ut(t,e,i=dt,s=ct){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}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(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var mt=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 g=!e&&0!==e&&yt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return g?(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=m(_,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?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(_,e),c?f(t):a}(l);if(d)return o=m(_,e),f(l)}return void 0===o&&(o=m(_,e)),a}return e=+e||0,p(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(g)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:y(Date.now())},b.pending=function(){return void 0!==o},b}function xt(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return p(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),bt(t,e,{leading:s,trailing:n,maxWait:e})}function St(t,e){return i=>t*(1-i)+e*i}function kt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function At(t){if(k(t))return t;const e=+t;return k(e)?e:0}function Mt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}yt=!1;const wt=4294967296;const Tt=t=>e=>P(e,t),Ct=(t,e={})=>{if(c(t))return t;const i=[t];return(e&&e.get||Tt)(i)},Bt=(t,e={})=>{if(_(t)){const i=t.map((t=>Ct(t,e)));return t=>i.map((e=>e(t)))}return Ct(t,e)},Et=(t,e)=>d(t)?e:v(t)?e*parseFloat(t)/100:t,Pt=t=>0,Rt=(t,e)=>{const i=c(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function It(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Lt(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!d(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:u,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)u+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!d(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!d(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:u,b:p},predict:g,rSquared:It(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=Ot(f.min,f);for(let r=0;r=1?zt:t<=-1?-zt:Math.asin(t)}function qt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Zt(t,e){return t[0]*e[1]-t[1]*e[0]}function Jt(t,e){let i=0;for(let s=0;s0?i:0}function ee(t,e){return Qt(t+e,10**Math.max(te(t),te(e)))}function ie(t,e){return Qt(t-e,10**Math.max(te(t),te(e)))}class se{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new se(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 x(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return x(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 ne{static distancePP(t,e){return Xt($t(t.x-e.x,2)+$t(t.y-e.y,2))}static distanceNN(t,e,i,s){return Xt($t(t-i,2)+$t(e-s,2))}static distancePN(t,e,i){return Xt($t(e-t.x,2)+$t(i-t.y,2))}static pointAtPP(t,e,i){return new se((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function re(t){return t*(Math.PI/180)}function ae(t){return 180*t/Math.PI}const oe=(t=0)=>{if(t<0)for(;t<-jt;)t+=jt;else if(t>0)for(;t>jt;)t-=jt;return t};function le(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 he(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function ce(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function de(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ue(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=de(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)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function pe(t){return(t=de(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 ge(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function fe(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function ve(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=ye(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var _e;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(_e||(_e={}));const ye=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function be(t,e,i){if(!t||!e)return _e.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=ye(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function ke(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Ae({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Me(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function we(t,e){const i=e?re(t.angle):t.angle,s=Me(t);return[Ae({x:t.x1,y:t.y1},i,s),Ae({x:t.x2,y:t.y1},i,s),Ae({x:t.x2,y:t.y2},i,s),Ae({x:t.x1,y:t.y2},i,s)]}function Te(t,e,i=!1){const s=we(t,i),n=we(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Me(t),Me(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?re(t.angle):t.angle;let u=i?re(90-t.angle):t.angle+zt;const p=i?re(e.angle):e.angle;let g=i?re(90-e.angle):e.angle+zt;u>Ht&&(u-=Ht),g>Ht&&(g-=Ht);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(ke(n,i)+ke(n,s))/2>ke(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Ce=1e-8;function Be(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Re(t,e){return Math.abs(t-e){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"};function Ie(t,e={},i){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")}class Le{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(),u(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=u(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(d(this._canvas)&&(u(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),d(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&u(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),d(this._context)&&u(this._canvas)){const t=this._canvas.getContext("2d");u(t)&&(t.save(),t.font=Ie(this.textSpec),this._contextSaved=!0,this._context=t)}return!d(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:f=o}=this._userSpec;if(v(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,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(d(t))return{width:0,height:0};if(d(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,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}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(d(this._numberCharSize)){const t=this._standardMethod(Le.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Le.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return d(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Le.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(d(this._letterCharSize)){const t=this._standardMethod(Le.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Le.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return u(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){u(this._canvas)&&(this._canvas=null),u(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Le.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Le.NUMBERS_CHAR_SET="0123456789",Le.FULL_SIZE_CHAR="字";const De=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),Fe=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=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(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=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(t=0,e=0,i=0,s=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(t=0,e=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(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return ze(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 He extends je{}class Ve extends je{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Te(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new Ve(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Ae({x:this.x1,y:this.y1},this.angle,t),Ae({x:this.x2,y:this.y1},this.angle,t),Ae({x:this.x1,y:this.y2},this.angle,t),Ae({x:this.x2,y:this.y2},this.angle,t)]}}class Ne{constructor(t=1,e=0,i=0,s=1,n=0,r=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 Ne,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,f=o*n+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 Ne;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:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ne(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=ae(r.rotateDeg),r}}class We{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 Ue(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 Ge(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 Ye=/^#([0-9a-f]{3,8})$/,Xe={transparent:4294967040},$e={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 Ke(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function qe(t){return x(t)?new ei(t>>16,t>>8&255,255&t,1):_(t)?new ei(t[0],t[1],t[2]):new ei(255,255,255)}function Ze(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Je(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const Qe=(t,e)=>{const i=Ye.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ei((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?qe(t):8===e?new ei(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class ti{static Brighter(t,e=1){return 1===e?t:new ti(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new ti(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof ti?t:new ti(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();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(u(Xe[t]))return function(t){return x(t)?new ei(t>>>24,t>>>16&255,t>>>8&255,255&t):_(t)?new ei(t[0],t[1],t[2],t[3]):new ei(255,255,255,1)}(Xe[t]);if(u($e[t]))return qe($e[t]);const e=`${t}`.trim().toLowerCase(),i=Qe(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new ei(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=Ue(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ei(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ti.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ei(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=Ge(this.color.r,this.color.g,this.color.b),r=Ue(d(t)?n.h:mt(t,0,360),d(e)?n.s:e>=0&&e<=1?100*e:e,d(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new ei(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!d(t)&&(this.color.r=t),!d(e)&&(this.color.g=e),!d(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=Qe(e,!0);return null!=i?i:this}setColorName(t){const e=$e[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(t=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}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new ti(this.color.toString())}copyGammaToLinear(t,e=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,e=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=Ze(t.color.r),this.color.g=Ze(t.color.g),this.color.b=Ze(t.color.b),this}copyLinearToSRGB(t){return this.color.r=Je(t.color.r),this.color.g=Je(t.color.g),this.color.b=Je(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ei{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)),u(s)?this.opacity=isNaN(+s)?1:Math.max(0,Math.min(1,+s)):this.opacity=1}formatHex(){return`#${Ke(this.r)+Ke(this.g)+Ke(this.b)+(1===this.opacity?"":Ke(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}=Ge(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ii(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 ei(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:Ge});function ni(t){if(k(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,s]=t;return[e,i,s,i]}if(4===e)return t}if(p(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 ri(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=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:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}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}const li=1e-10;function hi(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+li)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=pi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=ne.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=ci(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-li,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function ci(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function di(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return ci(t,t-(i*i-e*e+t*t)/(2*i))+ci(e,s)}function ui(t,e){const i=ne.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function pi(t){const e={x:0,y:0};for(let i=0;ithis.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 mi;function vi(t,e){const i=fi(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 _i{constructor(t={}){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 yi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function bi(t){let e;if(e=yi.exec(t))return new _i({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 xi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Si{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 Si.instance||(Si.instance=new Si),Si.instance}newFormat(t){const e=bi(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"):ki[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=ki[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:_,group:y,numerals:b}=this;function x(t){let e,r,x,S=u,k=p,A=t;if("c"===d)k=g(A)+k,A="";else{A=+A;let t=A<0||1/A<0;if(A=isNaN(A)?m:g(Math.abs(A),h),c&&(A=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}(A)),t&&0==+A&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,k=("s"===d?xi[8+mi/3]:"")+k+(t&&"("===n?")":""),f)for(e=-1,r=A.length;++ex||x>57){k=(46===x?_+A.slice(e+1):A.slice(e))+k,A=A.slice(0,e);break}}l&&!a&&(A=y(A,1/0));let M=S.length+A.length+k.length,w=M>1)+S+A+k+w.slice(M);break;default:A=w+S+A+k}return b(A)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=bi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=fi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=xi[8+n/3];return function(t){return s(r*t)+a}}}const ki={"%":(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)=>vi(100*t,e),r:vi,s:function(t,e){const i=fi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(mi=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")+fi(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 Ai(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(_.fx>e.fx?(Ci(y,1+c,v,-c,e),y.fx=t(y),y.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Ci(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=Jt(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Pi(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Ti(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},Ji=Math.sqrt,Qi=Math.tan;function ts(t){return t>1?0:t<-1?Fi:Math.acos(t)}function es(t){return t>1?zi:t<-1?-zi:Math.asin(t)}function is(){}function ss(t,e){t&&rs.hasOwnProperty(t.type)&&rs[t.type](t,e)}var ns={Feature:function(t,e){ss(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sFi?t+Math.round(-t/Hi)*Hi:t,e]}function _s(t,e,i){return(t%=Hi)?e||i?ms(bs(t),xs(e,i)):bs(t):e||i?xs(e,i):vs}function ys(t){return function(e,i){return[(e+=t)>Fi?e-Hi:e<-Fi?e+Hi:e,i]}}function bs(t){var e=ys(t);return e.invert=ys(-t),e}function xs(t,e){var i=Yi(t),s=qi(t),n=Yi(e),r=qi(e);function a(t,e){var a=Yi(e),o=Yi(t)*a,l=qi(t)*a,h=qi(e),c=h*i+o*s;return[Gi(l*n-c*r,o*i-h*s),es(c*n+l*r)]}return a.invert=function(t,e){var a=Yi(e),o=Yi(t)*a,l=qi(t)*a,h=qi(e),c=h*n-l*r;return[Gi(l*n+h*r,o*i+c*s),es(c*i-o*s)]},a}function Ss(t,e){(e=cs(e))[0]-=t,fs(e);var i=ts(-e[1]);return((-e[2]<0?-i:i)+Hi-Di)%Hi}function ks(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:is,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function As(t,e){return Wi(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 Ts(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Os(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 Is(t,e,i,s){return function(n){var r,a,o,l=e(n),h=ks(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Os(a);var t=function(t,e){var i=Ps(e),s=e[1],n=qi(s),r=[qi(i),-Yi(i),0],a=0,o=0;Es.reset(),1===n?s=zi+Di:-1===n&&(s=-zi-Di);for(var l=0,h=t.length;l=0?1:-1,M=A*k,w=M>Fi,T=f*x;if(Es.add(Gi(T*A*qi(M),m*S+T*Yi(M))),a+=w?k+A*Hi:k,w^p>=i^y>=i){var C=us(cs(u),cs(_));fs(C);var B=us(r,C);fs(B);var E=(w^k>=0?-1:1)*es(B[2]);(s>E||s===E&&(C[0]||C[1]))&&(o+=w^k>=0?1:-1)}}return(a<-Di||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(Ls))}return u}}function Ls(t){return t.length>1}function Ds(t,e){return((t=t.x)[0]<0?t[1]-zi-Di:zi-t[1])-((e=e.x)[0]<0?e[1]-zi-Di:zi-e[1])}1===(Cs=Rs).length&&(Bs=Cs,Cs=function(t,e){return Rs(Bs(t),e)});var Fs=Is((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?Fi:-Fi,l=Wi(r-i);Wi(l-Fi)0?zi:-zi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Fi&&(Wi(i-n)Di?Ui((qi(e)*(r=Yi(s))*qi(i)-qi(s)*(n=Yi(e))*qi(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*zi,s.point(-Fi,n),s.point(0,n),s.point(Fi,n),s.point(Fi,0),s.point(Fi,-n),s.point(0,-n),s.point(-Fi,-n),s.point(-Fi,0),s.point(-Fi,n);else if(Wi(t[0]-e[0])>Di){var r=t[0]0,n=Wi(e)>Di;function r(t,i){return Yi(t)*Yi(i)>e}function a(t,i,s){var n=[1,0,0],r=us(cs(t),cs(i)),a=ds(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=us(n,r),u=gs(n,h);ps(u,gs(r,c));var p=d,g=ds(u,p),f=ds(p,p),m=g*g-f*(ds(u,u)-1);if(!(m<0)){var v=Ji(m),_=gs(p,(-g-v)/f);if(ps(_,u),_=hs(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],k=i[1];x0^_[1]<(Wi(_[0]-b)Fi^(b<=_[0]&&_[0]<=x)){var w=gs(p,(-g+v)/f);return ps(w,u),[_,hs(w)]}}}function o(e,i){var n=s?t:Fi-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Is(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],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?Fi:-Fi),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||As(e,p)||As(g,p))&&(g[2]=1),f!==l)c=0,f?(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^f){var v;m&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)))}!f||e&&As(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},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=Yi(e),o=qi(e),l=s*i;null==n?(n=e+s*Hi,r=e-l/2):(n=Ss(a,n),r=Ss(a,r),(s>0?nr)&&(n+=s*Hi));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 Wi(s[0]-t)0?0:3:Wi(s[0]-i)0?2:1:Wi(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,f,m,v,_,y=a,b=ks(),x={point:S,lineStart:function(){x.point=k,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(k(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&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=Os(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&ws(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 k(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&&m)y.point(r,a);else{var l=[g=Math.max(Hs,Math.min(js,g)),f=Math.max(Hs,Math.min(js,f))],b=[r=Math.max(Hs,Math.min(js,r)),a=Math.max(Hs,Math.min(js,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):(m||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Ns(t){return t}var Ws,Us,Gs,Ys,Xs=Ri(),$s=Ri(),Ks={point:is,lineStart:is,lineEnd:is,polygonStart:function(){Ks.lineStart=qs,Ks.lineEnd=Qs},polygonEnd:function(){Ks.lineStart=Ks.lineEnd=Ks.point=is,Xs.add(Wi($s)),$s.reset()},result:function(){var t=Xs/2;return Xs.reset(),t}};function qs(){Ks.point=Zs}function Zs(t,e){Ks.point=Js,Ws=Gs=t,Us=Ys=e}function Js(t,e){$s.add(Ys*t-Gs*e),Gs=t,Ys=e}function Qs(){Js(Ws,Us)}var tn=Ks,en=1/0,sn=en,nn=-en,rn=nn;var an,on,ln,hn,cn={point:function(t,e){tnn&&(nn=t);ern&&(rn=e)},lineStart:is,lineEnd:is,polygonStart:is,polygonEnd:is,result:function(){var t=[[en,sn],[nn,rn]];return nn=rn=-(sn=en=1/0),t}},dn=0,un=0,pn=0,gn=0,fn=0,mn=0,vn=0,_n=0,yn=0,bn={point:xn,lineStart:Sn,lineEnd:Mn,polygonStart:function(){bn.lineStart=wn,bn.lineEnd=Tn},polygonEnd:function(){bn.point=xn,bn.lineStart=Sn,bn.lineEnd=Mn},result:function(){var t=yn?[vn/yn,_n/yn]:mn?[gn/mn,fn/mn]:pn?[dn/pn,un/pn]:[NaN,NaN];return dn=un=pn=gn=fn=mn=vn=_n=yn=0,t}};function xn(t,e){dn+=t,un+=e,++pn}function Sn(){bn.point=kn}function kn(t,e){bn.point=An,xn(ln=t,hn=e)}function An(t,e){var i=t-ln,s=e-hn,n=Ji(i*i+s*s);gn+=n*(ln+t)/2,fn+=n*(hn+e)/2,mn+=n,xn(ln=t,hn=e)}function Mn(){bn.point=xn}function wn(){bn.point=Cn}function Tn(){Bn(an,on)}function Cn(t,e){bn.point=Bn,xn(an=ln=t,on=hn=e)}function Bn(t,e){var i=t-ln,s=e-hn,n=Ji(i*i+s*s);gn+=n*(ln+t)/2,fn+=n*(hn+e)/2,mn+=n,vn+=(n=hn*t-ln*e)*(ln+t),_n+=n*(hn+e),yn+=3*n,xn(ln=t,hn=e)}var En=bn;function Pn(t){this._context=t}Pn.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,Hi)}},result:is};var Rn,On,In,Ln,Dn,Fn=Ri(),zn={point:is,lineStart:function(){zn.point=jn},lineEnd:function(){Rn&&Hn(On,In),zn.point=is},polygonStart:function(){Rn=!0},polygonEnd:function(){Rn=null},result:function(){var t=+Fn;return Fn.reset(),t}};function jn(t,e){zn.point=Hn,On=Ln=t,In=Dn=e}function Hn(t,e){Ln-=t,Dn-=e,Fn.add(Ji(Ln*Ln+Dn*Dn)),Ln=t,Dn=e}var Vn=zn;function Nn(){this._string=[]}function Wn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Un(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),ls(t,i(s))),s.result()}return r.area=function(t){return ls(t,i(tn)),tn.result()},r.measure=function(t){return ls(t,i(Vn)),Vn.result()},r.bounds=function(t){return ls(t,i(cn)),cn.result()},r.centroid=function(t){return ls(t,i(En)),En.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ns):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Nn):new Pn(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 Gn(t){return function(e){var i=new Yn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Yn(){}function Xn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),ls(i,t.stream(cn)),e(cn.result()),null!=s&&t.clipExtent(s),t}function $n(t,e,i){return Xn(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 Kn(t,e,i){return $n(t,[[0,0],e],i)}function qn(t,e,i){return Xn(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 Xn(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)}Nn.prototype={_radius:4.5,_circle:Wn(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=Wn(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}},Yn.prototype={constructor:Yn,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 Jn=16,Qn=Yi(30*Ni);function tr(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&f--){var b=a+u,x=o+p,S=l+g,k=Ji(b*b+x*x+S*S),A=es(S/=k),M=Wi(Wi(S)-1)e||Wi((v*B+_*E)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Ni:0,B()):[m*Vi,v*Vi,_*Vi]},T.angle=function(t){return arguments.length?(y=t%360*Ni,B()):y*Vi},T.reflectX=function(t){return arguments.length?(b=t?-1:1,B()):b<0},T.reflectY=function(t){return arguments.length?(x=t?-1:1,B()):x<0},T.precision=function(t){return arguments.length?(a=tr(o,w=t*t),E()):Ji(w)},T.fitExtent=function(t,e){return $n(T,t,e)},T.fitSize=function(t,e){return Kn(T,t,e)},T.fitWidth=function(t,e){return qn(T,t,e)},T.fitHeight=function(t,e){return Zn(T,t,e)},function(){return e=t.apply(this,arguments),T.invert=e.invert&&C,B()}}function ar(t){var e=0,i=Fi/3,s=rr(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Ni,i=t[1]*Ni):[e*Vi,i*Vi]},n}function or(t,e){var i=qi(t),s=(i+qi(e))/2;if(Wi(s)2?t[2]*Ni:0),e.invert=function(e){return(e=t.invert(e[0]*Ni,e[1]*Ni))[0]*=Vi,e[1]*=Vi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===gr?[[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 mr(t){return Qi((zi+t)/2)}function vr(t,e){var i=Yi(t),s=t===e?qi(t):$i(i/Yi(e))/$i(mr(e)/mr(t)),n=i*Ki(mr(t),s)/s;if(!s)return gr;function r(t,e){n>0?e<-zi+Di&&(e=-zi+Di):e>zi-Di&&(e=zi-Di);var i=n/Ki(mr(e),s);return[i*qi(s*t),n-i*Yi(s*t)]}return r.invert=function(t,e){var i=n-e,r=Zi(s)*Ji(t*t+i*i),a=Gi(t,Wi(i))*Zi(i);return i*s<0&&(a-=Fi*Zi(t)*Zi(i)),[a/s,2*Ui(Ki(n/r,1/s))-zi]},r}function _r(t,e){return[t,e]}function yr(t,e){var i=Yi(t),s=t===e?qi(t):(i-Yi(e))/(e-t),n=i/s+t;if(Wi(s)Di&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Cr.invert=dr(es),Br.invert=dr((function(t){return 2*Ui(t)})),Er.invert=function(t,e){return[-e,2*Ui(Xi(t))-zi]};var Or={exports:{}},Ir=function(t,e){this.p1=t,this.p2=e};Ir.prototype.rise=function(){return this.p2[1]-this.p1[1]},Ir.prototype.run=function(){return this.p2[0]-this.p1[0]},Ir.prototype.slope=function(){return this.rise()/this.run()},Ir.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Ir.prototype.isVertical=function(){return!isFinite(this.slope())},Ir.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Ir.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Ir.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Ir.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)},Ir.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Lr=Ir,Dr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Lr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Dr(t.slice(0,s),e),o=Dr(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},Fr=Dr;!function(t){var e=Fr;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;r{const i=jr(Nr,e),{tolerance:s}=i;return zr(t,s)};var Ur;!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"}(Ur||(Ur={}));const Gr=(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.sort&&(k(l.sortIndex)||(l.sortIndex=0),u(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!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;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,y=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],k=new Set,A=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),k.has(i)||(k.add(i),S.push(i),_(m)?A.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):A.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else y[r][l]+=a;e&&e.includeValues&&!v&&y[r][c].push(t[n]);break}}}let M=0;const w=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=y.length;t0?y[t][l]/M:0,w.push(y[t])}return w},Xr=(t,e)=>{var i,s,n,r,a,o,l,h,c,u;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,y=-1/0;if(e.extent)v=e.extent[0],y=e.extent[1];else for(let e=0;ey&&(y=s))}if(!Number.isFinite(v)||!Number.isFinite(y)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=y;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(y-v>1){const e=Math.floor(v),i=Math.ceil((y-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>y){t=s,m.length=t+1;break}}else{const e=(y-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>y){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",k=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",A=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",M=null!==(u=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==u?u:"percentage",w=_(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],T=_(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],C=T.length?T:void 0,B=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:k,percentageName:M,valuesName:A,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:C});if(!w.length)return Yr(t,B);const E={};return t.forEach((t=>{const e=w.map((e=>null==t?void 0:t[e])).join("-&&-");E[e]?E[e].push(t):E[e]=[t]})),Object.values(E).map((t=>{const e=[...T,...w];return Yr(t,Object.assign(Object.assign({},B),{groupField:e.length?e:void 0,n:t.length}))})).flat()},$r=(t,e)=>{var i,s,n,r,a,o,l,h,c,u,p,g,f,m,v,y;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const k=!!(null==e?void 0:e.includeValues),A=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},M=null!==(n=A.key)&&void 0!==n?n:_(x)?null:null!==(r=x)&&void 0!==r?r:"key",w=null!==(a=A.count)&&void 0!==a?a:"count",T=null!==(o=A.mean)&&void 0!==o?o:"mean",C=null!==(l=A.q1)&&void 0!==l?l:"q1",B=null!==(h=A.median)&&void 0!==h?h:"median",E=null!==(c=A.q3)&&void 0!==c?c:"q3",P=null!==(u=A.iqr)&&void 0!==u?u:"iqr",R=null!==(p=A.min)&&void 0!==p?p:"min",O=null!==(g=A.max)&&void 0!==g?g:"max",I=null!==(f=A.lowerWhisker)&&void 0!==f?f:"lowerWhisker",L=null!==(m=A.upperWhisker)&&void 0!==m?m:"upperWhisker",D=null!==(v=A.outliers)&&void 0!==v?v:"outliers",F=null!==(y=A.values)&&void 0!==y?y:"values",z=new Map,j=new Map,H=new Map,V=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),k&&j.set(r,[]),_(x)?H.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):H.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),k){const t=j.get(r);t&&t.push(i)}}_(S)&&(S=[mt(Math.min.apply(null,S),0,1),mt(Math.max.apply(null,S),0,1)]);const N=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=H.get(t);if(null!==M)f[M]=m;else if(_(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[w]=s,f[T]=o,f[C]=l,f[B]=h,f[E]=c,f[P]=d,f[R]=n,f[O]=r,f[I]=u,f[L]=p,f[D]=g,k&&(f[F]=j.get(t)||[]),N.push(f)}return N};var Kr={},qr={};function Zr(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function Jr(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function Qr(t,e){var i=t+"",s=i.length;return s9999?"+"+Qr(e,6):Qr(e,4))+"-"+Qr(t.getUTCMonth()+1,2)+"-"+Qr(t.getUTCDate(),2)+(r?"T"+Qr(i,2)+":"+Qr(s,2)+":"+Qr(n,2)+"."+Qr(r,3)+"Z":n?"T"+Qr(i,2)+":"+Qr(s,2)+":"+Qr(n,2)+"Z":s||i?"T"+Qr(i,2)+":"+Qr(s,2)+"Z":"")}function ea(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 qr;if(h)return h=!1,Kr;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(;a0}function ua(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=ra(t));var r=[];switch(t.type){case"GeometryCollection":return pa(t,(function(t){fa(t,s)})),t;case"FeatureCollection":return ua(t,(function(t){ua(fa(t,s),(function(t){r.push(t)}))})),oi(r)}return fa(t,s)}function fa(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return pa(t,(function(t){fa(t,e)})),t;case"LineString":return ma(ca(t),e),t;case"Polygon":return va(ca(t),e),t;case"MultiLineString":return ca(t).forEach((function(t){ma(t,e)})),t;case"MultiPolygon":return ca(t).forEach((function(t){va(t,e)})),t;case"Point":case"MultiPoint":return t}}function ma(t,e){da(t)===e&&t.reverse()}function va(t,e){da(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=_a(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Sa=(t,e={},i)=>{i.type=Ur.GEO;const s=jr(ba,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(xa(t))})):e.push(xa(t))})),e})(t);let l=t.features;return o&&(l=ga(t,{reverse:!p(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=ya.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=ya.bounds(t);t.bbox=e}})),t.features=l,t},ka={},Aa=(t,e,i)=>{i.type=Ur.GEO;const s=jr(ba,ka,e),{object:n}=s;if(!v(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 Rr(a,t)}))}:Rr(a,o));var a,o;return Sa(r,s,i)},Ma=(t,e,i)=>{const s=!h(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))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let wa=0;function Ta(t="dataset"){return wa>1e8&&(wa=0),t+"_"+wa++}class Ca{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new o,i=(null==t?void 0:t.name)?t.name:Ta("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()}}class Ba{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new o,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&N(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Ta("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){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,e=!0){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)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}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,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&N(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof Ba||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?z({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!d(this._fields)&&d(i)?(this.dataSet.registerTransform("fields",Gr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Un();const Ea={},Pa={albers:hr,albersusa:function(){var t,e,i,s,n,r,a=hr(),o=lr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=lr().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)}},Ra=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Oa(t,e){return function i(){const s=e();return s.type=t,s.path=Un().projection(s),s.copy=s.copy||function(){const t=i();return Ra.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Ia{static GenAutoIncrementId(){return Ia.auto_increment_id++}}Ia.auto_increment_id=0;class La{constructor(t){this.id=Ia.GenAutoIncrementId(),this.registry=t}}const Da="named",Fa="inject",za="multi_inject",ja="inversify:tagged",Ha="inversify:paramtypes";class Va{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===Da?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var Na=function(t){var e;return function(t){const e="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),s=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),n=new WeakMap;function r(t,e,i){let r=n.get(t);if(h(r)){if(!i)return;r=new s,n.set(t,r)}let a=r.get(e);if(h(a)){if(!i)return;a=new s,r.set(e,a)}return a}function a(t,e,i){if(o(t,e,i))return!0;const s=f(e);return!c(s)&&a(t,s,i)}function o(t,e,i){const s=r(e,i,!1);return!h(s)&&!!s.has(t)}function l(t,e,i){if(o(t,e,i))return function(t,e,i){const s=r(e,i,!1);if(!h(s))return s.get(t)}(t,e,i);const s=f(e);return c(s)?void 0:l(t,s,i)}function h(t){return void 0===t}function c(t){return null===t}function d(t){return"object"==typeof t?null!==t:"function"==typeof t}function u(t,i){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const s=3===i?"string":5===i?"number":"default",n=function(t,e){const i=t[e];if(null!=i){if(!g(i))throw new TypeError;return i}}(t,e);if(void 0!==n){const e=n.call(t,s);if(d(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.valueOf;if(g(i)){const e=i.call(t);if(!d(e))return e}}else{const e=t.valueOf;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.toString;if(g(i)){const e=i.call(t);if(!d(e))return e}}throw new TypeError}(t,"default"===s?"number":s)}function p(t){const e=u(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function g(t){return"function"==typeof t}function f(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const s=t.prototype,n=s&&Object.getPrototypeOf(s);if(null==n||n===Object.prototype)return e;const r=n.constructor;return"function"!=typeof r||r===t?e:r}t("defineMetadata",(function(t,e,i,s){if(!d(i))throw new TypeError;return n=t,a=e,void r(i,s,!0).set(n,a);var n,a})),t("hasMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),l(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function Wa(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};Na.hasOwnMetadata(t,e)&&(r=Na.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,Na.defineMetadata(t,r,e)}(ja,t,i.toString(),s)}function Ua(t){return(e,i,s)=>{Wa(e,0,s,t)}}function Ga(t){return e=>(i,s,n)=>Ua(new Va(t,e))(i,s,n)}const Ya=Ga(Fa),Xa=Ga(za);function $a(){return function(t){return Na.defineMetadata(Ha,null,t),t}}function Ka(t){return Ua(new Va(Da,t))}const qa="Singleton",Za="Transient",Ja="ConstantValue",Qa="DynamicValue",to="Factory",eo="Function",io="Instance",so="Invalid";class no{constructor(t,e){this.id=Ia.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=so,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new no(this.serviceIdentifier,this.scope);return t.activated=t.scope===qa&&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 ro{getConstructorMetadata(t){return{compilerGeneratedMetadata:Na.getMetadata(Ha,t),userGeneratedMetadata:Na.getMetadata(ja,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const ao=(oo=Da,t=>{const e=e=>{if(null==e)return!1;if(e.key===oo&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const co=Symbol("ContributionProvider");class uo{constructor(t,e){this.serviceIdentifier=t,this.container=e,go.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function po(t,e){t(co).toDynamicValue((({container:t})=>new uo(e,t))).inSingletonScope().whenTargetNamed(e)}class go{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}go.store=new Map;class fo{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 mo extends fo{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const vo=Symbol.for("EnvContribution"),_o=Symbol.for("VGlobal"),yo=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Za,this.options=e,this.id=Ia.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new ro}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,Da,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new no(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new ho(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[Fa],multiInject:s[za]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:a,metadata:e,bindings:l};n.push(t)}}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 eo:e=t.cache;break;case io: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===qa&&(t.cache=e,t.activated=!0)}},bo=Symbol.for("RenderService");const xo=new class{get renderService(){return this._renderService||(this._renderService=yo.get(bo)),this._renderService}};let So=0;class ko{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=xo.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++So,t),this.tryRunAnimationFrameNextFrame(),So}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class Ao{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var Mo=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wo=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},To=function(t,e){return function(i,s){e(i,s,t)}},Co=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 Bo=class extends Ao{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}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){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Ia.GenAutoIncrementId(),this.hooks={onSetEnv:new mo(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}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)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new ko);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}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)}loadFont(t,e,i){return Co(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}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,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var Eo,Po,Ro,Oo;Bo=Mo([$a(),To(0,Ya(co)),To(0,Ka(vo)),wo("design:paramtypes",[Object])],Bo),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(Eo||(Eo={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(Po||(Po={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(Ro||(Ro={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(Oo||(Oo={}));const Io=jt-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)>Io)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%=jt)<0&&(s+=jt),(n%=jt)<0&&(n+=jt),nn;++o,a-=zt)g(a);else for(a=s-s%zt+zt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const Fo=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,zo={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},jo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let Ho,Vo,No,Wo,Uo,Go;var Yo,Xo,$o,Ko,qo,Zo;function Jo(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),f=Math.cos(n),m=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+f,k=i+m,A=S+y*m,M=k-y*f;return[h*b+c*x,d*b+u*x,h*A+c*M,d*A+u*M,h*S+c*k,d*S+u*k]}function Qo(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=re(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 f=d/i,m=c/i,v=-c/s,_=d/s,y=f*o+m*l,b=v*o+_*l,x=f*t+m*e,S=v*t+_*e;let k=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;k<0&&(k=0);let A=Math.sqrt(k);r===n&&(A=-A);const M=.5*(y+x)-A*(S-b),w=.5*(b+S)+A*(x-y),T=Math.atan2(b-w,y-M);let C=Math.atan2(S-w,x-M)-T;C<0&&1===r?C+=jt:C>0&&0===r&&(C-=jt);const B=Math.ceil(Math.abs(C/(zt+.001))),E=[];for(let t=0;te.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 el(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=ll(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Ut(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Ut(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function cl(t,e){const{p0:i,p1:s}=t,n=ne.pointAtPP(i,s,e);return[new dl(i,n),new dl(n,s)]}class dl extends il{constructor(t,e){super(),this.type=qo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return ne.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Nt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?ne.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Ko.ROW?Vt(this.p0.x-this.p1.x):t===Ko.COLUMN?Vt(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class ul{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new hl(new se(this._lastX,this._lastY),new se(t,e),new se(i,s),new se(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new dl(new se(this._lastX,this._lastY),new se(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===Ko.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Vt(t.p0.y-s.y)}if(t===Ko.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Vt(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class pl extends ul{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 gl(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function fl(t,e,i){const s=null!=e?e:Vt(i[i.length-1].x-i[0].x)>Vt(i[i.length-1].y-i[0].y)?Ko.ROW:Ko.COLUMN;return"monotoneY"===t?new pl(t,s):new ul(t,s)}class ml{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 vl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=fl("linear",i,t);return function(t,e){gl(t,e,1)}(new ml(n,s),t),n}function _l(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 yl{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&&_l(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:_l(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 bl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return vl(t,e);const n=fl("basis",i,t);return function(t,e){gl(t,e,2)}(new yl(n,s),t),n}function xl(t){return t<0?-1:1}function Sl(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(xl(r)+xl(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function kl(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Al(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 Ml{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:Al(this,this._t0,kl(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,Al(this,kl(this,e=Sl(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Al(this,this._t0,e=Sl(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 wl extends Ml{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Tl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return vl(t,e);const n=fl("monotoneX",i,t);return function(t,e){gl(t,e,2)}(new Ml(n,s),t),n}function Cl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return vl(t,e);const n=fl("monotoneY",i,t);return function(t,e){gl(t,e,2)}(new wl(n,s),t),n}let Bl=class{constructor(t,e=.5,i){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;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):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()}};class El extends Bl{lineEnd(){this.context.closePath()}}function Pl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new ul("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?Ko.ROW:Ko.COLUMN);return Rl(new Bl(r,e,n),t),r}function Rl(t,e){return gl(t,e,1)}class Ol extends ml{lineEnd(){this.context.closePath()}}function Il(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=fl("linear",i,t);return function(t,e){gl(t,e,1)}(new Ol(n,s),t),n}function Ll(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Dt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>Dt){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function Dl(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return vl(i,n);const o=fl(t,r,i);return gl(new e(o,s,a),i,2),o}}const Fl=Dl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:Ll(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const zl=Dl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:Ll(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class jl extends il{constructor(t,e,i){super(),this.type=qo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return ol(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,sl([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===Ko.ROW?Vt(this.p0.x-this.p2.x):t===Ko.COLUMN?Vt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Ut(t-.01,0),i=Gt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Nt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=ol(i,s,n,e),a=ne.pointAtPP(i,s,e),o=ne.pointAtPP(s,n,e);return[new jl(i,a,r),new jl(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Hl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new dl(new se(this._lastX,this._lastY),new se(t,e))}quadraticCurveTo(t,e,i,s){const n=new jl(new se(this._lastX,this._lastY),new se(t,e),new se(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new hl(new se(this._lastX,this._lastY),new se(t,e),new se(i,s),new se(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Vl(t,e,i){var s,n;switch(e){case"linear":default:return vl(t,i);case"basis":return bl(t,i);case"monotoneX":return Tl(t,i);case"monotoneY":return Cl(t,i);case"step":return Pl(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new ul("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?Ko.ROW:Ko.COLUMN);return Rl(new El(r,e,n),t),r}(t,.5,i);case"stepBefore":return Pl(t,0,i);case"stepAfter":return Pl(t,1,i);case"catmullRom":return Fl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return zl(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return Il(t,i)}}class Nl extends Do{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Lo(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([jo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([jo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([jo.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([jo.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([jo.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([jo.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([jo.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([jo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([jo.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()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Hl(this);el(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[jo.M]=t=>`M${t[1]} ${t[2]}`,t[jo.L]=t=>`L${t[1]} ${t[2]}`,t[jo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[jo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[jo.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3];((t,e,i,s,n,r,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;e`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[jo.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;tGo){let t,e=No;for(let s=1,r=i.length;s{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,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),el(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Ko.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.y-e.p1.y)}if(this.direction===Ko.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{rt.getInstance().warn("空函数")}}),ah=Object.assign(Object.assign({},Jl),{points:[],cornerRadius:0,closePath:!0}),oh=Object.assign(Object.assign({},Jl),{width:100,height:100,spikes:5,thickness:.5}),lh=Object.assign(Object.assign({},Jl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},Jl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const hh=Object.assign(Object.assign({},Jl),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),ch=Object.assign(Object.assign(Object.assign({},Jl),Kl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),dh=Object.assign(Object.assign(Object.assign({},Jl),Kl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",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}),uh=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0,maxWidth:500,maxHeight:500},Jl),{fill:!0,cornerRadius:0,cornerType:"round"}),ph=Object.assign(Object.assign({},uh),{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}),gh=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 m("directional",t.sideOrCorner,1)||m("angular",t.angleValue,1)}function a(){return m("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=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 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=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 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 fh{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(fh.IsGradientStr(t))try{const e=gh(t)[0];if(e){if("linear"===e.type)return fh.ParseLinear(e);if("radial"===e.type)return fh.ParseRadial(e);if("conic"===e.type)return fh.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Ft/2,n=parseFloat(e.value)/180*Ft-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Ht,stops:fh.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:fh.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Ft/2;let n="angular"===e.type?parseFloat(e.value)/180*Ft:0;for(;n<0;)n+=Ht;for(;n>=Ht;)n-=Ht;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}const _h={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"}},yh=!0,bh=!1,xh=/\w|\(|\)|-/,Sh=/[.?!,;:/,。?!、;:]/,kh=/\S/,Ah=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function Mh(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=xo.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=wh(t,a)),a}function wh(t,e,i=!1){let s=e;for(;xh.test(t[s-1])&&xh.test(t[s])||Sh.test(t[s]);)if(s--,s<=0)return i?Th(t,e):e;return s}function Th(t,e){let i=e;for(;xh.test(t[i+1])&&xh.test(t[i])||Sh.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Ch(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=xo.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}var Bh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Eh=class{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=ch.fontSize}){let i=0,s=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 a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=wh(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_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){if(s===n){rt.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}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),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);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}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,a=!1){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=wh(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}};Eh=Bh([$a()],Eh);var Ph=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Rh=Symbol.for("TextMeasureContribution");let Oh=class extends Eh{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}};Oh=Ph([$a()],Oh);const Ih=Symbol.for("CanvasFactory"),Lh=Symbol.for("Context2dFactory");function Dh(t){return yo.getNamed(Ih,xo.global.env)(t)}const Fh=1e-4,zh=Math.sqrt(3),jh=1/3;function Hh(t){return t>-Qh&&tQh||t<-Qh}const Nh=[0,0],Wh=[0,0],Uh=[0,0];function Gh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Yh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function Xh(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 $h(t){return(t%=Ht)<0&&(t+=Ht),t}function Kh(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+=Ht);let d=Math.atan2(l,o);return d<0&&(d+=Ht),d>=s&&d<=n||d+Ht>=s&&d+Ht<=n}function Jh(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(Hh(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 ec=[-1,-1,-1],ic=[-1,-1];function sc(){const t=ic[0];ic[0]=ic[1],ic[1]=t}function nc(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(Hh(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,jh):Math.pow(i,jh),s=s<0?-Math.pow(-s,jh):Math.pow(s,jh);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+zh*Math.sin(e)))/(3*a),h=(-o+i*(s-zh*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,ec);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&sc(),p=Xh(e,s,r,o,ic[0]),u>1&&(g=Xh(e,s,r,o,ic[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Hh(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,ec);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=Yh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);ec[0]=-l,ec[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Ht-1e-4){s=0,n=Ht;const e=r?1:-1;return a>=ec[0]+t&&a<=ec[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Ht,n+=Ht);let c=0;for(let e=0;e<2;e++){const i=ec[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Ht+t),(t>=s&&t<=n||t+Ht>=s&&t+Ht<=n)&&(t>Ft/2&&t<1.5*Ft&&(e=-e),c+=e)}}return c}function oc(t){return Math.round(t/Ft*1e8)/1e8%2*Ft}function lc(t,e){let i=oc(t[0]);i<0&&(i+=Ht);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Ht?n=i+Ht:e&&i-n>=Ht?n=i-Ht:!e&&i>n?n=i+(Ht-oc(i-n)):e&&i1&&(i||(h+=Pe(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],v=a[2],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,k=b;hc[0]=S,hc[1]=k,lc(hc,Boolean(a[6])),S=hc[0],k=hc[1];const A=S,M=k-S,w=!!(1-(a[6]?0:1)),T=(s-m)*_/_+m;switch(f){case jo.M:u=m,p=v,c=u,d=p;break;case jo.L:if(i){if(Jh(c,d,m,v,e,s,n))return!0}else h+=Pe(c,d,m,v,s,n)||0;c=m,d=v;break;case jo.C:if(i){if(qh(c,d,m,v,_,y,b,x,e,s,n))return!0}else h+=nc(c,d,m,v,_,y,b,x,s,n)||0;c=b,d=x;break;case jo.Q:if(i){if(Kh(c,d,m,v,_,y,e,s,n))return!0}else h+=rc(c,d,m,v,_,y,s,n)||0;c=_,d=y;break;case jo.A:if(o=Math.cos(A)*_+m,l=Math.sin(A)*_+v,g?(u=o,p=l):h+=Pe(c,d,o,l,s,n),i){if(Zh(m,v,_,A,A+M,w,e,T,n))return!0}else h+=ac(m,v,_,A,A+M,w,T,n);c=Math.cos(A+M)*_+m,d=Math.sin(A+M)*_+v;break;case jo.R:if(u=c=m,p=d=v,o=u+_,l=p+y,i){if(Jh(u,p,o,p,e,s,n)||Jh(o,p,o,l,e,s,n)||Jh(o,l,u,l,e,s,n)||Jh(u,l,u,p,e,s,n))return!0}else h+=Pe(o,p,o,l,s,n),h+=Pe(u,l,u,p,s,n);break;case jo.Z:if(i){if(Jh(c,d,u,p,e,s,n))return!0}else h+=Pe(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},pc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const gc=Symbol.for("VWindow"),fc=Symbol.for("WindowHandlerContribution");let mc=class extends Ao{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(){super(),this.hooks={onChange:new mo(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(yo.getNamed(fc,t.env).configure(this,t),this.actived=!0)},this._uid=Ia.GenAutoIncrementId(),this.global=xo.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}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.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}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&&ut(this.width,t.width())&&ut(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)}};mc=uc([$a(),pc("design:paramtypes",[])],mc);var vc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},yc=function(t,e){return function(i,s){e(i,s,t)}};let bc=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=xo.global,this._textMeasureMap=new Map,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}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||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=dc.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="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:Kl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Le(Object.assign({defaultFontParams:{fontFamily:Kl.fontFamily,fontSize:Kl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Le.ALPHABET_CHAR_SET+Le.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=yo.get(gc),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 xc;bc=vc([$a(),yc(0,Ya(co)),yc(0,Ka(Rh)),_c("design:paramtypes",[Object])],bc),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(xc||(xc={}));const Sc=new Ne;let kc=class{constructor(){this.matrix=new Ne}init(t){return this.mode=xc.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=xc.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Sc.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(Sc.a,Sc.b,Sc.c,Sc.d,Sc.e,Sc.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Sc.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(Sc.a,Sc.b,Sc.c,Sc.d,Sc.e,Sc.f),this}scale(t,e,i){return this.mode===xc.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===xc.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Sc.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Sc.a,Sc.b,Sc.c,Sc.d,Sc.e,Sc.f),this}translate(t,e){return this.mode===xc.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===xc.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};kc=vc([$a(),_c("design:paramtypes",[])],kc);const Ac={arc:Ql,area:th,circle:eh,line:nh,path:rh,symbol:hh,text:ch,rect:lh,polygon:ah,star:oh,richtext:dh,richtextIcon:ph,image:uh,group:ih,glyph:sh},Mc=Object.keys(Ac);function wc(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Tc={arc:Object.assign({},Ac.arc),area:Object.assign({},Ac.area),circle:Object.assign({},Ac.circle),line:Object.assign({},Ac.line),path:Object.assign({},Ac.path),symbol:Object.assign({},Ac.symbol),text:Object.assign({},Ac.text),rect:Object.assign({},Ac.rect),polygon:Object.assign({},Ac.polygon),star:Object.assign({},Ac.star),richtext:Object.assign({},Ac.richtext),richtextIcon:Object.assign({},Ac.richtextIcon),image:Object.assign({},Ac.image),group:Object.assign({},Ac.group),glyph:Object.assign({},Ac.glyph)};class Cc{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Mc.forEach((t=>{this._defaultTheme[t]=Object.create(Tc[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,i=!1){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;Mc.forEach((s=>{const n=Object.create(Tc[s]);t&&t[s]&&wc(n,t[s]),i[s]&&wc(n,i[s]),e[s]&&wc(n,e[s]),this.combinedTheme[s]=n})),e.common&&Mc.forEach((t=>{wc(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 Bc=new Cc;function Ec(t,e){return t.glyphHost?Ec(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)):Bc.getTheme()}return null}(t)||t.attachedThemeGraphic&&Ec(t.attachedThemeGraphic)||Bc.getTheme()}var Pc=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 Rc extends o{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=Ia.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){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,e=!1){return Pc(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,e=!0){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,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)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===t||t===e)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===t)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,e=!1){let 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,e=!1){let 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,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Lc))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(jc(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 Lc))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=jc(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 Lc))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=jc(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 Lc))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=jc(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 Lc))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=zc.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(jc(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(jc(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,jc(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(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 Lc))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"):jc(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 Dc))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=zc.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.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),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 Hc(s,{clickInterval:a,supportsTouchEvents:o}),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 Lc,this.rootWheelEvent=new Dc,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&&v(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.addEventListener("pointermove",this.onPointerMove,!0),t.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.addEventListener("mousemove",this.onPointerMove,!0),t.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.removeEventListener("pointermove",this.onPointerMove,!0),t.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.removeEventListener("mousemove",this.onPointerMove,!0),t.removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}class Uc{static GetImage(t,e){var i;const s=Uc.cache.get(t);s?"fail"===s.loadState?xo.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):Uc.loadImage(t,e)}static GetSvg(t,e){var i;let s=Uc.cache.get(t);s?"fail"===s.loadState?xo.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"},Uc.cache.set(t,s),s.dataPromise=xo.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.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Uc.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Uc.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=xo.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=xo.global.loadBlob(t):"json"===e&&(i.dataPromise=xo.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Uc.isLoading&&Uc.toLoadAueue.length){Uc.isLoading=!0;const t=Uc.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Uc.cache.set(i,n),n.dataPromise=xo.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))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Uc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Uc.loading()})).catch((t=>{console.error(t),Uc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Uc.loading()}))}}),0)}static loadImage(t,e){const i=Gc(t,Uc.toLoadAueue);if(-1!==i)return Uc.toLoadAueue[i].marks.push(e),void Uc.loading();Uc.toLoadAueue.push({url:t,marks:[e]}),Uc.loading()}static improveImageLoading(t){const e=Gc(t,Uc.toLoadAueue);if(-1!==e){const t=Uc.toLoadAueue.splice(e,1);Uc.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Gc(t,e){for(let i=0;it?_(t)?0===t.length?0:1===t.length?t[0]:2===t.length?($c[0]=t[0],$c[2]=t[0],$c[1]=t[1],$c[3]=t[1],$c):t:t:0,qc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Zc=[1,2,3,0,1,2,3,0];function Jc(t,e,i,s){for(;t>=Ht;)t-=Ht;for(;t<0;)t+=Ht;for(;t>e;)e+=Ht;qc[0].x=i,qc[1].y=i,qc[2].x=-i,qc[3].y=-i;const n=Math.ceil(t/zt)%4,r=Math.ceil(e/zt)%4;if(s.add(Wt(t)*i,Yt(t)*i),s.add(Wt(e)*i,Yt(e)*i),n!==r||e-t>Ft){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new se(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new se(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{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)}}id.TimeOut=1e3/60;const sd=new id,nd=(t,e)=>{const i=((t,e)=>v(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};class rd{bounds(t,e){if(x(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}parseSize(t){return x(t)?t:Math.min(t[0],t[1])}}function ad(t,e,i,s,n){return n?t.arc(i,s,e,0,jt,!1,n):t.arc(i,s,e,0,jt),!1}var od=new class extends rd{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 ad(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return ad(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(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 ld=new class extends rd{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,this.parseSize(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,this.parseSize(e)/6,i,s,n,r)}};function hd(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 cd=new class extends rd{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 hd(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return hd(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return hd(t,this.parseSize(e)/2+n,i,s,r)}};function dd(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var ud=new class extends rd{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return dd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return dd(t,this.parseSize(e)/2+n,i,s)}};function pd(t,e,i,s,n=0){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}class gd extends rd{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 pd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return pd(t,this.parseSize(e)/2,i,s,n)}}var fd=new gd;var md=new class extends gd{constructor(){super(...arguments),this.type="triangle"}};const vd=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),_d=Math.sin(jt/10)*vd,yd=-Math.cos(jt/10)*vd;function bd(t,e,i,s){const n=_d*e,r=yd*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=jt*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 xd=new class extends rd{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 bd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return bd(t,this.parseSize(e)/2+n,i,s)}};const Sd=Xt(3);function kd(t,e,i,s){const n=e,r=n/Sd,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 Ad=new class extends rd{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 kd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return kd(t,this.parseSize(e)/2+n,i,s)}};function Md(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 wd=new class extends rd{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Md(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Md(t,this.parseSize(e)/2+n,i,s)}};function Td(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Cd=new class extends rd{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Td(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Td(t,this.parseSize(e)/2+n,i,s)}};const Bd=-.5,Ed=Xt(3)/2,Pd=1/Xt(12);function Rd(t,e,i,s){const n=e/2,r=e*Pd,a=n,o=e*Pd+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(Bd*n-Ed*r+i,Ed*n+Bd*r+s),t.lineTo(Bd*a-Ed*o+i,Ed*a+Bd*o+s),t.lineTo(Bd*l-Ed*h+i,Ed*l+Bd*h+s),t.lineTo(Bd*n+Ed*r+i,Bd*r-Ed*n+s),t.lineTo(Bd*a+Ed*o+i,Bd*o-Ed*a+s),t.lineTo(Bd*l+Ed*h+i,Bd*h-Ed*l+s),t.closePath(),!1}var Od=new class extends rd{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 Rd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Rd(t,this.parseSize(e)/2+n,i,s)}};function Id(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}var Ld=new class extends rd{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 Id(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Id(t,this.parseSize(e)/2,i,s,n)}};function Dd(t,e,i,s,n=0){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}var Fd=new class extends rd{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 Dd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Dd(t,this.parseSize(e)/2,i,s,n)}};function zd(t,e,i,s,n=0){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}var jd=new class extends rd{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 zd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return zd(t,this.parseSize(e)/2,i,s,n)}};const Hd=Xt(3);function Vd(t,e,i,s){const n=e*Hd;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var Nd=new class extends rd{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Vd(t,this.parseSize(e)/2/Hd,i,s)}drawOffset(t,e,i,s,n){return Vd(t,this.parseSize(e)/2/Hd+n,i,s)}};function Wd(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 Ud=new class extends rd{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 Wd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Wd(t,this.parseSize(e)/4+n,i,s)}};function Gd(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 Yd=new class extends rd{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 Gd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Gd(t,this.parseSize(e)/4+n,i,s)}};function Xd(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 $d=new class extends rd{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 Xd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Xd(t,this.parseSize(e)/4+n,i,s)}};function Kd(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 qd=new class extends rd{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 Kd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Kd(t,this.parseSize(e)/4+n,i,s)}};function Zd(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var Jd=new class extends rd{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return Zd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Zd(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function Qd(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var tu=new class extends rd{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return Qd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Qd(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function eu(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 iu=new class extends rd{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 eu(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return eu(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function su(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function nu(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var ru=new class extends rd{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 x(e)?nu(t,e,i,s):su(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){x(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return x(e)?nu(t,e+2*n,i,s):su(t,[e[0]+2*n,e[1]+2*n],i,s)}};const au=new He;class ou{constructor(t,e,i=!1){this.pathStr="",this.type=t,_(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),el(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(el(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return x(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{au.x1=i.bounds.x1*t,au.y1=i.bounds.y1*t,au.x2=i.bounds.x2*t,au.y2=i.bounds.y2*t,e.union(au)}))}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 lu={};[od,ld,cd,ud,Nd,md,xd,Ad,wd,Cd,Od,Ld,Fd,fd,jd,Ud,Yd,$d,qd,ru,Jd,tu,iu].forEach((t=>{lu[t.type]=t}));const hu={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"};class cu{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 du(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function uu(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",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=uu(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=du(t,"--\x3e",r+4,"Comment is not closed.");else{const a=uu(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 cu(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 cu(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 fu(t,e){return mu(t)}function mu(t,e){const i={};for(let e=0;eMu.set(t,!0)));const wu=new Map;function Tu(t){if(Mu.has(t))return!0;if(wu.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>wu.set(t,!0)));const Cu=ku(),Bu=ku(),Eu=ku(),Pu=ku(),Ru=ku(),Ou=ku(),Iu=ku(),Lu=ku(),Du=ku(),Fu=ku();ku();const zu=ku();ku();const ju=ku();ku();const Hu=ku(),Vu=ku(),Nu=Symbol.for("GraphicService"),Wu=Symbol.for("GraphicCreator"),Uu={"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"},Gu=Object.keys(Uu),Yu={duration:200,easing:"cubicOut"};function Xu(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}function $u(t,e,i){const s=i[0],n=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]*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],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*s+c*n+g*r+e[12],t[13]=o*s+d*n+f*r+e[13],t[14]=l*s+u*n+m*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function Ku(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 qu(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],f=e[12],m=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*f,t[1]=y*n+b*l+x*u+S*m,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*f,t[5]=y*n+b*l+x*u+S*m,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*f,t[9]=y*n+b*l+x*u+S*m,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*f,t[13]=y*n+b*l+x*u+S*m,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function Zu(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 Ju{constructor(){this.pools=[]}static identity(t){return Xu(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 Ju.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},ip=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const sp=new Ne(1,0,0,1,0,0),np={x:0,y:0};let rp=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new Ne(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ne(1,0,0,1,0,0),this.path=new Nl,this._clearMatrix=new Ne(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Qu.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ne(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(Qu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Qu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){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,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=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(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){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},np),function(t,e,i){return cc(t,0,!1,e,i)}(this.path.commandList,np.x,np.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},np);const i=mh(this,this.lineWidth,this.dpr);return function(t,e,i,s){return cc(t,e,!0,i,s)}(this.path.commandList,i,np.x,np.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(t=!0,e=this.dpr){this.setTransformFromMatrix(sp,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Qu.free(t))),this.stack.length=0}};rp=ep([$a(),ip("design:paramtypes",[Object,Number])],rp);const ap={WIDTH:500,HEIGHT:500,DPR:1};class op{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}set nativeCanvas(t){this._nativeCanvas=t}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=ap.WIDTH,height:n=ap.HEIGHT,dpr:r=ap.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(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var lp;op.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(lp||(lp={}));class hp{static Get(t,e=lp.Color1,i=[0,0,0,1]){if(e===lp.Color1){const e=hp.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ti.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];hp.store1[t]=e,hp.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=hp.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ti.parseColorString(t);return n&&(hp.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],hp.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===lp.Color1){if(hp.store1[t])return;hp.store1[t]=i,hp.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(hp.store255[t])return;hp.store255[t]=i,hp.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function cp(t,e=!1){return Array.isArray(t)&&x(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 dp(t,e,i,s,n){return Array.isArray(t)&&!x(t[0])||Array.isArray(e)&&!x(e[0])?new Array(4).fill(0).map(((n,r)=>{var a,o;return up(_(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,_(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):up(t,e,i,s,n)}function up(t,e,i,s,n){if(!t||!e)return t&&cp(t)||e&&cp(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=hp.Get(t,lp.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=hp.Get(e,lp.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:cp(a)})))});return o?dp(r,l,i,s,n):dp(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:mp(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:mp(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:mp(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),cp(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)}function pp(t,e,i){return`rgba(${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})`}hp.store255={},hp.store1={};const gp=[0,0,0,0],fp=[0,0,0,0];function mp(t,e,i){return hp.Get(t,lp.Color255,gp),hp.Get(e,lp.Color255,fp),`rgba(${Math.round(gp[0]+(fp[0]-gp[0])*i)},${Math.round(gp[1]+(fp[1]-gp[1])*i)},${Math.round(gp[2]+(fp[2]-gp[2])*i)},${gp[3]+(fp[3]-gp[3])*i})`}class vp{static GetCanvas(){try{return vp.canvas||(vp.canvas=xo.global.createCanvas({})),vp.canvas}catch(t){return null}}static GetCtx(){if(!vp.ctx){const t=vp.GetCanvas();vp.ctx=t.getContext("2d")}return vp.ctx}}class _p extends We{static getInstance(){return _p._instance||(_p._instance=new _p),_p._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=vp.GetCanvas(),s=vp.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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new _p(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class yp{static GetSize(t){for(let e=0;e=t)return yp.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=yp.GenKey(t,e,i,s,n),l=yp.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=yp.GenKey(t,e,i,s,n);yp.cache[l]?yp.cache[l].push({width:a,height:o,pattern:r}):yp.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}yp.cache={},yp.ImageSize=[20,40,80,160,320,640,1280,2560];const bp=new He,xp=new Ne;new He;const Sp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],kp=["x","y"],Ap=["scaleX","scaleY"],Mp=["angle"],wp=new se,Tp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Cp extends Rc{static mixin(t){const e=Object.keys(t);for(let i=0;i10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=lu[t];if(e)return e;if(e=Cp.userSymbolMap[t],e)return e;if(!0===((i=t=hu[t]||t).startsWith("{const e=(new Nl).fromString(t.d),i={};Gu.forEach((e=>{t[e]&&(i[Uu[e]]=t[e])})),n.push({path:e,attribute:i}),bp.union(e.bounds)}));const r=bp.width(),a=bp.height(),o=1/Ut(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new ou(t,n,!0);return Cp.userSymbolMap[t]=l,l}var i;const s=(new Nl).fromString(t),n=s.bounds.width(),r=s.bounds.height(),a=1/Ut(n,r);s.transform(0,0,a,a);const o=new ou(t,s);return Cp.userSymbolMap[t]=o,o}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,s=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:n=e.boundsPadding}=i,r=Kc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new Lo(t);return el(e.commandList,i,0,0),!0}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(t=!0){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(t=!0){return this._transMatrix||(this._transMatrix=new Ne),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&Yo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&Yo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}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===Xo.GLOBAL){const i=new se(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){this.setAttributes(t,e,i),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||s)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,i){t&&((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,e=!1,i){const s=Object.keys(t);for(let e=0;e{i[e]?(o||(o={}),o[e]=t[e]):a[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(r=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==r?r:Yu;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:a,duration:l.duration,easing:l.easing}}]),o&&this.setAttributesAndPreventAnimate(o,!1,{type:$o.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t)}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:$o.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{type:$o.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(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,i;const s=this.attribute[t];return this.animates&&this.animates.size?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=s?s:null===(i=this.finalAttribute)||void 0===i?void 0:i[t]}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){const i=_(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);s.length!==this.currentStates.length&&this.useStates(s,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;this.stateSort&&(t=t.sort(this.stateSort));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,i){const s=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Gl.x,y:e=Gl.y,scaleX:i=Gl.scaleX,scaleY:s=Gl.scaleY,angle:n=Gl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(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=Wt(a),f=Yt(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const _=m-i,y=v-s,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,k=d*g-h*f;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*k,t.e=u+l*m+c*v-b*_-S*y,t.f=p+h*m+d*v-x*_-k*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,!0),xo.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Gl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=xp.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.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:$o.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:xo.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),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 v(t,!0)?this.pathProxy=(new Nl).fromString(t):this.pathProxy=new Nl,this.pathProxy}loadImage(t,e=!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(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",this.stopAnimates(),xo.graphicService.onRelease(this),super.release()}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new Fc(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)}}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||xo.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new rp(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}var Bp;Cp.userSymbolMap={},Cp.mixin(Vc),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Bp||(Bp={}));let Ep=class t extends Cp{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Ou,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 Cc),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Cc)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===Xo.GLOBAL){const i=new se(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;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Gl.x,y:e=Gl.y,dx:i=Gl.dx,dy:s=Gl.dy,scaleX:n=Gl.scaleX,scaleY:r=Gl.scaleY,angle:a=Gl.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()}getGraphicTheme(){return Ec(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return xo.graphicService.updateTempAABBBounds(i),xo.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=Yo.CLEAR_BOUNDS,this._childUpdateTag&=Yo.CLEAR_BOUNDS}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(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().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),this.getGraphicService().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(t=!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=xo.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}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}};function Pp(t){return new Ep(t)}Ep.NOWORK_ANIMATE_ATTR=Tp;class Rp extends Ep{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 Cc,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!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=>{xo.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=>{xo.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 Op=Symbol.for("TransformUtil"),Ip=Symbol.for("GraphicUtil"),Lp=Symbol.for("LayerService"),Dp=Symbol.for("StaticLayerHandlerContribution"),Fp=Symbol.for("DynamicLayerHandlerContribution"),zp=Symbol.for("VirtualLayerHandlerContribution");var jp,Hp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Np=jp=class{static GenerateLayerId(){return`${jp.idprefix}_${jp.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=xo.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?yo.get(Dp):"dynamic"===t?yo.get(Fp):yo.get(zp),e}createLayer(t,e={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 Rp(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:jp.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)}};Np.idprefix="visactor_layer",Np.prefix_count=0,Np=jp=Hp([$a(),Vp("design:paramtypes",[])],Np);var Wp=new La((t=>{t(_o).to(Bo).inSingletonScope(),t(gc).to(mc),t(Ip).to(bc).inSingletonScope(),t(Op).to(kc).inSingletonScope(),t(Lp).to(Np).inSingletonScope()}));function Up(t,e){return!(!t&&!e)}function Gp(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Yp(t,e,i){return i&&t*e>0}function Xp(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function $p(t,e){return t*e>0}function Kp(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function qp(t,e,i,s,n,r,a){const o=t-i,l=e-s,h=(a?r:-r)/Math.sqrt(o*o+l*l),c=h*l,d=-h*o,u=t+c,p=e+d,g=i+c,f=s+d,m=(u+g)/2,v=(p+f)/2,_=g-u,y=f-p,b=_*_+y*y,x=n-r,S=u*f-g*p,k=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let A=(S*y-_*k)/b,M=(-S*_-y*k)/b;const w=(S*y+_*k)/b,T=(-S*_+y*k)/b,C=A-m,B=M-v,E=w-m,P=T-v;return C*C+B*B>E*E+P*P&&(A=w,M=T),{cx:A,cy:M,x01:-c,y01:-d,x11:A*(n/x-1),y11:M*(n/x-1)}}function Zp(t,e,i,s,n){const r=Vt(i-e),a=t.getParsedCornerRadius(),o=_(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,y=Math.max(f,g),b=Math.max(m,v);let x=y,S=b;const k=n*Wt(c),A=n*Yt(c),M=s*Wt(u),w=s*Yt(u);let T,C,B,E;if((b>Dt||y>Dt)&&(T=n*Wt(d),C=n*Yt(d),B=s*Wt(p),E=s*Yt(p),r1?0:P<-1?Ft:Math.acos(P))/2),l=Xt(t[0]*t[0]+t[1]*t[1]);S=Gt(b,(s-l)/(o-1)),x=Gt(y,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:k,yors:A,xirs:B,yirs:E,xore:T,yore:C,xire:M,yire:w,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:y,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function Jp(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(n=Ht-Dt)e.moveTo(i+n*Wt(o),s+n*Yt(o)),e.arc(i,s,n,o,l,!c),r>Dt&&(e.moveTo(i+r*Wt(l),s+r*Yt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:k,outerStartAngle:A,outerEndAngle:M,limitedIcr:w,innerDeltaAngle:T,innerEndAngle:C,innerStartAngle:B,innerCornerRadiusStart:E,innerCornerRadiusEnd:P,maxInnerCornerRadius:R}=Zp(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>Dt){const t=Gt(v,m),r=Gt(_,m),o=qp(g,f,u,p,n,t,Number(c)),l=qp(b,x,S,k,n,r,Number(c));m0&&e.arc(i+o.cx,s+o.cy,t,Nt(o.y01,o.x01),Nt(o.y11,o.x11),!c),e.arc(i,s,n,Nt(o.cy+o.y11,o.cx+o.x11),Nt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Nt(l.y11,l.x11),Nt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Wt(Nt(l.y01,l.x01)),s+l.cy+r*Yt(Nt(l.y01,l.x01))):e.moveTo(i+b,s+n*Yt(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,A,M,!c)):e.moveTo(i+n*Wt(M),s+n*Yt(M));if(!(r>Dt)||T<.001)!a||a[1]?e.lineTo(i+S,s+k):e.moveTo(i+S,s+k),d=!0;else if(w>Dt){const t=Gt(E,w),n=Gt(P,w),o=qp(S,k,b,x,r,-n,Number(c)),l=qp(u,p,g,f,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),w0&&e.arc(i+o.cx,s+o.cy,n,Nt(o.y01,o.x01),Nt(o.y11,o.x11),!c),e.arc(i,s,r,Nt(o.cy+o.y11,o.cx+o.x11),Nt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Nt(l.y11,l.x11),Nt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Wt(Nt(l.y01,l.x01)),s+l.cy+t*Yt(Nt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+k):e.moveTo(i+S,s+k),!a||a[2]?e.arc(i,s,r,C,B,c):e.moveTo(i+r*Wt(B),s+r*Yt(B))}return a?a[3]&&e.lineTo(i+n*Wt(o),s+n*Yt(o)):e.closePath(),d}const Qp=Symbol.for("ArcRenderContribution"),tg=Symbol.for("AreaRenderContribution"),eg=Symbol.for("CircleRenderContribution"),ig=Symbol.for("GroupRenderContribution"),sg=Symbol.for("ImageRenderContribution"),ng=Symbol.for("PathRenderContribution"),rg=Symbol.for("PolygonRenderContribution"),ag=Symbol.for("RectRenderContribution"),og=Symbol.for("SymbolRenderContribution"),lg=Symbol.for("TextRenderContribution"),hg=Symbol.for("InteractiveSubRenderContribution");function cg(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function dg(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}var ug=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},gg=function(t,e){return function(i,s){e(i,s,t)}};function fg(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:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:v}=e.attribute,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(s=m[2])&&void 0!==s?s:0}if(Xu(t),$u(t,t,[n+o,r+l,a+h]),$u(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),$u(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]),f){const i=tp.allocate(),s=[0,0];if(v){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=m[1]}$u(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,f),$u(i,i,[-s[0],-s[1],0]),qu(t,t,i)}}let mg=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new mo(["graphic"]),onSetStage:new mo(["graphic","stage"]),onRemove:new mo(["graphic"]),onRelease:new mo(["graphic"]),onAddIncremental:new mo(["graphic","group","stage"]),onClearIncremental:new mo(["graphic","group","stage"]),beforeUpdateAABBBounds:new mo(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new mo(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new mo(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new He,this.tempAABBBounds2=new He}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)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}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 el(i.commandList,s,0,0),!0}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=x(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=dg(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=x(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=cg(n,e);i.set(s,i.y1,s+e,i.y2)}}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){xu(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;xu(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&&ze(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};mg=ug([$a(),gg(0,Ya(Wu)),pg("design:paramtypes",[Object])],mg);const vg=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},_g=["radius","startAngle","endAngle",...Sp];class yg extends Cp{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=Pu}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)}getGraphicTheme(){return Ec(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=xo.graphicService.updateTempAABBBounds(i);return vg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,xo.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Ht-Dt?i.set(-r,-r,r,r):Jc(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,_g)}needUpdateTag(t){return super.needUpdateTag(t,_g)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Nl,s.arc(0,0,r,a,o),s}clone(){return new yg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return yg.NOWORK_ANIMATE_ATTR}}function bg(t){return new yg(t)}yg.NOWORK_ANIMATE_ATTR=Tp;class xg{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Eo.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,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;a{t+=e.str})),(Array.isArray(r)?r.join(""):r).toString()!==t}return"vertical"===s.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==s.text.toString():null!=this.clipedText&&this.clipedText!==s.text.toString()}get multilineLayout(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=Vu,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}getGraphicTheme(){return Ec(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new kg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Ae(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=xo.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){xu(n,o/Math.abs(r+a),!0,l),i.union(n)}return xo.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||xo.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,ze(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:_=s.ignoreBuf,keepCenterInLine:y=s.keepCenterInLine}=n,b=_?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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(f/2),this._AABBBounds}const S=xo.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),k=new xg(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:y}),{bbox:A}=k;return this.cache.layoutData=k,this.clearUpdateShapeTag(),this._AABBBounds.set(A.xOffset,A.yOffset,A.xOffset+A.width,A.yOffset+A.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{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,measureMode:v=r.measureMode,suffixPosition:y=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,k=m?0:this.guessLineHeightBuf(h),A=this.getLineHeight(this.attribute,r,k);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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 M=xo.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),w={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:A},T=new xg(a,w,M),C=_(t)?t.map((t=>t.toString())):[t.toString()],B=[],E=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/A),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),E[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Ut(e,a)}));const t=cg(_,a),e=this.cache.verticalList.length*v,i=dg(y,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>function(t){const e=[];let i=0,s="";for(let n=0;n{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===Au.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))})),this.cache.verticalList=b,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Ut(e,a)}));const x=cg(_,a),S=this.cache.verticalList.length*v,k=dg(y,S,d);return this._AABBBounds.set(k,x,k+S,x+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=nd(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=Sg){return super.needUpdateTags(t,e)}needUpdateTag(t,e=Sg){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new kg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return kg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return kg.baselineMapAlign}getAlignMapBaseline(){return kg.alignMapBaseline}}function Ag(t){return new kg(t)}kg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Tp),kg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},kg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Mg=["symbolType","size",...Sp];let wg=class t extends Cp{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=Hu}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}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{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return Ec(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=xo.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;xu(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){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){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,Mg)}needUpdateTag(t){return super.needUpdateTag(t,Mg)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new Nl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Nl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Tg(t){return new wg(t)}wg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Tp);const Cg=["segments","points","curveType","curveTension",...Sp];let Bg=class t extends Cp{constructor(t={}){super(t),this.type="line",this.numberType=Lu}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=td(i,s,e))}getGraphicTheme(){return Ec(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),xo.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Cg)}needUpdateTag(t){return super.needUpdateTag(t,Cg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Nl;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Eg(t){return new Bg(t)}Bg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Tp);const Pg=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=d(t.width)?t.x1-t.x:t.width,i=d(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}},Rg=["width","x1","y1","height","cornerRadius",...Sp];class Og extends Cp{constructor(t){super(t),this.type="rect",this.numberType=zu}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Ec(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=xo.graphicService.updateTempAABBBounds(i);return vg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,xo.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Rg)}needUpdateTag(t){return super.needUpdateTag(t,Rg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=Pg(e);return t=new Nl,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new Og(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Og.NOWORK_ANIMATE_ATTR}}function Ig(t){return new Og(t)}Og.NOWORK_ANIMATE_ATTR=Tp;class Lg extends Cp{constructor(t){super(t),this.type="glyph",this.numberType=Ru,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,e=!1,i){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}getGraphicTheme(){return Ec(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}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(),this.stateSort&&(t=t.sort(this.stateSort));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.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Lg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Lg.NOWORK_ANIMATE_ATTR}}function Dg(t){return new Lg(t)}Lg.NOWORK_ANIMATE_ATTR=Tp;class Fg{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=_h[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}}}function zg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class jg{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=nd(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Ch(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||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,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r: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}=Ch(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Mh(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Ch(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=zg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Mh(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Ch(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=zg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=zg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=zg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=zg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&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=Mh(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Ch(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const Hg=["width","height","image",...Sp];class Vg extends Cp{constructor(t){super(t),this.type="image",this.numberType=Iu,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}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()})),this.addUpdateBoundTag()}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)}getGraphicTheme(){return Ec(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=xo.graphicService.updateTempAABBBounds(i);return vg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,xo.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return uh[t]}needUpdateTags(t){return super.needUpdateTags(t,Hg)}needUpdateTag(t){return super.needUpdateTag(t,Hg)}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({image:1,repeatX:1,repeatY:1},Tp);class Wg extends Vg{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=Kc(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=Kc(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=uh.width,height:e=uh.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 Ug{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 Wg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=_h[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof jg){const e=kh.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,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Wg)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Ch(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Wg)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Wg)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||bh;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,Ah(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||yh;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?vh(t,s,{AABBBounds:i}):s,Ah(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Wg)break;const{width:n}=Ch(t,s.character,s.ascentDescentMode),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.forEach(((t,e)=>{i+=t instanceof Wg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Gg{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=_h[this.direction]}store(t){if(t instanceof Wg){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 Ug(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,e=!1){t instanceof Wg?"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||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Mh(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new jg(i,t.newLine,t.character,t.ascentDescentMode),new jg(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Yg=!1;try{Yg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Yg=!1}const Xg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...Sp];class $g extends Cp{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=ju,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:dh.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:dh.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:dh.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:dh.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:dh.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:dh.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:dh.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:dh.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Ec(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&v(t.text)&&$g.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&v(t.text)&&$g.splitText(t.text).length>1)))}static splitText(t){if(Yg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=$g.splitText(t.text.toString());if(v(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),xo.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||xo.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,xo.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Xg)}needUpdateTag(t){return super.needUpdateTag(t,Xg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!$g.AllSingleCharacter(_)&&(_=$g.TransformTextConfig2SingleCharacter(_),this.attribute.textConfig=_);const y=[],b=null!=t?t:_;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,y.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(x(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,k="number"==typeof s&&Number.isFinite(s)&&s>0,A="number"==typeof n&&Number.isFinite(n)&&n>0&&(!S||n<=i),M="number"==typeof r&&Number.isFinite(r)&&r>0&&(!k||r<=s),w=new Fg(0,0,(A?n:S?i:0)||0,(M?r:k?s:0)||0,a,o,l,h,c,d||"horizontal",!A&&S,!M&&k,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),T=new Gg(w);if(T.newLine=v,p){let t=0,e=!1;for(let i=0;i{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=w}clone(){return new $g(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(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())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return $g.NOWORK_ANIMATE_ATTR}}function Kg(t){return new $g(t)}$g.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Tp);const qg=["path","customPath",...Sp];class Zg extends Cp{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=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Nl?e.path:(d(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Nl?this.cache:t.path)}getGraphicTheme(){return Ec(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=xo.graphicService.updateTempAABBBounds(i);vg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;v(t.path,!0)?this.cache=(new Nl).fromString(t.path):t.customPath&&(this.cache=new Nl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,qg)}needUpdateTag(t){return super.needUpdateTag(t,qg)}toCustomPath(){return(new Nl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Zg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Zg.NOWORK_ANIMATE_ATTR}}function Jg(t){return new Zg(t)}Zg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Tp);const Qg=["segments","points","curveType","curveTension",...Sp];class tf extends Cp{constructor(t){super(t),this.type="area",this.numberType=Eu}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}getGraphicTheme(){return Ec(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),xo.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),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}_interpolate(t,e,i,s,n){"points"===t&&(n.points=td(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Qg)}needUpdateTag(t){return super.needUpdateTag(t,Qg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Nl;const 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 tf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return tf.NOWORK_ANIMATE_ATTR}}function ef(t){return new tf(t)}tf.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Tp);const sf=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Sp];class nf extends Cp{constructor(t){super(t),this.type="arc",this.numberType=Cu}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=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(x(t,!0)?t:a*parseFloat(t)/100,a/2);if(_(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();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=oe(e),i=e+r,s&&Vt(r)Dt&&o>Dt)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=this.getGraphicTheme(),{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=Xt(a*a+o*o)}=this.attribute,h=Vt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>Dt&&l>Dt){const i=e>t?1:-1;let s=Kt(Number(l)/o*Yt(g)),n=Kt(Number(l)/a*Yt(g));return(f-=2*s)>Dt?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>Dt?(n*=i,c+=n,d-=n):(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}}getGraphicTheme(){return Ec(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=xo.graphicService.updateTempAABBBounds(i);vg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=Dt?i.set(0,0,0,0):Math.abs(o-l)>Ht-Dt?i.set(-s,-s,s,s):(Jc(l,o,s,i),Jc(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,sf)}needUpdateTag(t){return super.needUpdateTag(t,sf)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Vt(o-a),d=o>a;if(h=Ht-Dt)n.moveTo(0+h*Wt(a),0+h*Yt(a)),n.arc(0,0,h,a,o,!d),l>Dt&&(n.moveTo(0+l*Wt(o),0+l*Yt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Wt(a),e=h*Yt(a),i=l*Wt(o),s=l*Yt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new nf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return nf.NOWORK_ANIMATE_ATTR}}function rf(t){return new nf(t)}nf.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Tp);const af=["points","cornerRadius",...Sp];class of extends Cp{constructor(t){super(t),this.type="polygon",this.numberType=Fu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Ec(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),xo.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=td(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,af)}needUpdateTag(t){return super.needUpdateTag(t,af)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Nl,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new of(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return of.NOWORK_ANIMATE_ATTR}}function lf(t){return new of(t)}of.NOWORK_ANIMATE_ATTR=Tp;class hf extends Ep{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!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 cf(t){return new hf(t)}const df=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 uf,pf;function gf(t){return uf||(uf=df.CreateGraphic("text",{})),uf.initAttributes(t),uf.AABBBounds}var ff=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},vf=function(t,e){return function(i,s){e(i,s,t)}};class _f{constructor(){this.time=Zo.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:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit,backgroundKeepAspectRatio:y=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:k=l.backgroundClip}=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=Ec(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}k&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:_,backgroundKeepAspectRatio:y,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s){const{backgroundMode:n,backgroundFit:r,backgroundKeepAspectRatio:a,backgroundScale:o=1,backgroundOffsetX:l=0,backgroundOffsetY:h=0}=s,c=i.width(),d=i.height();let u=c,p=d;if("no-repeat"===n)if(r)if(a){const s=Math.max(c/e.width,d/e.height);t.drawImage(e,i.x1+l,i.y1+h,e.width*s*o,e.height*s*o)}else t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const s=e.width*o,n=e.height*o;t.drawImage(e,i.x1+l,i.y1+h,s,n)}else{if(r&&"repeat"!==n&&(e.width||e.height)){const i=e.width,s=e.height;"repeat-x"===n?(u=i*(d/s),p=d):"repeat-y"===n&&(p=s*(c/i),u=c);const r=t.dpr,a=dc.allocate({width:u,height:p,dpr:r}),o=a.getContext("2d");o&&(o.inuse=!0,o.clearMatrix(),o.setTransformForCurrent(!0),o.clearRect(0,0,u,p),o.drawImage(e,0,0,u,p),e=a.nativeCanvas),dc.free(a)}const s=t.dpr,a=t.createPattern(e,n);a.setTransform&&a.setTransform(new DOMMatrix([1/s,0,0,1/s,0,0])),t.fillStyle=a,t.translate(i.x1,i.y1),t.fillRect(0,0,c,d),t.translate(-i.x1,-i.y1)}}}const yf=new _f;let bf=class{constructor(t){this.subRenderContribitions=t,this.time=Zo.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)}))}};bf=ff([$a(),vf(0,Ya(co)),vf(0,Ka(hg)),mf("design:paramtypes",[Object])],bf);const xf=new class{constructor(){this.time=Zo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),_=t.AABBBounds,y=null!==(p=t.attribute.width)&&void 0!==p?p:_.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:_.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[y,b],i+y/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const Sf=new class{constructor(){this.time=Zo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}};class kf{constructor(){this.time=Zo.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=dc.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])),dc.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,Ht),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:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h;const{textureRatio:c=r.textureRatio,textureOptions:d=null}=e.attribute;let u=this.textureMap.get(t);if(!u)switch(t){case"circle":u=this.createCirclePattern(o,l,a,i);break;case"diamond":u=this.createDiamondPattern(o,l,a,i);break;case"rect":u=this.createRectPattern(o,l,a,i);break;case"vertical-line":u=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":u=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":u=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":u=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":u=this.createGridPattern(o,l,a,i)}if(d&&d.dynamicTexture){const{gridConfig:u={},useNewCanvas:p}=d,g=e.AABBBounds;s=g.x1,n=g.y1;const f=i;let m;if(p){m=dc.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=m.getContext("2d");t.clearRect(0,0,g.width(),g.height()),s=0,n=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,s,n,r),f.clip();const v=g.width(),_=g.height(),y=l,b=o,x=u.columns?u.columns:Math.ceil(v/b),S=u.rows?u.rows:Math.ceil(_/b),k=u.gutterColumn?u.gutterColumn:2*y,A=u.gutterRow?u.gutterRow:2*y;this._tempSymbolGraphic||(this._tempSymbolGraphic=Tg({}));const M=u.columns?v/u.columns:b,w=u.rows?_/u.rows:b;this._tempSymbolGraphic.setAttributes({size:[M-k,w-A],symbolType:t});const T=this._tempSymbolGraphic.getParsedPath();for(let t=0;t{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:mh(e,o,e.dpr),c=o/T,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:T+u*h,innerRadius:w-u*h,startAngle:_-u*c,endAngle:y+u*c}),e.beginPath(),Jp(t,e,i,s,T+u*h,w-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/k,(S-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder"),t.setAttributes({outerRadius:T,innerRadius:w,startAngle:_,endAngle:y})}},wf=Af,Tf=yf;const Cf=new class{constructor(){this.time=Zo.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,f=p&&!1!==p.visible;if(!g&&!f)return;const{radius:m=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:k=l.scaleY,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:mh(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),f&&M(p,"innerBorder")}},Bf=Af,Ef=yf;const Pf=new class extends _f{constructor(){super(...arguments),this.time=Zo.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,backgroundKeepAspectRatio:f=l.backgroundKeepAspectRatio,backgroundScale:m=l.backgroundScale,backgroundOffsetX:v=l.backgroundOffsetX,backgroundOffsetY:_=l.backgroundOffsetY}=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,{backgroundMode:p,backgroundFit:g,backgroundKeepAspectRatio:f,backgroundScale:m,backgroundOffsetX:v,backgroundOffsetY:_}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Rf=Ft/2;function Of(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),x(r,!0))l=[r=Vt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Vt(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Vt(t[0]),i=Vt(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Vt(l[0]),l[1]=Vt(l[1]),l[2]=Vt(l[2]),l[3]=Vt(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],_=[c[0],c[1]+g[1]],y=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],S=[u[0]+g[3],u[1]],k=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!K(v,_)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Rf,0,!1)}if(o&&o[1]?o[1](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!K(y,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Rf,!1)}if(o&&o[2]?o[2](y[0],y[1],S[0],S[1]):t.lineTo(S[0],S[1]),!K(S,k)){const e=S[0],i=S[1]-g[3];o&&o[2]&&t.moveTo(S[0],S[1]),t.arc(e,i,g[3],Rf,Ft,!1)}if(o&&o[3]?o[3](k[0],k[1],m[0],m[1]):t.lineTo(m[0],m[1]),!K(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],Ft,Ft+Rf,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),o&&o[2]?o[2](y[0],y[1],S[0],S[1]):t.lineTo(S[0],S[1]),o&&o[2]?o[2](S[0],S[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}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};class Lf{constructor(){this.time=Zo.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,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:k=l.scaleY,x1:A,y1:M,keepStrokeScale:w=l.keepStrokeScale}=t.attribute;let{width:T,height:C}=t.attribute;T=(null!=T?T:A-i)||0,C=(null!=C?C:M-s)||0;const B=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=w?h:mh(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||_(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,T-o*g,C-o*g)):(e.beginPath(),Of(e,u,p,T-o*g,C-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&B(u,"outerBorder"),f&&B(p,"innerBorder")}}let Df=class{constructor(){this.time=Zo.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)}};Df=If([$a()],Df);let Ff=class{constructor(){this.time=Zo.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:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:y=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||_(v)&&v.every((t=>0===t)))){let n,r=0;return Of(e,i,s,b,x,v,"bevel"!==y,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};Ff=If([$a()],Ff);const zf=new Lf,jf=Af,Hf=yf;const Vf=new class extends Lf{constructor(){super(...arguments),this.time=Zo.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)}},Nf=yf;const Wf=new class{constructor(){this.time=Zo.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,f=p&&!1!==p.visible,m=g&&!1!==g.visible;if(!f&&!m)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,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,A=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:mh(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(y-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&A(p,"outerBorder"),m&&A(g,"innerBorder")}},Uf=new class{constructor(){this.time=Zo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:_=l.scaleX,scaleY:y=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/_,(f-s)/y,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/_,(f-s)/y,l),e.stroke())))}},Gf=Af,Yf=yf;const Xf={x:0,y:0,z:0,lastModelMatrix:null};class $f{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(xf),this.builtinContributions.push(Sf),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===Zo.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Zo.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}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)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Ec(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,_=Yp(d,u,h),y=$p(d,g),b=Up(h),x=Gp(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(_||y||a||o))return!0;e.beginPath();return el(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),!0}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=Yp(o,l,n),p=$p(o,c),g=Up(n,r),f=Gp(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){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;Xf.x=n,Xf.y=r,Xf.z=a,Xf.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=tp.allocate(),n=tp.allocate();fg(n,t,e),qu(s,d||s,n),Xf.x=0,Xf.y=0,Xf.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),tp.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Xf.x+=s.x,Xf.y+=s.y,Xf.z=a,i.setTransformForCurrent()}else if(p)Xf.x=0,Xf.y=0,Xf.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Xf.x+=s.x,Xf.y+=s.y,this.transformWithoutTranslate(i,Xf.x,Xf.y,Xf.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Xf.x=0,Xf.y=0,Xf.z=0;return Xf}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,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,_=(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,f,m,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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&tp.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}var Kf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zf=function(t,e){return function(i,s){e(i,s,t)}};let Jf=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Cu,this.builtinContributions=[Mf,Tf,wf],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=d>c;let p=!1;if(nDt){const t=Gt(b,y),r=Gt(x,y),a=qp(v,_,f,m,n,t,Number(u)),o=qp(k,A,M,w,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,Nt(o.y11,o.x11),Nt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>Dt)||C<.001)e.lineTo(i+M,s+w),p=!0;else if(T>Dt){const t=Gt(E,T),n=Gt(P,T),a=qp(M,w,k,A,r,-n,Number(u)),o=qp(f,m,v,_,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),T0&&e.arc(i+a.cx,s+a.cy,n,Nt(a.y01,a.x01),Nt(a.y11,a.x11),!u);const t=Nt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Wt(B),s+r*Yt(B));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Ec(t,null==r?void 0:r.theme).arc;const{fill:c=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:k=l.forceShowCap}=t.attribute;let{outerRadius:A=l.outerRadius,innerRadius:M=l.innerRadius}=t.attribute;A+=b,M-=x;let w=0;const T=(h(S)&&S||S[0])&&"conical"===c.gradient;if(T){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Vt(s-i){var e;let i=!0;if(h(t,!0)){for(let s=0;s<4;s++)Xc[s]=t,i&&(i=!(null!==(e=Xc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Xc[e]=!!t[e],i&&(i=!!Xc[e]);else Xc[0]=!1,Xc[1]=!1,Xc[2]=!1,Xc[3]=!1;return{isFullStroke:i,stroke:Xc}})(d);if((_||B)&&(e.beginPath(),Jp(t,e,i,s,A,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),g?(this._runStroke(t,e,i,s,l,y,B,v,o),this._runFill(t,e,i,s,l,_,m,u,p,a)):(this._runFill(t,e,i,s,l,_,m,u,p,a),this._runStroke(t,e,i,s,l,y,B,v,o))),!B&&y&&(e.beginPath(),Jp(t,e,i,s,A,M,E),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(h(S)&&S||S[1])&&k){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Vt(h-r)>=Ht-Dt){e.beginPath();const r=Math.abs(A-M)/2/A,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,A,M,d,d+r),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o);const u=()=>{if(_){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+=Ht;for(;i>Ht;)i-=Ht;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),dp(o.color,l.color,h,!1)}(0,0,h,n);a||Yp&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}},p=()=>{y&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};u(),p()}}this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),T&&(c.startAngle+=w,c.endAngle+=w)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}};Jf=Kf([$a(),Zf(0,Ya(co)),Zf(0,Ka(Qp)),qf("design:paramtypes",[Object])],Jf);var Qf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},em=function(t,e){return function(i,s){e(i,s,t)}};let im=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Pu,this.builtinContributions=[Cf,Ef,Bf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Ec(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,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f;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,_,y,m,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{y&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o)}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function sm(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]=ll(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 nm(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function rm(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=nm(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),sm(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=Ko.ROW:"y"===s?u=Ko.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.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 om=class extends $f{constructor(){super(...arguments),this.numberType=Lu}draw(t,e,i,s){const n=Ec(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 f;if(!e)return;t.beginPath();rm(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),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:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!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:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===_)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}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=Vl(x(t.points,v),_,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===_){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===y){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],y,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=y*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Gt(_,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,y,b,i,s,t,a,o)}};function lm(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),sm(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),sm(t,l,1,s),o=!1):o=!0}t.closePath()}om=am([$a()],om);const hm=new class extends kf{constructor(){super(...arguments),this.time=Zo.afterFillStroke}drawShape(t,e,i,s,n,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:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:ed(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:ed(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:ed(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:ed(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},cm=yf;var dm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},um=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pm=function(t,e){return function(i,s){e(i,s,t)}};let gm=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Eu,this.builtinContributions=[hm,cm],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,y=m[0];e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const i=m[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,v)}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:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(_(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Ec(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:k}=S,A=S.doStroke&&S.sVisible,{clipRange:M=g.clipRange,closePath:w,points:T,segments:C}=t.attribute;let{curveType:B=g.curveType}=t.attribute;function E(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(w&&"linear"===B&&(B="linearClosed"),1===M&&!C&&!T.some((t=>!1===t.defined))&&"linear"===B)return this.drawLinearAreaHighPerformance(t,e,!!f,A,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(C&&C.length){let e,i;const s=C.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=Vl(E(t.points,x),B,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=C.length-1;t>=0;t--){const e=C[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=C[t-1].points,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=Vl(E(i,x),"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!T||!T.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=E(T,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Vl(e,B,{curveTension:b}),n=Vl(i,"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===M){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,k,v,A,y,r[c],[g,t.attribute],M,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=M*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,k,v,A,y,r[u],[g,t.attribute],Gt(f,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,k,v,A,y,t.attribute,g,M,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Ec(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,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let y,b,x=Ko.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],y=t.points[t.points.length-1]}else b=m[0],y=m[m.length-1];const S=Vt(y.x-b.x),k=Vt(y.y-b.y);x=null==y.x1?Ko.ROW:null==y.y1?Ko.COLUMN:Number.isFinite(S+k)?S>k?Ko.ROW:Ko.COLUMN:Ko.ROW,function(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?Ko.ROW:Ko.COLUMN,Number.isFinite(c)||(o=Ko.COLUMN),Number.isFinite(d)||(o=Ko.ROW);const u=i*(o===Ko.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;_(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),rm(t,i[0]?e.top:e.bottom,l,x===Ko.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,A-h,M-c,o),t.stroke()}})(),!1}};gm=dm([$a(),pm(0,Ya(co)),pm(0,Ka(tg)),um("design:paramtypes",[Object])],gm);const fm=Af,mm=yf;var vm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},ym=function(t,e){return function(i,s){e(i,s,t)}};let bm=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Du,this.builtinContributions=[mm,fm],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:Ec(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:_,doFill:y,doStroke:b}=m;if(e.beginPath(),t.pathShape)el(t.pathShape.commandList,e,i,s,1,1,f);else{el((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,y,b,v,_,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):_&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{y&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,y,b,v,_,d,n,a,o)}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};bm=vm([$a(),ym(0,Ya(co)),ym(0,Ka(ng)),_m("design:paramtypes",[Object])],bm);var xm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},km=function(t,e){return function(i,s){e(i,s,t)}};let Am=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=zu,this.builtinContributions=[zf,Hf,jf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Ec(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:y=l.visible,x1:b,y1:x,x:S=l.x,y:k=l.y,fillStrokeOrder:A=l.fillStrokeOrder,drawStrokeWhenZeroWH:M=l.drawStrokeWhenZeroWH}=t.attribute;let{width:w,height:T}=t.attribute;w=(null!=w?w:b-S)||0,T=(null!=T?T:x-k)||0;const C=Xp(g,f,w,T,h),B=Kp(g,v,w,T,M),E=Up(h,c),P=Gp(d,m);if(!t.valid||!y)return;if(!E&&!P)return;if(!(C||B||a||o||c))return;0===u||_(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,w,T)):(e.beginPath(),Of(e,i,s,w,T,u,"bevel"!==p));const R={doFill:E,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,E,P,C,B,l,n,a,o,R),A?(this._runStroke(t,e,i,s,l,R,B,S,k,o),this._runFill(t,e,i,s,l,R,C,S,k,a)):(this._runFill(t,e,i,s,l,R,C,S,k,a),this._runStroke(t,e,i,s,l,R,B,S,k,o)),this.afterRenderStep(t,e,i,s,E,P,C,B,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}};Am=xm([$a(),km(0,Ya(co)),km(0,Ka(ag)),Sm("design:paramtypes",[Object])],Am);var Mm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tm=function(t,e){return function(i,s){e(i,s,t)}};let Cm=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Hu,this.builtinContributions=[Wf,Yf,Gf,Uf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:Ec(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v,k=t.getParsedPath();if(!k)return;const{keepDirIn3d:A=l.keepDirIn3d}=t.attribute,M=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let w=i,T=s,C=M;const B=e.camera;if(A&&B&&e.project){const t=e.project(i,s,M);e.camera=null,_(c)&&(c[0],c[1]),w=t.x,T=t.y,C=void 0}!1===k.draw(e,c,w,T,C,((n,r)=>{var h,c,v,_;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(_=r.lineWidth)&&void 0!==_?_:t.attribute.lineWidth,r=e}const y=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),y()):(y(),x())}))&&e.closePath(),e.camera=B,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,y,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,k,m,p,g,o),this._runFill(t,e,i,s,l,x,y,d,u,k,a)):(this._runFill(t,e,i,s,l,x,y,d,u,k,a),this._runStroke(t,e,i,s,l,S,b,d,u,k,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,y,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Cm=Mm([$a(),Tm(0,Ya(co)),Tm(0,Ka(og)),wm("design:paramtypes",[Object])],Cm);const Bm=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new He)}allocate(t,e,i,s){if(!this.pools.length)return(new He).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 He(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(...t){this.pools=[]}};const Em=new class extends _f{constructor(){super(...arguments),this.time=Zo.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,g,f,m,v,_,y,b,x,S;const{backgroundMode:k=l.backgroundMode,backgroundFit:A=l.backgroundFit,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio}=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 B;"richtext"===t.type&&(w=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const E=p(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!==(g=T.dx)&&void 0!==g?g:0),s=(null!==(f=T.y)&&void 0!==f?f:e.y1)+(null!==(m=T.dy)&&void 0!==m?m:0),n=null!==(v=T.width)&&void 0!==v?v:e.width(),r=null!==(_=T.height)&&void 0!==_?_:e.height();if(B=Bm.allocate(i,s,i+n,s+r),T=T.background,!P){const t=B.width(),e=B.height();B.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 B=t.AABBBounds,P||(B=gf(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 C();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,B,{backgroundMode:k,backgroundFit:A,backgroundKeepAspectRatio:M}),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n,backgroundOpacity:r=1}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=r,e.fillStyle=T,n?(Of(e,B.x1,B.y1,B.width(),B.height(),n,!0),e.fill()):e.fillRect(B.x1,B.y1,B.width(),B.height()),e.highPerformanceRestore()}E&&Bm.free(B),C()}};var Pm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Om=function(t,e){return function(i,s){e(i,s,t)}};let Im=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Vu,this.builtinContributions=[Em],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Ec(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,fontSize:v=d.fontSize,verticalMode:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute,x=null!==(l=nd(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:k,sVisible:A,doFill:M,doStroke:w}=S,T=!f,C=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,M,w,k,A,d,n,a,o),T&&this.transformUseContext2d(t,d,C,e);const B=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=Qu.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),Qu.free(t)}w&&(o?o(e,t.attribute,d):A&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,C))),M&&(a?a(e,t.attribute,d):k&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,C))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,C),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;w&&(o?o(e,t.attribute,d):A&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,C)})))),M&&(a?a(e,t.attribute,d):k&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,C),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,C,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!_){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Ut(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;B(i,a-(e+1)*x+u,r,n),r+=s}))}))}T&&this.restoreTransformUseContext2d(t,d,C,e),this.afterRenderStep(t,e,i,s,M,w,k,A,d,n,a,o)}draw(t,e,i,s){const n=Ec(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,l,h,c){if(e+t<=0)return;const{textAlign:u=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,_=!d(c),y=_?c.width:i.clipedWidth,b=_?0:cg(u,y),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+y,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+y,t,o),h.stroke()}}};function Lm(t,e,i,s){if(e&&e.length){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},Vm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nm=function(t,e){return function(i,s){e(i,s,t)}};let Wm=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Fu,this.builtinContributions=[jm,zm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Ec(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,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:b}=f;e.beginPath(),c<=0||_(c)&&c.every((t=>0===t))?Lm(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Lm(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,f=(Math.atan2(u,d)-Math.atan2(g,p))/2,m=Math.abs(Math.tan(f));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,_=v/m;const y=Dm(d,u),b=Dm(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*m);const S=Fm(h,_,y,d,u),k=Fm(h,_,b,p,g),A=2*h.x-S.x-k.x,M=2*h.y-S.y-k.y,w=Dm(A,M),T=Fm(h,Dm(_,v),w,A,M);let C=Math.atan2(S.y-T.y,S.x-T.x);const B=Math.atan2(k.y-T.y,k.x-T.x);let E=B-C;E<0&&(C=B,E=-E),E>Math.PI&&(E-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),E&&t.arcTo(h.x+i,h.y+s,k.x+i,k.y+s,v),t.lineTo(k.x+i,k.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,y,b,m,v,l,n,a,o);const x=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,y,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Wm=Hm([$a(),Nm(0,Ya(co)),Nm(0,Ka(rg)),Vm("design:paramtypes",[Object])],Wm);var Um=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Gm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ym=function(t,e){return function(i,s){e(i,s,t)}};let Xm=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Ou}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Pf)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:Ec(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:y=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:k=l.fillStrokeOrder,cornerType:A=l.cornerType,x:M=l.x,y:w=l.y}=t.attribute,T=Xp(p,m,g,f,c),C=Kp(p,v,g,f),B=Up(c,u),E=Gp(d,x);if(!t.valid||!S)return;if(!h){if(!B&&!E)return;if(!(T||C||a||o||u))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||_(y)&&y.every((t=>0===t))?(e.beginPath(),e.rect(i,s,g,f)):(e.beginPath(),Of(e,i,s,g,f,y,"bevel"!==A));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Pf));const P={doFill:B,doStroke:E};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===Zo.beforeFillStroke&&r.drawShape(t,e,i,s,B,E,T,C,l,n,a,o,P)})),h&&e.clip();const R=()=>{P.doFill&&(a?a(e,t.attribute,l):T&&(e.setCommonStyle(t,t.attribute,M-i,w-s,l),e.fill()))},O=()=>{P.doStroke&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,M-i,w-s,l),e.stroke()))};k?(O(),R()):(R(),O()),this._groupRenderContribitions.forEach((r=>{r.time===Zo.afterFillStroke&&r.drawShape(t,e,i,s,B,E,T,C,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=xo.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=Ec(t,null==s?void 0:s.theme).group,i=tp.allocate(),n=tp.allocate();fg(n,t,e),qu(i,p||i,n),a.modelMatrix=i,tp.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&tp.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}};Xm=Um([$a(),Ym(0,Ya(co)),Ym(0,Ka(ig)),Gm("design:paramtypes",[Object])],Xm);var $m=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},qm=function(t,e){return function(i,s){e(i,s,t)}};const Zm=["","repeat-x","repeat-y","repeat"];let Jm=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Iu,this.builtinContributions=[Vf,Nf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Ec(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,image:m}=t.attribute,v=this.valid(t,l,a);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v;if(!m||!t.resources)return;const k=t.resources.get(m);if("success"!==k.state)return;const A=t.width,M=t.height;e.beginPath();let w=!1;0===p||_(p)&&p.every((t=>0===t))?e.rect(i,s,A,M):(Of(e,i,s,A,M,p,"bevel"!==f),w=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const T=()=>{if(x)if(a)a(e,t.attribute,l);else if(y){e.setCommonStyle(t,t.attribute,i,s,l);let n=0;if("repeat"===h&&(n|=1),"repeat"===c&&(n|=2),n){const t=e.createPattern(k.data,Zm[n]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,A,M),e.translate(-i,-s,!0)}else e.drawImage(k.data,i,s,A,M)}},C=()=>{S&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(C(),w&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,y,!1,l,n,a),T(),w&&e.restore()):(w&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,y,!1,l,n,a),T(),w&&e.restore(),C()),this.afterRenderStep(t,e,i,s,x,!1,y,!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&&v(s))return void Uc.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Ec(t).image;this._draw(t,a,!1,i)}};Jm=$m([$a(),qm(0,Ya(co)),qm(0,Ka(sg)),Km("design:paramtypes",[Object])],Jm);const Qm=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"),fv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Bu,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];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+=Ht;for(;o<0;)o+=Ht;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};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},vv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const _v=Symbol.for("DrawItemInterceptor"),yv=new He,bv=new He;class xv{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){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,Qu.allocate(1,0,0,1,0,0)),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 kv=class{constructor(){this.order=1,this.interceptors=[new xv,new Mv,new Av,new Sv]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&tp.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var wv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Cv=function(t,e){return function(i,s){e(i,s,t)}};let Bv=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))}reInit(){this.drawContribution.reInit()}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}};Bv=wv([$a(),Cv(0,Ya(gv)),Tv("design:paramtypes",[Object])],Bv);var Ev=new La((t=>{t(bo).to(Bv)}));const Pv=Symbol.for("PickerService"),Rv=Symbol.for("GlobalPickerService"),Ov=Symbol.for("PickItemInterceptor"),Iv=Symbol.for("PickServiceInterceptor");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};let Dv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};Dv=Lv([$a()],Dv);let Fv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Ec(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=Qu.allocateByObj(a),u=new se(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};Fv=Lv([$a()],Fv);let zv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new se(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}};zv=Lv([$a()],zv);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){const a=fv(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};jv=Lv([$a()],jv);var Hv=new La(((t,e,i)=>{i(Pv)||(t(Rv).toSelf(),t(Pv).toService(Rv)),t(jv).toSelf().inSingletonScope(),t(Ov).toService(jv),t(Fv).toSelf().inSingletonScope(),t(Ov).toService(Fv),t(zv).toSelf().inSingletonScope(),t(Ov).toService(zv),po(t,Ov),t(Dv).toSelf().inSingletonScope(),t(Iv).toService(Dv),po(t,Iv)})),Vv=new La((t=>{t(Nu).to(mg),t(Wu).toConstantValue(df)}));const Nv=Symbol.for("AutoEnablePlugins"),Wv=Symbol.for("PluginService");var Uv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Yv=function(t,e){return function(i,s){e(i,s,t)}};let Xv=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&&yo.isBound(Nv)&&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(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Xv=Uv([$a(),Yv(0,Ya(co)),Yv(0,Ka(Nv)),Gv("design:paramtypes",[Object])],Xv);var $v=new La((t=>{t(Wv).to(Xv),function(t,e){t(co).toDynamicValue((({container:t})=>new uo(e,t))).whenTargetNamed(e)}(t,Nv)})),Kv=new La((t=>{po(t,vo)})),qv=new La((t=>{t(Rh).to(Oh).inSingletonScope(),po(t,Rh)})),Zv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Qv=class{constructor(){this.type="static",this.offscreen=!1,this.global=xo.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=Dh({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()}};Qv=Zv([$a(),Jv("design:paramtypes",[])],Qv);var t_=new La((t=>{t(Qv).toSelf(),t(Dp).toService(Qv)}));var e_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function i_(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function s_(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=i_(t,e,s);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;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=i_(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var a_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},o_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},l_=function(t,e){return function(i,s){e(i,s,t)}};let h_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):s_(e,Jl.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new je,this.backupDirtyBounds=new je,this.global=xo.global,this.layerService=xo.layerService,_(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}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){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=ve(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.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,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Jl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Jl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Qu.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=r_(e,i,Jl.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&&!xe(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Bm.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Qu.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Bm.free(n),Qu.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||yo.get(Qm);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let d_=class extends om{constructor(){super(...arguments),this.numberType=Lu}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=Ec(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=Yp(u,p,c),_=$p(u,g),y=Up(c),b=Gp(d,f);if(!t.valid||!m)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())}};d_=c_([$a()],d_);var u_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 p_=class extends gm{constructor(){super(...arguments),this.numberType=Eu}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=Ec(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Yp(u,d,c),f=Up(c);if(!t.valid||!p)return;if(!f)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())}};p_=u_([$a()],p_);var g_,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},m_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},v_=function(t,e){return function(i,s){e(i,s,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"}(g_||(g_={}));let y_=class extends h_{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=g_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new mo([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return __(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:Jl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Jl.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 __(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return __(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>__(this,void 0,void 0,(function*(){if(2!==t.count)yield n_(t,Jl.zIndex,((i,s)=>{if(this.status===g_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return __(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return __(this,void 0,void 0,(function*(){this.rendering&&(this.status=g_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=g_.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 __(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:()=>__(this,void 0,void 0,(function*(){yield n_(t,Jl.zIndex,(t=>__(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};y_=f_([$a(),v_(0,Xa(sv)),v_(1,Ya(d_)),v_(2,Ya(p_)),v_(3,Ya(co)),v_(3,Ka(_v)),m_("design:paramtypes",[Array,Object,Object,Object])],y_);var b_=new La((t=>{t(_f).toSelf().inSingletonScope(),t(kf).toSelf().inSingletonScope(),t(gv).to(h_),t(Qm).to(y_),t(nv).to(Xm).inSingletonScope(),t(sv).toService(nv),po(t,ig),t(bf).toSelf().inSingletonScope(),po(t,hg),po(t,sv),t(kv).toSelf().inSingletonScope(),t(_v).toService(kv),po(t,_v)}));function x_(){x_.__loaded||(x_.__loaded=!0,yo.load(Wp),yo.load(Vv),yo.load(Ev),yo.load(Hv),yo.load($v),function(t){t.load(Kv),t.load(qv),t.load(t_)}(yo),function(t){t.load(b_)}(yo))}x_.__loaded=!1,x_();const S_=yo.get(_o);xo.global=S_;const k_=yo.get(Ip);xo.graphicUtil=k_;const A_=yo.get(Op);xo.transformUtil=A_;const M_=yo.get(Nu);xo.graphicService=M_;const w_=yo.get(Lp);xo.layerService=w_;class T_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class C_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=xo.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=xo.global.getRequestAnimationFrame();this.rafId=t((()=>{xo.global.devicePixelRatio!==this.dpr&&(this.dpr=xo.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=xo.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class B_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.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))})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,xo.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())}}const E_=new He;class P_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Ia.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()}));const e=this.pluginService.stage;e&&(e.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&&(E_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(E_,t.parent&&t.parent.globalTransMatrix)))})),e.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))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let R_;function O_(){!function(){if(null==R_)try{const t=document.createElement("canvas"),e=t.getContext("2d");R_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),R_&&(R_=!!document.createElement)}catch(t){R_=!1}}();const t=xo.global&&xo.global.env;return t?"browser"===t:R_}let I_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};I_._pluginClasses={};const L_="white";class D_ extends Ep{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:L_}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={}){var e,i;super({}),this.tickedBeforeRender=!0,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._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Cc,this.hooks={beforeRender:new mo(["stage"]),afterRender:new mo(["stage"]),afterClearScreen:new mo(["stage"]),afterClearRect:new mo(["stage"])},this.global=xo.global,!this.global.env&&O_()&&this.global.setEnv("browser"),this.window=yo.get(gc),this.renderService=yo.get(bo),this.pluginService=yo.get(Wv),this.layerService=yo.get(Lp),this.graphicService=yo.get(Nu),this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],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:L_,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(),t.autoRefresh&&this.enableAutoRefresh(),!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),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&v(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(i=t.rafId)&&void 0!==i?i:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new Wc(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(t=!1){t&&(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:f=[1,1,-1],color:m="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,k=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+y,k=Math.cos(d)*Math.cos(u)*1);const A=I_.getPlugin("DirectionalLight");A&&(this.light=new A(f,m,v));const M={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,k],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=M;else{const t=I_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=I_.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}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 T_))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new C_))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new B_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new je;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new P_,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=I_.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=I_.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=I_.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();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.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();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===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),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.dirtyBounds&&this.dirtyBounds.clear(),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,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new se(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;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.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=yo.get(gc),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=yo.get(Pv)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}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},z_=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 j_=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new He}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}}loadFont(t,e,i){return z_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}};j_=F_([$a()],j_);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},V_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let N_=class{constructor(){this._uid=Ia.GenAutoIncrementId(),this.viewBox=new He,this.modelMatrix=new Ne(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){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}};N_=H_([$a(),V_("design:paramtypes",[])],N_);var W_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},U_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},G_=function(t,e){return function(i,s){e(i,s,t)}};let Y_=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=xo.global}reInit(){this._init()}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.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 He).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 Ne(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),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new se(e.x,e.y),a=Ec(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 se(e.x,e.y);l.transformPoint(a,a);const o=Ec(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&&tp.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),Qu.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function X_(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 $_(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function ty(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;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&&x(t.x)&&x(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}))),ry=(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]},ay=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new je;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 ry(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return ry(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);ay(n[0],s,i),ay(n[1],e-s,i)}};let oy=!1;const ly=new La((t=>{oy||(oy=!0,t(Jf).toSelf().inSingletonScope(),t(tv).to(Jf).inSingletonScope(),t(sv).toService(tv),t(Qp).toService(bf),po(t,Qp))}));let hy=!1;const cy=new La((t=>{hy||(hy=!0,t(Am).toSelf().inSingletonScope(),t(lv).to(Am).inSingletonScope(),t(sv).toService(lv),t(Ff).toSelf(),t(Df).toSelf(),t(ag).toService(Ff),t(ag).toService(Df),t(ag).toService(bf),po(t,ag))}));let dy=!1;const uy=new La((t=>{dy||(dy=!0,t(om).toSelf().inSingletonScope(),t(d_).toSelf().inSingletonScope(),t(rv).to(om).inSingletonScope(),t(sv).toService(rv))}));let py=!1;const gy=new La((t=>{py||(py=!0,t(gm).toSelf().inSingletonScope(),t(ev).to(gm).inSingletonScope(),t(sv).toService(ev),t(tg).toService(bf),po(t,tg),t(p_).toSelf().inSingletonScope())}));let fy=!1;const my=new La((t=>{fy||(fy=!0,t(Cm).toSelf().inSingletonScope(),t(hv).to(Cm).inSingletonScope(),t(sv).toService(hv),t(og).toService(bf),po(t,og))}));let vy=!1;const _y=new La((t=>{vy||(vy=!0,t(im).toSelf().inSingletonScope(),t(iv).to(im).inSingletonScope(),t(sv).toService(iv),t(eg).toService(bf),po(t,eg))}));let yy=!1;const by=new La((t=>{yy||(yy=!0,t(cv).to(Im).inSingletonScope(),t(sv).toService(cv),t(lg).toService(bf),po(t,lg))}));let xy=!1;const Sy=new La((t=>{xy||(xy=!0,t(bm).toSelf().inSingletonScope(),t(av).to(bm).inSingletonScope(),t(sv).toService(av),t(ng).toService(bf),po(t,ng))}));let ky=!1;const Ay=new La((t=>{ky||(ky=!0,t(ov).to(Wm).inSingletonScope(),t(sv).toService(ov),t(rg).toService(bf),po(t,rg))}));var My=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 wy=class{constructor(){this.numberType=Ru}reInit(){}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=Ec(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};wy=My([$a()],wy);let Ty=!1;const Cy=new La((t=>{Ty||(Ty=!0,t(uv).to(wy).inSingletonScope(),t(sv).toService(uv))}));var By=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)};let Py=class extends $f{constructor(){super(),this.numberType=ju,this.builtinContributions=[Em],this.init()}drawShape(t,e,i,s,n){const r=Ec(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=Yp(o,l,!0),d=Yp(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),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=Ec(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:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),Of(e,i-t,s-n,v,_,f,!0)),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=Ec(t).richtext;this._draw(t,s,!1,i)}};Py=By([$a(),Ey("design:paramtypes",[])],Py);let Ry=!1;const Oy=new La((t=>{Ry||(Ry=!0,t(dv).to(Py).inSingletonScope(),t(sv).toService(dv))}));let Iy=!1;const Ly=new La((t=>{Iy||(Iy=!0,t(pv).to(Jm).inSingletonScope(),t(sv).toService(pv),t(sg).toService(bf),po(t,sg))}));function Dy(t){const e=[];for(let i=0;i=0&&n>=0&&srt.getInstance().info(`[VChart log]: ${t}`,...e),jy=(t,e)=>(c(Vy.warnHandler)&&Vy.warnHandler.call(null,t,e),e?rt.getInstance().warn(`[VChart warn]: ${t}`,e):rt.getInstance().warn(`[VChart warn]: ${t}`)),Hy=(t,e,i)=>{if(!c(Vy.errorHandler))throw new Error(t);Vy.errorHandler.call(null,t,e)},Vy={silent:!1,warnHandler:!1,errorHandler:!1},Ny=O_(),Wy=Ny&&globalThis?globalThis.document:void 0;function Uy(t){return("desktop-browser"===t||"mobile-browser"===t)&&Ny}function Gy(t){return Yy(t)||"mobile-browser"===t}function Yy(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let Xy=0;function $y(){return Xy>=9999999&&(Xy=0),Xy++}function Ky(t){return null!=t&&""!==t&&(!!x(t)||+t==+t)}function qy(t){return!(!t||0===t.length)&&(!d(t[0])&&!d(t[0].dataId)&&_(t[0].fields))}const Zy=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Jy extends Ep{constructor(t,e){super(t),this._skipRenderAttributes=Zy,(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,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);f(this.attribute[t])&&f(e)&&!c(this.attribute[t])&&!c(e)?z(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.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,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.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){d(e)&&(e=Object.keys(t));for(let i=0;i{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"},wb=(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 Tb extends o{constructor(t,e={}){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.startTime=zc.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.pressTimeout=null}),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=zc.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||Mb(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=wb(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=zc.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=wb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=Mb(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&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("pointerleave",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("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=zc.now()-i>this.config.press.time&&wb(s[0],t){xo.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;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){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){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},Bb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Eb=[0,0,0];let Pb=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t: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(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},Yl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},$l),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Kl),{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 Ne(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ne(1,0,0,1,0,0),this._clearMatrix=new Ne(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&rt.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ne(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&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 Qu.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&&(Qu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(Qu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){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,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=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(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){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-=Ht;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(f,-2*y),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&&yp.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&&(Zu(Eb,[t,e,i],this.modelMatrix),t=Eb[0],e=Eb[1],i=Eb[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&&(Zu(Eb,[t,e,i],this.modelMatrix),t=Eb[0],e=Eb[1],i=Eb[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Zu(Eb,[e,i,s],this.modelMatrix),e=Eb[0],i=Eb[1],s=Eb[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,e=xo.global.measureTextMethod){var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=xo.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Kl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Kl.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&&(Zu(Eb,[e,i,s],this.modelMatrix),e=Eb[0],i=Eb[1],s=Eb[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=vh(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:mh(this,a,this.dpr),r.strokeStyle=vh(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=Ie(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?this.font=t.font:this.font=Ie(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(t=!0,e=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(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Qu.free(t))),this.stack.length=0}};Pb.env="browser",Pb=Cb([$a(),Bb("design:paramtypes",[Object,Number])],Pb);var Rb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ob=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ib=class extends op{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=xo.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new Pb(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 Lb(t,e){return new La((i=>{i(Ih).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Lh).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Ib.env="browser",Ib=Rb([$a(),Ob("design:paramtypes",[Object])],Ib);const Db=Lb(Ib,Pb);var Fb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jb=function(t,e){return function(i,s){e(i,s,t)}};let Hb=class extends Y_{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,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=dc.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 Nb=class{constructor(){this.type="group",this.numberType=Ou}contains(t,e,i){return!1}};Nb=Vb([$a()],Nb);const Wb=new La(((t,e,i,s)=>{Wb.__vloaded||(Wb.__vloaded=!0,t(kb).to(Nb).inSingletonScope(),t(Ab).toService(kb),po(t,Ab))}));Wb.__vloaded=!1;var Ub=Wb;const Gb=new La(((t,e,i,s)=>{i(Hb)||t(Hb).toSelf().inSingletonScope(),i(Pv)?s(Pv).toService(Hb):t(Pv).toService(Hb)}));var Yb,Xb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$b=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Kb=Yb=class extends N_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Yb.idprefix}_${Yb.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=xo.global,this.viewBox=new He,this.modelMatrix=new Ne(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:Yb.GenerateCanvasId(),canvasControled:!0};this.canvas=new Ib(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 Ib({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)}};Kb.env="browser",Kb.idprefix="visactor_window",Kb.prefix_count=0,Kb=Yb=Xb([$a(),$b("design:paramtypes",[])],Kb);const qb=new La((t=>{t(Kb).toSelf(),t(fc).toDynamicValue((t=>t.container.get(Kb))).whenTargetNamed(Kb.env)}));var Zb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qb=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 tx{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function ex(t,e=!1){const i=document.createElement("img");if(xo.global.isImageAnonymous&&(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 ix=class extends j_{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 tx(t)}return new He}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(v(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=v(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return ex(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return ex(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const s=document.createElement("canvas");t.id&&(s.id=null!==(e=t.id)&&void 0!==e?e:Ia.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(...t){}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}}loadFont(t,e,i){return Qb(this,void 0,void 0,(function*(){return new FontFace(t,v(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}};ix=Zb([$a(),Jb("design:paramtypes",[])],ix);const sx=new La((t=>{sx.isBrowserBound||(sx.isBrowserBound=!0,t(ix).toSelf().inSingletonScope(),t(vo).toService(ix))}));function nx(t,e=!0){nx.__loaded||(nx.__loaded=!0,t.load(sx),t.load(Db),t.load(qb),e&&function(t){t.load(Ub),t.load(Gb)}(t))}sx.isBrowserBound=!1,nx.__loaded=!1;var rx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},ox=function(t,e){return function(i,s){e(i,s,t)}};let lx=class extends Y_{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,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 rp(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}};lx=rx([$a(),ox(0,Ya(co)),ox(0,Ka(Qy)),ox(1,Ya(co)),ox(1,Ka(Ov)),ox(2,Ya(co)),ox(2,Ka(Iv)),ax("design:paramtypes",[Object,Object,Object])],lx);const hx=new La((t=>{hx.__vloaded||(hx.__vloaded=!0,po(t,Qy))}));hx.__vloaded=!1;var cx=hx;class dx{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();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,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:mh(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}var ux=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},px=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gx=function(t,e){return function(i,s){e(i,s,t)}};let fx=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Cu}};fx=ux([$a(),gx(0,Ya(tv)),px("design:paramtypes",[Object])],fx);let mx=!1;const vx=new La(((t,e,i,s)=>{mx||(mx=!0,t(tb).to(fx).inSingletonScope(),t(Qy).toService(tb))}));var _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)},bx=function(t,e){return function(i,s){e(i,s,t)}};let xx=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Eu}};xx=_x([$a(),bx(0,Ya(ev)),yx("design:paramtypes",[Object])],xx);let Sx=!1;const kx=new La(((t,e,i,s)=>{Sx||(Sx=!0,t(eb).to(xx).inSingletonScope(),t(Qy).toService(eb))}));var Ax=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wx=function(t,e){return function(i,s){e(i,s,t)}};let Tx=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Pu}};Tx=Ax([$a(),wx(0,Ya(iv)),Mx("design:paramtypes",[Object])],Tx);let Cx=!1;const Bx=new La(((t,e,i,s)=>{Cx||(Cx=!0,t(ib).to(Tx).inSingletonScope(),t(Qy).toService(ib))}));class Ex{constructor(){this.type="glyph",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=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}}var Px=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Ox=function(t,e){return function(i,s){e(i,s,t)}};let Ix=class extends Ex{constructor(t){super(),this.canvasRenderer=t}};Ix=Px([$a(),Ox(0,Ya(uv)),Rx("design:paramtypes",[Object])],Ix);let Lx=!1;const Dx=new La(((t,e,i,s)=>{Lx||(Lx=!0,t(cb).to(Ix).inSingletonScope(),t(Ix).toService(cb))}));var Fx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 zx=class{constructor(){this.type="image",this.numberType=Iu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};zx=Fx([$a()],zx);let jx=!1;const Hx=new La(((t,e,i,s)=>{jx||(jx=!0,t(sb).to(zx).inSingletonScope(),t(zx).toService(sb))}));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)},Wx=function(t,e){return function(i,s){e(i,s,t)}};let Ux=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Lu}};Ux=Vx([$a(),Wx(0,Ya(rv)),Nx("design:paramtypes",[Object])],Ux);let Gx=!1;const Yx=new La(((t,e,i,s)=>{Gx||(Gx=!0,t(nb).to(Ux).inSingletonScope(),t(Qy).toService(nb))}));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},$x=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kx=function(t,e){return function(i,s){e(i,s,t)}};let qx=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Fu}};qx=Xx([$a(),Kx(0,Ya(ov)),$x("design:paramtypes",[Object])],qx);let Zx=!1;const Jx=new La(((t,e,i,s)=>{Zx||(Zx=!0,t(hb).to(qx).inSingletonScope(),t(Qy).toService(hb))}));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 extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Du}};iS=Qx([$a(),eS(0,Ya(av)),tS("design:paramtypes",[Object])],iS);let sS=!1;const nS=new La(((t,e,i,s)=>{sS||(sS=!0,t(rb).to(iS).inSingletonScope(),t(Qy).toService(rb))})),rS=new He;class aS{constructor(){this.type="rect",this.numberType=zu}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=t.getGraphicTheme(),{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||x(r,!0)&&0!==r||_(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,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:mh(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;rS.setValue(i.x1,i.y1,i.x2,i.y2),rS.expand(-r/2),h=!rS.containsPoint(e)}}return s.highPerformanceRestore(),h}}var oS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hS=function(t,e){return function(i,s){e(i,s,t)}};let cS=class extends aS{constructor(t){super(),this.canvasRenderer=t}};cS=oS([$a(),hS(0,Ya(lv)),lS("design:paramtypes",[Object])],cS);let dS=!1;const uS=new La(((t,e,i,s)=>{dS||(dS=!0,t(ab).to(cS).inSingletonScope(),t(Qy).toService(ab))}));let pS=!1;const gS=new La(((t,e,i,s)=>{pS||(pS=!0,t(sb).to(zx).inSingletonScope(),t(zx).toService(sb))}));var fS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mS=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 extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Hu}};_S=fS([$a(),vS(0,Ya(hv)),mS("design:paramtypes",[Object])],_S);let yS=!1;const bS=new La(((t,e,i,s)=>{yS||(yS=!0,t(ob).to(_S).inSingletonScope(),t(Qy).toService(ob))}));var xS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let SS=class{constructor(){this.type="text",this.numberType=Vu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};SS=xS([$a()],SS);let kS=!1;const AS=new La(((t,e,i,s)=>{kS||(kS=!0,t(lb).to(SS).inSingletonScope(),t(Qy).toService(lb))})),MS=new La(((t,e,i,s)=>{i(lx)||t(lx).toSelf().inSingletonScope(),i(Pv)?s(Pv).toService(lx):t(Pv).toService(lx)}));class wS{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 TS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)};let BS=class extends Pb{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 Ne(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};BS.env="node",BS=TS([$a(),CS("design:paramtypes",[Object,Number])],BS);var ES=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},PS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let RS=class extends op{constructor(t){super(t)}init(){this._context=new BS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&c(this._nativeCanvas.release)&&this._nativeCanvas.release()}};RS.env="node",RS=ES([$a(),PS("design:paramtypes",[Object])],RS);const OS=Lb(RS,BS);var IS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},LS=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 FS=class extends N_{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:Ia.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new RS(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new RS({width:n,height:r,dpr:s,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}getImageBuffer(t="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){}};FS.env="node",FS=IS([$a(),DS(0,Ya(_o)),LS("design:paramtypes",[Object])],FS);const zS=new La((t=>{t(FS).toSelf(),t(fc).toDynamicValue((t=>t.container.get(FS))).whenTargetNamed(FS.env)}));var jS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let HS=class extends j_{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 sd.call(t)}}getCancelAnimationFrame(){return t=>{sd.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};HS=jS([$a()],HS);const VS=new La((t=>{VS.isNodeBound||(VS.isNodeBound=!0,t(HS).toSelf().inSingletonScope(),t(vo).toService(HS))}));function NS(t,e=!0){NS.__loaded||(NS.__loaded=!0,t.load(VS),t.load(OS),t.load(zS))}VS.isNodeBound=!1,NS.__loaded=!1;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};let US=class extends Pb{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_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,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:mh(this,l,this.dpr),r.strokeStyle=vh(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||(d&&r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=xo.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,xo.global.devicePixelRatio),super.measureText(t,e)}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;let r="";r=t.font?t.font:Ie(t,e,n&&this.camera&&this.camera.getProjectionScale(i)),s.font=(r||"").replace("px","vp");const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes);let a="";a=t.font?t.font:Ie(t,e,this.camera&&this.camera.getProjectionScale(i)),r.font=(a||"").replace("px","vp");const{fontFamily:o=e.fontFamily,fontSize:l=e.fontSize}=t;this.fontFamily=o,this.fontSize=l,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}createPattern(t,e){return null}drawImage(){const t=this.nativeContext,e=arguments;e[0].drawImage&&(e[0]=e[0].transferToImageBitmap()),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])}draw(){}};US.env="harmony",US=WS([$a()],US);var GS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},YS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let XS=class extends op{constructor(t){super(t)}init(){this._context=new US(this,this._dpr)}resize(t,e){}release(...t){}};XS.env="harmony",XS=GS([$a(),YS("design:paramtypes",[Object])],XS);var $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},KS=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)}};class ZS{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 JS=class extends N_{get container(){return null}constructor(t){super(),this.global=t,this.type="harmony",this.eventManager=new ZS}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{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:Ia.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new XS(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}this.canvas=new XS({width:i,height:s,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}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){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()}};JS.env="harmony",JS=$S([$a(),qS(0,Ya(_o)),KS("design:paramtypes",[Object])],JS);const QS=new La((t=>{t(JS).toSelf(),t(fc).toDynamicValue((t=>t.container.get(JS))).whenTargetNamed(JS.env)})),tk=Lb(XS,US);var ek=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ik=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let sk=class extends j_{constructor(){super(),this.type="harmony",this.supportEvent=!0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0,this.rafSTO=new id(0)}configure(t,e){t.env===this.type&&t.setActiveEnvContribution(this)}getDynamicCanvasCount(){return 9999}getStaticCanvasCount(){return 9999}loadImage(t){}loadSvg(t){return Promise.reject()}createCanvas(t){return function(t,e,i){const s=new OffscreenCanvas(t,e),n=s.getContext("2d");return new wS({width:t,height:e,context:n,_c:s,getBoundingClientRect:()=>({width:t,height:e}),getContext:()=>n},n,1,t,e,i)}(t.width,t.height,t.id)}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return t=>this.rafSTO.call(t)}getCancelAnimationFrame(){return t=>{this.rafSTO.clear(t)}}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return null}getRootElement(){return null}getDocument(){return null}release(...t){}};sk=ek([$a(),ik("design:paramtypes",[])],sk);const nk=new La((t=>{nk.isHarmonyBound||(nk.isHarmonyBound=!0,t(sk).toSelf().inSingletonScope(),t(vo).toService(sk))}));function rk(t,e=!0){rk.__loaded||(rk.__loaded=!0,t.load(nk),t.load(tk),t.load(QS),e&&function(t){t.load(cx),t.load(MS),t.load(vx),t.load(kx),t.load(Bx),t.load(Dx),t.load(Hx),t.load(Yx),t.load(Jx),t.load(nS),t.load(uS),t.load(gS),t.load(bS),t.load(AS)}(t))}nk.isHarmonyBound=!1,rk.__loaded=!1;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 extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Cu}};hk=ak([$a(),lk(0,Ya(tv)),ok("design:paramtypes",[Object])],hk);let ck=!1;const dk=new La(((t,e,i,s)=>{ck||(ck=!0,t(db).to(hk).inSingletonScope(),t(Ab).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 fk=class extends aS{constructor(t){super(),this.canvasRenderer=t}};fk=uk([$a(),gk(0,Ya(lv)),pk("design:paramtypes",[Object])],fk);let mk=!1;const vk=new La(((t,e,i,s)=>{mk||(mk=!0,t(vb).to(fk).inSingletonScope(),t(Ab).toService(vb))}));class _k extends $f{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=t.getGraphicTheme(),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,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:mh(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&tp.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var yk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xk=function(t,e){return function(i,s){e(i,s,t)}};let Sk=class extends _k{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Lu}};Sk=yk([$a(),xk(0,Ya(rv)),bk("design:paramtypes",[Object])],Sk);let kk=!1;const Ak=new La(((t,e,i,s)=>{kk||(kk=!0,t(fb).to(Sk).inSingletonScope(),t(Ab).toService(fb))}));var Mk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wk=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 Ck=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Eu}};Ck=Mk([$a(),Tk(0,Ya(ev)),wk("design:paramtypes",[Object])],Ck);let Bk=!1;const Ek=new La(((t,e,i,s)=>{Bk||(Bk=!0,t(ub).to(Ck).inSingletonScope(),t(Ab).toService(ub))}));class Pk extends $f{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();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,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&tp.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var Rk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Ik=function(t,e){return function(i,s){e(i,s,t)}};let Lk=class extends Pk{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Hu}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=t.getGraphicTheme(),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,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:mh(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&tp.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};Lk=Rk([$a(),Ik(0,Ya(hv)),Ok("design:paramtypes",[Object])],Lk);let Dk=!1;const Fk=new La(((t,e,i,s)=>{Dk||(Dk=!0,t(_b).to(Lk).inSingletonScope(),t(Ab).toService(_b))}));var zk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hk=function(t,e){return function(i,s){e(i,s,t)}};let Vk=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Pu}};Vk=zk([$a(),Hk(0,Ya(iv)),jk("design:paramtypes",[Object])],Vk);let Nk=!1;const Wk=new La(((t,e,i,s)=>{Nk||(Nk=!0,t(pb).to(Vk).inSingletonScope(),t(Ab).toService(pb))}));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},Gk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Yk=function(t,e){return function(i,s){e(i,s,t)}};let Xk=class extends Pk{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=t.getGraphicTheme(),{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(),f=l.width(),m=dg(a,u,n),v=cg(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,s.modelMatrix!==u&&tp.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};Xk=Uk([$a(),Yk(0,Ya(cv)),Gk("design:paramtypes",[Object])],Xk);let $k=!1;const Kk=new La(((t,e,i,s)=>{$k||($k=!0,t(yb).to(Xk).inSingletonScope(),t(Ab).toService(yb))}));var qk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zk=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 Qk=class extends _k{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Du}};Qk=qk([$a(),Jk(0,Ya(av)),Zk("design:paramtypes",[Object])],Qk);let tA=!1;const eA=new La(((t,e,i,s)=>{tA||(tA=!0,t(mb).to(Qk).inSingletonScope(),t(Ab).toService(mb))}));var iA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},nA=function(t,e){return function(i,s){e(i,s,t)}};let rA=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Fu}};rA=iA([$a(),nA(0,Ya(ov)),sA("design:paramtypes",[Object])],rA);let aA=!1;const oA=new La(((t,e,i,s)=>{aA||(aA=!0,t(bb).to(rA).inSingletonScope(),t(Ab).toService(bb))}));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},hA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cA=function(t,e){return function(i,s){e(i,s,t)}};let dA=class extends Ex{constructor(t){super(),this.canvasRenderer=t}};dA=lA([$a(),cA(0,Ya(uv)),hA("design:paramtypes",[Object])],dA);let uA=!1;const pA=new La(((t,e,i,s)=>{uA||(uA=!0,t(Sb).to(dA).inSingletonScope(),t(Ab).toService(Sb))}));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},fA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mA=function(t,e){return function(i,s){e(i,s,t)}};let vA=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=ju}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};vA=gA([$a(),mA(0,Ya(dv)),fA("design:paramtypes",[Object])],vA);let _A=!1;const yA=new La(((t,e,i,s)=>{_A||(_A=!0,t(xb).to(vA).inSingletonScope(),t(Ab).toService(xb))}));var bA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},SA=function(t,e){return function(i,s){e(i,s,t)}};let kA=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=Iu}};kA=bA([$a(),SA(0,Ya(pv)),xA("design:paramtypes",[Object])],kA);let AA=!1;const MA=new La(((t,e,i,s)=>{AA||(AA=!0,t(gb).to(kA).inSingletonScope(),t(Ab).toService(gb))})),wA=O_();function TA(){TA.__loaded||(TA.__loaded=!0,df.RegisterGraphicCreator("arc",rf),yo.load(ly),yo.load(wA?dk:vx))}TA.__loaded=!1;const CA=TA;function BA(){BA.__loaded||(BA.__loaded=!0,df.RegisterGraphicCreator("area",ef),yo.load(gy),yo.load(wA?Ek:kx))}BA.__loaded=!1;const EA=BA;function PA(){PA.__loaded||(PA.__loaded=!0,df.RegisterGraphicCreator("circle",bg),yo.load(_y),yo.load(wA?Wk:Bx))}PA.__loaded=!1;const RA=PA;function OA(){OA.__loaded||(OA.__loaded=!0,df.RegisterGraphicCreator("glyph",Dg),yo.load(Cy),yo.load(wA?pA:Dx))}OA.__loaded=!1;const IA=OA;function LA(){LA.__loaded||(LA.__loaded=!0,df.RegisterGraphicCreator("group",Pp))}LA.__loaded=!1;const DA=LA;function FA(){FA.__loaded||(FA.__loaded=!0,df.RegisterGraphicCreator("image",Ng),yo.load(Ly),yo.load(wA?MA:Hx))}FA.__loaded=!1;const zA=FA;function jA(){jA.__loaded||(jA.__loaded=!0,df.RegisterGraphicCreator("line",Eg),yo.load(uy),yo.load(wA?Ak:Yx))}jA.__loaded=!1;const HA=jA;function VA(){VA.__loaded||(VA.__loaded=!0,df.RegisterGraphicCreator("path",Jg),yo.load(Sy),yo.load(wA?eA:nS))}VA.__loaded=!1;const NA=VA;function WA(){WA.__loaded||(WA.__loaded=!0,df.RegisterGraphicCreator("polygon",lf),yo.load(Ay),yo.load(wA?oA:Jx))}WA.__loaded=!1;const UA=WA;function GA(){GA.__loaded||(GA.__loaded=!0,df.RegisterGraphicCreator("rect",Ig),yo.load(cy),yo.load(wA?vk:uS))}GA.__loaded=!1;const YA=GA;function XA(){XA.__loaded||(XA.__loaded=!0,df.RegisterGraphicCreator("richtext",Kg),yo.load(Oy),yo.load(wA?yA:gS))}XA.__loaded=!1;const $A=XA;function KA(){KA.__loaded||(KA.__loaded=!0,df.RegisterGraphicCreator("shadowRoot",cf))}KA.__loaded=!1;const qA=KA;function ZA(){ZA.__loaded||(ZA.__loaded=!0,df.RegisterGraphicCreator("symbol",Tg),yo.load(my),yo.load(wA?Fk:bS))}ZA.__loaded=!1;const JA=ZA;function QA(){QA.__loaded||(QA.__loaded=!0,df.RegisterGraphicCreator("text",Ag),yo.load(by),yo.load(wA?Kk:AS))}QA.__loaded=!1;const tM=QA;function eM(){DA(),YA()}const iM=-.5*Math.PI,sM=1.5*Math.PI,nM="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 rM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(rM||(rM={}));const aM={[rM.selectedReverse]:{},[rM.selected]:{},[rM.hover]:{},[rM.hoverReverse]:{}},oM={container:"",width:30,height:30,style:{}},lM="scrollDrag";function hM(){return"browser"===S_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const cM={debounce:bt,throttle:xt};eM();let dM=class t extends Jy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{u(this._prePos)&&t.preventDefault()},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=mt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=mt(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=>{this._clearDragEvents();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});const r=hM(),a="browser"===S_.env?S_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=mt(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},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=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:vt(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){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(lM,{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),("browser"===S_.env?S_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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:ni(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,[s,n,r,a]=ni(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,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=mt(t[0],0,1),c=mt(t[1],0,1),d=mt(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_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)}_clearDragEvents(){const t=hM(),e="browser"===S_.env?S_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===S_.env?S_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};dM.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,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};var uM,pM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 gM=uM=class{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new je).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Vt(t.deltaX)>Vt(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new He,e.addEventListener("wheel",this.scroll),this.params=uM.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(lM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new dM(v),h.name=a,e.add(h),h.isScrollBar=!0);const _=this.childrenBounds,{scrollX:y,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/_.width(),1),e=Math.max(Math.min(y/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/_.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=i{i(gM)||(t(gM).toSelf(),t(Nv).toService(gM))}));function mM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&mM(t,e)}))}const vM=t=>!d(t)&&!1!==t.visible;function _M(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function yM(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 xM=["#ffffff","#000000"];function SM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ti(t).toHex(),o=new ti(e).toHex();return kM(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(...xM);for(const n of a)if(t!==n&&kM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function kM(t,e,i,s,n){if("lightness"===n){const i=ti.getColorBrightness(new ti(e));return ti.getColorBrightness(new ti(t))<.5?i>=.5:i<.5}return s?AM(t,e)>s:"largeText"===i?AM(t,e)>3:AM(t,e)>4.5}function AM(t,e){const i=MM(t),s=MM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function MM(t){const e=ii(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function wM(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function TM(t,e){return[t[0]*e,t[1]*e]}function CM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function BM(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=Zt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const EM=(t,e,i,s)=>new Le(Object.assign({defaultFontParams:Object.assign({fontFamily:nM,fontSize:14},s),getTextBounds:i?void 0:gf,specialCharSet:"-/: .,@%'\"~"+Le.ALPHABET_CHAR_SET+Le.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function PM(t,e,i={}){if(!t)return{width:0,height:0};const s=gf({text:t,fontFamily:e.fontFamily||i.fontFamily||nM,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 RM(t,e="type"){var i,s;return p(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 OM(t){var e,i;return u(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function IM(t,e="type"){const i=RM(t,e);return"rich"===i?df.richtext(OM(t)):("html"===i?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"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),df.text(t))}function LM(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 DM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function FM(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 zM(t,e){const{dx:i,dy:s}=FM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function jM(){DA(),YA(),JA(),$A(),tM()}var HM=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);nc&&(w=c,O.setAttribute("maxLineWidth",c-b[1]-b[2]))),A=0,M=0;let H=0;"left"===z||"start"===z?H=1:"right"===z||"end"===z?H=-1:"center"===z&&(H=0),H?H<0?(A-=w,k&&k.setAttribute("x",(k.attribute.x||0)-I),S.setAttribute("x",-b[1]-B)):H>0&&S.setAttribute("x",b[3]):(A-=w/2,k&&k.setAttribute("x",(k.attribute.x||0)-I/2),S.setAttribute("x",-B/2));const V="right"===y||"end"===y,N="left"===y||"start"===y,W=(t,e)=>{"richtext"===O.type?O.setAttributes({x:t,textAlign:e,textConfig:G(O.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):O.setAttributes({x:t,textAlign:e})};if((y?"center"===y:_)&&H){const t=w-b[1]-b[3],e=I+B,i=1===H?(t-e)/2+B+I/2:b[0]+B-(w/2+e/2-B)+I/2;if(W(i,"center"),k){const t=i-I/2-B+F/2;k.setAttributes({x:t})}}if(N&&1!==H){const t=w-b[1]-b[3],e=0===H?-t/2+B/2:-w+b[3]+b[1]+B;if(W(e+B,"left"),k){const t=e+F/2;k.setAttributes({x:t})}}if(V&&-1!==H){const t=w-b[1]-b[3],e=0===H?t/2+B/2:t;if(W(e,"right"),k){const t=e-I-B+F/2;k.setAttributes({x:t})}}"middle"===j?(M-=T/2,k&&k.setAttribute("y",0)):"bottom"===j?(M-=T,k&&k.setAttribute("y",-L/2),S.setAttribute("y",-b[2])):"top"===j&&(S.setAttribute("y",b[0]),k&&k.setAttribute("y",L/2)),E(null==m?void 0:m.text)||(O.states=m.text);const{visible:U}=a,Y=HM(a,["visible"]);if(f&&h(U)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},Y),{visible:U&&!!s,width:w,height:T,x:A,y:M}),"rect");if(E(null==m?void 0:m.panel)||(t.states=m.panel),Y.customShape){const e=Y.customShape;t.pathProxy=t=>e(this,t,new Nl)}this._bgRect=t}this._textShape=O,this._symbol=k,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:z({},VM.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}VM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const NM={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}},WM={poptip:z({},NM)};var UM=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);nk?q=k:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(_(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),L.setAttribute("x",L.attribute.x+e),o.setAttribute("dx",Gt(Ut(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),L.setAttribute("y",L.attribute.y+e),o.setAttribute("dy",Gt(Ut(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?Ft/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:Ft/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?Ft/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?Ft/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:Ft/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?Ft/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?Ft:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:Ft,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?Ft:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}ZM.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"},panel:{},maxWidthPercent:.8,space:8,padding:10};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};let QM=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};z(s,ZM.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new ZM(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};z(e,WM.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,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),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}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}};QM=JM([$a()],QM);var tw=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 ew{constructor(){this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(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)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}let iw=class extends ew{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};iw=tw([$a()],iw);let sw=class extends ew{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}};sw=tw([$a()],sw);const nw=new La(((t,e,i,s)=>{i(QM)||(t(QM).toSelf().inSingletonScope(),t(hg).toService(QM)),i(iw)||(t(iw).toSelf(),t(Nv).toService(iw)),i(sw)||(t(sw).toSelf(),t(Nv).toService(sw))}));class rw extends Jy{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}DA(),HA();class aw extends rw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},aw.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})}}aw.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},DA(),YA();class ow extends rw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ow.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})}}ow.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},DA(),CA();class lw extends rw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},lw.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=ne.distancePP(t,e);this.setAttribute("radius",i)}}lw.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},DA(),CA();class hw extends rw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},hw.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=iM,endAngle:s=sM}=this.attribute,n=s-i,r=ae(ce(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}hw.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},DA(),NA();class cw extends rw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},cw.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=le(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=ne.distancePP(t,e);this.setAttribute("radius",i)}}function dw(){DA(),HA(),UA(),JA()}function uw(){DA(),HA(),CA(),JA()}cw.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},dw();class pw extends Jy{getStartAngle(){return de(this._startAngle)}getEndAngle(){return de(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},pw.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(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 n,r;const a=df.line(Object.assign(Object.assign({points:t},_(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),E(null==s?void 0:s.line)||(a.states=_(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=df.line;G(i)[0].cornerRadius&&(t=df.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},G(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),E(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:f=12}=t;let m,v;"start"===i?(m={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)):(m={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=df.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),E(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?E(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):E(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]:Z(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}}pw.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}}},uw();class gw extends pw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},pw.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=df.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"),E(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var fw,mw;!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.labelHoverOnAxis="axis-label-hover-on-axis",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",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(fw||(fw={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(mw||(mw={}));const vw={[mw.selectedReverse]:{},[mw.selected]:{},[mw.hover]:{},[mw.hoverReverse]:{}},_w={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}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},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}}},yw={size:8,stroke:"#000",lineWidth:1,zIndex:1};const bw=Math.sin(Math.PI/10);function xw(t,e=bw){const i=!d(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function Sw(t,e=bw){const i=!d(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function kw(t){const e={};return mM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function Aw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function Mw(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return TM(r,(s?-1:1)*(n?-1:1)*t/CM(r))}function ww(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function Cw(t,e,i){var s;if(Sw(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>De(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>De(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>Fe(n,r)}function Bw(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!E(s.states)?(s.addState(rM.hover,!0),mM(e,(t=>{t!==s&&t.name&&!E(t.states)&&t.addState(rM.hoverReverse,!0)})),s):i},Pw=(t,e,i)=>i?(mM(e,(t=>{t.name&&!E(t.states)&&(t.removeState(rM.hoverReverse),t.removeState(rM.hover))})),null):i,Rw=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(rM.selected)?(mM(e,(t=>{t.name&&!E(t.states)&&(t.removeState(rM.selectedReverse),t.removeState(rM.selected))})),null):s.name&&!E(s.states)?(s.addState(rM.selected,!0),mM(e,(t=>{t!==s&&t.name&&!E(t.states)&&t.addState(rM.selectedReverse,!0)})),s):i};class Ow extends Jy{_prepareAnimate(t){if(!1!==this.attribute.animation){const{animation:e,animationEnter:i,animationExit:s,animationUpdate:n}=this.attribute,r=p(e)?e:{};this._animationConfig={enter:!1!==i&&z({},t,r,null!=i?i:{}),exit:!1!==s&&z({},t,r,null!=s?s:{}),update:!1!==n&&(_(n)?n:z({},t,r,null!=n?n:{}))}}else this._animationConfig={enter:!1,exit:!1,update:!1}}}const Iw={type:"default",duration:300,easing:"linear"};class Lw extends Ow{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=Ew(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=Pw(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=Rw(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=df.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._prepare(),this._prevInnerView=this._innerView&&kw(this._innerView),this.removeAllChild(!0),this._innerView=df.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation()}_prepare(){this._prepareAnimate(Iw)}_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=df.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=fw.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=df.group({x:0,y:0,pickable:!1});t.name=fw.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",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=df.group({x:0,y:0,pickable:!1});i.name=fw.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=df.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=fw.tick,r.id=this._getNodeId(t.id),E(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=aM;else{const t=this.data[s],e=z({},aM,this.attribute.tick.state);Object.keys(e).forEach((i=>{c(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=df.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=fw.subTick,r.id=this._getNodeId(`${n}`),E(s.state))r.states=aM;else{const i=z({},aM,s.state);Object.keys(i).forEach((s=>{c(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&&c(s)&&(e=s(e,i));const n=this._transformItems(e),r=df.group({x:0,y:0,pickable:!1});return r.name=`${fw.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=IM(this._getLabelAttribute(t,e,n,i));if(a.name=fw.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),E(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=aM;else{const s=z({},aM,this.attribute.label.state);Object.keys(s).forEach((r=>{c(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new VM(Object.assign({},e));i.name=fw.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return Aw(t,this.getVerticalVector(e,i,t))}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&&c(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;Vt(s[0])>Vt(s[1])?o=Ft/2*(l.x>e.x?1:-1):h=Ft/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+P(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+P(this.attribute,"label.space",4))*s);const f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:_}=this.attribute.label;_=c(_)?z({},_w.label.style,_(t,e,i,s)):_;_=z(this.getLabelAlign(m,o,_.angle),_),c(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let y=_.react;return c(y)&&(y=y(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,_)),{text:null!=d?d:v,_originText:t.label,lineHeight:null==_?void 0:_.fontSize,type:h}),_),{react:y})}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}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},mM(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(e.setFinalAttributes(e.attribute),r){r.release();const i=r.attribute,a=e.getFinalAttribute(),o=function(t,e,i){const s={};for(const i in e)i in t&&N(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}(i,a);let l=Object.keys(o).length>0;if("opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l){this._newElementAttrMap[e.id]={state:"update",node:e,attrs:e.attribute};const i=r.attribute;e.setAttributes(i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}])}}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const Dw={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&&Cw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function Fw(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function zw(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=c(n)?n:Dw[n]||Dw.parity;if(s.length>=3&&Bw(s,r)){do{s=a(s,r)}while(s.length>=3&&Bw(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=Y(i);Cw(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),zw(l,s,n,(t=>Cw(t,l,r))),zw(h,s,o,(t=>Cw(t,h,r)||!(!n||t===l)&&Cw(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function Hw(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},Ww(t,e.attribute.angle)),{angle:Nw(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({},Uw(t,e.attribute.angle)),{angle:Nw(e.attribute.angle)}))}))}(t,e),function(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=Ae({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function Nw(t=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 Ww(t,e=0){let 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=Nw(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 Uw(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=Nw(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 Gw(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(E(t)||!k(i))return;const o=function(t){return k(t)?{left:t,right:t}:p(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!d(h),u=c?Math.cos(h):1,g=c?Math.sin(h):0,f=Sw(h),m=xw(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/g);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===_||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=g/u,l=Math.abs(i/g);if(y&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(u);r=Math.min(t,l)}else if(y&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(u);r=Math.min(t,l)}else r=l}else r=Math.abs(i/u);k(t.attribute.maxLineWidth)&&(r=k(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function Yw(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class Xw{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,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=CM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return TM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class $w{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-$w.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*$w.bounceIn(2*t):.5*$w.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ht*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ht/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ht*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Ht/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Ht*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ht/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Ht/e)*.5+1}}static registerFunc(t,e){$w[t]=e}}function Kw(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}$w.quadIn=$w.getPowIn(2),$w.quadOut=$w.getPowOut(2),$w.quadInOut=$w.getPowInOut(2),$w.cubicIn=$w.getPowIn(3),$w.cubicOut=$w.getPowOut(3),$w.cubicInOut=$w.getPowInOut(3),$w.quartIn=$w.getPowIn(4),$w.quartOut=$w.getPowOut(4),$w.quartInOut=$w.getPowInOut(4),$w.quintIn=$w.getPowIn(5),$w.quintOut=$w.getPowOut(5),$w.quintInOut=$w.getPowInOut(5),$w.backIn=$w.getBackIn(1.7),$w.backOut=$w.getBackOut(1.7),$w.backInOut=$w.getBackInOut(1.7),$w.elasticIn=$w.getElasticIn(1,.3),$w.elasticOut=$w.getElasticOut(1,.3),$w.elasticInOut=$w.getElasticInOut(1,.3*1.5),$w.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),$w.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},$w.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)$w[`flicker${t}`]=e=>Kw(e,t);for(let t=2;t<10;t++)$w[`aIn${t}`]=e=>t*e*e+(1-t)*e;function qw(t,e,i){return t+(e-t)*i}const Zw=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=qw(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=qw(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=qw(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=qw(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=qw(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=qw(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=qw(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=qw(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=qw(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=dp(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?pp(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=dp(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?pp(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=qw(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=qw(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=qw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=qw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=qw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=qw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=qw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=qw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=qw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=qw(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=qw(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=qw(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=qw(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=qw(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=qw(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=qw(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=td(e,i,s),r.addUpdateBoundTag()}}};function Jw(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.setAttributes(this.target.attribute)},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=$w[s])&&void 0!==n?n:$w.linear:$w.linear,"wait"===t&&(this.onUpdate=Qw),this.id=Ia.GenAutoIncrementId(),this.syncAttributeUpdate=Qw}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(v(i)&&v(s)){const n=hp.Get(i,lp.Color255),r=hp.Get(s,lp.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(Zw["fill"===e?"fillPure":"strokePure"])}else Zw[e]?t.push(Zw[e]):t.push(Jw)}else Zw[e]?t.push(Zw[e]):t.push(Jw)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate;this.target.animates.forEach((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const i=e.getStartProps();this.propKeys.forEach((t=>{null!=i[t]&&e.preventAttr(t)}))}))}deleteSelfAttr(t){var e;delete this.props[t],this.fromProps&&delete this.fromProps[t];const i=this.propKeys.indexOf(t);-1!==i&&(this.propKeys.splice(i,1),null===(e=this.interpolateUpdateFunctions)||void 0===e||e.splice(i,1))}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){this.target.setAttributes(this.props),t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class eT extends tT{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();this.target.setAttributes(t)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class iT extends o{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Ia.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Oo.END?this.removeAnimate(t,!0):t.status!==Oo.RUNNING&&t.status!==Oo.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const sT=new iT;sT.isGlobal=!0;class nT{constructor(t=Ia.GenAutoIncrementId(),e=sT,i){this.id=t,this.status=Oo.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){return this.target=t,this.target.animates||(this.target.animates=new Map),this.target.animates.set(this.id,this),this.onRemove((()=>{this.stop(),this.target.animates.delete(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new tT(Ro.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new eT(Ro.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new tT(Ro.from,t,e,i);return this._firstStep?(this._lastStep.append(s),this._lastStep=s):(this._firstStep=s,this._lastStep=s),this.updateDuration(),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Oo.RUNNING&&(this.status=Oo.PAUSED)}resume(){this.status===Oo.PAUSED&&(this.status=Oo.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this._preventAttrs.add(t),delete this._startProps[t],delete this._endProps[t];let e=this._firstStep;for(;e;)e.deleteSelfAttr(t),e=e.next}preventAttrs(t){t.forEach((t=>this._preventAttrs.add(t)))}validAttr(t){return!this._preventAttrs.has(t)}runCb(t){var e;return null===(e=this._lastStep)||void 0===e||e.onEnd(t),this}startAt(t){return this._startTime=t,this}customInterpolate(t,e,i,s,n,r){return!1}getFromValue(){return this._startProps}getToValue(){return this._endProps}stop(t){let e=this._firstStep;for(;e;)e.stop(),e=e.next;this.status!==Oo.END&&this.onEnd(),this.status=Oo.END,this.target&&("start"===t?this.target.setAttributes(this._startProps):"end"===t?this.target.setAttributes(this._endProps):t&&this.target.setAttributes(t))}release(){this.status=Oo.END,this._onRemove&&this._onRemove.forEach((t=>t())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Oo.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),void(this.status=Oo.END);this.status=Oo.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&this.target.setAttributes(this._startProps);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const rT=new ko;class aT{constructor(){this.released=!1}tick(t,e){rT.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class oT extends o{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Po.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Po.INITIAL,xo.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),xo.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new aT;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Po.INITIAL&&(this.status=Po.PAUSE,!0)}resume(){return this.status!==Po.INITIAL&&(this.status=Po.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Po.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Po.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Po.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Po.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Po.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Po.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,xo.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}function dT(t){if(!t||!c(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1}return 2}cT.getInstance();class uT{static registerBuiltInAnimate(t,e){uT.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;_(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:uT.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=dT(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:uT.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=dT(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=k(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){Array.isArray(t)?t.forEach((t=>this._execute(t))):this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,d,u;const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:_=0,duration:y=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:k,priority:A=0,options:M,custom:w,customType:T,controlOptions:C}=t,B=e.animate();B.priority=A;const E=c(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],R=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&R&&(i=null!==(h=P[R])&&void 0!==h?h:i),B.startAt(b);const O=i*x+E;O>0&&B.wait(O);let I=null,L=t.to,D=t.from;L||(I||(I=this.createPropsFromChannel(g,e)),L=I.props),D||(I||(I=this.createPropsFromChannel(g,e)),D=I.from),I.attrOutChannel&&e.setAttributes(I.attrOutChannel),this._handleRunAnimate(B,w,T,D,L,y,m,f,C,M,p,e);let F=0;x&&(F=x*(s-i-1));const z=c(_)?_(null===(u=null===(d=e.context)||void 0===d?void 0:d.data)||void 0===u?void 0:u[0],e,{}):_;return z>0&&(F+=z),F>0&&B.wait(F),S&&S>0&&B.loop(S),k&&B.bounce(!0),B}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,d,u){var p,g,f,m,v,_,y,b;if(e&&i){i=dT(e);let d=this.resolveValue(o,u);"function"==typeof d&&(d=d(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),d=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},d);const x=c(h)?h.call(null,null!==(_=d&&(null===(v=d.data)||void 0===v?void 0:v[0]))&&void 0!==_?_:null===(b=null===(y=u.context)||void 0===y?void 0:y.data)||void 0===b?void 0:b[0],u,d):h;d.options=x,d.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,d):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,d)}else"to"===d?t.to(n,r,a):"from"===d&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:d=0,delayAfter:u=0}=t,p=c(d)?d(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):d,g=c(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;u||(d||(d=this.createPropsFromChannel(a,i)),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i)),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const g=null!==(n=t.custom)&&void 0!==n?n:uT.builtInAnimateMap[r],f=t.custom?t.customType:dT(g);this._handleRunAnimate(e,g,f,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e){var i;const s={};let n=null;if(!t)return{from:n,props:s,attrOutChannel:null};const r={};let a=!1;const o=null===(i=e.context)||void 0===i?void 0:i.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===o[e]||(t[e]={to:o[e]}),t)),{})),Object.keys(t).forEach((i=>{var r,a,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?s[i]=h.to(null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,{}):s[i]=h.to),void 0!==h.from&&(n||(n={}),"function"==typeof h.from?n[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):n[i]=h.from)})),o)for(const t in o){const e=o[t];void 0!==e&&(s.hasOwnProperty(t)||(r[t]=e,a=!0))}return{from:n,props:s,attrOutChannel:a?r:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}executeItem(t,e,i=0,s=1){return Array.isArray(t)?t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean):[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Oo.END),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}uT.builtInAnimateMap={};const pT="appear",gT="disappear",fT="update",mT="highlight",vT="unhighlight";class _T{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class yT{constructor(t){this.stateList=null,this.graphic=t}applyState(t,e,i){const s=cT.getInstance(),n=[],r=[];if(this.stateList&&this.stateList.length?t.forEach(((t,i)=>{const a={allowTransition:!0,stopOriginalTransition:!0};this.stateList.forEach((e=>{const i=s.isTransitionAllowed(e.state,t,this.graphic);a.allowTransition=a.allowTransition&&i.allowTransition})),a.allowTransition&&(r.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new uT(this.graphic)}),this.stateList.forEach((e=>{s.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&n.push(e)})))})):t.forEach(((t,i)=>{r.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new uT(this.graphic)})})),n.forEach((t=>{t.executor.stop(null,!1)})),r.length){r[0].executor.execute(r[0].animationConfig);for(let t=0;t{e&&e.executor.execute(e.animationConfig),this.stateList=this.stateList.filter((t=>t!==s)),t===r.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!n.includes(t))):this.stateList=[],this.stateList.push(...r)}applyAppearState(t,e){this.applyState([pT],[{name:pT,animation:t}],e)}applyDisappearState(t,e){this.applyState([gT],[{name:gT,animation:t}],e)}applyUpdateState(t,e){this.applyState([fT],[{name:fT,animation:t}],e)}applyHighlightState(t,e){this.applyState([mT],[{name:mT,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([vT],[{name:vT,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class bT{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new yT(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new _T(t)),t._animationStateStore}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return(new bT)._getAnimationStateManager(t),t}}class xT{getAttributes(t=!1){return t&&this.finalAttribute?this.finalAttribute:this.attribute}animate(t){var e,i,s;const n=new nT(null==t?void 0:t.id,null!==(i=null!==(e=null==t?void 0:t.timeline)&&void 0!==e?e:this.stage&&this.stage.getTimeline())&&void 0!==i?i:sT,null==t?void 0:t.slience);if(n.bind(this),t){const{onStart:e,onEnd:i,onRemove:s}=t;null!=e&&n.onStart(e),null!=i&&n.onEnd(i),null!=s&&n.onRemove(s)}return null===(s=this.stage)||void 0===s||s.ticker.start(),n}createTimeline(){return new iT}createTicker(t){return new oT(t)}setFinalAttributes(t){this.finalAttribute||(this.finalAttribute={}),Object.assign(this.finalAttribute,t)}initFinalAttributes(t){this.finalAttribute=t}initAnimateExecutor(){this._animateExecutor||(this._animateExecutor=new uT(this))}executeAnimation(t){return this.initAnimateExecutor(),this._animateExecutor.execute(t),this}executeAnimations(t){return this.initAnimateExecutor(),t.forEach((t=>{this._animateExecutor.execute(t)})),this}getFinalAttribute(){return this.finalAttribute}getGraphicAttribute(t,e=!1){return!e&&this.finalAttribute?this.finalAttribute[t]:this.attribute[t]}pauseAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function ST(){U(Cp,bT),U(Cp,xT)}class kT extends tT{constructor(t,e,i,s,n){super("customAnimate",e,i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class AT extends kT{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class MT extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0,this.checkStatusAfterRender=!0,this._beforeStageRender=()=>{if(!this.willCallBeforeStageRender)return;this.willCallBeforeStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.beforeStageRender(t,e);i&&this.renderToStage(t,i)},this._afterStageRender=()=>{if(!this.willCallAfterStageRender)return;this.willCallAfterStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.afterStageRender(t,e);i&&this.renderToStage(t,i),this.checkStatusAfterRender&&this.animate.status===Oo.END&&this.animate.timeline.removeAnimate(this.animate)},this.props={}}beforeStageRender(t,e){return!1}afterStageRender(t,e){return!1}onFirstRun(){super.onFirstRun(),this.target.stage.setBeforeRender(this._beforeStageRender),this.target.stage.setAfterRender(this._afterStageRender),this.target.stage.disableDirtyBounds()}stop(){super.stop(),this.target.stage.removeBeforeRender(this._beforeStageRender),this.target.stage.removeAfterRender(this._afterStageRender)}onUpdate(t,e,i){super.onUpdate(t,e,i),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0}renderToStage(t,e){const i=t.window.getContext().canvas.nativeCanvas,s=i.getContext("2d");return!!s&&(s.clearRect(0,0,i.width,i.height),s.drawImage(e,0,0),i)}}class wT{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new uT(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttr(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function TT(t){return new wT(t)}class CT extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,this.target.setAttribute("text",n)}}const BT=1e3,ET="quadInOut",PT=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],RT=(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=dp(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},OT=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?Q_(t):[],n=Q_(e);i&&s&&(i.fromTransform&&ty(s,i.fromTransform.clone().getInverse()),ty(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})))},LT=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],DT=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!LT.includes(n))return;const r=e[n];if(!d(r)&&!d(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?hp.Get(t,lp.Color255):t;i.push({from:_(t[n])?t[n].map(e):e(t[n]),to:_(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class FT extends kT{constructor(t,e,i){super({},{},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;OT(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&RT(this.otherAttrs,i,e),this.target.setAttributes(i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const zT=(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=IT(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=DT(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new FT({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:BT,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:ET);return c.play(d),c};class jT extends kT{constructor(t,e,i){super({},{},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;OT(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&&RT(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const HT=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>PT.includes(t))(i)||(e[i]=t[i])})),e},VT=(t,e,i)=>{const s=HT(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),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=xo.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},NT=(t,e,i)=>{const s=[],n=i?null:HT(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:HT(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=Pg(t.attribute),n=iy(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(xo.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=iy(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(xo.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=iy(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(xo.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 sy(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 sy(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(xo.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:ny(i)}];const s=[];return ay(i,e,s),s})(t,e).forEach((t=>{s.push(xo.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&&x(t.x)&&x(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 ay(l,e,h),h})(t,e).forEach((t=>{s.push(xo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=Q_(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(xo.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(xo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&VT(t,s,e),s};class UT extends kT{constructor(t,e,i,s,n){super(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(){super.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:$o.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:$o.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:$o.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class GT extends UT{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;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 k=0,A=0;"anticlockwise"===S?(A="in"===b?x+2*Math.PI:x,A=x+2*Math.PI):(k=x,A="out"===b?x+2*Math.PI:x);const M=xo.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!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:y/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(_+y)/2,innerRadius:0,startAngle:k,endAngle:A,fill:!0});let w,T;"anticlockwise"===S?(w={startAngle:x+2*Math.PI},T={startAngle:x}):(w={endAngle:x},T={endAngle:x+2*Math.PI}),super("in"===b?w:T,"in"===b?T:w,i,s,{group:null==n?void 0:n.group,clipGraphic:M})}}class YT extends UT{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:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=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=xo.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:f,height:"in"===v&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===y?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class XT extends kT{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){super.onBind();const{points:t,segments:e}=this.target.attribute,{points:i,segments:s}=this.target.getFinalAttribute();this.from={points:t,segments:e},this.to={points:i,segments:s},this.props=this.to;const n=this.getPoints(this.from),r=this.getPoints(this.to,!0);this.fromPoints=n?Array.isArray(n)?n:[n]:[],this.toPoints=r?Array.isArray(r)?r:[r]:[];const a=new Map;this.fromPoints.forEach((t=>{t.context&&a.set(t.context,t)}));let o,l,h=1/0,c=-1/0;for(let t=0;t=0;t-=1)if(a.has(this.toPoints[t].context)){c=t,l=a.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(c)?(this.clipRange=this.toPoints[c][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[c][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=mt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let d=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=a.get(t.context);return i?(d=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ec&&l?[l,t]:[d,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new se(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(t)return Object.keys(this.to).forEach((t=>{this.target.attribute[t]=this.to[t]})),this.target.addUpdatePositionTag(),void this.target.addUpdateShapeAndBoundsTag();if(this.points=this.points.map(((t,i)=>{const s=Qc(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));this.target.setAttributes({clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.target.attribute.segments=e}else this.target.attribute.points=this.points;this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class $T extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0}));const o=this.target.getFinalAttribute();o&&this.target.setAttributes(o),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(a)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class KT extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Object.assign(this.target.attribute,i),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class qT extends $T{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class ZT extends KT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}class JT extends $T{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"],this.from={opacity:0,fillOpacity:0,strokeOpacity:0}}}class QT extends KT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"]}}const tC=(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.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=x(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=x(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.getFinalAttribute();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)};class eC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this._updateFunction=null}updateStartAngle(t){this.target.attribute.startAngle=this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t}updateEndAngle(t){this.target.attribute.endAngle=this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class iC extends eC{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=tC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r),this.determineUpdateFunction()}}class sC extends eC{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=x(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class nC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:u(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:u(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return u(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),u(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:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class rC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:u(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:u(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return u(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),u(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const aC=(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,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?x(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=x(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:d(l)?void 0:c,height:d(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class oC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=aC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class lC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?x(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=x(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:d(o)?void 0:h,height:d(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const hC=(t,e,i)=>{const s=t.getFinalAttribute().points,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.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class cC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(this.target.attribute.points=r.map(((t,i)=>Qc(r[i],a[i],e))),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class dC extends cC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:hC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class uC extends cC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:hC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const pC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class gC extends cC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:pC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class fC extends cC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:pC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const mC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class vC extends cC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:mC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class _C extends cC{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:mC(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const yC=(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.getFinalAttribute(),n=x(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.getFinalAttribute();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)};class bC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class xC extends bC{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=yC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}}class SC extends bC{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const kC=(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.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?x(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=x(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:d(a)?void 0:l,width:d(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class AC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=kC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class MC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?x(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=x(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class wC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c;let d,u;super.onBind();const p=this.target.getFinalAttribute(),g=null!==(t=this.target.attribute)&&void 0!==t?t:{};switch(null===(e=this.params)||void 0===e?void 0:e.direction){case"x":d={scaleX:null!==(i=g.scaleX)&&void 0!==i?i:0},u={scaleX:null!==(s=null==p?void 0:p.scaleX)&&void 0!==s?s:1},this._updateFunction=this.updateX;break;case"y":d={scaleY:null!==(n=g.scaleY)&&void 0!==n?n:0},u={scaleY:null!==(r=null==p?void 0:p.scaleY)&&void 0!==r?r:1},this._updateFunction=this.updateY;break;default:d={scaleX:null!==(a=g.scaleX)&&void 0!==a?a:0,scaleY:null!==(o=g.scaleY)&&void 0!==o?o:0},u={scaleX:null!==(l=null==p?void 0:p.scaleX)&&void 0!==l?l:1,scaleY:null!==(h=null==p?void 0:p.scaleY)&&void 0!==h?h:1},this._updateFunction=this.updateXY}const f=this.target.getFinalAttribute();f&&this.target.setAttributes(f),this.props=u,this.from=d,this.to=u,!1!==(null===(c=this.params.controlOptions)||void 0===c?void 0:c.immediatelyApply)&&this.target.setAttributes(d)}onEnd(t){super.onEnd(t)}updateX(t){this.target.attribute.scaleX=this.from.scaleX+(this.to.scaleX-this.from.scaleX)*t}updateY(t){this.target.attribute.scaleY=this.from.scaleY+(this.to.scaleY-this.from.scaleY)*t}updateXY(t){this.updateX(t),this.updateY(t)}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateXY:"scaleX"===this.propKeys[0]?this._updateFunction=this.updateX:"scaleY"===this.propKeys[0]?this._updateFunction=this.updateY:this._updateFunction=null}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag())}}class TC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n;let r,a;super.onBind();const o=this.target.attribute;switch(null===(t=this.params)||void 0===t?void 0:t.direction){case"x":r={scaleX:null!==(e=null==o?void 0:o.scaleX)&&void 0!==e?e:1},a={scaleX:0};break;case"y":r={scaleY:null!==(i=null==o?void 0:o.scaleY)&&void 0!==i?i:1},a={scaleY:0};break;default:r={scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1,scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1},a={scaleX:0,scaleY:0}}this.props=a,this.from=r,this.to=a}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}}class CC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}class BC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e;super.onBind();let{diffAttrs:i={}}=null!==(t=this.target.context)&&void 0!==t?t:{};const{options:s}=this.params;i=Object.assign({},i),(null===(e=null==s?void 0:s.excludeChannels)||void 0===e?void 0:e.length)&&s.excludeChannels.forEach((t=>{delete i[t]})),this.props=i}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i)}}class EC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class PC extends EC{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:d,excludeChannels:u=[],layoutRect:p={}}=null!=e?e:{};let g=0,f=0;"negative"===l&&(g=null!==(s=p.width)&&void 0!==s?s:t.stage.viewWidth,f=null!==(n=p.height)&&void 0!==n?n:t.stage.viewHeight),g+=o,f+=o;const m=c(d)?d.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):d,v=t.getGraphicAttribute("x"),_=t.getGraphicAttribute("y"),y=u.includes("x")?v:m&&k(m.x)?m.x:g,b=u.includes("y")?_:m&&k(m.y)?m.y:f;switch(h){case"x":return{from:{x:u.includes("x")?v:y},to:{x:v}};case"y":return{from:{y:b},to:{y:_}};default:return{from:{x:y,y:b},to:{x:v,y:_}}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}}class RC extends EC{onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:d}=null!=e?e:{},u=i.group?i.group.AABBBounds:null,p=null!==(s=u.width())&&void 0!==s?s:i.width,g=null!==(n=u.height())&&void 0!==n?n:i.height,f=("negative"===l?p:0)+o,m=("negative"===l?g:0)+o,v=c(d)?d.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):d,_=v&&k(v.x)?v.x:f,y=v&&k(v.y)?v.y:m;switch(h){case"x":return{from:{x:t.getGraphicAttribute("x")},to:{x:_}};case"y":return{from:{y:t.getGraphicAttribute("y")},to:{y:y}};default:return{from:{x:t.getGraphicAttribute("x"),y:t.getGraphicAttribute("y")},to:{x:_,y:y}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=t,this.to=e}}class OC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class IC extends OC{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=ut(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(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:n},to:{angle:s}}})(this.target,this.params.options);this.props=i,this.propKeys=["angle"],this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}}class LC extends OC{onBind(){super.onBind();const{from:t,to:e}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=ut(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(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:n}}})(this.target,this.params.options);this.props=e,this.propKeys=["angle"],this.from=t,this.to=e}}class DC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.from=null!=t?t:{}}onBind(){var t,e;super.onBind(),Object.keys(this.from).forEach((t=>{null==this.props[t]&&(this.props[t]=this.target.getGraphicAttribute(t))}));const i=this.target.getFinalAttribute();"appear"===(null===(t=this.target.context)||void 0===t?void 0:t.animationState)&&i&&this.target.setAttributes(i),!1!==(null===(e=this.params.controlOptions)||void 0===e?void 0:e.immediatelyApply)&&this.target.setAttributes(this.from)}onFirstRun(){this.from=Object.assign(Object.assign({},this.getLastProps()),this.from);const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.from[e]=null!==(i=this.from[e])&&void 0!==i?i:t[e]})),this.target.setAttributes(this.from)}deleteSelfAttr(t){super.deleteSelfAttr(t),delete this.from[t]}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.from,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.from[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}class FC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=xo.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Nl,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=xo.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_;const y=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(y){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:$o.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(_=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==_?_:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:$o.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=ll(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=ll(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(ne.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(ne.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;e{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=df.group({zIndex:999});e.name=fw.axisBreak,e.id=this._getNodeId(`${fw.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=z({},yw,s),a=null!==(e=r.size)&&void 0!==e?e:yw.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=df.symbol(Object.assign({x:s.x,y:s.y},o));l.name=fw.axisBreakSymbol;const h=df.symbol(Object.assign({x:n.x,y:n.y},o));h.name=fw.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=df.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=fw.background,n.id=this._getNodeId("background"),n.states=z({},vw,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new VM(Object.assign({},t));e.name=fw.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=VC(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];E(l)||(c.state={line:z({},vw,l),symbol:z({},vw,l)});const d=new pw(c);d.name=fw.line,d.id=this._getNodeId("line"),t.add(d)}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}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:u}=s,p=VC(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),_=this.getRelativeVector();let y=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+P(this.attribute,"label.space",4);y+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===_[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?y+=i+(e-1)*t:y=0}else if(0===_[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;y+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}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.getActualOffset(x),A=this.getVerticalCoord(v,S,!1),M=this.getVerticalVector(S,!1,{x:0,y:0});let w,T,{angle:C}=p;if(w="start"===n?"start":"end"===n?"end":"center",d(C)&&o){C=BM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;T=1==-1*t?"bottom":"top"}else w=this.getTextAlign(M),T=this.getTextBaseline(M,!1);let B=u;if(d(B)){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(C!==Math.PI/2){const t=Math.abs(Math.cos(null!=C?C:0));B=t<1e-6?1/0:this.attribute.end.x/t}else B=s-S;else if(C&&0!==C){const t=Math.abs(Math.sin(C));B=t<1e-6?1/0:this.attribute.end.y/t}else B=s-S}const E=Object.assign(Object.assign(Object.assign({},A),p),{maxWidth:B,textStyle:Object.assign({textAlign:w,textBaseline:T},a),state:{text:z({},vw,c.text),shape:z({},vw,c.shape),panel:z({},vw,c.background)}});return E.angle=C,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}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:u}=s,p=VC(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),_=this.getVerticalVector(m,!1,{x:0,y:0});let y,{angle:b}=p,x="center";if(d(b)&&a){b=BM(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;y=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(_,!1,o.angle);x=t,y=e}const S=u,k=h?h(c):c,A=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:y},o),text:k});return A.angle=b,l&&l.visible&&(A.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),A}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 Ww(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return Uw(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=Y(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(E(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:d,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(c(h))h(t,e,s,this);else{if(d)!function(t,e){if(E(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,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=re(e)})),Vw(i,t),!Hw(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(E(t)||!k(i))return;const a=t[0].attribute.angle,o=Sw(a),l=xw(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=Yw(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);k(i)&&(c=Gt(c,i))}}else{if(l){const i=Yw(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);k(i)&&(c=Gt(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&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);Gw(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||d?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&jw(t,{orient:o,method:m,separation:v,lastVisible:_,firstVisible: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=df.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=fw.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(u(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(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 f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=PM(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=ni(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(){super.release(),this._breaks=null}}NC.defaultAttributes=_w,U(NC,Xw);class WC{isInValidValue(t){const{startAngle:e=iM,endAngle:i=sM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=iM,endAngle:i=sM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return le(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return Mw(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function UC(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=UC(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var XC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),k(l)&&l>=3){const t=ww(n,l,c,e,i);h=df.path(Object.assign(Object.assign({},a.style),{path:Tw(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=df.circle(t)}h.name=fw.line,h.id=this._getNodeId("line"),E(a.state)||(h.states=z({},vw,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:u={}}=a,p=XC(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=P(this.attribute.label,"style.fontSize",12)+P(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=n+m+f+o;let _="middle",{position:y}=this.attribute.title;d(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({},vw,u.text),shape:z({},vw,u.shape),panel:z({},vw,u.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;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(ut(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=UC(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&GC(e,c,i)}else e.AABBBounds.width()>r&&GC(e,r,i)}else o>a.x&&h.x2>n.x2?(GC(e,n.x2-o,i),r&&YC(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return ut(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}$C.defaultAttributes=_w,U($C,WC);const KC=t=>t.map(((t,e)=>({index:e,value:t}))),qC=(t,e,i=0)=>{const s=new He(t).expand(i/2),n=new He(e).expand(i/2);return s.intersects(n)},ZC=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=re(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,m=0;u||(p?(g=0,m=1):c&&(g=Math.cos(c),m=-Math.sin(c)));const v=EM(a),_=t.range();let y=[];for(let i=0;i{tB[t]=!0}));const rB=t=>-Math.log(-t),aB=t=>-Math.exp(-t),oB=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,lB=t=>10===t?oB:t===Math.E?Math.exp:e=>Math.pow(t,e),hB=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),cB=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),dB=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function uB(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 pB(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function gB(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function fB(t,e,i,s){return 1===i&&(i=0),gB(t,i,s)*(e/(1-i))}function mB(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function vB(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=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 yB{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=mB(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):u(this._rangeFactorStart)&&u(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return d(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(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 d(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(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=mt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=d(s)?(l-o)*i:s;let u=Math.exp(e);u=u/(u-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=u*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const bB=Symbol("implicit");class xB extends yB{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=QC.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=bB}clone(){const t=(new xB).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return u(this._rangeFactorStart)&&u(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!==bB)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&&a>1;)a-=1,r=Math.floor((e-t)/a);return SB(t,e,r,n)}class AB extends xB{constructor(t){super(),this.type=QC.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=fB(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(u(this._rangeFactorStart)&&u(this._rangeFactorEnd)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("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),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]}}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(u(this._rangeFactorStart)&&u(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=[tt(t[0]),tt(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[tt(t[0]),tt(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:kB(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=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(t=10){const e=this.calculateVisibleDomain(this._range);return kB(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=_t(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,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 d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return d(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&&x(this._userBandwidth)}clone(){var t,e,i;return new AB(!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:MB}=si;function wB(t,e){const i=typeof e;let s;if(d(e)||"boolean"===i)return()=>e;if("number"===i)return St(t,e);if("string"===i){if(s=ti.parseColorString(e)){const e=MB(ti.parseColorString(t),s);return t=>e(t).formatRgb()}return St(Number(t),Number(e))}return e instanceof ei?MB(t,e):e instanceof ti?MB(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 TB extends yB{constructor(t=nB,e=nB){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=nB,this._piecewise=pB,this._interpolate=wB}calculateVisibleDomain(t){var e;return u(this._rangeFactorStart)&&u(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,tt);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=_t(i[0],i[r-1])),this._piecewise=r>2?vB:pB,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:nB),this.rescale(i)):this._clamp!==nB}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=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 d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const CB=Math.sqrt(50),BB=Math.sqrt(10),EB=Math.sqrt(2),PB=[1,2,5,10],RB=(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=DB(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)),J(0,e).map((t=>n+t*s))):t>0?IB(0,-(e-1)/s,s):IB((e-1)/s,0,s)},OB=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 RB(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return RB(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=IB(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=IB(t,e,l);return n&&r.reverse(),r})),DB=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=PB[0];return i>=CB?s=PB[3]:i>=BB?s=PB[2]:i>=EB&&(s=PB[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function FB(t,e,i){const s=(e-t)/Math.max(0,i);return DB(s)}function zB(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;e0;){if(s=FB(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function HB(t,e){const i=x(e.forceMin),s=x(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:x(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:x(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),x(r[0])&&x(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=x(r[0])||x(r[1])?x(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const VB=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),NB=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})),WB=ft(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=LB(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?VB(t,e,n):VB(t,e,_B(n)),h=VB(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),UB=ft(((t,e,i,s,n)=>zB(s(t),s(e),i).map((t=>_B(n(t))))));class GB extends TB{constructor(){super(...arguments),this.type=QC.Linear}clone(){var t;const e=new GB;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return OB(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(c(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(u(this._rangeFactorStart)&&u(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=LB(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(t=10){const e=this.calculateVisibleDomain(this._range);return zB(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(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r: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}}function XB(t){return e=>-t(-e)}function $B(t=Number.EPSILON){return e=>Math.max(e,t)}class KB extends TB{constructor(){super(hB(10),lB(10)),this.type=QC.Log,this._limit=$B(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new KB).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=hB(this._base),s=lB(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=XB(i),this._pows=XB(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=rB,this.untransformer=aB):(this._logs=i,this._pows=s,this._limit=$B(),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 nB}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return NB(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return WB(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return UB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return UB(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{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))))}}}U(KB,YB);class qB extends GB{constructor(){super(cB(1),dB(1)),this.type=QC.Symlog,this._const=1}clone(){return(new qB).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=cB(t),this.untransformer=dB(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return NB(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return WB(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return UB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return UB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}U(qB,YB);class ZB{constructor(){this.type=QC.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!d(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 ZB).domain(this._domain).range(this._range).unknown(this._unknown)}}function JB(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function QB(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!eB(t.type))return KC(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return KC([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:d,noDecimals:p=!1,labelStyle:g,breakData:f}=e;let m;if(u(d))v=t.stepTicks(d),_=f&&f()?f().breakDomains:null,m=_&&_.length?v.filter((t=>_.every((e=>te[1])))):v;else if(u(h))m=JB(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=c(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=JB(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:p}):t.d3Ticks(e,{noDecimals:p})))}else{const i=null!==(s=c(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=c(e.tickMode)?e.tickMode:void 0;m=JB(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:p,customTicks:n}):t.ticks(e,{noDecimals:p,customTicks:n})))}var v,_;const y=t.domain();if(e.labelFirstVisible&&y[0]!==m[0]&&!m.includes(y[0])&&m.unshift(y[0]),e.labelLastVisible&&y[y.length-1]!==m[m.length-1]&&!m.includes(y[y.length-1])&&m.push(y[y.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=JC(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=JC(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=Y(l),r=f&&f()?eE.greedy:eE.parity;for(;l.length>=3&&Bw(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;Cw(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),QB(t,l,a,(e=>Cw(e,t,i))),QB(n,l,o,(e=>Cw(e,n,i)||!(!a||e===t)&&Cw(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),Y(h)!==Y(m)&&h.push(Y(m))),m=h}}return KC(m)},eE={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&Cw(i,t,e)||(i=t,0))))}},iE=(t,e,i,s)=>{const n=JC(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},sE=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,nE=(t,e)=>t[1]{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,p=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?KC([s[s.length-1]]):KC([s[0]]);let m;if(u(a))m=t.stepTicks(a);else if(u(r))m=t.forceTicks(r);else if(u(n)){const e=c(n)?n({axisLength:f,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=$(g),a=X(g);if(s.length<=f/n){const i=iE(t,s,e,p);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=aE(s,i,o,e.labelLastVisible,Math.floor(n/l),!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=iE(t,i,e,p);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!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])){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&&!sE(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?nE(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{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=EM(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=le({x:0,y:0},i,t),a=Aw(r,Mw(s,r,e,n));return o=a,l=Mw(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return _.align||(ut(y,f.x)?_.baseline||(_.baseline=b>f.y?"top":"bottom"):y>f.x?_.align="left":y{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||h<=0)return KC(t.domain());let d;if(u(n))d=t.stepTicks(n);else if(u(s))d=t.forceTicks(s);else if(u(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=c(i)?i({axisLength:s,labelStyle:l}):i;d=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=oE(t,i,e),r=$(s),l=X(s),c=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=hE(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/c));d=t.stepTicks(u),d=d.slice(0,d.length-p)}else d=t.domain();return KC(d)},hE=(t,e,i,s)=>{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&&qC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},cE=new Uint32Array(33),dE=new Uint32Array(33);dE[0]=0,cE[0]=~dE[0];for(let t=1;t<=32;++t)dE[t]=dE[t-1]<<1|1,cE[t]=~dE[t];function uE(t,e,i={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:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&cE[31&o]&dE[1+(31&l)])return!0}else{if(i[h]&cE[31&o])return!0;if(i[c]&dE[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,cE[31&o]&dE[1+(31&l)]);else for(s(h,cE[31&o]),s(c,dE[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,dE[31&a]|cE[1+(31&o)]);else for(n(l,dE[31&a]),n(h,cE[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=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 pE(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=mt(i,-o,t.width+l),d=mt(s,-o,t.width+l),u=mt(n,-a,t.height+h),p=mt(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function gE(t,e,i=!1){return i?pE(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function fE(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=gE(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=pE(t,r)),e.getRange(r)))}function mE(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>u(t))),p=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return mE(t,e,n,o,h,d,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?c(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return mE(t,e,n,s,h,d)}if("moveX"===i.type){const s=(i.offset?c(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return mE(t,e,n,s,h,d)}return!1}const _E=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],yE=["top","inside-top","inside"];function bE(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let _=0,y=0;return u<0-h?_=-u:p>m&&(_=m-p),g<0-l?y=-g:f>v&&(y=v-f),{dx:_,dy:y}}const xE={mode:"same-time",duration:300,easing:"linear"};function SE(t){return 3===t||4===t}function kE(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 AE=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 ME(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)}}var wE=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{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const BE=(t,e)=>Math.ceil(t)>Math.floor(e),EE=([t,e],[i,s])=>s>t&&e>i;function PE(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}var RE=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{const e=t.target;e===this._lastHover||E(e.states)||(e.addState(rM.hover,!0),mM(this,(t=>{t===e||E(t.states)||t.addState(rM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(mM(this,(t=>{E(t.states)||(t.removeState(rM.hoverReverse),t.removeState(rM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void mM(this,(t=>{E(t.states)||(t.removeState(rM.selectedReverse),t.removeState(rM.selected))}));E(e.states)||(e.addState(rM.selected,!0),mM(this,(t=>{t===e||E(t.states)||t.addState(rM.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)===$o.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===$o.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(xe(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,f=p-d;return[ME(g,f,c,d,a,o),ME(-g,-f,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds)}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=df.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Nl)}return e&&e.getAttributes(!0).fill&&s.setAttribute("stroke",e.getAttributes(!0).fill),this.attribute.line&&!E(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),d(this._idToGraphic)||this._isCollectionBase&&d(this._idToPoint))return;const t=[];!1!==this._enableAnimation&&this._baseMarks.forEach((e=>{t.push(e.attribute),e.initAttributes(e.getAttributes(!0))}));const{overlap:e,smartInvert:i,dataFilter:s,customLayoutFunc:n,customOverlapFunc:r}=this.attribute;let a=this.attribute.data;if(c(s)&&(a=s(a)),a&&a.length){const t=new Set;a=a.filter((e=>!t.has(e.id)&&t.add(e.id)))}let o=this._initText(a);o=c(n)?n(a,o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(o);const l=[],u=o;if(!h(e)&&c(null==e?void 0:e.filterBeforeOverlap)){const t=this.getRelatedGraphic.bind(this);o.forEach((i=>{e.filterBeforeOverlap(i,t,this)?u.push(i):l.push(i)}))}c(r)?o=r(u,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(l):!1!==e&&(o=this._overlapping(u).concat(l)),c(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),o&&o.length&&o.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==i&&this._smartInvert(o),this._renderLabels(o),!1!==this._enableAnimation&&this._baseMarks.forEach(((e,i)=>{e.initAttributes(t[i])}))}_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&&!E(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!E(e)&&(t.states=e)}_createLabelText(t){var e,i;return IM(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;const i=[];let s;if(s=c(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),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&BE(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&BE(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(ut(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(PE([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!EE([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let y=0,b=t.length-1;for(;y<=b;)y===b?_.push(t[y]):(_.push(t[y]),_.push(t[b])),y++,b--;return _}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&s.setRange(gE(i,t.AABBBounds,!0))}))),h.length>0&&h.forEach((t=>{v(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&&s.setRange(gE(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(gE(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){var s;if(t){if(!1!==t.attribute.visible){if(null===(s=t.context)||void 0===s?void 0:s.animationState){const e=t.clone();return Object.assign(e.attribute,t.getAttributes(!0)),e.AABBBounds}return t.AABBBounds}const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:n,y:r}=e;return{x1:n,x2:n,y1:r,y2:r}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=p(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:g}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{IE[t]=e};var DE=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{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,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*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}FE.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const zE=()=>{LE("symbol",FE),LE("line-data",FE)};var jE=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{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}})(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}}}HE.tag="rect-label",HE.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var VE=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{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=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}}(t,e,i,s)}};NE.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const WE=()=>{LE("line",NE),LE("area",NE)};var UE=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);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=c(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=c(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const d=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}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),h=l.getAttributes(!0),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!d(s[i])&&!d(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,d=h.endAngle-h.startAngle,p=pe(h.endAngle-d/2),g=le(c,h.outerRadius,o),f=le(c,a+e.line.line1MinLength,o),m=new GE(t,g,f,p,d,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=le(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(u=m.quadrant)||2===u?this._arcRight.set(m.refDatum,m):SE(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var u}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":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 f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,_=0;if("inside"===o&&(_="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=le(t.circleCenter,v,t.middleAngle),t.labelLimit=f,pt(f,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.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=SE(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=SE(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.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 c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(gt(t.pointB.x,this._line2MinLength+h)||pt(t.pointB.x,c-this._line2MinLength-h))&&(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(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;k(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=SE(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-y-c:0+y+c;break;default:m=p.x+f*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+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?d(h)||"auto"===h?"edge"===c?SE(t.quadrant)?"left":"right":SE(t.quadrant)?"right":"left":h:d(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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*(SE(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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,f,m;if(ut(l/2,u))g=0,f=1,m=-p;else if(ut(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,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,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?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.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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;e{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 KE(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=ne.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 qE(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=Tw(t,!!n),o=Tw(r,!!n);const h=ne.distancePP(s,l),c=ne.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=KE(e,t,!1,!!n),o=KE(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=Tw(t,!!n),o=Tw(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}$E.defaultAttributes={pickable:!1};class ZE extends Jy{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&kw(this._innerView),this.removeAllChild(!0),this._innerView=df.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 Aw(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?`${fw.grid}-sub`:`${fw.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let d="";if("line"===s||"polygon"===s)d=Tw(o,!!a);else if("circle"===s){const{center:t}=this.attribute;d=KE(t,o,!1,!!a)}const u=df.path(Object.assign({path:d,z:l},c(r)?z({},this.skipDefault?null:ZE.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 d=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(d*d+u*u),g=l/p;o.push({x:n[0].x+d*g,y:n[0].y+u*g});const f=Tw(o,!!a),m=Vt(o[0].x-o[1].x),v=Vt(o[0].y-o[1].y),_=df.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*Ft/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},c(r)?z({},this.skipDefault?null:ZE.defaultAttributes.style,r(t,i)):r));_.name=`${h}-line`,_.id=this._getNodeId(`${h}-path-${s}`),e.add(_)})),n.length>1&&o){const t=_(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!ut(a.value,0)&&!ut(l.value,0),d=!ut(a.value,1)&&!ut(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}ZE.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},DA(),NA();class JE extends ZE{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ZE.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=iM,endAngle:r=sM}=this.attribute;i=ww(t,s,ne.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=z({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}U(JE,Xw);var QE,tP,eP,iP=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){const e=this._getPointsOfSubGrid(p,d);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(sP,WC),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(QE||(QE={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(tP||(tP={})),function(t){t.dataZoomChange="dataZoomChange"}(eP||(eP={}));const nP="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",rP={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:nP,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:nP,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},aP={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}},oP=0,lP=1,hP=2,cP=3,dP=4,uP=5,pP=5,gP=999,fP=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var mP=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;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s,zIndex:hP},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s,zIndex:hP},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto",zIndex:oP},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,k,A,M,w;const{orient:T,middleHandlerStyle:C={},startHandlerStyle:B={},endHandlerStyle:E={},zoomLock:P}=this.attribute,{start:R,end:O}=this._getState(),{position:I,width:L,height:D}=this._getLayoutAttrFromConfig(),F=null!==(t=B.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=E.triggerMinSize)&&void 0!==e?e:40,j=this._getContainer();if(this._isHorizontal){if(C.visible){const t=(null===(i=C.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:I.x+R*L,y:I.y-t,width:(O-R)*L,height:t,zIndex:uP},null===(s=C.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=C.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:I.x+(R+O)/2*L,y:I.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=C.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square",zIndex:uP},C.icon),{pickable:!P&&(null===(h=C.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+R*L,y:I.y+D/2,size:D,symbolType:null!==(c=B.symbolType)&&void 0!==c?c:"square"},aP.horizontal),{zIndex:uP}),B),{pickable:!P&&(null===(d=B.pickable)||void 0===d||d)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+O*L,y:I.y+D/2,size:D,symbolType:null!==(u=E.symbolType)&&void 0!==u?u:"square"},aP.horizontal),{zIndex:uP}),E),{pickable:!P&&(null===(p=E.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+R*L-t/2,y:I.y+D/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:gP},aP.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+O*L-g/2,y:I.y+D/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:gP},aP.horizontal),{pickable:!P}),"rect")}else{if(C.visible){const t=(null===(g=C.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===T?I.x-t:I.x+L,y:I.y+R*D,width:t,height:(O-R)*D,zIndex:uP},null===(f=C.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(_=null===(v=null===(m=C.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===_||_)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===T?I.x-t/2:I.x+L+t/2,y:I.y+(R+O)/2*D,angle:Math.PI/180*90,symbolType:null!==(b=null===(y=C.icon)||void 0===y?void 0:y.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0,zIndex:uP},C.icon),{pickable:!P&&(null===(S=null===(x=C.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+L/2,y:I.y+R*D,size:L,symbolType:null!==(k=B.symbolType)&&void 0!==k?k:"square"},aP.vertical),{zIndex:uP}),B),{pickable:!P&&(null===(A=B.pickable)||void 0===A||A)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:I.x+L/2,y:I.y+O*D,size:L,symbolType:null!==(M=E.symbolType)&&void 0!==M?M:"square",zIndex:uP},aP.vertical),E),{pickable:!P&&(null===(w=E.pickable)||void 0===w||w)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+L/2+t/2,y:I.y+R*D-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:gP},aP.vertical),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+L/2+i/2,y:I.y+O*D-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:gP},aP.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move",zIndex:cP},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move",zIndex:cP},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1,zIndex:lP},"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))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1,zIndex:dP},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){return t.length<=10||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,void 0!==e?e*e:1)}(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(t);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(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){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 je).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)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=mP(c,["formatMethod"]),{formatMethod:g}=d,f=mP(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:_,width:y,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,k={x1:_.x,y1:_.y,x2:_.x+y,y2:_.y+b};let A,M,w,T;this._isHorizontal?(A={x:_.x+m*y,y:_.y+b/2},M={x:_.x+v*y,y:_.y+b/2},w={textAlign:fP(k,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},T={textAlign:fP(k,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(A={x:_.x+y/2,y:_.y+m*b},M={x:_.x+y/2,y:_.y+v*b},w={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:fP(k,t,"start",this._isHorizontal)?"top":"bottom"},T={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:fP(k,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),z({},p,{text:x,x:A.x,y:A.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w,zIndex:pP}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),z({},f,{text:S,x:M.x,y:M.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T,zIndex:pP}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new VM(e),s.name=i,t.add(s)),s}}const _P={debounce:bt,throttle:xt};class yP extends o{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=QE.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=QE.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=QE.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=QE.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=QE.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===S_.env?S_:this.stage,s=hM();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===QE.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===QE.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===QE.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===QE.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(tP.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(tP.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(tP.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===QE.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(tP.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(tP.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:_P[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===S_.env?S_:this.stage,e=hM();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===S_.env?S_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===S_.env?S_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:mt(e+t,0,1),end:mt(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=QE.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}jM(),YA(),JA(),EA(),HA();let bP=class t extends Jy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,_;h.visible?this._isHorizontal?(m=p,v=g-f,_={x:a.x,y:a.y+f}):(m=p-f,v=g,_={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(y+b)/2,_={x:_.x+y/2,y:_.y}):(v-=(y+b)/2,_={x:_.x,y:_.y+y/2})),v+=(null!==(n=u.lineWidth)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:_,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new vP(this._getRendererAttrs()),this._interaction=new yP(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(tP.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(tP.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(eP.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(tP.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;u(t)&&u(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(eP.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.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,...G(a))}setPreviewPointsX(t){c(t)&&(this._renderer.previewPointsX=t)}setPreviewPointsY(t){c(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){c(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){c(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){c(t)&&(this._renderer.statePointToData=t)}};var xP,SP,kP,AP;function MP(){DA(),jM(),ST()}bP.defaultAttributes=rP,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"}(xP||(xP={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(SP||(SP={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(kP||(kP={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(AP||(AP={}));class wP extends Jy{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=Ew(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=Pw(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=Rw(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=p(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=df.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=df.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=df.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 TP(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 CP(t,e,i,s){t&&(TP(t.startSymbol,e,i,s),t.lines.forEach((t=>TP(t,e,i,s))),TP(t.line,e,i,s),TP(t.endSymbol,e,i,s))}function BP(t,e,i,s){t&&(TP(t.getTextShape(),e,i,s),TP(t.getBgRect(),e,i,s))}function EP(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 PP(t,e,i,s){t&&(EP(t.startSymbol,e,i,s),t.lines.forEach((t=>EP(t,e,i,s))),EP(t.line,e,i,s),EP(t.endSymbol,e,i,s))}function RP(t,e,i,s){t&&(EP(t.getTextShape(),e,i,s),EP(t.getBgRect(),e,i,s))}function OP(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;TP(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)})),TP(t.endSymbol,s+r+a,o,n),G(e).forEach((t=>{const e=s+r+a+o;TP(t.getTextShape(),e,l,n),TP(t.getBgRect(),e,l,n)}))}function IP(t,e,i,s,n){CP(t,s,i,n),G(e).forEach((t=>{BP(t,s,i,n)}))}function LP(t,e,i,s,n){TP(t,s,i,n),G(e).forEach((t=>{BP(t,s,i,n)}))}function DP(t,e,i,s,n){TP(t,s,i,n),G(e).forEach((t=>{BP(t,s,i,n)}))}function FP(t,e,i,s,n,r){var a;CP(t,n,s,r),TP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?BP(i,n,s,r):TP(i,n,s,r)}function zP(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;TP(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)})),TP(e,n+o+l,h,r),TP(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(TP(i.getTextShape(),n+o+l+h+c,d,r),TP(i.getBgRect(),n+o+l+c,d,r)):TP(i,n+o+l+c,d,r)}function jP(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?OP(t,e,s,r,a):"fadeIn"===i&&IP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?OP(t,e,s,n,a):"fadeIn"===i&&IP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){PP(t,s,i,n),G(e).forEach((t=>{RP(t,s,i,n)}))}(t,e,i,s,n)}}function HP(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&&LP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&LP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){EP(t,s,i,n),G(e).forEach((t=>{RP(t,s,i,n)}))}(t,e,i,s,n)}}function VP(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&&DP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&DP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){EP(t,s,i,n),G(e).forEach((t=>{RP(t,s,i,n)}))}(t,e,i,s,n)}}function NP(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?FP(n,r,e,i,s,o):"callIn"===t&&zP(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?FP(n,r,e,i,s,a):"callIn"===t&&zP(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;PP(t,n,s,r),EP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?RP(i,n,s,r):EP(i,n,s,r)}(n,r,e,t,i,s)}}const WP={type:"clipIn",duration:500,easing:"linear",delay:0},UP={type:"fadeIn",duration:500,easing:"linear",delay:0},GP={type:"callIn",duration:500,easing:"linear",delay:0},YP={type:"fadeOut",duration:500,easing:"linear",delay:0};class XP{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=G(null==n?void 0:n.label),a=G(null==n?void 0:n.labelBackground),o=G(s).map(((s,n)=>{var o,l;const h=z({},i,s),c=new VM(Object.assign(Object.assign({},h),{state:{panel:z({},aM,null!==(o=a[n])&&void 0!==o?o:Y(a)),text:z({},aM,null!==(l=r[n])&&void 0!==l?l:Y(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===G(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=G(this._label),n=G(null==i?void 0:i.label),r=G(null==i?void 0:i.labelBackground);if(s.length){const i=G(e);s.forEach(((e,s)=>{var a,o;const l=z({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:z({},aM,null!==(a=r[s])&&void 0!==a?a:Y(r)),text:z({},aM,null!==(o=n[s])&&void 0!==o?o:Y(n))}})),this.setLabelPos(e,l)}))}}}class $P extends wP{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=WP,this.defaultExitAnimation=YP}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;zM(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}U($P,XP);const KP=.001,qP={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:xP.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]}},ZP={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"}}},JP={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:{autoRotate:!0,position:kP.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]}},QP={interactive:!0,label:{position:SP.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}},tR={interactive:!0,label:{autoRotate:!0,position:kP.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}},eR={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"}},iR={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"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},sR={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 nR(){rR._animate=jP}MP(),dw(),ST();class rR extends $P{markerAnimate(t){rR._animate&&this._animationConfig&&rR._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},rR.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i: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,e){var i;return(_M(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return yM(Math.abs(e),Math.PI/2,KP)||yM(Math.abs(e),3*Math.PI/2,KP)?bM(i,e,t):_M(e)?ZP.postiveXAxis[t]:ZP.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new pw({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},aM,null==a?void 0:a.line),startSymbol:z({},aM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},aM,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({},aM,null==a?void 0:a.line),startSymbol:z({},aM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},aM,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}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",rR.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(rR.defaultAttributes.label)}}function aR(){oR._animate=HP}rR.defaultAttributes=qP,MP(),UA(),ST();class oR extends wP{markerAnimate(t){oR._animate&&this._animationConfig&&oR._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},oR.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=UP,this.defaultExitAnimation=YP}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},iR[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;zM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=df.polygon(Object.assign({points:e},i));n.states=z({},aM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",oR.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=z({},aM,null==i?void 0:i.area)),this._updateMarkLabels(oR.defaultAttributes.label)}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}}oR.defaultAttributes=QP,U(oR,XP),MP(),uw(),ST();class lR extends $P{markerAnimate(t){lR._animate&&this._animationConfig&&lR._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},lR.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case kP.arcInnerStart:l=n;case kP.arcOuterStart:l=n;break;case kP.arcInnerEnd:l=r;case kP.arcOuterEnd:l=r;break;case kP.center:case kP.arcInnerMiddle:case kP.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return eR[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new gw({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},aM,null==o?void 0:o.line),startSymbol:z({},aM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},aM,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({},aM,null==o?void 0:o.line),startSymbol:z({},aM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},aM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",lR.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(lR.defaultAttributes.label)}}lR.defaultAttributes=JP,MP(),CA(),ST();class hR extends wP{markerAnimate(t){hR._animate&&this._animationConfig&&hR._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},hR.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=UP,this.defaultExitAnimation=YP}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case kP.center:h=(s+n)/2,c=(r+a)/2;break;case kP.arcInnerStart:h=s,c=r;break;case kP.arcOuterStart:h=n,c=r;break;case kP.arcInnerEnd:h=s,c=a;break;case kP.arcOuterEnd:h=n,c=a;break;case kP.arcInnerMiddle:h=s,c=(r+a)/2;break;case kP.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},eR[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;zM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=df.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=z({},aM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",hR.defaultAttributes.label)}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({},aM,null==o?void 0:o.area)),this._updateMarkLabels(hR.defaultAttributes.label)}isValidPoints(){return!0}}function cR(){dR._animate=NP}hR.defaultAttributes=tR,U(hR,XP),MP(),dw(),uw(),JA(),zA(),HA(),ST();class dR extends wP{markerAnimate(t){dR._animate&&this._animationConfig&&dR._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},dR.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=GP,this.defaultExitAnimation=YP,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return yM(Math.abs(s),Math.PI/2,KP)||yM(Math.abs(s),3*Math.PI/2,KP)?bM(t,s,n):_M(s)?sR.postiveXAxis[n]:sR.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,style:d,position:u=AP.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-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,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:z({},aM,null==p?void 0:p.textBackground),text:z({},aM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=z({},aM,null==p?void 0:p.itemContent));const v=_M(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+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",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=df.symbol(Object.assign(Object.assign({},i),r)),o.states=z({},aM,null==s?void 0:s.itemContent)):"text"===n?o=new VM(Object.assign(Object.assign({},i),{state:{panel:z({},aM,null==s?void 0:s.textBackground),text:z({},aM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=df.richtext(Object.assign(Object.assign({},i),r)),o.states=z({},aM,null==s?void 0:s.itemContent)):"image"===n?(o=df.image(Object.assign(Object.assign({},i),r)),o.states=z({},aM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=z({},aM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}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=yM(c,0,KP)||yM(d,0,KP),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=DM(e-u,t-d),o=DM(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*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(bR.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(bR.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===bR.focus||"focus"===o){const s=a.hasState(_R.focus);a.toggleState(_R.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[_R.unSelected,_R.unSelectedHover,_R.focus],t),this._setLegendItemState(e,_R.selected,t)})):(this._setLegendItemState(a,_R.selected,t),this._removeLegendItemState(a,[_R.unSelected,_R.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[_R.selected,_R.selectedHover,_R.focus],t),this._setLegendItemState(e,_R.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(_R.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(_R.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(yR.legendItemClick,a,t);i?(this._removeLegendItemState(a,[_R.selected,_R.selectedHover],t),this._setLegendItemState(a,_R.unSelected,t)):(this._setLegendItemState(a,_R.selected,t),this._removeLegendItemState(a,[_R.unSelected,_R.unSelectedHover],t))}else this._setLegendItemState(a,_R.selected,t),this._removeLegendItemState(a,[_R.unSelected,_R.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[_R.selected,_R.selectedHover],t),this._setLegendItemState(e,_R.unSelected,t))}))}this._dispatchLegendEvent(yR.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,_R.selected),this._removeLegendItemState(e,[_R.unSelected,_R.unSelectedHover])):(this._removeLegendItemState(e,[_R.selected,_R.selectedHover]),this._setLegendItemState(e,_R.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=fR,spaceRow:l=mR,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:p,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:p?i:e,v=this._contentMaxHeight;let y,{doWrap:b,maxWidthInCol:x,startX:S,startY:k,pages:A}=this._itemContext,M=0,w=0;const T=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),y=d[t],y.id||(y.id=y.label),y.index=t;let e=!0;_(n)&&(e=n.includes(y.label));const i=this._renderEachItem(y,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),p?(u(s)&&(f&&a?(A=Math.ceil((S+g)/s),b=A>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||T.forEach((t=>{t.setAttributes({y:t.attribute.y+(w-t.attribute.height)/("middle"===h?2:1)})})),A+=1,S=0,k+=w+l,w=0,T.length=0))),0===S&&0===k||i.setAttributes({x:S,y:k}),S+=o+g,w=Math.max(w,m),T.push(i)):(u(v)&&(f&&a?(A=Math.ceil((k+m)/v),b=A>1):v<=m?(A+=1,b=!0,k=0,t>0&&(S+=M+o)):v{t.setAttributes({y:t.attribute.y+(w-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=k,this._itemContext.maxWidthInCol=x,this._itemContext.pages=A,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=A),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||E(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=df.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:p}=t,g=[];u(c)&&g.push(c),u(d)&&g.push(d),g.length&&(u(s)&&g.push(s),this._itemWidthByUser=$(g)),u(p)&&(this._itemHeightByUser=p);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";p(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";p(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,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:p,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,s),k=this._handleStyle(y,t,e,i,s),A=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),w=ni(c);let T;!1===x.visible?(T=df.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(T,bR.item,t,T)):(T=df.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(T,bR.item,t,T,M.state)),T.id=`${null!=a?a:o}-${i}`,T.addState(e?_R.selected:_R.unSelected);const C=df.group({x:0,y:0,pickable:!1});T.add(C);let B,E=0,R=0,O=0;if(v&&!1!==v.visible){const i=P(S,"style.size",10);R=_(i)?i[0]||0:i,O=P(v,"space",8);const s=df.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&&d(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&d(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,bR.itemShape,t,T,S.state),s.addState(e?_R.selected:_R.unSelected),C.add(s)}let I=0;if(p){const e=P(g,"size",10);B=df.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:w},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(B,bR.focus,t,T),I=e}const L=y.formatMethod?y.formatMethod(o,t,i):o,D=IM(Object.assign(Object.assign({x:R/2+O,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=k.style)||void 0===r?void 0:r.fontSize},k.style),{text:L,_originText:y.formatMethod?o:void 0}));this._appendDataToShape(D,bR.itemLabel,t,T,k.state),D.addState(e?_R.selected:_R.unSelected),C.add(D);const F=P(y,"space",8);if(u(l)){const s=P(b,"space",p?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=IM(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:A.style.fontSize},A.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,bR.itemValue,t,T,A.state),r.addState(e?_R.selected:_R.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-w[1]-w[3]-R-O-F-I-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-R/2-w[1]-w[3]-I-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));E=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-w[1]-w[3]-R-O-I),E=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):E=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);B&&(B.setAttribute("x",E),C.add(B));const z=C.AABBBounds,j=z.width();if("right"===f){const t=z.x2,e=z.x1;C.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===B?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=z.height(),V=u(this.attribute.item.width)?this.attribute.item.width:j+w[1]+w[3],N=this._itemHeightByUser||H+w[0]+w[2];return T.attribute.width=V,T.attribute.height=N,B&&B.setAttribute("visible",!1),C.translateTo(-z.x1+w[3],-z.y1+w[0]),T}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new gR(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},z({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new gR(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new dM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new dM(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?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 i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",xt(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=fR,spaceRow:o=mR}=n,l=this._itemsContainer,{space:h=vR,defaultCurrent:c=1}=r,d=AR(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,_=0,y=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v0&&(y=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:y,y:b}),y+=a+i})),this._itemContext.startX=y,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),_=p-g.AABBBounds.height()-h-t,_<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;_0&&(b=0,y+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:y,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=df.group({x:0,y:t,width:u?v:f,height:u?m:_,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=fR,spaceRow:a=mR}=s,o=this._itemsContainer,{space:l=vR,defaultCurrent:h=1}=n,c=AR(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const _=df.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=df.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];ut(mt(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),ut(mt(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(_R.selected)?this._setLegendItemState(t,_R.selectedHover,e):this._setLegendItemState(t,_R.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===bR.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(yR.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(_R.unSelectedHover)||t.hasState(_R.selectedHover))&&(i=!0),t.removeState(_R.unSelectedHover),t.removeState(_R.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(_R.unSelectedHover)&&!t.hasState(_R.selectedHover)||(i=!0),t.removeState(_R.unSelectedHover),t.removeState(_R.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===bR.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(yR.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(yR.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!==bR.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(yR.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!==bR.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(yR.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(_R.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=z({},MR,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(_R.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(c(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]&&(c(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var TR;function CR(t){return _(t)?t:[t,t]}function BR(t){return t?"ew-resize":"ns-resize"}wR.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:fR,spaceRow:mR,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:vR,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"}(TR||(TR={})),SR();class ER extends Jy{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({},ER.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=mt(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=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=hM(),n="browser"===S_.env?S_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;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=mt(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=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=hM(),n="browser"===S_.env?S_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{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?mt(t+p,h,c):mt(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?mt(t+p,0,c-h):mt(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=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),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(u(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]=G(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:p}=this.attribute;d(p)&&(p=[o,l]),this._currentValue={startValue:CR(p)[0],endValue:CR(p)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=df.group({x:0,y:0});f.name=TR.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=df.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)),m.name=TR.startText,f.add(m);const e=u(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const _=df.group({x:g?v:0,y:g?0:v});f.add(_);const y=df.group({x:0,y:0});let b;if(y.name=TR.railContainer,this._railContainer=y,_.add(y),this._mainContainer=_,this._renderRail(y),v+=g?s:n,a&&a.visible){const t=u(a.space)?a.space:0;b=df.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=TR.endText,f.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=df.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=TR.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;d(c)&&(c=[i,s]);const u=a&&a.visible,p=this._isHorizontal,[g,f]=CR(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":BR(p)},r));if(v.name=TR.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,u){const i=this._renderHandlerText(g,e?"start":"end");i.name=TR.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":BR(p)},r));if(i.name=TR.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,u){const e=this._renderHandlerText(f,"end");e.name=TR.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,u;if(d(h))e?(c=i,u=s):c=u=i;else if(e){const t=vt(h,i,s);c=t[0],u=t[1]}else c=i,u=mt(h,i,s);const g=this._isHorizontal;e||(c=i);const f=df.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=TR.trackContainer;const m=p(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":BR(g);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(u,e?"end":"start"),b=df.rect(Object.assign({x:g?Math.min(_,y):0,y:g?0:Math.min(_,y),width:g?Math.abs(y-_):r,height:g?n:Math.abs(y-_),cursor:v},a));b.name=TR.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return df.symbol(t)}_renderHandlerText(t,e){return df.text(this._getHandlerTextAttributes(t,e))}_getHandlerPosition(t){return this.attribute.range&&t?"start":"end"}_getHandlerTextStyle(t,e){const{align:i,handlerSize:s=14,handlerText:n={},railHeight:r,railWidth:a,slidable:o}=this.attribute;return c(n.style)?n.style(t,e,{layout:this.attribute.layout,align:i,railWidth:a,railHeight:r,handlerSize:s,slidable:o}):n.style}_getHandlerTextAttributes(t,e){var i,s;const{align:n,handlerSize:r=14,handlerText:a={},railHeight:o,railWidth:l,slidable:h}=this.attribute,c=this._isHorizontal,d=this.calculatePosByValue(t,e),u=null!==(i=a.space)&&void 0!==i?i:4,p=this._getHandlerTextStyle(t,e),g={text:a.formatter?a.formatter(t):t.toFixed(null!==(s=a.precision)&&void 0!==s?s:0),lineHeight:null==p?void 0:p.lineHeight,cursor:!1===h?"default":BR(c)};return c?"top"===n?(g.textBaseline="bottom",g.textAlign="center",g.x=d,g.y=(o-r)/2-u):(g.textBaseline="top",g.textAlign="center",g.x=d,g.y=(o+r)/2+u):"left"===n?(g.textBaseline="middle",g.textAlign="end",g.x=(l-r)/2-u,g.y=d):(g.textBaseline="middle",g.textAlign="start",g.x=(l+r)/2+u,g.y=d),Object.assign(Object.assign({},g),p)}_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=df.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=df.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),p(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown),("browser"===S_.env?S_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=hM(),e="browser"===S_.env?S_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_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){const s=this._isHorizontal;t.setAttribute(s?"x":"y",e);const n=t.name===TR.startHandler?this._startHandlerText:this._endHandlerText;if(n){const e=this._getHandlerPosition(t.name===TR.startHandler);n.setAttributes(this._getHandlerTextAttributes(i,e))}t.name===TR.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){const s=this._isHorizontal,n=this._getHandlerPosition(t.name===TR.startHandlerText);t.setAttributes(this._getHandlerTextAttributes(i,n));const r=t.name===TR.startHandlerText?this._startHandler:this._endHandler;r&&r.setAttributes({[s?"x":"y"]:e}),t.name===TR.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}}release(t){super.release(t),("browser"===S_.env?S_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}ER.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}}},kR(),SR();class PR extends xR{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},PR.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!d(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:f,handlerText:m,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:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function RR(t="bottom"){let 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`}PR.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"}}},kR(),SR(),NA();class OR extends xR{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},OR.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:f,showTooltip:m,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=df.group({x:0,y:0});this._innerView.add(x);const S=new ER({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:RR(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,disableTriggerEvent:y,inverse:b});x.add(S);let k,A=0;"horizontal"===e?"top"===i?(k=`M0,0L${a},0L${b?0:a},12Z`,A=o):(k=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?k=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(k=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const M=df.path(Object.assign(Object.assign({x:0,y:A,path:k},_),{zIndex:0}));x.add(M);const w=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,w-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}OR.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)"}},DA(),tM(),$A();let IR=class t extends Jy{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,p,g,f,m,v,y,b,x;const{textType:S,text:k,subtextType:A,textStyle:M={},subtext:w,subtextStyle:T={},width:C,height:B,minWidth:E,maxWidth:P,minHeight:R,maxHeight:O,align:I,verticalAlign:L,padding:D=0}=this.attribute,F=ni(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),j=null!==(t=M.height)&&void 0!==t?t:B;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:p="break-word",maxWidth:g,lineClamp:f}=M;if("rich"===S||u(M.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:C)&&void 0!==e?e:0,height:null!=j?j:0,ellipsis:null==d||d,wordBreak:null!=p?p:"break-word",maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:null!==(i=M.character)&&void 0!==i?i:k},M);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:k},oM),M),x:h,y:c,width:null!==(s=null!=t?t:C)&&void 0!==s?s:0,height:null!=j?j:0,ellipsis:d,wordBreak:p,maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:[]},M);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else u(k)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:_(k)?k:[k],whiteSpace:"normal"},M),{maxLineWidth:null!==(r=null!==(n=M.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:C,heightLimit:null!==(a=M.height)&&void 0!==a?a:O,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const H=this._mainTitle?this._mainTitle.AABBBounds.height():0,V=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==T.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=T,v=Math.max(Number.MIN_VALUE,O-H);if("rich"===A||u(T.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:C)&&void 0!==o?o:0,height:null!==(l=null!=e?e:B)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=T.character)&&void 0!==h?h:w},T);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===A){const o=Object.assign({html:Object.assign(Object.assign({dom:w},oM),T),x:n,y:r,width:null!==(c=null!=t?t:C)&&void 0!==c?c:0,height:null!==(d=null!=e?e:B)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},T);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else u(w)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:_(w)?w:[w],whiteSpace:"normal"},T),{maxLineWidth:null!==(p=T.maxLineWidth)&&void 0!==p?p:C,heightLimit:null!==(g=T.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:H}),"text"))}const N=this._subTitle?this._subTitle.AABBBounds.height():0,W=this._subTitle?this._subTitle.AABBBounds.width():0;let U=Math.max(V,W),G=H+(null!==(f=T.height)&&void 0!==f?f:N);if(u(C)&&(U=C),u(B)&&(G=B),u(E)&&UP&&(U=P),u(R)&&GO&&(G=O),z.attribute.width=U,z.attribute.height=G,z.attribute.boundsPadding=F,this._mainTitle){if(u(I)||u(M.align)){const t=M.align?M.align:I,e=null!==(m=M.width)&&void 0!==m?m:U;"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")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:L,e=null!=j?j:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"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")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(u(I)||u(T.align)){const t=T.align?T.align:I,e=null!==(y=null!==(v=T.width)&&void 0!==v?v:M.width)&&void 0!==y?y:U;"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")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=T.verticalAlign?T.verticalAlign:L,e=this._mainTitle?u(j)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),j):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=T.height)&&void 0!==b?b:B)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"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")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};IR.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 LR={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"}}};DA(),tM(),$A();let DR=class extends Jy{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=z({},P(LR,n),e.style,{visible:e.visible});a.lineHeight=u(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=IM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{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,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(u(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),u(s)){const t=G(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e: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 p=PM(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(p>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/p,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",u(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 p=null!==(o=d.space)&&void 0!==o?o:0;if(c+=p,G(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,f=c/2,m=g**2+1,v=2*f*g,_=f**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*m*_))/(2*m))+f),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",u(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;G(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 FR extends wg{constructor(t){super(t)}}var zR,jR;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(zR||(zR={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(jR||(jR={}));class HR extends Jy{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},HR.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"},HR.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"},HR.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},HR.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},HR.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=()=>{d(this._playController)&&(this._playController=new FR(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{d(this._backwardController)&&(this._backwardController=new FR(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{d(this._forwardController)&&(this._forwardController=new FR(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(zR.OnPlay)},this.pause=()=>{this._dispatchEvent(zR.OnPause)},this.forward=()=>{this._dispatchEvent(zR.OnForward)},this.backward=()=>{this._dispatchEvent(zR.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()}}HR.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},HR.defaultAttributes={[jR.Start]:{},[jR.Pause]:{},[jR.Backward]:{},[jR.Forward]:{}};const VR={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},NR=[200,10];var WR,UR;!function(t){t.Default="default",t.Reverse="reverse"}(WR||(WR={})),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"}(UR||(UR={}));const GR=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===WR.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===WR.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),YR=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===WR.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===WR.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),XR=t=>"top"===t||"bottom"===t;class $R extends Jy{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},$R.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=Ut(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(XR(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:NR[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:NR[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 ER(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 t.layout=XR(this._orient)?"horizontal":"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 HR(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=XR(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:NR[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=x(i)?i:Ut(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(XR(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=x(n)?n:Ut(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:XR(this._orient)?t+s:(this._size.width-r)/2,y:XR(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:XR(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:XR(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=x(n)?n:Ut(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:XR(this._orient)?t+s:(this._size.width-r)/2,y:XR(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]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function KR(){SR(),DA(),JA()}$R.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({},VR),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},VR),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},VR),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},VR),{key:"backward",position:"start"})}},KR();class qR extends $R{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:WR.Default},this._initDataIndex=()=>{var t;this._dataIndex=d(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(zR.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(zR.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(zR.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(zR.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(UR.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(GR({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||YR({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===WR.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(UR.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=S_.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(UR.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(UR.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=S_.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(),S_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(UR.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,S_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(UR.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(UR.change),this.dispatchCustomEvent(UR.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var ZR,JR=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())}))};KR();class QR extends $R{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(zR.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(zR.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(zR.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(zR.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(UR.change))},this.play=()=>JR(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(UR.play),this._rafId=S_.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=S_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,S_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(UR.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,S_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(UR.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(UR.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(UR.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.brushActive="brushActive",t.brushClear="brushClear"}(ZR||(ZR={}));const tO={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],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:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},eO=5;const iO={debounce:bt,throttle:xt};DA(),UA();let sO=class t extends Jy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=tO.updateTrigger,endTrigger:i=tO.endTrigger,brushMoved:s=!0}=this.attribute;G(e).forEach((t=>this.stage.addEventListener(t,this._onBrushingWithDelay))),G(i).forEach((t=>this.stage.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos]},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:iO[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(ZR.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const{trigger:t=tO.trigger,resetTrigger:e=tO.resetTrigger}=this.attribute;G(t).forEach((t=>this.stage.addEventListener(t,this._onBrushStart))),G(e).forEach((t=>this.stage.addEventListener(t,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(ZR.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;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,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(ZR.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=eO}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(ZR.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(ZR.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;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._dispatchBrushEvent(ZR.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=eO}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(ZR.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(ZR.brushClear,t)):Math.abs(r-s)this.stage.removeEventListener(t,this._onBrushStart))),G(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents()}_releaseBrushUpdateEvents(){const{updateTrigger:t=tO.updateTrigger,endTrigger:e=tO.endTrigger}=this.attribute;G(t).forEach((t=>this.stage.removeEventListener(t,this._onBrushingWithDelay))),G(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushEnd)))}_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=df.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}_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(Ee(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_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.ythis._brushMaskAABBBoundsDict[t].empty()))}};sO.defaultAttributes=tO;const nO=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return z(t,...e,{shape:i.every(d)?void 0:z({},...i),key:s.every(d)?void 0:z({},...s),value:n.every(d)?void 0:z({},...n)})},rO=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:G(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}},aO={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:nM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:nM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:nM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new He).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},oO=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];DA(),YA(),JA(),tM(),$A();let lO=class t extends Jy{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=ni(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 p=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",z({symbolType:"circle"},p.shape,{visible:vM(p)&&vM(p.shape)}),"symbol"),"object"!=typeof p.value.text||null===p.value.text||"rich"!==p.value.text.type&&"html"!==p.value.text.type?p.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:vM(p)&&vM(p.value)},rO(p.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=p.value.text)&&void 0!==e?e:"",visible:vM(p)&&vM(p.value)},p.value),"text"):"rich"===p.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:vM(p)&&vM(p.value)},rO(p.value)),"richtext"):"html"===p.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:p.value.text.text},oM),p.value),visible:vM(p)&&vM(p.value),width:p.value.width,height:p.value.height,wordBreak:p.value.wordBreak,textAlign:p.value.textAlign,textBaseline:p.value.textBaseline,singleLine:!1,textConfig:[]},p.value),"richtext"));const g=vM(p.shape)?p.shape.size+p.shape.spacing:0,{textAlign:f,textBaseline:m}=p.value,v=n.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",p.height):"middle"===m?this._tooltipTitle.setAttribute("y",p.height/2):this._tooltipTitle.setAttribute("y",0);const _=vM(p)?p.height+p.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(!vM(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 p="right"===c?(o?d:0)+(vM(n.key)?r+n.key.spacing:0)+(vM(n.value)?a:0):0;this._createShape("right"===c?p-n.shape.size/2:p+n.shape.size/2,n,h,l),o&&("right"===c?p-=d:p+=d);const g=this._createKey(n,h,l);g&&(LM(c,g,n.key.textAlign,p,r),g.setAttribute("y",0),"right"===c?p-=r+n.key.spacing:p+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";u(n.value.textAlign)?t=n.value.textAlign:vM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),LM(c,f,t,p,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(vM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=nd(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(vM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},rO(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},rO(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},oM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(vM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},rO(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},rO(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=>oO.includes(t)))?(this._mergeAttributes(e,s),d(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)&&vM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=vM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=EM(d),_=EM(u);let y=0;if(vM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),y=Math.max(y,e)}if(vM(u)){const{width:t,height:e}=_.quickMeasure(u.text);h.push(t),y=Math.max(y,e)}f&&lu[m]&&(t=!0,r.push(p.size),y=Math.max(p.size,y)),e.height=y,o+=y,a{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 nO({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return nO({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};lO.defaultAttributes=aO;const hO=ut;function cO(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:$(i)}function dO(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function uO(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function pO(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 gO(t,e){const i=pO(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 fO(t,e){const i=mO(t),s=mO(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 mO(t,e={x:0,y:0}){return ne.distancePP(t,e)}function vO(t){return k(t.x)&&k(t.y)}function _O(t,e,i){let s=!1;if(e&&c(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 yO(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const bO=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function SO(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&SO(t[i],e)}}var kO,AO,MO;function wO(t){var e,i;const{type:s}=t;return s===AO.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!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.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_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"}(kO||(kO={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",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",t.mosaic="mosaic",t.pictogram="pictogram"}(AO||(AO={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",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.transform="transform",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.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.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(MO||(MO={}));const TO={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},CO={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function BO(t,e){var i;if(!t)return[];const s=DO(t,e);if(!s||_(s))return null!==(i=s)&&void 0!==i?i:[];if(p(s)){const{dataScheme:i}=s;return i?IO(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>OO(i)?PO(t,i,e):i)).filter(u)}))):i.map((i=>OO(i)?PO(t,i,e):i)).filter(u):[]}return[]}function EO(t,e){var i,s;return IO(t)?null!==(s=null===(i=t.find((t=>u(t.isAvailable)?c(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!u(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 PO(t,e,i){var s;const n=DO(t,i);if(!n)return;let r;const{palette:a}=n;if(p(a)&&(r=null!==(s=function(t,e){const i=TO[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=CO[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(d(e.a)&&d(e.l)||!v(r))return r;let o=new ti(r);if(u(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Ge(t,i,s),a=Ue(n,r,e.l),l=new ti(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return u(e.a)&&o.setOpacity(e.a),o.toRGBA()}const RO=(t,e)=>{if(e&&OO(t)){const i=PO(e,t);if(i)return i}return t};function OO(t){return t&&"palette"===t.type&&!!t.key}function IO(t){return!(!_(t)||0===t.length)&&t.every((t=>u(t.scheme)))}function LO(t){return _(t)?{dataScheme:t}:t}function DO(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||d(n))r=null==t?void 0:t.default;else{const a=wO(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 FO extends xB{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(!IO(this._range))return void super.range(this._range);const t=EO(this._range,this._domain);super.range(t)}}const zO={linear:GB,band:AB,point:class extends AB{constructor(t){super(!1),this.type=QC.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:xB,threshold:ZB,colorOrdinal:FO};function jO(t){const e=zO[t];return e?new e:null}function HO(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function VO(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function NO(t){return u(null==t?void 0:t.field)&&u(null==t?void 0:t.scale)}function WO(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function UO(t){return!!v(t)&&(!!t.endsWith("%")&&Ky(t.substring(0,t.length-1)))}function GO(t){return!!p(t)&&("percent"in t||"offset"in t)}function YO(t,e,i,s=0){var n,r;return x(t)?t:UO(t)?Number(t.substring(0,t.length-1))*e/100:c(t)?t(i):p(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function XO(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>x(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]=YO(t[s],e.size,i)}))})),o}function $O(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}}function KO(t){let e={};return _(t)?(d(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),d(t[1])||(e.left=e.right=t[1]),d(t[2])||(e.bottom=t[2]),d(t[3])||(e.left=t[3]),e):x(t)||UO(t)||c(t)||GO(t)?(e.top=e.left=e.bottom=e.right=t,e):p(t)?(e=Object.assign({},t),e):e}function qO(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const ZO=(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},JO=[{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"]}];function QO(t,e){return t&&e.key in t?t[e.key]:e.default}function tI(t){return t&&"token"===t.type&&!!t.key}const eI={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%"},iI={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:JO,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)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:eI,component:{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}}},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:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},sI={name:"dark",colorScheme:{default:{dataScheme:JO,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",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},nI=(t,e)=>t===e||!c(t)&&!c(e)&&(_(t)&&_(e)?e.every((e=>t.some((t=>nI(t,e))))):!(!p(t)||!p(e))&&Object.keys(e).every((i=>nI(t[i],e[i])))),rI=(t,e,i)=>{if(d(e))return t;const s=e[0];return d(s)?t:1===e.length?(t[s]=i,t):(d(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),rI(t[s],e.slice(1),i))},aI=t=>t instanceof Ba||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)))}}(t);function oI(t,e=["data"]){return I(t,aI,e)}function lI(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=LO(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}hI._charts={},hI._series={},hI._components={},hI._graphicComponents={},hI._marks={},hI._regions={},hI._animations={},hI._implements={},hI._chartPlugin={},hI._vChartPlugin={},hI._componentPlugin={},hI.transforms={fields:Gr,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}},hI.dataParser={csv:(t,e={},i)=>(i.type=Ur.DSV,ia(t)),dsv:(t,e={},i)=>{i.type=Ur.DSV;const s=jr(na,e),{delimiter:n}=s;if(!v(n))throw new TypeError("Invalid delimiter: must be a string!");return ea(n).parse(t)},tsv:(t,e={},i)=>(i.type=Ur.DSV,sa(t))},hI._layout={},hI._grammarTransforms={},hI._stageEventPlugins={},hI.registerStageEventPlugin=(t,e)=>{hI._stageEventPlugins[t]=e},hI.getStageEventPlugin=t=>hI._stageEventPlugins[t],hI._interactionTriggers={},hI.registerInteractionTrigger=(t,e)=>{hI._interactionTriggers[t]=e},hI._composedEventMap={},hI.registerComposedEvent=(t,e)=>{hI._composedEventMap[t]=e},hI._tooltipProcessors={},hI.registerTooltipProcessor=(t,e)=>{hI._tooltipProcessors[t]=e},hI.createTooltipProcessor=(t,e)=>{const i=hI._tooltipProcessors[t];return i?new i(e):null};const uI=t=>{const e={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"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},pI=uI(),gI={[iI.name]:iI},fI=iI.name,mI=new Map(Object.keys(gI).map((t=>[t,gI[t]]))),vI=new Map,_I=new Map(Object.keys(gI).map((t=>[t,t===fI]))),yI=(t,e)=>{if(!t)return;const i=kI(e);mI.set(t,i),_I.set(t,!0)},bI=(t=fI)=>(_I.has(t)&&!_I.get(t)&&yI(t,mI.get(t)),mI.get(t)),xI=t=>mI.delete(t)&&vI.delete(t)&&_I.delete(t),SI=t=>!!v(t)&&mI.has(t),kI=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:fI;return cI({},bI(i),t)};class AI{static registerInstance(t){AI.instances.set(t.id,t)}static unregisterInstance(t){AI.instances.delete(t.id)}static getInstance(t){return AI.instances.get(t)}static instanceExist(t){return AI.instances.has(t)}static forEach(t,e=[],i){const s=G(e);return AI.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}AI.instances=new Map;class MI{static registerTheme(t,e){yI(t,e)}static getTheme(t,e=!1){return bI(t)}static removeTheme(t){return xI(t)}static themeExist(t){return SI(t)}static getDefaultTheme(){return MI.themes.get(fI)}static setCurrentTheme(t){MI.themeExist(t)&&(MI._currentThemeName=t,AI.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return MI.getTheme(MI._currentThemeName,t)}static getCurrentThemeName(){return MI._currentThemeName}}function wI(t){return v(t)?MI.themeExist(t)?MI.getTheme(t):{}:p(t)?t:{}}MI.themes=mI,MI._currentThemeName=fI;const TI=["animationThreshold","colorScheme","name","padding"];function CI(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];TI.includes(n)?s[n]=r:f(r)?OO(r)?s[n]=RO(r,e):tI(r)?s[n]=QO(i,r):s[n]=CI(r,e,i):s[n]=r})),s}function BI(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]=BI(t[s],e)}return i}return _(t)?t.map((t=>BI(t,e))):t}function EI(t,e){if(!t)return t;if(f(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(v(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=EI(t[s],e)}return i}return _(t)?t.map((t=>EI(t,e))):t}function PI(t,...e){return c(t)?t(...e):t}const RI=(t,e,i,s)=>((t,e,i)=>EM(t,e,i,{fontFamily:eI.fontFamily,fontSize:eI.fontSize}))(e,i,s).measure(t),OI="__VCHART",II=500,LI=500,DI=`${OI}_MEASURE_CANVAS_ID`,FI=`${OI}_DEFAULT_DATA_INDEX`,zI=`${OI}_DEFAULT_DATA_KEY`,jI=`${OI}_DEFAULT_DATA_SERIES_FIELD`,HI=`${OI}_DEFAULT_SERIES_STYLE_NAME`,VI=`${OI}_STACK_KEY`,NI=`${OI}_STACK_START`,WI=`${OI}_STACK_END`,UI=`${OI}_STACK_START_PERCENT`,GI=`${OI}_STACK_END_PERCENT`,YI=`${OI}_STACK_START_OffsetSilhouette`,XI=`${OI}_STACK_END_OffsetSilhouette`,$I=`${OI}_STACK_TOTAL`,KI=`${OI}_STACK_TOTAL_PERCENT`,qI=`${OI}_STACK_TOTAL_TOP`,ZI=`${OI}_STACK_TOTAL_BOTTOM`,JI=`${OI}_MOSAIC_VALUE_START_PERCENT`,QI=`${OI}_MOSAIC_VALUE_END_PERCENT`,tL=`${OI}_MOSAIC_CAT_START_PERCENT`,eL=`${OI}_MOSAIC_CAT_END_PERCENT`,iL=`${OI}_SEGMENT_START`,sL=`${OI}_SEGMENT_END`,nL=`${OI}_KEY`,rL=`${OI}_MAP_LOOK_UP_KEY`;function aL(t,e){for(let i=0;it.key===e))}function lL(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 hL(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:{groupField:a.groupField,nodes:{}},gL(t,a,n[o],l,e,r))})),s?cL(n):n}function cL(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))):cL(t[e].nodes);return t}function dL(t,e){if("values"in t&&t.values.length){const i=uO(t.values,e),s=dO(t.values,GI);t.values.forEach((t=>{t[$I]=i,t[KI]=s}))}else for(const i in t.nodes)dL(t.nodes[i],e)}function uL(t){if(!t.values.length)return;const e=t.values[t.values.length-1][WI]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)pL(t.nodes[r],e,i,s,n)}function gL(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[WI]=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 l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},u(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),gL(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const fL=(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]=vL(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function _L(t={}){const e=Object.assign({},t);if(c(t.style)?e.style=(e,i,s,n)=>xL(t.style(e,i,s,n)):E(t.style)||(e.style=xL(t.style)),!E(t.state)){const i={};Object.keys(t.state).forEach((e=>{c(t.state[e])?i[e]=(i,s,n,r)=>xL(t.state[e](i,s,n,r)):E(t.state[e])||(i[e]=xL(t.state[e]))})),e.state=i}return e}function yL(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{c(t[i])?e[i]=(e,s,n,r)=>xL(t[i](e,s,n,r)):E(t[i])||(e[i]=xL(t[i]))})),e}function bL(t,e){if(E(t))return null;const i={};return Object.keys(t).forEach((s=>{c(t[s])?i[s]=t[s](e):i[s]=t[s]})),xL(i)}function xL(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:re(t.angle)}):t}const SL=t=>"line"===t||"area"===t,kL=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return SL(i)?e:null==e?void 0:e[0]},AL=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let ML=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},n=hI.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{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(hI.getComposedEvent(t))if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};var wL;!function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(wL||(wL={}));const TL=["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 CL,BL,EL;!function(t){t.initialized="initialized",t.rendered="rendered",t.renderFinished="renderFinished",t.animationFinished="animationFinished",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleRawDomainUpdate="scaleRawDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",t.layoutRectUpdate="layoutRectUpdate",t.playerPlay="playerPlay",t.playerPause="playerPause",t.playerEnd="playerEnd",t.playerChange="playerChange",t.playerForward="playerForward",t.playerBackward="playerBackward",t.scrollBarChange="scrollBarChange",t.brushStart="brushStart",t.brushChange="brushChange",t.brushEnd="brushEnd",t.brushClear="brushClear",t.brushActive="brushActive",t.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.tooltipShow="tooltipShow",t.tooltipHide="tooltipHide",t.tooltipRelease="tooltipRelease",t.afterResize="afterResize",t.afterRender="afterRender",t.afterLayout="afterLayout",t.afterMarkLayoutEnd="afterMarkLayoutEnd",t.afterWordcloudShapeDraw="afterWordcloudShapeDraw"}(CL||(CL={})),function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(BL||(BL={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(EL||(EL={}));const PL=[EL.mark,EL.model,EL.chart,EL.vchart];class RL{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(EL.vchart,[]),this._levelNodes.set(EL.chart,[]),this._levelNodes.set(EL.model,[]),this._levelNodes.set(EL.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const OL={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"};class IL{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=u(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=u(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=P(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>kL(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||BL.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||BL.chart);o.get(t)||o.set(t,new RL);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||BL.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||BL.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||BL.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||BL.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?PL.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[BL.chart,BL.window,BL.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(c(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&P(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 OL[a]&&(a=OL[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))&&(!u(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:u(t.id)?EL.model:EL.vchart:EL.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=xt(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=bt(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=BL.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==EL.model&&s!==EL.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),u(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=EL.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case BL.chart:return this._viewBubbles;case BL.window:return this._windowBubbles;case BL.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case BL.chart:return this._viewListeners;case BL.window:return this._windowListeners;case BL.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return TL.includes(t)||Object.values(wL).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&hI.hasInteractionTrigger(e)}}function LL(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function DL(t,e,i){t.getParser(e)||t.registerParser(e,i)}const FL=new Map;let zL;function jL(){zL||(zL=new Ca,DL(zL,"geojson",Sa),DL(zL,"topojson",Aa),LL(zL,"simplify",Wr))}function HL(t,e,i={type:"geojson",centroid:!0}){FL.has(t)&&jy(`map type of '${t}' already exists, will be overwritten.`),jL();const s=new Ba(zL),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"}):p(r)&&s.transform({type:"simplify",options:r}),FL.set(t,s)}function VL(t){FL.has(t)?FL.delete(t):jy(`map type of '${t}' does not exists.`)}function NL(t,e=!1){let i=e;return t.latestData instanceof Ba&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const WL=(t,e)=>0===t.length?[]:1===t.length?NL(t[0],null==e?void 0:e.deep):t.map((t=>NL(t,null==e?void 0:e.deep)));function UL(t,e,i){LL(e=e instanceof Ca?e:t.dataSet,"copyDataView",WL);const s=new Ba(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:XL.copyDataView}),s}function GL(t,e,i=[]){var s;if(t instanceof Ba)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new Ba(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return jy(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return jy(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!v(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),jy("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function YL(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var XL,$L,KL,qL;!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"}(XL||(XL={})),function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}($L||($L={})),function(t){t.data="data",t.mark="mark"}(KL||(KL={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(qL||(qL={}));const ZL=["line","area","trail"];function JL(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(nL,i?t.slice().sort(i):t.slice()),{keys:[nL],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const QL=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function tD(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{tD(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function iD(t,e,i,s){const n=JL(t,(t=>i(t))),r=JL(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!d(t)){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}}const sD=`${OI}_BuiltIn_CallBack_Disappear`;var nD;!function(t){t.render="render",t.disappear="disappear"}(nD||(nD={}));class rD{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(t,e){this._count=0,this._rootMarks=[],this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(CL.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(CL.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var t,e,i,s;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(t=this._compileChart.getEvent())||void 0===t||t.emit(CL.renderFinished,{chart:this._compileChart,vchart:null===(e=this._compileChart.getOption())||void 0===e?void 0:e.globalInstance})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterVRenderDraw)||void 0===s||s.call(i,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=t,this._option=e}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var t,e,i,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:g,background:f}=this._option;S_.setEnv(function(t){switch(t){case s["desktop-browser"]:case s["mobile-browser"]:return"browser";case s.node:case s.worker:return"node";case s.miniApp:case s["desktop-miniApp"]:return"feishu";case s.lynx:return"lynx";case s.wx:return"wx";case s.tt:return"tt";case s.harmony:return"harmony"}return"browser"}(o),null!=l?l:{}),this._stage=null!==(t=this._option.stage)&&void 0!==t?t:new D_(Object.assign({background:f,width:this._width,height:this._height,container:null!==(e=this._container.dom)&&void 0!==e?e:null,canvas:null!==(i=this._container.canvas)&&void 0!==i?i:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:g},ReactDOM:this._option.ReactDOM,autoRefresh:u(r)?r:!u(a)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{})),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const m=Pp({x:0,y:0,width:this._width,height:this._height});m.name="root",this._stage.defaultLayer.appendChild(m),this._rootGroup=m;const v=(u(h)?h:Gy(o))&&!1!==c&&hI.getStageEventPlugin("gesture");v&&(this._gestureController=new v(this._stage,p(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=qL.before}_setCanvasStyle(){if(this._stage&&this._container.dom&&!v(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(S_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=S_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>tD(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>tD(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{tD(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;this._hasCommitedMark()&&(zy(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),this._rootMarks.forEach((t=>{t.render()})),this._layoutState===qL.before&&(this._layoutState=qL.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=qL.reevaluate,this._hasCommitedMark()&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),this.findProgressiveMarks(),this.updateStateAnimation(),this._doRender(!0),this.doPreProgressive(),zy(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=eD(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=iD(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=iD(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=JL(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=JL(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}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];_(s)?e[i]="disappear"===i?s.map((t=>{return"function"==typeof(e=t.callBack)&&/^class\s/.test(e.toString())?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:sD,customParameters:{callBack:t.callBack}});var e})):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{tD(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===$L.appear))?$L.appear:e.every((t=>t===$L.disappear))?$L.disappear:$L.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===BL.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=u(a.context)?a:((t,e)=>{let i=e;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=i.parent,i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=u(l.markId)?l.markId:null,c=u(l.modelId)?l.modelId:null,d=u(l.modelUserId)?l.modelUserId:null,p=u(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:kL(o),markId:h,modelId:c,markUserId:p,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===BL.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===BL.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===BL.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===BL.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===BL.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this.releaseGrammar(!0),this._stage!==(null===(t=this._option)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{tD(t,(t=>{t.removeProduct()}),null,!0)})):this._cachedMarks=eD(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return Uy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&function(t){return bu(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{xo.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()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{tD(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=S_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){S_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function aD(t,i){var s;return e(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==i?void 0:i.onError)&&void 0!==s?s:Hy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function oD(t){t.crosshair=G(t.crosshair||{}).map((e=>lI({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function lD(t,e,i){var s;const{width:n,height:r}=t;if(u(n)&&u(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}=ri(l,i.width,i.height);a=t,o=e}else if(h&&Uy(e.mode)){let t;t=v(h)?S_.getElementById(h):h;const{width:e,height:s}=ri(t,i.width,i.height);a=e,o=s}else if(Yy(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 hD(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function cD(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}}const dD=9,uD=0,pD=-1;var gD,fD,mD,vD,_D,yD;!function(t){t[t.SeriesGroup=0]="SeriesGroup",t[t.Axis_Grid=50]="Axis_Grid",t[t.CrossHair_Grid=100]="CrossHair_Grid",t[t.Region=450]="Region",t[t.Mark=300]="Mark",t[t.Node=400]="Node",t[t.Axis=100]="Axis",t[t.MarkLine=500]="MarkLine",t[t.MarkArea=100]="MarkArea",t[t.MarkPoint=500]="MarkPoint",t[t.DataZoom=500]="DataZoom",t[t.ScrollBar=500]="ScrollBar",t[t.Player=500]="Player",t[t.Legend=500]="Legend",t[t.CrossHair=500]="CrossHair",t[t.Indicator=500]="Indicator",t[t.Title=500]="Title",t[t.Label=500]="Label",t[t.Brush=500]="Brush",t[t.CustomMark=500]="CustomMark",t[t.Interaction=700]="Interaction"}(gD||(gD={})),function(t){t[t.Indicator=10]="Indicator",t[t.Region=20]="Region",t[t.Axis=30]="Axis",t[t.DataZoom=40]="DataZoom",t[t.Player=40]="Player",t[t.ScrollBar=40]="ScrollBar",t[t.Legend=50]="Legend",t[t.Title=70]="Title",t[t.CustomMark=70]="CustomMark"}(fD||(fD={})),function(t){t[t.Default=0]="Default",t[t.Theme=1]="Theme",t[t.Chart=2]="Chart",t[t.Base_Series=3]="Base_Series",t[t.Series=4]="Series",t[t.Mark=5]="Mark",t[t.User_Chart=6]="User_Chart",t[t.User_Series=7]="User_Series",t[t.User_Mark=8]="User_Mark",t[t.User_SeriesStyle=9]="User_SeriesStyle",t[t.Built_In=99]="Built_In"}(mD||(mD={}));class bD{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){d(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,z({},bD.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=G(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]))))}}bD.defaultMarkInfo={};class xD{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class SD{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=>lI({},i,s,t);return _(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 kD extends xD{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}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=SD,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new bD,this._lastLayoutRect=null,this.id=$y(),this.userId=t.id,this._spec=t,this.effect={},this.event=new ML(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){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}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){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_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){u(t)&&u(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!u(t)||!u(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${OI}_${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(e,i={},s){const{type:n,name:r}=e,{parent:a}=i,o=t(i,["parent"]),l=hI.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_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(!d(e))return P(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}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class AD{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}get lastComputeRect(){return this._lastComputeRect}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}get willLayoutTag(){return this._willLayoutTag}constructor(t,e){var i;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=fD.Region,this._willLayoutTag=!0,this._model=t,this._option=e,this.layoutLevel=e.layoutLevel,this.layoutType=e.layoutType,e.layoutOrient&&(this.layoutOrient=e.layoutOrient),this._spec=null===(i=null==t?void 0:t.getSpec)||void 0===i?void 0:i.call(t)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=XO(KO(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=d(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:YO(t.minHeight,e.height,e),this._maxHeight=d(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:YO(t.maxHeight,e.height,e),this._minWidth=d(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:YO(t.minWidth,e.width,e),this._maxWidth=d(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:YO(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:YO(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:YO(t.height,e.height,e)},{height:9}),d(t.offsetX)||(this.layoutOffsetX=YO(t.offsetX,e.width,e)),d(t.offsetY)||(this.layoutOffsetY=YO(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){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{d(this._spec[i])||(e[i]=YO(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};d(s)||(r.width-=s),d(n)||(r.width-=n),d(e)||(r.height-=e),d(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):(d(s)?d(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,d(e)?d(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?(d(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),d(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(d(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),d(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($O(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class MD extends kD{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,this._transformLayoutPadding=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 AD(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&N(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.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 wD extends SD{_initTheme(t,e){return{spec:t,theme:this._theme}}}class TD extends MD{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(t,e){var i;super(t,e),this.transformerConstructor=wD,this.modelType="region",this.specKey="region",this.type=TD.type,this._series=[],this.layoutType="region",this.layoutZIndex=gD.Region,this.seriesDataFilterOver=()=>{this.event.emit(CL.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=t.id,this.coordinate=null!==(i=t.coordinate)&&void 0!==i?i:"cartesian"}_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 t,e;this.initLayout(),super.created();const i=null!==(t=this._spec.clip)&&void 0!==t?t:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(e=this.userId)&&void 0!==e?e:this.type)+"_interaction",gD.Interaction),E(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",mD.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:gD.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:gD.Mark+1}))}_createGroupMark(t,e,i){var s,n;const r=this._createMark({type:"group",name:t});r.setUserId(e),r.setMarkConfig({zIndex:i});const a=null!==(s=this._spec.clip)&&void 0!==s?s:this._getClipDefaultValue();return this.setMarkStyle(r,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:a},"normal",mD.Built_In),this.setMarkStyle(r,{cornerRadius:null===(n=this._spec.style)||void 0===n?void 0:n.cornerRadius},"normal",mD.User_Mark),this._marks.addMark(r),r}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var t,e;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(t=this._spec.style)||void 0===t?void 0:t.fill)?1:0},this._spec.style),"normal",mD.User_Mark),(null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",mD.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",mD.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return N(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||G(t.userId).includes(e.userId))&&(!u(t.specIndex)||G(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})}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=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function CD(t){const e=[],i=[],s=[];return t.forEach((t=>{d(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 BD(t,e,i){e?t.forEach((t=>{const e=Y(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=Y(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 ED(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 PD(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=LD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),ED(d,!0,p,l),s&&BD(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function RD(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=LD(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=LD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),ED(d,!1,p,o),s&&BD(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function ID(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=LD(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_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){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_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,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=LD(t,this,e);"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,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=CD(t);n.length&&PD(n,e,i,!1,"left",s),r.length&&PD(r,e,i,!0,"left",s),a.length&&RD(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=CD(t);n.length&&OD(n,e,i,!1,"top",s),r.length&&OD(r,e,i,!0,"top",s),a.length&&ID(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=CD(t);n.length&&PD(n,e,i,!1,"right",s),r.length&&PD(r,e,i,!0,"right",s),a.length&&RD(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=CD(t);n.length&&OD(n,e,i,!1,"bottom",s),r.length&&OD(r,e,i,!0,"bottom",s),a.length&&ID(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=LD(t,this,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=>{N(i.getLayoutRect(),e.rect)||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{rect:i}=LD(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);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+c-l})}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+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&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:Hy)("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}}}DD.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(vD||(vD={})),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",t.STATE_HIGHLIGHT="highlight",t.STATE_BLUR="blur",t.STATE_ACTIVE="active"}(_D||(_D={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(yD||(yD={}));const FD=["linear","radial","conical"],zD={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const jD={};Object.values(_D).forEach((t=>{jD[t]=!0})),_D.STATE_HOVER,_D.STATE_HOVER_REVERSE,_D.STATE_SELECTED,_D.STATE_SELECTED_REVERSE,_D.STATE_DIMENSION_HOVER,_D.STATE_DIMENSION_HOVER_REVERSE;class HD extends xD{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(z(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class VD extends HD{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];u(s.domain)&&(n.domain=s.domain),u(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:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||(t=this._mark.type,ZL.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(u(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!jD[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(_(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(OI)));i=t.datums.some((t=>e&&_(null==t?void 0:t.items)?n.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])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(p(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(OI))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(eB(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class ND extends xD{constructor(){super(...arguments),this.id=$y(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=hI.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class WD extends ND{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}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._data=null,this._data=e}removeProduct(){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const UD=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,GD=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=UD(l.delay,n,a,o),d=UD(l.duration,n,a,o),u=UD(l.oneByOne,n,a,o),p=UD(l.splitPath,n,a,o),g=k(u)&&u>0?t=>x(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)?NT:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:WT)(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);zT(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{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)?NT:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:WT)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>IT(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>DT(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:$o.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 FT({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:BT,null!==(l=i.easing)&&void 0!==l?l:ET))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:$o.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new jT({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:BT,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:ET))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):zT(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},YD=(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))))},XD=t=>{const e=t.getMarkConfig();if(u(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}};class $D extends ND{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){u(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){d(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&u(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];_(n)?s[e]=n.map(i):u(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=G(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=G(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new WD(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(u(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}d(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else u(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=Pp("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){d(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(){this._product&&this._product.parent&&this._product.parent.removeChild(this._product),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(t,e){var i;super(e),this.type=void 0,this.name="mark",this._markConfig={zIndex:gD.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Nl)),i&&(c(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==vD.enter&&t.context.diffState!==vD.update||(t.stateProxy=(e,i)=>{var s;return this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)},t.context.states&&t.useStates(t.context.states,e))},this.name=t,this.model=e.model,this.key=e.key,this.state=new VD(e,this),this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(u(t.id)&&(this._userId=t.id),h(t.interactive)&&(this._markConfig.interactive=t.interactive),u(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),h(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_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,re)}isUserLevel(t){return[mD.User_Mark,mD.User_Series,mD.User_Chart,mD.User_SeriesStyle].includes(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];d(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}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){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[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"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;u(r)&&r<=s&&lI(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(iB(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return v(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=jO(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),e.clamp&&t.clamp&&t.clamp(e.clamp))}(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=c(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):FD.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):iB(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t){t.style&&this.setStyle(t.style,"normal",mD.User_Mark);const e=t.state;e&&Object.keys(e).forEach((t=>{const i=e[t];if("style"in i){const e=i.style;let s={stateValue:t};"level"in i&&(s.level=i.level),"filter"in i&&(s=c(i.filter)?Object.assign({filter:i.filter},s):Object.assign(Object.assign({},i.filter),s)),this.state.addStateInfo(s),this.setStyle(e,t,mD.User_Mark)}else this.setStyle(i,t,mD.User_Mark)}))}_computeGradientAttr(e){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=e,d=t(e,["gradient","scale","field"]);let p=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(p=t),g||(g=e)}const f=EO(BO(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},zD[o]),d);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==p?void 0:p.scale(t[g]);return c(n)&&(a=n(t,this._attributeContext,i)),u(s)&&(a=ti.SetOpacity(a,s)),{offset:c(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):c(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(e){const{scale:i,field:s}=e,n=t(e,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];c(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)FD.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=EO(BO(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return JL(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return hI.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=c(this.key)?this.key:u(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[zI],this._groupKeyGetter=u(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=JL(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===$L.appear))?$L.appear:t.every((t=>t===$L.disappear))?$L.disappear:t[0];return null!=e?e:$L.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{XD(t),s.push(...t.getGraphics())})),e.forEach((t=>{XD(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);GD([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=YD(e,n),r=YD(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===$L.exit?$L.exit:i===$L.update?$L.update:$L.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===vD.exit&&(t.context.reusing=!0,t.animates&&t.animates.forEach((t=>t.stop())))}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===vD.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,u,p,g;let f,m;return d(e)?(f=this._graphicMap.get(t),f&&(m=vD.exit)):d(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=vD.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=vD.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(u=f.context)||void 0===u?void 0:u.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=$L.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=$L.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return QL(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=QL(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(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||(!!c(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach(((t,e)=>{var i,n;let r=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i.update,t);null===(n=t.currentStates)||void 0===n||n.forEach((e=>{var i;const s=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i[e],t);r=Object.assign(Object.assign({},r),s)})),d(this._markConfig.interactive)||(r.pickable=this._markConfig.interactive);const a=this._transformGraphicAttributes(t,r,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=a}))}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r,a;const o=i.context.finalAttrs,l=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=AL(i,o);i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes({}),i.context.reusing=!1):l||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),!(null===(a=this.renderContext)||void 0===a?void 0:a.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i),e&&i.setFinalAttributes(o)}else{const a=i;i=this._createGraphic(o),e&&(null===(n=i.setFinalAttributes)||void 0===n||n.call(i,o)),i.context=a.context,i.context.diffAttrs=o,i.stateSort=this._stateSort;const l=this._graphics===t?s:s+this._graphics.length-t.length;if(l>=0&&(this._graphics[l]=i),null===(r=this.renderContext)||void 0===r?void 0:r.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,l),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const t={};Object.keys(this.stateStyle).forEach((e=>{if(e===_D.STATE_NORMAL){const{groupStyles:i,updateStyles:s}=this._separateNormalStyle(this.stateStyle[e]);t.group=this._getEncoderOfStyle(e,i),t.update=this._getEncoderOfStyle(e,s)}else t[e]=this._getEncoderOfStyle(e,this.stateStyle[e])})),this._encoderOfState=t}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(d(e)||(t.zIndex=e),d(i)||(t.clip=i),!d(s)){const e=_(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return d(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=hI.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=hI.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=G(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===qL.before||(this._product||this._initProduct(),zy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{"in"===this.state.checkOneState(i,i.context.data,e)?i.addState(t,!0,this.hasAnimationByState("state")):i.removeState(t,this.hasAnimationByState("state"))}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===vD.exit&&!e.isExiting)if(e.context.animationState===vD.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:vD.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=Pp({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||p(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{t.clearStates()}))}}var KD;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(KD||(KD={}));class qD extends $D{constructor(){super(...arguments),this.type=qD.type,this._marks=[],this._diffState=vD.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(jy("Mark already exists, add mark failed."),!1):(this._marks.push(t),!0)}removeMark(t){const e=this._marks.findIndex((e=>e.id===t.id||e.name===t.name));return-1===e?(jy("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInUserId(t){let e;return tD(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.diffState===vD.update){const t=this.hasAnimation(),e=AL(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e)),t&&this._product.setFinalAttributes(i)}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=vD.update}render(){this._isCommited&&(zy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct()}}qD.type="group";const ZD={measureText:RI};class JD{static instance(){return JD.instance_||(JD.instance_=new JD),JD.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 QD{constructor(){this.id=$y(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?jy("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class tF extends QD{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)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const eF={type:"fadeIn"};function iF(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 eF;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}class sF extends MT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.currentAnimationRatio=0,this.animationTime=0}onUpdate(t,e,i){super.onUpdate(t,e,i),this.currentAnimationRatio=e,this.animationTime=e*Math.PI*2}getAnimationTime(){return this.currentAnimationRatio>0?this.animationTime:Date.now()/1e3}afterStageRender(t,e){var i,s;return null===(s=null===(i=this.params)||void 0===i?void 0:i.callBack)||void 0===s?void 0:s.call(i,t,e,this.currentAnimationRatio,this.animationTime)}}const nF={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"},state:{duration:300,easing:"linear"}},rF={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},aF={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},oF=()=>{hI.registerAnimation("scaleInOut",(()=>rF))},lF=()=>{hI.registerAnimation("fadeInOut",(()=>aF))},hF=(t,e)=>({appear:iF(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:XT,duration:nF.update.duration,easing:nF.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),cF=()=>{hI.registerAnimation("line",hF)},dF=()=>{uT.registerBuiltInAnimate("growPointsIn",dC),uT.registerBuiltInAnimate("growPointsOut",uC),uT.registerBuiltInAnimate("growPointsXIn",gC),uT.registerBuiltInAnimate("growPointsXOut",fC),uT.registerBuiltInAnimate("growPointsYIn",vC),uT.registerBuiltInAnimate("growPointsYOut",_C),uT.registerBuiltInAnimate("clipIn",qT),uT.registerBuiltInAnimate("clipOut",ZT)},uF=()=>{ST(),uT.registerBuiltInAnimate("scaleIn",wC),uT.registerBuiltInAnimate("scaleOut",TC),uT.registerBuiltInAnimate("fadeIn",JT),uT.registerBuiltInAnimate("fadeOut",QT),uT.registerBuiltInAnimate("moveIn",PC),uT.registerBuiltInAnimate("moveOut",RC),uT.registerBuiltInAnimate("rotateIn",IC),uT.registerBuiltInAnimate("rotateOut",LC),uT.registerBuiltInAnimate("update",BC),uT.registerBuiltInAnimate("state",CC),uT.registerBuiltInAnimate("fromTo",DC),uT.registerBuiltInAnimate(sD,sF)},pF=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};_D.STATE_HIGHLIGHT,_D.STATE_BLUR;class gF{constructor(t){this._markSet=new bD,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){_(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.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 fF={highlightState:_D.STATE_HIGHLIGHT,blurState:_D.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class mF extends gF{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},fF,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return v(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll(e)}}mF.type="element-highlight",mF.defaultOptions=fF;const vF=()=>{hI.registerInteractionTrigger(mF.type,mF)},_F={state:_D.STATE_SELECTED,trigger:"click"};class yF extends gF{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},_F,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=G(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):v(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):x(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(_(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),t.addState(i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll(e)}}yF.type="element-select",yF.defaultOptions=_F;const bF=()=>{hI.registerInteractionTrigger(yF.type,yF)};class xF extends QD{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class SF{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>hI.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>hI.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>hI.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return hI.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>hI.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){hI.registerTransform(t,e)}static registerFunction(t,e){t&&e&&JD.instance().registerFunction(t,e)}static unregisterFunction(t){t&&JD.instance().unregisterFunction(t)}static getFunction(t){return t?JD.instance().getFunction(t):null}static getFunctionList(){return JD.instance().getFunctionNameList()}static registerMap(t,e,i){const s=hI.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=hI.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,FL.get(e);var e}static registerSVG(t,e,i){const s=hI.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=hI.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){AI.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}get event(){return this._event}getDataSet(){return this._dataSet}constructor(e,i){var n,r,a,o,l,h,c,d,p;this.id=$y(),this._userEvents=[],this._autoSize=!0,this._option={mode:s["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._renderState=nD.render,this._disableDimensionHoverEvent=!1,this._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))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;N(n.theme,this._spec.theme)?N(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=hD(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?hI.getSeriesBuiltInTheme(e):hI.getComponentBuiltInTheme(e);i=i?lI({},s,i[e]):s}s===t.length-1&&u(i)&&(i=CI({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},SO(i),this._option=Object.assign(Object.assign({},this._option),i),(null==i?void 0:i.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),i.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:_,stage:y,poptip:b}=g,x=t(g,["dom","renderCanvas","mode","stage","poptip"]),S=Uy(_);if(S?nx(yo):"node"===_&&NS(yo),S&&f&&(this._container=v(f)?S_.getElementById(f):f),m&&(this._canvas=m),y&&(this._stage=y),"node"!==_&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=MI.getCurrentThemeName(),this._setNewSpec(e),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const k=[];!1!==b&&k.push("poptipForText"),"sankey"===e.type&&k.push("scrollbar");const A=new rt(null!==(a=this._option.logLevel)&&void 0!==a?a:nt.Error);rt.setInstance(A),(null===(o=this._option)||void 0===o?void 0:o.onError)&&A.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._compiler=new rD({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:y,pluginList:k},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new IL(this,this._compiler),this._event=new ML(this._eventDispatcher,_),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=e.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),AI.registerInstance(this),null===(p=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===p||p.call(d,this)}_setNewSpec(t,e){return!!t&&(v(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=lI({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=BI(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;SF.getFunctionList()&&SF.getFunctionList().length&&(t=EI(t,SF)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=hI.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=hI.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(t){var e,i,s;if(!this._compiler)return void(null===(e=this._option)||void 0===e||e.onError("compiler is not initialized"));if(this._chart)return void(null===(i=this._option)||void 0===i||i.onError("chart is already initialized"));const n=hI.createChart(t.type,t,this._getChartOption(t.type));n?(this._chart=n,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(CL.initialized,{chart:n,vchart:this})):null===(s=this._option)||void 0===s||s.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var t,e;this._compiler&&(null===(e=null===(t=this._compiler.getStage())||void 0===t?void 0:t.getTimeline())||void 0===e||e.on("animationEnd",(()=>{this._event.emit(CL.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=xt(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.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 lD(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:II,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:LI})}_initDataSet(t){this._dataSet=t instanceof Ca?t:new Ca,DL(this._dataSet,"dataview",Ma),DL(this._dataSet,"array",i),LL(this._dataSet,"copyDataView",WL);for(const t in hI.transforms)LL(this._dataSet,t,hI.transforms[t]);for(const t in hI.dataParser)DL(this._dataSet,t,hI.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return c(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake?(null===(n=this._compiler)||void 0===n||n.releaseGrammar(),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.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.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),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),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(CL.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return e(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return e(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?$L.none:$L.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}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._cachedProcessedTheme=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,AI.unregisterInstance(this)}updateData(t,i,s,n){return e(this,void 0,void 0,(function*(){return this.updateDataSync(t,i,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):_(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return e(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=G(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._reSetRenderState(),d(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=G(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=G(this._spec.data);return G(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof Ba?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,u(n)&&(a.parser=n),u(r)&&(a.fields=r));else{const e=GL(t,this._dataSet,s);_(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,i=!0){return e(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,i)}))}updateSpec(t,i=!1,s,n){return e(this,void 0,void 0,(function*(){const e=this._updateSpec(t,i,n);return e?(yield this.updateCustomConfigAndRerender(e,!1,{morphConfig:s,transformSpec:e.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,i,s=!1,n){return e(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,i,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(v(e)&&(e=JSON.parse(e)),c(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(p(e))e.type===n&&(_(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?lI({},t[n][e.index],i):i):t[n]=s?lI({},t[n],i):i);else if(_(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?lI({},t[n][r],i):i)}else t.id===e&&(t[n]=s?lI({},t[n],i):i)}))}(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=lI({},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,i){return e(this,void 0,void 0,(function*(){return this.resizeSync(t,i)}))}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),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,this),!0)}_afterResize(){return this._isReleased||this._event.emit(CL.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)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=cI({},e,e.chart[t])),e};let l;if(E(n)&&E(r))l=wI(this._currentThemeName),this._currentTheme=o(a,l);else{const t=cI({},wI(p(r)&&r.type?r.type:p(n)&&n.type?n.type:this._currentThemeName),wI(n),wI(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),z(WM.poptip,NM,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;d(this._spec.width)?!d(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),d(this._spec.height)?!d(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!Uy(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||p(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return wI(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return e(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!MI.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),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}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(n.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=u(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(n.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(n.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(n.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return e(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield aD(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var i,s;return e(this,void 0,void 0,(function*(){if(!Uy(this._option.mode))return void(null===(i=this._option)||void 0===i||i.onError(new TypeError("non-browser environment can not export img")));const e=yield this.getDataURL();e?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,e):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;this._chart.resetLayoutItemTag(),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(u(this._container))return this._container;let e;return e=v(this._canvas)?S_.getElementById(this._canvas):this._canvas,u(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)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(E(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(u(r)?o=this._chart.getSeriesInUserId(r):u(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?qO(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||d(t)||E(e))return null;if(!_(t)){const{axisId:n,axisIndex:r}=e;let a;if(u(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):u(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return jy("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return u(r)?o=this._chart.getSeriesInUserId(r):u(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?qO(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(jy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return JD.instance().getFunction(t)}registerFunction(t,e){t&&e&&JD.instance().registerFunction(t,e)}unregisterFunction(t){t&&JD.instance().unregisterFunction(t)}getFunctionList(){return JD.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(n.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,r;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(r=this._chart)||void 0===r?void 0:r.getComponentsByType(n.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=hI.getChartPlugins();t.length>0&&(this._chartPlugin=new tF(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=hI.getVChartPlugins();e.length>0&&(this._vChartPlugin=new xF(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||s["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_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,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=nD.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){this._renderState=nD.render,this.getStage().eventSystem.resumeTriggerEvent()}}SF.InstanceManager=AI,SF.ThemeManager=MI,SF.globalConfig={uniqueTooltip:!0},SF.Utils=ZD,SF.vglobal=S_;hI.registerRegion("region",TD),hI.registerLayout("base",DD),qA(),DA(),hI.registerMark(qD.type,qD),hI.registerStageEventPlugin("gesture",Tb),vF(),bF(),yI(sI.name,sI);const kF="monotone",AF="linear",MF="bevel";var wF;function TF(t,e){return e("component",t)}function CF(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=hI.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}!function(t){t.vertical="vertical",t.horizontal="horizontal"}(wF||(wF={}));const BF=(t,e,i,s)=>{if(d(t[e]))return;const n=_(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},EF=(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(c(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(d(i))for(let i=0;i(l(t),t)))},PF="2.0.20",RF=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},OF=(t,e,i,s)=>{let n;if(n=c(t)?t(e,i):f(t)&&u(t.field)?P(e,t.field):t,s){const{formatFunc:i,args:r}=CF(void 0,s,t,e);i&&r&&(n=i(...r))}return n},IF=(t,e,i)=>d(t)?t:c(t)?t(e,i):t;const LF=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(_(e.activeType)?e.activeType.includes(t):e.activeType===t)));function DF(e,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=d(i.key)&&d(i.value)&&!E(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:p,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:_}=l,y=t(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=zF(OF(h,r,a,c),p,g),o.value=zF(OF(f,r,a,m),v,_),Object.keys(y).forEach((t=>{o[t]=OF(l[t],r,a)})),!1!==o.visible&&(u(o.key)||u(o.value))&&e.push(o)}};_(i)?i.forEach((t=>{o(t)})):o(i)}function FF(t,e,i,s,n,r,a){if(c(e)){DF(t,e(n,a),i,s,r,a)}else e&&DF(t,e,i,s,r,a)}const zF=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=gi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class jF{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:u(n)?G(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(u(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 G(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(u(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.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{_(t)?t.forEach((t=>{FF(a,t,e,i,s,n,r)})):c(t)?FF(a,t,e,i,s,n,r):t&&DF(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=c(e)?e(s,n):e;if(r?d(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){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}(s),e={visible:OF(r.visible,t,n),value:zF(OF(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:OF(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=OF(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&LF(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const HF={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}},VF=(t,e)=>{var i,s;let n=e.fields;if(c(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=aL([],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 NF(a,n,o)},NF=(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&&t.forEach((t=>{t&&n.push(t[a])}));const u=n.length;if(h){r.length=0,n.forEach(((t,e)=>{Ky(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===u}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{Ky(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&&!0===o.lockStatisticsByDomain&&!d(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=HF[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},WF=(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=>{Ky(t[e])||(t[e]=0)}))})),t},UF=`${OI}_HIERARCHY_DEPTH`,GF=`${OI}_HIERARCHY_ROOT`,YF=`${OI}_HIERARCHY_ROOT_INDEX`;function XF(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function $F(t,e,i){t&&(i.needDefaultSeriesField&&(t[jI]=i.defaultSeriesField),t[FI]=e,t[zI]=i.getKey(t,e,i))}function KF(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function qF(t,e,i,s=0,n,r){void 0===r&&(r=e),$F(t,e,i),t[UF]=s,t[GF]=n||t[i.categoryField],t[YF]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>qF(e,s,i,t[UF]+1,t[GF],r)))}const ZF={label:{name:"label",type:"text"}},JF=`${OI}_rect_x`,QF=`${OI}_rect_x1`,tz=`${OI}_rect_y`,ez=`${OI}_rect_y1`,iz={data:!0},sz={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},nz=[...Object.keys(nF),"normal"];function rz(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=_(a)?a.map(((t,e)=>{var s;let n=t;return cz(n)&&delete n.type,n.oneByOne&&(n=oz(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:lz,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=lI({},o[e],a);return cz(n)&&delete n.type,n.oneByOne&&(n=oz(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:lz,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function az(t,e,i){var s,n,r,a,o,l;const h={};return u(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),u(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),u(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),u(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),u(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),u(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=I(t,null,i),dz(t,(t=>{var i;if(c(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function oz(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=c(n)?n(t,i,a):k(n)?n:0,h=c(r)?r(t,i,a):k(r)?r:0;let d=c(s)?s(t,i,a):s;return!1===d?h:(d=!0===d?0:d,h+o*(l+d))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=c(n)?n(t,r,o):k(n)?n:0,d=c(a)?a(t,r,o):k(a)?a:0;let u=c(s)?s(t,r,o):s;if(!1===u)return d;return u=!0===u?0:u,d+((i?i():r.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function lz(t,e){var i;return null!==(i=null==t?void 0:t[FI])&&void 0!==i?i:e.context.graphicIndex}function hz(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 cz(t){return!function(t){return u(t.timeSlices)}(t)&&u(t.channel)}function dz(t,e,i=[]){if(_(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),dz(t[n],e,i)}));else if(p(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),dz(t[s],e,i))}function uz(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class pz extends SD{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=G(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=wO(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=hI.getSeriesMarkMap(o)?function(t,e,i){const s=hI.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=lI({},i("mark",G(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return lI({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_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){h(t.stack)&&(this.stack=t.stack),h(t.percent)&&(this.stack=t.percent||this.stack),d(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;G(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:d=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(c(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&d)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,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 u(s)&&(i.outerRadius=s),u(n)&&(i.innerRadius=n),u(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=lI({},i,s,t),n=i.label;return n&&p(n)&&_(e.label)&&(e.label=e.label.map((t=>lI({},n,t)))),e};return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class gz extends kD{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){u(t)&&(this._seriesField=t)}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:`${OI}_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=pz,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=gD.SeriesGroup,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(CL.afterInitData,{model:this}),this.initRootMark(),this.initMark();const t=uz(this);this._initExtensionMark({hasAnimation:t}),this.initMarkStyle(),this.initMarkState(),t&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(CL.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 d(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),u(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)&&(LL(this._rawData.dataSet,"invalidTravel",WF),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;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=GL(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=UL(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=UL(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new WD(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(d(this._rawStatisticsCache[t].min)||d(this._rawStatisticsCache[t].max))||!e&&d(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=$(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=NF(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=z(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){LL(this._dataSet,"dimensionStatistics",VF);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new Ba(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&&aL(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){LL(this._dataSet,"dimensionStatistics",VF);const s=new Ba(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=aL(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&aL(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new Ba(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 d(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)}`)}:v(t)?e=>e[t]:_(t)&&t.every((t=>v(t)))?e=>t.map((t=>e[t])).join("-"):c(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)&&(LL(this._rawData.dataSet,"addVChartProperty",RF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:XF.bind(this),call:$F}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){var e;null===(e=this._rawDataStatistics)||void 0===e||e.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(CL.rawDataUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(CL.viewDataFilterOver,{model:this})}viewDataUpdate(t){var e;this.event.emit(CL.viewDataUpdate,{model:this}),null===(e=this._data)||void 0===e||e.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(CL.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||d(e)?null:t[e]}getDatumPositionValues(t,e){return!t||d(e)?[]:v(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;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.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(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:u(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(u(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=rz({},az(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)}))),!d(t.dataId)||!d(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(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:u(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(t){if(!(null==t?void 0:t.length))return[];const e=(i=this._option.mode)===s["desktop-browser"]||i===s["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:Gy(i)||Yy(i)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var i;let n=Object.assign({},null==e?void 0:e.hover),r=Object.assign({},null==e?void 0:e.select);const a=this._spec.hover;h(a)?n.enable=a:p(a)&&(n.enable=!0,n=lI(n,a));const o=this._spec.select;h(o)?r.enable=o:p(o)&&(r.enable=!0,r=lI(r,o));const l=[{trigger:{type:"dimension-hover"},marks:t}];if(n.enable){const e=pF(n,t);e.length&&l.push({trigger:this._defaultHoverConfig(n),marks:e})}if(r.enable){const e=pF(r,t);e.length&&l.push({trigger:this._defaultSelectConfig(r),marks:e})}return l}_defaultHoverConfig(t){return{type:"element-highlight",trigger:t.trigger,triggerOff:t.triggerOff,blurState:_D.STATE_HOVER_REVERSE,highlightState:_D.STATE_HOVER}}_defaultSelectConfig(t){const e="multiple"===t.mode,i=u(t.triggerOff)?t.triggerOff:e?["empty"]:["empty",t.trigger];return{type:"element-select",trigger:t.trigger,triggerOff:i,reverseState:_D.STATE_SELECTED_REVERSE,state:_D.STATE_SELECTED,isMultiple:e}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=pF(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}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:jI;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:HI,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],u(o)?o:t.getAttribute(e,s)}})),this.setMarkStyle(t,a,HI,mD.User_SeriesStyle)}))}afterInitMark(){this.event.emit(CL.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{var e,i;(null===(i=null===(e=t.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&t.setAttribute("stroke",this.getColorAttribute(),"normal",mD.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.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()}initTooltip(){this._tooltipHelper=new jF(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||e.visible!==t[i].visible))?i.reMake=!0:!i.reCompile&&e.some(((e,i)=>!N(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!N(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},iz),sz),i),{extensionMark:!0,label:!0,totalLabel:!0});return this._compareExtensionMarksSpec(G(t.extensionMark),G(e.extensionMark),s),!s.reMake&&this._compareLabelSpec(G(t.label),G(e.label),s),!s.reMake&&this._compareLabelSpec(G(t.totalLabel),G(e.totalLabel),s),s.reMake?s:(!s.reCompile&&this._marks.getMarks().some((i=>{var s,n;return r[i.name]=!0,(null===(s=e[i.name])||void 0===s?void 0:s.visible)!==(null===(n=t[i.name])||void 0===n?void 0:n.visible)}))&&(s.reCompile=!0),!s.reCompile&&n.some((i=>sz[i]&&!N(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!N(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Ba||YL(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();uz(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),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:jI,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new FO).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return BO(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:jI}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:p={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:_=!1}=e,y=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:_,parent:!1!==m?null!=m?m:this._rootMark:null});if(u(y)){const e=this.getSpec()||{};this._marks.addMark(y,{name:t.name}),v&&(this._seriesMark=y),d(f)?y.setData(this._data):!1!==f&&y.setDataView(f),y.setSkipBeforeLayouted(!1!==c),d(h)||y.setGroupKey(h);const l=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:null!==(s=i.morph)&&void 0!==s&&s,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(n=i.support3d)&&void 0!==n?n:e.support3d||!!e.zField,morphKey:(null===(r=e.morph)||void 0===r?void 0:r.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});y.setMarkConfig(l),this.initMarkStyleWithSpec(y,lI({},p,g||e[y.name]))}return y}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:zI}_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!==WI&&t!==GI&&t!==NI&&t!==UI||(t=this.getStackValueField()),null!==(e=lL(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>Ky(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:jI]}}function fz(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();eB(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 mz(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}}}gz.mark=ZF,gz.transformerConstructor=pz;class vz extends gz{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=G(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=G(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&G(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);eB(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:`${OI}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?G(this._spec.xField)[0]:G(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(WI),this.setFieldX2(NI)):(this.setFieldY(WI),this.setFieldY2(NI))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(GI),this.setFieldX2(UI)):(this.setFieldY(GI),this.setFieldY2(UI))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(XI),this.setFieldX2(YI)):(this.setFieldY(XI),this.setFieldY2(YI))}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=G(this._spec.xField),this._specYField=G(this._spec.yField),u(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(),u(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(G(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(G(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(CL.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)&&(fz("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()!==n.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==n.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)}}function _z(t){return"bottom"===t||"top"===t}function yz(t){return"left"===t||"right"===t}function bz(t){return"z"===t}function xz(t,e){return WO(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function Sz(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function kz(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?_z(t)?"linear":"band":_z(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${n.cartesianAxis}-${s}`}}const Az=(t,e,i)=>{var s;const n=null!==(s="band"===e?TF("axisBand",i):["linear","log","symlog"].includes(e)?TF("axisLinear",i):{})&&void 0!==s?s:{},r=_z(t)?TF("axisX",i):yz(t)?TF("axisY",i):TF("axisZ",i);return lI({},TF("axis",i),n,r)};class Mz{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:Hy)("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:Hy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;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)))),r=n.filter((t=>sB(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return _z(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class wz extends Mz{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(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:BL.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const Tz=(t,e)=>{var i,s;return t===e||!d(t)&&!d(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))},Cz=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},Bz=(t,e,i,s)=>{var n;const r=e.getScale(),a=sB(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=G(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.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))})),o.push({series:h,datum:e,key:Ez(h,s)})}else if(u(i[1])){const e=[],s=[];l.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||u(n[i[0]])&&u(n[i[1]])&&t>=n[i[0]]&&t{if(u(e[i[0]])){const r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{if(u(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(G(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};class Rz extends Mz{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!Tz(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:BL.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:BL.canvas}),callback:this.onMouseOut}),Gy(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:BL.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Gy(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var Oz;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Oz||(Oz={}));const Iz={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class Lz{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",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.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(Iz.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(t,e){var i,s;const n=this._lineMark;if(n){if(this.setMarkStyle(n,{stroke:this.getColorAttribute()},"normal",mD.Series),"zero"!==this._invalidType&&this.setMarkStyle(n,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",mD.Series),this.event.on(CL.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(n,"defined")})),"polar"===this.coordinate)this.setMarkStyle(n,{lineJoin:MF,curveType:AF,closePath:!0},"normal",mD.Series);else{const r=null!=e?e:null===(s=null===(i=this.getSpec().line)||void 0===i?void 0:i.style)||void 0===s?void 0:s.curveType,a=r===kF?"horizontal"===t?"monotoneY":"monotoneX":r;this.setMarkStyle(n,{curveType:a},"normal",mD.Built_In)}this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",mD.Series)}return n}_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){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(Iz.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:hz(this._spec,Iz.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new Ba(this._option.dataSet,{name:`${OI}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const t=this._symbolMark;if(!t)return this._initSymbolActiveMarkAlone(),t;if(this._initSymbolMark(t),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(Oz.dimensionHover,this._dimensionTrigger.bind(this));for(const e in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[e]={};for(const i in this._symbolMark.stateStyle[e])"visible"!==i&&(this._symbolActiveMark.stateStyle[e][i]={style:null,level:mD.Series,referer:t})}this._symbolActiveMark.state.changeStateInfo({stateValue:_D.STATE_DIMENSION_HOVER,filter:()=>!0})}return t}_initSymbolMark(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",mD.Series),this.setMarkStyle(t,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",mD.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[Iz.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(Oz.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,lI({},this._spec[Iz.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:_D.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(t){var e;t&&("symbol"!==(null===(e=t.getTarget())||void 0===e?void 0:e.type)&&t.setRule("line-data"),this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},"normal",mD.Series),this.event.on(CL.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(t,e){var i,s,n,r;if(!t)return;const a=this._isFieldAllValid();if("zero"===this._invalidType||a){if(!0===(null===(s=null===(i=t.stateStyle.normal)||void 0===i?void 0:i[e])||void 0===s?void 0:s.style))return;this.setMarkStyle(t,{[e]:!0},"normal",mD.Series)}else{if(!0!==(null===(r=null===(n=t.stateStyle.normal)||void 0===n?void 0:n[e])||void 0===r?void 0:r.style))return;this.setMarkStyle(t,{[e]:this._getInvalidDefined.bind(this)},"normal",mD.Series)}t.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const Dz=Object.assign(Object.assign({},ZF),Iz),Fz=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(v(t))return!1;if(_(t))return t.length===e.length&&t.every(((t,i)=>Fz(t,e[i])));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]))},zz=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class jz extends $D{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return zz}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(d(o)||s.includes(a))return;r&&n.includes(a)&&(iB(null==o?void 0:o.type)||(null==o?void 0:o.scale)||c(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!d(t)||!d(e))||!d(t)&&!d(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?Fz(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,d(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n,r;const a=e.context.data,o=[],l=[],h={},c=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,d=c&&0===c.currentIndex;if(a.forEach(((e,i)=>{var s;l[i]={},o[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?l[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!c?o[i][s]=t[s](e):0!==i||c&&!d||(h[s]=t[s](e))})),l[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),c){const t=null!==(r=null===(n=e.attribute)||void 0===n?void 0:n.segments)&&void 0!==r?r:[];return t.push({points:l}),d?Object.assign(Object.assign({},h),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(o,l);if(t)return Object.assign(Object.assign(Object.assign({},h),o[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},h),o[0]),{points:l,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:vD.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[zI]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}class Hz extends jz{constructor(){super(...arguments),this.type=Hz.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)===AO.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}Hz.type="line";const Vz=()=>{hI.registerMark(Hz.type,Hz),qA(),HA(),WE(),zE(),dF(),hI.registerGraphicComponent("line",Eg)};class Nz extends $D{constructor(){super(...arguments),this.type=Nz.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="circle":a.symbolType=o,a}}Nz.type="symbol";const Wz=()=>{hI.registerMark(Nz.type,Nz),qA(),JA(),zE(),hI.registerGraphicComponent("symbol",Tg)};class Uz extends pz{_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)}}function Gz(t){return t.length>=2&&k(t[0])&&k(Y(t))&&Y(t)>=t[0]}function Yz(t,e){var i;const s=Y(e)-e[0],n=Y(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=Y(e)>0?Y(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!k(o.min),extendable_max:!k(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):Y(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function Xz(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 $z(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 Kz(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 qz(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 Zz=(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=>t.type.includes("ticks"))))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=Y(p)-p[0];if(0===g)return t;const f=c.domain(),m=Y(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=ie(t,e),a=Math.max(te(i),te(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return KC(v)};class Jz{constructor(t){this.id=$y(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class Qz extends Jz{constructor(){super(Qz.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!eB(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(t,e){const i=this._checkEnableSync(e);if(!i)return;if(!i.zeroAlign)return;const s=this._getTargetAxis(e,i);s&&e.event.on(CL.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id||t.id===s.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&&Gz(c)&&Gz(d)))return;const u=Yz(t,c),p=Yz(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:k}=p;if(0===g&&0===f){if(!$z(u,p))return}else if(0===y&&0===b){if(!$z(p,u))return}else if(_||k)if(_&&!k){if(!Xz(u,p))return}else if(k&&!_){if(!Xz(p,u))return}else{if(f===b)return;if(f>b){if(!Kz(u,p))return}else if(!Kz(p,u))return}else{if(0===f&&0===y){if(!qz(u,p))return}else if(0===b&&0===g&&!qz(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===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)})(s,e)}))}onDidCompile(t,e){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){LL(e.getOption().dataSet,"tickAlign",Zz);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}Qz.pluginType="component",Qz.type="AxisSyncPlugin";const tj={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function ej(t){let e=0;return P(t,"tick.visible")&&(e+=P(t,"tick.tickSize")),P(t,"label.visible")&&(e+=P(t,"label.space")),e}function ij(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 sj(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const nj=t=>"band"===t||"ordinal"===t||"point"===t;function rj(t,e){return{id:t,label:t,value:e,rawValue:t}}function aj(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class oj extends QD{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const lj=`${OI}_ARC_TRANSFORM_VALUE`,hj=`${OI}_ARC_RATIO`,cj=`${OI}_ARC_START_ANGLE`,dj=`${OI}_ARC_END_ANGLE`,uj=`${OI}_ARC_K`,pj=`${OI}_ARC_MIDDLE_ANGLE`,gj=`${OI}_ARC_QUADRANT`,fj=`${OI}_ARC_RADIAN`,mj=-Math.PI/2,vj=3*Math.PI/2,_j=.6,yj=(t,e,i,s)=>{const n=t();if(x(n))return n;if(c(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return ue(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},bj=(t,e,i)=>{var s;const n=null!==(s="band"===e?TF("axisBand",i):"linear"===e?TF("axisLinear",i):{})&&void 0!==s?s:{},r=TF("angle"===t?"axisAngle":"axisRadius",i);return lI({},TF("axis",i),n,r)};function xj(t,e,i,s){switch(t){case n.cartesianBandAxis:return Az(xz(i,["z"]),"band",e);case n.cartesianLinearAxis:return Az(xz(i,["z"]),"linear",e);case n.cartesianLogAxis:return Az(xz(i,["z"]),"log",e);case n.cartesianSymlogAxis:return Az(xz(i,["z"]),"symlog",e);case n.cartesianAxis:case n.cartesianTimeAxis:return Az(xz(i),void 0,e);case n.polarBandAxis:return bj(i.orient,"band",e);case n.polarLinearAxis:return bj(i.orient,"linear",e);case n.polarAxis:return bj(i.orient,void 0,e);case n.cartesianCrosshair:return((t,e)=>{var i,s;const r=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:d}=null!==(s=TF(n.crosshair,t))&&void 0!==s?s:{},p=r.find((t=>_z(t.orient)));let g;g=u(p)?lI({},nj(p.type)?a:o,l):l;const f=r.find((t=>yz(t.orient)));let m;return m=u(f)?lI({},sB(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(e,s);case n.polarCrosshair:return((t,e)=>{var i,s;const r=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:d}=null!==(s=TF(n.crosshair,t))&&void 0!==s?s:{},p=r.find((t=>"angle"===t.orient));let g;g=u(p)?lI({},nj(p.type)?a:o,l):l;const f=r.find((t=>"radius"===t.orient));let m;return m=u(f)?lI({},sB(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case n.colorLegend:case n.sizeLegend:case n.discreteLegend:case n.dataZoom:case n.scrollBar:return Sj(i,TF(t,e));default:return TF(t,e)}}const Sj=(t,e)=>{var i;const s=lI({},e,e[Sz(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class kj extends SD{getTheme(t,e){return xj(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({},KO(e)),{[s]:0}))}}class Aj extends MD{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=kj,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof Fc||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:BL.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new oj(this)}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)))}_getNeedClearVRenderComponents(){return[]}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=>!N(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&&(t.release(!0),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=>{e.compile({group:t,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}}getDatum(t){}}var Mj,wj;Aj.transformerConstructor=kj,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(Mj||(Mj={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(wj||(wj={}));class Tj extends $D{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}clearComponent(){this._component&&(this._component.parent&&this._component.parent.removeChild(this._component),this._component=null)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=hI.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(wL.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){super.release(),this.removeProduct()}}Tj.type="component";const Cj=()=>{hI.registerMark(Tj.type,Tj)},Bj=t=>t;class Ej extends Aj{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}getVisible(){return this._visible}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i,s;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._specVisible=!0,this._hideWhenEmpty=!1,this._tick=void 0,this._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._specVisible=null===(i=t.visible)||void 0===i||i,this._hideWhenEmpty=null!==(s=t.hideWhenEmpty)&&void 0!==s&&s,this._visible=this._specVisible,this._coordinateType="none"}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._specVisible=null===(t=this._spec.visible)||void 0===t||t,this._hideWhenEmpty=null!==(e=this._spec.hideWhenEmpty)&&void 0!==e&&e,this._visible=this._specVisible,this._scale&&this._refreshVisibilityByData()}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(u)}created(){var t,e,i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,_,y;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._refreshVisibilityByData(),this._shouldComputeTickData()&&this._initData(),this._specVisible){const b=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?Mj.circleAxis:Mj.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(b),this._axisMark=b,b.setMarkConfig({zIndex:this.layoutZIndex}),u(this._spec.id)&&b.setUserId(this._spec.id),b.setMarkConfig({interactive:null!==(t=this._spec.interactive)&&void 0!==t?t:this.getDefaultInteractive()}),this._marks.addMark(b),null===(e=this._spec.grid)||void 0===e?void 0:e.visible){const t=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?wj.circleAxisGrid:wj.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(t),t.setMarkConfig({zIndex: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:gD.Axis_Grid,interactive:!1}),this._marks.addMark(t),this._gridMark=t}if(this._syncComponentVisibility(),(null===(o=this._option.globalInstance)||void 0===o?void 0:o.isAnimationEnable())&&!1!==P(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=rz(null===(l=hI.getAnimationInKey("axis"))||void 0===l?void 0:l(),{appear:null!==(c=null!==(h=this._spec.animationAppear)&&void 0!==h?h:P(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==c?c:P(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(p=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:P(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==p?p:P(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(f=null!==(g=this._spec.animationEnter)&&void 0!==g?g:P(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==f?f:P(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(v=null!==(m=this._spec.animationExit)&&void 0!==m?m:P(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==v?v:P(this._option.getChart().getSpec(),"animationExit"),update:null!==(y=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:P(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==y?y:P(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._specVisible&&(this.getVisible()||this._spec.forceInitTick||this._hideWhenEmpty)}_initData(){const t=this._initTickDataSet(this._tickTransformOption()),e=new WD(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return this._regions&&_O(this._regions,(s=>{var r;let a=this.collectSeriesField(t,s);if(a=_(a)?eB(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!eB(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(r=s.getViewDataStatistics)||void 0===r?void 0:r.call(s),o=this.type===n.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return _O(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:s}=this._spec;u(t)&&(this._seriesUserId=G(t)),u(i)&&(this._regionUserId=G(i)),u(e)&&(this._seriesIndex=G(e)),u(s)&&(this._regionIndex=G(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(CL.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const t=yO(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));t.length>1?this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()})):1===t.length&&t[0].target.addListener("change",(()=>{this.updateScaleDomain()})),_O(this._regions,(t=>{t.event.on(CL.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_hasCollectedSeriesData(){return this.collectData(0).length>0}_refreshVisibilityByData(){const t=this._specVisible&&(!this._hideWhenEmpty||this._hasCollectedSeriesData()),e=this._visible!==t;return this._visible=t,(this._axisMark||this._gridMark)&&this._syncComponentVisibility(),e&&this._forceLayout(),e}_syncComponentVisibility(){var t,e,i,s,n,r,a,o,l,h,c,d;null===(t=this._axisMark)||void 0===t||t.setVisible(this._visible),null===(e=this._gridMark)||void 0===e||e.setVisible(this._visible&&!1!==(null===(i=this._spec.grid)||void 0===i?void 0:i.visible)),null===(a=null===(r=null===(n=null===(s=this._axisMark)||void 0===s?void 0:s.getComponent)||void 0===n?void 0:n.call(s))||void 0===r?void 0:r.setAttributes)||void 0===a||a.call(r,{visibleAll:this._visible}),null===(c=null===(h=null===(l=null===(o=this._gridMark)||void 0===o?void 0:o.getComponent)||void 0===l?void 0:l.call(o))||void 0===h?void 0:h.setAttributes)||void 0===c||c.call(h,{visibleAll:this._visible&&!1!==(null===(d=this._spec.grid)||void 0===d?void 0:d.visible)})}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(CL.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&N(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):_O(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(_O(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_getAxisAttributes(){const e=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&e.select,hover:!0!==this._option.disableTriggerEvent&&e.hover};var s;if(e.domainLine&&e.domainLine.visible?i.line=((s=_L(s=e.domainLine)).startSymbol=_L(s.startSymbol),s.endSymbol=_L(s.endSymbol),s):i.line={visible:!1},e.label&&e.label.visible){const t=j(e.label,["style","formatMethod","state"]);i.label=t,e.label.style&&(i.label.style=c(e.label.style)?(t,i,s,n)=>{var r;const a=e.label.style(t.rawValue,i,t,s,n);return xL(lI({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:xL(e.label.style)),(e.label.formatMethod||e.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),e.label.state&&(i.label.state=function(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{c(t[i])?e[i]=(e,s,n,r)=>xL(t[i](e.rawValue,s,e,n,r)):E(t[i])||(e[i]=xL(t[i]))})),e}(e.label.state)),c(e.label.dataFilter)&&(i.label.dataFilter=(t,i)=>e.label.dataFilter(t,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(e.tick&&e.tick.visible?(i.tick={visible:e.tick.visible,length:e.tick.tickSize,inside:e.tick.inside,alignWithLabel:e.tick.alignWithLabel,dataFilter:c(e.tick.dataFilter)?t=>e.tick.dataFilter(t,{vchart:this._option.globalInstance}):void 0},e.tick.style&&(i.tick.style=c(e.tick.style)?(t,i,s,n)=>{var r;const a=e.tick.style(t,i,s,n);return xL(lI({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:xL(e.tick.style)),e.tick.state&&(i.tick.state=yL(e.tick.state))):i.tick={visible:!1},e.subTick&&e.subTick.visible?(i.subTick={visible:e.subTick.visible,length:e.subTick.tickSize,inside:e.subTick.inside,count:e.subTick.tickCount},e.subTick.style&&(i.subTick.style=c(e.subTick.style)?(t,i,s,n)=>{var r;const a=e.subTick.style(t,i,s,n);return xL(lI({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:xL(e.subTick.style)),e.subTick.state&&(i.subTick.state=yL(e.subTick.state))):i.subTick={visible:!1},e.title&&e.title.visible){const s=e.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=t(s,["autoRotate","angle","style","background","state","shape"]);let u,p=r;"left"!==e.orient&&"right"!==e.orient||n&&d(p)&&(p="left"===e.orient?-90:90,u=tj[e.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?re(p):null,textStyle:lI({},u,xL(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:xL(h.style)}),h.state&&(i.title.state.shape=yL(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:xL(o.style)}),o.state&&(i.title.state.background=yL(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=yL(l))}else i.title={visible:!1};return e.background&&e.background.visible?(i.panel={visible:!0},e.background.style&&(i.panel.style=xL(e.background.style)),e.background.state&&(i.panel.state=yL(e.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:PI(t.grid.alternateColor),alignWithLabel:t.grid.alignWithLabel,style:c(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 xL(lI({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:xL(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:PI(t.subGrid.alternateColor),style:xL(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=CF(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){DL(this._option.dataSet,"scale",Bj);const i=this.registerTicksTransform();return new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,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)}getDatum(t){var e;return t&&t.name===fw.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}Ej.specKey="axes";const Pj=()=>{Cj(),hI.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},Rj=[Qz];class Oj extends Ej{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}constructor(e,i){super(e,i),this.type=n.cartesianAxis,this.name=n.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=gD.Axis,this.layoutLevel=fD.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),_O(this._regions,(t=>{const e=this.getOrient();_z(e)?aj(t.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):yz(e)?aj(t.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):bz(e)&&aj(t.getZAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&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._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{if(!this._visible)return void this._syncComponentVisibility();const e=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=t(i,["grid"]),r=lI({x:e.x,y:e.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(lI({x:e.x,y:e.y},this._getGridAttributes(),s)),this._syncComponentVisibility()},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=_z(this.getOrient()),n=t=>{var e;return(s?!_z(t.getOrient()):_z(t.getOrient()))&&eB(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&&Y(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(u(t))a=r.find((e=>e.id===t));else if(u(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=xz(e,["z"]),bz(this._orient)&&(this.layoutType="absolute"),this._dataSet=i.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!_(e)){if(!sj(e))return null;const{axisType:t,componentName:s}=kz(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=>yz(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(!sj(t))return;const{axisType:s,componentName:n}=kz(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]),r=hI.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}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return _z(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):bz(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(Rj.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this._specVisible){_z(this.getOrient())?m(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):m(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&&!_z(t.orient)&&(i=!u(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!bz(this.getOrient())&&this._spec.innerOffset){const t=this._spec;yz(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=YO(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=YO(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=_z(this.getOrient())?t.fieldX:bz(this.getOrient())?t.fieldZ:t.fieldY,eB(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;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,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:eB(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 t;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(wL.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(_z(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._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=_z(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)}))}collectScale(){const t=[];return _O(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]:_z(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:bz(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();_O(this._regions,(e=>{_z(t)?aj(e.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):yz(t)?aj(e.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):bz(t)&&aj(e.getZAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(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=_z(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 s={skipLayout:!1},n=_z(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)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=lI(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new je).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=_z(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?mt(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):mt(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-Y(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&d(null===(e=a.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=a.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 o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return rj(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:eB(this._scale.type)?i>=s[0]&&i<=Y(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this._specVisible&&(this.event.on(CL.layoutEnd,this._updateAxisLayout),this.event.on(CL.layoutEnd,this._fixAxisOnZero),this.event.on(CL.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 i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}Oj.type=n.cartesianAxis,Oj.specKey="axes";const Ij=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function Lj(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,Fj=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function zj(t,e,i="count"){const s=Fj(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const jj=Math.sqrt(50),Hj=Math.sqrt(10),Vj=Math.sqrt(2);class Nj{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){u(this._spec.nice)&&(this._nice=this._spec.nice),u(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=ij(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(i.forceTickCount))e=i.forceTickCount;else if(c(i.tickCount)){const t=this._scale.range();let s=Math.abs(Y(t)-t[0]);if(1===s&&this._option){s=_z(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=k(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return d(s)&&d(n)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice(e):(u(s)||u(this._softMinValue))&&d(n)&&d(this._softMaxValue)?this._scale.niceMax(e):!(!d(s)||!d(this._softMinValue)||!u(n)&&!u(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return d(e)&&d(i)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice():(u(e)||u(this._softMinValue))&&d(i)&&d(this._softMaxValue)?this._scale.niceMax():!(!d(e)||!d(this._softMinValue)||!u(i)&&!u(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=d(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(Dj),e.sort(Dj),{domain:Lj(t,e),scope:zj(t,e,i)}}(r,Dy(t),this._spec.breaks[0].scopeType);e=Dy(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=Y(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),u(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),u(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=ij(this._spec);if(u(e)||u(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[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=jj?10:n>=Hj?5:n>=Vj?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(Y(t),0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();if(this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(CL.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=Y(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}updateScaleDomainByModel(t){if(t=null!=t?t:this._scale.domain(),this.extendDomain(t),this.includeZero(t),this.setDomainMinMax(t),this.niceDomain(t),this._scale.domain(t,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(t),this._domainAfterSpec=this._scale.domain(),this._refreshVisibilityByData(),this.event.emit(CL.scaleDomainUpdate,{model:this}),this.event.emit(CL.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(Y(t)-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}_updateRawDomain(){const t=this.collectData(0,!0),e=this.computeLinearDomain(t);this._rawDomain=e,this.event.emit(CL.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}const Wj={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},Uj={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}}},Gj={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}}},Yj={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}}};class Xj extends Oj{constructor(){super(...arguments),this.type=n.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new GB}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];u(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),u(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!bz(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=_z(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=UO(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=Dy(this._break.scope).map((t=>i[0]+(Y(i)-i[0])*t))),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}registerTicksTransform(){const t=`${this.type}-ticks`;return LL(this._option.dataSet,t,tE),t}}Xj.type=n.cartesianLinearAxis,Xj.specKey="axes",Xj.builtInTheme={axis:Yj,axisLinear:Wj,axisX:Uj,axisY:Gj},U(Xj,Nj);const $j=()=>{hI.registerGraphicComponent(Mj.lineAxis,((t,e)=>new NC(t,e))),hI.registerGraphicComponent(wj.lineAxisGrid,((t,e)=>new JE(t,e))),Pj(),hI.registerComponent(Xj.type,Xj)};class Kj{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new WD(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{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._refreshVisibilityByData(),this.event.emit(CL.scaleDomainUpdate,{model:this}),this.event.emit(CL.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).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=G(e).concat(i);if(n.push(r),o){const e=rj(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=>rj(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const t=this._spec.domain;for(let e=0;ethis._rawDomainIndex[e][t]=i))}this.event.emit(CL.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const qj={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}};class Zj extends Oj{constructor(){super(...arguments),this.type=n.cartesianBandAxis,this._scale=new AB}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}}registerTicksTransform(){const t=`${this.type}-ticks`;return LL(this._option.dataSet,t,rE),t}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=fB(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(),p=e=>{const i=t===n?a:0;if(d(r)||t{hI.registerGraphicComponent(Mj.lineAxis,((t,e)=>new NC(t,e))),hI.registerGraphicComponent(wj.lineAxisGrid,((t,e)=>new JE(t,e))),Pj(),hI.registerComponent(Zj.type,Zj,!1)};class Qj extends Xj{constructor(){super(...arguments),this.type=n.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),_O(this._regions,(t=>{_z(this.getOrient())?aj(t.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):aj(t.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=lI({},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 Ba(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.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 WD(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=gi.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=>rj(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=>rj(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return LL(this._option.dataSet,t,tE),t}transformScaleDomain(){}}Qj.type=n.cartesianTimeAxis,Qj.specKey="axes",Qj.builtInTheme={axis:Yj,axisX:Uj,axisY:Gj};const tH=()=>{hI.registerGraphicComponent(Mj.lineAxis,((t,e)=>new NC(t,e))),hI.registerGraphicComponent(wj.lineAxisGrid,((t,e)=>new JE(t,e))),Pj(),hI.registerComponent(Qj.type,Qj)};class eH extends Xj{constructor(){super(...arguments),this.type=n.cartesianLogAxis,this._zero=!1,this._scale=new KB}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return LL(this._option.dataSet,t,tE),t}transformScaleDomain(){}}eH.type=n.cartesianLogAxis,eH.specKey="axes",eH.builtInTheme={axis:Yj,axisLinear:Wj,axisX:Uj,axisY:Gj},U(eH,Nj);const iH=()=>{hI.registerGraphicComponent(Mj.lineAxis,((t,e)=>new NC(t,e))),hI.registerGraphicComponent(wj.lineAxisGrid,((t,e)=>new JE(t,e))),Pj(),hI.registerComponent(eH.type,eH)};class sH extends Xj{constructor(){super(...arguments),this.type=n.cartesianSymlogAxis,this._zero=!1,this._scale=new qB}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return LL(this._option.dataSet,t,tE),t}transformScaleDomain(){}}sH.type=n.cartesianSymlogAxis,sH.specKey="axes",sH.builtInTheme={axis:Yj,axisLinear:Wj,axisX:Uj,axisY:Gj},U(sH,Nj);const nH=()=>{hI.registerGraphicComponent(Mj.lineAxis,((t,e)=>new NC(t,e))),hI.registerGraphicComponent(wj.lineAxisGrid,((t,e)=>new JE(t,e))),Pj(),hI.registerComponent(sH.type,sH)},rH=`${OI}_hide_`;function aH(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const oH=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[rH]&&(aH(t,!0),t[rH]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=d(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[rH]=!0,aH(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=d(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},lH=()=>{hI.registerGrammarTransform("symbolOverlap",{transform:oH,runType:"afterEncode"})},hH={min:$,max:X,average:pO,sum:uO};function cH(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}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function dH(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 uH(t,e,i,s){return dH(t,e,i,"min",s)}function pH(t,e,i,s){return dH(t,e,i,"max",s)}function gH(t,e,i,s){return dH(t,e,i,"average",s)}function fH(t,e,i,s){return dH(t,e,i,"sum",s)}const mH=(t,e)=>{let i=c(t.size)?t.size():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=cH;if("min"===n?l=uH:"max"===n?l=pH:"average"===n?l=gH:"sum"===n&&(l=fH),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[]},vH=()=>{hI.registerGrammarTransform("dataSampling",{transform:mH})};class _H extends vz{constructor(){super(...arguments),this.type=AO.line,this.transformerConstructor=Uz,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.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(rz(null===(i=hI.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),az("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=mz(this);this._symbolMark.setAnimationConfig(rz(null===(s=hI.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),az("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),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]}}_H.type=AO.line,_H.mark=Dz,_H.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},_H.transformerConstructor=Uz,U(_H,Lz);class yH{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=G(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{YL(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof Ba)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];jy(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];jy(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class bH{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)=>{qy(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{aL(e,[{key:t,operations:eB(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&&aL(e,[{key:i.field,operations:eB(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?jO("colorOrdinal"):jO(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(qy(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),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(N(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;if(!N(r.specified,s.specified))return e.reMake=!0,e;s.range&&!N(s.range,n.range())&&(n.range(s.range),e.reRender=!0),qy(s.domain)?e.reRender=!0:N(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(!qy(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=eB(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=eB(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(d(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),d(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;eB(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(d(t.changeDomain)||"none"===t.changeDomain||d(t.seriesId))return void(eB(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=eB(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!E(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)));eB(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(d(t.field)||!d(t.changeDomain)&&"none"!==t.changeDomain&&!d(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class xH{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&t.addState(i,!0,l):a&&t.addState(s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&t.addState(i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{t.removeState(i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&t.removeState(e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}class SH extends xD{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){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=$y(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:II,height:LI},this._viewRect={width:II,height:LI},this._viewBox={x1:0,y1:0,x2:II,y2:LI},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)=>G(t).some((t=>u(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=KO(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new ML(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new yH(this._dataSet),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===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new xH;const t=this.getAllSeries(),e=[],i={};t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=`${n}-${t.type}`;i[r]?s.forEach((t=>{i[r].marks.push(t)})):(i[r]=Object.assign(Object.assign({},t),{marks:s}),e.push(i[r]))}))}})),e.forEach((t=>{const e=hI.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(rz({},az("stage",this._spec,{}),null))}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.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||u(t.gradient))return;const e=j(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=hI.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},e),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:gD.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(e,i){if(!e)return;const{spec:s}=i,n=t(i,["spec"]),r=new e(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(e,i){if(!e)return;const{spec:s}=i,n=t(i,["spec"]);let r;if(u(s.regionId)?r=this.getRegionsInUserId(s.regionId):u(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new e(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(v(t))return this.getAllModels().find((e=>e.userId===t));if(c(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){const s=hI.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"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(){var t,e,i,s;if(null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeLayoutWithSceneGraph)||void 0===e||e.call(t,this._option.globalInstance),this.getLayoutTag()){this._event.emit(CL.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const t=this.getLayoutElements();this._layoutFunc(this,t,this._layoutRect,this._viewBox),this._event.emit(CL.afterLayout,{elements:t,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(CL.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterLayoutWithSceneGraph)||void 0===s||s.call(i,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof kD)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 $D))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof $D)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}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){G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&YL(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=lD(this._spec,this._option,{width:II,height:LI})),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(_(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),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=BO(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new bH(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){hD(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=BO(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0};return Object.keys(t).filter((t=>!e[t])).sort()}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=this._getSpecKeys(this._spec);if(!N(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{hD(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[n.title]:!0,[n.brush]:!0,[n.indicator]:!0};this._components.forEach((s=>{var r,a;if(s.type===n.label||s.type===n.totalLabel)return;i[s.type]&&(i[s.type]=!1);const o=s.specKey||s.type,l=null!==(r=this._spec[o])&&void 0!==r?r:{};_(l)?(e[o]=e[o]||{specCount:l.length,componentCount:0},e[o].componentCount++,hD(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):hD(t,s.updateSpec(l))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}const s=t=>t&&!1!==t.visible;Object.keys(i).forEach((e=>{if(i[e]){const i=this._spec[e];(_(i)?i.some(s):s(i))&&(t.reMake=!0)}}))}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];hD(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(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:s=0,x2:n,y2:r}=t;e={width:n-i,height:r-s}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=XO(this._paddingSpec,e,e),this._layoutRect.width=e.width-this.padding.left-this.padding.right,this._layoutRect.height=e.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(CL.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),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(){this._backgroundMark&&this._backgroundMark.compile()}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._option.globalInstance),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,this._option.globalInstance)}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._option.globalInstance),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,this._option.globalInstance)}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._option.globalInstance),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,this._option.globalInstance)}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(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(E(t[s]))continue;const n=t[s];let r={stateValue:s};r=c(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(_D.STATE_SELECTED,t,e,i)}setHovered(t,e,i){this._setStateInDatum(_D.STATE_HOVER,t,e,i)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(_D.STATE_SELECTED)}clearHovered(){this.clearState(_D.STATE_HOVER)}_initEvent(){[CL.dataZoomChange,CL.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(wL.AFTER_MARK_RENDER_END,e)};this._event.on(wL.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?G(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:kL;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||c(e.filter)&&e.filter(o,l))){if(SL(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let r=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===Oz.dimensionHover||s===Oz.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(r=i)}}));const a=d(t)||!r||r.every((t=>sB(t.axis.getScale().type)&&d(t.index))),o=a||r.every((t=>sB(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(n.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};r.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(n.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(r))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(n.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(n.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),r=[];s.forEach((e=>{const i=t(e);!1!==i&&r.push({axis:e,value:i})})),i.showCrosshair(r)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const kH=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(u(n)){const t=G(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(u(r))return G(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(u)};class AH{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={}),u(t.stackInverse)&&t.region.forEach((e=>{!u(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),u(t.stackSort)&&t.region.forEach((e=>{!u(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):rI(t,a,c.spec),rI(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));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=kH(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=kH(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(u(n)){const t=G(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(u(r))return G(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(u)})(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,e,i){var s,n,r,a,o;const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,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},h=this.seriesType;return h&&(l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(hI.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(hI.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,r,a;const o=[],l=hI.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=hI.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=hI.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(r=d.getSpecInfo(t,i))||void 0===r||r.forEach((t=>{o.push(e(d,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):BF(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=BF(t,u.specKey,u.type))||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"];return i.find((i=>{if(!s.includes(i.orient))return!1;if(u(i.seriesId)){if(G(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(u(i.seriesIndex)){if(G(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;x(n)?(t.minBandSize=n,o=!0):x(r)?(t.minBandSize=r,o=!0):x(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:_(a)?a[a.length-1]:a})}}class MH extends AH{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_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;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{d(i[t])&&(i[t]=n[t])})),P(i,"trimPadding")&&lI(i,cD(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class wH extends MH{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),oD(t)}}const TH=(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&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=hL(t,!0);for(const e in o)for(const i in o[e].nodes)pL(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)uL(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&dL(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(CL.regionSeriesDataFilterOver,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class BH{_beforeInit(){this._dataSet&&LL(this._dataSet,"stackSplit",TH)}_initStack(){this._stack=new CH(this),this._stack.init()}}const EH={state:_D.STATE_DIMENSION_HOVER,reverseState:_D.STATE_DIMENSION_HOVER_REVERSE,trigger:Oz.dimensionHover};class PH extends gF{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},EH,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=kL(i);let n;return n=_(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}PH.type="dimension-hover",PH.defaultOptions=EH;const RH=()=>{hI.registerInteractionTrigger(PH.type,PH)},OH=()=>{hI.registerComposedEvent(Oz.dimensionHover,Rz),hI.registerComposedEvent(Oz.dimensionClick,wz)},IH=t=>t.fieldX[0],LH=t=>t.fieldY[0],DH=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},FH=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},zH=(t,e)=>t?e?IH:DH:e?LH:FH,jH=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=Pz(t,(t=>_z(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=Pz(t,(t=>yz(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{sB(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((t=>{if(d.size>0){if(d.has(t)){const s=HH(t,i,zH(e,sB(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=HH(t,i,zH(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},HH=(t,e,i)=>{const s=t.positionToData(e,!0);return d(s)?null:VH(t,s,i)},VH=(t,e,i)=>{const s=t.getScale();if(d(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=Bz(e,t,"cartesian",null!=i?i:_z(t.getOrient())?IH:LH);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},NH=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:p,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,_=0,y=null;if(d.size){const t=Array.from(d.values())[0];_=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,y=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(_)&&!Number.isNaN(_),x=s&&!b&&u(p),S=x?p:{coordRange:[0,0],sizeRange:[0,0],coord:_,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:y};let k;S&&(S._isCache=x);let A=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(sB(m.type))k=m.bandwidth(),0===k&&m.step&&(A=m.step());else if(eB(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(k=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):k=1,_=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=ej(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(a=y.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&y&&null!==(o=y.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(l=y.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&y&&null!==(h=y.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(c=y.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&y&&null!==(d=y.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(u=y.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&y&&null!==(p=y.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};UH(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=_+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=_+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&WH(S.labels[t],t,f.label)}))}t[n].bandSize=null!=k?k:0,t[n].offsetSize=A,t[n].cacheInfo=S})),t),WH=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=CF(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},UH=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},GH=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=YH(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},YH=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},XH=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return NH(c,r,e),c.xField.cacheInfo?GH(c.xField):c.yField.cacheInfo?GH(c.yField):void 0},$H=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],KH=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&$H.forEach((e=>{u(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(qH(s).every((t=>{var e;return!LF("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},qH=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{u(t.series)&&e.push(t.series)}))})),e},ZH={dom:`${OI}_TOOLTIP_HANDLER_DOM`,canvas:`${OI}_TOOLTIP_HANDLER_CANVAS`},JH={key:"其他",value:"..."};var QH;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(QH||(QH={}));class tV{constructor(t){this._showTooltipByHandler=(t,e)=>{var i,s,n;if(d(t))return 1;e.changePositionOnly||this.clearCache(),this._updateViewSpec(t,e);const r=this._cacheActiveSpec;if(d(r)||!1===r.visible)return 1;e.tooltipSpec=this.component.getSpec(),e.activeTooltipSpec=r;const{title:a,content:o}=r,l=d(null==a?void 0:a.key)&&d(null==a?void 0:a.value)&&!(null==o?void 0:o.length);if(this.component.event.emit(CL.tooltipShow,Object.assign(Object.assign({},e),{isEmptyTooltip:l,tooltipData:t,activeType:this.activeType,tooltip:this.component})),l)return 1;let h;return(null===(i=r.handler)||void 0===i?void 0:i.showTooltip)?h=r.handler.showTooltip.bind(r.handler):(null===(s=this.component.tooltipHandler)||void 0===s?void 0:s.showTooltip)&&(h=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),h?null!==(n=h(this.activeType,t,e))&&void 0!==n?n:0:1},this.component=t}_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}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:p,model:g}=e;if(!p||!this._cacheActiveSpec){const p=this.component.getSpec();if(this._cacheActiveSpec=KH(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){d(this._cacheActiveSpec.handler)&&u(p.handler)&&(this._cacheActiveSpec.handler=p.handler);const g=null!==(i=p[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},JH),t):JH;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!d(e)&&LF(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class eV extends tV{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)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],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(!sB(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(u(s))break}return u(s)&&s.getDimensionField()[0]===s.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}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const iV=()=>{hI.registerTooltipProcessor("dimension",eV)};class sV extends tV{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,Xo.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(kL(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const nV=()=>{hI.registerTooltipProcessor("mark",sV)};class rV extends tV{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:G(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?G(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return G(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=G(s)[0][a];return r.filter((t=>t[a]===o))}}const aV=()=>{hI.registerTooltipProcessor("group",rV)};class oV extends SH{constructor(){super(...arguments),this.transformerConstructor=wH,this.type="line",this.seriesType=AO.line}_setModelOption(){this._modelOption.getDimensionInfo=jH,this._modelOption.getDimensionInfoByValue=VH,this._modelOption.getRectByDimensionData=XH}}oV.type="line",oV.seriesType=AO.line,oV.transformerConstructor=wH,U(oV,BH);const lV=[...zz,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class hV extends jz{constructor(){super(...arguments),this.type=hV.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return lV}_getIgnoreAttributes(){return[]}}hV.type="area";const cV=()=>{hI.registerMark(hV.type,hV),qA(),EA(),WE(),zE(),dF(),hI.registerGraphicComponent("area",ef)};class dV extends jF{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of G(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")),u(e))return e}return i}}}const uV=Object.assign(Object.assign(Object.assign({},ZF),Iz),{area:{name:"area",type:"area"}}),pV=()=>{hI.registerAnimation("area",hF),cF(),oF()};class gV extends Uz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!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,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_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),p=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=u(l.zIndex)||u(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||p&&!d)&&(g=h,f=l),l.style=lI({},f.style,g.style),l.state=lI({},f.state,g.state),!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),t.area=l,t.line=h}}class fV extends vz{constructor(){super(...arguments),this.type=AO.area,this.transformerConstructor=gV,this._sortDataByAxis=!1}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(fV.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var t,e,i,s,n;const r=null!==(i=null===(e=null===(t=this.getSpec().area)||void 0===t?void 0:t.style)||void 0===e?void 0:e.curveType)&&void 0!==i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,a=r===kF?"horizontal"===this._direction?"monotoneY":"monotoneX":r,o=this._areaMark;if(o){const t=this._isAreaVisible(),e=this._isLineVisible();t||e?o.setVisible(!0):o.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return HO(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),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",mD.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return HO(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",mD.Series),this.setMarkStyle(o,{fill:!!t&&this.getColorAttribute(),stroke:!!e&&this.getColorAttribute()},"normal",mD.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",mD.Series),this.getStack()&&this.setMarkStyle(o,{zIndex:t=>-t[WI]},"normal",mD.Series),this.setMarkStyle(o,{curveType:a},"normal",mD.Built_In),Object.keys(o.stateStyle).forEach((t=>{o.stateStyle[t].stroke&&o.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(rz(null===(e=hI.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),az("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(rz(null===(i=hI.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),az("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=mz(this);this._symbolMark.setAnimationConfig(rz(null===(s=hI.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),az("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new dV(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.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(){super.onLayoutEnd(),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&&_(l)?l[0]:l}}}fV.type=AO.area,fV.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},fV.mark=uV,fV.transformerConstructor=gV,U(fV,Lz);class mV extends MH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),oD(t)}}class vV extends SH{constructor(){super(...arguments),this.transformerConstructor=mV,this.type="area",this.seriesType=AO.area}_setModelOption(){this._modelOption.getDimensionInfo=jH,this._modelOption.getDimensionInfoByValue=VH,this._modelOption.getRectByDimensionData=XH}}vV.type="area",vV.seriesType=AO.area,vV.transformerConstructor=mV,U(vV,BH);function _V(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 yV=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:_V(t,e)}),bV=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:_V(t,e)}),xV={type:"fadeIn"},SV={type:"growCenterIn"};function kV(t,e){if(!1===e)return{};switch(e){case"fadeIn":return xV;case"scaleIn":return SV;default:return yV(t)}}class AV extends $D{constructor(){super(...arguments),this.type=AV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}AV.type="rect";const MV=()=>{qA(),YA(),LE("rect",HE),hI.registerMark(AV.type,AV),uT.registerBuiltInAnimate("growHeightIn",oC),uT.registerBuiltInAnimate("growHeightOut",lC),uT.registerBuiltInAnimate("growWidthIn",AC),uT.registerBuiltInAnimate("growWidthOut",MC),uT.registerBuiltInAnimate("growCenterIn",nC),uT.registerBuiltInAnimate("growCenterOut",rC),hI.registerGraphicComponent("rect",Ig)},wV=Object.assign(Object.assign({},ZF),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function TV(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;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=ZO(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[JF]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):HO(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[QF]):HO(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=HO(this._dataToPosX(t),e,i),n=HO(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[tz]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):HO(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[ez]):HO(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=HO(this._dataToPosY(t),e,i),n=HO(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},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(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},EV.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:hz(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(EV.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",mD.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===n.cartesianBandAxis));let r;if(LL(this._option.dataSet,"addVChartProperty",RF),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=d(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};LL(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();r=new Ba(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:XF.bind(this),call:$F}},!1),null==e||e.target.addListener("change",r.reRunAllTransform)}this._barBackgroundViewData=new WD(this._option,r)}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=ez,s=tz,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=QF,s=JF,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=hL(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)TV(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=HO(this[r](t),l,i),u=HO(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!VO(t[this.getStackValueField()],l)?p=0:pthis._getBarXStart(t,n),x1:t=>this._getBarXEnd(t,n),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",mD.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",mD.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.setMarkConfig({clip:!0,clipPath:()=>{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[NI],n=t[WI],r=t[UI],h=t[GI];i=Math.min(i,e,n),s=Math.max(s,e,n),u(r)&&u(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]),{[NI]:i,[WI]:s}),a?{[UI]:o,[GI]:l}:void 0),d="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)};t.push(Ig(Object.assign(Object.assign({},d),{cornerRadius:c(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(d,h,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),t}})}initLinearRectMarkStyle(){var t,e,i,s;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);if("horizontal"===this.direction){const t=u(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,r,!0)[0],y1:t=>this._getLinearBarYRange(t,r,!0)[1]}:{y:t=>HO(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,r,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,n,!0),x1:t=>this._getBarXEnd(t,n,!0)},t),"normal",mD.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(n),x1:()=>this._getBarBackgroundXEnd(n)},t),"normal",mD.Series)}else{const t=u(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,n,!0)[0],x1:t=>this._getLinearBarXRange(t,n,!0)[1]}:{x:t=>HO(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,n,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},t),{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r)}),"normal",mD.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},t),{y:()=>this._getBarBackgroundYStart(r),y1:()=>this._getBarBackgroundYEnd(r)}),"normal",mD.Series)}}_initBandBarBackgroundMarkStyle(){var t,e,i,s,n;if(!this._barBackgroundMark)return;const r=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),a=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),o=null!==(n=this._spec.barBackground)&&void 0!==n?n:{},l=d(o.fieldLevel)?void 0:o.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r),y:t=>this._getPosition(this.direction,t,l,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,l),width:()=>{},y1:()=>{}},"normal",mD.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,l,"barBackground"),y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a),width:()=>this._getBarWidth(this._xAxisHelper,l),x1:()=>{},height:()=>{}},"normal",mD.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=$(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=mz(this);this._barMark.setAnimationConfig(rz(null===(e=hI.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),az(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=d(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=u(this._spec.barWidth)&&r===n,l=u(this._spec.barMinWidth),h=u(this._spec.barMaxWidth);let c=a;return o&&(c=ZO(this._spec.barWidth,a)),l&&(c=Math.max(c,ZO(this._spec.barMinWidth,a))),h&&(c=Math.min(c,ZO(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,p;"horizontal"===t?(h=this.getYAxisHelper(),c="height",p="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",p="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=d(i)?f:Math.min(f,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,m-1))&&void 0!==r?r:6,_=m===f?this._barMark.getAttribute(c,e):v;if(m>1&&u(this._spec.barGapInGroup)){const t=this._groups.fields,i=G(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=ZO(null!==(l=i[r-1])&&void 0!==l?l:Y(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=eB(g.type||"band");return p(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(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}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}}EV.type=AO.bar,EV.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},EV.mark=wV,EV.transformerConstructor=BV;const PV=()=>{vH(),MV(),hI.registerAnimation("bar",((t,e)=>({appear:kV(t,e),enter:yV(t,!1),exit:bV(t,!1),disappear:{duration:nF.disappear.duration}}))),Jj(),$j(),hI.registerSeries(EV.type,EV)};class RV extends MH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),oD(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=p(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 OV extends SH{constructor(){super(...arguments),this.transformerConstructor=RV,this.type="bar",this.seriesType=AO.bar}_setModelOption(){this._modelOption.getDimensionInfo=jH,this._modelOption.getDimensionInfoByValue=VH,this._modelOption.getRectByDimensionData=XH}}OV.type="bar",OV.seriesType=AO.bar,OV.transformerConstructor=RV,U(OV,BH);const IV=[10,20],LV=QC.Linear,DV="circle",FV=QC.Ordinal,zV=["circle","square","triangle","diamond","star"],jV=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},HV=Object.assign(Object.assign({},ZF),{point:{name:"point",type:"symbol"}});class VV extends pz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class NV extends vz{constructor(){super(...arguments),this.type=AO.scatter,this.transformerConstructor=VV,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(c(e))return e;if(_(e)){if(d(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=`${OI}_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(p(e)){if(d(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${OI}_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 d(e)?10:x(e)?e:v(e)&&S(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:LV,defaultRange:IV},"size")}getShapeAttribute(t,e){return d(e)?DV:v(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:FV,defaultRange:zV},"shape")}initMark(){this._symbolMark=this._createMark(NV.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:hz(this._spec,NV.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=mz(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(rz(null===(i=hI.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),az("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const t=this._symbolMark;t&&("zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:x(this._size)||c(this._size)?this._size:10,symbolType:v(this._shape)||c(this._shape)?this._shape:DV},_D.STATE_NORMAL,mD.Series),(u(this._sizeField)||u(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},_D.STATE_NORMAL,mD.User_Mark),(u(this._shapeField)||u(this._shape))&&this.setMarkStyle(t,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},_D.STATE_NORMAL,mD.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t);const e=[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||e?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",mD.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",mD.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},_D.STATE_NORMAL,mD.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},_D.STATE_NORMAL,mD.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{if(!t)return;const e=t.getGraphics();e&&e.length&&e.forEach(((t,e)=>{var i,s;const n=null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],r=this.dataToPosition(n);r&&t&&t.translateTo(r.x,r.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){this.handleZoom(t)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}NV.type=AO.scatter,NV.mark=HV,NV.builtInTheme={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"}}}}},NV.transformerConstructor=VV;const WV=()=>{Wz(),hI.registerAnimation("scatter",((t,e)=>Object.assign({appear:jV(0,e)},rF))),Jj(),$j(),hI.registerSeries(NV.type,NV)};class UV extends MH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class GV extends SH{constructor(){super(...arguments),this.transformerConstructor=UV,this.type="scatter",this.seriesType=AO.scatter}_setModelOption(){this._modelOption.getDimensionInfo=jH,this._modelOption.getDimensionInfoByValue=VH,this._modelOption.getRectByDimensionData=XH}}GV.type="scatter",GV.seriesType=AO.scatter,GV.transformerConstructor=UV,U(GV,BH);const YV=()=>{iV(),nV(),OH(),RH(),WV(),hI.registerChart(GV.type,GV)};class XV extends gz{constructor(){super(...arguments),this.type=AO.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 d(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(d(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return d(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=`${OI}_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 $V=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[FI]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[rL]=e.nameMap[n]:t[rL]=n})),t.features);class KV extends jF{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 qV extends $D{constructor(){super(...arguments),this.type=qV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}qV.type="path";const ZV=()=>{hI.registerMark(qV.type,qV),qA(),NA(),hI.registerGraphicComponent("path",Jg)},JV=Object.assign(Object.assign({},ZF),{area:{name:"area",type:"path"}});class QV{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Oa(i,e):Pa[i]?(Ea[i]||(Ea[i]=Oa(i,Pa[i])),Ea[i]):null}(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 tN{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(){}}class eN{constructor(){this._lastScale=0}clearZoom(){this._lastScale=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 iN(t){return t===s["desktop-browser"]||t===s["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:tN}:Gy(t)||Yy(t)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:eN}:null}const sN={debounce:bt,throttle:xt};class nN{constructor(){this._isGestureListener=!1}initZoomable(t,e=s["desktop-browser"]){this._eventObj=t,this._renderMode=e,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=Gy(this._renderMode)||Yy(this._renderMode),iN(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return iN(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(d(r))return;if(!Se({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{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(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:EL.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:EL.chart,consume:!1}];l.on(...c,sN[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,sN[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||iN(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||iN(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 d(r)&&d(a)?s:Se({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:EL.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:EL.chart,consume:!1}];l.on(...c,sN[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,sN[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){iN(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||iN(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(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:EL.chart},(t=>{if(!t.event)return;const{event:n}=t;Se({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:EL.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||iN(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:EL.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||iN(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:EL.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:EL.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:EL.chart,source:BL.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:EL.chart,source:BL.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=sN[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=sN[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:EL.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:EL.chart,source:BL.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:EL.chart,source:BL.chart},this._handleDragMouseUp)}))}}function rN(t,e){return`${OI}_${e}_${t}`}class aN extends Aj{constructor(){super(...arguments),this.type=n.geoCoordinate,this.name=n.geoCoordinate,this.layoutType="none",this.layoutZIndex=gD.Mark,this._projectionSpec={name:rN(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;const l=u(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,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,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):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,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(d(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:n.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=lI(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var t,e,i;this.event.on(CL.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:s}=this._spec;if(s){let n=!0,r=!0,a=!1;!0!==s&&(n=null===(t=s.zoom)||void 0===t||t,r=null===(e=s.drag)||void 0===e||e,a=null!==(i=s.blank)&&void 0!==i&&i),n&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!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 QV(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===AO.map||e.type===AO.pictogram?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(d(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(d(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(d(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(d(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(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),_O(this._regions,(t=>{var e;if(t.type===AO.map||t.type===AO.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ne})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==AO.map&&e.type!==AO.pictogram||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[rL],s=t.getDatumCenter(e);i&&u(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!N(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}aN.type=n.geoCoordinate,U(aN,nN);const oN=()=>{hI.registerComponent(aN.type,aN)};class lN extends pz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class hN extends XV{constructor(){super(...arguments),this.type=AO.map,this.transformerConstructor=lN,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 !`),FL.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),LL(this._dataSet,"copyDataView",WL),LL(this._dataSet,"map",$V),LL(this._dataSet,"lookup",EF);const i=FL.get(this.map);i||null===(t=this._option)||void 0===t||t.onError("no valid map data found!");const s=new Ba(this._dataSet,{name:`map_${this.id}_data`});s.parse([i],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:XL.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:rL,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 WD(this._option,s)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(hN.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:hz(this._spec,hN.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>{var e,i,s,n;return u(t[null!==(e=this._seriesField)&&void 0!==e?e:jI])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:jI]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",mD.Series),t.setPostProcess("fill",(t=>u(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(t,{smoothScale:!0},"normal",mD.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(rz(null===(t=hI.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),az("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new KV(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[FI]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[FI],{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;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ne}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ne}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}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 FI}getActiveMarks(){return[this._pathMark]}}hN.type=AO.map,hN.mark=JV,hN.builtInTheme={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"}}}}},hN.transformerConstructor=lN;const cN=`${OI}_waterfall_default_seriesField`,dN=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n,calculationMode:r}=e,a=[],{dimensionValues:o,dimensionData:l}=n().latestData;let h=Array.from(o[i]);"decrease"===r&&(h=h.reverse());let c={start:0,end:0,positive:0,negative:0,lastIndex:null};return h.forEach(((t,i)=>{const n={start:c.end,end:c.end,lastIndex:c.lastIndex,lastEnd:c.end,index:t,isTotal:!1,positive:c.end,negative:c.end},r=!0===e.stackInverse?l[t].reverse():l[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[qI]=!0:delete t[qI]})),r.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===h.length-1)return!0;return!1};if(r.some((t=>o(t))))return c=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,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=uN([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 f=g[0];let{start:m,end:v}=pN(f,i,s,n,u);i.start=m,i.end=v;let _=m,y=m,b=v-m;const x=p.reduce(((t,e)=>ie(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=ee(_,e)):(t[c]=+y,y=ee(y,e)),t[d]=ee(t[c],e),m=ee(m,e),b=ie(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,n,a,c,h,i,e,o),void a.push(n)}c=uN(r,t,n,a,c,h,i,e),a.push(n)})),a};function uN(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:u,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(u&&"end"!==u.type){if("field"===u.type||"custom"===u.type){if(t[u.tagField]){e=!0;const{start:r,end:a}=pN(t,i,s,n,u);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=ee(i.positive,e)):(t[h]=+i.negative,i.negative=ee(i.negative,e)),t[c]=ee(t[h],e),i.end=ee(i.end,e)}i.isTotal=e,(d(p)||p===cN)&&(t[cN]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function pN(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&&!d(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?jy("total.collectCountField error"):n=e[a].start;o<0?jy("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!d(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!d(t[i.valueField])&&(n=ee(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 gN=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>ee(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?t.unshift(o):t.push(o),t},fN={type:"fadeIn"},mN={type:"growCenterIn"};function vN(t,e){switch(e){case"fadeIn":return fN;case"scaleIn":return mN;default:return yV(t,!1)}}class _N extends $D{constructor(){super(...arguments),this.type=_N.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(e,i,s){const n=super._transformGraphicAttributes(e,i,s),{x:r,x1:a,y:o,y1:l}=n,h=t(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return Eg(t)}}_N.type="rule";const yN=()=>{hI.registerMark(_N.type,_N),qA(),HA(),hI.registerGraphicComponent("line",Eg)},bN=Object.assign(Object.assign({},wV),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),xN=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:SN(t.map((t=>t.latestData)).flat(),e.fields,i)}};function SN(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)=>SN(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class kN{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 Ba(e instanceof Ca?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),LL(e,"dimensionTree",xN),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 AN extends BV{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const MN={rect:PN,symbol:BN,arc:ON,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=BN(t);h(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:IN,line:LN,area:LN,rect3d:PN,arc3d:ON,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function wN(t,e){var i;const{labelSpec:s}=e;s.overlap&&!p(s.overlap)&&(s.overlap={});const n=null!==(i=MN[t])&&void 0!==i?i:MN.point;return e.series.type===AO.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=CN(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;v(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!v(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:DN(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function TN(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==AO.sankey){const{formatFunc:t,args:n}=CF(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function CN(t){return c(t)?e=>t(e.data):t}function BN(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=CN(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:EN(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function EN(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function PN(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=CN(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;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:RN(o)};let g=!1;return v(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function RN(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 ON(t){var e;const{labelSpec:i}=t,s=null!==(e=CN(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:v(s)&&s.includes("inside"),{position:n,smartInvert:r}}function IN(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=TN(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),Ag(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 LN(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}))):[{index:0,[jI]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function DN(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class FN extends EV{constructor(){super(...arguments),this.type=AO.waterfall,this.transformerConstructor=AN,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&dL(t,e)}}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 kN(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]],d(this._seriesField)&&(this._seriesField=cN)}getSeriesKeys(){return this._seriesField===cN?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t,e,i;super.initData(),LL(this._dataSet,"waterfallFillTotal",gN),LL(this._dataSet,"waterfall",dN),(d(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,calculationMode:null!==(e=this._spec.calculationMode)&&void 0!==e?e:"increase",stackInverse:this.getRegion().getStackInverse()}},!1));const s=UL(this.getViewData(),this._dataSet,{name:`${OI}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",s.reRunAllTransform),this._totalData=new WD(this._option,s),s.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:NI,endAs:WI,total:this._spec.total,calculationMode:null!==(i=this._spec.calculationMode)&&void 0!==i?i:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}},!1),s.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}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=mz(this);this._barMark.setAnimationConfig(rz(null===(i=hI.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),az("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(rz(null===(s=hI.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),az("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(){super.initMark();const t=this._createMark(FN.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:ie(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:ie(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return IN(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?HO(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):HO(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle();const t="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:e=>e.lastIndex?this.totalPositionY(e,"lastIndex",t?0:1):0,y1:e=>this.totalPositionY(e,"index",t?1:0)},"normal",mD.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:e=>e.lastIndex?this.totalPositionX(e,"lastIndex",t?0:1):0,x1:e=>this.totalPositionX(e,"index",t?1:0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",mD.Series))}isVisibleLeaderLine(t){return!d(t.lastIndex)&&VO([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}FN.type=AO.waterfall,FN.mark=bN,FN.builtInTheme={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}}}},FN.transformerConstructor=AN;const zN=()=>{yN(),MV(),hI.registerAnimation("waterfall",((t,e)=>({appear:vN(t,e),enter:yV(t,!1),exit:bV(t,!1),disappear:{duration:nF.disappear.duration}}))),lF(),Jj(),$j(),hI.registerSeries(FN.type,FN)},jN=`${OI}_BOX_PLOT_OUTLIER_VALUE`;var HN;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(HN||(HN={}));const VN=(t,e)=>{const i=[],{outliersField:s,dimensionField:n,seriesField:r}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];_(e)||(e=[e]),i.push(...e.map((e=>{const i={[jN]:e};return n.forEach((e=>{i[e]=t[e]})),u(r)&&(i[r]=t[r]),i})))})),i};class NN extends jF{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===HN.OUTLIER)return this.series.getOutliersField();if(t===HN.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case HN.MIN:return this.series.getMinField();case HN.MAX:return this.series.getMaxField();case HN.MEDIAN:return this.series.getMedianField();case HN.Q1:return this.series.getQ1Field();case HN.Q3:return this.series.getQ3Field();case HN.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===HN.OUTLIER)return e[jN];if(t===HN.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case HN.MIN:return e[this.series.getMinField()];case HN.MAX:return e[this.series.getMaxField()];case HN.MEDIAN:return e[this.series.getMedianField()];case HN.Q1:return e[this.series.getQ1Field()];case HN.Q3:return e[this.series.getQ3Field()];case HN.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,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>u(t[jN])}getDefaultContentList(t){return[{key:this.getContentKey(HN.OUTLIER),value:this.getContentValue(HN.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(HN.MAX),value:this.getContentValue(HN.MAX)},{key:this.getContentKey(HN.Q3),value:this.getContentValue(HN.Q3)},{key:this.getContentKey(HN.MEDIAN),value:this.getContentValue(HN.MEDIAN)},{key:this.getContentKey(HN.Q1),value:this.getContentValue(HN.Q1)},{key:this.getContentKey(HN.MIN),value:this.getContentValue(HN.MIN)},{key:this.getContentKey(HN.SERIES_FIELD),value:this.getContentValue(HN.SERIES_FIELD)}]}}class WN extends $D{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==vD.enter&&t.context.diffState!==vD.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;return this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?z(r,i):i}})),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=Dg(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=hI.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const UN=()=>{hI.registerGraphicComponent("glyph",Dg),qA(),IA()},GN=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],YN=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class XN extends WN{constructor(){super(...arguments),this.type=XN.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=GN,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=YN,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}XN.type="boxPlot";const $N=Object.assign(Object.assign({},ZF),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),KN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},qN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},ZN=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),JN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,M;if(i&&k(i.center))return i.center;let w,T,C,B,E;if("horizontal"===e){w=null===(r=null===(n=(null===(s=ZN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,T=null===(h=null===(l=null===(o=null===(a=ZN(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,C=null===(p=null===(u=null===(d=null===(c=ZN(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=ZN(t,"box").attribute.width,i=ZN(t,"box").attribute.x;B=i,E=i+e}else{w=null===(m=null===(f=(null===(g=ZN(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,T=null===(b=null===(y=null===(_=null===(v=ZN(t,"max"))||void 0===v?void 0:v.attribute)||void 0===_?void 0:_.points)||void 0===y?void 0:y[0])||void 0===b?void 0:b.y,C=null===(M=null===(A=null===(S=null===(x=ZN(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===M?void 0:M.y;const e=ZN(t,"box").attribute.height,i=ZN(t,"box").attribute.y;B=i,E=i+e}return k(w)?w:k(B)&&k(E)?(B+E)/2:k(T)&&k(C)?(T+C)/2:k(C)?C:k(T)?T:NaN},QN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,_,y,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=ZN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=ZN(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=ZN(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;y=i,_=i+e;const c=(null===(l=ZN(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=ZN(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=ZN(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=ZN(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=ZN(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;y=i,_=i+e;const s=(null===(f=ZN(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=ZN(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(_)&&k(y)?(_+y)/2:k(y)?y:k(_)?_:NaN};class tW extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return KN(JN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class eW extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return qN(JN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class iW extends tW{computeAttribute(){return KN(QN)(this.target,this.params,this.params.options)}}class sW extends eW{computeAttribute(){return qN(QN)(this.target,this.params,this.params.options)}}class nW extends pz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}class rW extends vz{constructor(){super(...arguments),this.type=AO.boxPlot,this.transformerConstructor=nW,this._bandPosition=0}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,r,a;super.setAttrFromSpec();const o=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=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(rW.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(rW.mark.outlier,{key:FI,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var t,e,i,s,n,r;const a=this._boxPlotMark;if(a){const i={lineWidth:this._lineWidth,fill:null!==(t=this._boxFillColor)&&void 0!==t?t:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(e=this._strokeColor)&&void 0!==e?e:"line"!==this._shaftShape?"#000":this.getColorAttribute()};a.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const s="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return ZO(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return ZO(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return ZO(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return ZO(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return ZO(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return ZO(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return ZO(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return ZO(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(a,i,_D.STATE_NORMAL,mD.Series),this.setMarkStyle(a,s,_D.STATE_NORMAL,mD.Built_In)}const o=this._outlierMark;o&&this.setMarkStyle(o,{fill:null!==(n=null!==(s=null===(i=this._outliersStyle)||void 0===i?void 0:i.fill)&&void 0!==s?s:this._boxFillColor)&&void 0!==n?n:this.getColorAttribute(),stroke:this.getColorAttribute(),size:x(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10},_D.STATE_NORMAL,mD.Series)}initBoxPlotMarkStyle(){var t,e;const i=this._boxPlotMark,s="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(i&&s){const{dataToPosition:e}=s,n=null===(t=null==s?void 0:s.getScale)||void 0===t?void 0:t.call(s,0);this.setMarkStyle(i,{min:t=>HO(e(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>HO(e(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>HO(e(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>HO(e(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>HO(e(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},_D.STATE_NORMAL,mD.Series)}const n=this._outlierMark;if(n&&s){const{dataToPosition:t}=s,i=null===(e=null==s?void 0:s.getScale)||void 0===e?void 0:e.call(s,0),r="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),x:e=>HO(t(this.getDatumPositionValues(e,jN),{bandPosition:this._bandPosition}),i)}:{x:t=>this._getPosition(this.direction,t),y:e=>HO(t(this.getDatumPositionValues(e,jN),{bandPosition:this._bandPosition}),i)};this.setMarkStyle(n,r,_D.STATE_NORMAL,mD.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;LL(this._dataSet,"foldOutlierData",VN),LL(this._dataSet,"addVChartProperty",RF);const t=new Ba(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${OI}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField}}),t.transform({type:"addVChartProperty",options:{beforeCall:XF.bind(this),call:$F}},!1),this._outlierData=new WD(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t;if(this._autoBoxWidth)return this._autoBoxWidth;const e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,i=this._groups?this._groups.fields.length:1,s=null===(t=e.getBandwidth)||void 0===t?void 0:t.call(e,i-1);let n=s;return u(this._spec.boxWidth)&&(n=ZO(this._spec.boxWidth,s)),u(this._spec.boxMinWidth)&&(n=Math.max(n,ZO(this._spec.boxMinWidth,s))),u(this._spec.boxMaxWidth)&&(n=Math.min(n,ZO(this._spec.boxMaxWidth,s))),this._autoBoxWidth=n,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r;let a,o,l;"horizontal"===t?(a=this.getYAxisHelper(),o="boxHeight",l=this.dataToPositionY.bind(this)):(a=this.getXAxisHelper(),o="boxWidth",l=this.dataToPositionX.bind(this));const h=a.getScale(0),c=this._groups?this._groups.fields.length:1,d=null===(i=a.getBandwidth)||void 0===i?void 0:i.call(a,c-1),p=this._boxPlotMark.getAttribute(o,e);if(c>1&&u(this._spec.boxGapInGroup)){const t=this._groups.fields,i=G(this._spec.boxGapInGroup);let o=0,l=0;for(let h=t.length-1;h>=1;h--){const c=t[h],u=null!==(n=null===(s=a.getScale(h))||void 0===s?void 0:s.domain())&&void 0!==n?n:[],g=u.length,f=ZO(null!==(r=i[h-1])&&void 0!==r?r:Y(i),d),m=u.indexOf(e[c]);h===t.length-1?(o+=g*p+(g-1)*f,l+=m*(p+f)):(l+=m*(o+f),o+=o+(g-1)*f)}return h.scale(e[t[0]])+a.getBandwidth(0)/2-o/2+l+p/2}const g=eB(h.type||"band");return l(e)+.5*d+(g?-d/2:0)}onLayoutEnd(){super.onLayoutEnd(),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="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=mz(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=hI.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(az("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(rz(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(rz(null===(a=hI.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new NN(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}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}rW.type=AO.boxPlot,rW.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},rW.mark=$N,rW.transformerConstructor=nW;const aW=()=>{UN(),HA(),YA(),hI.registerGraphicComponent("line",(t=>Eg(t))),hI.registerGraphicComponent("rect",(t=>Ig(t))),hI.registerMark(XN.type,XN),Wz(),oF(),Jj(),$j(),uT.registerBuiltInAnimate("boxplotScaleIn",tW),uT.registerBuiltInAnimate("boxplotScaleOut",eW),uT.registerBuiltInAnimate("barBoxplotScaleIn",iW),uT.registerBuiltInAnimate("barBoxplotScaleOut",sW),hI.registerSeries(rW.type,rW)};class oW extends $D{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=oW.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return p(n)&&u(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?Kg(t):Ag(t)}}oW.type="text";const lW=()=>{hI.registerMark(oW.type,oW),qA(),tM(),$A(),hI.registerGraphicComponent("text",Ag),hI.registerGraphicComponent("richtext",Kg)};class hW extends jF{constructor(){super(...arguments),this._getMeasureData=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]]}}const cW=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),dW={type:"fadeIn"},uW=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function pW(t,e){return"fadeIn"===e?dW:cW(t)}const gW=Object.assign(Object.assign({},wV),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class fW extends BV{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 mW extends EV{constructor(){super(...arguments),this.type=AO.rangeColumn,this._barMarkType="rect",this._barName=AO.bar,this.transformerConstructor=fW}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(mW.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:hz(this._spec,mW.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(mW.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(mW.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(t,e,i,s){var n,r,a,o;if(t){this.setMarkStyle(t,{fill:null!==(r=null===(n=null==e?void 0:e.style)||void 0===n?void 0:n.fill)&&void 0!==r?r:this.getColorAttribute(),text:t=>{const s="horizontal"===this._spec.direction?t[this._spec.xField[i]]:t[this._spec.yField[i]];return(null==e?void 0:e.formatMethod)?e.formatMethod(s,t):s}});!function(t,e,i,s,n,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if("vertical"===l())return"center";const e=n(t),s=r(t);if("middle"===i)return"center";if(e>=s){if("start"===i)return"left";if("end"===i)return"right";if("outside"===i)return"left"}else{if("start"===i)return"right";if("end"===i)return"left";if("outside"===i)return"right"}return"center"},textBaseline:t=>{if("horizontal"===l())return"middle";const e=a(t),s=o(t);if("middle"===i)return"middle";if(s>=e){if("start"===i)return"bottom";if("end"===i)return"top";if("outside"===i)return"bottom"}else{if("start"===i)return"top";if("end"===i)return"bottom";if("outside"===i)return"top"}return"middle"}}),t.setMarkStyle(e,{x:t=>{const e=l(),a=n(t),o=r(t);if("vertical"===e)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+s;if("end"===i)return a-s;if("outside"===i)return a+s}else{if("start"===i)return o-s;if("end"===i)return a+s;if("outside"===i)return a-s}return(a+o)/2},y:t=>{const e=l(),n=a(t),r=o(t);if("horizontal"===e)return(n+r)/2;if("middle"===i)return(n+r)/2;if(n>=r){if("start"===i)return r+s;if("end"===i)return n-s;if("outside"===i)return n+s}else{if("start"===i)return r-s;if("end"===i)return n+s;if("outside"===i)return n-s}return(n+r)/2}},"normal",mD.Series)}(this,t,null!==(a=null==e?void 0:e.position)&&void 0!==a?a:s,null!==(o=null==e?void 0:e.offset)&&void 0!==o?o:"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=mz(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(rz(null===(i=hI.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),az("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(rz(null===(s=hI.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),az("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(rz(null===(n=hI.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),az("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new hW(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)}}mW.type=AO.rangeColumn,mW.mark=gW,mW.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},mW.transformerConstructor=fW;const vW=()=>{MV(),lW(),hI.registerAnimation("rangeColumn",((t,e)=>({appear:pW(t,e),enter:cW(t),exit:uW(t),disappear:{duration:nF.disappear.duration}}))),lF(),Jj(),$j(),hI.registerSeries(mW.type,mW)};var _W,yW;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(_W||(_W={})),function(t){t.middle="middle",t.start="start",t.end="end"}(yW||(yW={}));class bW extends jF{constructor(){super(...arguments),this._getMeasureData=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]]}}const xW=Object.assign({},uV);class SW extends fV{constructor(){super(...arguments),this.type=AO.rangeArea}initMark(){this._areaMark=this._createMark(SW.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const t=this._areaMark;t&&(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",mD.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",mD.Series),this.setMarkStyle(t,{stroke:!1},"normal",mD.Series))}initTooltip(){this._tooltipHelper=new bW(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}SW.type=AO.rangeArea,SW.mark=xW;class kW extends gz{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=_j,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=u(t)?G(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=u(t)?G(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=G(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(d(t)||d(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(G(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(G(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}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:[]};eB(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:[]};eB(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),u(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),u(this._spec.radius)&&(this._outerRadius=this._spec.radius),u(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),u(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(CL.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)&&fz(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}}function AW(t){return Ky(t)?Number.parseFloat(t):0}const MW=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&wW(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=pe(e+a/2)};let _=0,y=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let k=p,A=S,M=0;const w=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))}(x);if(m.forEach(((t,e)=>{const i=t[lj],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=A/M;k=p,m.forEach((e=>{const i=e[r]===f?f:e[lj]*t;v(e,k,i),k+=i}))}if(0!==_&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},wW=(t,e,i)=>!!d(t)||(0===t.length||(!!t.every((t=>0===AW(t[e])))||!i&&0===t.reduce(((t,i)=>t+AW(i[e])),0)));function TW(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const CW=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:TW(t,!0,$L.appear)}),BW={type:"fadeIn"},EW=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:TW(t,!0,$L.enter)}),PW=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:TW(t,!0,$L.exit)});function RW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return BW;case"growRadius":return CW(Object.assign(Object.assign({},t),{growField:"radius"}));default:return CW(Object.assign(Object.assign({},t),{growField:"angle"}))}}class OW extends $D{constructor(t,e){super(t,e),this.type=IW.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>le({x:0,y:0},this.getAttribute("centerOffset",e,i),e[pj])[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 IW extends OW{constructor(){super(...arguments),this.type=IW.type}}IW.type="arc";const LW=()=>{qA(),CA(),LE("arc",YE),uT.registerBuiltInAnimate("growRadiusIn",xC),uT.registerBuiltInAnimate("growRadiusOut",SC),uT.registerBuiltInAnimate("growAngleIn",iC),uT.registerBuiltInAnimate("growAngleOut",sC),hI.registerGraphicComponent("arc",rf),hI.registerMark(IW.type,IW)},DW=Object.assign(Object.assign({},ZF),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class FW extends pz{_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=lI({},this._theme,i,t);const n=(t,e)=>lI({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);_(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 u(s)&&(i.centerX=s),u(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const zW=`${OI}_LABEL_VISIBLE`;class jW extends kW{constructor(){super(...arguments),this.transformerConstructor=FW,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:YO(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:YO(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=mj,this._endAngle=vj,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[pj];if(d(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return le(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;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 a=function(t,e){let i=0,s=2*Math.PI;const n=u(t),r=u(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}}(u(this._spec.startAngle)?re(this._spec.startAngle):this._startAngle,u(this._spec.endAngle)?re(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=u(this._spec.padAngle)?re(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=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;LL(this._dataSet,"pie",MW),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>u(this._spec.minAngle)?re(this._spec.minAngle):0,asStartAngle:cj,asEndAngle:dj,asRatio:hj,asMiddleAngle:pj,asRadian:fj,asQuadrant:gj,asK:uj,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new Ba(this._dataSet,{name:`${OI}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new WD(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},jW.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:zI,groupKey:this._seriesField,isSeriesMark:!0},{morph:hz(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return xO(cj)(t)}endAngleScale(t){return xO(dj)(t)}_computeLayoutRadius(){return yj((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const t={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:NO(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:NO(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},e=this._pieMark;e&&this.setMarkStyle(e,t,"normal",mD.Series);const i=this._emptyArcMark;i&&this.setMarkStyle(i,Object.assign(Object.assign({},t),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",mD.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(t,e){if(super.initMarkStyleWithSpec(t,e),t.name===this._pieMarkName){const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,mD.User_Mark)}"emptyCircle"===t.name&&this.setMarkStyle(t,this.generateRadiusStyle(e.style),"normal",mD.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:xO(zW).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(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(CL.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*(d(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[pj];if(d(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return le(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===$L.appear)return this._startAngle;if(i===$L.disappear)return this._endAngle;const r=[$L.disappear,$L.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[FI];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[FI]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[FI])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[FI])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+le({x:0,y:0},a,e[pj]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+le({x:0,y:0},a,e[pj]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+le({x:0,y:0},a,e[pj]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+le({x:0,y:0},a,e[pj]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=rz(null===(i=hI.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}jW.transformerConstructor=FW,jW.mark=DW,jW.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class HW extends jW{constructor(){super(...arguments),this.type=AO.pie}}HW.type=AO.pie;const VW=()=>{LW(),hI.registerAnimation("pie",((t,e)=>({appear:RW(t,e),enter:EW(t),exit:PW(t),disappear:{duration:nF.disappear.duration}}))),hI.registerAnimation("emptyCircle",((t,e)=>({appear:RW(t,e)}))),hI.registerSeries(HW.type,HW)};function NW(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const WW=t=>({type:NW(t.growField),options:{overall:!0}}),UW={type:"fadeIn"},GW=t=>({type:NW(t.growField)}),YW=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function XW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return UW;case"growAngle":return WW(Object.assign(Object.assign({},t),{growField:"angle"}));default:return WW(Object.assign(Object.assign({},t),{growField:"radius"}))}}class $W extends kW{getStackGroupFields(){return this._angleField}getStackValueField(){return G(this._spec.valueField)[0]||G(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(WI),this.setInnerRadiusField(NI)}setValueFieldToPercent(){this.setRadiusField(GI),this.setInnerRadiusField(UI)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const KW=Object.assign(Object.assign({},ZF),{rose:{name:"rose",type:"arc"}});class qW extends pz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class ZW extends Ej{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=_(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let r,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:p,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((t,e)=>{var i,s,r,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${n.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,p=null!==(r=t.endAngle)&&void 0!==r?r:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=p?p:u(d)?d+360:270,center:u(e.center)?e.center:u(null==e?void 0:e.centerX)||u(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.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=p,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const _={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(_),"radius"===i.orient?(o.push(_),a=h):(l.push(_),r=h)})),o.forEach((t=>{t.angleAxisIndex=r})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]),r=hI.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(t,e){super(t,e),this.type=n.polarAxis,this.name=n.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=gD.Axis,this._tick=void 0,this._center=null,this._startAngle=mj,this._endAngle=vj,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),_O(this._regions,(t=>{"radius"===this.getOrient()?aj(t.radiusAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):aj(t.angleAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(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.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:YO(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:YO(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this._specVisible&&(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=re(this._spec.startAngle),this._endAngle=re(this._spec.endAngle),this._inverse=this._spec.inverse}_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:ej(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}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(){_O(this._regions,(t=>{"radius"===this.getOrient()?aj(t.radiusAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):aj(t.angleAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(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 eB(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:eB(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 le(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return he(t,this.getCenter(),this._startAngle,this._endAngle)}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=>rj(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_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=ne.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",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(u(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return yj((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=_j,e=0;const i=this.getChart().getSpec();return _O(this.getRegions(),(s=>{const n=s;if(r=n.type,[AO.rose,AO.radar,AO.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(e){const{grid:i}=e,s=t(e,["grid"]);if(this._axisMark.getComponent().setAttributes(lI({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(lI({},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)}}ZW.type=n.polarAxis,ZW.specKey="axes";const JW={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},QW={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class tU extends ZW{constructor(){super(...arguments),this.type=n.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new GB}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}registerTicksTransform(){const t=`${this.type}-ticks`;return LL(this._option.dataSet,t,tE),t}}tU.type=n.polarLinearAxis,tU.specKey="axes",tU.builtInTheme={axis:Yj,axisLinear:Wj,axisAngle:QW,axisRadius:JW},U(tU,Nj);const eU=()=>{hI.registerGraphicComponent(Mj.lineAxis,((t,e)=>new NC(t,e))),hI.registerGraphicComponent(wj.lineAxisGrid,((t,e)=>new JE(t,e))),hI.registerGraphicComponent(Mj.circleAxis,((t,e)=>new $C(t,e))),hI.registerGraphicComponent(wj.circleAxisGrid,((t,e)=>new sP(t,e))),Pj(),hI.registerComponent(tU.type,tU)};class iU extends ZW{constructor(){super(...arguments),this.type=n.polarBandAxis,this._scale=new AB}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)}registerTicksTransform(){const t=`${this.type}-ticks`;return LL(this._option.dataSet,t,lE),t}transformScaleDomain(){}}iU.type=n.polarBandAxis,iU.specKey="axes",iU.builtInTheme={axis:Yj,axisBand:qj,axisAngle:QW,axisRadius:JW},U(iU,Kj);const sU=()=>{hI.registerGraphicComponent(Mj.lineAxis,((t,e)=>new NC(t,e))),hI.registerGraphicComponent(wj.lineAxisGrid,((t,e)=>new JE(t,e))),hI.registerGraphicComponent(Mj.circleAxis,((t,e)=>new $C(t,e))),hI.registerGraphicComponent(wj.circleAxisGrid,((t,e)=>new sP(t,e))),Pj(),hI.registerComponent(iU.type,iU)};class nU extends $W{constructor(){super(...arguments),this.type=AO.rose,this.transformerConstructor=qW,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(){this._roseMark=this._createMark(nU.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:hz(this._spec,nU.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}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=>HO(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=HO(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(rz(null===(i=hI.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),az("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}nU.type=AO.rose,nU.mark=KW,nU.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},nU.transformerConstructor=qW;const rU=()=>{hI.registerSeries(nU.type,nU),LW(),hI.registerAnimation("rose",((t,e)=>({appear:XW(t,e),enter:GW(t),exit:YW(t),disappear:{duration:nF.disappear.duration}}))),sU(),eU()};class aU extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:le(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=he(this.from,this._prevCenter),{angle:i,radius:s}=he(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,hO(this._fromAngle,this._toAngle)&&hO(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=le({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class oU extends XT{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!vO(t)&&!vO(e))return e;const s=he(t,this._prevCenter),n=he(e,this._center);let r=de(s.angle),a=de(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return le({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new se(s,n,r,a);return o.defined=e.defined,o}}const lU=t=>({type:"in"===t?"fadeIn":"fadeOut"});function hU(t,e,i){return"fadeIn"===e?lU(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function cU(t,e,i){return"fadeIn"===e?lU(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 dU=(t,e)=>({custom:GT,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),uU=Object.assign(Object.assign(Object.assign({},ZF),Iz),{area:{name:"area",type:"area"}});class pU extends $W{constructor(){super(...arguments),this.type=AO.radar,this.transformerConstructor=Uz,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!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),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(pU.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const t=this._areaMark;t&&(this.setMarkStyle(t,{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:AF,closePath:!0},"normal",mD.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",mD.Series),this.event.on(CL.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.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:u(this._spec.startAngle)?re(this._spec.startAngle):mj},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(rz(null===(s=hI.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),az("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(u(t)){const i=hI.getAnimationInKey(e);t.setAnimationConfig(rz(null==i?void 0:i(n,r),az(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&&_(a)?a[0]:a}}}pU.type=AO.radar,pU.mark=uU,pU.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},pU.transformerConstructor=Uz,U(pU,Lz);const gU=()=>{hI.registerSeries(pU.type,pU),cV(),Vz(),Wz(),hI.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:hU(t,e,"in"),enter:hU(t,e,"in"),exit:hU(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:nF.disappear.duration},update:[{channel:["points","center"],custom:oU,customParameters:t,duration:nF.update.duration,easing:nF.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),hI.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:cU(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:nF.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:aU,customParameters:t,duration:nF.update.duration,easing:nF.update.easing}]}))),hI.registerAnimation("radarGroup",((t,e)=>({appear:dU(t,"in"),disappear:{duration:nF.disappear.duration}}))),CA(),sU(),eU()};class fU extends jF{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>gi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const mU=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(OI)||(i[n]=t[n],s=u(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[FI]:r,[zI]:`${s}_${e}`})),r++}))})),n},vU={fill:"#bbb",fillOpacity:.2},_U=Object.assign(Object.assign({},ZF),{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"}});class yU extends vz{constructor(){super(...arguments),this.type=AO.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){u(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){u(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){u(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){u(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){u(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){u(t)&&(this._gridBackground=t)}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),LL(this._option.dataSet,"objFlat",mU),LL(this._option.dataSet,"copyDataView",WL),DL(this._option.dataSet,"dataview",Ma),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:XL.dotObjFlat},!1)}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(lI(vU,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(yU.mark.group),this._containerMark=this._createMark(yU.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(yU.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(yU.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(yU.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(yU.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(yU.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(yU.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var t;const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-(null!==(t=this._spec.leftAppendPadding)&&void 0!==t?t:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",mD.Series),e.setMarkConfig({interactive:!1,clip:!0}));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",mD.Series),i.setMarkConfig({interactive:!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",mD.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",mD.Series);const r=this._dotMark;r&&this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",mD.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",mD.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",mD.Series);const l=this._symbolMark;l&&this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",mD.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(){var t,e;super.onLayoutEnd();const i=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.leftAppendPadding)&&void 0!==e?e:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+i},"normal",mD.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:jI}}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 FO).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:jI}}initTooltip(){this._tooltipHelper=new fU(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}yU.type=AO.dot,yU.mark=_U,yU.builtInTheme={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"}}}}};class bU extends jF{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>gi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const xU=Object.assign(Object.assign({},ZF),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),SU=(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 kU extends vz{constructor(){super(...arguments),this.type=AO.link}getFromField(){return this._fromField}setFromField(t){u(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){u(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){u(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){u(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(),LL(this._option.dataSet,"linkDotInfo",SU),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:XL.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(kU.mark.group),this._containerMark=this._createMark(kU.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(kU.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(kU.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var t,e,i,s;const n=this._clipMark;n&&(this.setMarkStyle(n,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",mD.Series),n.setMarkConfig({interactive:!1,clip:!0}));const r=this._containerMark;r&&(this.setMarkStyle(r,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",mD.Series),r.setMarkConfig({interactive:!1}));const a=this._linkMark;a&&this.setMarkStyle(a,{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",mD.Series);const o=this._arrowMark;if(o){const n=null!==(s=null===(i=null===(e=null===(t=this._theme)||void 0===t?void 0:t.arrow)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size)&&void 0!==s?s:10;this.setMarkStyle(o,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,n),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:n,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",mD.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:jI}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new bU(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}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]}}kU.type=AO.link,kU.mark=xU,kU.builtInTheme={link:{arrow:{style:{size:10}}}};const AU=Object.assign(Object.assign({},ZF),{group:{name:"group",type:"group"}});class MU extends kW{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()?NI:iL],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=re(i.offsetAngle);let o;if(u(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 d(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()?WI:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=re(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=u(n)?re(n):mj;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=u(r)?re(r):vj,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)||u(null==s?void 0:s.startAngle)||u(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=HO(this.angleAxisHelper.dataToPosition([t[NI]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=HO(this.angleAxisHelper.dataToPosition([t[WI]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?HO(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(MU.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const t=this._arcGroupMark;t.created(),this.setMarkStyle(t,{x:0,y:0},"normal",mD.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+re(a),o=re(r)/2;return rf(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[Ig({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_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 BU=()=>{hI.registerAnimation("circularProgress",((t,e)=>({appear:CU(t,e),enter:{type:"growAngleIn"},disappear:{duration:nF.disappear.duration}})))};class EU extends pz{constructor(){super(...arguments),this._supportStack=!0}}class PU extends MU{constructor(){super(...arguments),this.type=AO.circularProgress,this.transformerConstructor=EU,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(){return this._progressMark=this._createMark(PU.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:hz(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var t;const e=this._progressMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",mD.Series)}getInteractionTriggers(){const t=[];return 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(){return this._trackMark=this._createMark(PU.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&this.setMarkStyle(t,{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()?NI:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?WI: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",mD.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(rz(null===(i=hI.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),az("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(rz(null===(s=hI.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),az("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}PU.type=AO.circularProgress,PU.mark=wU,PU.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},PU.transformerConstructor=EU;const RU=()=>{hI.registerSeries(PU.type,PU),LW(),BU(),lF(),sU(),eU()};function OU(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const IU={type:"fadeIn"};function LU(t,e="grow"){return!1===e?{}:"fadeIn"===e?IU:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:OU(t)}))(t)}class DU extends jF{enableByType(t){return"dimension"!==t}}const FU=Object.assign(Object.assign({},ZF),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class zU extends vz{constructor(){super(...arguments),this.type=AO.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=u(e.width)?e.width:e.x1-e.x,o=u(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(zU.mark.progress,{isSeriesMark:!0}),d(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var t,e,i,s;const n=this._progressMark;if(n)if("vertical"===this._spec.direction){const i=this._spec.progress||{},s=null!==(t=i.leftPadding)&&void 0!==t?t:0,r=null!==(e=i.rightPadding)&&void 0!==e?e:0;this.setMarkStyle(n,{x:t=>{var e,i;return HO(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),!0)-this._spec.bandWidth/2+s},y1:t=>{var e,i;return HO(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))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?HO(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-s-r,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",mD.Series)}else{const t=this._spec.progress||{},e=null!==(i=t.topPadding)&&void 0!==i?i:0,r=null!==(s=t.bottomPadding)&&void 0!==s?s:0;this.setMarkStyle(n,{x1:t=>{var e,i;return HO(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))},y:t=>{var i,s;return HO(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),!0)-this._spec.bandWidth/2+e},height:this._spec.bandWidth-e-r,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?HO(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",mD.Series)}}_initTrackMark(){return this._trackMark=this._createMark(zU.mark.track),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>{var e,i;return HO(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),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",mD.Series):this.setMarkStyle(t,{x:0,y:t=>{var e,i;return HO(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),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",mD.Series))}getInteractionTriggers(){const t=[];return 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(rz(null===(i=hI.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),az("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(rz(null===(s=hI.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),az("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new DU(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}zU.type=AO.linearProgress,zU.mark=FU,zU.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const jU=()=>{MV(),hI.registerAnimation("linearProgress",((t,e)=>({appear:LU(t,e),enter:LU(t),disappear:{duration:nF.disappear.duration}}))),lF(),hI.registerSeries(zU.type,zU)},HU=[0],VU=[20,40],NU=[200,500],WU={shrink:!1,enlarge:!1,fontSizeLimitMin:0},UU=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class GU{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const YU=`${OI}_WORD_CLOUD_TEXT`,XU=Object.assign(Object.assign({},ZF),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),$U={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic",scaleX:1,scaleY:1}}};class KU extends gz{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},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._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){u(t)&&(this._valueField=t)}setFontSizeRange(t){u(t)?this._fontSizeRange=t:this._fontSizeRange=VU}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,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:NU,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:HU,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?YU:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:WU},this._spec.wordCloudConfig),r&&!d(r.layoutMode)||Uy(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:HU,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!UU.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new GU(1e3))}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",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var t;this._wordMark=this._createMark(KU.mark.word,{key:zI,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(t=this._spec.wordMask)||void 0===t?void 0:t.visible)&&(this._maskMark=this._createMark(KU.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:gD.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",mD.Series)}initMarkStyleOfWord(t,e,i,s,n){var r,a;t&&(this.setMarkStyle(t,{text:(null==e?void 0:e.formatMethod)?t=>e.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",mD.Series),this.setMarkStyle(t,{fill:null!==(a=null===(r=null==e?void 0:e.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",mD.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(rz(hI.getAnimationInKey("wordCloud")(n,s),az("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 FO).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:jI])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new GB).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new GB).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[FI])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var t,e,i,s,n;const{width:r,height:a}=this._region.getLayoutRect(),o=null!==(t=this._spec.word)&&void 0!==t?t:{},l=null!==(e=o.style)&&void 0!==e?e:{};return{size:[r,a],shape:p(this._maskShape)&&"text"===this._maskShape.type&&d(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const t=()=>{var e,i,s,n;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((e=>e.fn!==t)),null===(i=(e=this._option).dispatchEvent)||void 0===i||i.call(e,CL.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(n=null===(s=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===s?void 0:s.afterWordcloudShapeDraw)||void 0===n||n.call(s,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:t})},dataIndexKey:zI,text:o.formatMethod?t=>o.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(s=null===(i=this._spec.word)||void 0===i?void 0:i.padding)&&void 0!==s?s:1,fontFamily:u(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(n=l.fontFamily)&&void 0!==n?n:this._defaultFontFamily,fontWeight:u(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:u(l.fontWeight)?l.fontWeight:u(this._valueField)?this._calculateFontWeight:"normal",fontStyle:u(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:l.fontStyle,createCanvas:S_.createCanvas.bind(S_),getTextBounds:gf}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,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,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:Ng,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:u(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:u(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:u(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}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(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}KU.mark=XU,KU.builtInTheme={wordCloud:$U};function qU(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||nF.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,u;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(u=t.children)||void 0===u?void 0:u.length){p.children=[],p.isLeaf=!1;const e=ZU(t.children,p.children,i+1,l,p,r,a);p.value=d(t[a])?e.sum:Math.max(e.sum,At(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=At(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},JU=(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=JU(t.children,e,t,n))})),s},QU=(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=QU(t.children,e,t,n)),n=e(t,s,i,n)})),n},tG=(t,e=[],i)=>{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):tG(t.children,e,i)))})),e};function eG(t,e){let i,s;if(nG(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function nG(t,e){for(let i=0;i1e-6?(T+Math.sqrt(T*T-4*w*C))/(2*w):C/T);return{x:s+S+k*B,y:n+A+M*B,radius:B}}function lG(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 hG(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 cG(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 dG(t){return{_:t,next:null,prev:null}}function uG(t,e){const i=(t=G(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];lG(n,s,r);let a,o,l,h,c,d,u,p=dG(s),g=dG(n),f=dG(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:_(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,this._valueField=null!==(e=null==t?void 0:t.valueField)&&void 0!==e?e:"value"}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=ZU(t,n,0,-1,null,this._getNodeKey,this._valueField);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%wt)/wt}(),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:d,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=c(l)?this.options.nodeKey:mG.defaultOpionts.nodeSort;JU([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)JU([o],pG(h)),QU([o],gG(this._getPadding,.5,a)),JU([o],fG(1,this._maxDepth));else{const t=Math.min(s.width,s.height);JU([o],pG(mG.defaultOpionts.setRadius)),QU([o],gG(Pt,1,a)),d&&QU([o],gG(this._getPadding,o.radius/t,a)),JU([o],fG(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}mG.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const vG=t=>{let e=0;return t.forEach(((t,i)=>{var s;d(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=vG(t.children):t.value=0),e+=Math.abs(t.value)})),e};function _G(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){vG(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=d(t.value)?0:At(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=j(t,["parents"]);if(a.parents=t.parents.map((t=>j(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=At(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function yG(t){return t.depth}function bG(t,e){return e-1-t.endDepth}const xG=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),SG=(t,e)=>{if(d(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(d(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},kG={left:yG,right:bG,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:yG,end:bG},AG=_t(0,1);class MG{constructor(t){this._ascendingSourceBreadth=(t,e)=>xG(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>xG(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},MG.defaultOptions,t);const e=this.options.nodeKey,i=c(e)?e:e?Bt(e):null;this._getNodeKey=i,this._logger=rt.getInstance(),this._alignFunc=c(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):kG[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)};"vertical"===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<=0)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!d(t.source)&&!d(t.target))),t.targetLinks=t.targetLinks.filter((t=>!d(t.source)&&!d(t.target)))})),r=r.filter((t=>!d(t.source)&&!d(t.target))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;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}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return 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){return _G(t,this._getNodeKey)}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=!d(r.source),l=!d(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&&d(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=[SG(s[t.source]),SG(s[t.target],!0)].filter((t=>!d(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){return function(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=At(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=At(e.value))&&void 0!==i?i:0)}),0))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=c(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}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(v(e)){const t=mt(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(x(e)){if(r=e,x(i))a=i;else if(d(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else c(e)&&x(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,u=null;if(c(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)u=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=x(this.options.nodeHeight)?t=>this.options.nodeHeight:c(this.options.nodeHeight)?this.options.nodeHeight:u>0?t=>u:t=>Math.max(t.value*l,0),m=x(this.options.linkHeight)?()=>this.options.linkHeight:c(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*AG(t.value/e.value):0,n,0),o);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;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,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)}d(this.options.nodeSortBy)&&n.sort(xG),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(xG),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{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];wG(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),TG);const s=_(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,h(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},CG.defaultOpionts,t):Object.assign({},CG.defaultOpionts);const e=this.options.nodeKey,i=c(e)?e:e?Bt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Et(this.options.center[0],t.width),s=t.y0+Et(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=_(r),l=o?r.map((t=>Et(t,n))):Et(r,n),h=_(a),c=this.options.gapRadius,u=h?a.map((t=>Et(t,n))):Et(a,n),p=J(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return d(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=u[i])&&void 0!==s?s:n:id(u[e])?n:u[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(_(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=Et(r,n),i=(u-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-(_(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=ZU(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=le({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)}}}function BG(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(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,f,m,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,_=Math.max(v/x,x/m),_>y){f-=h;break}y=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{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*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:wG,slice:BG,sliceDice:function(t,e,i,s,n){(t.depth%2==1?BG:wG)(t,e,i,s,n)}};class RG{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=_(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=_(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=_(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=_(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({},RG.defaultOpionts,t);const i=this.options.nodeKey,s=c(i)?i:i?Bt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?EG(this.options.aspectRatio):null!==(e=PG[this.options.splitType])&&void 0!==e?e:PG.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=ZU(t,n,0,-1,null,this._getNodeKey,this.options.valueField);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(x(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(x(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)}))}}function OG(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+li?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return rt.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=OG(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=wi(o.map(wi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rMt(e)));u=Pi(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=IG(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&rt.getInstance().error("Area "+r+" not represented on screen")}return i}function VG(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Bi((function(i){return-1*NG({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},UG=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=G(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!E(G(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:G(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||DG,s=e.lossFunction||LG,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=G(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];hi(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rne.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:WG(f),arcs:f})}))},GG={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:YG,triangle:YG,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.955)%(2*Math.PI/5)-2*Math.PI/10>=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 YG(){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 XG(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*.4),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"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const $G=t=>GG[t]?GG[t]():GG.circle(),KG=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function qG(t){return c(t)?t:function(){return t}}class ZG{constructor(t){var e,i;switch(this.options=z({},ZG.defaultOptions,t),c(this.options.shape)?this.shape=this.options.shape:this.shape=$G(this.options.shape),this.getText=null!==(e=qG(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=qG(this.options.fontWeight),this.getTextFontSize=qG(this.options.fontSize),this.getTextFontStyle=qG(this.options.fontStyle),this.getTextFontFamily=qG(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>KG(10,50);break;case"random-light":this.getTextColor=()=>KG(50,90);break;default:this.getTextColor=qG(this.options.color)}if(d(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=c(this.options.rotate)?t=>{var e;return re(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=G(this.options.rotate),s=this.options.random?Math.random():Mt(e);return re(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+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:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1: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&&!d(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 QG extends ZG{constructor(t){var e;super(z({},QG.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<=QG.defaultOptions.minFontSize&&(this.options.minFontSize=QG.defaultOptions.minFontSize),this.spiral=v(this.options.spiral)?null!==(e=JG[this.options.spiral])&&void 0!==e?e:JG.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=qG(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}=XG(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,f,m;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,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,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._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=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(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=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}));if(this.originalData=s,this.data=s,this.progressiveRun(),!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._originSize[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],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});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 f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);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*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(sY(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(iY(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}sY(p,this._size)&&(p=nY(p,this._size))}else if(sY(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||eY(p,i))&&(!i||!tY(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 tY(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 eY(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,sY=(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 nY(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{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const p=n.measureText(h),g="normal"!==o?1.1:1,f=u(p.actualBoundingBoxRight)&&u(p.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(p.actualBoundingBoxRight)+Math.abs(p.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(p.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},aY=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>le(t,e,i+r*n)))},oY=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},lY=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=XG(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=$G("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return le(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)oY(n,aY({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)oY(n,aY({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)oY(n,aY({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)oY(n,aY({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)oY(n,aY({x:l,y:h},o,0,3));else if("star"===t.shape){const t=aY({x:l,y:h},o,-Math.PI/2,5),e=aY({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);oY(n,i)}else n.fillRect(0,0,i,s)}; /*! * wordcloud2.js * http://timdream.org/wordcloud2.js/ @@ -20,4 +20,4 @@ function t(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s * Copyright 2011 - 2019 Tim Guan-tin Chien and contributors. * Released under the MIT license */ -let eY=class t extends WG{constructor(e){super(z({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{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,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize: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=this.options.createCanvas({width:1,height:1}),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 f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),_=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*Math.abs(Math.sin(h)))/this.gridSize),k=S*this.gridSize,A=x*this.gridSize;d.setAttribute("width",""+k),d.setAttribute("height",""+A),u.scale(1,1),u.translate(k/2,A/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,k,A).data;if(this.exceedTime())return null;const w=[];let T,C=S;const B=[x/2,S/2,x/2,S/2],E=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*k+(t*this.gridSize+n))+3])return i.push([t,e]),tB[1]&&(B[1]=t),eB[2]&&(B[2]=e))}};for(;C--;)for(T=x;T--;)E(C,T,w);return{datum:t,occupied:w,bounds:B,gw:S,gh:x,fillTextOffsetX:y,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=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,e=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),q(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){this.grid=[];const e=this.options.shape;if(p(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?ZG(t,o,l.width,l.height,h):"geometric"===t.type&&tY(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!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)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,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}=jG(this.options.shape,[e.width,e.height]);return 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),this.result=[],this.progressiveRun()}};eY.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class iY extends WG{constructor(t){super(z({},iY.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,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)}iY.defaultOptions={enlarge:!1};const nY={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},rY=(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?aY(t.fontFamily):"sans-serif",d=t.fontStyle?aY(t.fontStyle):"normal",u=t.fontWeight?aY(t.fontWeight):"normal",p=t.rotate?aY(t.rotate):0,g=aY(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?aY(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,S=t.minFontSize,k=t.randomVisible,A=t.as?Object.assign(Object.assign({},nY),t.as):nY,M=t.depth_3d,w=t.postProjection;let T=t.fontSize?aY(t.fontSize):14;const C=t.fontSizeRange;if(C&&!x(T)){const t=T,e=lY(hY(t,l),C);T=i=>e(t(i))}let B=GG;"fast"===t.layoutType?B=iY:"grid"===t.layoutType&&(B=eY);const E=new B(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:T,shrink:_,clip:b,enlarge:y,minFontSize:S,random:k,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:E}:E.output()},aY=t=>v(t)||x(t)||c(t)||_(t)?t:e=>e[t.field],oY=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),lY=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=oY(t[0]),n=oY(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(oY(t)-r)/(a-r)*(e[1]-e[0])+e[0]},hY=(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 cY(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{eI.registerGrammarTransform("wordcloud",{transform:rY}),tW(),eI.registerAnimation("wordCloud",((t,e)=>({appear:NU(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:qD.disappear.duration}}))),eI.registerSeries(dY.type,dY)},pY=(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:f=!1,isCone:m=!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===f?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?m?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},gY=(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},fY=`${MI}_FUNNEL_TRANSFORM_RATIO`,mY=`${MI}_FUNNEL_REACH_RATIO`,vY=`${MI}_FUNNEL_HEIGHT_RATIO`,_Y=`${MI}_FUNNEL_VALUE_RATIO`,yY=`${MI}_FUNNEL_LAST_VALUE_RATIO`,bY=`${MI}_FUNNEL_NEXT_VALUE_RATIO`,xY=`${MI}_FUNNEL_LAST_VALUE`,SY=`${MI}_FUNNEL_CURRENT_VALUE`,kY=`${MI}_FUNNEL_NEXT_VALUE`,AY=`${MI}_FUNNEL_TRANSFORM_LEVEL`;class MY extends PF{constructor(t){var e,i;super(t),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)?this._transformRatioText: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[mY])).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 this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return u(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class wY extends HD{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class TY extends wY{constructor(){super(...arguments),this.type=TY.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}TY.type="polygon";const CY=()=>{eI.registerMark(TY.type,TY),qA(),UA(),uT.registerBuiltInAnimate("growPointsOut",uC),eI.registerGraphicComponent("polygon",lf)},BY=Object.assign(Object.assign({},WF),{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"}});class EY extends rz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class PY extends az{constructor(){super(...arguments),this.type=mO.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=EY,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,i,s,n;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._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;TL(this._dataSet,"funnel",pY),TL(this._dataSet,"funnelTransform",gY);const t=new Ba(this._dataSet,{name:`${MI}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new LD(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}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:SY,asTransformRatio:fY,asReachRatio:mY,asHeightRatio:vY,asValueRatio:_Y,asNextValueRatio:bY,asLastValueRatio:yY,asLastValue:xY,asNextValue:kY,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:AY}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},PY.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:ez(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},PY.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),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(PY.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(PY.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new MY(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(){var t,e,i,s;const n=this._funnelMark;n&&this.setMarkStyle(n,{points:t=>this.getPoints(t),visible:t=>u(t[this._valueField]),fill:this.getColorAttribute()},"normal",lD.Series);const r=this._funnelTransformMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t)},"normal",lD.Series);const a=this._funnelOuterLabelMark.label;a&&(this.setMarkStyle(a,{text:t=>`${t[this.getCategoryField()]}`,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),width:0,height:0},"normal",lD.Series),c(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(a,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",lD.User_Mark));const o=this._funnelOuterLabelMark.line;if(o&&a){this.setMarkStyle(o,{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",lD.Series);const n=null!==(i=null===(e=null===(t=this._spec.outerLabel)||void 0===t?void 0:t.line)||void 0===e?void 0:e.visible)&&void 0!==i?i:null===(s=this._spec.outerLabel)||void 0===s?void 0:s.visible;u(n)&&o.setVisible(n)}}initLabelMarkStyle(t){var e;if(!t)return;const i=t.getTarget(),s=t.getComponent();if(i===this._funnelMark){this._labelMark=t,this.setMarkStyle(t,{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",lD.Series);const i=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&Fy(i,this._funnelOuterLabelMark.label,s),this._funnelOuterLabelMark.line&&Fy(i,this._funnelOuterLabelMark.line,null!==(e=this._funnelOuterLabelMark.label)&&void 0!==e?e:s)}else this._funnelTransformMark&&i===this._funnelTransformMark&&(this._transformLabelMark=t,this.setMarkStyle(t,{text:t=>`${(100*pO(mY).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",lD.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(ZF(null===(s=eI.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.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),JF("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(ZF(eI.getAnimationInKey("fadeInOut")(),JF(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(ZF(eI.getAnimationInKey("funnel")({},o),JF(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(ZF(null===(a=eI.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),JF("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[yY])/2:this._getSecondaryAxisLength(t[_Y])/2,n=this._getSecondaryAxisLength(t[_Y])/2):(s=this._getSecondaryAxisLength(t[_Y])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[bY])/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[AY])}_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 u(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[EI]===t[EI]));if(!u(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(x(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,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,_,y;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h: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!==f.alignLabel?(null==u?void 0:u.y2)+e:_-e,m=this._getPolygonCenter(i).x,_-y{CY(),tW(),dN(),eI.registerSeries(PY.type,PY),eI.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},JD))),eI.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:YT,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),tF()},OY=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},IY=t=>{const e=t.filter((t=>t.context.diffState===hD.update)),i=$(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},LY=(t,e,i)=>{if(E(t))return[e,i];const s=$(t.map((t=>1*t.getFinalAttribute().startAngle))),n=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},DY=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=IY(i.parent.children),a=LY(r,s,n);return OY(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=IY(i.parent.children),a=LY(r,s,n);return OY(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),FY=t=>{const e=$(t.map((t=>1*t.getFinalAttribute().startAngle))),i=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},zY=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=IY(i.parent.children),a=FY(r);return OY(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=IY(i.parent.children),a=FY(r);return OY(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),jY=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},HY=(t,e={})=>{if(!t)return[];const i=[];return YU(t,i,e),i},VY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new bG(i).layout(t,{width:s,height:n})};class NY extends PF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var WY;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(WY||(WY={}));const UY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(d(n))return t;if(i.type===WY.DrillDown){return G(oL(t,n,s,"children"))}if(i.type===WY.DrillUp){const e=lL(t,n,s,"children");if(e)return G(e)}return t};class GY{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=$V(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(n.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;TL(t,"drillFilter",UY),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(d(t.datum)||d(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(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!_(t)||E(t))return t;const s=t[t.length-1];return this._drillInfo={key:s,path:t,type:WY.DrillDown},e().reRunAllTransform(),i.emit(bL.drill,{value:{path:t,type:WY.DrillDown},model:this}),t}drillUp(){var t,e;const{getRawData:i,event:s}=this._drillParams,n=null!==(e=null===(t=this._drillInfo)||void 0===t?void 0:t.path)&&void 0!==e?e:[];if(!_(n)||E(n))return n;const r=n.pop();return this._drillInfo={key:r,path:n,type:WY.DrillUp},i().reRunAllTransform(),s.emit(bL.drill,{value:{path:n,type:WY.DrillUp},model:this}),n}}const YY=Object.assign(Object.assign({},WF),{sunburst:{name:"sunburst",type:"arc"}}),XY=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:DF,operations:["max","min","values"]}),t.push({key:FF,operations:["values"]}),t),$Y={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,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"}}}};class KY extends fW{constructor(){super(...arguments),this.type=mO.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:FF),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:EI},getRawData:()=>this.getRawData()}),this._startAngle=re(this._spec.startAngle),this._endAngle=re(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),TL(this._dataSet,"sunburstLayout",VY),TL(this._dataSet,"flatten",HY),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:[u(this._centerX)?this._centerX:this.getLayoutRect().width/2,u(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 XY(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();d(null==t?void 0:t.dataSet)||(TL(t.dataSet,"addVChartProperty",AF),t.transform({type:"addVChartProperty",options:{beforeCall:VF.bind(this),call:NF}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(KY.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_initArcMarkStyle(){d(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(u(this._offsetX)?this._offsetX:0),y:t=>t.y+(u(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},cD.STATE_NORMAL,lD.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(KY.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){d(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return p(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)+(u(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(u(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},cD.STATE_NORMAL,lD.Series)}initTooltip(){this._tooltipHelper=new NY(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(G(this.__innerRadius))[0],outerRadius:this._computeRadius(G(this.__outerRadius))[0],startAngle:G(this._startAngle)[0],endAngle:G(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(ZF(null===(e=eI.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),JF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(ZF(null===(e=eI.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),JF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_computeRadius(t){return _(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]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}KY.type=mO.sunburst,KY.mark=YY,KY.builtInTheme={sunburst:$Y},U(KY,GY);const qY=()=>{eI.registerSeries(KY.type,KY),TW(),tW(),tF(),eI.registerAnimation("sunburst",((t,e)=>({appear:jY(0,e),enter:DY(t),exit:zY(t),disappear:{duration:qD.disappear.duration}})))},ZY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new lG(i).layout(t,{width:s,height:n})};class JY extends PF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const QY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},tX=Object.assign(Object.assign({},WF),{circlePacking:{name:"circlePacking",type:"arc"}});class eX extends hz{constructor(){super(...arguments),this.type=mO.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:FF),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:EI},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();d(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),TL(this._dataSet,"circlePackingLayout",ZY),TL(this._dataSet,"flatten",HY),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();d(null==t?void 0:t.dataSet)||(TL(t.dataSet,"addVChartProperty",AF),t.transform({type:"addVChartProperty",options:{beforeCall:VF.bind(this),call:NF}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(eX.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_initCirclePackingMarkStyle(){d(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},cD.STATE_NORMAL,lD.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(eX.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){d(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},cD.STATE_NORMAL,lD.Series)}getStatisticFields(){return XY(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new JY(this),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(ZF(null===(i=eI.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),JF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(ZF(null===(e=eI.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),JF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}eX.type=mO.circlePacking,eX.mark=tX,eX.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,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"}}}}},U(eX,GY);const iX=()=>{eI.registerSeries(eX.type,eX),TW(),tW(),QD(),eI.registerAnimation("circlePacking",((t,e)=>({appear:QY(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:qD.disappear.duration}})))},sX=(t,e,i)=>{e.forEach((e=>{d(e[i])||t.add(e[i]),e.children&&e.children.length>0&&sX(t,e.children,i)}))},nX=t=>{var e;if(!t||!_(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},rX=(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 vG(e),r=[];return r.push(n.layout(s,i)),r},aX=t=>{var e,i;return t&&_(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:[]},oX=t=>{var e,i;return t&&_(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 lX extends PF{constructor(){super(...arguments),this._getDimensionData=t=>{if(t.source){if(x(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},this.markTooltipValueCallback=t=>t.value}}const hX=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),cX=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:hX(t),dX=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class uX extends kT{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class pX extends kT{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const gX=(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,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=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}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},fX=(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,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=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}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class mX extends LN{constructor(){super(...arguments),this.type=mX.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?fX:gX,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}mX.type="linkPath";const vX=Object.assign(Object.assign({},WF),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class _X extends rz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const yX=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&t.removeState(e),t.addState(e,s,n)};class bX extends hz{constructor(){super(...arguments),this.type=mO.sankey,this.transformerConstructor=_X,this._nodeLayoutZIndex=aD.Node,this._labelLayoutZIndex=aD.Label,this._viewBox=new je,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(u(a))return a;if(u(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;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(u(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=x(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var t,e;if(!this._needClear)return;const i=null===(t=this._nodeMark)||void 0===t?void 0:t.getGraphics();if(!i||!i.length)return;const s=null===(e=this._linkMark)||void 0===e?void 0:e.getGraphics();s&&s.length&&(i.forEach((t=>{t.removeState(cD.STATE_SANKEY_EMPHASIS),t.removeState(cD.STATE_SANKEY_EMPHASIS_REVERSE)})),s.forEach((t=>{t.removeState(cD.STATE_SANKEY_EMPHASIS),t.removeState(cD.STATE_SANKEY_EMPHASIS_REVERSE)})),this._needClear=!1)},this._handleNodeAdjacencyClick=t=>{const e=fL(t),i=[e.key];if(this._linkMark){const t=this._linkMark.getGraphics();if(!t||!t.length)return;t.forEach(((t,s)=>{const n=fL(t);n.source===e.key?(i.includes(n.target)||i.push(n.target),t.removeState(cD.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(cD.STATE_SANKEY_EMPHASIS,!0)):n.target===e.key?(i.includes(n.source)||i.push(n.source),t.removeState(cD.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(cD.STATE_SANKEY_EMPHASIS,!0)):(t.removeState(cD.STATE_SANKEY_EMPHASIS),t.addState(cD.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),i),this._needClear=!0},this._handleLinkAdjacencyClick=t=>{const e=fL(t),i=[e.source,e.target];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach((e=>{e===t?(e.removeState(cD.STATE_SANKEY_EMPHASIS_REVERSE),yX(e,cD.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState(cD.STATE_SANKEY_EMPHASIS),e.addState(cD.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),i),this._needClear=!0},this._handleNodeRelatedClick=t=>{var e;const i=fL(t),s=this._nodeMark.getGraphics();if(!s||!s.length)return;const n=this._linkMark.getGraphics();if(!n||!n.length)return;const r=(null===(e=fL(n[0]))||void 0===e?void 0:e.parents)?"parents":"source";if("source"===r){const t=[i.key],e=[];if(n.forEach(((n,r)=>{var a,o,l,h;const c=fL(n),d=(null==c?void 0:c.parents)?"parents":"source";if(G(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.getGraphics();if(!t||!t.length)return;t.forEach(((t,i)=>{var s;const n=fL(t);e.includes(null!==(s=n.key)&&void 0!==s?s:n.index)?(t.removeState(cD.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(cD.STATE_SANKEY_EMPHASIS,!0)):(t.removeState(cD.STATE_SANKEY_EMPHASIS),t.addState(cD.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),t)}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(G(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 a=fL(s),o=a.datum,l=o?o.filter((t=>t[r].some((t=>t.key===i.key)))):null,h=e.find((t=>t.source===a.source&&t.target===a.target));if(l&&l.length){t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target);const e=l.reduce(((t,e)=>t+e.value),0),i=e/a.value;return s.removeState(cD.STATE_SANKEY_EMPHASIS_REVERSE),void yX(s,cD.STATE_SANKEY_EMPHASIS,{ratio:i})}if(h)return t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target),s.removeState(cD.STATE_SANKEY_EMPHASIS_REVERSE),void yX(s,cD.STATE_SANKEY_EMPHASIS,{ratio:h.value/a.value});s.removeState(cD.STATE_SANKEY_EMPHASIS),s.addState(cD.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),t)}this._needClear=!0},this._handleLinkRelatedClick=t=>{const e=this._nodeMark.getGraphics();if(!e||!e.length)return;const i=this._linkMark.getGraphics();if(!i||!i.length)return;if("source"===(fL(t)?"parents":"source"))this._linkMark&&i.forEach((t=>{t.removeState(cD.STATE_SANKEY_EMPHASIS),t.removeState(cD.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&e.forEach((t=>{t.removeState(cD.STATE_SANKEY_EMPHASIS),t.removeState(cD.STATE_SANKEY_EMPHASIS_REVERSE)}));else{const s=fL(t),n=[s.source,s.target],r=[];G(s.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})}})),i.forEach((t=>{const e=fL(t),i=e.datum;if(e.source===s.source&&e.target===s.target)return t.removeState(cD.STATE_SANKEY_EMPHASIS_REVERSE),void yX(t,cD.STATE_SANKEY_EMPHASIS,{ratio:1});const a=i?i.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(s.source)&&e.includes(s.target)})):null;if(a&&a.length){n.includes(e.source)||n.push(e.source),n.includes(e.target)||n.push(e.target);const i=a.filter((t=>t.parents.some(((e,i)=>{var n;return e.key===s.source&&(null===(n=t.parents[i+1])||void 0===n?void 0:n.key)===s.target})))).reduce(((t,e)=>t+e.value),0),r=i/e.value;return t.removeState(cD.STATE_SANKEY_EMPHASIS_REVERSE),void yX(t,cD.STATE_SANKEY_EMPHASIS,{ratio:r})}const o=r.find((t=>t.source===e.source&&t.target===e.target));if(o)return n.includes(e.source)||n.push(e.source),n.includes(e.target)||n.push(e.target),t.removeState(cD.STATE_SANKEY_EMPHASIS_REVERSE),void yX(t,cD.STATE_SANKEY_EMPHASIS,{ratio:o.value/e.value});t.removeState(cD.STATE_SANKEY_EMPHASIS),t.addState(cD.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(e,n)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}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:this._spec.categoryField)}initData(){var t,e,i,s;super.initData();const n=this.getViewData(),r=this.getRawData();if(r&&n){TL(this._dataSet,"sankeyLayout",rX),TL(this._dataSet,"sankeyFormat",nX),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.direction,crossNodeAlign:this._spec.crossNodeAlign,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,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,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,inverse:this._spec.inverse},level:jL.sankeyLayout});const{dataSet:a}=this._option;TL(a,"sankeyNodes",aX),TL(a,"flatten",HY);const o=new Ba(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:jF.bind(this),call:HF}},!1),this._nodesSeriesData=o,TL(a,"sankeyLinks",oX);const l=new Ba(a,{name:`sankey-link-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyLinks"}),l.transform({type:"addVChartProperty",options:{beforeCall:jF.bind(this),call:HF}},!1),this._linksSeriesData=l}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(bX.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(bX.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=G(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,i=G(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()}_initNodeMarkStyle(){var t,e;const i=this._nodeMark;i&&(this.setMarkStyle(i,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},cD.STATE_NORMAL,lD.Mark),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.node.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByNode},"normal",lD.User_Mark))}_initLinkMarkStyle(){var t,e;const i=this._linkMark;i&&(i.setGlyphConfig({direction:this.direction}),this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},cD.STATE_NORMAL,lD.Series),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.link.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByLink},"normal",lD.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(d(t)||d(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=bF(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={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;this._nodeMark&&this._nodeMark.setAnimationConfig(ZF(null===(i=eI.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),JF("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(ZF(null===(s=eI.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),JF("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:SL.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(t,e){t&&t.length&&t.forEach((t=>{t.removeState([cD.STATE_SANKEY_EMPHASIS_REVERSE,cD.STATE_SANKEY_EMPHASIS]),e.includes(fL(t).key)?t.addState(cD.STATE_SANKEY_EMPHASIS,!0):t.addState(cD.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new lX(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_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&&!d(a[0])||(a=this.getNodeList(),a&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new BO;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_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=>{u(t[i])&&e.add(t[i]),u(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 sX(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),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]}getMarkData(t){return t.datum?_(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}bX.type=mO.sankey,bX.transformerConstructor=_X,bX.mark=vX,bX.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const xX=()=>{vV(),DN(),NA(),eI.registerGraphicComponent("path",(t=>Jg(t))),eI.registerMark(mX.type,mX),tW(),eI.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:cX(t,e)},JD))),eI.registerAnimation("sankeyLinkPath",((t,e)=>({appear:dX(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:qD.disappear.duration}}))),uT.registerBuiltInAnimate("linkPathGrowOut",pX),uT.registerBuiltInAnimate("linkPathGrowIn",uX),tF(),eI.registerSeries(bX.type,bX)},SX=(t,e)=>{let i={},s=e.fields;if(c(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=HY(n);return i=OF([{latestData:r}],e),i};class kX extends PF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const AX=Object.assign(Object.assign({},WF),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),MX=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class wX extends rz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const TX=(t,e)=>{if(e.getViewBox()){const i=new AG(e).layout(t,e.getViewBox()),s=[];return YU(i,s,{maxDepth:null==e?void 0:e.maxDepth}),s.forEach(((t,i)=>{t&&[FF,"name"].forEach((i=>{t[i]=t.datum[t.depth][e.nameField]}))})),s}return[]};class CX extends hz{constructor(){super(...arguments),this.type=mO.treemap,this.transformerConstructor=wX,this._categoryField="name",this._valueField="value",this._viewBox=new je,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:FF),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ne),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:EI},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,s,n;super.initData(),TL(this._dataSet,"treemap",TX),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{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}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(TL(this._rawData.dataSet,"addVChartProperty",AF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:VF.bind(this),call:NF}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=SX([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=z(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){TL(this._dataSet,"hierarchyDimensionStatistics",SX),TL(this._dataSet,"flatten",HY);const i=new Ba(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 XY(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(CX.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(CX.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}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()},cD.STATE_NORMAL,lD.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()},cD.STATE_NORMAL,lD.Series)}_initRichStyleOfLabelMark(t){"rich"===t.getTextType()&&this.setMarkStyle(t,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},cD.STATE_NORMAL,lD.Series)}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{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},cD.STATE_NORMAL,lD.Series),this._initRichStyleOfLabelMark(t))}initNonLeafLabelMarkStyle(t){t&&(this._nonLeafLabelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{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},cD.STATE_NORMAL,lD.Series),this._initRichStyleOfLabelMark(t))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(ZF(null===(e=eI.getAnimationInKey("treemap"))||void 0===e?void 0:e(),JF(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 kX(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(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(_L.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(_L.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}CX.type=mO.treemap,CX.mark=AX,CX.builtInTheme={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"}}}},CX.transformerConstructor=wX,U(CX,GY),U(CX,qV);const BX=()=>{eI.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),eI.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),vV(),tW(),eI.registerAnimation("treemap",((t,e)=>({appear:MX(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:qD.disappear.duration}}))),tF(),eI.registerSeries(CX.type,CX)},EX=Object.assign(Object.assign({},mU),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),PX=Object.assign(Object.assign({},WF),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),RX={type:"fadeIn"};function OX(t,e){return"fadeIn"===e?RX:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class IX extends rz{constructor(){super(...arguments),this._supportStack=!1}}class LX extends PF{enableByType(t){return"dimension"!==t}}const DX="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",FX={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:DX,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:DX,fill:"#ddd"}}};class zX extends vU{constructor(){super(...arguments),this.type=mO.gaugePointer,this.transformerConstructor=IX,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(zX.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},zX.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(zX.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(){this._tooltipHelper=new LX(this),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 u(this.radiusAxisHelper)&&u(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=mt(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})}getInteractionTriggers(){return 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(ZF(null===(i=eI.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),JF("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}zX.type=mO.gaugePointer,zX.mark=PX,zX.builtInTheme={gaugePointer:FX},zX.transformerConstructor=IX;const jX=()=>{eI.registerSeries(zX.type,zX),WV(),vV(),eI.registerAnimation("gaugePointer",((t,e)=>{const i=OX(t,e);return{appear:i,enter:i,disappear:{duration:qD.disappear.duration}}})),KW(),XW()};class HX extends rz{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class VX extends vU{constructor(){super(...arguments),this.type=mO.gauge,this.transformerConstructor=HX,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=re(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();TL(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[KI]=t[this._angleField[0]],t[$I]=e>0?i[e-1][KI]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(VX.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(VX.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})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(t,e){if(super.initMarkStyleWithSpec(t,e),t&&"segment"===t.name){const e=this.getSpec().segment;if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,lD.User_Mark)}}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),s=_t(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?RO(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=_t(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?RO(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return u(t[$I])?this.angleAxisHelper.dataToPosition([t[$I]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[KI]])}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(ZF(null===(i=eI.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),JF("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}VX.type=mO.gauge,VX.mark=EX,VX.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},VX.transformerConstructor=HX;class NX extends HD{constructor(){super(...arguments),this.type=NX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Tg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="rect":a.symbolType=o,a}}NX.type="cell";function WX(t){return!1===t?{}:{type:"fadeIn"}}class UX extends PF{enableByType(t){return"dimension"!==t}}const GX=Object.assign(Object.assign({},WF),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class YX extends rz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class XX extends hz{constructor(){super(...arguments),this.type=mO.heatmap,this.transformerConstructor=YX}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=G(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(XX.mark.cell,{isSeriesMark:!0},{morph:ez(this._spec,XX.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(XX.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){var e,i,s;t&&this.setMarkStyle(t,{fill:null!==(s=null===(i=null===(e=this._spec.cell)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s: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",lD.Series)}initCellBackgroundMarkStyle(){var t,e,i;const s=ni(null!==(i=null===(e=null===(t=this._spec.cellBackground)||void 0===t?void 0:t.style)||void 0===e?void 0:e.padding)&&void 0!==i?i:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+s[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+s[0]},width:()=>this.getCellSize(this._xAxisHelper)-s[1]-s[3],height:()=>this.getCellSize(this._yAxisHelper)-s[0]-s[2]},"normal",lD.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue()[0]}}getInteractionTriggers(){return 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=lz(this);this._cellMark.setAnimationConfig(ZF(null===(i=eI.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),JF("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 UX(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}XX.type=mO.heatmap,XX.mark=GX,XX.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1},label:{style:{lineWidth:2}}}},XX.transformerConstructor=YX;const $X=()=>{tW(),eI.registerMark(NX.type,NX),eI.registerGraphicComponent("symbol",Tg),qA(),JA(),zE(),eI.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},JD),{appear:WX(e)}))),Uj(),Hj(),eI.registerSeries(XX.type,XX)},KX=Object.assign(Object.assign({},WF),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),qX=`${MI}_CORRELATION_X`,ZX=`${MI}_CORRELATION_Y`,JX=`${MI}_CORRELATION_SIZE`,QX=(t,e)=>{var i,s,n,r,a,o,l,h,c,u,p,g,f,m,v;if(!t||!(null==e?void 0:e.view)||!_(t))return t;const y=e.view();if(y.x1-y.x0==0||y.y1-y.y0==0||y.x1-y.x0==-1/0||y.x1-y.x0==1/0||y.y1-y.y0==-1/0||y.y1-y.y0==1/0)return t;const b=re(null!==(i=e.startAngle)&&void 0!==i?i:-90),S=re(null!==(s=e.endAngle)&&void 0!==s?s:270),k=Math.max((y.x1-y.x0)/2,(y.y1-y.y0)/2),A=Et(null!==(n=e.innerRadius)&&void 0!==n?n:0,k),M=Et(e.outerRadius,k),w=[x(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:y.x0+Et(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",y.x1-y.x0),x(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:y.y0+Et(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",y.y1-y.y0)],T=Bt(e.field),C=t.map(T),[B,E]=Rt(C),P=B===E?t=>(A+M)/2:t=>A+(M-A)*(t-B)/(E-B),R=d(e.radiusField)?T:Bt(e.radiusField),O=null!==(p=null===(u=null==e?void 0:e.radiusRange)||void 0===u?void 0:u[1])&&void 0!==p?p:5;let I=t=>O;if(R){const[i,s]=R!==T?Rt(t.map(R)):[B,E],n=null!==(f=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==f?f:5,r=null!==(v=null===(m=e.radiusRange)||void 0===m?void 0:m[1])&&void 0!==v?v:5;i!==s&&(I=t=>n+(r-n)*(R(t)-i)/(s-i))}const L=Math.min(b,S),D=Math.max(b,S),F=t$(L,D,t.length),z=[],j=(D-L)/60;return t.forEach(((t,e)=>{const i=P(C[e]),s=I(t);let n,r,a=F[e];for(let t=0;t<60&&(n=w[0]+i*Math.cos(a),r=w[1]+i*Math.sin(a),e$({x:n,y:r,size:s},z)||n-sy.x1||r-sy.y1);t++)t<59&&(a+=j,a>D?a=L: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},e$=(t,e)=>!(!e||!e.length)&&e.some((e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2){if(!t||!_(t))return[];const{keyword:i,categoryField:s}=e,n=t[0].latestData[0];return{[s]:i,[BI]:null==n?void 0:n[BI],[PI]:null==n?void 0:n[PI]}};class s$ extends LN{constructor(){super(...arguments),this.type=s$.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=mt(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}s$.type="ripple";const n$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class r$ extends rz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class a$ extends fW{constructor(){super(...arguments),this.type=mO.correlation,this.transformerConstructor=r$,this._viewBox=new je}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){u(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){u(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){u(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;TL(this._dataSet,"correlation",QX);const s=new Ca;CL(s,"dataview",Ma),TL(s,"correlationCenter",i$);const n=new Ba(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 LD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_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(){const t=this._createMark(a$.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:BI});t&&(t.setMarkConfig({zIndex:aD.Node}),this._nodePointMark=t);const e=this._createMark(a$.mark.ripplePoint,{key:BI,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});e&&(this._ripplePointMark=e);const i=this._createMark(a$.mark.centerPoint,{key:BI,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(i.setMarkConfig({zIndex:aD.Node}),this._centerPointMark=i)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var t,e,i,s;const n=this._nodePointMark;if(!n)return;const r=null!==(e=null===(t=this._spec.nodePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(n,{x:t=>t[qX],y:t=>t[ZX],size:t=>t[JX],fill:null!==(i=r.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(s=r.fillOpacity)&&void 0!==s?s:1,lineWidth:0},cD.STATE_NORMAL,lD.Series)}_initRipplePointMarkStyle(){var t,e,i,s,n;const r=this._ripplePointMark;if(!r)return;const a=null!==(e=null===(t=this._spec.ripplePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(r,{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!==(i=a.fill)&&void 0!==i?i:this.getColorAttribute(),opacity:null!==(s=a.fillOpacity)&&void 0!==s?s:.2,ripple:null!==(n=a.ripple)&&void 0!==n?n:0},cD.STATE_NORMAL,lD.Series)}_initCenterPointMarkStyle(){var t,e,i,s,n,r;const a=this._centerPointMark;a&&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:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(i=null===(e=null===(t=this._spec.centerPoint)||void 0===t?void 0:t.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(r=null===(n=null===(s=this._spec.centerPoint)||void 0===s?void 0:s.style)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1},cD.STATE_NORMAL,lD.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},cD.STATE_NORMAL,lD.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(ZF(null===(e=eI.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),JF("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(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}a$.type=mO.correlation,a$.mark=KX,a$.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},a$.transformerConstructor=r$;const o$=()=>{Lz(),DN(),JA(),eI.registerMark(s$.type,s$),eI.registerGraphicComponent("symbol",(t=>Tg(t))),eI.registerSeries(a$.type,a$),eI.registerAnimation("correlation",((t,e)=>Object.assign({appear:n$(0,e)},ZD)))},l$=Object.assign(Object.assign({},WF),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class h$ extends LN{constructor(){super(...arguments),this.type=h$.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}h$.type="liquid";const c$=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class d$ extends PF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class u$ extends az{constructor(){super(...arguments),this.type=mO.liquid,this.transformerConstructor=Dz,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Ig({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Tg({x:s,y:n,size:r,symbolType:c$(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){u(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=VO(this._spec.outlineMargin),this._paddingSpec=VO(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Ut(...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(u$.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(u$.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(u$.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(u$.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const t=this._liquidOutlineMark;t.created(),this.setMarkStyle(t,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",lD.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const t=this._liquidBackgroundMark;t.created(),this.setMarkStyle(t,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",lD.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const t=this._liquidMark,e=this._liquidGroupMark;e&&this.setMarkStyle(e,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),t&&this.setMarkStyle(t,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",lD.Series)}initTooltip(){this._tooltipHelper=new d$(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(ZF(null===(i=eI.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),JF("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(ZF(null===(s=eI.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),JF("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(bL.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=SM(t.attribute.fill,n.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]}}u$.type=mO.liquid,u$.mark=l$,u$.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},u$.transformerConstructor=Dz;const p$=t=>G(t).join(",");class g$ extends PF{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>p$(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>p$(null==t?void 0:t[this.series.getDimensionField()[0]])}}const f$=Object.assign(Object.assign({},WF),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class m$ extends rz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const v$=(t,e)=>{const i=e.getViewBox();return i&&(null==t?void 0:t.length)?DG(Object.assign({setField:e.setField,valueField:e.valueField},i),t):[]};class _$ extends az{constructor(){super(...arguments),this.type=mO.venn,this.transformerConstructor=m$,this._viewBox=new je}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:EI)}initData(){var t;super.initData(),TL(this._dataSet,"venn",v$),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:{getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField}})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(_$.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(_$.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()},cD.STATE_NORMAL,lD.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},cD.STATE_NORMAL,lD.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},cD.STATE_HOVER,lD.Series))}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>p$(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)}},cD.STATE_NORMAL,lD.Series))}initOverlapLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>p$(t.sets)},cD.STATE_NORMAL,lD.Series))}initTooltip(){this._tooltipHelper=new g$(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(){super.onLayoutEnd(),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:p$(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return p$(i)}legendSelectedFilter(t,e){if(t.type===n.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[p$(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>G(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(p$(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(ZF(null===(e=eI.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),JF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(ZF(null===(e=eI.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),JF(t.name,this._spec,this._markAttributeContext)))}))}}_$.type=mO.venn,_$.mark=f$,_$.builtInTheme={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"}}}}},_$.transformerConstructor=m$;class y$ extends SV{constructor(){super(...arguments),this.type=mO.mosaic,this.transformerConstructor=xV}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(GI),this.setFieldX2(UI)),this.setFieldY(XI),this.setFieldY2(YI)):(t&&(this.setFieldY(GI),this.setFieldY2(UI)),this.setFieldX(XI),this.setFieldX2(YI)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&d(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];d(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}y$.type=mO.mosaic,y$.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},y$.transformerConstructor=xV;class b$ extends mH{_isValidSeries(t){return t===mO.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class x$ extends gH{constructor(){super(...arguments),this.transformerConstructor=b$,this.type="map",this.seriesType=mO.map}}x$.type="map",x$.seriesType=mO.map,x$.transformerConstructor=b$;const S$=()=>{qH(),QV(),WV(),eI.registerSeries(eN.type,eN),eI.registerImplement("registerMap",RL),eI.registerImplement("unregisterMap",OL),tF(),eI.registerChart(x$.type,x$)};class k$ extends mH{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=G(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 u(r)&&n.forEach((t=>{d(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],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),u(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class A$ extends k${needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_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)),d(l.type)&&(l.type="linear"),d(o.type)&&(o.type="band");const h=$z(l,{min:0,max:1});d(l.min)&&(l.min=h.min),d(l.max)&&(l.max=h.max),s&&Object.assign(l,tI({},s,l)),n&&Object.assign(o,tI({},n,o))}}class M$ extends k${needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}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 w$ extends k${needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class T$ extends gH{constructor(){super(...arguments),this.transformerConstructor=w$}}T$.transformerConstructor=w$;class C$ extends T${constructor(){super(...arguments),this.transformerConstructor=w$,this.type="pie",this.seriesType=mO.pie}}C$.type="pie",C$.seriesType=mO.pie,C$.transformerConstructor=w$;class B$ extends M${_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return n.radius=null!==(e=t.radius)&&void 0!==e?e:cj,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:cj,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}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&&d(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=G(t.crosshair||{}).map((t=>tI({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const E$=(t,e)=>{if(!t)return null;const i=kz(t,(t=>"angle"===t.getOrient()),e),s=kz(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&sB(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),u={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=oO({x:1,y:0},u);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=lO(u),f=null===(e=s[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(d(v))return;let _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=xz(v,t,"polar",r);n.push({index:_,value:v,position:i.scale(v),axis:t,data:y})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&sB(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let u=oO({x:1,y:0},c);u<-Math.PI/2&&(u=2*Math.PI+u);const p=lO(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((u-(null==f?void 0:f[0]))*(u-(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=s.invert(p);if(d(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const _=xz(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:_})}})),n.length?n:null};class P$ extends gH{constructor(){super(...arguments),this.transformerConstructor=B$,this.type="rose",this.seriesType=mO.rose}_setModelOption(){this._modelOption.getDimensionInfo=E$}}P$.type="rose",P$.seriesType=mO.rose,P$.transformerConstructor=B$,U(P$,xH);const R$=()=>{$H(),qH(),MH(),AH(),ZW(),eI.registerChart(P$.type,P$)};class O$ extends M${_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t);return i.line=t.line,i.point=t.point,i.stack=t.stack,i.percent=t.percent,i.area=tI({visible:!1},t.area),i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"area",i.activePoint=t.activePoint,i.pointDis=t.pointDis,i.pointDisMul=t.pointDisMul,i.markOverlap=t.markOverlap,i}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=G(t.crosshair||{}).map((t=>tI({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class I$ extends gH{constructor(){super(...arguments),this.transformerConstructor=O$,this.type="radar",this.seriesType=mO.radar}_setModelOption(){this._modelOption.getDimensionInfo=E$}}I$.type="radar",I$.seriesType=mO.radar,I$.transformerConstructor=O$,U(I$,xH);const L$=()=>{$H(),qH(),JH(),MH(),AH(),aU(),eI.registerChart(I$.type,I$)};class D$ extends mH{_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=p(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=>{P(e,"trimPadding")&&tI(e,iD(this.type,t))})),this._transformAxisSpec(t)}}class F$ extends gH{constructor(){super(...arguments),this.transformerConstructor=D$,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=PH(t,e,i))&&void 0!==s?s:[],...null!==(n=E$(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=OH,this._modelOption.getRectByDimensionData=jH}}F$.type="common",F$.transformerConstructor=D$,U(F$,xH);class z$ extends vH{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class j$ extends gH{constructor(){super(...arguments),this.transformerConstructor=z$}}j$.transformerConstructor=z$,U(j$,xH);class H$ extends z${transformSpec(t){super.transformSpec(t),QL(t)}}class V$ extends j${constructor(){super(...arguments),this.transformerConstructor=H$,this.type="histogram",this.seriesType=mO.bar}_setModelOption(){this._modelOption.getDimensionInfo=PH,this._modelOption.getDimensionInfoByValue=OH,this._modelOption.getRectByDimensionData=jH}}V$.type="histogram",V$.seriesType=mO.bar,V$.transformerConstructor=H$;const N$=()=>{$H(),qH(),JH(),MH(),AH(),kV(),eI.registerTransform("bin",Xr),eI.registerChart(V$.type,V$)};class W$ extends A${_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class U$ extends gH{constructor(){super(...arguments),this.transformerConstructor=W$,this.type="circularProgress",this.seriesType=mO.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=E$}}U$.type="circularProgress",U$.seriesType=mO.circularProgress,U$.transformerConstructor=W$,U(U$,xH);const G$=()=>{$H(),qH(),MH(),AH(),AU(),eI.registerChart(U$.type,U$)};class Y$ extends A${_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=mO.circularProgress,e}transformSpec(t){var e,i,s,n,r;super.transformSpec(t);let a=null===(e=t.series)||void 0===e?void 0:e.find((t=>t.type===mO.gauge||t.type===mO.circularProgress));d(a)&&(a=null!==(i=t.gauge)&&void 0!==i?i:this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===a.type&&(d(a.radiusField)&&d(a.categoryField)&&(a.radiusField=null!==(n=null!==(s=t.radiusField)&&void 0!==s?s:t.categoryField)&&void 0!==n?n:t.seriesField),d(a.valueField)&&d(a.angleField)&&(a.valueField=null!==(r=t.valueField)&&void 0!==r?r:t.angleField)),1===t.series.length?t.series.push(a):t.series.forEach((t=>{t.type===a.type&&Object.keys(a).forEach((e=>{e in t||(t[e]=a[e])}))}))),a.type===mO.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:aD.Region+50}):this._transformGaugeAxisSpec(t)}_transformGaugeAxisSpec(t){var e;t.axes||(t.axes=[]);const i={radius:null,angle:null};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=t),"angle"===e&&(i.angle=t)})),i.angle||(i.angle={orient:"angle",visible:!0},t.axes.push(i.angle)),i.radius||(i.radius={orient:"radius",visible:!1},t.axes.push(i.radius)),d(i.angle.type)&&(i.angle.type="linear"),d(i.radius.type)&&(i.radius.type="linear"),d(i.angle.zIndex)&&(i.angle.zIndex=aD.Region+50)}}class X$ extends gH{constructor(){super(...arguments),this.transformerConstructor=Y$,this.type="gauge",this.seriesType=mO.gaugePointer}}X$.type="gauge",X$.seriesType=mO.gaugePointer,X$.transformerConstructor=Y$;const $$=()=>{qH(),jX(),eI.registerSeries(VX.type,VX),TW(),xU(),XW(),AU(),eI.registerChart(X$.type,X$)};class K$ extends mH{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class q$ extends gH{constructor(){super(...arguments),this.transformerConstructor=K$,this.type="wordCloud",this.seriesType=mO.wordCloud}}q$.transformerConstructor=K$;class Z$ extends q${constructor(){super(...arguments),this.transformerConstructor=K$,this.type="wordCloud",this.seriesType=mO.wordCloud}}Z$.type="wordCloud",Z$.seriesType=mO.wordCloud,Z$.transformerConstructor=K$;const J$=()=>{qH(),uY(),eI.registerChart(Z$.type,Z$)};class Q$ extends mH{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class tK extends gH{constructor(){super(...arguments),this.transformerConstructor=Q$,this.type="funnel",this.seriesType=mO.funnel}}tK.type="funnel",tK.seriesType=mO.funnel,tK.transformerConstructor=Q$;const eK=()=>{qH(),RY(),eI.registerChart(tK.type,tK)};class iK extends vH{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}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)),d(s.type)&&(s.type="band"),d(i.type)&&(i.type="linear");const n=$z(i,{min:0,max:1});d(i.min)&&(i.min=n.min),d(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)),d(s.type)&&(s.type="linear"),d(e.type)&&(e.type="band");const n=$z(s,{min:0,max:1});d(s.min)&&(s.min=n.min),d(s.max)&&(s.max=n.max)}}}class sK extends gH{constructor(){super(...arguments),this.transformerConstructor=iK,this.type="linearProgress",this.seriesType=mO.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=PH,this._modelOption.getDimensionInfoByValue=OH,this._modelOption.getRectByDimensionData=jH}}sK.type="linearProgress",sK.seriesType=mO.linearProgress,sK.transformerConstructor=iK,U(sK,xH);const nK=()=>{$H(),qH(),MH(),AH(),PU(),eI.registerChart(sK.type,sK)};class rK extends vH{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"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),QL(t)}}class aK extends gH{constructor(){super(...arguments),this.transformerConstructor=rK,this.type="rangeColumn",this.seriesType=mO.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=PH,this._modelOption.getDimensionInfoByValue=OH,this._modelOption.getRectByDimensionData=jH}}aK.type="rangeColumn",aK.seriesType=mO.rangeColumn,aK.transformerConstructor=rK;const oK=()=>{$H(),qH(),MH(),AH(),hW(),eI.registerChart(aK.type,aK)};class lK extends mH{_getDefaultSeriesSpec(t){const e=u(t.startAngle)?t.startAngle:-90,i=u(t.endAngle)?t.endAngle:e+ae(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class hK extends gH{constructor(){super(...arguments),this.transformerConstructor=lK,this.type="sunburst",this.seriesType=mO.sunburst}}hK.type="sunburst",hK.seriesType=mO.sunburst,hK.transformerConstructor=lK;const cK=()=>{qH(),qY(),eI.registerChart(hK.type,hK)};class dK extends mH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class uK extends gH{constructor(){super(...arguments),this.transformerConstructor=dK,this.type="circlePacking",this.seriesType=mO.circlePacking}}uK.type="circlePacking",uK.seriesType=mO.circlePacking,uK.transformerConstructor=dK;const pK=()=>{qH(),iX(),eI.registerChart(uK.type,uK)};class gK extends mH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class fK extends gH{constructor(){super(...arguments),this.transformerConstructor=gK,this.type="treemap",this.seriesType=mO.treemap}}fK.type="treemap",fK.seriesType=mO.treemap,fK.transformerConstructor=gK;const mK=()=>{qH(),BX(),eI.registerChart(fK.type,fK)};class vK extends AV{transformSpec(t){super.transformSpec(t),t.legends&&G(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),QL(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class _K extends MV{constructor(){super(...arguments),this.transformerConstructor=vK,this.type="waterfall",this.seriesType=mO.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=PH,this._modelOption.getDimensionInfoByValue=OH,this._modelOption.getRectByDimensionData=jH}}_K.type="waterfall",_K.seriesType=mO.waterfall,_K.transformerConstructor=vK;const yK=()=>{$H(),qH(),JH(),MH(),AH(),EN(),eI.registerChart(_K.type,_K)};class bK extends vH{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),QL(t)}}class xK extends gH{constructor(){super(...arguments),this.transformerConstructor=bK,this.type="boxPlot",this.seriesType=mO.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=PH,this._modelOption.getDimensionInfoByValue=OH,this._modelOption.getRectByDimensionData=jH}}xK.type="boxPlot",xK.seriesType=mO.boxPlot,xK.transformerConstructor=bK;const SK=()=>{$H(),qH(),MH(),AH(),JN(),eI.registerTransform("boxplot",$r),eI.registerChart(xK.type,xK)};class kK extends mH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class AK extends gH{constructor(){super(...arguments),this.transformerConstructor=kK,this.type="sankey",this.seriesType=mO.sankey}_setStateInDatum(t,e,i,s){const n=_(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=fL(t))||void 0===e?void 0:e.datum;return _(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}AK.type="sankey",AK.seriesType=mO.sankey,AK.transformerConstructor=kK;const MK=()=>{qH(),yo.load(fM),xX(),eI.registerChart(AK.type,AK)};class wK extends vH{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.area=t.area,s.point=t.point,s.line=t.line,"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),QL(t)}}class TK extends gH{constructor(){super(...arguments),this.transformerConstructor=wK,this.type="rangeArea",this.seriesType=mO.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=PH,this._modelOption.getDimensionInfoByValue=OH,this._modelOption.getRectByDimensionData=jH}}TK.type="rangeArea",TK.seriesType=mO.rangeArea,TK.transformerConstructor=wK;const CK=()=>{$H(),qH(),JH(),MH(),AH(),iV(),Uj(),Hj(),eI.registerSeries(gW.type,gW),eI.registerChart(TK.type,TK)};class BK extends vH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class EK extends gH{constructor(){super(...arguments),this.transformerConstructor=BK,this.type="heatmap",this.seriesType=mO.heatmap}}EK.type="heatmap",EK.seriesType=mO.heatmap,EK.transformerConstructor=BK;const PK=()=>{qH(),$X(),eI.registerChart(EK.type,EK)};class RK extends mH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class OK extends gH{constructor(){super(...arguments),this.transformerConstructor=RK,this.type="correlation",this.seriesType=mO.correlation}}OK.type="correlation",OK.seriesType=mO.correlation,OK.transformerConstructor=RK;const IK=()=>{qH(),o$(),eI.registerChart(OK.type,OK)};function LK(t){var e,i;const s=Object.assign({},t);return E(t.style)||(s.textStyle=pL(t.style)),E(t.textStyle)||tI(s.textStyle,pL(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&pL(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&pL(s.background.style),s}const DK=(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},FK=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const p={};c.forEach((t=>{p[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:PI;return h?h(t,c,g):(_(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===p[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===p[t.source]&&!0===p[t.target])))):u(g)&&(t=t.filter((t=>!0===p[r.getSeriesFieldValue(t,g)]))),t)};class zK extends mj{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=aD.Legend,this.layoutLevel=oD.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{cO(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),cO(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=LO(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;u(s)&&(this._seriesUserId=G(s)),u(e)&&(this._regionUserId=G(e)),u(n)&&(this._seriesIndex=G(n)),u(i)&&(this._regionUserIndex=G(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_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):(N(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const t=this._initLegendData();t.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new LD(this._option,t),this._initSelectedData(),cO(this._regions,(t=>{t.event.on(bL.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){var e,i,s;const n=this._selectedData;d(t)||JSON.stringify(n)===JSON.stringify(t)||(cO(this._regions,(e=>{e.legendSelectedFilter&&(t=e.legendSelectedFilter(this,t))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...t],null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(bL.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;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)N(s,this._cacheAttrs)||this._legendComponent.setAttributes(tI({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(tI({},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 t,e;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());N(t,this._cacheAttrs)||this._legendComponent.setAttributes(tI({},t,{defaultSelected:this._selectedData}))}null===(e=(t=this.effect).onSelectedDataChange)||void 0===e||e.call(t),this.event.emit(bL.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}zK.specKey="legends";class jK extends zK{constructor(){super(...arguments),this.type=n.discreteLegend,this.name=n.discreteLegend}static getSpecInfo(t){return xF(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(t){super.init(t),cO(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:jL.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){TL(this._option.dataSet,"discreteLegendFilter",FK),TL(this._option.dataSet,"discreteLegendDataMake",DK);const t=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return cO(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(d(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(!qy(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 c(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)&&d(t.title.text)&&d(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=tL(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(e){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(e,i){const s=t(e,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:n={},item:r={},pager:a={},background:o={}}=e;n=I(n),r=I(r),a=I(a),o=I(o);const l=s;return n.visible?l.title=LK(n):l.title={visible:!1},E(r.focusIconStyle)||pL(r.focusIconStyle),r.shape&&(r.shape=cL(r.shape)),r.label&&(r.label=cL(r.label)),r.value&&(r.value=cL(r.value)),r.background&&(r.background=cL(r.background)),DO(r.maxWidth)&&(r.maxWidth=Number(r.maxWidth.substring(0,r.maxWidth.length-1))*i.width/100),DO(r.width)&&(r.width=Number(r.width.substring(0,r.width.length-1))*i.width/100),DO(r.height)&&(r.height=Number(r.height.substring(0,r.height.length-1))*i.width/100),l.item=r,"scrollbar"===a.type?(E(a.railStyle)||pL(a.railStyle),E(a.sliderStyle)||pL(a.sliderStyle)):(E(a.textStyle)||pL(a.textStyle),a.handler&&cL(a.handler)),l.pager=a,o.visible&&!E(o.style)&&(tI(l,o.style),u(o.padding)&&(l.padding=o.padding)),l}(this._spec,e)),{maxWidth:e.width,maxHeight:e.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return _R}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(dR.legendItemClick,(e=>{const i=P(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(bL.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(dR.legendItemHover,(t=>{const e=P(t,"detail");this.event.emit(bL.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(dR.legendItemUnHover,(t=>{const e=P(t,"detail");this.event.emit(bL.legendItemUnHover,{model:this,value:e,event:t})}))}}_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 c(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}=bF(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=bF(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}jK.specKey="legends",jK.builtInTheme={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}},jK.type=n.discreteLegend;const HK=(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[]},VK=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!p(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!E(o)){const[e,i]=o;return a?a(t,o,l):h(t)?hL(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};const NK={color:kR,size:MR},WK={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}},UK=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},WK),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},GK={horizontal:UK(!0),vertical:UK(!1)},YK=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},WK),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},XK={horizontal:YK(!0),vertical:YK(!1)},$K=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],KK=[2,10];class qK extends zK{static getSpecInfo(t){const e=xF(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?n.colorLegend:n.sizeLegend})),e}constructor(t,e){super(t,e),this.type=n.colorLegend,this.name=n.colorLegend;const i="color"===this._spec.type?n.colorLegend:n.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),cO(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData,customFilter:this._spec.customFilter},level:jL.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(){TL(this._option.dataSet,"continuousLegendFilter",VK),TL(this._option.dataSet,"continuousLegendDataMake",HK);const t=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>dO(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)&&d(t.title.text)&&d(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=tL(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!qy(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=tL(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(e){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()),E(a)&&(a="color"===this._legendType?$K:KK);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(e){const i=tI({},e),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:d={},type:p,id:g,visible:f,orient:m,position:v,data:_,defaultSelected:y,field:b,filter:x,regionId:S,regionIndex:k,seriesIndex:A,seriesId:M,padding:w}=i,T=t(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?T.title=LK(s):T.title={visible:!1},T.showHandler=!1!==n.visible,E(n.style)||(T.handlerStyle=pL(n.style)),u(r.width)&&(T.railWidth=r.width),u(r.height)&&(T.railHeight=r.height),E(r.style)||(T.railStyle=pL(r.style)),E(a.style)||(T.trackStyle=pL(a.style)),T.startText=cL(o),T.endText=cL(l),T.handlerText=cL(h),E(c)||(T.sizeBackground=pL(c)),d.visible&&!E(d.style)&&(tI(T,d.style),u(d.padding)&&(T.padding=d.padding)),T}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return NK[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",bt((e=>{const i=P(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(bL.legendFilter,{model:this,value:i,event:e})}),30))}}}qK.specKey="legends",qK.builtInTheme={colorLegend:GK,sizeLegend:XK},qK.type=n.continuousLegend;const ZK=()=>{eI.registerComponent(qK.type,qK)},JK=(t,e)=>u(e)?t.map((t=>e[t])):void 0,QK=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),tq=t=>!d(t)&&(_(t)?t.length>0&&t.every(u):Object.keys(t).length>0);function eq(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),p=i.getOption(),g=p.getRegionsInUserIdOrIndex(u(c.regionId)?[c.regionId]:void 0,u(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=iq(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),_=g.getLayoutRect(),y=p.globalInstance.getContainer(),b=Object.assign({x:0,y:0},y?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(y):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>QK(i,s)(t)&&QK(n,r)(t)&&(d(a)||QK([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),k=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),_.width),y:Math.min(Math.max(t.y,0),_.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.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 l=[{value:t[e.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=>x(t))))&&void 0!==i?i:[]}}))}];u(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=p.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:xL.chart,event:k({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=p.globalInstance;return gF.globalConfig.uniqueTooltip&&gF.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=p.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:xL.chart,event:k(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=p.globalInstance;return gF.globalConfig.uniqueTooltip&&gF.hideTooltip(a.id),m}return"none"}const iq=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),p=e.getMeasureField(),g=e.getSeriesField(),f=u(g)?t[g]:void 0,m=u(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=JK(c,t);let _=JK(p,t);const y=tq(_),b=!y&&u(g)&&d(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(QK(c,v));if(!y&&(_=JK(p,i),!tq(_)))return;const n=e.type===mO.pie?e.dataToCentralPosition(i):e.dataToPosition(i);d(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:p,measureData:_,hasMeasureData:y,groupField:g,groupData:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=sB(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])=>d(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(QK(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=JK(p,o),!tq(_))return;const l=t.dataToPosition(o);d(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:p,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(QK(c,n));if(!y&&(_=JK(p,r),!tq(_)))return;const o=t.dataToPosition(r);if(d(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:p,measureData:_,hasMeasureData:y,groupField:g,groupData:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===mO.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(QK(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(_=JK(p,i),!tq(_))return;const r=t.dataToPosition(i);d(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:p,measureData:_,hasMeasureData:y,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&(()=>{var i,n,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(QK(c,v));const o=e.getNameMap(),l=null===(r=null===(n=e.getMapViewData)||void 0===n?void 0:n.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=_;if(l&&!a&&(a=Object.assign({},t)),!y){if(_=JK(p,a),h=_,!tq(_)&&!a)return;tq(_)||(_=[null])}const u=e.dataToPosition(a);d(u)||isNaN(u.x)||isNaN(u.y)||s.push({pos:u,data:{dimensionFields:c,dimensionData:v,measureFields:p,measureData:h,hasMeasureData:y,groupField:g,groupData:f,originDatum:a},series:e})})()})),s},sq=t=>u(t)&&!_(t),nq=t=>u(t)&&_(t);class rq extends fj{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i,s,n;const{spec:r,theme:a}=super._initTheme(t,e);return r.style=tI({},this._theme,r.style),r.offset=tI({},a.offset,t.offset),r.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:a.transitionDuration,r.trigger=null!==(s=t.trigger)&&void 0!==s?s:a.trigger,r.triggerOff=null!==(n=t.triggerOff)&&void 0!==n?n:a.triggerOff,{spec:r,theme:a}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(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 u(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]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:Yy(this._option.mode)||!Uy(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.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,u(t.parentElement)?v(t.parentElement)&&(t.parentElement=S_.getElementById(t.parentElement)):Uy(this._option.mode)&&(t.parentElement=null==Wy?void 0:Wy.body)}}const aq={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}};class oq extends mj{constructor(){super(...arguments),this.layoutZIndex=1,this.type=n.tooltip,this.name=n.tooltip,this.transformerConstructor=rq,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=Uy(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||p(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return d(t.mark)&&d(t.model)&&d(t.datum)}(t)&&(n&&sq(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):u(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!d(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&gF.globalConfig.uniqueTooltip&&l&&gF.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=t=>{var e,i,s;if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return 0;this.event.emit(bL.tooltipHide,Object.assign(Object.assign({},t),{source:xL.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const n=null!==(s=this._spec.handler)&&void 0!==s?s:this.tooltipHandler;if(null==n?void 0:n.hideTooltip){const e=n.hideTooltip.call(n,t);return e||(this._isTooltipShown=!1),e}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:xL.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),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(bL.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(bL.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,this._enterable=!1;else{const t="canvas"===s?WH.canvas:WH.dom,n=eI.getComponentPluginInType(t);n||Hy("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,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=eI.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=G(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=G(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(Gy(s)||Yy(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):p(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>p(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=x(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,xt(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(p(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===s||s.call(i)}else 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=eq(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(d(this._cacheInfo)||d(t))return!1;if(nq(t)){if(sq(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>yz(t,e[i])))}if(nq(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!d(n)&&!d(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: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}getVisible(){return!1!==this._spec.visible}}oq.type=n.tooltip,oq.transformerConstructor=rq,oq.builtInTheme={tooltip:aq},oq.specKey="tooltip";var lq,hq;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(lq||(lq={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(hq||(hq={}));const cq={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class dq extends mj{get enableRemain(){return"none"===this.triggerOff}constructor(t,e){super(t,e),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=aD.CrossHair_Grid,this.labelZIndex=aD.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),x(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=xt((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(p(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.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{sB(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_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}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||N(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(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:SL.chart}:{source:xL.chart};_(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;_(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}onBeforeRender(){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:t=s["desktop-browser"]}=this._option,e=function(t){return t===s["desktop-browser"]||t===s["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:Gy(t)||Yy(t)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(t);if(e){const t=G(this.trigger||"hover"),i=t=>"click"===t?"none"===this.triggerOff?null:e.clickOut:e.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:e[t],out:i(t)})})),s}return null}_registerTooltipEvent(){this.event.on(bL.tooltipHide,{source:xL.chart},this._handleTooltipHideOrRelease),this.event.on(bL.tooltipShow,{source:xL.chart},this._handleTooltipShow),this.event.on(bL.tooltipRelease,{source:xL.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=P(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{cq[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=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const u=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+u.left),o=Math.min(o,i-d+u.top),l=Math.max(l,e+t.getLayoutRect().width-c-u.right),h=Math.max(h,i+t.getLayoutRect().height-d-u.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_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)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||x(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(e,i){var s,n,r;const a={},{line:o={},label:l={},visible:c}=e;if(a.visible=c,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=t(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(x(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=P(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==e?void 0:e.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=e.line.style.stroke);const t=P(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 e=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=e.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:c,outerBorder:d}=n,u=t(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:e.minWidth,maxWidth:e.maxWidth,padding:e.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:P(s,"stroke")}),panel:(h(e.visible)?e.visible:e)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:c,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{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||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}dq.specKey="crosshair";const uq={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}}}}};class pq extends dq{static getSpecInfo(t){return xF(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=n.cartesianCrosshair,this.name=n.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_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)}}_getDatumAtPoint(t,e){const i=cz(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){cz(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(u(t.dimType)?"y"===t.dimType:dz(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();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 o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=uO(this._regions,"cartesian");e&&(IH(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=FH(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new aw(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new ow(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}pq.specKey="crosshair",pq.builtInTheme={crosshair:uq},pq.type=n.cartesianCrosshair;class gq extends dq{static getSpecInfo(t){return xF(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=n.polarCrosshair,this.name=n.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_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)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_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}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=uO(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&u(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=Xz(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=bF(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:le(d,a.getInnerRadius(),o),end:le(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=ce(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=le(t,o,r),d=le(t,o,h),m=me([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=mt(ne.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new aw(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new hw(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new cw(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new lw(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=de(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}}(u):function(t){let e="center",i="middle";return e=(t=de(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}}(g.startAngle),a="angle"===l?le(e,p[1]+m.offset,u):le(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}gq.specKey="crosshair",gq.builtInTheme={crosshair:uq},gq.type=n.polarCrosshair;const fq=()=>{eI.registerComponent(gq.type,gq)},mq=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(d(o)||d(a))return t;const l=r(),h=_(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},vq=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(d(a)||d(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=>{let e=!1;return G(r).every((i=>{t[i]>=a[0]&&t[i]<=Y(a)&&(e=!0)})),e}:t=>{let e=!1;return G(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},_q=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],p=[],g=[];let f=!1,m=!1;n.forEach(((t,e)=>{var n;if(d(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);u(null==t?void 0:t.max)&&u(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{d(h[t])&&(g.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{G(i[e]).forEach((i=>{d(t[i])||(d(h[t[i]])&&(g.push(t[i]),h[t[i]]=0,c.push(t[i])),d(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const v=f?g:!1===r||m?g.sort(((t,e)=>t-e)):c;return v.forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),p.push(e)})),p},yq=(t,e,i)=>{const s=e.domain();if(eB(e.type))return i?s[0]+(Y(s)-s[0])*(1-t):s[0]+(Y(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+(Y(n)-n[0])*t;return e.invert(r)},bq=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&eB(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/(Y(n)-n[0])))},xq=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},Sq=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}},kq=(t,e,i)=>"start"===t?"percent"===e&&u(i.start)||"value"===e&&u(i.startValue):"percent"===e&&u(i.end)||"value"===e&&u(i.endValue),Aq=(t,e,i)=>{if(eB(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class Mq{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})}constructor(t,e,i,s,n,r,a,o){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.initZoomEvent=()=>{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:u(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,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),d=Math.abs(this.getState().start-this.getState().end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=mt(this.getState().start+f,0,1),_=mt(this.getState().end-m,0,1);this._handleChange(Math.min(v,_),Math.max(v,_),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Vt(s/n)>=.5:Vt(n/s)>=.5;if(this._scrollAttr.reverse||(r=-r),a){const t=this._spec.scrollStep;if(k(t)){r=(r>0?1:-1)*(t*(this.getState().end-this.getState().start)/1)}this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1)}const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))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.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===gz(pz(e))}setEventAttrFromSpec(){!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,h(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&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.getEvent(),this._option.mode)}}U(Mq,qV);class wq extends mj{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:bq(t,this._stateScale,this._isHorizontal),a="percent"===n?e:bq(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var t;this._dataFilterEvent.initZoomEvent(),null===(t=this._relatedAxisComponent)||void 0===t||t.event.on(bL.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_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)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=xq(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[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._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._currentDataCollection=[],this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=Aq(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!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&&Sq(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({value:"force"})}else cO(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),cO(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=pz(t),this._isHorizontal="horizontal"===gz(this._orient),this._dataFilterEvent=new Mq(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){this._handleDataCollectionChangeBound=this._handleDataCollectionChange.bind(this),super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||N(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])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(eB(n.type)){const r=n.domain(),a=r[0],o=Y(r)-a,l=u(t)?a+o*t:+e,h=u(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=u(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=u(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}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}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_setAxisFromSpec(){if(u(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):u(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),d(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>gz(t._orient)===gz(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!eB(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(u(i)&&(u(i.userId)&&(this._seriesUserId=G(i.userId)),u(i.specIndex)&&(this._seriesIndex=G(i.specIndex))),u(this._spec.seriesId)){const t=G(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(u(this._spec.seriesIndex)){const t=G(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(u(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(G(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(u(this._spec.regionId)){const t=G(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}_collectDataInfo(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};cO(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l,u=eB(d.getScale(0).type),p=eB(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?G(g.xField):G(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?G(g.yField):G(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:d===l?f:m;u&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else cO(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});return{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}}_initData(){const{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}=this._collectDataInfo(),{dataSet:r}=this._option;CL(r,"dataview",Ma),TL(r,"dataFilterComputeDomain",_q);const a=new Ba(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new LD(this._option,a),a.reRunAllTransform(),this._currentDataCollection=t,r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChangeBound)}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(TL(this._option.dataSet,"dataFilterWithNewDomain",vq),TL(this._option.dataSet,"lockStatisticsFilter",mq),cO(this._regions,(t=>{t.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>t.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>eB(this._stateScale.type)},level:1},!1),t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>eB(this._stateScale.type)},level:jL.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r}=this._collectDataInfo();if(this._currentDataCollection.length!==e.length||this._currentDataCollection.some(((t,i)=>t!==e[i]))){this._currentDataCollection.forEach((t=>{var e;null===(e=null==t?void 0:t.target)||void 0===e||e.removeListener("change",this._handleDataCollectionChangeBound)})),this._currentDataCollection=e;const{dataSet:t}=this._option;t.multipleDataViewAddListener(this._currentDataCollection,"change",this._handleDataCollectionChangeBound)}this._data.getDataView().transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data.getDataView().reRunAllTransform();const a=this._computeDomainOfStateScale(eB(this._stateScale.type));this._stateScale.domain(a,!1),(u(this._spec.start)||u(this._spec.end))&&this._setStateFromSpec(),this._handleChange(this._start,this._end,!0),this._spec.auto&&!N(this._domainCache,a)&&(this._domainCache=a,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;kq("start",i,this._spec)&&kq("end",s,this._spec)&&(t="percent"===i?this._spec.start:bq(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:bq(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?bq(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?bq(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=yq(this._start,this._stateScale,xq(i,this._isHorizontal)),this._endValue=yq(this._end,this._stateScale,xq(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,eB(this._stateScale.type)&&this._stateScale.domain()[0]!==Y(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(Y(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(Y(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=Aq(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&cO(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);k(null==i?void 0:i.min)&&k(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new GB:new AB,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_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}_autoVisible(t){if(!this._auto)return;t?this.show():this.hide();const e=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[e]:t?this[`_${e}`]:0},{[e]:lD.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_autoUpdate(t){var e,i,s,r,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(),u=Sq(h);if(!this._dataUpdating&&sB(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==u?void 0:u.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===(r=this._cacheRect)||void 0===r?void 0:r.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==u?void 0:u.bandSize,sB(c.type)){u&&(this._start||this._end)&&(this.type===n.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!d(t)||!d(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),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}U(wq,qV);class Tq extends fj{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=tI({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=_(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}const Cq=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),Bq={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:Cq(!1),startHandler:{style:{symbolType:"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;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"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;",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:Cq(!0)};class Eq extends wq{constructor(t,e){var i;super(t,e),this.type=n.dataZoom,this.name=n.dataZoom,this.transformerConstructor=Tq,this.specKey="dataZoom",this.layoutZIndex=aD.DataZoom,this.layoutLevel=oD.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,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=this._isHorizontal?0:this._middleHandlerSize,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._getPreviewStateScale(),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._getPreviewStateScale(),n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"filter"}_handleChange(t,e,i,s){if(super._handleChange(t,e,i),this._shouldChange)if(i&&this._component)this._component.setStartAndEnd(t,e);else{const i=this._relatedAxisComponent,n=yq(t,this._stateScale,xq(i,this._isHorizontal)),r=yq(e,this._stateScale,xq(i,this._isHorizontal));if(!u(n)||!u(r))return;this._start=t,this._end=e;(c(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,n,r):this._handleStateChange(n,r,s))&&this.event.emit(bL.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:t,end:e,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){this._data.getDataView().reRunAllTransform();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new GB),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(xq(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=xq(t,this._isHorizontal),this.effect.onZoomChange())}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,d=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+d,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+d),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);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(),d(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=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize),d(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=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize);const u=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=u?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new GB;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(xq(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[$(e),X(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!eB(t.type)||e[0]!==Y(e))&&(!sB(t.type)||1!==(i=e,i&&_(i)?Array.from(new Set(G(i))):i).length);var i}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_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:x(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:x(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_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._computeWidth(),height:this._computeHeight()},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:u(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,isReverse:xq(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=this._isHorizontal?this._stateScale:this._valueScale,i=this._isHorizontal?this._valueScale:this._stateScale,s=this._isScaleValid(e)&&this._isScaleValid(i)&&!1!==this._spec.showBackgroundChart,n=this._getAttrs(s),r=this._relatedAxisComponent;if(this._component)this._component.setAttributes(n),t&&(this._component.setPreviewData(this._data.getDataView().latestData),s&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>yq(t,this._stateScale,xq(r,this._isHorizontal))))));else{const t=this.getContainer();this._component=new uP(n),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?s&&this._component.setPreviewPointsY1(this._dataToPositionY2):s&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>yq(t,this._stateScale,xq(r,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:pL(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:pL(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:pL(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:pL(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:pL(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:pL(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:pL(g.style)},selectedBackgroundStyle:pL(this._spec.selectedBackground.style),dragMaskStyle:pL(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:tI(pL(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},pL(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:tI(pL(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},pL(null===(d=m.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}=bF(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(xq(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}}Eq.type=n.dataZoom,Eq.transformerConstructor=Tq,Eq.builtInTheme={dataZoom:Bq},Eq.specKey="dataZoom";const Pq=()=>{eI.registerComponent(Eq.type,Eq)},Rq={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}};class Oq extends wq{constructor(t,e){var i;super(t,e),this.type=n.scrollBar,this.name=n.scrollBar,this.specKey="scrollBar",this.layoutZIndex=aD.DataZoom,this.layoutLevel=oD.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"axis"}_handleChange(t,e,i){super._handleChange(t,e,i);const s=eO(this._start,t)&&eO(this._end,e);if(this._shouldChange&&(!s||!1===this._spec.realTime)){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;const s=yq(t,this._stateScale,!1),n=yq(e,this._stateScale,!1);(c(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,s,n):this._handleStateChange(s,n))&&this.event.emit(bL.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:x(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:x(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r,a;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:u(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,minSliderSize:null===(a=this._spec)||void 0===a?void 0:a.minSliderSize},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new dM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return d(i)||(s.padding=i),E(null==t?void 0:t.style)||(s.railStyle=pL(t.style)),E(null==e?void 0:e.style)||(s.sliderStyle=pL(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}Oq.type=n.scrollBar,Oq.builtInTheme={scrollBar:Rq},Oq.specKey="scrollBar";const Iq=()=>{eI.registerComponent(Oq.type,Oq)},Lq=(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}),G(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r},Dq=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),Fq={title:{visible:!0,autoLimit:!1,autoFit:!1,style:Dq("l1FontSize","primaryFontColor")},content:{visible:!0,style:Dq("l2FontSize","tertiaryFontColor")}};class zq extends mj{constructor(){super(...arguments),this.type=n.indicator,this.name=n.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=aD.Indicator,this.layoutLevel=oD.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return xF(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=G(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(G(this._spec.regionId),G(this._spec.regionIndex))}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(fL(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(fL(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){TL(this._option.dataSet,"indicatorFilter",Lq);const t=new Ba(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 LD(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const e=this._regions[0],{width:i,height:s}=e.getLayoutRect(),{x:n,y:r}=e.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,p=t(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return G(o).forEach((t=>{const e=tI({},this._theme.content,t);g.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({},uL(j(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?WO(l,this._computeLayoutRadius()):0,dy:h?WO(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!u(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},uL(j(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},p)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)N(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new CR(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":c(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.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}zq.type=n.indicator,zq.builtInTheme={indicator:Fq},zq.specKey="indicator";const jq=()=>{eI.registerComponent(zq.type,zq)},Hq=["sum","average","min","max","variance","standardDeviation","median"];function Vq(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=X(s);return er}function Nq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return x(t.x)&&Vq(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=DO(t.x)?Yq(t.x,n)+r.x:Xq(l.getXAxisHelper(),[t.x])+r.x,h}function Wq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return x(t.y)&&Vq(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=DO(t.y)?Yq(t.y,n)+r.y:Xq(l.getYAxisHelper(),[t.y])+r.y,h}function Uq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return x(t.angle)&&Vq(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)),Xq(a.angleAxisHelper,[t.angle])}function Gq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return x(t.radius)&&Vq(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)),Xq(a.radiusAxisHelper,[t.radius])}function Yq(t,e){return Number(t.substring(0,t.length-1))*e/100}function Xq(t,e){const i=t.getScale(0);return eB(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function $q(t){return Hq.includes(t)}function Kq(t,e,i,s,n,r=!1){const a=e.getRegion(),o=a.getLayoutStartPoint(),l=i.getRegion(),h=l.getLayoutStartPoint(),c=Math.abs(Math.min(o.x,h.x)-Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width)),d=Math.abs(Math.min(o.y,h.y)-Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height)),p={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},g=[],f=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper(),v=s.getYAxisHelper(),_=m.getScale(0).domain(),y=v.getScale(0).domain(),b=r&&!m.isContinuous&&!!m.getBandwidth,x=r&&!v.isContinuous&&!!v.getBandwidth,S={min:null,max:null},k={min:null,max:null};return f.forEach((t=>{const e=u(t.x),i=u(t.y);let s,r;if(e&&i)s=Nq(t,_,n,p,c,o),r=Wq(t,y,n,p,d,o),qq(s,b,S,g.length),qq(r,x,k,g.length),g.push([{x:s,y:r}]);else if(e){s=Nq(t,_,n,p,c,o),r=Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height);const e=Math.min(o.y,h.y);qq(s,b,S,g.length),g.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(o.x,h.x),r=Wq(t,y,n,p,d,o);const e=Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width);qq(r,x,k,g.length),g.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(g,m,v,S,k),g}function qq(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=u(t.angle),i=u(t.radius);if(e&&i){const e=Uq(t,l,n,r),i=Gq(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=Uq(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=Gq(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function Jq(t,e,i,s){const n=[],r=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,a=_(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:f}=u.getLayoutRect();let m=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(m=DO(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=DO(i)?Number(i.substring(0,i.length-1))*f/100:i)}const _=d.getXAxisHelper().getScale(0).domain(),y=d.getYAxisHelper().getScale(0).domain(),b=G(t.x),S=G(t.y);1===b.length&&x(b[0])&&Vq(_,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===S.length&&x(S[0])&&Vq(y,S[0],i)&&(null===(c=null===(h=d.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",S[0])),n.push({x:Xq(d.getXAxisHelper(),b)+p.x+m,y:Xq(d.getYAxisHelper(),S)+p.y+v})})),n}function Qq(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=G(t.angle),u=G(t.radius);1===d.length&&x(d[0])&&Vq(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&&x(u[0])&&Vq(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:Xq(l.angleAxisHelper,d),radius:Xq(l.radiusAxisHelper,u)})})),s}function tZ(t,e,i){let{x:s,y:n}=t;return DO(s)&&(s=Yq(s,e)),DO(n)&&(n=Yq(n,i)),{x:s,y:n}}function eZ(t,e,i){let s;if(s=c(t)?G(t(e.getData().getLatestData(),e)):G(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=tZ(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>tZ(t,n,r)))}function iZ(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 sZ(e,i,s){const{labelBackground:n={},style:r,shape:a}=e,o=t(e,["labelBackground","style","shape"]);if(!1!==e.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},pL(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},rZ(pL(n.style),i,s)),u(n.padding)&&(t.padding=ni(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=rZ(pL(r),i,s)),t}return{visible:!1}}function nZ(t,e,i){for(const s in t)c(t[s])&&(t[s]=t[s](e,i));return t}function rZ(t,e,i){return c(t)?t(e,i):t}function aZ(t,e){return c(t)?t(e):t}function oZ(t,e,i){return u(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 lZ(t){return{isXProcess:u(t.x),isYProcess:u(t.y),isX1Process:u(t.x1),isY1Process:u(t.y1),isAngleProcess:u(t.angle),isRadiusProcess:u(t.radius),isAngle1Process:u(t.angle1),isRadius1Process:u(t.radius1),isCoordinatesProcess:u(t.coordinates),isValidProcess:u(t.process)}}function hZ(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=lZ(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:h&&(!c||"process"in t&&"xy"in t.process)}}function cZ(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=lZ(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function dZ(t){return{doXYProcess:u(t.x)&&u(t.y),doPolarProcess:u(t.angle)&&u(t.radius),doGeoProcess:u(t.areaName)}}function uZ(e,i){let s;if(i.coordinates){const e=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=e,o=t(e,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(c(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=G(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;u(r)&&(c=G(i)[r]),n&&G(i).includes(n)&&(c=n);let d=s;u(l)&&(d=G(s)[l]),a&&G(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),v(t[c])&&$q(t[c])?h.x={field:c,aggrType:t[c]}:h.x=G(c).map((e=>t[e])),v(t[d])&&$q(t[d])?h.y={field:d,aggrType:t[d]}:h.y=G(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;u(r)&&(a=G(s)[r]),n&&G(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),v(t[a])&&$q(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=G(a).map((e=>t[e])),v(t[l])&&$q(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=G(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((t=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(u(t.x)){const s=t.x;_(s)?i.x=s.map((i=>gZ(i,e,t))):i.x=gZ(s,e,t)}if(u(t.y)){const s=t.y;_(s)?i.y=s.map((i=>gZ(i,e,t))):i.y=gZ(s,e,t)}if(u(t.angle)){const s=t.angle;_(s)?i.angle=s.map((i=>gZ(i,e,t))):i.angle=gZ(s,e,t)}if(u(t.radius)){const s=t.radius;_(s)?i.radius=s.map((i=>gZ(i,e,t))):i.radius=gZ(s,e,t)}if(u(t.areaName)){const s=t.areaName;i.areaName=gZ(s,e,t)}t.getRefRelativeSeries&&(i.getRefRelativeSeries=t.getRefRelativeSeries),n.push(i)})),n}const pZ={min:(t,e)=>iO(t[0].latestData,e.field),max:(t,e)=>sO(t[0].latestData,e.field),sum:function(t,e){return nO(t[0].latestData,e.field)},average:function(t,e){return rO(t[0].latestData,e.field)},variance:function(t,e){return aO(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(aO(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 gZ(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(c(t))return t(a,o,l,s,n,r);if(f(t)){const{aggrType:i,field:s}=t;return pZ[i](e,{field:s})}return t}function fZ(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 mZ extends mj{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){return xF(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_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 v(e)&&$q(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){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];G(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Ca;return e.registerParser("array",i),new Ba(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(u(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)))}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=uO(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){d(this._spec.offsetX)||(this._layoutOffsetX=zO(this._spec.offsetX,e.width,e)),d(this._spec.offsetY)||(this._layoutOffsetY=zO(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return N(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();TL(this._option.dataSet,"markerAggregation",uZ),TL(this._option.dataSet,"markerFilter",fZ);const i=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),i.target.on("change",(()=>{this._markerLayout()})),this._markerData=i}}function vZ(t,e){return function(t,e,i){const{predict:s}=Lt(t,(t=>t[e]),(t=>t[i])),n=iO(t,e),r=sO(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class _Z extends mZ{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=aD.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=hZ(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;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=G(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={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},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:rZ(pL(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>sZ(t,this._markerData,this._markAttributeContext))),state:{line:nZ(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:nZ(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:nZ(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return nZ(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return nZ(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:rZ(pL(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:rZ(pL(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||G(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=iZ([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=G((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=G(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,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}=hZ(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;TL(this._option.dataSet,"markerAggregation",uZ),TL(this._option.dataSet,"markerRegression",vZ),TL(this._option.dataSet,"markerFilter",fZ);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new Ba(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",(()=>{this._markerLayout()})),this._markerData=m}}_Z.specKey="markLine";const yZ=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),bZ={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"}}},refY:5},xZ={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:yZ(!1),endSymbol:yZ(!0),label:bZ};class SZ extends _Z{constructor(){super(...arguments),this.type=n.markLine,this.name=n.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new ZP(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=u(e.coordinates),o=u(e.process),l=o&&u(e.process.x),h=o&&u(e.process.y),c=u(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:p,doYProcess:g,doXYY1Process:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:_}=hZ(e);let y=[];if(p||f||g||m||v||a&&l||a&&h){const t=Kq(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=Jq(i,r,d,e.coordinatesOffset):c&&(y=eZ(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n;const r=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const n=this._startRelativeSeries,a=this._endRelativeSeries,{multiSegment:o,mainSegmentIndex:l}=this._spec.line||{},{connectDirection:h,expandDistance:c=0}=this._spec;let d;if(DO(c)){const t=n.getRegion(),e=t.getLayoutStartPoint(),i=a.getRegion(),s=i.getLayoutStartPoint();if("bottom"===h||"top"===h){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));d=Number(c.substring(0,c.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));d=Number(c.substring(0,c.length-1))*n/100}}else d=c;const{points:p,limitRect:g}=r;if(!p||p.length<2)return void(null===(t=this._markerComponent)||void 0===t||t.setAttributes(r));const f=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}(p[0],p[1],h,d);let m;m=o&&u(l)?{position:"middle",autoRotate:!1}: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)}:{}}(p[0],p[1],h,d));const v=G((null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{}).label),_=G(r.label),y=G(this._spec.label);null===(s=this._markerComponent)||void 0===s||s.setAttributes({points:o?[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]]]:f,label:_.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=m.dx)&&void 0!==i?i:0,h=null!==(s=m.dy)&&void 0!==s?s:0;const c=null!==(n=y[e])&&void 0!==n?n:y[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),m),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=v[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:g,multiSegment:o,mainSegmentIndex:l,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(n=this._markerComponent)||void 0===n||n.setAttributes(r)}_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}=hZ(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 Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&u(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&u(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&u(n.process.xy)){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}}}SZ.type=n.markLine,SZ.coordinateType="cartesian",SZ.builtInTheme={markLine:xZ};const kZ=()=>{eI.registerComponent(SZ.type,SZ),qP()};class AZ extends _Z{constructor(){super(...arguments),this.type=n.polarMarkLine,this.name=n.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=hZ(this._spec);return e||i?new tR(t):new ZP(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}=hZ(e);let p=[],g={};const f={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=Zq(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:f}:{points:p.map((t=>le(f,t.radius,t.angle)))}}else u&&(p=Qq(i,r,a),g={points:p.map((t=>le(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=hZ(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}}}AZ.type=n.polarMarkLine,AZ.coordinateType="polar",AZ.builtInTheme={polarMarkLine:xZ};const MZ=()=>{eI.registerComponent(AZ.type,AZ),tR._animate=PP,qP()};class wZ extends mj{get orient(){return this._orient}constructor(t,e){super(t,e),this.type=n.title,this.specKey=n.title,this.layoutType="normal",this.layoutZIndex=aD.Title,this.layoutLevel=oD.Title,this._orient="top",this._orient=LO(t.orient)?t.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return xF(t,this.specKey,n.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}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;if(!1===this._spec.visible)return{visible:!1};const a=this.getLayoutRect(),o=zO(this._spec.width,a.width,null,a.width),l=zO(this._spec.maxWidth,a.width,null,a.width),h=Math.max(Math.min(o,l,a.width),0),c=u(this._spec.text)&&""!==this._spec.text,d=u(this._spec.subtext)&&""!==this._spec.subtext,p=Object.assign(Object.assign({},j(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:c?this._spec.text:void 0,subtextType:null!==(e=this._spec.subtextType)&&void 0!==e?e:"text",subtext:d?this._spec.subtext:void 0,x:null!==(i=this._spec.x)&&void 0!==i?i:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:h,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(n=this._spec.align)&&void 0!==n?n:"left",verticalAlign:null!==(r=this._spec.verticalAlign)&&void 0!==r?r:"top",textStyle:Object.assign({maxLineWidth:h},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:h},this._spec.subtextStyle)});if(c&&(p.textStyle.width=h),d&&(p.subtextStyle.width=h),u(this._spec.width)){const t=Math.max(Math.min(o,a.width),0);c?p.textStyle.width=t:delete p.textStyle.width,d&&(p.subtextStyle.width=t)}return p}_createOrUpdateTitleComponent(t){if(this._titleComponent)N(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new wR(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}}wZ.type=n.title,wZ.specKey=n.title,wZ.builtInTheme={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"}}}};const TZ=()=>{eI.registerComponent(wZ.type,wZ)};class CZ extends mZ{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=aD.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=cZ(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=G(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={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:rZ(pL(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>sZ(t,this._markerData,this._markAttributeContext))),state:{area:nZ(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>nZ(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return nZ(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||G(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=iZ([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=G(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=G(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,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}=cZ(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}CZ.specKey="markArea";const BZ={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"}}}}};class EZ extends CZ{constructor(){super(...arguments),this.type=n.markArea,this.name=n.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new QP(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=cZ(i),d=u(i.positions),p=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=Kq(s,n,r,a,p,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=Kq(s,n,r,a,p,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=Jq(s,a,p,i.coordinatesOffset):d&&(f=eZ(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=cZ(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}}}EZ.type=n.markArea,EZ.coordinateType="cartesian",EZ.builtInTheme={markArea:BZ};const PZ=()=>{eI.registerComponent(EZ.type,EZ),JP()};class RZ extends CZ{constructor(){super(...arguments),this.type=n.polarMarkArea,this.name=n.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=cZ(this._spec);return i||e||s?new eR(t):new QP(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}=cZ(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=Zq(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=Qq(i,r,c),u={points:d.map((t=>le(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=cZ(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}}}RZ.type=n.polarMarkArea,RZ.coordinateType="polar",RZ.builtInTheme={polarMarkArea:BZ};const OZ=()=>{eI.registerComponent(RZ.type,RZ),eR._animate=OP,JP()},IZ=t=>pL(Object.assign({},t)),LZ=t=>Object.assign(Object.assign({},t),{style:Object.assign({},pL(t.style))}),DZ=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=IZ(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=IZ(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:{},pL(Object.assign({},y)));var y;const b=LZ(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=LZ(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=LZ(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),k=LZ(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),A=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:k})});return t.visible||(A.controller.visible=!1,A.slider.visible=!1),A},FZ=t=>"left"===t||"right"===t,zZ=t=>"top"===t||"bottom"===t,jZ={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:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,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:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class HZ extends mj{constructor(){super(...arguments),this.layoutZIndex=aD.Player,this.layoutLevel=oD.Player,this.specKey="player",this.type=n.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({},DZ(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({},DZ(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?N(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new NR(t):this._playerComponent=new GR(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(...G(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...G(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...G(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...G(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=FZ(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=FZ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...G(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...G(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...G(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...G(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.autoPlayCallback=()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.off(bL.rendered,this.autoPlayCallback),this._option.globalInstance.on(bL.rendered,this.autoPlayCallback),this._playerComponent.addEventListener(DR.end,(()=>{var t;this.event.emit(bL.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===(t=this._spec)||void 0===t?void 0:t.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(DR.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(DR.backward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(bL.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(DR.forward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(bL.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(DR.play,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(bL.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(DR.pause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(bL.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}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=FZ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=zZ(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}_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 x(this._spec.width)?Math.min(t.width,Number(this._spec.width)):FZ(this._orient)?this._maxSize():t.width}_computeHeight(t){return x(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):zZ(this._orient)?this._maxSize():t.height}_computeDx(t){return FZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return zZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(t){const e=this._specs[t];this._option.globalInstance.updateFullData(e.data),this.event.emit(bL.playerChange,{model:this,value:{spec:e,index:t,specs:this._specs}})}release(){this._option.globalInstance.off(bL.rendered,this.autoPlayCallback)}}HZ.builtInTheme={player:jZ},HZ.specKey="player",HZ.type=n.player;const VZ=()=>{eI.registerComponent(HZ.type,HZ)};class NZ extends mj{constructor(t,e){super(t,e),this.type=n.label,this.name=n.label,this.layoutType="none",this.layoutZIndex=aD.Label,this._regions=e.getRegionsInIndex(e.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,N(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=AO({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:G(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==hD.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}))})),f(a.overlap)&&d(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}NZ.type=n.label;class WZ extends QN{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}render(){}}WZ.type="text",WZ.constructorType="label";const UZ=()=>{tW(),eI.registerMark(WZ.constructorType,WZ)};class GZ extends fj{_initTheme(t,e){return{spec:t,theme:this._theme}}}class YZ extends NZ{constructor(t,e){super(t,e),this.type=n.label,this.name=n.label,this.specKey="label",this.transformerConstructor=GZ,this.layoutZIndex=aD.Label,this._layoutRule=t.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,r)=>{(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:n.label,specInfoPath:["component",this.specKey,r],regionIndexes:[r]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(bL.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(_L.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(_L.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),cO(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{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&u(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(u(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{G(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((t=>{t.forEach((t=>{var e,i;const{labelMark:s,labelSpec:n,series:r}=t;if(this.initMarkStyleWithSpec(s,n),c(null==n?void 0:n.getStyleHandler)){const t=n.getStyleHandler(r);null==t||t.call(r,s,n)}(null===(i=null===(e=s.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&s.setAttribute("stroke",r.getColorAttribute(),"normal",lD.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,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=tI({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},_N(h,r),Object.assign(Object.assign(Object.assign({},j(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[WI])):t=>t.filter((t=>t.data[NI]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?yN(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=_(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=G(i())[t])}))}return e}}YZ.type=n.label,YZ.specKey="label",YZ.transformerConstructor=GZ;class XZ extends NZ{constructor(){super(...arguments),this.type=n.totalLabel,this.name=n.totalLabel,this.specKey="totalLabel",this.layoutZIndex=aD.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 r;null===(r=t.seriesIndexes)||void 0===r||r.forEach((t=>{const{spec:r}=e.series[t],a=r[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:n.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()}reInit(t){super.reInit(t),this._initTextMark()}_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 t;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[HI]},"normal",lD.Default);const e=this._getSeries();null===(t=e.initTotalLabelMarkStyle)||void 0===t||t.call(e,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return tI({textStyle:{pickable:!0===this._spec.interactive},position:$Z(t,this._baseMark.type,a),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=>"bottom"===a?t.data[WI]:t.data[NI]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>yN({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function $Z(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}XZ.type=n.totalLabel,XZ.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},XZ.specKey="totalLabel";const KZ=()=>{eI.registerGraphicComponent(XZ.type,(t=>new $E(t))),UZ(),bj(),eI.registerComponent(XZ.type,XZ,!0)};class qZ extends mZ{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=aD.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=dZ(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,k,A,M,w,T,C,B,E,P,R,O,I;const{itemContent:L={},itemLine:D={},targetSymbol:F={}}=this._spec,j=L,{type:H="text",text:V,symbol:N,image:W,richText:U,customMark:G,textStyle:Y,symbolStyle:X,imageStyle:$,richTextStyle:K,customMarkStyle:q,style:Z={},state:J={}}=j,Q=t(j,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let tt=null,et=null,it={};"text"===H?(tt=null!==(e=null==V?void 0:V.state)&&void 0!==e?e:J,it={dx:0,dy:0},et=sZ(Object.assign(Object.assign({},V),{style:z(it,null!==(n=null!==(s=null!==(i=null==V?void 0:V.style)&&void 0!==i?i:null==V?void 0:V.textStyle)&&void 0!==s?s:Y)&&void 0!==n?n:Z)}),this._markerData,this._markAttributeContext)):"richText"===H?(tt=null!==(r=null==U?void 0:U.state)&&void 0!==r?r:J,it={width:100,height:100},et=rZ(z(it,null!==(o=null!==(a=null==U?void 0:U.style)&&void 0!==a?a:K)&&void 0!==o?o:Z),this._markerData,this._markAttributeContext)):"symbol"===H?(tt=null!==(l=null==N?void 0:N.state)&&void 0!==l?l:J,it={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},et=pL(rZ(z(it,null!==(c=null!==(h=null==N?void 0:N.style)&&void 0!==h?h:X)&&void 0!==c?c:Z),this._markerData,this._markAttributeContext))):"image"===H?(tt=null!==(d=null==W?void 0:W.state)&&void 0!==d?d:J,it={width:80,height:80},et=rZ(z(it,null!==(p=null!==(u=null==W?void 0:W.style)&&void 0!==u?u:$)&&void 0!==p?p:Z),this._markerData,this._markAttributeContext)):"custom"===H&&(tt=null!==(g=null==G?void 0:G.state)&&void 0!==g?g:J,et=rZ(null!==(m=null!==(f=null==G?void 0:G.style)&&void 0!==f?f:q)&&void 0!==m?m:Z,this._markerData,this._markAttributeContext));const st={zIndex:this.layoutZIndex,interactive:null===(v=this._spec.interactive)||void 0===v||v,hover:null===(_=this._spec.interactive)||void 0===_||_,select:null===(y=this._spec.interactive)||void 0===y||y,position:{x:0,y:0},clipInRange:null!==(b=this._spec.clip)&&void 0!==b&&b,itemContent:Object.assign(Object.assign({type:H,offsetX:aZ(L.offsetX,this._relativeSeries.getRegion()),offsetY:aZ(L.offsetX,this._relativeSeries.getRegion())},Q),{style:rZ(et,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(x=F.offset)&&void 0!==x?x:0,visible:null!==(S=F.visible)&&void 0!==S&&S,size:null!==(k=F.size)&&void 0!==k?k:20,style:rZ(F.style,this._markerData,this._markAttributeContext)},state:{line:nZ(null!==(M=null===(A=this._spec.itemLine.line)||void 0===A?void 0:A.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),lineStartSymbol:nZ(null!==(T=null===(w=this._spec.itemLine.startSymbol)||void 0===w?void 0:w.state)&&void 0!==T?T:{},this._markerData,this._markAttributeContext),lineEndSymbol:nZ(null!==(B=null===(C=this._spec.itemLine.endSymbol)||void 0===C?void 0:C.state)&&void 0!==B?B:{},this._markerData,this._markAttributeContext),itemContent:nZ(tt,this._markerData,this._markAttributeContext),textBackground:nZ(null===(P=null===(E=this._spec.itemContent.text)||void 0===E?void 0:E.labelBackground)||void 0===P?void 0:P.state,this._markerData,this._markAttributeContext),targetItem:nZ(null!==(O=null===(R=this._spec.targetSymbol)||void 0===R?void 0:R.state)&&void 0!==O?O:{},this._markerData,this._markAttributeContext)},animation:null!==(I=this._spec.animation)&&void 0!==I&&I,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:nt,line:rt={}}=D,at=t(D,["visible","line"]);st.itemLine=!1!==nt?Object.assign(Object.assign({},at),{visible:!0,lineStyle:pL(rt.style)}):{visible:!1};return new sR(st)}_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}=iZ([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:oZ(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:oZ(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}=dZ(t);(u(t.coordinate)||e||i||s)&&this._initCommonDataView()}}qZ.specKey="markPoint";const ZZ={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}};class JZ extends qZ{constructor(){super(...arguments),this.type=n.markPoint,this.name=n.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=u(s.x)&&u(s.y),o=u(s.coordinate),l=u(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=Kq(n,r,r,r,h))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=Jq(n,r,h,s.coordinatesOffset)[0]:l&&(c=eZ(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=dZ(t),i=u(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}}}JZ.type=n.markPoint,JZ.coordinateType="cartesian",JZ.builtInTheme={markPoint:ZZ};const QZ=()=>{eI.registerComponent(JZ.type,JZ),iR()};class tJ extends qZ{constructor(){super(...arguments),this.type=n.polarMarkPoint,this.name=n.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=Zq(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:le({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}])]}}}tJ.type=n.polarMarkPoint,tJ.coordinateType="polar",tJ.builtInTheme={polarMarkPoint:ZZ};const eJ=()=>{eI.registerComponent(tJ.type,tJ),iR()};class iJ extends qZ{constructor(){super(...arguments),this.type=n.geoMarkPoint,this.name=n.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=>{u(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}])]}}}iJ.type=n.geoMarkPoint,iJ.coordinateType="geo",iJ.builtInTheme={geoMarkPoint:ZZ};const sJ=()=>{eI.registerComponent(iJ.type,iJ),iR()},nJ="inBrush",rJ="outOfBrush";class aJ extends mj{constructor(){super(...arguments),this.layoutType="none",this.type=n.brush,this.name=n.brush,this.specKey="brush",this.layoutZIndex=aD.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return xF(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const t=this._transformBrushedMarkAttr(this._spec.inBrush),e=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((i=>{i.getActiveMarks().forEach((s=>{s&&(i.setMarkStyle(s,Object.assign({},t),nJ,lD.Series),i.setMarkStyle(s,Object.assign({},e),rJ,lD.Series))}))}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&G(t).includes(n.userId.toString())||e&&G(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()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){u(this._spec.regionId)||u(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(G(this._spec.regionId),G(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(u(this._spec.brushLinkSeriesId)||u(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(G(this._spec.brushLinkSeriesId),G(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){u(this._spec.axisId)?G(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):u(this._spec.axisIndex)?G(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)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return N(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild()}_shouldEnableInteractive(){return!1!==this.getOption().getCompiler().getOption().interactive}_createBrushComponent(t,e){var i,s;const n=this._getBrushInteractiveAttr(t),r=new KR(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:pL(null===(i=this._spec)||void 0===i?void 0:i.style)},n),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));r.id=null!==(s=this._spec.id)&&void 0!==s?s:`brush-${this.id}`,this.getContainer().add(r),this._brushComponents.push(r),this._cacheInteractiveRangeAttrs.push(n),r.addEventListener(WR.brushActive,(i=>{this._initMarkBrushState(e,rJ),this._emitEvent(bL.brushActive,t,i)})),r.addEventListener(WR.drawStart,(e=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(t,!0),this._emitEvent(bL.brushStart,t,e)})),r.addEventListener(WR.moveStart,(e=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(t,!0),this._emitEvent(bL.brushStart,t,e)})),r.addEventListener(WR.drawing,(e=>{this._setRegionMarkPickable(t,!1),this._handleBrushChange(t,e),this._emitEvent(bL.brushChange,t,e)})),r.addEventListener(WR.moving,(e=>{this._setRegionMarkPickable(t,!1),this._handleBrushChange(t,e),this._emitEvent(bL.brushChange,t,e)})),r.addEventListener(WR.brushClear,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(t,!0),this._initMarkBrushState(e,""),this._emitEvent(bL.brushClear,t,i)})),r.addEventListener(WR.drawEnd,(i=>{var s;this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(t,!0);const{operateMask:n}=i.detail,{updateElementsState:r=!0}=this._spec;if(null===(s=this._spec)||void 0===s?void 0:s.onBrushEnd)!0===this._spec.onBrushEnd(i)?(this.clearGraphic(),this._initMarkBrushState(e,""),this._emitEvent(bL.brushClear,t,i)):(this._spec.onBrushEnd(i),this._emitEvent(bL.brushEnd,t,i));else{const e=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&e.length>0||!r)&&this._setAxisAndDataZoom(n,t),this._emitEvent(bL.brushEnd,t,i)}})),r.addEventListener(WR.moveEnd,(e=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(t,!0);const{operateMask:i}=e.detail,{updateElementsState:s=!0}=this._spec,n=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&n.length>0||s)&&this._setAxisAndDataZoom(i,t),this._emitEvent(bL.brushEnd,t,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],interactive:this._shouldEnableInteractive()}}_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({},pL(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail;this._operateMask=i;const{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e,i){var s;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},vchart:null===(s=this._option)||void 0===s?void 0:s.globalInstance,event:i})}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(i.addState(nJ,!0),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(i.removeState(nJ),i.addState(rJ,!0),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:_=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(_.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(i.addState(nJ,!0),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(i.removeState(nJ),i.addState(rJ,!0),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Be(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;s.removeState(nJ),s.removeState(rJ),i&&s.addState(i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_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?"width":"height",p=r?o:h,g=r?l:c;if(this._axisDataZoomMap[t.id]){const i=this._axisDataZoomMap[t.id],s=(p-e.getLayoutStartPoint()[d])/e.getLayoutRect()[u],n=(g-e.getLayoutStartPoint()[d])/e.getLayoutRect()[u],r=this._stateClamp(s-a),o=this._stateClamp(n+a);i.setStartAndEnd(Math.min(r,o),Math.max(r,o),["percent","percent"]),this._zoomRecord.push({operateComponent:i,start:r,end:o,startValue:yq(r,i.stateScale,xq(i.relatedAxisComponent,i.isHorizontal)),endValue:yq(o,i.stateScale,xq(i.relatedAxisComponent,i.isHorizontal))})}else{const i=t.getScale().range(),s=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],r=Y(i){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}clearBrushStateAndMask(){this._relativeRegions.forEach(((t,e)=>{this._initMarkBrushState(e,""),this._brushComponents[e].children[0].removeAllChild()}))}}aJ.type=n.brush,aJ.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},aJ.specKey="brush";const oJ=()=>{eI.registerComponent(aJ.type,aJ)};class lJ extends mj{constructor(){super(...arguments),this.type=n.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=aD.CustomMark,this.layoutLevel=oD.CustomMark}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;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${MI}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:u(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(u(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=ZF({},JF(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(d(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)}))),u(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return N(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,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 je).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new je;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),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}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}lJ.type=n.customMark,lJ.specKey="customMark";const hJ=()=>{eI.registerComponent(lJ.type,lJ)};class cJ{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}:c(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){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=>{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&&u(e.modelId)){if(u(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&u(e.modelKey)&&"modelIndex"in e&&u(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=>dJ(t))),a=n.filter((t=>!dJ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>dJ(t))),h=o.filter((t=>!dJ(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 dJ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}cJ.type="grid";const uJ=()=>{eI.registerLayout(cJ.type,cJ)},pJ=()=>{yo.load(nw)},gJ="vchart-tooltip",fJ=`${gJ}-container`,mJ=`${gJ}-title`,vJ=`${gJ}-content-box`,_J={offsetX:10,offsetY:10},yJ="99999999999999";function bJ(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const xJ=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,SJ=t=>v(t)&&""!==(null==t?void 0:t.trim())||x(t)?bJ(t):"",kJ=(t,e)=>{let i;if(u(t))if(x(t))i=t;else if(c(t)){const s=t(e);x(s)&&(i=s)}return i},AJ={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},MJ=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=AJ[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class wJ extends Uz{constructor(){super(...arguments),this._visible=!0,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._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,d,g;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const _=e.event,{activeType:y,data:b}=t,S="dimension"===y?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:M}=this._option,w=m[y],T=wF(null==w?void 0:w.position,b,e),C=null!==(r=wF(null==w?void 0:w.positionMode,b,e))&&void 0!==r?r:"mark"===y?"mark":"pointer",{width:B=0,height:E=0}=null!=i?i:{},P="canvas"===m.renderMode,R=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),O=null!==(o=null==R?void 0:R.width)&&void 0!==o?o:wI,I=null!==(l=null==R?void 0:R.height)&&void 0!==l?l:TI;let L=!1;const D={width:0,height:0};let F,z={x:0,y:0},j={x:0,y:0},H=1,V=1;const N=Uy(this._env);if(N&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=O,D.height=I),N&&!P){const t=this._getParentElement(m);j=null!==(d=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==d?d:v;const e=null!==(g=this._compiler.getCanvas())&&void 0!==g?g:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-j.x,y:F.y-j.y},H=xJ(e,F),V=xJ(t,j)}const W=V/H,U={},G={x:T,y:T},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?A:M;if("mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==S?void 0:S.series)||void 0===r?void 0:r.coordinate)&&S.datum&&S.datum.length){L=!0;const t=f(S,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(L){const e=Y[n][0],i="x"===n?B:E;switch(MJ(t,n)){case-2:U[e]=a-i*W-c;break;case-1.5:U[e]=a+c;break;case 0:U[e]=(a+o)/2-i*W/2;break;case-1:U[e]=(a+o)/2-i*W-c;break;case 1:U[e]=(a+o)/2+c;break;case 1.5:U[e]=o-i*W-c;break;case 2:U[e]=o+c}}},$=["x","y"];if(p(T))if(p(K=T)&&(u(K.left)||u(K.right)||u(K.top)||u(K.bottom))){const{left:t,right:e,top:i,bottom:s}=T;U.left=kJ(t,_),U.top=kJ(i,_),U.right=kJ(e,_),U.bottom=kJ(s,_)}else(t=>p(t)&&(u(t.x)||u(t.y)))(T)&&$.forEach((t=>{const e=T[t];x(e)||c(e)?U[Y[t][0]]=kJ(e,_):X(e,t)}));else u(T)&&(X({orient:T,mode:C},"x"),X({orient:T,mode:C},"y"));var K;const q={x:null,y:null};return $.forEach((t=>{var e;const i="x"===t?B:E,s="x"===t?O:I,n="x"===t?A:M,r=MJ(G[t],t);if(k(U[Y[t][0]]))q[t]=U[Y[t][0]];else if(k(U[Y[t][1]]))q[t]=s-i*W-U[Y[t][1]];else{const e="x"===t?_.canvasX:_.canvasY;q[t]=r>0?e+n:0===r?e-i*W/2:e-i*W-n}q[t]*=H,N&&(q[t]+=z[t]),q[t]/=V;const a="x"===t?D.width:D.height,o=m.confine?-(j[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/H)/V:-j[t]/V,l=a/V+o-i;2!==r&&q[t]l&&(q[t]=l)):-2!==r&&q[t]>l&&(L?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]u(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",CJ=(t={},e={})=>{var i,s;u(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return u(n)&&(e.color=n),u(t.fontWeight)&&(e.fontWeight=t.fontWeight),u(t.textAlign)&&(e.textAlign=t.textAlign),u(t.fontSize)&&(e.fontSize=TJ(t.fontSize)),u(t.maxWidth)&&(e.maxWidth=TJ(t.maxWidth)),t.multiLine||u(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},BJ=(t={})=>{const{lineHeight:e}=t;return t.fontSize?zO(e,t.fontSize):0},EJ=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return u(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),u(r)&&(o=ni(r),a.padding=TJ(o)),{panelStyle:a,panelPadding:o}};function PJ(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}const RJ=t=>{eI.registerComponentPlugin(t.type,t)};class OJ extends wJ{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(OJ.type),this.type=WH.dom,this._tooltipContainer=null==Wy?void 0:Wy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(Wy&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:u,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=EJ(l),_={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(_.marginBottom=`${g}px`);const y={width:TJ(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=CJ(h),x=CJ(u),S=CJ(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),d(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),d(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),d(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),y[A]=TJ(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=TJ(null!==(s=u.spacing)&&void 0!==s?s:26),S[A]=TJ(null!==(n=p.spacing)&&void 0!==n?n:0);const M=Math.max(BJ(p),BJ(u));return _.lineHeight=M>0?`${M}px`:"20px",{panelPadding:v,row:_,panel:m,title:b,shape:y,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(mJ))),l=a.find((t=>t.className.includes(vJ)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(mJ),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(PJ(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${gJ}-column`),e.classList.add(`${gJ}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(vJ),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];PJ(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));PJ(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${gJ}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=SJ(e.key),e.keyStyle&&CJ(e.keyStyle,l)):"value"===i?(o.innerHTML=SJ(e.value),e.valueStyle&&CJ(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,g=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?bJ(t.shapeLineWidth)+"px":"0px";let m="currentColor";const _=()=>c?bJ(c):m,y=g,b=t=>new wg({symbolType:t,size:y,fill:!0});let x=b(h);const S=x.getParsedPath();let k,A;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;A=t.toString(),k=t.bounds}else S.isSvg&&S.svgCache&&(A=S.svgCache.map((t=>t.path.toString())).join(),k=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new je));let M=`${k.x1} ${k.y1} ${k.width()} ${k.height()}`;if("0px"!==f){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const w=fh.IsGradientStr(u);if(!u||v(u)&&!w||d)return m=d?"none":u?bJ(u):"currentColor",`\n \n \n \n `;const T=w?fh.Parse(u):p(u)?u:null;if(T){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=T.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===T.gradient?t=`\n ${i}\n `:"linear"===T.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),PJ(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(vJ))),h=[...o.children].find((t=>t.className.includes(mJ)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(u(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(mJ)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=zO(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,PJ(l,c))}const p=l.children,g=[];if(p){for(let i=0;i{RJ(OJ)},LJ={fontFamily:XO.fontFamily,spacing:10,wordBreak:"break-word"},DJ=(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},pf||(pf=df.CreateGraphic("richtext",{})),pf.setAttributes(a),pf.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function FJ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:LJ),{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:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:u(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const zJ=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 u(a)&&(r.cornerRadius=[a,a,a,a]),r};class jJ extends wJ{constructor(){super(jJ.type),this.type=WH.canvas,this._attributes=null}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 tO({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}_getTooltipBoxSize(t,e){var i,s;if(!e||d(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:p,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:_}=l,y=ni(d.padding),b=VO(d.padding),x=FJ(Object.assign({textAlign:"right"===_?"right":"left"},p),i),S=FJ(Object.assign({textAlign:"right"===_?"right":"left"},f),i),k=FJ(m,i),A={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:zJ(d),padding:y,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:A,key:S,value:k,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:_},{title:w={},content:T=[]}=t;let C=b.left+b.right,B=b.top+b.bottom,E=0;const P=!!T.length;let R=0,O=0,I=0,L=0;if(P){const t=[],e=[],i=[],s=[];let n=0;M.content=T.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:p,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:M}=r,w={height:0,spaceRow:null!=y?y:v};if(u(h)){const i=tI({},S,FJ(b,void 0,{})),{width:s,height:n,text:r}=DJ(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(u(m)){const t=tI({},k,FJ(x,void 0,{})),{width:e,height:s,text:n}=DJ(m,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};M?t.stroke=d:t.fill=d,t.stroke=null!=p?p:d,t.lineWidth=g,w.shape=t;const e=null!=f?f:A.size;o=Math.max(e,o),s.push(e)}else w.shape={visible:!1};return w.height=o,n+=o,aW.autoWidth&&!1!==W.multiLine;if(j){W=tI({},x,FJ(V,void 0,{})),U()&&(W.multiLine=null===(r=W.multiLine)||void 0===r||r,W.maxWidth=null!==(a=W.maxWidth)&&void 0!==a?a:P?Math.ceil(E):void 0);const{text:t,width:e,height:i}=DJ(H,W);M.title.value=Object.assign(Object.assign({width:U()?Math.min(e,null!==(o=W.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},W),{text:t}),D=M.title.value.width,F=M.title.value.height,z=F+(P?M.title.spaceRow:0)}return B+=z,M.title.width=D,M.title.height=F,U()?C+=E||D:C+=Math.max(D,E),P&&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-L-R-S.spacing-k.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),M.valueWidth=Math.max(M.valueWidth,i.width))})),M.panel.width=C,M.panel.height=B,M})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_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{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?u(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()}}jJ.type=WH.canvas;const HJ=()=>{RJ(jJ)},VJ=(t="chart",e,i)=>{var s,r,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===(s=e.region)||void 0===s||s.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["region",e],type:"region"})}));else if("series"===t)f.modelType="series",f.specKey="series",null===(r=e.series)||void 0===r||r.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["series",e],type:t.type})}));else if(Object.values(mO).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(n).includes(t)){f.modelType="component",f.type=t,f.specKey=null===(o=eI.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:s}=f,n=G(null!==(h=null===(l=i.component)||void 0===l?void 0:l[s])&&void 0!==h?h:[]);null===(d=G(null!==(c=e[s])&&void 0!==c?c:[]))||void 0===d||d.forEach(((e,i)=>{const s=n[i];s&&s.type===t?f.modelInfo.push(Object.assign(Object.assign({},s),{spec:e})):e&&!1===e.visible&&f.modelInfo.push({type:t,spec:e})}))}else{const s=eI.getComponents().filter((({cmp:e})=>e.specKey===t)).map((({cmp:t})=>t.type));if(s.length>0){f.modelType="component";const n=t;f.specKey=n;const r=G(null!==(p=null===(u=i.component)||void 0===u?void 0:u[n])&&void 0!==p?p:[]);G(null!==(g=e[n])&&void 0!==g?g:[]).forEach(((t,e)=>{const i=r[e];i&&s.includes(i.type)&&f.modelInfo.push(Object.assign(Object.assign({},i),{spec:t}))}))}}return f},NJ=(t,e,i,s)=>{const{spec:n,filter:r,filterType:a,forceAppend:o}=t,{isChart:l,modelType:h,specKey:u,type:p,modelInfo:g}=((t="chart",e,i,s,n,r)=>{const a=VJ(t,n,r);return Object.assign(Object.assign({},a),{modelInfo:a.modelInfo.filter((t=>!!d(e)||G(e).some((e=>c(e)?e(t,i,s):qO(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const f=tI({},i),m=c(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:tI(f,m),hasChanged:!0};const i=tI({},t,m);ZO(f,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},m);_(f[u])?f[u].push(t):d(f[u])?f[u]="component"===h?t:[t]:f[u]=[f[u],t]}return{chartSpec:f,hasChanged:!0}},WJ=t=>{eI.registerChartPlugin(t.type,t)};class UJ extends Uz{constructor(){super(UJ.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[UJ.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[UJ.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)}onAfterModelSpecTransform(t,e,i,s){this._initialized&&"updateSpec"===s&&this.onBeforeInitChart(t,e,"setCurrentTheme")}onBeforeInitChart(t,e,i){if(!this._initialized)return;let s,n;switch(i){case"render":case"updateModelSpec":s=!1,n=!0;break;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=QO(this._option.globalInstance.getSpec(),["data",UJ.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=QO(this._baseChartSpec,["data",UJ.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(u(t.maxHeight)&&e.height>t.maxHeight)return!1;break;case"minHeight":if(u(t.minHeight)&&e.heightt.maxWidth)return!1;break;case"minWidth":if(u(t.minWidth)&&e.width{const n=NJ(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=QO(i,["data",UJ.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()}}UJ.pluginType="chart",UJ.specKey="media",UJ.type="MediaQueryPlugin";const GJ=()=>{WJ(UJ)},YJ=/\{([^}]+)\}/,XJ=/\{([^}]+)\}/g,$J=/:/;class KJ extends Uz{constructor(){super(KJ.type),this.type="formatterPlugin",this._timeModeFormat={utc:gi.getInstance().timeUTCFormat,local:gi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Si.getInstance().format,this._numericSpecifier=Si.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[KJ.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;c(r)?this._formatter=r:(this._formatter=this._format.bind(this),c(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),eI.registerFormatter(this._formatter)}_format(t,e,i){return _(t)?t.map(((t,s)=>{const n=_(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):_(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=YJ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(XJ,((t,i)=>{if(!$J.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(yi.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):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}KJ.pluginType="chart",KJ.specKey="formatter",KJ.type="formatterPlugin";const qJ=()=>{WJ(KJ)};class ZJ extends Uz{constructor(){super(ZJ.type),this.type="ChartResizeZoomPlugin",this._zoom=1,this._onWheel=t=>{t.preventDefault(),t.stopImmediatePropagation();const e=Math.pow(1.005,-t.deltaY*Math.pow(16,t.deltaMode)*.2*this._rate),i={x:t.offsetX,y:t.offsetY};this.zoom(e,i)}}onAfterInitChart(t,e){var i,s,n,r,a;const o=t.globalInstance,l=null!==(s=null===(i=o.getSpec())||void 0===i?void 0:i[ZJ.specKey])&&void 0!==s?s:{enabled:!1};!0===l.enabled&&(this._minZoom=null!==(n=l.min)&&void 0!==n?n:.1,this._maxZoom=null!==(r=l.max)&&void 0!==r?r:10,this._rate=null!==(a=l.rate)&&void 0!==a?a:.1,this._container=o.getContainer(),this._triggerEvent=$V(t.globalInstance.getChart().getOption().mode).zoom,this._container&&this._triggerEvent&&this._container.addEventListener(this._triggerEvent,this._onWheel))}zoom(t,e){const i=this.service.globalInstance;if(!i)return;const s=this._zoom;let n=this._zoom*t;if(n<=this._minZoom&&t<1||n>=this._maxZoom&&t>1)if(n<=this._minZoom&&this._zoom>this._minZoom)n=this._minZoom;else{if(!(n>=this._maxZoom&&this._zoom{WJ(ZJ)};gF.useRegisters([()=>{$H(),qH(),JH(),MH(),AH(),hH(),tH(),Oz(),Lz(),iF(),QD(),Uj(),Hj(),eI.registerSeries(cH.type,cH),eI.registerChart(QH.type,QH)},()=>{$H(),qH(),JH(),AH(),hH(),tH(),Oz(),iV(),Lz(),rV(),Uj(),Hj(),eI.registerSeries(oV.type,oV),MH(),eI.registerChart(hV.type,hV)},()=>{$H(),qH(),JH(),AH(),kV(),MH(),eI.registerChart(MV.type,MV)},()=>{qH(),OW(),eI.registerChart(C$.type,C$)},()=>{$H(),qH(),JH(),MH(),eI.registerChart(F$.type,F$),AH()},Hj,Uj,()=>{eI.registerComponent(jK.type,jK)},()=>{eI.registerComponent(oq.type,oq)},()=>{eI.registerComponent(pq.type,pq)},()=>{eI.registerGraphicComponent(YZ.type,(t=>new $E(t))),UZ(),bj(),eI.registerComponent(YZ.type,YZ,!0,1/0)},HJ]),gF.useRegisters([()=>{rk(yo)}]);export{lD as AttributeLevel,Gz as AxisSyncPlugin,jJ as CanvasTooltipHandler,bL as ChartEvent,ZJ as ChartResizeZoomPlugin,TI as DEFAULT_CHART_HEIGHT,wI as DEFAULT_CHART_WIDTH,vF as DEFAULT_CLOSE_STROKE_JOIN,BI as DEFAULT_DATA_INDEX,EI as DEFAULT_DATA_KEY,PI as DEFAULT_DATA_SERIES_FIELD,qI as DEFAULT_KEY,nD as DEFAULT_LAYOUT_RECT_LEVEL,rD as DEFAULT_LAYOUT_RECT_LEVEL_MIN,mF as DEFAULT_LINEAR_INTERPOLATE,ZI as DEFAULT_MAP_LOOK_UP_KEY,CI as DEFAULT_MEASURE_CANVAS_ID,RI as DEFAULT_SERIES_STYLE_NAME,fF as DEFAULT_SMOOTH_INTERPOLATE,oT as DefaultTicker,_F as Direction,OJ as DomTooltipHandler,eI as Factory,KJ as FormatterPlugin,oD as LayoutLevel,aD as LayoutZIndex,XI as MOSAIC_CAT_END_PERCENT,YI as MOSAIC_CAT_START_PERCENT,GI as MOSAIC_VALUE_END_PERCENT,UI as MOSAIC_VALUE_START_PERCENT,hT as ManualTicker,UJ as MediaQuery,MI as PREFIX,s as RenderModeEnum,KI as SEGMENT_FIELD_END,$I as SEGMENT_FIELD_START,LI as STACK_FIELD_END,jI as STACK_FIELD_END_OffsetSilhouette,FI as STACK_FIELD_END_PERCENT,OI as STACK_FIELD_KEY,II as STACK_FIELD_START,zI as STACK_FIELD_START_OffsetSilhouette,DI as STACK_FIELD_START_PERCENT,HI as STACK_FIELD_TOTAL,WI as STACK_FIELD_TOTAL_BOTTOM,VI as STACK_FIELD_TOTAL_PERCENT,NI as STACK_FIELD_TOTAL_TOP,cD as STATE_VALUE_ENUM,FC as StreamLight,vI as ThemeManager,jL as TransformLevel,sD as USER_LAYOUT_RECT_LEVEL,gF as VChart,HO as boundsInRect,aI as builtinThemes,zO as calcLayoutNumber,jO as calcPadding,SO as computeActualDataScheme,NO as convertPoint,rf as createArc,ef as createArea,Pp as createGroup,Eg as createLine,Ig as createRect,Kg as createRichText,Tg as createSymbol,Ag as createText,KO as darkTheme,UO as dataScheme,gF as default,oI as defaultThemeName,AO as getActualColor,WO as getActualNumValue,CO as getColorSchemeBySeries,xO as getDataScheme,nI as getFunnelTheme,fI as getMergedTheme,xF as getSpecInfo,uI as getTheme,cI as hasThemeMerged,MO as isColorKey,DO as isPercent,FO as isPercentOffset,wO as isProgressiveDataColorScheme,YO as isTokenKey,LO as isValidOrient,$O as lightTheme,SF as lookup,AI as measureText,VO as normalizeLayoutPaddingSpec,kO as queryColorFromColorScheme,GO as queryToken,nF as registerAnimate,SK as registerBoxplotChart,oJ as registerBrush,HJ as registerCanvasTooltipHandler,$j as registerCartesianLogAxis,qj as registerCartesianSymlogAxis,Yj as registerCartesianTimeAxis,WJ as registerChartPlugin,JJ as registerChartResizeZoomPlugin,pK as registerCirclePackingChart,G$ as registerCircularProgressChart,ZK as registerContinuousLegend,IK as registerCorrelationChart,hJ as registerCustomMark,CL as registerDataSetInstanceParser,TL as registerDataSetInstanceTransform,Pq as registerDataZoom,IJ as registerDomTooltipHandler,hF as registerElementHighlight,uF as registerElementSelect,qJ as registerFormatPlugin,eK as registerFunnelChart,$$ as registerGaugeChart,QV as registerGeoCoordinate,sJ as registerGeoMarkPoint,uJ as registerGridLayout,PK as registerHeatmapChart,N$ as registerHistogramChart,jq as registerIndicator,nK as registerLinearProgressChart,S$ as registerMapChart,PZ as registerMarkArea,kZ as registerMarkLine,QZ as registerMarkPoint,GJ as registerMediaQuery,VZ as registerPlayer,KW as registerPolarBandAxis,fq as registerPolarCrossHair,XW as registerPolarLinearAxis,OZ as registerPolarMarkArea,MZ as registerPolarMarkLine,eJ as registerPolarMarkPoint,pJ as registerPoptip,L$ as registerRadarChart,CK as registerRangeAreaChart,oK as registerRangeColumnChart,R$ as registerRoseChart,MK as registerSankeyChart,zV as registerScatterChart,Iq as registerScrollBar,cK as registerSunburstChart,dI as registerTheme,TZ as registerTitle,KZ as registerTotalLabel,mK as registerTreemapChart,yK as registerWaterfallChart,J$ as registerWordCloudChart,pI as removeTheme,gI as themeExist,lI as themes,XO as token,TO as transformColorSchemeToStandardStruct,pL as transformToGraphic,kF as version,S_ as vglobal,jy as warn}; +let hY=class t extends ZG{constructor(e){super(z({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{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,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize: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=this.options.createCanvas({width:1,height:1}),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 f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),_=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*Math.abs(Math.sin(h)))/this.gridSize),k=S*this.gridSize,A=x*this.gridSize;d.setAttribute("width",""+k),d.setAttribute("height",""+A),u.scale(1,1),u.translate(k/2,A/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,k,A).data;if(this.exceedTime())return null;const w=[];let T,C=S;const B=[x/2,S/2,x/2,S/2],E=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*k+(t*this.gridSize+n))+3])return i.push([t,e]),tB[1]&&(B[1]=t),eB[2]&&(B[2]=e))}};for(;C--;)for(T=x;T--;)E(C,T,w);return{datum:t,occupied:w,bounds:B,gw:S,gh:x,fillTextOffsetX:y,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=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,e=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),q(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){this.grid=[];const e=this.options.shape;if(p(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?rY(t,o,l.width,l.height,h):"geometric"===t.type&&lY(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!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)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,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}=XG(this.options.shape,[e.width,e.height]);return 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),this.result=[],this.progressiveRun()}};hY.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class cY extends ZG{constructor(t){super(z({},cY.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,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)}cY.defaultOptions={enlarge:!1};const uY={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},pY=(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?gY(t.fontFamily):"sans-serif",d=t.fontStyle?gY(t.fontStyle):"normal",u=t.fontWeight?gY(t.fontWeight):"normal",p=t.rotate?gY(t.rotate):0,g=gY(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?gY(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,S=t.minFontSize,k=t.randomVisible,A=t.as?Object.assign(Object.assign({},uY),t.as):uY,M=t.depth_3d,w=t.postProjection;let T=t.fontSize?gY(t.fontSize):14;const C=t.fontSizeRange;if(C&&!x(T)){const t=T,e=mY(vY(t,l),C);T=i=>e(t(i))}let B=QG;"fast"===t.layoutType?B=cY:"grid"===t.layoutType&&(B=hY);const E=new B(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:T,shrink:_,clip:b,enlarge:y,minFontSize:S,random:k,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:E}:E.output()},gY=t=>v(t)||x(t)||c(t)||_(t)?t:e=>e[t.field],fY=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),mY=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=fY(t[0]),n=fY(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(fY(t)-r)/(a-r)*(e[1]-e[0])+e[0]},vY=(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 _Y(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{hI.registerGrammarTransform("wordcloud",{transform:pY}),lW(),hI.registerAnimation("wordCloud",((t,e)=>({appear:qU(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:nF.disappear.duration}}))),hI.registerSeries(yY.type,yY)},xY=(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:f=!1,isCone:m=!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===f?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?m?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},SY=(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},kY=`${OI}_FUNNEL_TRANSFORM_RATIO`,AY=`${OI}_FUNNEL_REACH_RATIO`,MY=`${OI}_FUNNEL_HEIGHT_RATIO`,wY=`${OI}_FUNNEL_VALUE_RATIO`,TY=`${OI}_FUNNEL_LAST_VALUE_RATIO`,CY=`${OI}_FUNNEL_NEXT_VALUE_RATIO`,BY=`${OI}_FUNNEL_LAST_VALUE`,EY=`${OI}_FUNNEL_CURRENT_VALUE`,PY=`${OI}_FUNNEL_NEXT_VALUE`,RY=`${OI}_FUNNEL_TRANSFORM_LEVEL`;class OY extends jF{constructor(t){var e,i;super(t),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)?this._transformRatioText: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[AY])).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 this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return u(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class IY extends $D{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class LY extends IY{constructor(){super(...arguments),this.type=LY.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}LY.type="polygon";const DY=()=>{hI.registerMark(LY.type,LY),qA(),UA(),uT.registerBuiltInAnimate("growPointsOut",uC),hI.registerGraphicComponent("polygon",lf)},FY=Object.assign(Object.assign({},ZF),{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"}});class zY extends pz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class jY extends gz{constructor(){super(...arguments),this.type=AO.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=zY,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,i,s,n;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._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;LL(this._dataSet,"funnel",xY),LL(this._dataSet,"funnelTransform",SY);const t=new Ba(this._dataSet,{name:`${OI}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new WD(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}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:EY,asTransformRatio:kY,asReachRatio:AY,asHeightRatio:MY,asValueRatio:wY,asNextValueRatio:CY,asLastValueRatio:TY,asLastValue:BY,asNextValue:PY,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:RY}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},jY.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:hz(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},jY.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),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(jY.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(jY.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new OY(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(){var t,e,i,s;const n=this._funnelMark;n&&this.setMarkStyle(n,{points:t=>this.getPoints(t),visible:t=>u(t[this._valueField]),fill:this.getColorAttribute()},"normal",mD.Series);const r=this._funnelTransformMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t)},"normal",mD.Series);const a=this._funnelOuterLabelMark.label;a&&(this.setMarkStyle(a,{text:t=>`${t[this.getCategoryField()]}`,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),width:0,height:0},"normal",mD.Series),c(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(a,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",mD.User_Mark));const o=this._funnelOuterLabelMark.line;if(o&&a){this.setMarkStyle(o,{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",mD.Series);const n=null!==(i=null===(e=null===(t=this._spec.outerLabel)||void 0===t?void 0:t.line)||void 0===e?void 0:e.visible)&&void 0!==i?i:null===(s=this._spec.outerLabel)||void 0===s?void 0:s.visible;u(n)&&o.setVisible(n)}}initLabelMarkStyle(t){var e;if(!t)return;const i=t.getTarget(),s=t.getComponent();if(i===this._funnelMark){this._labelMark=t,this.setMarkStyle(t,{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",mD.Series);const i=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&Fy(i,this._funnelOuterLabelMark.label,s),this._funnelOuterLabelMark.line&&Fy(i,this._funnelOuterLabelMark.line,null!==(e=this._funnelOuterLabelMark.label)&&void 0!==e?e:s)}else this._funnelTransformMark&&i===this._funnelTransformMark&&(this._transformLabelMark=t,this.setMarkStyle(t,{text:t=>`${(100*xO(AY).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",mD.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(rz(null===(s=hI.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.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),az("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(rz(hI.getAnimationInKey("fadeInOut")(),az(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(rz(hI.getAnimationInKey("funnel")({},o),az(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(rz(null===(a=hI.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),az("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[TY])/2:this._getSecondaryAxisLength(t[wY])/2,n=this._getSecondaryAxisLength(t[wY])/2):(s=this._getSecondaryAxisLength(t[wY])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[CY])/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[RY])}_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 u(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[zI]===t[zI]));if(!u(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(x(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,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,_,y;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h: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!==f.alignLabel?(null==u?void 0:u.y2)+e:_-e,m=this._getPolygonCenter(i).x,_-y{DY(),lW(),yN(),hI.registerSeries(jY.type,jY),hI.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},aF))),hI.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:YT,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),lF()},VY=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},NY=t=>{const e=t.filter((t=>t.context.diffState===vD.update)),i=$(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},WY=(t,e,i)=>{if(E(t))return[e,i];const s=$(t.map((t=>1*t.getFinalAttribute().startAngle))),n=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},UY=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=NY(i.parent.children),a=WY(r,s,n);return VY(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=NY(i.parent.children),a=WY(r,s,n);return VY(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),GY=t=>{const e=$(t.map((t=>1*t.getFinalAttribute().startAngle))),i=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},YY=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=NY(i.parent.children),a=GY(r);return VY(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=NY(i.parent.children),a=GY(r);return VY(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),XY=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},$Y=(t,e={})=>{if(!t)return[];const i=[];return tG(t,i,e),i},KY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new CG(i).layout(t,{width:s,height:n})};class qY extends jF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var ZY;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(ZY||(ZY={}));const JY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(d(n))return t;if(i.type===ZY.DrillDown){return G(fL(t,n,s,"children"))}if(i.type===ZY.DrillUp){const e=mL(t,n,s,"children");if(e)return G(e)}return t};class QY{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=iN(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(n.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;LL(t,"drillFilter",JY),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(d(t.datum)||d(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(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!_(t)||E(t))return t;const s=t[t.length-1];return this._drillInfo={key:s,path:t,type:ZY.DrillDown},e().reRunAllTransform(),i.emit(CL.drill,{value:{path:t,type:ZY.DrillDown},model:this}),t}drillUp(){var t,e;const{getRawData:i,event:s}=this._drillParams,n=null!==(e=null===(t=this._drillInfo)||void 0===t?void 0:t.path)&&void 0!==e?e:[];if(!_(n)||E(n))return n;const r=n.pop();return this._drillInfo={key:r,path:n,type:ZY.DrillUp},i().reRunAllTransform(),s.emit(CL.drill,{value:{path:n,type:ZY.DrillUp},model:this}),n}}const tX=Object.assign(Object.assign({},ZF),{sunburst:{name:"sunburst",type:"arc"}}),eX=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:UF,operations:["max","min","values"]}),t.push({key:GF,operations:["values"]}),t),iX={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,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"}}}};class sX extends kW{constructor(){super(...arguments),this.type=AO.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:GF),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:zI},getRawData:()=>this.getRawData()}),this._startAngle=re(this._spec.startAngle),this._endAngle=re(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),LL(this._dataSet,"sunburstLayout",KY),LL(this._dataSet,"flatten",$Y),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:s}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[u(this._centerX)?this._centerX:this.getLayoutRect().width/2,u(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 eX(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();d(null==t?void 0:t.dataSet)||(LL(t.dataSet,"addVChartProperty",RF),t.transform({type:"addVChartProperty",options:{beforeCall:KF.bind(this),call:qF}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(sX.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_initArcMarkStyle(){d(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(u(this._offsetX)?this._offsetX:0),y:t=>t.y+(u(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},_D.STATE_NORMAL,mD.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(sX.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){d(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return p(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)+(u(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(u(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},_D.STATE_NORMAL,mD.Series)}initTooltip(){this._tooltipHelper=new qY(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(G(this.__innerRadius))[0],outerRadius:this._computeRadius(G(this.__outerRadius))[0],startAngle:G(this._startAngle)[0],endAngle:G(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(rz(null===(e=hI.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),az(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(rz(null===(e=hI.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),az(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_computeRadius(t){return _(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]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}sX.type=AO.sunburst,sX.mark=tX,sX.builtInTheme={sunburst:iX},U(sX,QY);const nX=()=>{hI.registerSeries(sX.type,sX),LW(),lW(),lF(),hI.registerAnimation("sunburst",((t,e)=>({appear:XY(0,e),enter:UY(t),exit:YY(t),disappear:{duration:nF.disappear.duration}})))},rX=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new mG(i).layout(t,{width:s,height:n})};class aX extends jF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const oX=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},lX=Object.assign(Object.assign({},ZF),{circlePacking:{name:"circlePacking",type:"arc"}});class hX extends vz{constructor(){super(...arguments),this.type=AO.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:GF),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:zI},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();d(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),LL(this._dataSet,"circlePackingLayout",rX),LL(this._dataSet,"flatten",$Y),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,valueField:this._valueField,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();d(null==t?void 0:t.dataSet)||(LL(t.dataSet,"addVChartProperty",RF),t.transform({type:"addVChartProperty",options:{beforeCall:KF.bind(this),call:qF}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(hX.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_initCirclePackingMarkStyle(){d(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},_D.STATE_NORMAL,mD.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(hX.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){d(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},_D.STATE_NORMAL,mD.Series)}getStatisticFields(){return eX(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new aX(this),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(rz(null===(i=hI.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),az(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(rz(null===(e=hI.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),az(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}hX.type=AO.circlePacking,hX.mark=lX,hX.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,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"}}}}},U(hX,QY);const cX=()=>{hI.registerSeries(hX.type,hX),LW(),lW(),oF(),hI.registerAnimation("circlePacking",((t,e)=>({appear:oX(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:nF.disappear.duration}})))},dX=(t,e,i)=>{e.forEach((e=>{d(e[i])||t.add(e[i]),e.children&&e.children.length>0&&dX(t,e.children,i)}))},uX=t=>{var e;if(!t||!_(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},pX=(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 MG(e),r=[];return r.push(n.layout(s,i)),r},gX=t=>{var e,i;return t&&_(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:[]},fX=t=>{var e,i;return t&&_(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 mX extends jF{constructor(){super(...arguments),this._getDimensionData=t=>{if(t.source){if(x(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},this.markTooltipValueCallback=t=>t.value}}const vX=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),_X=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:vX(t),yX=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class bX extends kT{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class xX extends kT{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const SX=(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,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=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}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},kX=(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,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=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}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class AX extends WN{constructor(){super(...arguments),this.type=AX.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?kX:SX,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}AX.type="linkPath";const MX=Object.assign(Object.assign({},ZF),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class wX extends pz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const TX=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&t.removeState(e),t.addState(e,s,n)};class CX extends vz{constructor(){super(...arguments),this.type=AO.sankey,this.transformerConstructor=wX,this._nodeLayoutZIndex=gD.Node,this._labelLayoutZIndex=gD.Label,this._viewBox=new je,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(u(a))return a;if(u(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;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(u(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=x(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var t,e;if(!this._needClear)return;const i=null===(t=this._nodeMark)||void 0===t?void 0:t.getGraphics();if(!i||!i.length)return;const s=null===(e=this._linkMark)||void 0===e?void 0:e.getGraphics();s&&s.length&&(i.forEach((t=>{t.removeState(_D.STATE_SANKEY_EMPHASIS),t.removeState(_D.STATE_SANKEY_EMPHASIS_REVERSE)})),s.forEach((t=>{t.removeState(_D.STATE_SANKEY_EMPHASIS),t.removeState(_D.STATE_SANKEY_EMPHASIS_REVERSE)})),this._needClear=!1)},this._handleNodeAdjacencyClick=t=>{const e=kL(t),i=[e.key];if(this._linkMark){const t=this._linkMark.getGraphics();if(!t||!t.length)return;t.forEach(((t,s)=>{const n=kL(t);n.source===e.key?(i.includes(n.target)||i.push(n.target),t.removeState(_D.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(_D.STATE_SANKEY_EMPHASIS,!0)):n.target===e.key?(i.includes(n.source)||i.push(n.source),t.removeState(_D.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(_D.STATE_SANKEY_EMPHASIS,!0)):(t.removeState(_D.STATE_SANKEY_EMPHASIS),t.addState(_D.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),i),this._needClear=!0},this._handleLinkAdjacencyClick=t=>{const e=kL(t),i=[e.source,e.target];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach((e=>{e===t?(e.removeState(_D.STATE_SANKEY_EMPHASIS_REVERSE),TX(e,_D.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState(_D.STATE_SANKEY_EMPHASIS),e.addState(_D.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),i),this._needClear=!0},this._handleNodeRelatedClick=t=>{var e;const i=kL(t),s=this._nodeMark.getGraphics();if(!s||!s.length)return;const n=this._linkMark.getGraphics();if(!n||!n.length)return;const r=(null===(e=kL(n[0]))||void 0===e?void 0:e.parents)?"parents":"source";if("source"===r){const t=[i.key],e=[];if(n.forEach(((n,r)=>{var a,o,l,h;const c=kL(n),d=(null==c?void 0:c.parents)?"parents":"source";if(G(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.getGraphics();if(!t||!t.length)return;t.forEach(((t,i)=>{var s;const n=kL(t);e.includes(null!==(s=n.key)&&void 0!==s?s:n.index)?(t.removeState(_D.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(_D.STATE_SANKEY_EMPHASIS,!0)):(t.removeState(_D.STATE_SANKEY_EMPHASIS),t.addState(_D.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),t)}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(G(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 a=kL(s),o=a.datum,l=o?o.filter((t=>t[r].some((t=>t.key===i.key)))):null,h=e.find((t=>t.source===a.source&&t.target===a.target));if(l&&l.length){t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target);const e=l.reduce(((t,e)=>t+e.value),0),i=e/a.value;return s.removeState(_D.STATE_SANKEY_EMPHASIS_REVERSE),void TX(s,_D.STATE_SANKEY_EMPHASIS,{ratio:i})}if(h)return t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target),s.removeState(_D.STATE_SANKEY_EMPHASIS_REVERSE),void TX(s,_D.STATE_SANKEY_EMPHASIS,{ratio:h.value/a.value});s.removeState(_D.STATE_SANKEY_EMPHASIS),s.addState(_D.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),t)}this._needClear=!0},this._handleLinkRelatedClick=t=>{const e=this._nodeMark.getGraphics();if(!e||!e.length)return;const i=this._linkMark.getGraphics();if(!i||!i.length)return;if("source"===(kL(t)?"parents":"source"))this._linkMark&&i.forEach((t=>{t.removeState(_D.STATE_SANKEY_EMPHASIS),t.removeState(_D.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&e.forEach((t=>{t.removeState(_D.STATE_SANKEY_EMPHASIS),t.removeState(_D.STATE_SANKEY_EMPHASIS_REVERSE)}));else{const s=kL(t),n=[s.source,s.target],r=[];G(s.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})}})),i.forEach((t=>{const e=kL(t),i=e.datum;if(e.source===s.source&&e.target===s.target)return t.removeState(_D.STATE_SANKEY_EMPHASIS_REVERSE),void TX(t,_D.STATE_SANKEY_EMPHASIS,{ratio:1});const a=i?i.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(s.source)&&e.includes(s.target)})):null;if(a&&a.length){n.includes(e.source)||n.push(e.source),n.includes(e.target)||n.push(e.target);const i=a.filter((t=>t.parents.some(((e,i)=>{var n;return e.key===s.source&&(null===(n=t.parents[i+1])||void 0===n?void 0:n.key)===s.target})))).reduce(((t,e)=>t+e.value),0),r=i/e.value;return t.removeState(_D.STATE_SANKEY_EMPHASIS_REVERSE),void TX(t,_D.STATE_SANKEY_EMPHASIS,{ratio:r})}const o=r.find((t=>t.source===e.source&&t.target===e.target));if(o)return n.includes(e.source)||n.push(e.source),n.includes(e.target)||n.push(e.target),t.removeState(_D.STATE_SANKEY_EMPHASIS_REVERSE),void TX(t,_D.STATE_SANKEY_EMPHASIS,{ratio:o.value/e.value});t.removeState(_D.STATE_SANKEY_EMPHASIS),t.addState(_D.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(e,n)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}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:this._spec.categoryField)}initData(){var t,e,i,s;super.initData();const n=this.getViewData(),r=this.getRawData();if(r&&n){LL(this._dataSet,"sankeyLayout",pX),LL(this._dataSet,"sankeyFormat",uX),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.direction,crossNodeAlign:this._spec.crossNodeAlign,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,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,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,inverse:this._spec.inverse},level:XL.sankeyLayout});const{dataSet:a}=this._option;LL(a,"sankeyNodes",gX),LL(a,"flatten",$Y);const o=new Ba(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:XF.bind(this),call:$F}},!1),this._nodesSeriesData=o,LL(a,"sankeyLinks",fX);const l=new Ba(a,{name:`sankey-link-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyLinks"}),l.transform({type:"addVChartProperty",options:{beforeCall:XF.bind(this),call:$F}},!1),this._linksSeriesData=l}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(CX.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(CX.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=G(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,i=G(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()}_initNodeMarkStyle(){var t,e;const i=this._nodeMark;i&&(this.setMarkStyle(i,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},_D.STATE_NORMAL,mD.Mark),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.node.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByNode},"normal",mD.User_Mark))}_initLinkMarkStyle(){var t,e;const i=this._linkMark;i&&(i.setGlyphConfig({direction:this.direction}),this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},_D.STATE_NORMAL,mD.Series),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.link.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByLink},"normal",mD.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(d(t)||d(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=CF(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={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;this._nodeMark&&this._nodeMark.setAnimationConfig(rz(null===(i=hI.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),az("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(rz(null===(s=hI.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),az("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:EL.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(t,e){t&&t.length&&t.forEach((t=>{t.removeState([_D.STATE_SANKEY_EMPHASIS_REVERSE,_D.STATE_SANKEY_EMPHASIS]),e.includes(kL(t).key)?t.addState(_D.STATE_SANKEY_EMPHASIS,!0):t.addState(_D.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new mX(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_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&&!d(a[0])||(a=this.getNodeList(),a&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new FO;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_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=>{u(t[i])&&e.add(t[i]),u(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 dX(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),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]}getMarkData(t){return t.datum?_(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}CX.type=AO.sankey,CX.transformerConstructor=wX,CX.mark=MX,CX.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const BX=()=>{MV(),UN(),NA(),hI.registerGraphicComponent("path",(t=>Jg(t))),hI.registerMark(AX.type,AX),lW(),hI.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:_X(t,e)},aF))),hI.registerAnimation("sankeyLinkPath",((t,e)=>({appear:yX(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:nF.disappear.duration}}))),uT.registerBuiltInAnimate("linkPathGrowOut",xX),uT.registerBuiltInAnimate("linkPathGrowIn",bX),lF(),hI.registerSeries(CX.type,CX)},EX=(t,e)=>{let i={},s=e.fields;if(c(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const n=t[0].latestData,r=$Y(n);return i=VF([{latestData:r}],e),i};class PX extends jF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const RX=Object.assign(Object.assign({},ZF),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),OX=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class IX extends pz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const LX=(t,e)=>{if(e.getViewBox()){const i=new RG(e).layout(t,e.getViewBox()),s=[];return tG(i,s,{maxDepth:null==e?void 0:e.maxDepth}),s.forEach(((t,i)=>{t&&[GF,"name"].forEach((i=>{t[i]=t.datum[t.depth][e.nameField]}))})),s}return[]};class DX extends vz{constructor(){super(...arguments),this.type=AO.treemap,this.transformerConstructor=IX,this._categoryField="name",this._valueField="value",this._viewBox=new je,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:GF),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ne),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:zI},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,s,n;super.initData(),LL(this._dataSet,"treemap",LX),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{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}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(LL(this._rawData.dataSet,"addVChartProperty",RF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:KF.bind(this),call:qF}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=EX([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=z(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){LL(this._dataSet,"hierarchyDimensionStatistics",EX),LL(this._dataSet,"flatten",$Y);const i=new Ba(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 eX(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(DX.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(DX.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}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()},_D.STATE_NORMAL,mD.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()},_D.STATE_NORMAL,mD.Series)}_initRichStyleOfLabelMark(t){"rich"===t.getTextType()&&this.setMarkStyle(t,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},_D.STATE_NORMAL,mD.Series)}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{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},_D.STATE_NORMAL,mD.Series),this._initRichStyleOfLabelMark(t))}initNonLeafLabelMarkStyle(t){t&&(this._nonLeafLabelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{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},_D.STATE_NORMAL,mD.Series),this._initRichStyleOfLabelMark(t))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(rz(null===(e=hI.getAnimationInKey("treemap"))||void 0===e?void 0:e(),az(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 PX(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(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(wL.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(wL.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}DX.type=AO.treemap,DX.mark=RX,DX.builtInTheme={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"}}}},DX.transformerConstructor=IX,U(DX,QY),U(DX,nN);const FX=()=>{hI.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),hI.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),MV(),lW(),hI.registerAnimation("treemap",((t,e)=>({appear:OX(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:nF.disappear.duration}}))),lF(),hI.registerSeries(DX.type,DX)},zX=Object.assign(Object.assign({},AU),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),jX=Object.assign(Object.assign({},ZF),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),HX={type:"fadeIn"};function VX(t,e){return"fadeIn"===e?HX:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class NX extends pz{constructor(){super(...arguments),this._supportStack=!1}}class WX extends jF{enableByType(t){return"dimension"!==t}}const UX="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",GX={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:UX,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:UX,fill:"#ddd"}}};class YX extends MU{constructor(){super(...arguments),this.type=AO.gaugePointer,this.transformerConstructor=NX,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(YX.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},YX.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(YX.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(){this._tooltipHelper=new WX(this),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 u(this.radiusAxisHelper)&&u(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=mt(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})}getInteractionTriggers(){return 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(rz(null===(i=hI.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),az("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}YX.type=AO.gaugePointer,YX.mark=jX,YX.builtInTheme={gaugePointer:GX},YX.transformerConstructor=NX;const XX=()=>{hI.registerSeries(YX.type,YX),ZV(),MV(),hI.registerAnimation("gaugePointer",((t,e)=>{const i=VX(t,e);return{appear:i,enter:i,disappear:{duration:nF.disappear.duration}}})),sU(),eU()};class $X extends pz{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class KX extends MU{constructor(){super(...arguments),this.type=AO.gauge,this.transformerConstructor=$X,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=re(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();LL(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[sL]=t[this._angleField[0]],t[iL]=e>0?i[e-1][sL]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(KX.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(KX.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})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(t,e){if(super.initMarkStyleWithSpec(t,e),t&&"segment"===t.name){const e=this.getSpec().segment;if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,mD.User_Mark)}}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),s=_t(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?HO(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=_t(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?HO(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return u(t[iL])?this.angleAxisHelper.dataToPosition([t[iL]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[sL]])}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(rz(null===(i=hI.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),az("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}KX.type=AO.gauge,KX.mark=zX,KX.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},KX.transformerConstructor=$X;class qX extends $D{constructor(){super(...arguments),this.type=qX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Tg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="rect":a.symbolType=o,a}}qX.type="cell";function ZX(t){return!1===t?{}:{type:"fadeIn"}}class JX extends jF{enableByType(t){return"dimension"!==t}}const QX=Object.assign(Object.assign({},ZF),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class t$ extends pz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class e$ extends vz{constructor(){super(...arguments),this.type=AO.heatmap,this.transformerConstructor=t$}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=G(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(e$.mark.cell,{isSeriesMark:!0},{morph:hz(this._spec,e$.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(e$.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){var e,i,s;t&&this.setMarkStyle(t,{fill:null!==(s=null===(i=null===(e=this._spec.cell)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s: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",mD.Series)}initCellBackgroundMarkStyle(){var t,e,i;const s=ni(null!==(i=null===(e=null===(t=this._spec.cellBackground)||void 0===t?void 0:t.style)||void 0===e?void 0:e.padding)&&void 0!==i?i:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+s[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+s[0]},width:()=>this.getCellSize(this._xAxisHelper)-s[1]-s[3],height:()=>this.getCellSize(this._yAxisHelper)-s[0]-s[2]},"normal",mD.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue()[0]}}getInteractionTriggers(){return 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=mz(this);this._cellMark.setAnimationConfig(rz(null===(i=hI.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),az("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 JX(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}e$.type=AO.heatmap,e$.mark=QX,e$.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1},label:{style:{lineWidth:2}}}},e$.transformerConstructor=t$;const i$=()=>{lW(),hI.registerMark(qX.type,qX),hI.registerGraphicComponent("symbol",Tg),qA(),JA(),zE(),hI.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},aF),{appear:ZX(e)}))),Jj(),$j(),hI.registerSeries(e$.type,e$)},s$=Object.assign(Object.assign({},ZF),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),n$=`${OI}_CORRELATION_X`,r$=`${OI}_CORRELATION_Y`,a$=`${OI}_CORRELATION_SIZE`,o$=(t,e)=>{var i,s,n,r,a,o,l,h,c,u,p,g,f,m,v;if(!t||!(null==e?void 0:e.view)||!_(t))return t;const y=e.view();if(y.x1-y.x0==0||y.y1-y.y0==0||y.x1-y.x0==-1/0||y.x1-y.x0==1/0||y.y1-y.y0==-1/0||y.y1-y.y0==1/0)return t;const b=re(null!==(i=e.startAngle)&&void 0!==i?i:-90),S=re(null!==(s=e.endAngle)&&void 0!==s?s:270),k=Math.max((y.x1-y.x0)/2,(y.y1-y.y0)/2),A=Et(null!==(n=e.innerRadius)&&void 0!==n?n:0,k),M=Et(e.outerRadius,k),w=[x(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:y.x0+Et(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",y.x1-y.x0),x(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:y.y0+Et(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",y.y1-y.y0)],T=Bt(e.field),C=t.map(T),[B,E]=Rt(C),P=B===E?t=>(A+M)/2:t=>A+(M-A)*(t-B)/(E-B),R=d(e.radiusField)?T:Bt(e.radiusField),O=null!==(p=null===(u=null==e?void 0:e.radiusRange)||void 0===u?void 0:u[1])&&void 0!==p?p:5;let I=t=>O;if(R){const[i,s]=R!==T?Rt(t.map(R)):[B,E],n=null!==(f=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==f?f:5,r=null!==(v=null===(m=e.radiusRange)||void 0===m?void 0:m[1])&&void 0!==v?v:5;i!==s&&(I=t=>n+(r-n)*(R(t)-i)/(s-i))}const L=Math.min(b,S),D=Math.max(b,S),F=l$(L,D,t.length),z=[],j=(D-L)/60;return t.forEach(((t,e)=>{const i=P(C[e]),s=I(t);let n,r,a=F[e];for(let t=0;t<60&&(n=w[0]+i*Math.cos(a),r=w[1]+i*Math.sin(a),h$({x:n,y:r,size:s},z)||n-sy.x1||r-sy.y1);t++)t<59&&(a+=j,a>D?a=L: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},h$=(t,e)=>!(!e||!e.length)&&e.some((e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2){if(!t||!_(t))return[];const{keyword:i,categoryField:s}=e,n=t[0].latestData[0];return{[s]:i,[FI]:null==n?void 0:n[FI],[jI]:null==n?void 0:n[jI]}};class d$ extends WN{constructor(){super(...arguments),this.type=d$.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=mt(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}d$.type="ripple";const u$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class p$ extends pz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class g$ extends kW{constructor(){super(...arguments),this.type=AO.correlation,this.transformerConstructor=p$,this._viewBox=new je}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){u(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){u(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){u(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;LL(this._dataSet,"correlation",o$);const s=new Ca;DL(s,"dataview",Ma),LL(s,"correlationCenter",c$);const n=new Ba(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 WD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_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(){const t=this._createMark(g$.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:FI});t&&(t.setMarkConfig({zIndex:gD.Node}),this._nodePointMark=t);const e=this._createMark(g$.mark.ripplePoint,{key:FI,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});e&&(this._ripplePointMark=e);const i=this._createMark(g$.mark.centerPoint,{key:FI,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(i.setMarkConfig({zIndex:gD.Node}),this._centerPointMark=i)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var t,e,i,s;const n=this._nodePointMark;if(!n)return;const r=null!==(e=null===(t=this._spec.nodePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(n,{x:t=>t[n$],y:t=>t[r$],size:t=>t[a$],fill:null!==(i=r.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(s=r.fillOpacity)&&void 0!==s?s:1,lineWidth:0},_D.STATE_NORMAL,mD.Series)}_initRipplePointMarkStyle(){var t,e,i,s,n;const r=this._ripplePointMark;if(!r)return;const a=null!==(e=null===(t=this._spec.ripplePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(r,{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!==(i=a.fill)&&void 0!==i?i:this.getColorAttribute(),opacity:null!==(s=a.fillOpacity)&&void 0!==s?s:.2,ripple:null!==(n=a.ripple)&&void 0!==n?n:0},_D.STATE_NORMAL,mD.Series)}_initCenterPointMarkStyle(){var t,e,i,s,n,r;const a=this._centerPointMark;a&&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:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(i=null===(e=null===(t=this._spec.centerPoint)||void 0===t?void 0:t.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(r=null===(n=null===(s=this._spec.centerPoint)||void 0===s?void 0:s.style)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1},_D.STATE_NORMAL,mD.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},_D.STATE_NORMAL,mD.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(rz(null===(e=hI.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),az("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(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}g$.type=AO.correlation,g$.mark=s$,g$.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},g$.transformerConstructor=p$;const f$=()=>{Wz(),UN(),JA(),hI.registerMark(d$.type,d$),hI.registerGraphicComponent("symbol",(t=>Tg(t))),hI.registerSeries(g$.type,g$),hI.registerAnimation("correlation",((t,e)=>Object.assign({appear:u$(0,e)},rF)))},m$=Object.assign(Object.assign({},ZF),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class v$ extends WN{constructor(){super(...arguments),this.type=v$.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}v$.type="liquid";const _$=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class y$ extends jF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class b$ extends gz{constructor(){super(...arguments),this.type=AO.liquid,this.transformerConstructor=Uz,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Ig({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Tg({x:s,y:n,size:r,symbolType:_$(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){u(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=KO(this._spec.outlineMargin),this._paddingSpec=KO(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Ut(...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(b$.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(b$.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(b$.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(b$.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const t=this._liquidOutlineMark;t.created(),this.setMarkStyle(t,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",mD.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const t=this._liquidBackgroundMark;t.created(),this.setMarkStyle(t,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",mD.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const t=this._liquidMark,e=this._liquidGroupMark;e&&this.setMarkStyle(e,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),t&&this.setMarkStyle(t,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",mD.Series)}initTooltip(){this._tooltipHelper=new y$(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(rz(null===(i=hI.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),az("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(rz(null===(s=hI.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),az("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(CL.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=SM(t.attribute.fill,n.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]}}b$.type=AO.liquid,b$.mark=m$,b$.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},b$.transformerConstructor=Uz;const x$=t=>G(t).join(",");class S$ extends jF{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>x$(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>x$(null==t?void 0:t[this.series.getDimensionField()[0]])}}const k$=Object.assign(Object.assign({},ZF),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class A$ extends pz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const M$=(t,e)=>{const i=e.getViewBox();return i&&(null==t?void 0:t.length)?UG(Object.assign({setField:e.setField,valueField:e.valueField},i),t):[]};class w$ extends gz{constructor(){super(...arguments),this.type=AO.venn,this.transformerConstructor=A$,this._viewBox=new je}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:zI)}initData(){var t;super.initData(),LL(this._dataSet,"venn",M$),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:{getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField}})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(w$.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(w$.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()},_D.STATE_NORMAL,mD.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},_D.STATE_NORMAL,mD.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},_D.STATE_HOVER,mD.Series))}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>x$(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)}},_D.STATE_NORMAL,mD.Series))}initOverlapLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>x$(t.sets)},_D.STATE_NORMAL,mD.Series))}initTooltip(){this._tooltipHelper=new S$(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(){super.onLayoutEnd(),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:x$(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return x$(i)}legendSelectedFilter(t,e){if(t.type===n.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[x$(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>G(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(x$(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(rz(null===(e=hI.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),az(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(rz(null===(e=hI.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),az(t.name,this._spec,this._markAttributeContext)))}))}}w$.type=AO.venn,w$.mark=k$,w$.builtInTheme={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"}}}}},w$.transformerConstructor=A$;class T$ extends EV{constructor(){super(...arguments),this.type=AO.mosaic,this.transformerConstructor=BV}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(QI),this.setFieldX2(JI)),this.setFieldY(eL),this.setFieldY2(tL)):(t&&(this.setFieldY(QI),this.setFieldY2(JI)),this.setFieldX(eL),this.setFieldX2(tL)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&d(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];d(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}T$.type=AO.mosaic,T$.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},T$.transformerConstructor=BV;class C$ extends AH{_isValidSeries(t){return t===AO.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class B$ extends SH{constructor(){super(...arguments),this.transformerConstructor=C$,this.type="map",this.seriesType=AO.map}}B$.type="map",B$.seriesType=AO.map,B$.transformerConstructor=C$;const E$=()=>{nV(),oN(),ZV(),hI.registerSeries(hN.type,hN),hI.registerImplement("registerMap",HL),hI.registerImplement("unregisterMap",VL),lF(),hI.registerChart(B$.type,B$)};class P$ extends AH{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=G(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 u(r)&&n.forEach((t=>{d(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],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),u(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class R$ extends P${needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_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)),d(l.type)&&(l.type="linear"),d(o.type)&&(o.type="band");const h=ij(l,{min:0,max:1});d(l.min)&&(l.min=h.min),d(l.max)&&(l.max=h.max),s&&Object.assign(l,lI({},s,l)),n&&Object.assign(o,lI({},n,o))}}class O$ extends P${needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}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 I$ extends P${needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class L$ extends SH{constructor(){super(...arguments),this.transformerConstructor=I$}}L$.transformerConstructor=I$;class D$ extends L${constructor(){super(...arguments),this.transformerConstructor=I$,this.type="pie",this.seriesType=AO.pie}}D$.type="pie",D$.seriesType=AO.pie,D$.transformerConstructor=I$;class F$ extends O${_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return n.radius=null!==(e=t.radius)&&void 0!==e?e:_j,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:_j,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}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&&d(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=G(t.crosshair||{}).map((t=>lI({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const z$=(t,e)=>{if(!t)return null;const i=Pz(t,(t=>"angle"===t.getOrient()),e),s=Pz(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&sB(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),u={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=fO({x:1,y:0},u);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=mO(u),f=null===(e=s[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(d(v))return;let _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=Bz(v,t,"polar",r);n.push({index:_,value:v,position:i.scale(v),axis:t,data:y})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&sB(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let u=fO({x:1,y:0},c);u<-Math.PI/2&&(u=2*Math.PI+u);const p=mO(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((u-(null==f?void 0:f[0]))*(u-(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=s.invert(p);if(d(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const _=Bz(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:_})}})),n.length?n:null};class j$ extends SH{constructor(){super(...arguments),this.transformerConstructor=F$,this.type="rose",this.seriesType=AO.rose}_setModelOption(){this._modelOption.getDimensionInfo=z$}}j$.type="rose",j$.seriesType=AO.rose,j$.transformerConstructor=F$,U(j$,BH);const H$=()=>{iV(),nV(),OH(),RH(),rU(),hI.registerChart(j$.type,j$)};class V$ extends O${_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t);return i.line=t.line,i.point=t.point,i.stack=t.stack,i.percent=t.percent,i.area=lI({visible:!1},t.area),i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"area",i.activePoint=t.activePoint,i.pointDis=t.pointDis,i.pointDisMul=t.pointDisMul,i.markOverlap=t.markOverlap,i}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=G(t.crosshair||{}).map((t=>lI({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class N$ extends SH{constructor(){super(...arguments),this.transformerConstructor=V$,this.type="radar",this.seriesType=AO.radar}_setModelOption(){this._modelOption.getDimensionInfo=z$}}N$.type="radar",N$.seriesType=AO.radar,N$.transformerConstructor=V$,U(N$,BH);const W$=()=>{iV(),nV(),aV(),OH(),RH(),gU(),hI.registerChart(N$.type,N$)};class U$ extends AH{_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=p(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=>{P(e,"trimPadding")&&lI(e,cD(this.type,t))})),this._transformAxisSpec(t)}}class G$ extends SH{constructor(){super(...arguments),this.transformerConstructor=U$,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=jH(t,e,i))&&void 0!==s?s:[],...null!==(n=z$(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=VH,this._modelOption.getRectByDimensionData=XH}}G$.type="common",G$.transformerConstructor=U$,U(G$,BH);class Y$ extends MH{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class X$ extends SH{constructor(){super(...arguments),this.transformerConstructor=Y$}}X$.transformerConstructor=Y$,U(X$,BH);class $$ extends Y${transformSpec(t){super.transformSpec(t),oD(t)}}class K$ extends X${constructor(){super(...arguments),this.transformerConstructor=$$,this.type="histogram",this.seriesType=AO.bar}_setModelOption(){this._modelOption.getDimensionInfo=jH,this._modelOption.getDimensionInfoByValue=VH,this._modelOption.getRectByDimensionData=XH}}K$.type="histogram",K$.seriesType=AO.bar,K$.transformerConstructor=$$;const q$=()=>{iV(),nV(),aV(),OH(),RH(),PV(),hI.registerTransform("bin",Xr),hI.registerChart(K$.type,K$)};class Z$ extends R${_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class J$ extends SH{constructor(){super(...arguments),this.transformerConstructor=Z$,this.type="circularProgress",this.seriesType=AO.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=z$}}J$.type="circularProgress",J$.seriesType=AO.circularProgress,J$.transformerConstructor=Z$,U(J$,BH);const Q$=()=>{iV(),nV(),OH(),RH(),RU(),hI.registerChart(J$.type,J$)};class tK extends R${_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=AO.circularProgress,e}transformSpec(t){var e,i,s,n,r;super.transformSpec(t);let a=null===(e=t.series)||void 0===e?void 0:e.find((t=>t.type===AO.gauge||t.type===AO.circularProgress));d(a)&&(a=null!==(i=t.gauge)&&void 0!==i?i:this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===a.type&&(d(a.radiusField)&&d(a.categoryField)&&(a.radiusField=null!==(n=null!==(s=t.radiusField)&&void 0!==s?s:t.categoryField)&&void 0!==n?n:t.seriesField),d(a.valueField)&&d(a.angleField)&&(a.valueField=null!==(r=t.valueField)&&void 0!==r?r:t.angleField)),1===t.series.length?t.series.push(a):t.series.forEach((t=>{t.type===a.type&&Object.keys(a).forEach((e=>{e in t||(t[e]=a[e])}))}))),a.type===AO.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:gD.Region+50}):this._transformGaugeAxisSpec(t)}_transformGaugeAxisSpec(t){var e;t.axes||(t.axes=[]);const i={radius:null,angle:null};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=t),"angle"===e&&(i.angle=t)})),i.angle||(i.angle={orient:"angle",visible:!0},t.axes.push(i.angle)),i.radius||(i.radius={orient:"radius",visible:!1},t.axes.push(i.radius)),d(i.angle.type)&&(i.angle.type="linear"),d(i.radius.type)&&(i.radius.type="linear"),d(i.angle.zIndex)&&(i.angle.zIndex=gD.Region+50)}}class eK extends SH{constructor(){super(...arguments),this.transformerConstructor=tK,this.type="gauge",this.seriesType=AO.gaugePointer}}eK.type="gauge",eK.seriesType=AO.gaugePointer,eK.transformerConstructor=tK;const iK=()=>{nV(),XX(),hI.registerSeries(KX.type,KX),LW(),BU(),eU(),RU(),hI.registerChart(eK.type,eK)};class sK extends AH{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class nK extends SH{constructor(){super(...arguments),this.transformerConstructor=sK,this.type="wordCloud",this.seriesType=AO.wordCloud}}nK.transformerConstructor=sK;class rK extends nK{constructor(){super(...arguments),this.transformerConstructor=sK,this.type="wordCloud",this.seriesType=AO.wordCloud}}rK.type="wordCloud",rK.seriesType=AO.wordCloud,rK.transformerConstructor=sK;const aK=()=>{nV(),bY(),hI.registerChart(rK.type,rK)};class oK extends AH{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class lK extends SH{constructor(){super(...arguments),this.transformerConstructor=oK,this.type="funnel",this.seriesType=AO.funnel}}lK.type="funnel",lK.seriesType=AO.funnel,lK.transformerConstructor=oK;const hK=()=>{nV(),HY(),hI.registerChart(lK.type,lK)};class cK extends MH{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}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)),d(s.type)&&(s.type="band"),d(i.type)&&(i.type="linear");const n=ij(i,{min:0,max:1});d(i.min)&&(i.min=n.min),d(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)),d(s.type)&&(s.type="linear"),d(e.type)&&(e.type="band");const n=ij(s,{min:0,max:1});d(s.min)&&(s.min=n.min),d(s.max)&&(s.max=n.max)}}}class dK extends SH{constructor(){super(...arguments),this.transformerConstructor=cK,this.type="linearProgress",this.seriesType=AO.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=jH,this._modelOption.getDimensionInfoByValue=VH,this._modelOption.getRectByDimensionData=XH}}dK.type="linearProgress",dK.seriesType=AO.linearProgress,dK.transformerConstructor=cK,U(dK,BH);const uK=()=>{iV(),nV(),OH(),RH(),jU(),hI.registerChart(dK.type,dK)};class pK extends MH{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"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),oD(t)}}class gK extends SH{constructor(){super(...arguments),this.transformerConstructor=pK,this.type="rangeColumn",this.seriesType=AO.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=jH,this._modelOption.getDimensionInfoByValue=VH,this._modelOption.getRectByDimensionData=XH}}gK.type="rangeColumn",gK.seriesType=AO.rangeColumn,gK.transformerConstructor=pK;const fK=()=>{iV(),nV(),OH(),RH(),vW(),hI.registerChart(gK.type,gK)};class mK extends AH{_getDefaultSeriesSpec(t){const e=u(t.startAngle)?t.startAngle:-90,i=u(t.endAngle)?t.endAngle:e+ae(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class vK extends SH{constructor(){super(...arguments),this.transformerConstructor=mK,this.type="sunburst",this.seriesType=AO.sunburst}}vK.type="sunburst",vK.seriesType=AO.sunburst,vK.transformerConstructor=mK;const _K=()=>{nV(),nX(),hI.registerChart(vK.type,vK)};class yK extends AH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class bK extends SH{constructor(){super(...arguments),this.transformerConstructor=yK,this.type="circlePacking",this.seriesType=AO.circlePacking}}bK.type="circlePacking",bK.seriesType=AO.circlePacking,bK.transformerConstructor=yK;const xK=()=>{nV(),cX(),hI.registerChart(bK.type,bK)};class SK extends AH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class kK extends SH{constructor(){super(...arguments),this.transformerConstructor=SK,this.type="treemap",this.seriesType=AO.treemap}}kK.type="treemap",kK.seriesType=AO.treemap,kK.transformerConstructor=SK;const AK=()=>{nV(),FX(),hI.registerChart(kK.type,kK)};class MK extends RV{transformSpec(t){super.transformSpec(t),t.legends&&G(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),oD(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class wK extends OV{constructor(){super(...arguments),this.transformerConstructor=MK,this.type="waterfall",this.seriesType=AO.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=jH,this._modelOption.getDimensionInfoByValue=VH,this._modelOption.getRectByDimensionData=XH}}wK.type="waterfall",wK.seriesType=AO.waterfall,wK.transformerConstructor=MK;const TK=()=>{iV(),nV(),aV(),OH(),RH(),zN(),hI.registerChart(wK.type,wK)};class CK extends MH{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),oD(t)}}class BK extends SH{constructor(){super(...arguments),this.transformerConstructor=CK,this.type="boxPlot",this.seriesType=AO.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=jH,this._modelOption.getDimensionInfoByValue=VH,this._modelOption.getRectByDimensionData=XH}}BK.type="boxPlot",BK.seriesType=AO.boxPlot,BK.transformerConstructor=CK;const EK=()=>{iV(),nV(),OH(),RH(),aW(),hI.registerTransform("boxplot",$r),hI.registerChart(BK.type,BK)};class PK extends AH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class RK extends SH{constructor(){super(...arguments),this.transformerConstructor=PK,this.type="sankey",this.seriesType=AO.sankey}_setStateInDatum(t,e,i,s){const n=_(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=kL(t))||void 0===e?void 0:e.datum;return _(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}RK.type="sankey",RK.seriesType=AO.sankey,RK.transformerConstructor=PK;const OK=()=>{nV(),yo.load(fM),BX(),hI.registerChart(RK.type,RK)};class IK extends MH{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.area=t.area,s.point=t.point,s.line=t.line,"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),oD(t)}}class LK extends SH{constructor(){super(...arguments),this.transformerConstructor=IK,this.type="rangeArea",this.seriesType=AO.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=jH,this._modelOption.getDimensionInfoByValue=VH,this._modelOption.getRectByDimensionData=XH}}LK.type="rangeArea",LK.seriesType=AO.rangeArea,LK.transformerConstructor=IK;const DK=()=>{iV(),nV(),aV(),OH(),RH(),cV(),Jj(),$j(),hI.registerSeries(SW.type,SW),hI.registerChart(LK.type,LK)};class FK extends MH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class zK extends SH{constructor(){super(...arguments),this.transformerConstructor=FK,this.type="heatmap",this.seriesType=AO.heatmap}}zK.type="heatmap",zK.seriesType=AO.heatmap,zK.transformerConstructor=FK;const jK=()=>{nV(),i$(),hI.registerChart(zK.type,zK)};class HK extends AH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class VK extends SH{constructor(){super(...arguments),this.transformerConstructor=HK,this.type="correlation",this.seriesType=AO.correlation}}VK.type="correlation",VK.seriesType=AO.correlation,VK.transformerConstructor=HK;const NK=()=>{nV(),f$(),hI.registerChart(VK.type,VK)};function WK(t){var e,i;const s=Object.assign({},t);return E(t.style)||(s.textStyle=xL(t.style)),E(t.textStyle)||lI(s.textStyle,xL(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&xL(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&xL(s.background.style),s}const UK=(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},GK=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const p={};c.forEach((t=>{p[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:jI;return h?h(t,c,g):(_(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===p[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===p[t.source]&&!0===p[t.target])))):u(g)&&(t=t.filter((t=>!0===p[r.getSeriesFieldValue(t,g)]))),t)};class YK extends Aj{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=gD.Legend,this.layoutLevel=fD.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{_O(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),_O(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=WO(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;u(s)&&(this._seriesUserId=G(s)),u(e)&&(this._regionUserId=G(e)),u(n)&&(this._seriesIndex=G(n)),u(i)&&(this._regionUserIndex=G(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_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):(N(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const t=this._initLegendData();t.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new WD(this._option,t),this._initSelectedData(),_O(this._regions,(t=>{t.event.on(CL.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){var e,i,s;const n=this._selectedData;d(t)||JSON.stringify(n)===JSON.stringify(t)||(_O(this._regions,(e=>{e.legendSelectedFilter&&(t=e.legendSelectedFilter(this,t))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...t],null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(CL.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;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)N(s,this._cacheAttrs)||this._legendComponent.setAttributes(lI({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(lI({},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 t,e;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());N(t,this._cacheAttrs)||this._legendComponent.setAttributes(lI({},t,{defaultSelected:this._selectedData}))}null===(e=(t=this.effect).onSelectedDataChange)||void 0===e||e.call(t),this.event.emit(CL.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}YK.specKey="legends";class XK extends YK{constructor(){super(...arguments),this.type=n.discreteLegend,this.name=n.discreteLegend}static getSpecInfo(t){return BF(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(t){super.init(t),_O(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:XL.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){LL(this._option.dataSet,"discreteLegendFilter",GK),LL(this._option.dataSet,"discreteLegendDataMake",UK);const t=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return _O(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(d(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(!qy(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 c(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)&&d(t.title.text)&&d(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=lL(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(e){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(e,i){const s=t(e,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:n={},item:r={},pager:a={},background:o={}}=e;n=I(n),r=I(r),a=I(a),o=I(o);const l=s;return n.visible?l.title=WK(n):l.title={visible:!1},E(r.focusIconStyle)||xL(r.focusIconStyle),r.shape&&(r.shape=_L(r.shape)),r.label&&(r.label=_L(r.label)),r.value&&(r.value=_L(r.value)),r.background&&(r.background=_L(r.background)),UO(r.maxWidth)&&(r.maxWidth=Number(r.maxWidth.substring(0,r.maxWidth.length-1))*i.width/100),UO(r.width)&&(r.width=Number(r.width.substring(0,r.width.length-1))*i.width/100),UO(r.height)&&(r.height=Number(r.height.substring(0,r.height.length-1))*i.width/100),l.item=r,"scrollbar"===a.type?(E(a.railStyle)||xL(a.railStyle),E(a.sliderStyle)||xL(a.sliderStyle)):(E(a.textStyle)||xL(a.textStyle),a.handler&&_L(a.handler)),l.pager=a,o.visible&&!E(o.style)&&(lI(l,o.style),u(o.padding)&&(l.padding=o.padding)),l}(this._spec,e)),{maxWidth:e.width,maxHeight:e.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return wR}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(yR.legendItemClick,(e=>{const i=P(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(CL.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(yR.legendItemHover,(t=>{const e=P(t,"detail");this.event.emit(CL.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(yR.legendItemUnHover,(t=>{const e=P(t,"detail");this.event.emit(CL.legendItemUnHover,{model:this,value:e,event:t})}))}}_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 c(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}=CF(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=CF(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}XK.specKey="legends",XK.builtInTheme={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}},XK.type=n.discreteLegend;const $K=(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[]},KK=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!p(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!E(o)){const[e,i]=o;return a?a(t,o,l):h(t)?vL(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};function qK(e){const i=lI({},e),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:d,background:p={},type:g,id:f,visible:m,orient:v,position:_,data:y,defaultSelected:b,field:x,filter:S,regionId:k,regionIndex:A,seriesIndex:M,seriesId:w,padding:T}=i,C=t(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?C.title=WK(s):C.title={visible:!1},C.showHandler=!1!==n.visible,E(n.style)||(C.handlerStyle=xL(n.style)),u(r.width)&&(C.railWidth=r.width),u(r.height)&&(C.railHeight=r.height),E(r.style)||(C.railStyle=xL(r.style)),E(a.style)||(C.trackStyle=xL(a.style)),C.startText=_L(o),C.endText=_L(l),C.handlerText=function(t){if(!t)return t;const e=Object.assign({},t),i=t.style;return c(i)?e.style=(t,e,s)=>xL(i(t,e,s)):E(i)||(e.style=xL(i)),e}(h),E(d)||(C.sizeBackground=xL(d)),p.visible&&!E(p.style)&&(lI(C,p.style),u(p.padding)&&(C.padding=p.padding)),C}const ZK={color:PR,size:OR},JK={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}},QK=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},JK),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},tq={horizontal:QK(!0),vertical:QK(!1)},eq=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},JK),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},iq={horizontal:eq(!0),vertical:eq(!1)},sq=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],nq=[2,10];class rq extends YK{static getSpecInfo(t){const e=BF(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?n.colorLegend:n.sizeLegend})),e}constructor(t,e){super(t,e),this.type=n.colorLegend,this.name=n.colorLegend;const i="color"===this._spec.type?n.colorLegend:n.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),_O(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData,customFilter:this._spec.customFilter},level:XL.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(){LL(this._option.dataSet,"continuousLegendFilter",KK),LL(this._option.dataSet,"continuousLegendDataMake",$K);const t=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>yO(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)&&d(t.title.text)&&d(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=lL(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!qy(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=lL(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var e,i;const s="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",n="horizontal"===s?"bottom":this.layoutOrient;let r=[];const a=this._getScaleInGlobal();a&&"linear"===a.type&&(r=a.range()),E(r)&&(r="color"===this._legendType?sq:nq);let o=null!==(e=this._legendData.getLatestData()[0])&&void 0!==e?e:0,l=null!==(i=this._legendData.getLatestData()[1])&&void 0!==i?i:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(o=Math.min(0,this._legendData.getLatestData()[0]),l=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const h=Object.assign({layout:s,align:n,zIndex:this.layoutZIndex,min:o,max:l,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:r},qK(this._spec));return this._addDefaultTitleText(h),h}_getLegendConstructor(){return ZK[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",bt((e=>{const i=P(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(CL.legendFilter,{model:this,value:i,event:e})}),30))}}}rq.specKey="legends",rq.builtInTheme={colorLegend:tq,sizeLegend:iq},rq.type=n.continuousLegend;const aq=()=>{hI.registerComponent(rq.type,rq)},oq=(t,e)=>u(e)?t.map((t=>e[t])):void 0,lq=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),hq=t=>!d(t)&&(_(t)?t.length>0&&t.every(u):Object.keys(t).length>0);function cq(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),p=i.getOption(),g=p.getRegionsInUserIdOrIndex(u(c.regionId)?[c.regionId]:void 0,u(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=dq(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),_=g.getLayoutRect(),y=p.globalInstance.getContainer(),b=Object.assign({x:0,y:0},y?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(y):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>lq(i,s)(t)&&lq(n,r)(t)&&(d(a)||lq([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),k=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),_.width),y:Math.min(Math.max(t.y,0),_.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.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 l=[{value:t[e.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=>x(t))))&&void 0!==i?i:[]}}))}];u(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=p.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:BL.chart,event:k({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=p.globalInstance;return SF.globalConfig.uniqueTooltip&&SF.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=p.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:BL.chart,event:k(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=p.globalInstance;return SF.globalConfig.uniqueTooltip&&SF.hideTooltip(a.id),m}return"none"}const dq=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),p=e.getMeasureField(),g=e.getSeriesField(),f=u(g)?t[g]:void 0,m=u(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=oq(c,t);let _=oq(p,t);const y=hq(_),b=!y&&u(g)&&d(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(lq(c,v));if(!y&&(_=oq(p,i),!hq(_)))return;const n=e.type===AO.pie?e.dataToCentralPosition(i):e.dataToPosition(i);d(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:p,measureData:_,hasMeasureData:y,groupField:g,groupData:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=sB(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])=>d(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(lq(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=oq(p,o),!hq(_))return;const l=t.dataToPosition(o);d(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:p,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(lq(c,n));if(!y&&(_=oq(p,r),!hq(_)))return;const o=t.dataToPosition(r);if(d(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:p,measureData:_,hasMeasureData:y,groupField:g,groupData:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===AO.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(lq(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(_=oq(p,i),!hq(_))return;const r=t.dataToPosition(i);d(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:p,measureData:_,hasMeasureData:y,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&(()=>{var i,n,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(lq(c,v));const o=e.getNameMap(),l=null===(r=null===(n=e.getMapViewData)||void 0===n?void 0:n.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=_;if(l&&!a&&(a=Object.assign({},t)),!y){if(_=oq(p,a),h=_,!hq(_)&&!a)return;hq(_)||(_=[null])}const u=e.dataToPosition(a);d(u)||isNaN(u.x)||isNaN(u.y)||s.push({pos:u,data:{dimensionFields:c,dimensionData:v,measureFields:p,measureData:h,hasMeasureData:y,groupField:g,groupData:f,originDatum:a},series:e})})()})),s},uq=t=>u(t)&&!_(t),pq=t=>u(t)&&_(t);class gq extends kj{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i,s,n;const{spec:r,theme:a}=super._initTheme(t,e);return r.style=lI({},this._theme,r.style),r.offset=lI({},a.offset,t.offset),r.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:a.transitionDuration,r.trigger=null!==(s=t.trigger)&&void 0!==s?s:a.trigger,r.triggerOff=null!==(n=t.triggerOff)&&void 0!==n?n:a.triggerOff,{spec:r,theme:a}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(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 u(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]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:Yy(this._option.mode)||!Uy(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.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,u(t.parentElement)?v(t.parentElement)&&(t.parentElement=S_.getElementById(t.parentElement)):Uy(this._option.mode)&&(t.parentElement=null==Wy?void 0:Wy.body)}}const fq={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}};class mq extends Aj{constructor(){super(...arguments),this.layoutZIndex=1,this.type=n.tooltip,this.name=n.tooltip,this.transformerConstructor=gq,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=Uy(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||p(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return d(t.mark)&&d(t.model)&&d(t.datum)}(t)&&(n&&uq(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):u(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!d(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&SF.globalConfig.uniqueTooltip&&l&&SF.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=t=>{var e,i,s;if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return 0;this.event.emit(CL.tooltipHide,Object.assign(Object.assign({},t),{source:BL.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const n=null!==(s=this._spec.handler)&&void 0!==s?s:this.tooltipHandler;if(null==n?void 0:n.hideTooltip){const e=n.hideTooltip.call(n,t);return e||(this._isTooltipShown=!1),e}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:BL.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),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(CL.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(CL.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,this._enterable=!1;else{const t="canvas"===s?ZH.canvas:ZH.dom,n=hI.getComponentPluginInType(t);n||Hy("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,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=hI.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=G(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=G(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(Gy(s)||Yy(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):p(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>p(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=x(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,xt(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(p(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===s||s.call(i)}else 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=cq(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(d(this._cacheInfo)||d(t))return!1;if(pq(t)){if(uq(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>Tz(t,e[i])))}if(pq(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!d(n)&&!d(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: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}getVisible(){return!1!==this._spec.visible}}mq.type=n.tooltip,mq.transformerConstructor=gq,mq.builtInTheme={tooltip:fq},mq.specKey="tooltip";var vq,_q;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(vq||(vq={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(_q||(_q={}));const yq={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class bq extends Aj{get enableRemain(){return"none"===this.triggerOff}constructor(t,e){super(t,e),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=gD.CrossHair_Grid,this.labelZIndex=gD.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),x(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=xt((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(p(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.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{sB(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_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}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||N(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(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:EL.chart}:{source:BL.chart};_(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;_(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}onBeforeRender(){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:t=s["desktop-browser"]}=this._option,e=function(t){return t===s["desktop-browser"]||t===s["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:Gy(t)||Yy(t)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(t);if(e){const t=G(this.trigger||"hover"),i=t=>"click"===t?"none"===this.triggerOff?null:e.clickOut:e.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:e[t],out:i(t)})})),s}return null}_registerTooltipEvent(){this.event.on(CL.tooltipHide,{source:BL.chart},this._handleTooltipHideOrRelease),this.event.on(CL.tooltipShow,{source:BL.chart},this._handleTooltipShow),this.event.on(CL.tooltipRelease,{source:BL.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=P(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{yq[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=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const u=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+u.left),o=Math.min(o,i-d+u.top),l=Math.max(l,e+t.getLayoutRect().width-c-u.right),h=Math.max(h,i+t.getLayoutRect().height-d-u.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_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)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||x(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(e,i){var s,n,r;const a={},{line:o={},label:l={},visible:c}=e;if(a.visible=c,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=t(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(x(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=P(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==e?void 0:e.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=e.line.style.stroke);const t=P(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 e=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=e.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:c,outerBorder:d}=n,u=t(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:e.minWidth,maxWidth:e.maxWidth,padding:e.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:P(s,"stroke")}),panel:(h(e.visible)?e.visible:e)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:c,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{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||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}bq.specKey="crosshair";const xq={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}}}}};class Sq extends bq{static getSpecInfo(t){return BF(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=n.cartesianCrosshair,this.name=n.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_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)}}_getDatumAtPoint(t,e){const i=_z(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){_z(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(u(t.dimType)?"y"===t.dimType:yz(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();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 o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=bO(this._regions,"cartesian");e&&(NH(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=GH(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new aw(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new ow(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}Sq.specKey="crosshair",Sq.builtInTheme={crosshair:xq},Sq.type=n.cartesianCrosshair;class kq extends bq{static getSpecInfo(t){return BF(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=n.polarCrosshair,this.name=n.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_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)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_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}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=bO(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&u(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=ej(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=CF(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:le(d,a.getInnerRadius(),o),end:le(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=ce(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=le(t,o,r),d=le(t,o,h),m=me([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=mt(ne.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new aw(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new hw(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new cw(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new lw(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=de(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}}(u):function(t){let e="center",i="middle";return e=(t=de(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}}(g.startAngle),a="angle"===l?le(e,p[1]+m.offset,u):le(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}kq.specKey="crosshair",kq.builtInTheme={crosshair:xq},kq.type=n.polarCrosshair;const Aq=()=>{hI.registerComponent(kq.type,kq)},Mq=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(d(o)||d(a))return t;const l=r(),h=_(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},wq=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(d(a)||d(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=>{let e=!1;return G(r).every((i=>{t[i]>=a[0]&&t[i]<=Y(a)&&(e=!0)})),e}:t=>{let e=!1;return G(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},Tq=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],p=[],g=[];let f=!1,m=!1;n.forEach(((t,e)=>{var n;if(d(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);u(null==t?void 0:t.max)&&u(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{d(h[t])&&(g.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{G(i[e]).forEach((i=>{d(t[i])||(d(h[t[i]])&&(g.push(t[i]),h[t[i]]=0,c.push(t[i])),d(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const v=f?g:!1===r||m?g.sort(((t,e)=>t-e)):c;return v.forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),p.push(e)})),p},Cq=(t,e,i)=>{const s=e.domain();if(eB(e.type))return i?s[0]+(Y(s)-s[0])*(1-t):s[0]+(Y(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+(Y(n)-n[0])*t;return e.invert(r)},Bq=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&eB(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/(Y(n)-n[0])))},Eq=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},Pq=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}},Rq=(t,e,i)=>"start"===t?"percent"===e&&u(i.start)||"value"===e&&u(i.startValue):"percent"===e&&u(i.end)||"value"===e&&u(i.endValue),Oq=(t,e,i)=>{if(eB(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class Iq{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})}constructor(t,e,i,s,n,r,a,o){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.initZoomEvent=()=>{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:u(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,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),d=Math.abs(this.getState().start-this.getState().end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=mt(this.getState().start+f,0,1),_=mt(this.getState().end-m,0,1);this._handleChange(Math.min(v,_),Math.max(v,_),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Vt(s/n)>=.5:Vt(n/s)>=.5;if(this._scrollAttr.reverse||(r=-r),a){const t=this._spec.scrollStep;if(k(t)){r=(r>0?1:-1)*(t*(this.getState().end-this.getState().start)/1)}this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1)}const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))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.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===Sz(xz(e))}setEventAttrFromSpec(){!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,h(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&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.getEvent(),this._option.mode)}}U(Iq,nN);class Lq extends Aj{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:Bq(t,this._stateScale,this._isHorizontal),a="percent"===n?e:Bq(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var t;this._dataFilterEvent.initZoomEvent(),null===(t=this._relatedAxisComponent)||void 0===t||t.event.on(CL.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_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)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=Eq(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[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._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._currentDataCollection=[],this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=Oq(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!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&&Pq(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({value:"force"})}else _O(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),_O(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=xz(t),this._isHorizontal="horizontal"===Sz(this._orient),this._dataFilterEvent=new Iq(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){this._handleDataCollectionChangeBound=this._handleDataCollectionChange.bind(this),super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||N(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])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(eB(n.type)){const r=n.domain(),a=r[0],o=Y(r)-a,l=u(t)?a+o*t:+e,h=u(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=u(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=u(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}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}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_setAxisFromSpec(){if(u(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):u(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),d(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>Sz(t._orient)===Sz(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!eB(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(u(i)&&(u(i.userId)&&(this._seriesUserId=G(i.userId)),u(i.specIndex)&&(this._seriesIndex=G(i.specIndex))),u(this._spec.seriesId)){const t=G(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(u(this._spec.seriesIndex)){const t=G(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(u(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(G(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(u(this._spec.regionId)){const t=G(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}_collectDataInfo(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};_O(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l,u=eB(d.getScale(0).type),p=eB(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?G(g.xField):G(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?G(g.yField):G(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:d===l?f:m;u&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else _O(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});return{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}}_initData(){const{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}=this._collectDataInfo(),{dataSet:r}=this._option;DL(r,"dataview",Ma),LL(r,"dataFilterComputeDomain",Tq);const a=new Ba(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new WD(this._option,a),a.reRunAllTransform(),this._currentDataCollection=t,r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChangeBound)}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(LL(this._option.dataSet,"dataFilterWithNewDomain",wq),LL(this._option.dataSet,"lockStatisticsFilter",Mq),_O(this._regions,(t=>{t.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>t.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>eB(this._stateScale.type)},level:1},!1),t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>eB(this._stateScale.type)},level:XL.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r}=this._collectDataInfo();if(this._currentDataCollection.length!==e.length||this._currentDataCollection.some(((t,i)=>t!==e[i]))){this._currentDataCollection.forEach((t=>{var e;null===(e=null==t?void 0:t.target)||void 0===e||e.removeListener("change",this._handleDataCollectionChangeBound)})),this._currentDataCollection=e;const{dataSet:t}=this._option;t.multipleDataViewAddListener(this._currentDataCollection,"change",this._handleDataCollectionChangeBound)}this._data.getDataView().transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data.getDataView().reRunAllTransform();const a=this._computeDomainOfStateScale(eB(this._stateScale.type));this._stateScale.domain(a,!1),(u(this._spec.start)||u(this._spec.end))&&this._setStateFromSpec(),this._handleChange(this._start,this._end,!0),this._spec.auto&&!N(this._domainCache,a)&&(this._domainCache=a,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;Rq("start",i,this._spec)&&Rq("end",s,this._spec)&&(t="percent"===i?this._spec.start:Bq(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:Bq(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?Bq(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?Bq(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=Cq(this._start,this._stateScale,Eq(i,this._isHorizontal)),this._endValue=Cq(this._end,this._stateScale,Eq(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,eB(this._stateScale.type)&&this._stateScale.domain()[0]!==Y(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(Y(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(Y(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=Oq(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&_O(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);k(null==i?void 0:i.min)&&k(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new GB:new AB,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_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}_autoVisible(t){if(!this._auto)return;t?this.show():this.hide();const e=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[e]:t?this[`_${e}`]:0},{[e]:mD.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_autoUpdate(t){var e,i,s,r,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(),u=Pq(h);if(!this._dataUpdating&&sB(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==u?void 0:u.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===(r=this._cacheRect)||void 0===r?void 0:r.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==u?void 0:u.bandSize,sB(c.type)){u&&(this._start||this._end)&&(this.type===n.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!d(t)||!d(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),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}U(Lq,nN);class Dq extends kj{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=lI({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=_(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}const Fq=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),zq={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:Fq(!1),startHandler:{style:{symbolType:"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;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"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;",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:Fq(!0)};class jq extends Lq{constructor(t,e){var i;super(t,e),this.type=n.dataZoom,this.name=n.dataZoom,this.transformerConstructor=Dq,this.specKey="dataZoom",this.layoutZIndex=gD.DataZoom,this.layoutLevel=fD.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,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=this._isHorizontal?0:this._middleHandlerSize,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._getPreviewStateScale(),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._getPreviewStateScale(),n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"filter"}_handleChange(t,e,i,s){if(super._handleChange(t,e,i),this._shouldChange)if(i&&this._component)this._component.setStartAndEnd(t,e);else{const i=this._relatedAxisComponent,n=Cq(t,this._stateScale,Eq(i,this._isHorizontal)),r=Cq(e,this._stateScale,Eq(i,this._isHorizontal));if(!u(n)||!u(r))return;this._start=t,this._end=e;(c(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,n,r):this._handleStateChange(n,r,s))&&this.event.emit(CL.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:t,end:e,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){this._data.getDataView().reRunAllTransform(),this._initAfterLayout();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new GB),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(Eq(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=Eq(t,this._isHorizontal),this.effect.onZoomChange())}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,d=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+d,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+d),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);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(),d(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=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize),d(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=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize);const u=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=u?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new GB;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(Eq(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[$(e),X(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!eB(t.type)||e[0]!==Y(e))&&(!sB(t.type)||1!==(i=e,i&&_(i)?Array.from(new Set(G(i))):i).length);var i}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_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:x(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:x(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_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._computeWidth(),height:this._computeHeight()},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:u(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,isReverse:Eq(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=!1!==this._spec.showBackgroundChart,i=this._getAttrs(e),s=this._relatedAxisComponent;if(this._component)this._component.setAttributes(i),t&&(this._component.setPreviewData(this._data.getDataView().latestData),e&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>Cq(t,this._stateScale,Eq(s,this._isHorizontal))))));else{const t=this.getContainer();this._component=new bP(i),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?e&&this._component.setPreviewPointsY1(this._dataToPositionY2):e&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>Cq(t,this._stateScale,Eq(s,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:xL(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:xL(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:xL(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:xL(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:xL(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:xL(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:xL(g.style)},selectedBackgroundStyle:xL(this._spec.selectedBackground.style),dragMaskStyle:xL(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:lI(xL(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},xL(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:lI(xL(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},xL(null===(d=m.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}=CF(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(Eq(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}}jq.type=n.dataZoom,jq.transformerConstructor=Dq,jq.builtInTheme={dataZoom:zq},jq.specKey="dataZoom";const Hq=()=>{hI.registerComponent(jq.type,jq)},Vq={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}};class Nq extends Lq{constructor(t,e){var i;super(t,e),this.type=n.scrollBar,this.name=n.scrollBar,this.specKey="scrollBar",this.layoutZIndex=gD.DataZoom,this.layoutLevel=fD.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"axis"}_handleChange(t,e,i){super._handleChange(t,e,i);const s=hO(this._start,t)&&hO(this._end,e);if(this._shouldChange&&(!s||!1===this._spec.realTime)){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;const s=this._relatedAxisComponent,n=Eq(s,this._isHorizontal),r=Cq(t,this._stateScale,n),a=Cq(e,this._stateScale,n);(c(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,r,a):this._handleStateChange(r,a))&&this.event.emit(CL.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:x(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:x(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r,a;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:u(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,minSliderSize:null===(a=this._spec)||void 0===a?void 0:a.minSliderSize},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new dM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return d(i)||(s.padding=i),E(null==t?void 0:t.style)||(s.railStyle=xL(t.style)),E(null==e?void 0:e.style)||(s.sliderStyle=xL(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}Nq.type=n.scrollBar,Nq.builtInTheme={scrollBar:Vq},Nq.specKey="scrollBar";const Wq=()=>{hI.registerComponent(Nq.type,Nq)},Uq=(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}),G(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r},Gq=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),Yq={title:{visible:!0,autoLimit:!1,autoFit:!1,style:Gq("l1FontSize","primaryFontColor")},content:{visible:!0,style:Gq("l2FontSize","tertiaryFontColor")}};class Xq extends Aj{constructor(){super(...arguments),this.type=n.indicator,this.name=n.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=gD.Indicator,this.layoutLevel=fD.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return BF(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=G(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(G(this._spec.regionId),G(this._spec.regionIndex))}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(kL(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(kL(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){LL(this._option.dataSet,"indicatorFilter",Uq);const t=new Ba(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 WD(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const e=this._regions[0],{width:i,height:s}=e.getLayoutRect(),{x:n,y:r}=e.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,p=t(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return G(o).forEach((t=>{const e=lI({},this._theme.content,t);g.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({},bL(j(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?ZO(l,this._computeLayoutRadius()):0,dy:h?ZO(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!u(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},bL(j(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},p)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)N(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new DR(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":c(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.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}Xq.type=n.indicator,Xq.builtInTheme={indicator:Yq},Xq.specKey="indicator";const $q=()=>{hI.registerComponent(Xq.type,Xq)},Kq=["sum","average","min","max","variance","standardDeviation","median"];function qq(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=X(s);return er}function Zq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return x(t.x)&&qq(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=UO(t.x)?eZ(t.x,n)+r.x:iZ(l.getXAxisHelper(),[t.x])+r.x,h}function Jq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return x(t.y)&&qq(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=UO(t.y)?eZ(t.y,n)+r.y:iZ(l.getYAxisHelper(),[t.y])+r.y,h}function Qq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return x(t.angle)&&qq(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)),iZ(a.angleAxisHelper,[t.angle])}function tZ(t,e,i,s){var n,r;const{relativeSeries:a}=s;return x(t.radius)&&qq(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)),iZ(a.radiusAxisHelper,[t.radius])}function eZ(t,e){return Number(t.substring(0,t.length-1))*e/100}function iZ(t,e){const i=t.getScale(0);return eB(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function sZ(t){return Kq.includes(t)}function nZ(t,e,i,s,n,r=!1){const a=e.getRegion(),o=a.getLayoutStartPoint(),l=i.getRegion(),h=l.getLayoutStartPoint(),c=Math.abs(Math.min(o.x,h.x)-Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width)),d=Math.abs(Math.min(o.y,h.y)-Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height)),p={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},g=[],f=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper(),v=s.getYAxisHelper(),_=m.getScale(0).domain(),y=v.getScale(0).domain(),b=r&&!m.isContinuous&&!!m.getBandwidth,x=r&&!v.isContinuous&&!!v.getBandwidth,S={min:null,max:null},k={min:null,max:null};return f.forEach((t=>{const e=u(t.x),i=u(t.y);let s,r;if(e&&i)s=Zq(t,_,n,p,c,o),r=Jq(t,y,n,p,d,o),rZ(s,b,S,g.length),rZ(r,x,k,g.length),g.push([{x:s,y:r}]);else if(e){s=Zq(t,_,n,p,c,o),r=Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height);const e=Math.min(o.y,h.y);rZ(s,b,S,g.length),g.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(o.x,h.x),r=Jq(t,y,n,p,d,o);const e=Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width);rZ(r,x,k,g.length),g.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(g,m,v,S,k),g}function rZ(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=u(t.angle),i=u(t.radius);if(e&&i){const e=Qq(t,l,n,r),i=tZ(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=Qq(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=tZ(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function oZ(t,e,i,s){const n=[],r=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,a=_(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:f}=u.getLayoutRect();let m=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(m=UO(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=UO(i)?Number(i.substring(0,i.length-1))*f/100:i)}const _=d.getXAxisHelper().getScale(0).domain(),y=d.getYAxisHelper().getScale(0).domain(),b=G(t.x),S=G(t.y);1===b.length&&x(b[0])&&qq(_,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===S.length&&x(S[0])&&qq(y,S[0],i)&&(null===(c=null===(h=d.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",S[0])),n.push({x:iZ(d.getXAxisHelper(),b)+p.x+m,y:iZ(d.getYAxisHelper(),S)+p.y+v})})),n}function lZ(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=G(t.angle),u=G(t.radius);1===d.length&&x(d[0])&&qq(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&&x(u[0])&&qq(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:iZ(l.angleAxisHelper,d),radius:iZ(l.radiusAxisHelper,u)})})),s}function hZ(t,e,i){let{x:s,y:n}=t;return UO(s)&&(s=eZ(s,e)),UO(n)&&(n=eZ(n,i)),{x:s,y:n}}function cZ(t,e,i){let s;if(s=c(t)?G(t(e.getData().getLatestData(),e)):G(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=hZ(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>hZ(t,n,r)))}function dZ(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 uZ(e,i,s){const{labelBackground:n={},style:r,shape:a}=e,o=t(e,["labelBackground","style","shape"]);if(!1!==e.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},xL(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},gZ(xL(n.style),i,s)),u(n.padding)&&(t.padding=ni(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=gZ(xL(r),i,s)),t}return{visible:!1}}function pZ(t,e,i){for(const s in t)c(t[s])&&(t[s]=t[s](e,i));return t}function gZ(t,e,i){return c(t)?t(e,i):t}function fZ(t,e){return c(t)?t(e):t}function mZ(t,e,i){return u(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 vZ(t){return{isXProcess:u(t.x),isYProcess:u(t.y),isX1Process:u(t.x1),isY1Process:u(t.y1),isAngleProcess:u(t.angle),isRadiusProcess:u(t.radius),isAngle1Process:u(t.angle1),isRadius1Process:u(t.radius1),isCoordinatesProcess:u(t.coordinates),isValidProcess:u(t.process)}}function _Z(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=vZ(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:h&&(!c||"process"in t&&"xy"in t.process)}}function yZ(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=vZ(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function bZ(t){return{doXYProcess:u(t.x)&&u(t.y),doPolarProcess:u(t.angle)&&u(t.radius),doGeoProcess:u(t.areaName)}}function xZ(e,i){let s;if(i.coordinates){const e=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=e,o=t(e,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(c(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=G(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;u(r)&&(c=G(i)[r]),n&&G(i).includes(n)&&(c=n);let d=s;u(l)&&(d=G(s)[l]),a&&G(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),v(t[c])&&sZ(t[c])?h.x={field:c,aggrType:t[c]}:h.x=G(c).map((e=>t[e])),v(t[d])&&sZ(t[d])?h.y={field:d,aggrType:t[d]}:h.y=G(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;u(r)&&(a=G(s)[r]),n&&G(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),v(t[a])&&sZ(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=G(a).map((e=>t[e])),v(t[l])&&sZ(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=G(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((t=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(u(t.x)){const s=t.x;_(s)?i.x=s.map((i=>kZ(i,e,t))):i.x=kZ(s,e,t)}if(u(t.y)){const s=t.y;_(s)?i.y=s.map((i=>kZ(i,e,t))):i.y=kZ(s,e,t)}if(u(t.angle)){const s=t.angle;_(s)?i.angle=s.map((i=>kZ(i,e,t))):i.angle=kZ(s,e,t)}if(u(t.radius)){const s=t.radius;_(s)?i.radius=s.map((i=>kZ(i,e,t))):i.radius=kZ(s,e,t)}if(u(t.areaName)){const s=t.areaName;i.areaName=kZ(s,e,t)}t.getRefRelativeSeries&&(i.getRefRelativeSeries=t.getRefRelativeSeries),n.push(i)})),n}const SZ={min:(t,e)=>cO(t[0].latestData,e.field),max:(t,e)=>dO(t[0].latestData,e.field),sum:function(t,e){return uO(t[0].latestData,e.field)},average:function(t,e){return pO(t[0].latestData,e.field)},variance:function(t,e){return gO(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(gO(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 kZ(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(c(t))return t(a,o,l,s,n,r);if(f(t)){const{aggrType:i,field:s}=t;return SZ[i](e,{field:s})}return t}function AZ(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 MZ extends Aj{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){return BF(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_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 v(e)&&sZ(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){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];G(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Ca;return e.registerParser("array",i),new Ba(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(u(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)))}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=bO(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){d(this._spec.offsetX)||(this._layoutOffsetX=YO(this._spec.offsetX,e.width,e)),d(this._spec.offsetY)||(this._layoutOffsetY=YO(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return N(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();LL(this._option.dataSet,"markerAggregation",xZ),LL(this._option.dataSet,"markerFilter",AZ);const i=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),i.target.on("change",(()=>{this._markerLayout()})),this._markerData=i}}function wZ(t,e){return function(t,e,i){const{predict:s}=Lt(t,(t=>t[e]),(t=>t[i])),n=cO(t,e),r=dO(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class TZ extends MZ{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=gD.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=_Z(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;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=G(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={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},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:gZ(xL(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>uZ(t,this._markerData,this._markAttributeContext))),state:{line:pZ(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:pZ(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:pZ(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return pZ(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return pZ(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:gZ(xL(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:gZ(xL(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||G(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=dZ([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=G((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=G(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,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}=_Z(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;LL(this._option.dataSet,"markerAggregation",xZ),LL(this._option.dataSet,"markerRegression",wZ),LL(this._option.dataSet,"markerFilter",AZ);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new Ba(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",(()=>{this._markerLayout()})),this._markerData=m}}TZ.specKey="markLine";const CZ=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),BZ={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"}}},refY:5},EZ={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:CZ(!1),endSymbol:CZ(!0),label:BZ};class PZ extends TZ{constructor(){super(...arguments),this.type=n.markLine,this.name=n.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new rR(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=u(e.coordinates),o=u(e.process),l=o&&u(e.process.x),h=o&&u(e.process.y),c=u(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:p,doYProcess:g,doXYY1Process:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:_}=_Z(e);let y=[];if(p||f||g||m||v||a&&l||a&&h){const t=nZ(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=oZ(i,r,d,e.coordinatesOffset):c&&(y=cZ(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n;const r=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const n=this._startRelativeSeries,a=this._endRelativeSeries,{multiSegment:o,mainSegmentIndex:l}=this._spec.line||{},{connectDirection:h,expandDistance:c=0}=this._spec;let d;if(UO(c)){const t=n.getRegion(),e=t.getLayoutStartPoint(),i=a.getRegion(),s=i.getLayoutStartPoint();if("bottom"===h||"top"===h){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));d=Number(c.substring(0,c.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));d=Number(c.substring(0,c.length-1))*n/100}}else d=c;const{points:p,limitRect:g}=r;if(!p||p.length<2)return void(null===(t=this._markerComponent)||void 0===t||t.setAttributes(r));const f=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}(p[0],p[1],h,d);let m;m=o&&u(l)?{position:"middle",autoRotate:!1}: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)}:{}}(p[0],p[1],h,d));const v=G((null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{}).label),_=G(r.label),y=G(this._spec.label);null===(s=this._markerComponent)||void 0===s||s.setAttributes({points:o?[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]]]:f,label:_.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=m.dx)&&void 0!==i?i:0,h=null!==(s=m.dy)&&void 0!==s?s:0;const c=null!==(n=y[e])&&void 0!==n?n:y[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),m),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=v[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:g,multiSegment:o,mainSegmentIndex:l,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(n=this._markerComponent)||void 0===n||n.setAttributes(r)}_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}=_Z(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 Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&u(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&u(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&u(n.process.xy)){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}}}PZ.type=n.markLine,PZ.coordinateType="cartesian",PZ.builtInTheme={markLine:EZ};const RZ=()=>{hI.registerComponent(PZ.type,PZ),nR()};class OZ extends TZ{constructor(){super(...arguments),this.type=n.polarMarkLine,this.name=n.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=_Z(this._spec);return e||i?new lR(t):new rR(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}=_Z(e);let p=[],g={};const f={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=aZ(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:f}:{points:p.map((t=>le(f,t.radius,t.angle)))}}else u&&(p=lZ(i,r,a),g={points:p.map((t=>le(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=_Z(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}}}OZ.type=n.polarMarkLine,OZ.coordinateType="polar",OZ.builtInTheme={polarMarkLine:EZ};const IZ=()=>{hI.registerComponent(OZ.type,OZ),lR._animate=jP,nR()};class LZ extends Aj{get orient(){return this._orient}constructor(t,e){super(t,e),this.type=n.title,this.specKey=n.title,this.layoutType="normal",this.layoutZIndex=gD.Title,this.layoutLevel=fD.Title,this._orient="top",this._orient=WO(t.orient)?t.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return BF(t,this.specKey,n.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}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;if(!1===this._spec.visible)return{visible:!1};const a=this.getLayoutRect(),o=YO(this._spec.width,a.width,null,a.width),l=YO(this._spec.maxWidth,a.width,null,a.width),h=Math.max(Math.min(o,l,a.width),0),c=u(this._spec.text)&&""!==this._spec.text,d=u(this._spec.subtext)&&""!==this._spec.subtext,p=Object.assign(Object.assign({},j(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:c?this._spec.text:void 0,subtextType:null!==(e=this._spec.subtextType)&&void 0!==e?e:"text",subtext:d?this._spec.subtext:void 0,x:null!==(i=this._spec.x)&&void 0!==i?i:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:h,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(n=this._spec.align)&&void 0!==n?n:"left",verticalAlign:null!==(r=this._spec.verticalAlign)&&void 0!==r?r:"top",textStyle:Object.assign({maxLineWidth:h},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:h},this._spec.subtextStyle)});if(c&&(p.textStyle.width=h),d&&(p.subtextStyle.width=h),u(this._spec.width)){const t=Math.max(Math.min(o,a.width),0);c?p.textStyle.width=t:delete p.textStyle.width,d&&(p.subtextStyle.width=t)}return p}_createOrUpdateTitleComponent(t){if(this._titleComponent)N(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new IR(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}}LZ.type=n.title,LZ.specKey=n.title,LZ.builtInTheme={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"}}}};const DZ=()=>{hI.registerComponent(LZ.type,LZ)};class FZ extends MZ{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=gD.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=yZ(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=G(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={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:gZ(xL(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>uZ(t,this._markerData,this._markAttributeContext))),state:{area:pZ(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>pZ(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return pZ(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||G(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=dZ([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=G(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=G(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,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}=yZ(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}FZ.specKey="markArea";const zZ={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"}}}}};class jZ extends FZ{constructor(){super(...arguments),this.type=n.markArea,this.name=n.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new oR(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=yZ(i),d=u(i.positions),p=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=nZ(s,n,r,a,p,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=nZ(s,n,r,a,p,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=oZ(s,a,p,i.coordinatesOffset):d&&(f=cZ(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=yZ(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}}}jZ.type=n.markArea,jZ.coordinateType="cartesian",jZ.builtInTheme={markArea:zZ};const HZ=()=>{hI.registerComponent(jZ.type,jZ),aR()};class VZ extends FZ{constructor(){super(...arguments),this.type=n.polarMarkArea,this.name=n.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=yZ(this._spec);return i||e||s?new hR(t):new oR(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}=yZ(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=aZ(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=lZ(i,r,c),u={points:d.map((t=>le(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=yZ(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}}}VZ.type=n.polarMarkArea,VZ.coordinateType="polar",VZ.builtInTheme={polarMarkArea:zZ};const NZ=()=>{hI.registerComponent(VZ.type,VZ),hR._animate=VP,aR()},WZ=t=>xL(Object.assign({},t)),UZ=t=>Object.assign(Object.assign({},t),{style:Object.assign({},xL(t.style))}),GZ=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=WZ(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=WZ(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:{},xL(Object.assign({},y)));var y;const b=UZ(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=UZ(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=UZ(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),k=UZ(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),A=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:k})});return t.visible||(A.controller.visible=!1,A.slider.visible=!1),A},YZ=t=>"left"===t||"right"===t,XZ=t=>"top"===t||"bottom"===t,$Z={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:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,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:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class KZ extends Aj{constructor(){super(...arguments),this.layoutZIndex=gD.Player,this.layoutLevel=fD.Player,this.specKey="player",this.type=n.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({},GZ(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({},GZ(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?N(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new qR(t):this._playerComponent=new QR(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(...G(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...G(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...G(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...G(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=YZ(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=YZ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...G(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...G(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...G(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...G(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.autoPlayCallback=()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.off(CL.rendered,this.autoPlayCallback),this._option.globalInstance.on(CL.rendered,this.autoPlayCallback),this._playerComponent.addEventListener(UR.end,(()=>{var t;this.event.emit(CL.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===(t=this._spec)||void 0===t?void 0:t.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(UR.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(UR.backward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(CL.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(UR.forward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(CL.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(UR.play,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(CL.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(UR.pause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(CL.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}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=YZ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=XZ(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}_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 x(this._spec.width)?Math.min(t.width,Number(this._spec.width)):YZ(this._orient)?this._maxSize():t.width}_computeHeight(t){return x(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):XZ(this._orient)?this._maxSize():t.height}_computeDx(t){return YZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return XZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(t){const e=this._specs[t];this._option.globalInstance.updateFullData(e.data),this.event.emit(CL.playerChange,{model:this,value:{spec:e,index:t,specs:this._specs}})}release(){this._option.globalInstance.off(CL.rendered,this.autoPlayCallback)}}KZ.builtInTheme={player:$Z},KZ.specKey="player",KZ.type=n.player;const qZ=()=>{hI.registerComponent(KZ.type,KZ)};class ZZ extends Aj{constructor(t,e){super(t,e),this.type=n.label,this.name=n.label,this.layoutType="none",this.layoutZIndex=gD.Label,this._regions=e.getRegionsInIndex(e.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,N(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=RO({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:G(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==vD.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}))})),f(a.overlap)&&d(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}ZZ.type=n.label;class JZ extends oW{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}render(){}}JZ.type="text",JZ.constructorType="label";const QZ=()=>{lW(),hI.registerMark(JZ.constructorType,JZ)};class tJ extends kj{_initTheme(t,e){return{spec:t,theme:this._theme}}}class eJ extends ZZ{constructor(t,e){super(t,e),this.type=n.label,this.name=n.label,this.specKey="label",this.transformerConstructor=tJ,this.layoutZIndex=gD.Label,this._layoutRule=t.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,r)=>{(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:n.label,specInfoPath:["component",this.specKey,r],regionIndexes:[r]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(CL.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(wL.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(wL.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),_O(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{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&u(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(u(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{G(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((t=>{t.forEach((t=>{var e,i;const{labelMark:s,labelSpec:n,series:r}=t;if(this.initMarkStyleWithSpec(s,n),c(null==n?void 0:n.getStyleHandler)){const t=n.getStyleHandler(r);null==t||t.call(r,s,n)}(null===(i=null===(e=s.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&s.setAttribute("stroke",r.getColorAttribute(),"normal",mD.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,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=lI({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},wN(h,r),Object.assign(Object.assign(Object.assign({},j(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[ZI])):t=>t.filter((t=>t.data[qI]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?TN(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=_(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=G(i())[t])}))}return e}}eJ.type=n.label,eJ.specKey="label",eJ.transformerConstructor=tJ;class iJ extends ZZ{constructor(){super(...arguments),this.type=n.totalLabel,this.name=n.totalLabel,this.specKey="totalLabel",this.layoutZIndex=gD.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 r;null===(r=t.seriesIndexes)||void 0===r||r.forEach((t=>{const{spec:r}=e.series[t],a=r[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:n.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()}reInit(t){super.reInit(t),this._initTextMark()}_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 t;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[$I]},"normal",mD.Default);const e=this._getSeries();null===(t=e.initTotalLabelMarkStyle)||void 0===t||t.call(e,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return lI({textStyle:{pickable:!0===this._spec.interactive},position:sJ(t,this._baseMark.type,a),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=>"bottom"===a?t.data[ZI]:t.data[qI]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>TN({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function sJ(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}iJ.type=n.totalLabel,iJ.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},iJ.specKey="totalLabel";const nJ=()=>{hI.registerGraphicComponent(iJ.type,(t=>new $E(t))),QZ(),Cj(),hI.registerComponent(iJ.type,iJ,!0)};class rJ extends MZ{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=gD.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=bZ(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,k,A,M,w,T,C,B,E,P,R,O,I;const{itemContent:L={},itemLine:D={},targetSymbol:F={}}=this._spec,j=L,{type:H="text",text:V,symbol:N,image:W,richText:U,customMark:G,textStyle:Y,symbolStyle:X,imageStyle:$,richTextStyle:K,customMarkStyle:q,style:Z={},state:J={}}=j,Q=t(j,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let tt=null,et=null,it={};"text"===H?(tt=null!==(e=null==V?void 0:V.state)&&void 0!==e?e:J,it={dx:0,dy:0},et=uZ(Object.assign(Object.assign({},V),{style:z(it,null!==(n=null!==(s=null!==(i=null==V?void 0:V.style)&&void 0!==i?i:null==V?void 0:V.textStyle)&&void 0!==s?s:Y)&&void 0!==n?n:Z)}),this._markerData,this._markAttributeContext)):"richText"===H?(tt=null!==(r=null==U?void 0:U.state)&&void 0!==r?r:J,it={width:100,height:100},et=gZ(z(it,null!==(o=null!==(a=null==U?void 0:U.style)&&void 0!==a?a:K)&&void 0!==o?o:Z),this._markerData,this._markAttributeContext)):"symbol"===H?(tt=null!==(l=null==N?void 0:N.state)&&void 0!==l?l:J,it={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},et=xL(gZ(z(it,null!==(c=null!==(h=null==N?void 0:N.style)&&void 0!==h?h:X)&&void 0!==c?c:Z),this._markerData,this._markAttributeContext))):"image"===H?(tt=null!==(d=null==W?void 0:W.state)&&void 0!==d?d:J,it={width:80,height:80},et=gZ(z(it,null!==(p=null!==(u=null==W?void 0:W.style)&&void 0!==u?u:$)&&void 0!==p?p:Z),this._markerData,this._markAttributeContext)):"custom"===H&&(tt=null!==(g=null==G?void 0:G.state)&&void 0!==g?g:J,et=gZ(null!==(m=null!==(f=null==G?void 0:G.style)&&void 0!==f?f:q)&&void 0!==m?m:Z,this._markerData,this._markAttributeContext));const st={zIndex:this.layoutZIndex,interactive:null===(v=this._spec.interactive)||void 0===v||v,hover:null===(_=this._spec.interactive)||void 0===_||_,select:null===(y=this._spec.interactive)||void 0===y||y,position:{x:0,y:0},clipInRange:null!==(b=this._spec.clip)&&void 0!==b&&b,itemContent:Object.assign(Object.assign({type:H,offsetX:fZ(L.offsetX,this._relativeSeries.getRegion()),offsetY:fZ(L.offsetX,this._relativeSeries.getRegion())},Q),{style:gZ(et,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(x=F.offset)&&void 0!==x?x:0,visible:null!==(S=F.visible)&&void 0!==S&&S,size:null!==(k=F.size)&&void 0!==k?k:20,style:gZ(F.style,this._markerData,this._markAttributeContext)},state:{line:pZ(null!==(M=null===(A=this._spec.itemLine.line)||void 0===A?void 0:A.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),lineStartSymbol:pZ(null!==(T=null===(w=this._spec.itemLine.startSymbol)||void 0===w?void 0:w.state)&&void 0!==T?T:{},this._markerData,this._markAttributeContext),lineEndSymbol:pZ(null!==(B=null===(C=this._spec.itemLine.endSymbol)||void 0===C?void 0:C.state)&&void 0!==B?B:{},this._markerData,this._markAttributeContext),itemContent:pZ(tt,this._markerData,this._markAttributeContext),textBackground:pZ(null===(P=null===(E=this._spec.itemContent.text)||void 0===E?void 0:E.labelBackground)||void 0===P?void 0:P.state,this._markerData,this._markAttributeContext),targetItem:pZ(null!==(O=null===(R=this._spec.targetSymbol)||void 0===R?void 0:R.state)&&void 0!==O?O:{},this._markerData,this._markAttributeContext)},animation:null!==(I=this._spec.animation)&&void 0!==I&&I,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:nt,line:rt={}}=D,at=t(D,["visible","line"]);st.itemLine=!1!==nt?Object.assign(Object.assign({},at),{visible:!0,lineStyle:xL(rt.style)}):{visible:!1};return new dR(st)}_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}=dZ([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:mZ(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:mZ(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}=bZ(t);(u(t.coordinate)||e||i||s)&&this._initCommonDataView()}}rJ.specKey="markPoint";const aJ={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}};class oJ extends rJ{constructor(){super(...arguments),this.type=n.markPoint,this.name=n.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=u(s.x)&&u(s.y),o=u(s.coordinate),l=u(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=nZ(n,r,r,r,h))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=oZ(n,r,h,s.coordinatesOffset)[0]:l&&(c=cZ(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=bZ(t),i=u(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}}}oJ.type=n.markPoint,oJ.coordinateType="cartesian",oJ.builtInTheme={markPoint:aJ};const lJ=()=>{hI.registerComponent(oJ.type,oJ),cR()};class hJ extends rJ{constructor(){super(...arguments),this.type=n.polarMarkPoint,this.name=n.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=aZ(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:le({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}])]}}}hJ.type=n.polarMarkPoint,hJ.coordinateType="polar",hJ.builtInTheme={polarMarkPoint:aJ};const cJ=()=>{hI.registerComponent(hJ.type,hJ),cR()};class dJ extends rJ{constructor(){super(...arguments),this.type=n.geoMarkPoint,this.name=n.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=>{u(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}])]}}}dJ.type=n.geoMarkPoint,dJ.coordinateType="geo",dJ.builtInTheme={geoMarkPoint:aJ};const uJ=()=>{hI.registerComponent(dJ.type,dJ),cR()},pJ="inBrush",gJ="outOfBrush";class fJ extends Aj{constructor(){super(...arguments),this.layoutType="none",this.type=n.brush,this.name=n.brush,this.specKey="brush",this.layoutZIndex=gD.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return BF(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const t=this._transformBrushedMarkAttr(this._spec.inBrush),e=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((i=>{i.getActiveMarks().forEach((s=>{s&&(i.setMarkStyle(s,Object.assign({},t),pJ,mD.Series),i.setMarkStyle(s,Object.assign({},e),gJ,mD.Series))}))}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&G(t).includes(n.userId.toString())||e&&G(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()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){u(this._spec.regionId)||u(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(G(this._spec.regionId),G(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(u(this._spec.brushLinkSeriesId)||u(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(G(this._spec.brushLinkSeriesId),G(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){u(this._spec.axisId)?G(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):u(this._spec.axisIndex)?G(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)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return N(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild()}_shouldEnableInteractive(){return!1!==this.getOption().getCompiler().getOption().interactive}_createBrushComponent(t,e){var i,s;const n=this._getBrushInteractiveAttr(t),r=new sO(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:xL(null===(i=this._spec)||void 0===i?void 0:i.style)},n),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));r.id=null!==(s=this._spec.id)&&void 0!==s?s:`brush-${this.id}`,this.getContainer().add(r),this._brushComponents.push(r),this._cacheInteractiveRangeAttrs.push(n),r.addEventListener(ZR.brushActive,(i=>{this._initMarkBrushState(e,gJ),this._emitEvent(CL.brushActive,t,i)})),r.addEventListener(ZR.drawStart,(e=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(t,!0),this._emitEvent(CL.brushStart,t,e)})),r.addEventListener(ZR.moveStart,(e=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(t,!0),this._emitEvent(CL.brushStart,t,e)})),r.addEventListener(ZR.drawing,(e=>{this._setRegionMarkPickable(t,!1),this._handleBrushChange(t,e),this._emitEvent(CL.brushChange,t,e)})),r.addEventListener(ZR.moving,(e=>{this._setRegionMarkPickable(t,!1),this._handleBrushChange(t,e),this._emitEvent(CL.brushChange,t,e)})),r.addEventListener(ZR.brushClear,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(t,!0),this._initMarkBrushState(e,""),this._emitEvent(CL.brushClear,t,i)})),r.addEventListener(ZR.drawEnd,(i=>{var s;this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(t,!0);const{operateMask:n}=i.detail,{updateElementsState:r=!0}=this._spec;if(null===(s=this._spec)||void 0===s?void 0:s.onBrushEnd)!0===this._spec.onBrushEnd(i)?(this.clearGraphic(),this._initMarkBrushState(e,""),this._emitEvent(CL.brushClear,t,i)):(this._spec.onBrushEnd(i),this._emitEvent(CL.brushEnd,t,i));else{const e=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&e.length>0||!r)&&this._setAxisAndDataZoom(n,t),this._emitEvent(CL.brushEnd,t,i)}})),r.addEventListener(ZR.moveEnd,(e=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(t,!0);const{operateMask:i}=e.detail,{updateElementsState:s=!0}=this._spec,n=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&n.length>0||s)&&this._setAxisAndDataZoom(i,t),this._emitEvent(CL.brushEnd,t,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],interactive:this._shouldEnableInteractive()}}_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({},xL(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail;this._operateMask=i;const{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e,i){var s;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},vchart:null===(s=this._option)||void 0===s?void 0:s.globalInstance,event:i})}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(i.addState(pJ,!0),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(i.removeState(pJ),i.addState(gJ,!0),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:_=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(_.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(i.addState(pJ,!0),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(i.removeState(pJ),i.addState(gJ,!0),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Be(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;s.removeState(pJ),s.removeState(gJ),i&&s.addState(i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_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,g=t.getScale().range(),f=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],m=Y(g){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}clearBrushStateAndMask(){this._relativeRegions.forEach(((t,e)=>{this._initMarkBrushState(e,""),this._brushComponents[e].children[0].removeAllChild()}))}}fJ.type=n.brush,fJ.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},fJ.specKey="brush";const mJ=()=>{hI.registerComponent(fJ.type,fJ)};class vJ extends Aj{constructor(){super(...arguments),this.type=n.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=gD.CustomMark,this.layoutLevel=fD.CustomMark}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;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${OI}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:u(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(u(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=rz({},az(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(d(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)}))),u(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return N(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,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 je).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new je;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),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}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}vJ.type=n.customMark,vJ.specKey="customMark";const _J=()=>{hI.registerComponent(vJ.type,vJ)};class yJ{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}:c(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){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=>{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&&u(e.modelId)){if(u(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&u(e.modelKey)&&"modelIndex"in e&&u(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=>bJ(t))),a=n.filter((t=>!bJ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>bJ(t))),h=o.filter((t=>!bJ(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 bJ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}yJ.type="grid";const xJ=()=>{hI.registerLayout(yJ.type,yJ)},SJ=()=>{yo.load(nw)},kJ="vchart-tooltip",AJ=`${kJ}-container`,MJ=`${kJ}-title`,wJ=`${kJ}-content-box`,TJ={offsetX:10,offsetY:10},CJ="99999999999999";function BJ(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const EJ=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,PJ=t=>v(t)&&""!==(null==t?void 0:t.trim())||x(t)?BJ(t):"",RJ=(t,e)=>{let i;if(u(t))if(x(t))i=t;else if(c(t)){const s=t(e);x(s)&&(i=s)}return i},OJ={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},IJ=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=OJ[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class LJ extends Jz{constructor(){super(...arguments),this._visible=!0,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._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,d,g;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const _=e.event,{activeType:y,data:b}=t,S="dimension"===y?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:M}=this._option,w=m[y],T=IF(null==w?void 0:w.position,b,e),C=null!==(r=IF(null==w?void 0:w.positionMode,b,e))&&void 0!==r?r:"mark"===y?"mark":"pointer",{width:B=0,height:E=0}=null!=i?i:{},P="canvas"===m.renderMode,R=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),O=null!==(o=null==R?void 0:R.width)&&void 0!==o?o:II,I=null!==(l=null==R?void 0:R.height)&&void 0!==l?l:LI;let L=!1;const D={width:0,height:0};let F,z={x:0,y:0},j={x:0,y:0},H=1,V=1;const N=Uy(this._env);if(N&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=O,D.height=I),N&&!P){const t=this._getParentElement(m);j=null!==(d=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==d?d:v;const e=null!==(g=this._compiler.getCanvas())&&void 0!==g?g:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-j.x,y:F.y-j.y},H=EJ(e,F),V=EJ(t,j)}const W=V/H,U={},G={x:T,y:T},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?A:M;if("mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==S?void 0:S.series)||void 0===r?void 0:r.coordinate)&&S.datum&&S.datum.length){L=!0;const t=f(S,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(L){const e=Y[n][0],i="x"===n?B:E;switch(IJ(t,n)){case-2:U[e]=a-i*W-c;break;case-1.5:U[e]=a+c;break;case 0:U[e]=(a+o)/2-i*W/2;break;case-1:U[e]=(a+o)/2-i*W-c;break;case 1:U[e]=(a+o)/2+c;break;case 1.5:U[e]=o-i*W-c;break;case 2:U[e]=o+c}}},$=["x","y"];if(p(T))if(p(K=T)&&(u(K.left)||u(K.right)||u(K.top)||u(K.bottom))){const{left:t,right:e,top:i,bottom:s}=T;U.left=RJ(t,_),U.top=RJ(i,_),U.right=RJ(e,_),U.bottom=RJ(s,_)}else(t=>p(t)&&(u(t.x)||u(t.y)))(T)&&$.forEach((t=>{const e=T[t];x(e)||c(e)?U[Y[t][0]]=RJ(e,_):X(e,t)}));else u(T)&&(X({orient:T,mode:C},"x"),X({orient:T,mode:C},"y"));var K;const q={x:null,y:null};return $.forEach((t=>{var e;const i="x"===t?B:E,s="x"===t?O:I,n="x"===t?A:M,r=IJ(G[t],t);if(k(U[Y[t][0]]))q[t]=U[Y[t][0]];else if(k(U[Y[t][1]]))q[t]=s-i*W-U[Y[t][1]];else{const e="x"===t?_.canvasX:_.canvasY;q[t]=r>0?e+n:0===r?e-i*W/2:e-i*W-n}q[t]*=H,N&&(q[t]+=z[t]),q[t]/=V;const a="x"===t?D.width:D.height,o=m.confine?-(j[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/H)/V:-j[t]/V,l=a/V+o-i;2!==r&&q[t]l&&(q[t]=l)):-2!==r&&q[t]>l&&(L?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]u(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",FJ=(t={},e={})=>{var i,s;u(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return u(n)&&(e.color=n),u(t.fontWeight)&&(e.fontWeight=t.fontWeight),u(t.textAlign)&&(e.textAlign=t.textAlign),u(t.fontSize)&&(e.fontSize=DJ(t.fontSize)),u(t.maxWidth)&&(e.maxWidth=DJ(t.maxWidth)),t.multiLine||u(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},zJ=(t={})=>{const{lineHeight:e}=t;return t.fontSize?YO(e,t.fontSize):0},jJ=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return u(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),u(r)&&(o=ni(r),a.padding=DJ(o)),{panelStyle:a,panelPadding:o}};function HJ(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}const VJ=t=>{hI.registerComponentPlugin(t.type,t)};class NJ extends LJ{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(NJ.type),this.type=ZH.dom,this._tooltipContainer=null==Wy?void 0:Wy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(Wy&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:u,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=jJ(l),_={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(_.marginBottom=`${g}px`);const y={width:DJ(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=FJ(h),x=FJ(u),S=FJ(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),d(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),d(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),d(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),y[A]=DJ(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=DJ(null!==(s=u.spacing)&&void 0!==s?s:26),S[A]=DJ(null!==(n=p.spacing)&&void 0!==n?n:0);const M=Math.max(zJ(p),zJ(u));return _.lineHeight=M>0?`${M}px`:"20px",{panelPadding:v,row:_,panel:m,title:b,shape:y,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(MJ))),l=a.find((t=>t.className.includes(wJ)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(MJ),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(HJ(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${kJ}-column`),e.classList.add(`${kJ}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(wJ),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];HJ(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));HJ(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${kJ}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=PJ(e.key),e.keyStyle&&FJ(e.keyStyle,l)):"value"===i?(o.innerHTML=PJ(e.value),e.valueStyle&&FJ(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,g=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?BJ(t.shapeLineWidth)+"px":"0px";let m="currentColor";const _=()=>c?BJ(c):m,y=g,b=t=>new wg({symbolType:t,size:y,fill:!0});let x=b(h);const S=x.getParsedPath();let k,A;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;A=t.toString(),k=t.bounds}else S.isSvg&&S.svgCache&&(A=S.svgCache.map((t=>t.path.toString())).join(),k=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new je));let M=`${k.x1} ${k.y1} ${k.width()} ${k.height()}`;if("0px"!==f){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const w=fh.IsGradientStr(u);if(!u||v(u)&&!w||d)return m=d?"none":u?BJ(u):"currentColor",`\n \n \n \n `;const T=w?fh.Parse(u):p(u)?u:null;if(T){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=T.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===T.gradient?t=`\n ${i}\n `:"linear"===T.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),HJ(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(wJ))),h=[...o.children].find((t=>t.className.includes(MJ)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(u(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(MJ)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=YO(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,HJ(l,c))}const p=l.children,g=[];if(p){for(let i=0;i{VJ(NJ)},UJ={fontFamily:eI.fontFamily,spacing:10,wordBreak:"break-word"},GJ=(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},pf||(pf=df.CreateGraphic("richtext",{})),pf.setAttributes(a),pf.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function YJ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:UJ),{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:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:u(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const XJ=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 u(a)&&(r.cornerRadius=[a,a,a,a]),r};class $J extends LJ{constructor(){super($J.type),this.type=ZH.canvas,this._attributes=null}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 lO({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}_getTooltipBoxSize(t,e){var i,s;if(!e||d(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:p,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:_}=l,y=ni(d.padding),b=KO(d.padding),x=YJ(Object.assign({textAlign:"right"===_?"right":"left"},p),i),S=YJ(Object.assign({textAlign:"right"===_?"right":"left"},f),i),k=YJ(m,i),A={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:XJ(d),padding:y,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:A,key:S,value:k,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:_},{title:w={},content:T=[]}=t;let C=b.left+b.right,B=b.top+b.bottom,E=0;const P=!!T.length;let R=0,O=0,I=0,L=0;if(P){const t=[],e=[],i=[],s=[];let n=0;M.content=T.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:p,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:M}=r,w={height:0,spaceRow:null!=y?y:v};if(u(h)){const i=lI({},S,YJ(b,void 0,{})),{width:s,height:n,text:r}=GJ(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(u(m)){const t=lI({},k,YJ(x,void 0,{})),{width:e,height:s,text:n}=GJ(m,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};M?t.stroke=d:t.fill=d,t.stroke=null!=p?p:d,t.lineWidth=g,w.shape=t;const e=null!=f?f:A.size;o=Math.max(e,o),s.push(e)}else w.shape={visible:!1};return w.height=o,n+=o,aW.autoWidth&&!1!==W.multiLine;if(j){W=lI({},x,YJ(V,void 0,{})),U()&&(W.multiLine=null===(r=W.multiLine)||void 0===r||r,W.maxWidth=null!==(a=W.maxWidth)&&void 0!==a?a:P?Math.ceil(E):void 0);const{text:t,width:e,height:i}=GJ(H,W);M.title.value=Object.assign(Object.assign({width:U()?Math.min(e,null!==(o=W.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},W),{text:t}),D=M.title.value.width,F=M.title.value.height,z=F+(P?M.title.spaceRow:0)}return B+=z,M.title.width=D,M.title.height=F,U()?C+=E||D:C+=Math.max(D,E),P&&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-L-R-S.spacing-k.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),M.valueWidth=Math.max(M.valueWidth,i.width))})),M.panel.width=C,M.panel.height=B,M})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_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{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?u(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()}}$J.type=ZH.canvas;const KJ=()=>{VJ($J)},qJ=(t="chart",e,i)=>{var s,r,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===(s=e.region)||void 0===s||s.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["region",e],type:"region"})}));else if("series"===t)f.modelType="series",f.specKey="series",null===(r=e.series)||void 0===r||r.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["series",e],type:t.type})}));else if(Object.values(AO).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(n).includes(t)){f.modelType="component",f.type=t,f.specKey=null===(o=hI.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:s}=f,n=G(null!==(h=null===(l=i.component)||void 0===l?void 0:l[s])&&void 0!==h?h:[]);null===(d=G(null!==(c=e[s])&&void 0!==c?c:[]))||void 0===d||d.forEach(((e,i)=>{const s=n[i];s&&s.type===t?f.modelInfo.push(Object.assign(Object.assign({},s),{spec:e})):e&&!1===e.visible&&f.modelInfo.push({type:t,spec:e})}))}else{const s=hI.getComponents().filter((({cmp:e})=>e.specKey===t)).map((({cmp:t})=>t.type));if(s.length>0){f.modelType="component";const n=t;f.specKey=n;const r=G(null!==(p=null===(u=i.component)||void 0===u?void 0:u[n])&&void 0!==p?p:[]);G(null!==(g=e[n])&&void 0!==g?g:[]).forEach(((t,e)=>{const i=r[e];i&&s.includes(i.type)&&f.modelInfo.push(Object.assign(Object.assign({},i),{spec:t}))}))}}return f},ZJ=(t,e,i,s)=>{const{spec:n,filter:r,filterType:a,forceAppend:o}=t,{isChart:l,modelType:h,specKey:u,type:p,modelInfo:g}=((t="chart",e,i,s,n,r)=>{const a=qJ(t,n,r);return Object.assign(Object.assign({},a),{modelInfo:a.modelInfo.filter((t=>!!d(e)||G(e).some((e=>c(e)?e(t,i,s):nI(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const f=lI({},i),m=c(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:lI(f,m),hasChanged:!0};const i=lI({},t,m);rI(f,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},m);_(f[u])?f[u].push(t):d(f[u])?f[u]="component"===h?t:[t]:f[u]=[f[u],t]}return{chartSpec:f,hasChanged:!0}},JJ=t=>{hI.registerChartPlugin(t.type,t)};class QJ extends Jz{constructor(){super(QJ.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[QJ.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[QJ.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)}onAfterModelSpecTransform(t,e,i,s){this._initialized&&"updateSpec"===s&&this.onBeforeInitChart(t,e,"setCurrentTheme")}onBeforeInitChart(t,e,i){if(!this._initialized)return;let s,n;switch(i){case"render":case"updateModelSpec":s=!1,n=!0;break;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=oI(this._option.globalInstance.getSpec(),["data",QJ.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=oI(this._baseChartSpec,["data",QJ.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(u(t.maxHeight)&&e.height>t.maxHeight)return!1;break;case"minHeight":if(u(t.minHeight)&&e.heightt.maxWidth)return!1;break;case"minWidth":if(u(t.minWidth)&&e.width{const n=ZJ(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=oI(i,["data",QJ.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()}}QJ.pluginType="chart",QJ.specKey="media",QJ.type="MediaQueryPlugin";const tQ=()=>{JJ(QJ)},eQ=/\{([^}]+)\}/,iQ=/\{([^}]+)\}/g,sQ=/:/;class nQ extends Jz{constructor(){super(nQ.type),this.type="formatterPlugin",this._timeModeFormat={utc:gi.getInstance().timeUTCFormat,local:gi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Si.getInstance().format,this._numericSpecifier=Si.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[nQ.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;c(r)?this._formatter=r:(this._formatter=this._format.bind(this),c(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),hI.registerFormatter(this._formatter)}_format(t,e,i){return _(t)?t.map(((t,s)=>{const n=_(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):_(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=eQ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(iQ,((t,i)=>{if(!sQ.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(yi.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):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}nQ.pluginType="chart",nQ.specKey="formatter",nQ.type="formatterPlugin";const rQ=()=>{JJ(nQ)};class aQ extends Jz{constructor(){super(aQ.type),this.type="ChartResizeZoomPlugin",this._zoom=1,this._onWheel=t=>{t.preventDefault(),t.stopImmediatePropagation();const e=Math.pow(1.005,-t.deltaY*Math.pow(16,t.deltaMode)*.2*this._rate),i={x:t.offsetX,y:t.offsetY};this.zoom(e,i)}}onAfterInitChart(t,e){var i,s,n,r,a;const o=t.globalInstance,l=null!==(s=null===(i=o.getSpec())||void 0===i?void 0:i[aQ.specKey])&&void 0!==s?s:{enabled:!1};!0===l.enabled&&(this._minZoom=null!==(n=l.min)&&void 0!==n?n:.1,this._maxZoom=null!==(r=l.max)&&void 0!==r?r:10,this._rate=null!==(a=l.rate)&&void 0!==a?a:.1,this._container=o.getContainer(),this._triggerEvent=iN(t.globalInstance.getChart().getOption().mode).zoom,this._container&&this._triggerEvent&&this._container.addEventListener(this._triggerEvent,this._onWheel))}zoom(t,e){const i=this.service.globalInstance;if(!i)return;const s=this._zoom;let n=this._zoom*t;if(n<=this._minZoom&&t<1||n>=this._maxZoom&&t>1)if(n<=this._minZoom&&this._zoom>this._minZoom)n=this._minZoom;else{if(!(n>=this._maxZoom&&this._zoom{JJ(aQ)};SF.useRegisters([()=>{iV(),nV(),aV(),OH(),RH(),vH(),lH(),Vz(),Wz(),cF(),oF(),Jj(),$j(),hI.registerSeries(_H.type,_H),hI.registerChart(oV.type,oV)},()=>{iV(),nV(),aV(),RH(),vH(),lH(),Vz(),cV(),Wz(),pV(),Jj(),$j(),hI.registerSeries(fV.type,fV),OH(),hI.registerChart(vV.type,vV)},()=>{iV(),nV(),aV(),RH(),PV(),OH(),hI.registerChart(OV.type,OV)},()=>{nV(),VW(),hI.registerChart(D$.type,D$)},()=>{iV(),nV(),aV(),OH(),hI.registerChart(G$.type,G$),RH()},$j,Jj,()=>{hI.registerComponent(XK.type,XK)},()=>{hI.registerComponent(mq.type,mq)},()=>{hI.registerComponent(Sq.type,Sq)},()=>{hI.registerGraphicComponent(eJ.type,(t=>new $E(t))),QZ(),Cj(),hI.registerComponent(eJ.type,eJ,!0,1/0)},KJ]),SF.useRegisters([()=>{rk(yo)}]);export{mD as AttributeLevel,Qz as AxisSyncPlugin,$J as CanvasTooltipHandler,CL as ChartEvent,aQ as ChartResizeZoomPlugin,LI as DEFAULT_CHART_HEIGHT,II as DEFAULT_CHART_WIDTH,MF as DEFAULT_CLOSE_STROKE_JOIN,FI as DEFAULT_DATA_INDEX,zI as DEFAULT_DATA_KEY,jI as DEFAULT_DATA_SERIES_FIELD,nL as DEFAULT_KEY,uD as DEFAULT_LAYOUT_RECT_LEVEL,pD as DEFAULT_LAYOUT_RECT_LEVEL_MIN,AF as DEFAULT_LINEAR_INTERPOLATE,rL as DEFAULT_MAP_LOOK_UP_KEY,DI as DEFAULT_MEASURE_CANVAS_ID,HI as DEFAULT_SERIES_STYLE_NAME,kF as DEFAULT_SMOOTH_INTERPOLATE,oT as DefaultTicker,wF as Direction,NJ as DomTooltipHandler,hI as Factory,nQ as FormatterPlugin,fD as LayoutLevel,gD as LayoutZIndex,eL as MOSAIC_CAT_END_PERCENT,tL as MOSAIC_CAT_START_PERCENT,QI as MOSAIC_VALUE_END_PERCENT,JI as MOSAIC_VALUE_START_PERCENT,hT as ManualTicker,QJ as MediaQuery,OI as PREFIX,s as RenderModeEnum,sL as SEGMENT_FIELD_END,iL as SEGMENT_FIELD_START,WI as STACK_FIELD_END,XI as STACK_FIELD_END_OffsetSilhouette,GI as STACK_FIELD_END_PERCENT,VI as STACK_FIELD_KEY,NI as STACK_FIELD_START,YI as STACK_FIELD_START_OffsetSilhouette,UI as STACK_FIELD_START_PERCENT,$I as STACK_FIELD_TOTAL,ZI as STACK_FIELD_TOTAL_BOTTOM,KI as STACK_FIELD_TOTAL_PERCENT,qI as STACK_FIELD_TOTAL_TOP,_D as STATE_VALUE_ENUM,FC as StreamLight,MI as ThemeManager,XL as TransformLevel,dD as USER_LAYOUT_RECT_LEVEL,SF as VChart,$O as boundsInRect,gI as builtinThemes,YO as calcLayoutNumber,XO as calcPadding,EO as computeActualDataScheme,qO as convertPoint,rf as createArc,ef as createArea,Pp as createGroup,Eg as createLine,Ig as createRect,Kg as createRichText,Tg as createSymbol,Ag as createText,sI as darkTheme,JO as dataScheme,SF as default,fI as defaultThemeName,RO as getActualColor,ZO as getActualNumValue,DO as getColorSchemeBySeries,BO as getDataScheme,uI as getFunnelTheme,kI as getMergedTheme,BF as getSpecInfo,bI as getTheme,_I as hasThemeMerged,OO as isColorKey,UO as isPercent,GO as isPercentOffset,IO as isProgressiveDataColorScheme,tI as isTokenKey,WO as isValidOrient,iI as lightTheme,EF as lookup,RI as measureText,KO as normalizeLayoutPaddingSpec,PO as queryColorFromColorScheme,QO as queryToken,uF as registerAnimate,EK as registerBoxplotChart,mJ as registerBrush,KJ as registerCanvasTooltipHandler,iH as registerCartesianLogAxis,nH as registerCartesianSymlogAxis,tH as registerCartesianTimeAxis,JJ as registerChartPlugin,oQ as registerChartResizeZoomPlugin,xK as registerCirclePackingChart,Q$ as registerCircularProgressChart,aq as registerContinuousLegend,NK as registerCorrelationChart,_J as registerCustomMark,DL as registerDataSetInstanceParser,LL as registerDataSetInstanceTransform,Hq as registerDataZoom,WJ as registerDomTooltipHandler,vF as registerElementHighlight,bF as registerElementSelect,rQ as registerFormatPlugin,hK as registerFunnelChart,iK as registerGaugeChart,oN as registerGeoCoordinate,uJ as registerGeoMarkPoint,xJ as registerGridLayout,jK as registerHeatmapChart,q$ as registerHistogramChart,$q as registerIndicator,uK as registerLinearProgressChart,E$ as registerMapChart,HZ as registerMarkArea,RZ as registerMarkLine,lJ as registerMarkPoint,tQ as registerMediaQuery,qZ as registerPlayer,sU as registerPolarBandAxis,Aq as registerPolarCrossHair,eU as registerPolarLinearAxis,NZ as registerPolarMarkArea,IZ as registerPolarMarkLine,cJ as registerPolarMarkPoint,SJ as registerPoptip,W$ as registerRadarChart,DK as registerRangeAreaChart,fK as registerRangeColumnChart,H$ as registerRoseChart,OK as registerSankeyChart,YV as registerScatterChart,Wq as registerScrollBar,_K as registerSunburstChart,yI as registerTheme,DZ as registerTitle,nJ as registerTotalLabel,AK as registerTreemapChart,TK as registerWaterfallChart,aK as registerWordCloudChart,xI as removeTheme,SI as themeExist,mI as themes,eI as token,LO as transformColorSchemeToStandardStruct,xL as transformToGraphic,PF as version,S_ as vglobal,jy as warn}; diff --git a/packages/harmony_vchart/library/src/main/ets/index-harmony.es.min.js b/packages/harmony_vchart/library/src/main/ets/index-harmony.es.min.js index e63c189d4b..0475c2fd58 100644 --- a/packages/harmony_vchart/library/src/main/ets/index-harmony.es.min.js +++ b/packages/harmony_vchart/library/src/main/ets/index-harmony.es.min.js @@ -12,7 +12,7 @@ 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 t(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 s,n;function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}!function(t){t["desktop-browser"]="desktop-browser",t["mobile-browser"]="mobile-browser",t.node="node",t.worker="worker",t.miniApp="miniApp",t.wx="wx",t.tt="tt",t.harmony="harmony",t["desktop-miniApp"]="desktop-miniApp",t.lynx="lynx"}(s||(s={})),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.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"}(n||(n={}));var a={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 h=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||l(t,"Boolean");var c=t=>"function"==typeof t;var d=t=>null==t;var u=t=>null!=t;var p=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var g=t=>"object"==typeof t&&null!==t;var f=function(t){if(!g(t)||!l(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 m=t=>void 0===t;var v=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||l(t,"String")};var _=t=>Array.isArray?Array.isArray(t):l(t,"Array");var y=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var b=t=>l(t,"Date");var x=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||l(t,"Number")};var S=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>x(t)&&Number.isFinite(t);var A=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var M=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 T=Object.prototype;var C=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||T)};const B=Object.prototype.hasOwnProperty;function E(t){if(d(t))return!0;if(y(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(C(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var P=(t,e,i)=>{const s=v(e)?e.split("."):e;for(let e=0;enull!=t&&R.call(t,e);function I(t,e,i){let s;if(!u(t)||"object"!=typeof t||e&&e(t))return t;const n=_(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:h(t)||x(t)||v(t)?t:b(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=I(r,e,i)}return s}function L(t,e,i=!1,s=!1){if(e){if(t===e)return;if(u(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!u(n[a])||"object"!=typeof n[a]||s&&_(t[a])?F(t,a,n[a]):D(t,e,a,i,s)}}}}function D(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(_(a)){if(s)o=[];else if(_(r))o=r;else if(y(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(v(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function H(t){return Object.prototype.toString.call(t)}function V(t){return Object.keys(t)}function N(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(H(t)!==H(e))return!1;if(c(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 s=t.length-1;s>=0;s--)if(!N(t[s],e[s],i))return!1;return!0}if(!f(t))return!1;const s=V(t),n=V(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!N(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;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;ne?1:t>=e?0:NaN}function tt(t){return Number(t)}function et(t,e,i=tt){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)}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&&x(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(t=nt.None,e){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(...t){this._onErrorHandler.forEach((e=>e(...t)))}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(...t){var e;return this._level>=nt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):st(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=nt.Warn&&st(this._method||"warn","WARN",t),this}info(...t){return this._level>=nt.Info&&st(this._method||"log","INFO",t),this}debug(...t){return this._level>=nt.Debug&&st(this._method||"log","DEBUG",t),this}}function at(t,e,i=0,s){for(d(s)&&(s=t.length);i>>1;Q(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(Q)),et(i,.5)},ct=1e-10,dt=1e-10;function ut(t,e,i=dt,s=ct){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}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(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var mt=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 g=!e&&0!==e&&yt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return g?(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=m(_,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?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(_,e),c?f(t):a}(l);if(d)return o=m(_,e),f(l)}return void 0===o&&(o=m(_,e)),a}return e=+e||0,p(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(g)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:y(Date.now())},b.pending=function(){return void 0!==o},b}function xt(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return p(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),bt(t,e,{leading:s,trailing:n,maxWait:e})}function St(t,e){return i=>t*(1-i)+e*i}function kt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function At(t){if(k(t))return t;const e=+t;return k(e)?e:0}function Mt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}yt=!1;const wt=4294967296;const Tt=t=>e=>P(e,t),Ct=(t,e={})=>{if(c(t))return t;const i=[t];return(e&&e.get||Tt)(i)},Bt=(t,e={})=>{if(_(t)){const i=t.map((t=>Ct(t,e)));return t=>i.map((e=>e(t)))}return Ct(t,e)},Et=(t,e)=>d(t)?e:v(t)?e*parseFloat(t)/100:t,Pt=t=>0,Rt=(t,e)=>{const i=c(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function It(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Lt(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!d(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:u,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)u+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!d(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!d(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:u,b:p},predict:g,rSquared:It(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=Ot(f.min,f);for(let r=0;r=1?zt:t<=-1?-zt:Math.asin(t)}function qt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Zt(t,e){return t[0]*e[1]-t[1]*e[0]}function Jt(t,e){let i=0;for(let s=0;s0?i:0}function ee(t,e){return Qt(t+e,10**Math.max(te(t),te(e)))}function ie(t,e){return Qt(t-e,10**Math.max(te(t),te(e)))}class se{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new se(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 x(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return x(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 ne{static distancePP(t,e){return Xt($t(t.x-e.x,2)+$t(t.y-e.y,2))}static distanceNN(t,e,i,s){return Xt($t(t-i,2)+$t(e-s,2))}static distancePN(t,e,i){return Xt($t(e-t.x,2)+$t(i-t.y,2))}static pointAtPP(t,e,i){return new se((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function re(t){return t*(Math.PI/180)}function ae(t){return 180*t/Math.PI}const oe=(t=0)=>{if(t<0)for(;t<-jt;)t+=jt;else if(t>0)for(;t>jt;)t-=jt;return t};function le(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 he(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function ce(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function de(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ue(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=de(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)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function pe(t){return(t=de(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 ge(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function fe(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function ve(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=ye(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var _e;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(_e||(_e={}));const ye=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function be(t,e,i){if(!t||!e)return _e.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=ye(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function ke(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Ae({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Me(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function we(t,e){const i=e?re(t.angle):t.angle,s=Me(t);return[Ae({x:t.x1,y:t.y1},i,s),Ae({x:t.x2,y:t.y1},i,s),Ae({x:t.x2,y:t.y2},i,s),Ae({x:t.x1,y:t.y2},i,s)]}function Te(t,e,i=!1){const s=we(t,i),n=we(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Me(t),Me(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?re(t.angle):t.angle;let u=i?re(90-t.angle):t.angle+zt;const p=i?re(e.angle):e.angle;let g=i?re(90-e.angle):e.angle+zt;u>Ht&&(u-=Ht),g>Ht&&(g-=Ht);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(ke(n,i)+ke(n,s))/2>ke(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Ce=1e-8;function Be(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Re(t,e){return Math.abs(t-e){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"};function Ie(t,e={},i){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")}class Le{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(),u(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=u(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(d(this._canvas)&&(u(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),d(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&u(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),d(this._context)&&u(this._canvas)){const t=this._canvas.getContext("2d");u(t)&&(t.save(),t.font=Ie(this.textSpec),this._contextSaved=!0,this._context=t)}return!d(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:f=o}=this._userSpec;if(v(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,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(d(t))return{width:0,height:0};if(d(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,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}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(d(this._numberCharSize)){const t=this._standardMethod(Le.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Le.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return d(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Le.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(d(this._letterCharSize)){const t=this._standardMethod(Le.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Le.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return u(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){u(this._canvas)&&(this._canvas=null),u(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Le.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Le.NUMBERS_CHAR_SET="0123456789",Le.FULL_SIZE_CHAR="字";const De=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),Fe=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=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(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=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(t=0,e=0,i=0,s=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(t=0,e=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(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return ze(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 He extends je{}class Ve extends je{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Te(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new Ve(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Ae({x:this.x1,y:this.y1},this.angle,t),Ae({x:this.x2,y:this.y1},this.angle,t),Ae({x:this.x1,y:this.y2},this.angle,t),Ae({x:this.x2,y:this.y2},this.angle,t)]}}class Ne{constructor(t=1,e=0,i=0,s=1,n=0,r=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 Ne,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,f=o*n+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 Ne;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:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ne(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=ae(r.rotateDeg),r}}class We{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 Ue(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 Ge(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 Ye=/^#([0-9a-f]{3,8})$/,Xe={transparent:4294967040},$e={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 Ke(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function qe(t){return x(t)?new ei(t>>16,t>>8&255,255&t,1):_(t)?new ei(t[0],t[1],t[2]):new ei(255,255,255)}function Ze(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Je(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const Qe=(t,e)=>{const i=Ye.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ei((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?qe(t):8===e?new ei(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class ti{static Brighter(t,e=1){return 1===e?t:new ti(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new ti(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof ti?t:new ti(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();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(u(Xe[t]))return function(t){return x(t)?new ei(t>>>24,t>>>16&255,t>>>8&255,255&t):_(t)?new ei(t[0],t[1],t[2],t[3]):new ei(255,255,255,1)}(Xe[t]);if(u($e[t]))return qe($e[t]);const e=`${t}`.trim().toLowerCase(),i=Qe(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new ei(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=Ue(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ei(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ti.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ei(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=Ge(this.color.r,this.color.g,this.color.b),r=Ue(d(t)?n.h:mt(t,0,360),d(e)?n.s:e>=0&&e<=1?100*e:e,d(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new ei(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!d(t)&&(this.color.r=t),!d(e)&&(this.color.g=e),!d(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=Qe(e,!0);return null!=i?i:this}setColorName(t){const e=$e[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(t=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}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new ti(this.color.toString())}copyGammaToLinear(t,e=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,e=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=Ze(t.color.r),this.color.g=Ze(t.color.g),this.color.b=Ze(t.color.b),this}copyLinearToSRGB(t){return this.color.r=Je(t.color.r),this.color.g=Je(t.color.g),this.color.b=Je(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ei{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)),u(s)?this.opacity=isNaN(+s)?1:Math.max(0,Math.min(1,+s)):this.opacity=1}formatHex(){return`#${Ke(this.r)+Ke(this.g)+Ke(this.b)+(1===this.opacity?"":Ke(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}=Ge(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ii(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 ei(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:Ge});function ni(t){if(k(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,s]=t;return[e,i,s,i]}if(4===e)return t}if(p(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 ri(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=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:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}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}const li=1e-10;function hi(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+li)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=pi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=ne.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=ci(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-li,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function ci(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function di(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return ci(t,t-(i*i-e*e+t*t)/(2*i))+ci(e,s)}function ui(t,e){const i=ne.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function pi(t){const e={x:0,y:0};for(let i=0;ithis.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 mi;function vi(t,e){const i=fi(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 _i{constructor(t={}){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 yi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function bi(t){let e;if(e=yi.exec(t))return new _i({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 xi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Si{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 Si.instance||(Si.instance=new Si),Si.instance}newFormat(t){const e=bi(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"):ki[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=ki[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:_,group:y,numerals:b}=this;function x(t){let e,r,x,S=u,k=p,A=t;if("c"===d)k=g(A)+k,A="";else{A=+A;let t=A<0||1/A<0;if(A=isNaN(A)?m:g(Math.abs(A),h),c&&(A=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}(A)),t&&0==+A&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,k=("s"===d?xi[8+mi/3]:"")+k+(t&&"("===n?")":""),f)for(e=-1,r=A.length;++ex||x>57){k=(46===x?_+A.slice(e+1):A.slice(e))+k,A=A.slice(0,e);break}}l&&!a&&(A=y(A,1/0));let M=S.length+A.length+k.length,w=M>1)+S+A+k+w.slice(M);break;default:A=w+S+A+k}return b(A)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=bi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=fi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=xi[8+n/3];return function(t){return s(r*t)+a}}}const ki={"%":(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)=>vi(100*t,e),r:vi,s:function(t,e){const i=fi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(mi=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")+fi(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 Ai(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(_.fx>e.fx?(Ci(y,1+c,v,-c,e),y.fx=t(y),y.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Ci(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=Jt(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Pi(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Ti(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},Ji=Math.sqrt,Qi=Math.tan;function ts(t){return t>1?0:t<-1?Fi:Math.acos(t)}function es(t){return t>1?zi:t<-1?-zi:Math.asin(t)}function is(){}function ss(t,e){t&&rs.hasOwnProperty(t.type)&&rs[t.type](t,e)}var ns={Feature:function(t,e){ss(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sFi?t+Math.round(-t/Hi)*Hi:t,e]}function _s(t,e,i){return(t%=Hi)?e||i?ms(bs(t),xs(e,i)):bs(t):e||i?xs(e,i):vs}function ys(t){return function(e,i){return[(e+=t)>Fi?e-Hi:e<-Fi?e+Hi:e,i]}}function bs(t){var e=ys(t);return e.invert=ys(-t),e}function xs(t,e){var i=Yi(t),s=qi(t),n=Yi(e),r=qi(e);function a(t,e){var a=Yi(e),o=Yi(t)*a,l=qi(t)*a,h=qi(e),c=h*i+o*s;return[Gi(l*n-c*r,o*i-h*s),es(c*n+l*r)]}return a.invert=function(t,e){var a=Yi(e),o=Yi(t)*a,l=qi(t)*a,h=qi(e),c=h*n-l*r;return[Gi(l*n+h*r,o*i+c*s),es(c*i-o*s)]},a}function Ss(t,e){(e=cs(e))[0]-=t,fs(e);var i=ts(-e[1]);return((-e[2]<0?-i:i)+Hi-Di)%Hi}function ks(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:is,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function As(t,e){return Wi(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 Ts(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Os(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 Is(t,e,i,s){return function(n){var r,a,o,l=e(n),h=ks(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Os(a);var t=function(t,e){var i=Ps(e),s=e[1],n=qi(s),r=[qi(i),-Yi(i),0],a=0,o=0;Es.reset(),1===n?s=zi+Di:-1===n&&(s=-zi-Di);for(var l=0,h=t.length;l=0?1:-1,M=A*k,w=M>Fi,T=f*x;if(Es.add(Gi(T*A*qi(M),m*S+T*Yi(M))),a+=w?k+A*Hi:k,w^p>=i^y>=i){var C=us(cs(u),cs(_));fs(C);var B=us(r,C);fs(B);var E=(w^k>=0?-1:1)*es(B[2]);(s>E||s===E&&(C[0]||C[1]))&&(o+=w^k>=0?1:-1)}}return(a<-Di||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(Ls))}return u}}function Ls(t){return t.length>1}function Ds(t,e){return((t=t.x)[0]<0?t[1]-zi-Di:zi-t[1])-((e=e.x)[0]<0?e[1]-zi-Di:zi-e[1])}1===(Cs=Rs).length&&(Bs=Cs,Cs=function(t,e){return Rs(Bs(t),e)});var Fs=Is((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?Fi:-Fi,l=Wi(r-i);Wi(l-Fi)0?zi:-zi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Fi&&(Wi(i-n)Di?Ui((qi(e)*(r=Yi(s))*qi(i)-qi(s)*(n=Yi(e))*qi(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*zi,s.point(-Fi,n),s.point(0,n),s.point(Fi,n),s.point(Fi,0),s.point(Fi,-n),s.point(0,-n),s.point(-Fi,-n),s.point(-Fi,0),s.point(-Fi,n);else if(Wi(t[0]-e[0])>Di){var r=t[0]0,n=Wi(e)>Di;function r(t,i){return Yi(t)*Yi(i)>e}function a(t,i,s){var n=[1,0,0],r=us(cs(t),cs(i)),a=ds(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=us(n,r),u=gs(n,h);ps(u,gs(r,c));var p=d,g=ds(u,p),f=ds(p,p),m=g*g-f*(ds(u,u)-1);if(!(m<0)){var v=Ji(m),_=gs(p,(-g-v)/f);if(ps(_,u),_=hs(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],k=i[1];x0^_[1]<(Wi(_[0]-b)Fi^(b<=_[0]&&_[0]<=x)){var w=gs(p,(-g+v)/f);return ps(w,u),[_,hs(w)]}}}function o(e,i){var n=s?t:Fi-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Is(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],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?Fi:-Fi),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||As(e,p)||As(g,p))&&(g[2]=1),f!==l)c=0,f?(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^f){var v;m&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)))}!f||e&&As(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},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=Yi(e),o=qi(e),l=s*i;null==n?(n=e+s*Hi,r=e-l/2):(n=Ss(a,n),r=Ss(a,r),(s>0?nr)&&(n+=s*Hi));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 Wi(s[0]-t)0?0:3:Wi(s[0]-i)0?2:1:Wi(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,f,m,v,_,y=a,b=ks(),x={point:S,lineStart:function(){x.point=k,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(k(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&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=Os(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&ws(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 k(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&&m)y.point(r,a);else{var l=[g=Math.max(Hs,Math.min(js,g)),f=Math.max(Hs,Math.min(js,f))],b=[r=Math.max(Hs,Math.min(js,r)),a=Math.max(Hs,Math.min(js,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):(m||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Ns(t){return t}var Ws,Us,Gs,Ys,Xs=Ri(),$s=Ri(),Ks={point:is,lineStart:is,lineEnd:is,polygonStart:function(){Ks.lineStart=qs,Ks.lineEnd=Qs},polygonEnd:function(){Ks.lineStart=Ks.lineEnd=Ks.point=is,Xs.add(Wi($s)),$s.reset()},result:function(){var t=Xs/2;return Xs.reset(),t}};function qs(){Ks.point=Zs}function Zs(t,e){Ks.point=Js,Ws=Gs=t,Us=Ys=e}function Js(t,e){$s.add(Ys*t-Gs*e),Gs=t,Ys=e}function Qs(){Js(Ws,Us)}var tn=Ks,en=1/0,sn=en,nn=-en,rn=nn;var an,on,ln,hn,cn={point:function(t,e){tnn&&(nn=t);ern&&(rn=e)},lineStart:is,lineEnd:is,polygonStart:is,polygonEnd:is,result:function(){var t=[[en,sn],[nn,rn]];return nn=rn=-(sn=en=1/0),t}},dn=0,un=0,pn=0,gn=0,fn=0,mn=0,vn=0,_n=0,yn=0,bn={point:xn,lineStart:Sn,lineEnd:Mn,polygonStart:function(){bn.lineStart=wn,bn.lineEnd=Tn},polygonEnd:function(){bn.point=xn,bn.lineStart=Sn,bn.lineEnd=Mn},result:function(){var t=yn?[vn/yn,_n/yn]:mn?[gn/mn,fn/mn]:pn?[dn/pn,un/pn]:[NaN,NaN];return dn=un=pn=gn=fn=mn=vn=_n=yn=0,t}};function xn(t,e){dn+=t,un+=e,++pn}function Sn(){bn.point=kn}function kn(t,e){bn.point=An,xn(ln=t,hn=e)}function An(t,e){var i=t-ln,s=e-hn,n=Ji(i*i+s*s);gn+=n*(ln+t)/2,fn+=n*(hn+e)/2,mn+=n,xn(ln=t,hn=e)}function Mn(){bn.point=xn}function wn(){bn.point=Cn}function Tn(){Bn(an,on)}function Cn(t,e){bn.point=Bn,xn(an=ln=t,on=hn=e)}function Bn(t,e){var i=t-ln,s=e-hn,n=Ji(i*i+s*s);gn+=n*(ln+t)/2,fn+=n*(hn+e)/2,mn+=n,vn+=(n=hn*t-ln*e)*(ln+t),_n+=n*(hn+e),yn+=3*n,xn(ln=t,hn=e)}var En=bn;function Pn(t){this._context=t}Pn.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,Hi)}},result:is};var Rn,On,In,Ln,Dn,Fn=Ri(),zn={point:is,lineStart:function(){zn.point=jn},lineEnd:function(){Rn&&Hn(On,In),zn.point=is},polygonStart:function(){Rn=!0},polygonEnd:function(){Rn=null},result:function(){var t=+Fn;return Fn.reset(),t}};function jn(t,e){zn.point=Hn,On=Ln=t,In=Dn=e}function Hn(t,e){Ln-=t,Dn-=e,Fn.add(Ji(Ln*Ln+Dn*Dn)),Ln=t,Dn=e}var Vn=zn;function Nn(){this._string=[]}function Wn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Un(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),ls(t,i(s))),s.result()}return r.area=function(t){return ls(t,i(tn)),tn.result()},r.measure=function(t){return ls(t,i(Vn)),Vn.result()},r.bounds=function(t){return ls(t,i(cn)),cn.result()},r.centroid=function(t){return ls(t,i(En)),En.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ns):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Nn):new Pn(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 Gn(t){return function(e){var i=new Yn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Yn(){}function Xn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),ls(i,t.stream(cn)),e(cn.result()),null!=s&&t.clipExtent(s),t}function $n(t,e,i){return Xn(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 Kn(t,e,i){return $n(t,[[0,0],e],i)}function qn(t,e,i){return Xn(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 Xn(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)}Nn.prototype={_radius:4.5,_circle:Wn(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=Wn(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}},Yn.prototype={constructor:Yn,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 Jn=16,Qn=Yi(30*Ni);function tr(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&f--){var b=a+u,x=o+p,S=l+g,k=Ji(b*b+x*x+S*S),A=es(S/=k),M=Wi(Wi(S)-1)e||Wi((v*B+_*E)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Ni:0,B()):[m*Vi,v*Vi,_*Vi]},T.angle=function(t){return arguments.length?(y=t%360*Ni,B()):y*Vi},T.reflectX=function(t){return arguments.length?(b=t?-1:1,B()):b<0},T.reflectY=function(t){return arguments.length?(x=t?-1:1,B()):x<0},T.precision=function(t){return arguments.length?(a=tr(o,w=t*t),E()):Ji(w)},T.fitExtent=function(t,e){return $n(T,t,e)},T.fitSize=function(t,e){return Kn(T,t,e)},T.fitWidth=function(t,e){return qn(T,t,e)},T.fitHeight=function(t,e){return Zn(T,t,e)},function(){return e=t.apply(this,arguments),T.invert=e.invert&&C,B()}}function ar(t){var e=0,i=Fi/3,s=rr(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Ni,i=t[1]*Ni):[e*Vi,i*Vi]},n}function or(t,e){var i=qi(t),s=(i+qi(e))/2;if(Wi(s)2?t[2]*Ni:0),e.invert=function(e){return(e=t.invert(e[0]*Ni,e[1]*Ni))[0]*=Vi,e[1]*=Vi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===gr?[[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 mr(t){return Qi((zi+t)/2)}function vr(t,e){var i=Yi(t),s=t===e?qi(t):$i(i/Yi(e))/$i(mr(e)/mr(t)),n=i*Ki(mr(t),s)/s;if(!s)return gr;function r(t,e){n>0?e<-zi+Di&&(e=-zi+Di):e>zi-Di&&(e=zi-Di);var i=n/Ki(mr(e),s);return[i*qi(s*t),n-i*Yi(s*t)]}return r.invert=function(t,e){var i=n-e,r=Zi(s)*Ji(t*t+i*i),a=Gi(t,Wi(i))*Zi(i);return i*s<0&&(a-=Fi*Zi(t)*Zi(i)),[a/s,2*Ui(Ki(n/r,1/s))-zi]},r}function _r(t,e){return[t,e]}function yr(t,e){var i=Yi(t),s=t===e?qi(t):(i-Yi(e))/(e-t),n=i/s+t;if(Wi(s)Di&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Cr.invert=dr(es),Br.invert=dr((function(t){return 2*Ui(t)})),Er.invert=function(t,e){return[-e,2*Ui(Xi(t))-zi]};var Or={exports:{}},Ir=function(t,e){this.p1=t,this.p2=e};Ir.prototype.rise=function(){return this.p2[1]-this.p1[1]},Ir.prototype.run=function(){return this.p2[0]-this.p1[0]},Ir.prototype.slope=function(){return this.rise()/this.run()},Ir.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Ir.prototype.isVertical=function(){return!isFinite(this.slope())},Ir.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Ir.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Ir.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Ir.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)},Ir.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Lr=Ir,Dr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Lr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Dr(t.slice(0,s),e),o=Dr(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},Fr=Dr;!function(t){var e=Fr;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;r{const i=jr(Nr,e),{tolerance:s}=i;return zr(t,s)};var Ur;!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"}(Ur||(Ur={}));const Gr=(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.sort&&(k(l.sortIndex)||(l.sortIndex=0),u(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!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;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,y=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],k=new Set,A=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),k.has(i)||(k.add(i),S.push(i),_(m)?A.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):A.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else y[r][l]+=a;e&&e.includeValues&&!v&&y[r][c].push(t[n]);break}}}let M=0;const w=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=y.length;t0?y[t][l]/M:0,w.push(y[t])}return w},Xr=(t,e)=>{var i,s,n,r,a,o,l,h,c,u;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,y=-1/0;if(e.extent)v=e.extent[0],y=e.extent[1];else for(let e=0;ey&&(y=s))}if(!Number.isFinite(v)||!Number.isFinite(y)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=y;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(y-v>1){const e=Math.floor(v),i=Math.ceil((y-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>y){t=s,m.length=t+1;break}}else{const e=(y-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>y){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",k=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",A=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",M=null!==(u=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==u?u:"percentage",w=_(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],T=_(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],C=T.length?T:void 0,B=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:k,percentageName:M,valuesName:A,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:C});if(!w.length)return Yr(t,B);const E={};return t.forEach((t=>{const e=w.map((e=>null==t?void 0:t[e])).join("-&&-");E[e]?E[e].push(t):E[e]=[t]})),Object.values(E).map((t=>{const e=[...T,...w];return Yr(t,Object.assign(Object.assign({},B),{groupField:e.length?e:void 0,n:t.length}))})).flat()},$r=(t,e)=>{var i,s,n,r,a,o,l,h,c,u,p,g,f,m,v,y;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const k=!!(null==e?void 0:e.includeValues),A=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},M=null!==(n=A.key)&&void 0!==n?n:_(x)?null:null!==(r=x)&&void 0!==r?r:"key",w=null!==(a=A.count)&&void 0!==a?a:"count",T=null!==(o=A.mean)&&void 0!==o?o:"mean",C=null!==(l=A.q1)&&void 0!==l?l:"q1",B=null!==(h=A.median)&&void 0!==h?h:"median",E=null!==(c=A.q3)&&void 0!==c?c:"q3",P=null!==(u=A.iqr)&&void 0!==u?u:"iqr",R=null!==(p=A.min)&&void 0!==p?p:"min",O=null!==(g=A.max)&&void 0!==g?g:"max",I=null!==(f=A.lowerWhisker)&&void 0!==f?f:"lowerWhisker",L=null!==(m=A.upperWhisker)&&void 0!==m?m:"upperWhisker",D=null!==(v=A.outliers)&&void 0!==v?v:"outliers",F=null!==(y=A.values)&&void 0!==y?y:"values",z=new Map,j=new Map,H=new Map,V=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),k&&j.set(r,[]),_(x)?H.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):H.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),k){const t=j.get(r);t&&t.push(i)}}_(S)&&(S=[mt(Math.min.apply(null,S),0,1),mt(Math.max.apply(null,S),0,1)]);const N=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=H.get(t);if(null!==M)f[M]=m;else if(_(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[w]=s,f[T]=o,f[C]=l,f[B]=h,f[E]=c,f[P]=d,f[R]=n,f[O]=r,f[I]=u,f[L]=p,f[D]=g,k&&(f[F]=j.get(t)||[]),N.push(f)}return N};var Kr={},qr={};function Zr(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function Jr(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function Qr(t,e){var i=t+"",s=i.length;return s9999?"+"+Qr(e,6):Qr(e,4))+"-"+Qr(t.getUTCMonth()+1,2)+"-"+Qr(t.getUTCDate(),2)+(r?"T"+Qr(i,2)+":"+Qr(s,2)+":"+Qr(n,2)+"."+Qr(r,3)+"Z":n?"T"+Qr(i,2)+":"+Qr(s,2)+":"+Qr(n,2)+"Z":s||i?"T"+Qr(i,2)+":"+Qr(s,2)+"Z":"")}function ea(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 qr;if(h)return h=!1,Kr;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(;a0}function ua(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=ra(t));var r=[];switch(t.type){case"GeometryCollection":return pa(t,(function(t){fa(t,s)})),t;case"FeatureCollection":return ua(t,(function(t){ua(fa(t,s),(function(t){r.push(t)}))})),oi(r)}return fa(t,s)}function fa(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return pa(t,(function(t){fa(t,e)})),t;case"LineString":return ma(ca(t),e),t;case"Polygon":return va(ca(t),e),t;case"MultiLineString":return ca(t).forEach((function(t){ma(t,e)})),t;case"MultiPolygon":return ca(t).forEach((function(t){va(t,e)})),t;case"Point":case"MultiPoint":return t}}function ma(t,e){da(t)===e&&t.reverse()}function va(t,e){da(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=_a(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Sa=(t,e={},i)=>{i.type=Ur.GEO;const s=jr(ba,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(xa(t))})):e.push(xa(t))})),e})(t);let l=t.features;return o&&(l=ga(t,{reverse:!p(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=ya.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=ya.bounds(t);t.bbox=e}})),t.features=l,t},ka={},Aa=(t,e,i)=>{i.type=Ur.GEO;const s=jr(ba,ka,e),{object:n}=s;if(!v(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 Rr(a,t)}))}:Rr(a,o));var a,o;return Sa(r,s,i)},Ma=(t,e,i)=>{const s=!h(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))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let wa=0;function Ta(t="dataset"){return wa>1e8&&(wa=0),t+"_"+wa++}class Ca{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new o,i=(null==t?void 0:t.name)?t.name:Ta("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()}}class Ba{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new o,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&N(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Ta("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){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,e=!0){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)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}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,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&N(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof Ba||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?z({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!d(this._fields)&&d(i)?(this.dataSet.registerTransform("fields",Gr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Un();const Ea={},Pa={albers:hr,albersusa:function(){var t,e,i,s,n,r,a=hr(),o=lr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=lr().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)}},Ra=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Oa(t,e){return function i(){const s=e();return s.type=t,s.path=Un().projection(s),s.copy=s.copy||function(){const t=i();return Ra.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Ia{static GenAutoIncrementId(){return Ia.auto_increment_id++}}Ia.auto_increment_id=0;class La{constructor(t){this.id=Ia.GenAutoIncrementId(),this.registry=t}}const Da="named",Fa="inject",za="multi_inject",ja="inversify:tagged",Ha="inversify:paramtypes";class Va{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===Da?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var Na=function(t){var e;return function(t){const e="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),s=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),n=new WeakMap;function r(t,e,i){let r=n.get(t);if(h(r)){if(!i)return;r=new s,n.set(t,r)}let a=r.get(e);if(h(a)){if(!i)return;a=new s,r.set(e,a)}return a}function a(t,e,i){if(o(t,e,i))return!0;const s=f(e);return!c(s)&&a(t,s,i)}function o(t,e,i){const s=r(e,i,!1);return!h(s)&&!!s.has(t)}function l(t,e,i){if(o(t,e,i))return function(t,e,i){const s=r(e,i,!1);if(!h(s))return s.get(t)}(t,e,i);const s=f(e);return c(s)?void 0:l(t,s,i)}function h(t){return void 0===t}function c(t){return null===t}function d(t){return"object"==typeof t?null!==t:"function"==typeof t}function u(t,i){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const s=3===i?"string":5===i?"number":"default",n=function(t,e){const i=t[e];if(null!=i){if(!g(i))throw new TypeError;return i}}(t,e);if(void 0!==n){const e=n.call(t,s);if(d(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.valueOf;if(g(i)){const e=i.call(t);if(!d(e))return e}}else{const e=t.valueOf;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.toString;if(g(i)){const e=i.call(t);if(!d(e))return e}}throw new TypeError}(t,"default"===s?"number":s)}function p(t){const e=u(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function g(t){return"function"==typeof t}function f(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const s=t.prototype,n=s&&Object.getPrototypeOf(s);if(null==n||n===Object.prototype)return e;const r=n.constructor;return"function"!=typeof r||r===t?e:r}t("defineMetadata",(function(t,e,i,s){if(!d(i))throw new TypeError;return n=t,a=e,void r(i,s,!0).set(n,a);var n,a})),t("hasMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),l(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function Wa(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};Na.hasOwnMetadata(t,e)&&(r=Na.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,Na.defineMetadata(t,r,e)}(ja,t,i.toString(),s)}function Ua(t){return(e,i,s)=>{Wa(e,0,s,t)}}function Ga(t){return e=>(i,s,n)=>Ua(new Va(t,e))(i,s,n)}const Ya=Ga(Fa),Xa=Ga(za);function $a(){return function(t){return Na.defineMetadata(Ha,null,t),t}}function Ka(t){return Ua(new Va(Da,t))}const qa="Singleton",Za="Transient",Ja="ConstantValue",Qa="DynamicValue",to="Factory",eo="Function",io="Instance",so="Invalid";class no{constructor(t,e){this.id=Ia.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=so,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new no(this.serviceIdentifier,this.scope);return t.activated=t.scope===qa&&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 ro{getConstructorMetadata(t){return{compilerGeneratedMetadata:Na.getMetadata(Ha,t),userGeneratedMetadata:Na.getMetadata(ja,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const ao=(oo=Da,t=>{const e=e=>{if(null==e)return!1;if(e.key===oo&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const co=Symbol("ContributionProvider");class uo{constructor(t,e){this.serviceIdentifier=t,this.container=e,go.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function po(t,e){t(co).toDynamicValue((({container:t})=>new uo(e,t))).inSingletonScope().whenTargetNamed(e)}class go{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}go.store=new Map;class fo{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 mo extends fo{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const vo=Symbol.for("EnvContribution"),_o=Symbol.for("VGlobal"),yo=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Za,this.options=e,this.id=Ia.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new ro}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,Da,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new no(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new ho(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[Fa],multiInject:s[za]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:a,metadata:e,bindings:l};n.push(t)}}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 eo:e=t.cache;break;case io: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===qa&&(t.cache=e,t.activated=!0)}},bo=Symbol.for("RenderService");const xo=new class{get renderService(){return this._renderService||(this._renderService=yo.get(bo)),this._renderService}};let So=0;class ko{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=xo.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++So,t),this.tryRunAnimationFrameNextFrame(),So}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class Ao{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var Mo=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wo=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},To=function(t,e){return function(i,s){e(i,s,t)}},Co=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 Bo=class extends Ao{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}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){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Ia.GenAutoIncrementId(),this.hooks={onSetEnv:new mo(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}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)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new ko);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}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)}loadFont(t,e,i){return Co(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}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,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var Eo,Po,Ro,Oo;Bo=Mo([$a(),To(0,Ya(co)),To(0,Ka(vo)),wo("design:paramtypes",[Object])],Bo),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(Eo||(Eo={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(Po||(Po={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(Ro||(Ro={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(Oo||(Oo={}));const Io=jt-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)>Io)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%=jt)<0&&(s+=jt),(n%=jt)<0&&(n+=jt),nn;++o,a-=zt)g(a);else for(a=s-s%zt+zt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const Fo=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,zo={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},jo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let Ho,Vo,No,Wo,Uo,Go;var Yo,Xo,$o,Ko,qo,Zo;function Jo(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),f=Math.cos(n),m=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+f,k=i+m,A=S+y*m,M=k-y*f;return[h*b+c*x,d*b+u*x,h*A+c*M,d*A+u*M,h*S+c*k,d*S+u*k]}function Qo(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=re(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 f=d/i,m=c/i,v=-c/s,_=d/s,y=f*o+m*l,b=v*o+_*l,x=f*t+m*e,S=v*t+_*e;let k=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;k<0&&(k=0);let A=Math.sqrt(k);r===n&&(A=-A);const M=.5*(y+x)-A*(S-b),w=.5*(b+S)+A*(x-y),T=Math.atan2(b-w,y-M);let C=Math.atan2(S-w,x-M)-T;C<0&&1===r?C+=jt:C>0&&0===r&&(C-=jt);const B=Math.ceil(Math.abs(C/(zt+.001))),E=[];for(let t=0;te.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 el(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=ll(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Ut(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Ut(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function cl(t,e){const{p0:i,p1:s}=t,n=ne.pointAtPP(i,s,e);return[new dl(i,n),new dl(n,s)]}class dl extends il{constructor(t,e){super(),this.type=qo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return ne.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Nt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?ne.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Ko.ROW?Vt(this.p0.x-this.p1.x):t===Ko.COLUMN?Vt(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class ul{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new hl(new se(this._lastX,this._lastY),new se(t,e),new se(i,s),new se(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new dl(new se(this._lastX,this._lastY),new se(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===Ko.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Vt(t.p0.y-s.y)}if(t===Ko.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Vt(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class pl extends ul{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 gl(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function fl(t,e,i){const s=null!=e?e:Vt(i[i.length-1].x-i[0].x)>Vt(i[i.length-1].y-i[0].y)?Ko.ROW:Ko.COLUMN;return"monotoneY"===t?new pl(t,s):new ul(t,s)}class ml{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 vl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=fl("linear",i,t);return function(t,e){gl(t,e,1)}(new ml(n,s),t),n}function _l(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 yl{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&&_l(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:_l(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 bl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return vl(t,e);const n=fl("basis",i,t);return function(t,e){gl(t,e,2)}(new yl(n,s),t),n}function xl(t){return t<0?-1:1}function Sl(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(xl(r)+xl(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function kl(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Al(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 Ml{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:Al(this,this._t0,kl(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,Al(this,kl(this,e=Sl(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Al(this,this._t0,e=Sl(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 wl extends Ml{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Tl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return vl(t,e);const n=fl("monotoneX",i,t);return function(t,e){gl(t,e,2)}(new Ml(n,s),t),n}function Cl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return vl(t,e);const n=fl("monotoneY",i,t);return function(t,e){gl(t,e,2)}(new wl(n,s),t),n}let Bl=class{constructor(t,e=.5,i){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;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):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()}};class El extends Bl{lineEnd(){this.context.closePath()}}function Pl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new ul("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?Ko.ROW:Ko.COLUMN);return Rl(new Bl(r,e,n),t),r}function Rl(t,e){return gl(t,e,1)}class Ol extends ml{lineEnd(){this.context.closePath()}}function Il(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=fl("linear",i,t);return function(t,e){gl(t,e,1)}(new Ol(n,s),t),n}function Ll(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Dt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>Dt){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function Dl(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return vl(i,n);const o=fl(t,r,i);return gl(new e(o,s,a),i,2),o}}const Fl=Dl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:Ll(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const zl=Dl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:Ll(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class jl extends il{constructor(t,e,i){super(),this.type=qo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return ol(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,sl([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===Ko.ROW?Vt(this.p0.x-this.p2.x):t===Ko.COLUMN?Vt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Ut(t-.01,0),i=Gt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Nt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=ol(i,s,n,e),a=ne.pointAtPP(i,s,e),o=ne.pointAtPP(s,n,e);return[new jl(i,a,r),new jl(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Hl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new dl(new se(this._lastX,this._lastY),new se(t,e))}quadraticCurveTo(t,e,i,s){const n=new jl(new se(this._lastX,this._lastY),new se(t,e),new se(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new hl(new se(this._lastX,this._lastY),new se(t,e),new se(i,s),new se(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Vl(t,e,i){var s,n;switch(e){case"linear":default:return vl(t,i);case"basis":return bl(t,i);case"monotoneX":return Tl(t,i);case"monotoneY":return Cl(t,i);case"step":return Pl(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new ul("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?Ko.ROW:Ko.COLUMN);return Rl(new El(r,e,n),t),r}(t,.5,i);case"stepBefore":return Pl(t,0,i);case"stepAfter":return Pl(t,1,i);case"catmullRom":return Fl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return zl(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return Il(t,i)}}class Nl extends Do{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Lo(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([jo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([jo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([jo.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([jo.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([jo.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([jo.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([jo.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([jo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([jo.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()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Hl(this);el(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[jo.M]=t=>`M${t[1]} ${t[2]}`,t[jo.L]=t=>`L${t[1]} ${t[2]}`,t[jo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[jo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[jo.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3];((t,e,i,s,n,r,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;e`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[jo.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;tGo){let t,e=No;for(let s=1,r=i.length;s{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,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),el(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Ko.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.y-e.p1.y)}if(this.direction===Ko.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{rt.getInstance().warn("空函数")}}),ah=Object.assign(Object.assign({},Jl),{points:[],cornerRadius:0,closePath:!0}),oh=Object.assign(Object.assign({},Jl),{width:100,height:100,spikes:5,thickness:.5}),lh=Object.assign(Object.assign({},Jl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},Jl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const hh=Object.assign(Object.assign({},Jl),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),ch=Object.assign(Object.assign(Object.assign({},Jl),Kl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),dh=Object.assign(Object.assign(Object.assign({},Jl),Kl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",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}),uh=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0,maxWidth:500,maxHeight:500},Jl),{fill:!0,cornerRadius:0,cornerType:"round"}),ph=Object.assign(Object.assign({},uh),{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}),gh=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 m("directional",t.sideOrCorner,1)||m("angular",t.angleValue,1)}function a(){return m("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=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 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=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 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 fh{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(fh.IsGradientStr(t))try{const e=gh(t)[0];if(e){if("linear"===e.type)return fh.ParseLinear(e);if("radial"===e.type)return fh.ParseRadial(e);if("conic"===e.type)return fh.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Ft/2,n=parseFloat(e.value)/180*Ft-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Ht,stops:fh.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:fh.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Ft/2;let n="angular"===e.type?parseFloat(e.value)/180*Ft:0;for(;n<0;)n+=Ht;for(;n>=Ht;)n-=Ht;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}const _h={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"}},yh=!0,bh=!1,xh=/\w|\(|\)|-/,Sh=/[.?!,;:/,。?!、;:]/,kh=/\S/,Ah=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function Mh(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=xo.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=wh(t,a)),a}function wh(t,e,i=!1){let s=e;for(;xh.test(t[s-1])&&xh.test(t[s])||Sh.test(t[s]);)if(s--,s<=0)return i?Th(t,e):e;return s}function Th(t,e){let i=e;for(;xh.test(t[i+1])&&xh.test(t[i])||Sh.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Ch(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=xo.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}var Bh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Eh=class{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=ch.fontSize}){let i=0,s=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 a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=wh(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_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){if(s===n){rt.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}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),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);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}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,a=!1){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=wh(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}};Eh=Bh([$a()],Eh);var Ph=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Rh=Symbol.for("TextMeasureContribution");let Oh=class extends Eh{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}};Oh=Ph([$a()],Oh);const Ih=Symbol.for("CanvasFactory"),Lh=Symbol.for("Context2dFactory");function Dh(t){return yo.getNamed(Ih,xo.global.env)(t)}const Fh=1e-4,zh=Math.sqrt(3),jh=1/3;function Hh(t){return t>-Qh&&tQh||t<-Qh}const Nh=[0,0],Wh=[0,0],Uh=[0,0];function Gh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Yh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function Xh(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 $h(t){return(t%=Ht)<0&&(t+=Ht),t}function Kh(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+=Ht);let d=Math.atan2(l,o);return d<0&&(d+=Ht),d>=s&&d<=n||d+Ht>=s&&d+Ht<=n}function Jh(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(Hh(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 ec=[-1,-1,-1],ic=[-1,-1];function sc(){const t=ic[0];ic[0]=ic[1],ic[1]=t}function nc(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(Hh(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,jh):Math.pow(i,jh),s=s<0?-Math.pow(-s,jh):Math.pow(s,jh);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+zh*Math.sin(e)))/(3*a),h=(-o+i*(s-zh*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,ec);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&sc(),p=Xh(e,s,r,o,ic[0]),u>1&&(g=Xh(e,s,r,o,ic[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Hh(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,ec);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=Yh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);ec[0]=-l,ec[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Ht-1e-4){s=0,n=Ht;const e=r?1:-1;return a>=ec[0]+t&&a<=ec[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Ht,n+=Ht);let c=0;for(let e=0;e<2;e++){const i=ec[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Ht+t),(t>=s&&t<=n||t+Ht>=s&&t+Ht<=n)&&(t>Ft/2&&t<1.5*Ft&&(e=-e),c+=e)}}return c}function oc(t){return Math.round(t/Ft*1e8)/1e8%2*Ft}function lc(t,e){let i=oc(t[0]);i<0&&(i+=Ht);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Ht?n=i+Ht:e&&i-n>=Ht?n=i-Ht:!e&&i>n?n=i+(Ht-oc(i-n)):e&&i1&&(i||(h+=Pe(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],v=a[2],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,k=b;hc[0]=S,hc[1]=k,lc(hc,Boolean(a[6])),S=hc[0],k=hc[1];const A=S,M=k-S,w=!!(1-(a[6]?0:1)),T=(s-m)*_/_+m;switch(f){case jo.M:u=m,p=v,c=u,d=p;break;case jo.L:if(i){if(Jh(c,d,m,v,e,s,n))return!0}else h+=Pe(c,d,m,v,s,n)||0;c=m,d=v;break;case jo.C:if(i){if(qh(c,d,m,v,_,y,b,x,e,s,n))return!0}else h+=nc(c,d,m,v,_,y,b,x,s,n)||0;c=b,d=x;break;case jo.Q:if(i){if(Kh(c,d,m,v,_,y,e,s,n))return!0}else h+=rc(c,d,m,v,_,y,s,n)||0;c=_,d=y;break;case jo.A:if(o=Math.cos(A)*_+m,l=Math.sin(A)*_+v,g?(u=o,p=l):h+=Pe(c,d,o,l,s,n),i){if(Zh(m,v,_,A,A+M,w,e,T,n))return!0}else h+=ac(m,v,_,A,A+M,w,T,n);c=Math.cos(A+M)*_+m,d=Math.sin(A+M)*_+v;break;case jo.R:if(u=c=m,p=d=v,o=u+_,l=p+y,i){if(Jh(u,p,o,p,e,s,n)||Jh(o,p,o,l,e,s,n)||Jh(o,l,u,l,e,s,n)||Jh(u,l,u,p,e,s,n))return!0}else h+=Pe(o,p,o,l,s,n),h+=Pe(u,l,u,p,s,n);break;case jo.Z:if(i){if(Jh(c,d,u,p,e,s,n))return!0}else h+=Pe(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},pc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const gc=Symbol.for("VWindow"),fc=Symbol.for("WindowHandlerContribution");let mc=class extends Ao{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(){super(),this.hooks={onChange:new mo(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(yo.getNamed(fc,t.env).configure(this,t),this.actived=!0)},this._uid=Ia.GenAutoIncrementId(),this.global=xo.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}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.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}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&&ut(this.width,t.width())&&ut(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)}};mc=uc([$a(),pc("design:paramtypes",[])],mc);var vc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},yc=function(t,e){return function(i,s){e(i,s,t)}};let bc=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=xo.global,this._textMeasureMap=new Map,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}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||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=dc.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="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:Kl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Le(Object.assign({defaultFontParams:{fontFamily:Kl.fontFamily,fontSize:Kl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Le.ALPHABET_CHAR_SET+Le.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=yo.get(gc),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 xc;bc=vc([$a(),yc(0,Ya(co)),yc(0,Ka(Rh)),_c("design:paramtypes",[Object])],bc),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(xc||(xc={}));const Sc=new Ne;let kc=class{constructor(){this.matrix=new Ne}init(t){return this.mode=xc.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=xc.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Sc.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(Sc.a,Sc.b,Sc.c,Sc.d,Sc.e,Sc.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Sc.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(Sc.a,Sc.b,Sc.c,Sc.d,Sc.e,Sc.f),this}scale(t,e,i){return this.mode===xc.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===xc.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Sc.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Sc.a,Sc.b,Sc.c,Sc.d,Sc.e,Sc.f),this}translate(t,e){return this.mode===xc.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===xc.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};kc=vc([$a(),_c("design:paramtypes",[])],kc);const Ac={arc:Ql,area:th,circle:eh,line:nh,path:rh,symbol:hh,text:ch,rect:lh,polygon:ah,star:oh,richtext:dh,richtextIcon:ph,image:uh,group:ih,glyph:sh},Mc=Object.keys(Ac);function wc(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Tc={arc:Object.assign({},Ac.arc),area:Object.assign({},Ac.area),circle:Object.assign({},Ac.circle),line:Object.assign({},Ac.line),path:Object.assign({},Ac.path),symbol:Object.assign({},Ac.symbol),text:Object.assign({},Ac.text),rect:Object.assign({},Ac.rect),polygon:Object.assign({},Ac.polygon),star:Object.assign({},Ac.star),richtext:Object.assign({},Ac.richtext),richtextIcon:Object.assign({},Ac.richtextIcon),image:Object.assign({},Ac.image),group:Object.assign({},Ac.group),glyph:Object.assign({},Ac.glyph)};class Cc{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Mc.forEach((t=>{this._defaultTheme[t]=Object.create(Tc[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,i=!1){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;Mc.forEach((s=>{const n=Object.create(Tc[s]);t&&t[s]&&wc(n,t[s]),i[s]&&wc(n,i[s]),e[s]&&wc(n,e[s]),this.combinedTheme[s]=n})),e.common&&Mc.forEach((t=>{wc(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 Bc=new Cc;function Ec(t,e){return t.glyphHost?Ec(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)):Bc.getTheme()}return null}(t)||t.attachedThemeGraphic&&Ec(t.attachedThemeGraphic)||Bc.getTheme()}var Pc=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 Rc extends o{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=Ia.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){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,e=!1){return Pc(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,e=!0){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,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)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===t||t===e)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===t)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,e=!1){let 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,e=!1){let 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,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Lc))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(jc(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 Lc))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=jc(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 Lc))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=jc(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 Lc))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=jc(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 Lc))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=zc.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(jc(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(jc(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,jc(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(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 Lc))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"):jc(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 Dc))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=zc.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.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),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 Hc(s,{clickInterval:a,supportsTouchEvents:o}),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 Lc,this.rootWheelEvent=new Dc,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&&v(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.addEventListener("pointermove",this.onPointerMove,!0),t.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.addEventListener("mousemove",this.onPointerMove,!0),t.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.removeEventListener("pointermove",this.onPointerMove,!0),t.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.removeEventListener("mousemove",this.onPointerMove,!0),t.removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}class Uc{static GetImage(t,e){var i;const s=Uc.cache.get(t);s?"fail"===s.loadState?xo.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):Uc.loadImage(t,e)}static GetSvg(t,e){var i;let s=Uc.cache.get(t);s?"fail"===s.loadState?xo.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"},Uc.cache.set(t,s),s.dataPromise=xo.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.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Uc.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Uc.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=xo.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=xo.global.loadBlob(t):"json"===e&&(i.dataPromise=xo.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Uc.isLoading&&Uc.toLoadAueue.length){Uc.isLoading=!0;const t=Uc.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Uc.cache.set(i,n),n.dataPromise=xo.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))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Uc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Uc.loading()})).catch((t=>{console.error(t),Uc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Uc.loading()}))}}),0)}static loadImage(t,e){const i=Gc(t,Uc.toLoadAueue);if(-1!==i)return Uc.toLoadAueue[i].marks.push(e),void Uc.loading();Uc.toLoadAueue.push({url:t,marks:[e]}),Uc.loading()}static improveImageLoading(t){const e=Gc(t,Uc.toLoadAueue);if(-1!==e){const t=Uc.toLoadAueue.splice(e,1);Uc.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Gc(t,e){for(let i=0;it?_(t)?0===t.length?0:1===t.length?t[0]:2===t.length?($c[0]=t[0],$c[2]=t[0],$c[1]=t[1],$c[3]=t[1],$c):t:t:0,qc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Zc=[1,2,3,0,1,2,3,0];function Jc(t,e,i,s){for(;t>=Ht;)t-=Ht;for(;t<0;)t+=Ht;for(;t>e;)e+=Ht;qc[0].x=i,qc[1].y=i,qc[2].x=-i,qc[3].y=-i;const n=Math.ceil(t/zt)%4,r=Math.ceil(e/zt)%4;if(s.add(Wt(t)*i,Yt(t)*i),s.add(Wt(e)*i,Yt(e)*i),n!==r||e-t>Ft){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new se(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new se(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{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)}}id.TimeOut=1e3/60;const sd=new id,nd=(t,e)=>{const i=((t,e)=>v(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};class rd{bounds(t,e){if(x(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}parseSize(t){return x(t)?t:Math.min(t[0],t[1])}}function ad(t,e,i,s,n){return n?t.arc(i,s,e,0,jt,!1,n):t.arc(i,s,e,0,jt),!1}var od=new class extends rd{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 ad(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return ad(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(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 ld=new class extends rd{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,this.parseSize(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,this.parseSize(e)/6,i,s,n,r)}};function hd(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 cd=new class extends rd{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 hd(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return hd(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return hd(t,this.parseSize(e)/2+n,i,s,r)}};function dd(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var ud=new class extends rd{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return dd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return dd(t,this.parseSize(e)/2+n,i,s)}};function pd(t,e,i,s,n=0){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}class gd extends rd{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 pd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return pd(t,this.parseSize(e)/2,i,s,n)}}var fd=new gd;var md=new class extends gd{constructor(){super(...arguments),this.type="triangle"}};const vd=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),_d=Math.sin(jt/10)*vd,yd=-Math.cos(jt/10)*vd;function bd(t,e,i,s){const n=_d*e,r=yd*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=jt*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 xd=new class extends rd{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 bd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return bd(t,this.parseSize(e)/2+n,i,s)}};const Sd=Xt(3);function kd(t,e,i,s){const n=e,r=n/Sd,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 Ad=new class extends rd{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 kd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return kd(t,this.parseSize(e)/2+n,i,s)}};function Md(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 wd=new class extends rd{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Md(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Md(t,this.parseSize(e)/2+n,i,s)}};function Td(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Cd=new class extends rd{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Td(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Td(t,this.parseSize(e)/2+n,i,s)}};const Bd=-.5,Ed=Xt(3)/2,Pd=1/Xt(12);function Rd(t,e,i,s){const n=e/2,r=e*Pd,a=n,o=e*Pd+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(Bd*n-Ed*r+i,Ed*n+Bd*r+s),t.lineTo(Bd*a-Ed*o+i,Ed*a+Bd*o+s),t.lineTo(Bd*l-Ed*h+i,Ed*l+Bd*h+s),t.lineTo(Bd*n+Ed*r+i,Bd*r-Ed*n+s),t.lineTo(Bd*a+Ed*o+i,Bd*o-Ed*a+s),t.lineTo(Bd*l+Ed*h+i,Bd*h-Ed*l+s),t.closePath(),!1}var Od=new class extends rd{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 Rd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Rd(t,this.parseSize(e)/2+n,i,s)}};function Id(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}var Ld=new class extends rd{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 Id(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Id(t,this.parseSize(e)/2,i,s,n)}};function Dd(t,e,i,s,n=0){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}var Fd=new class extends rd{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 Dd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Dd(t,this.parseSize(e)/2,i,s,n)}};function zd(t,e,i,s,n=0){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}var jd=new class extends rd{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 zd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return zd(t,this.parseSize(e)/2,i,s,n)}};const Hd=Xt(3);function Vd(t,e,i,s){const n=e*Hd;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var Nd=new class extends rd{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Vd(t,this.parseSize(e)/2/Hd,i,s)}drawOffset(t,e,i,s,n){return Vd(t,this.parseSize(e)/2/Hd+n,i,s)}};function Wd(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 Ud=new class extends rd{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 Wd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Wd(t,this.parseSize(e)/4+n,i,s)}};function Gd(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 Yd=new class extends rd{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 Gd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Gd(t,this.parseSize(e)/4+n,i,s)}};function Xd(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 $d=new class extends rd{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 Xd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Xd(t,this.parseSize(e)/4+n,i,s)}};function Kd(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 qd=new class extends rd{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 Kd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Kd(t,this.parseSize(e)/4+n,i,s)}};function Zd(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var Jd=new class extends rd{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return Zd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Zd(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function Qd(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var tu=new class extends rd{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return Qd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Qd(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function eu(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 iu=new class extends rd{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 eu(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return eu(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function su(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function nu(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var ru=new class extends rd{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 x(e)?nu(t,e,i,s):su(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){x(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return x(e)?nu(t,e+2*n,i,s):su(t,[e[0]+2*n,e[1]+2*n],i,s)}};const au=new He;class ou{constructor(t,e,i=!1){this.pathStr="",this.type=t,_(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),el(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(el(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return x(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{au.x1=i.bounds.x1*t,au.y1=i.bounds.y1*t,au.x2=i.bounds.x2*t,au.y2=i.bounds.y2*t,e.union(au)}))}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 lu={};[od,ld,cd,ud,Nd,md,xd,Ad,wd,Cd,Od,Ld,Fd,fd,jd,Ud,Yd,$d,qd,ru,Jd,tu,iu].forEach((t=>{lu[t.type]=t}));const hu={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"};class cu{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 du(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function uu(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",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=uu(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=du(t,"--\x3e",r+4,"Comment is not closed.");else{const a=uu(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 cu(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 cu(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 fu(t,e){return mu(t)}function mu(t,e){const i={};for(let e=0;eMu.set(t,!0)));const wu=new Map;function Tu(t){if(Mu.has(t))return!0;if(wu.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>wu.set(t,!0)));const Cu=ku(),Bu=ku(),Eu=ku(),Pu=ku(),Ru=ku(),Ou=ku(),Iu=ku(),Lu=ku(),Du=ku(),Fu=ku();ku();const zu=ku();ku();const ju=ku();ku();const Hu=ku(),Vu=ku(),Nu=Symbol.for("GraphicService"),Wu=Symbol.for("GraphicCreator"),Uu={"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"},Gu=Object.keys(Uu),Yu={duration:200,easing:"cubicOut"};function Xu(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}function $u(t,e,i){const s=i[0],n=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]*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],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*s+c*n+g*r+e[12],t[13]=o*s+d*n+f*r+e[13],t[14]=l*s+u*n+m*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function Ku(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 qu(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],f=e[12],m=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*f,t[1]=y*n+b*l+x*u+S*m,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*f,t[5]=y*n+b*l+x*u+S*m,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*f,t[9]=y*n+b*l+x*u+S*m,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*f,t[13]=y*n+b*l+x*u+S*m,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function Zu(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 Ju{constructor(){this.pools=[]}static identity(t){return Xu(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 Ju.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},ip=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const sp=new Ne(1,0,0,1,0,0),np={x:0,y:0};let rp=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new Ne(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ne(1,0,0,1,0,0),this.path=new Nl,this._clearMatrix=new Ne(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Qu.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ne(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(Qu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Qu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){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,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=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(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){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},np),function(t,e,i){return cc(t,0,!1,e,i)}(this.path.commandList,np.x,np.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},np);const i=mh(this,this.lineWidth,this.dpr);return function(t,e,i,s){return cc(t,e,!0,i,s)}(this.path.commandList,i,np.x,np.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(t=!0,e=this.dpr){this.setTransformFromMatrix(sp,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Qu.free(t))),this.stack.length=0}};rp=ep([$a(),ip("design:paramtypes",[Object,Number])],rp);const ap={WIDTH:500,HEIGHT:500,DPR:1};class op{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}set nativeCanvas(t){this._nativeCanvas=t}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=ap.WIDTH,height:n=ap.HEIGHT,dpr:r=ap.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(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var lp;op.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(lp||(lp={}));class hp{static Get(t,e=lp.Color1,i=[0,0,0,1]){if(e===lp.Color1){const e=hp.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ti.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];hp.store1[t]=e,hp.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=hp.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ti.parseColorString(t);return n&&(hp.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],hp.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===lp.Color1){if(hp.store1[t])return;hp.store1[t]=i,hp.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(hp.store255[t])return;hp.store255[t]=i,hp.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function cp(t,e=!1){return Array.isArray(t)&&x(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 dp(t,e,i,s,n){return Array.isArray(t)&&!x(t[0])||Array.isArray(e)&&!x(e[0])?new Array(4).fill(0).map(((n,r)=>{var a,o;return up(_(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,_(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):up(t,e,i,s,n)}function up(t,e,i,s,n){if(!t||!e)return t&&cp(t)||e&&cp(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=hp.Get(t,lp.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=hp.Get(e,lp.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:cp(a)})))});return o?dp(r,l,i,s,n):dp(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:mp(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:mp(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:mp(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),cp(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)}function pp(t,e,i){return`rgba(${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})`}hp.store255={},hp.store1={};const gp=[0,0,0,0],fp=[0,0,0,0];function mp(t,e,i){return hp.Get(t,lp.Color255,gp),hp.Get(e,lp.Color255,fp),`rgba(${Math.round(gp[0]+(fp[0]-gp[0])*i)},${Math.round(gp[1]+(fp[1]-gp[1])*i)},${Math.round(gp[2]+(fp[2]-gp[2])*i)},${gp[3]+(fp[3]-gp[3])*i})`}class vp{static GetCanvas(){try{return vp.canvas||(vp.canvas=xo.global.createCanvas({})),vp.canvas}catch(t){return null}}static GetCtx(){if(!vp.ctx){const t=vp.GetCanvas();vp.ctx=t.getContext("2d")}return vp.ctx}}class _p extends We{static getInstance(){return _p._instance||(_p._instance=new _p),_p._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=vp.GetCanvas(),s=vp.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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new _p(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class yp{static GetSize(t){for(let e=0;e=t)return yp.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=yp.GenKey(t,e,i,s,n),l=yp.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=yp.GenKey(t,e,i,s,n);yp.cache[l]?yp.cache[l].push({width:a,height:o,pattern:r}):yp.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}yp.cache={},yp.ImageSize=[20,40,80,160,320,640,1280,2560];const bp=new He,xp=new Ne;new He;const Sp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],kp=["x","y"],Ap=["scaleX","scaleY"],Mp=["angle"],wp=new se,Tp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Cp extends Rc{static mixin(t){const e=Object.keys(t);for(let i=0;i10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=lu[t];if(e)return e;if(e=Cp.userSymbolMap[t],e)return e;if(!0===((i=t=hu[t]||t).startsWith("{const e=(new Nl).fromString(t.d),i={};Gu.forEach((e=>{t[e]&&(i[Uu[e]]=t[e])})),n.push({path:e,attribute:i}),bp.union(e.bounds)}));const r=bp.width(),a=bp.height(),o=1/Ut(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new ou(t,n,!0);return Cp.userSymbolMap[t]=l,l}var i;const s=(new Nl).fromString(t),n=s.bounds.width(),r=s.bounds.height(),a=1/Ut(n,r);s.transform(0,0,a,a);const o=new ou(t,s);return Cp.userSymbolMap[t]=o,o}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,s=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:n=e.boundsPadding}=i,r=Kc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new Lo(t);return el(e.commandList,i,0,0),!0}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(t=!0){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(t=!0){return this._transMatrix||(this._transMatrix=new Ne),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&Yo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&Yo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}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===Xo.GLOBAL){const i=new se(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){this.setAttributes(t,e,i),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||s)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,i){t&&((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,e=!1,i){const s=Object.keys(t);for(let e=0;e{i[e]?(o||(o={}),o[e]=t[e]):a[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(r=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==r?r:Yu;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:a,duration:l.duration,easing:l.easing}}]),o&&this.setAttributesAndPreventAnimate(o,!1,{type:$o.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t)}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:$o.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{type:$o.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(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,i;const s=this.attribute[t];return this.animates&&this.animates.size?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=s?s:null===(i=this.finalAttribute)||void 0===i?void 0:i[t]}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){const i=_(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);s.length!==this.currentStates.length&&this.useStates(s,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;this.stateSort&&(t=t.sort(this.stateSort));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,i){const s=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Gl.x,y:e=Gl.y,scaleX:i=Gl.scaleX,scaleY:s=Gl.scaleY,angle:n=Gl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(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=Wt(a),f=Yt(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const _=m-i,y=v-s,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,k=d*g-h*f;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*k,t.e=u+l*m+c*v-b*_-S*y,t.f=p+h*m+d*v-x*_-k*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,!0),xo.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Gl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=xp.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.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:$o.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:xo.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),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 v(t,!0)?this.pathProxy=(new Nl).fromString(t):this.pathProxy=new Nl,this.pathProxy}loadImage(t,e=!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(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",this.stopAnimates(),xo.graphicService.onRelease(this),super.release()}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new Fc(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)}}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||xo.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new rp(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}var Bp;Cp.userSymbolMap={},Cp.mixin(Vc),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Bp||(Bp={}));let Ep=class t extends Cp{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Ou,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 Cc),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Cc)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===Xo.GLOBAL){const i=new se(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;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Gl.x,y:e=Gl.y,dx:i=Gl.dx,dy:s=Gl.dy,scaleX:n=Gl.scaleX,scaleY:r=Gl.scaleY,angle:a=Gl.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()}getGraphicTheme(){return Ec(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return xo.graphicService.updateTempAABBBounds(i),xo.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=Yo.CLEAR_BOUNDS,this._childUpdateTag&=Yo.CLEAR_BOUNDS}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(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().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),this.getGraphicService().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(t=!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=xo.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}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}};function Pp(t){return new Ep(t)}Ep.NOWORK_ANIMATE_ATTR=Tp;class Rp extends Ep{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 Cc,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!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=>{xo.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=>{xo.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 Op=Symbol.for("TransformUtil"),Ip=Symbol.for("GraphicUtil"),Lp=Symbol.for("LayerService"),Dp=Symbol.for("StaticLayerHandlerContribution"),Fp=Symbol.for("DynamicLayerHandlerContribution"),zp=Symbol.for("VirtualLayerHandlerContribution");var jp,Hp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Np=jp=class{static GenerateLayerId(){return`${jp.idprefix}_${jp.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=xo.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?yo.get(Dp):"dynamic"===t?yo.get(Fp):yo.get(zp),e}createLayer(t,e={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 Rp(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:jp.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)}};Np.idprefix="visactor_layer",Np.prefix_count=0,Np=jp=Hp([$a(),Vp("design:paramtypes",[])],Np);var Wp=new La((t=>{t(_o).to(Bo).inSingletonScope(),t(gc).to(mc),t(Ip).to(bc).inSingletonScope(),t(Op).to(kc).inSingletonScope(),t(Lp).to(Np).inSingletonScope()}));function Up(t,e){return!(!t&&!e)}function Gp(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Yp(t,e,i){return i&&t*e>0}function Xp(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function $p(t,e){return t*e>0}function Kp(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function qp(t,e,i,s,n,r,a){const o=t-i,l=e-s,h=(a?r:-r)/Math.sqrt(o*o+l*l),c=h*l,d=-h*o,u=t+c,p=e+d,g=i+c,f=s+d,m=(u+g)/2,v=(p+f)/2,_=g-u,y=f-p,b=_*_+y*y,x=n-r,S=u*f-g*p,k=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let A=(S*y-_*k)/b,M=(-S*_-y*k)/b;const w=(S*y+_*k)/b,T=(-S*_+y*k)/b,C=A-m,B=M-v,E=w-m,P=T-v;return C*C+B*B>E*E+P*P&&(A=w,M=T),{cx:A,cy:M,x01:-c,y01:-d,x11:A*(n/x-1),y11:M*(n/x-1)}}function Zp(t,e,i,s,n){const r=Vt(i-e),a=t.getParsedCornerRadius(),o=_(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,y=Math.max(f,g),b=Math.max(m,v);let x=y,S=b;const k=n*Wt(c),A=n*Yt(c),M=s*Wt(u),w=s*Yt(u);let T,C,B,E;if((b>Dt||y>Dt)&&(T=n*Wt(d),C=n*Yt(d),B=s*Wt(p),E=s*Yt(p),r1?0:P<-1?Ft:Math.acos(P))/2),l=Xt(t[0]*t[0]+t[1]*t[1]);S=Gt(b,(s-l)/(o-1)),x=Gt(y,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:k,yors:A,xirs:B,yirs:E,xore:T,yore:C,xire:M,yire:w,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:y,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function Jp(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(n=Ht-Dt)e.moveTo(i+n*Wt(o),s+n*Yt(o)),e.arc(i,s,n,o,l,!c),r>Dt&&(e.moveTo(i+r*Wt(l),s+r*Yt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:k,outerStartAngle:A,outerEndAngle:M,limitedIcr:w,innerDeltaAngle:T,innerEndAngle:C,innerStartAngle:B,innerCornerRadiusStart:E,innerCornerRadiusEnd:P,maxInnerCornerRadius:R}=Zp(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>Dt){const t=Gt(v,m),r=Gt(_,m),o=qp(g,f,u,p,n,t,Number(c)),l=qp(b,x,S,k,n,r,Number(c));m0&&e.arc(i+o.cx,s+o.cy,t,Nt(o.y01,o.x01),Nt(o.y11,o.x11),!c),e.arc(i,s,n,Nt(o.cy+o.y11,o.cx+o.x11),Nt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Nt(l.y11,l.x11),Nt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Wt(Nt(l.y01,l.x01)),s+l.cy+r*Yt(Nt(l.y01,l.x01))):e.moveTo(i+b,s+n*Yt(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,A,M,!c)):e.moveTo(i+n*Wt(M),s+n*Yt(M));if(!(r>Dt)||T<.001)!a||a[1]?e.lineTo(i+S,s+k):e.moveTo(i+S,s+k),d=!0;else if(w>Dt){const t=Gt(E,w),n=Gt(P,w),o=qp(S,k,b,x,r,-n,Number(c)),l=qp(u,p,g,f,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),w0&&e.arc(i+o.cx,s+o.cy,n,Nt(o.y01,o.x01),Nt(o.y11,o.x11),!c),e.arc(i,s,r,Nt(o.cy+o.y11,o.cx+o.x11),Nt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Nt(l.y11,l.x11),Nt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Wt(Nt(l.y01,l.x01)),s+l.cy+t*Yt(Nt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+k):e.moveTo(i+S,s+k),!a||a[2]?e.arc(i,s,r,C,B,c):e.moveTo(i+r*Wt(B),s+r*Yt(B))}return a?a[3]&&e.lineTo(i+n*Wt(o),s+n*Yt(o)):e.closePath(),d}const Qp=Symbol.for("ArcRenderContribution"),tg=Symbol.for("AreaRenderContribution"),eg=Symbol.for("CircleRenderContribution"),ig=Symbol.for("GroupRenderContribution"),sg=Symbol.for("ImageRenderContribution"),ng=Symbol.for("PathRenderContribution"),rg=Symbol.for("PolygonRenderContribution"),ag=Symbol.for("RectRenderContribution"),og=Symbol.for("SymbolRenderContribution"),lg=Symbol.for("TextRenderContribution"),hg=Symbol.for("InteractiveSubRenderContribution");function cg(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function dg(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}var ug=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},gg=function(t,e){return function(i,s){e(i,s,t)}};function fg(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:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:v}=e.attribute,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(s=m[2])&&void 0!==s?s:0}if(Xu(t),$u(t,t,[n+o,r+l,a+h]),$u(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),$u(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]),f){const i=tp.allocate(),s=[0,0];if(v){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=m[1]}$u(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,f),$u(i,i,[-s[0],-s[1],0]),qu(t,t,i)}}let mg=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new mo(["graphic"]),onSetStage:new mo(["graphic","stage"]),onRemove:new mo(["graphic"]),onRelease:new mo(["graphic"]),onAddIncremental:new mo(["graphic","group","stage"]),onClearIncremental:new mo(["graphic","group","stage"]),beforeUpdateAABBBounds:new mo(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new mo(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new mo(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new He,this.tempAABBBounds2=new He}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)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}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 el(i.commandList,s,0,0),!0}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=x(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=dg(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=x(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=cg(n,e);i.set(s,i.y1,s+e,i.y2)}}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){xu(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;xu(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&&ze(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};mg=ug([$a(),gg(0,Ya(Wu)),pg("design:paramtypes",[Object])],mg);const vg=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},_g=["radius","startAngle","endAngle",...Sp];class yg extends Cp{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=Pu}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)}getGraphicTheme(){return Ec(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=xo.graphicService.updateTempAABBBounds(i);return vg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,xo.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Ht-Dt?i.set(-r,-r,r,r):Jc(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,_g)}needUpdateTag(t){return super.needUpdateTag(t,_g)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Nl,s.arc(0,0,r,a,o),s}clone(){return new yg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return yg.NOWORK_ANIMATE_ATTR}}function bg(t){return new yg(t)}yg.NOWORK_ANIMATE_ATTR=Tp;class xg{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Eo.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,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;a{t+=e.str})),(Array.isArray(r)?r.join(""):r).toString()!==t}return"vertical"===s.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==s.text.toString():null!=this.clipedText&&this.clipedText!==s.text.toString()}get multilineLayout(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=Vu,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}getGraphicTheme(){return Ec(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new kg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Ae(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=xo.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){xu(n,o/Math.abs(r+a),!0,l),i.union(n)}return xo.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||xo.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,ze(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:_=s.ignoreBuf,keepCenterInLine:y=s.keepCenterInLine}=n,b=_?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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(f/2),this._AABBBounds}const S=xo.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),k=new xg(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:y}),{bbox:A}=k;return this.cache.layoutData=k,this.clearUpdateShapeTag(),this._AABBBounds.set(A.xOffset,A.yOffset,A.xOffset+A.width,A.yOffset+A.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{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,measureMode:v=r.measureMode,suffixPosition:y=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,k=m?0:this.guessLineHeightBuf(h),A=this.getLineHeight(this.attribute,r,k);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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 M=xo.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),w={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:A},T=new xg(a,w,M),C=_(t)?t.map((t=>t.toString())):[t.toString()],B=[],E=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/A),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),E[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Ut(e,a)}));const t=cg(_,a),e=this.cache.verticalList.length*v,i=dg(y,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>function(t){const e=[];let i=0,s="";for(let n=0;n{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===Au.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))})),this.cache.verticalList=b,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Ut(e,a)}));const x=cg(_,a),S=this.cache.verticalList.length*v,k=dg(y,S,d);return this._AABBBounds.set(k,x,k+S,x+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=nd(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=Sg){return super.needUpdateTags(t,e)}needUpdateTag(t,e=Sg){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new kg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return kg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return kg.baselineMapAlign}getAlignMapBaseline(){return kg.alignMapBaseline}}function Ag(t){return new kg(t)}kg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Tp),kg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},kg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Mg=["symbolType","size",...Sp];let wg=class t extends Cp{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=Hu}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}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{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return Ec(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=xo.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;xu(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){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){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,Mg)}needUpdateTag(t){return super.needUpdateTag(t,Mg)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new Nl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Nl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Tg(t){return new wg(t)}wg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Tp);const Cg=["segments","points","curveType","curveTension",...Sp];let Bg=class t extends Cp{constructor(t={}){super(t),this.type="line",this.numberType=Lu}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=td(i,s,e))}getGraphicTheme(){return Ec(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),xo.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Cg)}needUpdateTag(t){return super.needUpdateTag(t,Cg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Nl;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Eg(t){return new Bg(t)}Bg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Tp);const Pg=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=d(t.width)?t.x1-t.x:t.width,i=d(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}},Rg=["width","x1","y1","height","cornerRadius",...Sp];class Og extends Cp{constructor(t){super(t),this.type="rect",this.numberType=zu}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Ec(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=xo.graphicService.updateTempAABBBounds(i);return vg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,xo.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Rg)}needUpdateTag(t){return super.needUpdateTag(t,Rg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=Pg(e);return t=new Nl,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new Og(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Og.NOWORK_ANIMATE_ATTR}}function Ig(t){return new Og(t)}Og.NOWORK_ANIMATE_ATTR=Tp;class Lg extends Cp{constructor(t){super(t),this.type="glyph",this.numberType=Ru,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,e=!1,i){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}getGraphicTheme(){return Ec(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}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(),this.stateSort&&(t=t.sort(this.stateSort));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.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Lg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Lg.NOWORK_ANIMATE_ATTR}}function Dg(t){return new Lg(t)}Lg.NOWORK_ANIMATE_ATTR=Tp;class Fg{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=_h[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}}}function zg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class jg{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=nd(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Ch(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||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,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r: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}=Ch(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Mh(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Ch(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=zg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Mh(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Ch(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=zg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=zg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=zg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=zg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&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=Mh(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Ch(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const Hg=["width","height","image",...Sp];class Vg extends Cp{constructor(t){super(t),this.type="image",this.numberType=Iu,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}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()})),this.addUpdateBoundTag()}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)}getGraphicTheme(){return Ec(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=xo.graphicService.updateTempAABBBounds(i);return vg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,xo.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return uh[t]}needUpdateTags(t){return super.needUpdateTags(t,Hg)}needUpdateTag(t){return super.needUpdateTag(t,Hg)}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({image:1,repeatX:1,repeatY:1},Tp);class Wg extends Vg{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=Kc(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=Kc(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=uh.width,height:e=uh.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 Ug{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 Wg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=_h[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof jg){const e=kh.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,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Wg)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Ch(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Wg)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Wg)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||bh;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,Ah(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||yh;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?vh(t,s,{AABBBounds:i}):s,Ah(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Wg)break;const{width:n}=Ch(t,s.character,s.ascentDescentMode),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.forEach(((t,e)=>{i+=t instanceof Wg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Gg{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=_h[this.direction]}store(t){if(t instanceof Wg){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 Ug(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,e=!1){t instanceof Wg?"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||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Mh(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new jg(i,t.newLine,t.character,t.ascentDescentMode),new jg(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Yg=!1;try{Yg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Yg=!1}const Xg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...Sp];class $g extends Cp{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=ju,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:dh.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:dh.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:dh.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:dh.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:dh.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:dh.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:dh.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:dh.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Ec(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&v(t.text)&&$g.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&v(t.text)&&$g.splitText(t.text).length>1)))}static splitText(t){if(Yg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=$g.splitText(t.text.toString());if(v(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),xo.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||xo.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,xo.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Xg)}needUpdateTag(t){return super.needUpdateTag(t,Xg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!$g.AllSingleCharacter(_)&&(_=$g.TransformTextConfig2SingleCharacter(_),this.attribute.textConfig=_);const y=[],b=null!=t?t:_;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,y.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(x(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,k="number"==typeof s&&Number.isFinite(s)&&s>0,A="number"==typeof n&&Number.isFinite(n)&&n>0&&(!S||n<=i),M="number"==typeof r&&Number.isFinite(r)&&r>0&&(!k||r<=s),w=new Fg(0,0,(A?n:S?i:0)||0,(M?r:k?s:0)||0,a,o,l,h,c,d||"horizontal",!A&&S,!M&&k,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),T=new Gg(w);if(T.newLine=v,p){let t=0,e=!1;for(let i=0;i{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=w}clone(){return new $g(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(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())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return $g.NOWORK_ANIMATE_ATTR}}function Kg(t){return new $g(t)}$g.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Tp);const qg=["path","customPath",...Sp];class Zg extends Cp{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=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Nl?e.path:(d(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Nl?this.cache:t.path)}getGraphicTheme(){return Ec(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=xo.graphicService.updateTempAABBBounds(i);vg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;v(t.path,!0)?this.cache=(new Nl).fromString(t.path):t.customPath&&(this.cache=new Nl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,qg)}needUpdateTag(t){return super.needUpdateTag(t,qg)}toCustomPath(){return(new Nl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Zg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Zg.NOWORK_ANIMATE_ATTR}}function Jg(t){return new Zg(t)}Zg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Tp);const Qg=["segments","points","curveType","curveTension",...Sp];class tf extends Cp{constructor(t){super(t),this.type="area",this.numberType=Eu}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}getGraphicTheme(){return Ec(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),xo.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),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}_interpolate(t,e,i,s,n){"points"===t&&(n.points=td(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Qg)}needUpdateTag(t){return super.needUpdateTag(t,Qg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Nl;const 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 tf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return tf.NOWORK_ANIMATE_ATTR}}function ef(t){return new tf(t)}tf.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Tp);const sf=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Sp];class nf extends Cp{constructor(t){super(t),this.type="arc",this.numberType=Cu}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=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(x(t,!0)?t:a*parseFloat(t)/100,a/2);if(_(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();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=oe(e),i=e+r,s&&Vt(r)Dt&&o>Dt)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=this.getGraphicTheme(),{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=Xt(a*a+o*o)}=this.attribute,h=Vt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>Dt&&l>Dt){const i=e>t?1:-1;let s=Kt(Number(l)/o*Yt(g)),n=Kt(Number(l)/a*Yt(g));return(f-=2*s)>Dt?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>Dt?(n*=i,c+=n,d-=n):(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}}getGraphicTheme(){return Ec(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=xo.graphicService.updateTempAABBBounds(i);vg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=Dt?i.set(0,0,0,0):Math.abs(o-l)>Ht-Dt?i.set(-s,-s,s,s):(Jc(l,o,s,i),Jc(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,sf)}needUpdateTag(t){return super.needUpdateTag(t,sf)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Vt(o-a),d=o>a;if(h=Ht-Dt)n.moveTo(0+h*Wt(a),0+h*Yt(a)),n.arc(0,0,h,a,o,!d),l>Dt&&(n.moveTo(0+l*Wt(o),0+l*Yt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Wt(a),e=h*Yt(a),i=l*Wt(o),s=l*Yt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new nf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return nf.NOWORK_ANIMATE_ATTR}}function rf(t){return new nf(t)}nf.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Tp);const af=["points","cornerRadius",...Sp];class of extends Cp{constructor(t){super(t),this.type="polygon",this.numberType=Fu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Ec(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),xo.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=td(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,af)}needUpdateTag(t){return super.needUpdateTag(t,af)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Nl,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new of(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return of.NOWORK_ANIMATE_ATTR}}function lf(t){return new of(t)}of.NOWORK_ANIMATE_ATTR=Tp;class hf extends Ep{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!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 cf(t){return new hf(t)}const df=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 uf,pf;function gf(t){return uf||(uf=df.CreateGraphic("text",{})),uf.initAttributes(t),uf.AABBBounds}var ff=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},vf=function(t,e){return function(i,s){e(i,s,t)}};class _f{constructor(){this.time=Zo.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:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit,backgroundKeepAspectRatio:y=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:k=l.backgroundClip}=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=Ec(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}k&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:_,backgroundKeepAspectRatio:y,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s){const{backgroundMode:n,backgroundFit:r,backgroundKeepAspectRatio:a,backgroundScale:o=1,backgroundOffsetX:l=0,backgroundOffsetY:h=0}=s,c=i.width(),d=i.height();let u=c,p=d;if("no-repeat"===n)if(r)if(a){const s=Math.max(c/e.width,d/e.height);t.drawImage(e,i.x1+l,i.y1+h,e.width*s*o,e.height*s*o)}else t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const s=e.width*o,n=e.height*o;t.drawImage(e,i.x1+l,i.y1+h,s,n)}else{if(r&&"repeat"!==n&&(e.width||e.height)){const i=e.width,s=e.height;"repeat-x"===n?(u=i*(d/s),p=d):"repeat-y"===n&&(p=s*(c/i),u=c);const r=t.dpr,a=dc.allocate({width:u,height:p,dpr:r}),o=a.getContext("2d");o&&(o.inuse=!0,o.clearMatrix(),o.setTransformForCurrent(!0),o.clearRect(0,0,u,p),o.drawImage(e,0,0,u,p),e=a.nativeCanvas),dc.free(a)}const s=t.dpr,a=t.createPattern(e,n);a.setTransform&&a.setTransform(new DOMMatrix([1/s,0,0,1/s,0,0])),t.fillStyle=a,t.translate(i.x1,i.y1),t.fillRect(0,0,c,d),t.translate(-i.x1,-i.y1)}}}const yf=new _f;let bf=class{constructor(t){this.subRenderContribitions=t,this.time=Zo.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)}))}};bf=ff([$a(),vf(0,Ya(co)),vf(0,Ka(hg)),mf("design:paramtypes",[Object])],bf);const xf=new class{constructor(){this.time=Zo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),_=t.AABBBounds,y=null!==(p=t.attribute.width)&&void 0!==p?p:_.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:_.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[y,b],i+y/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const Sf=new class{constructor(){this.time=Zo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}};class kf{constructor(){this.time=Zo.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=dc.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])),dc.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,Ht),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:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h;const{textureRatio:c=r.textureRatio,textureOptions:d=null}=e.attribute;let u=this.textureMap.get(t);if(!u)switch(t){case"circle":u=this.createCirclePattern(o,l,a,i);break;case"diamond":u=this.createDiamondPattern(o,l,a,i);break;case"rect":u=this.createRectPattern(o,l,a,i);break;case"vertical-line":u=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":u=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":u=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":u=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":u=this.createGridPattern(o,l,a,i)}if(d&&d.dynamicTexture){const{gridConfig:u={},useNewCanvas:p}=d,g=e.AABBBounds;s=g.x1,n=g.y1;const f=i;let m;if(p){m=dc.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=m.getContext("2d");t.clearRect(0,0,g.width(),g.height()),s=0,n=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,s,n,r),f.clip();const v=g.width(),_=g.height(),y=l,b=o,x=u.columns?u.columns:Math.ceil(v/b),S=u.rows?u.rows:Math.ceil(_/b),k=u.gutterColumn?u.gutterColumn:2*y,A=u.gutterRow?u.gutterRow:2*y;this._tempSymbolGraphic||(this._tempSymbolGraphic=Tg({}));const M=u.columns?v/u.columns:b,w=u.rows?_/u.rows:b;this._tempSymbolGraphic.setAttributes({size:[M-k,w-A],symbolType:t});const T=this._tempSymbolGraphic.getParsedPath();for(let t=0;t{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:mh(e,o,e.dpr),c=o/T,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:T+u*h,innerRadius:w-u*h,startAngle:_-u*c,endAngle:y+u*c}),e.beginPath(),Jp(t,e,i,s,T+u*h,w-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/k,(S-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder"),t.setAttributes({outerRadius:T,innerRadius:w,startAngle:_,endAngle:y})}},wf=Af,Tf=yf;const Cf=new class{constructor(){this.time=Zo.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,f=p&&!1!==p.visible;if(!g&&!f)return;const{radius:m=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:k=l.scaleY,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:mh(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),f&&M(p,"innerBorder")}},Bf=Af,Ef=yf;const Pf=new class extends _f{constructor(){super(...arguments),this.time=Zo.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,backgroundKeepAspectRatio:f=l.backgroundKeepAspectRatio,backgroundScale:m=l.backgroundScale,backgroundOffsetX:v=l.backgroundOffsetX,backgroundOffsetY:_=l.backgroundOffsetY}=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,{backgroundMode:p,backgroundFit:g,backgroundKeepAspectRatio:f,backgroundScale:m,backgroundOffsetX:v,backgroundOffsetY:_}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Rf=Ft/2;function Of(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),x(r,!0))l=[r=Vt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Vt(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Vt(t[0]),i=Vt(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Vt(l[0]),l[1]=Vt(l[1]),l[2]=Vt(l[2]),l[3]=Vt(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],_=[c[0],c[1]+g[1]],y=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],S=[u[0]+g[3],u[1]],k=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!K(v,_)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Rf,0,!1)}if(o&&o[1]?o[1](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!K(y,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Rf,!1)}if(o&&o[2]?o[2](y[0],y[1],S[0],S[1]):t.lineTo(S[0],S[1]),!K(S,k)){const e=S[0],i=S[1]-g[3];o&&o[2]&&t.moveTo(S[0],S[1]),t.arc(e,i,g[3],Rf,Ft,!1)}if(o&&o[3]?o[3](k[0],k[1],m[0],m[1]):t.lineTo(m[0],m[1]),!K(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],Ft,Ft+Rf,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),o&&o[2]?o[2](y[0],y[1],S[0],S[1]):t.lineTo(S[0],S[1]),o&&o[2]?o[2](S[0],S[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}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};class Lf{constructor(){this.time=Zo.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,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:k=l.scaleY,x1:A,y1:M,keepStrokeScale:w=l.keepStrokeScale}=t.attribute;let{width:T,height:C}=t.attribute;T=(null!=T?T:A-i)||0,C=(null!=C?C:M-s)||0;const B=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=w?h:mh(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||_(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,T-o*g,C-o*g)):(e.beginPath(),Of(e,u,p,T-o*g,C-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&B(u,"outerBorder"),f&&B(p,"innerBorder")}}let Df=class{constructor(){this.time=Zo.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)}};Df=If([$a()],Df);let Ff=class{constructor(){this.time=Zo.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:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:y=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||_(v)&&v.every((t=>0===t)))){let n,r=0;return Of(e,i,s,b,x,v,"bevel"!==y,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};Ff=If([$a()],Ff);const zf=new Lf,jf=Af,Hf=yf;const Vf=new class extends Lf{constructor(){super(...arguments),this.time=Zo.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)}},Nf=yf;const Wf=new class{constructor(){this.time=Zo.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,f=p&&!1!==p.visible,m=g&&!1!==g.visible;if(!f&&!m)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,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,A=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:mh(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(y-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&A(p,"outerBorder"),m&&A(g,"innerBorder")}},Uf=new class{constructor(){this.time=Zo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:_=l.scaleX,scaleY:y=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/_,(f-s)/y,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/_,(f-s)/y,l),e.stroke())))}},Gf=Af,Yf=yf;const Xf={x:0,y:0,z:0,lastModelMatrix:null};class $f{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(xf),this.builtinContributions.push(Sf),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===Zo.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Zo.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}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)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Ec(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,_=Yp(d,u,h),y=$p(d,g),b=Up(h),x=Gp(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(_||y||a||o))return!0;e.beginPath();return el(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),!0}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=Yp(o,l,n),p=$p(o,c),g=Up(n,r),f=Gp(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){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;Xf.x=n,Xf.y=r,Xf.z=a,Xf.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=tp.allocate(),n=tp.allocate();fg(n,t,e),qu(s,d||s,n),Xf.x=0,Xf.y=0,Xf.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),tp.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Xf.x+=s.x,Xf.y+=s.y,Xf.z=a,i.setTransformForCurrent()}else if(p)Xf.x=0,Xf.y=0,Xf.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Xf.x+=s.x,Xf.y+=s.y,this.transformWithoutTranslate(i,Xf.x,Xf.y,Xf.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Xf.x=0,Xf.y=0,Xf.z=0;return Xf}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,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,_=(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,f,m,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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&tp.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}var Kf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zf=function(t,e){return function(i,s){e(i,s,t)}};let Jf=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Cu,this.builtinContributions=[Mf,Tf,wf],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=d>c;let p=!1;if(nDt){const t=Gt(b,y),r=Gt(x,y),a=qp(v,_,f,m,n,t,Number(u)),o=qp(k,A,M,w,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,Nt(o.y11,o.x11),Nt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>Dt)||C<.001)e.lineTo(i+M,s+w),p=!0;else if(T>Dt){const t=Gt(E,T),n=Gt(P,T),a=qp(M,w,k,A,r,-n,Number(u)),o=qp(f,m,v,_,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),T0&&e.arc(i+a.cx,s+a.cy,n,Nt(a.y01,a.x01),Nt(a.y11,a.x11),!u);const t=Nt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Wt(B),s+r*Yt(B));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Ec(t,null==r?void 0:r.theme).arc;const{fill:c=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:k=l.forceShowCap}=t.attribute;let{outerRadius:A=l.outerRadius,innerRadius:M=l.innerRadius}=t.attribute;A+=b,M-=x;let w=0;const T=(h(S)&&S||S[0])&&"conical"===c.gradient;if(T){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Vt(s-i){var e;let i=!0;if(h(t,!0)){for(let s=0;s<4;s++)Xc[s]=t,i&&(i=!(null!==(e=Xc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Xc[e]=!!t[e],i&&(i=!!Xc[e]);else Xc[0]=!1,Xc[1]=!1,Xc[2]=!1,Xc[3]=!1;return{isFullStroke:i,stroke:Xc}})(d);if((_||B)&&(e.beginPath(),Jp(t,e,i,s,A,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),g?(this._runStroke(t,e,i,s,l,y,B,v,o),this._runFill(t,e,i,s,l,_,m,u,p,a)):(this._runFill(t,e,i,s,l,_,m,u,p,a),this._runStroke(t,e,i,s,l,y,B,v,o))),!B&&y&&(e.beginPath(),Jp(t,e,i,s,A,M,E),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(h(S)&&S||S[1])&&k){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Vt(h-r)>=Ht-Dt){e.beginPath();const r=Math.abs(A-M)/2/A,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,A,M,d,d+r),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o);const u=()=>{if(_){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+=Ht;for(;i>Ht;)i-=Ht;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),dp(o.color,l.color,h,!1)}(0,0,h,n);a||Yp&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}},p=()=>{y&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};u(),p()}}this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),T&&(c.startAngle+=w,c.endAngle+=w)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}};Jf=Kf([$a(),Zf(0,Ya(co)),Zf(0,Ka(Qp)),qf("design:paramtypes",[Object])],Jf);var Qf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},em=function(t,e){return function(i,s){e(i,s,t)}};let im=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Pu,this.builtinContributions=[Cf,Ef,Bf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Ec(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,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f;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,_,y,m,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{y&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o)}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function sm(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]=ll(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 nm(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function rm(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=nm(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),sm(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=Ko.ROW:"y"===s?u=Ko.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.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 om=class extends $f{constructor(){super(...arguments),this.numberType=Lu}draw(t,e,i,s){const n=Ec(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 f;if(!e)return;t.beginPath();rm(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),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:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!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:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===_)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}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=Vl(x(t.points,v),_,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===_){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===y){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],y,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=y*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Gt(_,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,y,b,i,s,t,a,o)}};function lm(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),sm(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),sm(t,l,1,s),o=!1):o=!0}t.closePath()}om=am([$a()],om);const hm=new class extends kf{constructor(){super(...arguments),this.time=Zo.afterFillStroke}drawShape(t,e,i,s,n,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:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:ed(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:ed(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:ed(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:ed(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},cm=yf;var dm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},um=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pm=function(t,e){return function(i,s){e(i,s,t)}};let gm=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Eu,this.builtinContributions=[hm,cm],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,y=m[0];e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const i=m[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,v)}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:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(_(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Ec(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:k}=S,A=S.doStroke&&S.sVisible,{clipRange:M=g.clipRange,closePath:w,points:T,segments:C}=t.attribute;let{curveType:B=g.curveType}=t.attribute;function E(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(w&&"linear"===B&&(B="linearClosed"),1===M&&!C&&!T.some((t=>!1===t.defined))&&"linear"===B)return this.drawLinearAreaHighPerformance(t,e,!!f,A,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(C&&C.length){let e,i;const s=C.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=Vl(E(t.points,x),B,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=C.length-1;t>=0;t--){const e=C[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=C[t-1].points,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=Vl(E(i,x),"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!T||!T.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=E(T,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Vl(e,B,{curveTension:b}),n=Vl(i,"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===M){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,k,v,A,y,r[c],[g,t.attribute],M,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=M*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,k,v,A,y,r[u],[g,t.attribute],Gt(f,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,k,v,A,y,t.attribute,g,M,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Ec(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,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let y,b,x=Ko.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],y=t.points[t.points.length-1]}else b=m[0],y=m[m.length-1];const S=Vt(y.x-b.x),k=Vt(y.y-b.y);x=null==y.x1?Ko.ROW:null==y.y1?Ko.COLUMN:Number.isFinite(S+k)?S>k?Ko.ROW:Ko.COLUMN:Ko.ROW,function(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?Ko.ROW:Ko.COLUMN,Number.isFinite(c)||(o=Ko.COLUMN),Number.isFinite(d)||(o=Ko.ROW);const u=i*(o===Ko.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;_(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),rm(t,i[0]?e.top:e.bottom,l,x===Ko.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,A-h,M-c,o),t.stroke()}})(),!1}};gm=dm([$a(),pm(0,Ya(co)),pm(0,Ka(tg)),um("design:paramtypes",[Object])],gm);const fm=Af,mm=yf;var vm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},ym=function(t,e){return function(i,s){e(i,s,t)}};let bm=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Du,this.builtinContributions=[mm,fm],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:Ec(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:_,doFill:y,doStroke:b}=m;if(e.beginPath(),t.pathShape)el(t.pathShape.commandList,e,i,s,1,1,f);else{el((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,y,b,v,_,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):_&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{y&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,y,b,v,_,d,n,a,o)}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};bm=vm([$a(),ym(0,Ya(co)),ym(0,Ka(ng)),_m("design:paramtypes",[Object])],bm);var xm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},km=function(t,e){return function(i,s){e(i,s,t)}};let Am=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=zu,this.builtinContributions=[zf,Hf,jf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Ec(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:y=l.visible,x1:b,y1:x,x:S=l.x,y:k=l.y,fillStrokeOrder:A=l.fillStrokeOrder,drawStrokeWhenZeroWH:M=l.drawStrokeWhenZeroWH}=t.attribute;let{width:w,height:T}=t.attribute;w=(null!=w?w:b-S)||0,T=(null!=T?T:x-k)||0;const C=Xp(g,f,w,T,h),B=Kp(g,v,w,T,M),E=Up(h,c),P=Gp(d,m);if(!t.valid||!y)return;if(!E&&!P)return;if(!(C||B||a||o||c))return;0===u||_(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,w,T)):(e.beginPath(),Of(e,i,s,w,T,u,"bevel"!==p));const R={doFill:E,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,E,P,C,B,l,n,a,o,R),A?(this._runStroke(t,e,i,s,l,R,B,S,k,o),this._runFill(t,e,i,s,l,R,C,S,k,a)):(this._runFill(t,e,i,s,l,R,C,S,k,a),this._runStroke(t,e,i,s,l,R,B,S,k,o)),this.afterRenderStep(t,e,i,s,E,P,C,B,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}};Am=xm([$a(),km(0,Ya(co)),km(0,Ka(ag)),Sm("design:paramtypes",[Object])],Am);var Mm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tm=function(t,e){return function(i,s){e(i,s,t)}};let Cm=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Hu,this.builtinContributions=[Wf,Yf,Gf,Uf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:Ec(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v,k=t.getParsedPath();if(!k)return;const{keepDirIn3d:A=l.keepDirIn3d}=t.attribute,M=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let w=i,T=s,C=M;const B=e.camera;if(A&&B&&e.project){const t=e.project(i,s,M);e.camera=null,_(c)&&(c[0],c[1]),w=t.x,T=t.y,C=void 0}!1===k.draw(e,c,w,T,C,((n,r)=>{var h,c,v,_;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(_=r.lineWidth)&&void 0!==_?_:t.attribute.lineWidth,r=e}const y=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),y()):(y(),x())}))&&e.closePath(),e.camera=B,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,y,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,k,m,p,g,o),this._runFill(t,e,i,s,l,x,y,d,u,k,a)):(this._runFill(t,e,i,s,l,x,y,d,u,k,a),this._runStroke(t,e,i,s,l,S,b,d,u,k,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,y,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Cm=Mm([$a(),Tm(0,Ya(co)),Tm(0,Ka(og)),wm("design:paramtypes",[Object])],Cm);const Bm=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new He)}allocate(t,e,i,s){if(!this.pools.length)return(new He).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 He(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(...t){this.pools=[]}};const Em=new class extends _f{constructor(){super(...arguments),this.time=Zo.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,g,f,m,v,_,y,b,x,S;const{backgroundMode:k=l.backgroundMode,backgroundFit:A=l.backgroundFit,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio}=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 B;"richtext"===t.type&&(w=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const E=p(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!==(g=T.dx)&&void 0!==g?g:0),s=(null!==(f=T.y)&&void 0!==f?f:e.y1)+(null!==(m=T.dy)&&void 0!==m?m:0),n=null!==(v=T.width)&&void 0!==v?v:e.width(),r=null!==(_=T.height)&&void 0!==_?_:e.height();if(B=Bm.allocate(i,s,i+n,s+r),T=T.background,!P){const t=B.width(),e=B.height();B.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 B=t.AABBBounds,P||(B=gf(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 C();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,B,{backgroundMode:k,backgroundFit:A,backgroundKeepAspectRatio:M}),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=T,n?(Of(e,B.x1,B.y1,B.width(),B.height(),n,!0),e.fill()):e.fillRect(B.x1,B.y1,B.width(),B.height()),e.highPerformanceRestore()}E&&Bm.free(B),C()}};var Pm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Om=function(t,e){return function(i,s){e(i,s,t)}};let Im=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Vu,this.builtinContributions=[Em],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Ec(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,fontSize:v=d.fontSize,verticalMode:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute,x=null!==(l=nd(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:k,sVisible:A,doFill:M,doStroke:w}=S,T=!f,C=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,M,w,k,A,d,n,a,o),T&&this.transformUseContext2d(t,d,C,e);const B=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=Qu.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),Qu.free(t)}w&&(o?o(e,t.attribute,d):A&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,C))),M&&(a?a(e,t.attribute,d):k&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,C))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,C),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;w&&(o?o(e,t.attribute,d):A&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,C)})))),M&&(a?a(e,t.attribute,d):k&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,C),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,C,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!_){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Ut(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;B(i,a-(e+1)*x+u,r,n),r+=s}))}))}T&&this.restoreTransformUseContext2d(t,d,C,e),this.afterRenderStep(t,e,i,s,M,w,k,A,d,n,a,o)}draw(t,e,i,s){const n=Ec(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,l,h,c){if(e+t<=0)return;const{textAlign:u=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,_=!d(c),y=_?c.width:i.clipedWidth,b=_?0:cg(u,y),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+y,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+y,t,o),h.stroke()}}};function Lm(t,e,i,s){if(e&&e.length){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},Vm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nm=function(t,e){return function(i,s){e(i,s,t)}};let Wm=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Fu,this.builtinContributions=[jm,zm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Ec(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,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:b}=f;e.beginPath(),c<=0||_(c)&&c.every((t=>0===t))?Lm(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Lm(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,f=(Math.atan2(u,d)-Math.atan2(g,p))/2,m=Math.abs(Math.tan(f));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,_=v/m;const y=Dm(d,u),b=Dm(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*m);const S=Fm(h,_,y,d,u),k=Fm(h,_,b,p,g),A=2*h.x-S.x-k.x,M=2*h.y-S.y-k.y,w=Dm(A,M),T=Fm(h,Dm(_,v),w,A,M);let C=Math.atan2(S.y-T.y,S.x-T.x);const B=Math.atan2(k.y-T.y,k.x-T.x);let E=B-C;E<0&&(C=B,E=-E),E>Math.PI&&(E-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),E&&t.arcTo(h.x+i,h.y+s,k.x+i,k.y+s,v),t.lineTo(k.x+i,k.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,y,b,m,v,l,n,a,o);const x=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,y,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Wm=Hm([$a(),Nm(0,Ya(co)),Nm(0,Ka(rg)),Vm("design:paramtypes",[Object])],Wm);var Um=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Gm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ym=function(t,e){return function(i,s){e(i,s,t)}};let Xm=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Ou}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Pf)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:Ec(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:y=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:k=l.fillStrokeOrder,cornerType:A=l.cornerType,x:M=l.x,y:w=l.y}=t.attribute,T=Xp(p,m,g,f,c),C=Kp(p,v,g,f),B=Up(c,u),E=Gp(d,x);if(!t.valid||!S)return;if(!h){if(!B&&!E)return;if(!(T||C||a||o||u))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||_(y)&&y.every((t=>0===t))?(e.beginPath(),e.rect(i,s,g,f)):(e.beginPath(),Of(e,i,s,g,f,y,"bevel"!==A));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Pf));const P={doFill:B,doStroke:E};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===Zo.beforeFillStroke&&r.drawShape(t,e,i,s,B,E,T,C,l,n,a,o,P)})),h&&e.clip();const R=()=>{P.doFill&&(a?a(e,t.attribute,l):T&&(e.setCommonStyle(t,t.attribute,M-i,w-s,l),e.fill()))},O=()=>{P.doStroke&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,M-i,w-s,l),e.stroke()))};k?(O(),R()):(R(),O()),this._groupRenderContribitions.forEach((r=>{r.time===Zo.afterFillStroke&&r.drawShape(t,e,i,s,B,E,T,C,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=xo.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=Ec(t,null==s?void 0:s.theme).group,i=tp.allocate(),n=tp.allocate();fg(n,t,e),qu(i,p||i,n),a.modelMatrix=i,tp.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&tp.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}};Xm=Um([$a(),Ym(0,Ya(co)),Ym(0,Ka(ig)),Gm("design:paramtypes",[Object])],Xm);var $m=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},qm=function(t,e){return function(i,s){e(i,s,t)}};const Zm=["","repeat-x","repeat-y","repeat"];let Jm=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Iu,this.builtinContributions=[Vf,Nf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Ec(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,image:m}=t.attribute,v=this.valid(t,l,a);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v;if(!m||!t.resources)return;const k=t.resources.get(m);if("success"!==k.state)return;const A=t.width,M=t.height;e.beginPath();let w=!1;0===p||_(p)&&p.every((t=>0===t))?e.rect(i,s,A,M):(Of(e,i,s,A,M,p,"bevel"!==f),w=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const T=()=>{if(x)if(a)a(e,t.attribute,l);else if(y){e.setCommonStyle(t,t.attribute,i,s,l);let n=0;if("repeat"===h&&(n|=1),"repeat"===c&&(n|=2),n){const t=e.createPattern(k.data,Zm[n]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,A,M),e.translate(-i,-s,!0)}else e.drawImage(k.data,i,s,A,M)}},C=()=>{S&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(C(),w&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,y,!1,l,n,a),T(),w&&e.restore()):(w&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,y,!1,l,n,a),T(),w&&e.restore(),C()),this.afterRenderStep(t,e,i,s,x,!1,y,!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&&v(s))return void Uc.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Ec(t).image;this._draw(t,a,!1,i)}};Jm=$m([$a(),qm(0,Ya(co)),qm(0,Ka(sg)),Km("design:paramtypes",[Object])],Jm);const Qm=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"),fv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Bu,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];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+=Ht;for(;o<0;)o+=Ht;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};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},vv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const _v=Symbol.for("DrawItemInterceptor"),yv=new He,bv=new He;class xv{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){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,Qu.allocate(1,0,0,1,0,0)),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 kv=class{constructor(){this.order=1,this.interceptors=[new xv,new Mv,new Av,new Sv]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&tp.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var wv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Cv=function(t,e){return function(i,s){e(i,s,t)}};let Bv=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))}reInit(){this.drawContribution.reInit()}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}};Bv=wv([$a(),Cv(0,Ya(gv)),Tv("design:paramtypes",[Object])],Bv);var Ev=new La((t=>{t(bo).to(Bv)}));const Pv=Symbol.for("PickerService"),Rv=Symbol.for("GlobalPickerService"),Ov=Symbol.for("PickItemInterceptor"),Iv=Symbol.for("PickServiceInterceptor");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};let Dv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};Dv=Lv([$a()],Dv);let Fv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Ec(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=Qu.allocateByObj(a),u=new se(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};Fv=Lv([$a()],Fv);let zv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new se(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}};zv=Lv([$a()],zv);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){const a=fv(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};jv=Lv([$a()],jv);var Hv=new La(((t,e,i)=>{i(Pv)||(t(Rv).toSelf(),t(Pv).toService(Rv)),t(jv).toSelf().inSingletonScope(),t(Ov).toService(jv),t(Fv).toSelf().inSingletonScope(),t(Ov).toService(Fv),t(zv).toSelf().inSingletonScope(),t(Ov).toService(zv),po(t,Ov),t(Dv).toSelf().inSingletonScope(),t(Iv).toService(Dv),po(t,Iv)})),Vv=new La((t=>{t(Nu).to(mg),t(Wu).toConstantValue(df)}));const Nv=Symbol.for("AutoEnablePlugins"),Wv=Symbol.for("PluginService");var Uv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Yv=function(t,e){return function(i,s){e(i,s,t)}};let Xv=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&&yo.isBound(Nv)&&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(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Xv=Uv([$a(),Yv(0,Ya(co)),Yv(0,Ka(Nv)),Gv("design:paramtypes",[Object])],Xv);var $v=new La((t=>{t(Wv).to(Xv),function(t,e){t(co).toDynamicValue((({container:t})=>new uo(e,t))).whenTargetNamed(e)}(t,Nv)})),Kv=new La((t=>{po(t,vo)})),qv=new La((t=>{t(Rh).to(Oh).inSingletonScope(),po(t,Rh)})),Zv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Qv=class{constructor(){this.type="static",this.offscreen=!1,this.global=xo.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=Dh({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()}};Qv=Zv([$a(),Jv("design:paramtypes",[])],Qv);var t_=new La((t=>{t(Qv).toSelf(),t(Dp).toService(Qv)}));var e_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function i_(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function s_(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=i_(t,e,s);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;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=i_(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var a_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},o_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},l_=function(t,e){return function(i,s){e(i,s,t)}};let h_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):s_(e,Jl.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new je,this.backupDirtyBounds=new je,this.global=xo.global,this.layerService=xo.layerService,_(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}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){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=ve(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.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,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Jl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Jl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Qu.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=r_(e,i,Jl.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&&!xe(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Bm.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Qu.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Bm.free(n),Qu.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||yo.get(Qm);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let d_=class extends om{constructor(){super(...arguments),this.numberType=Lu}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=Ec(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=Yp(u,p,c),_=$p(u,g),y=Up(c),b=Gp(d,f);if(!t.valid||!m)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())}};d_=c_([$a()],d_);var u_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 p_=class extends gm{constructor(){super(...arguments),this.numberType=Eu}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=Ec(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Yp(u,d,c),f=Up(c);if(!t.valid||!p)return;if(!f)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())}};p_=u_([$a()],p_);var g_,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},m_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},v_=function(t,e){return function(i,s){e(i,s,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"}(g_||(g_={}));let y_=class extends h_{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=g_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new mo([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return __(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:Jl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Jl.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 __(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return __(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>__(this,void 0,void 0,(function*(){if(2!==t.count)yield n_(t,Jl.zIndex,((i,s)=>{if(this.status===g_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return __(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return __(this,void 0,void 0,(function*(){this.rendering&&(this.status=g_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=g_.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 __(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:()=>__(this,void 0,void 0,(function*(){yield n_(t,Jl.zIndex,(t=>__(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};y_=f_([$a(),v_(0,Xa(sv)),v_(1,Ya(d_)),v_(2,Ya(p_)),v_(3,Ya(co)),v_(3,Ka(_v)),m_("design:paramtypes",[Array,Object,Object,Object])],y_);var b_=new La((t=>{t(_f).toSelf().inSingletonScope(),t(kf).toSelf().inSingletonScope(),t(gv).to(h_),t(Qm).to(y_),t(nv).to(Xm).inSingletonScope(),t(sv).toService(nv),po(t,ig),t(bf).toSelf().inSingletonScope(),po(t,hg),po(t,sv),t(kv).toSelf().inSingletonScope(),t(_v).toService(kv),po(t,_v)}));function x_(){x_.__loaded||(x_.__loaded=!0,yo.load(Wp),yo.load(Vv),yo.load(Ev),yo.load(Hv),yo.load($v),function(t){t.load(Kv),t.load(qv),t.load(t_)}(yo),function(t){t.load(b_)}(yo))}x_.__loaded=!1,x_();const S_=yo.get(_o);xo.global=S_;const k_=yo.get(Ip);xo.graphicUtil=k_;const A_=yo.get(Op);xo.transformUtil=A_;const M_=yo.get(Nu);xo.graphicService=M_;const w_=yo.get(Lp);xo.layerService=w_;class T_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class C_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=xo.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=xo.global.getRequestAnimationFrame();this.rafId=t((()=>{xo.global.devicePixelRatio!==this.dpr&&(this.dpr=xo.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=xo.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class B_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.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))})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,xo.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())}}const E_=new He;class P_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Ia.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()}));const e=this.pluginService.stage;e&&(e.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&&(E_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(E_,t.parent&&t.parent.globalTransMatrix)))})),e.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))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let R_;function O_(){!function(){if(null==R_)try{const t=document.createElement("canvas"),e=t.getContext("2d");R_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),R_&&(R_=!!document.createElement)}catch(t){R_=!1}}();const t=xo.global&&xo.global.env;return t?"browser"===t:R_}let I_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};I_._pluginClasses={};const L_="white";class D_ extends Ep{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:L_}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={}){var e,i;super({}),this.tickedBeforeRender=!0,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._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Cc,this.hooks={beforeRender:new mo(["stage"]),afterRender:new mo(["stage"]),afterClearScreen:new mo(["stage"]),afterClearRect:new mo(["stage"])},this.global=xo.global,!this.global.env&&O_()&&this.global.setEnv("browser"),this.window=yo.get(gc),this.renderService=yo.get(bo),this.pluginService=yo.get(Wv),this.layerService=yo.get(Lp),this.graphicService=yo.get(Nu),this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],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:L_,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(),t.autoRefresh&&this.enableAutoRefresh(),!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),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&v(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(i=t.rafId)&&void 0!==i?i:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new Wc(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(t=!1){t&&(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:f=[1,1,-1],color:m="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,k=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+y,k=Math.cos(d)*Math.cos(u)*1);const A=I_.getPlugin("DirectionalLight");A&&(this.light=new A(f,m,v));const M={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,k],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=M;else{const t=I_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=I_.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}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 T_))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new C_))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new B_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new je;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new P_,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=I_.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=I_.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=I_.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();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.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();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===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),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.dirtyBounds&&this.dirtyBounds.clear(),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,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new se(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;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.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=yo.get(gc),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=yo.get(Pv)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}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},z_=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 j_=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new He}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}}loadFont(t,e,i){return z_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}};j_=F_([$a()],j_);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},V_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let N_=class{constructor(){this._uid=Ia.GenAutoIncrementId(),this.viewBox=new He,this.modelMatrix=new Ne(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){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}};N_=H_([$a(),V_("design:paramtypes",[])],N_);var W_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},U_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},G_=function(t,e){return function(i,s){e(i,s,t)}};let Y_=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=xo.global}reInit(){this._init()}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.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 He).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 Ne(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),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new se(e.x,e.y),a=Ec(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 se(e.x,e.y);l.transformPoint(a,a);const o=Ec(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&&tp.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),Qu.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function X_(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 $_(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function ty(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;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&&x(t.x)&&x(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}))),ry=(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]},ay=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new je;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 ry(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return ry(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);ay(n[0],s,i),ay(n[1],e-s,i)}};let oy=!1;const ly=new La((t=>{oy||(oy=!0,t(Jf).toSelf().inSingletonScope(),t(tv).to(Jf).inSingletonScope(),t(sv).toService(tv),t(Qp).toService(bf),po(t,Qp))}));let hy=!1;const cy=new La((t=>{hy||(hy=!0,t(Am).toSelf().inSingletonScope(),t(lv).to(Am).inSingletonScope(),t(sv).toService(lv),t(Ff).toSelf(),t(Df).toSelf(),t(ag).toService(Ff),t(ag).toService(Df),t(ag).toService(bf),po(t,ag))}));let dy=!1;const uy=new La((t=>{dy||(dy=!0,t(om).toSelf().inSingletonScope(),t(d_).toSelf().inSingletonScope(),t(rv).to(om).inSingletonScope(),t(sv).toService(rv))}));let py=!1;const gy=new La((t=>{py||(py=!0,t(gm).toSelf().inSingletonScope(),t(ev).to(gm).inSingletonScope(),t(sv).toService(ev),t(tg).toService(bf),po(t,tg),t(p_).toSelf().inSingletonScope())}));let fy=!1;const my=new La((t=>{fy||(fy=!0,t(Cm).toSelf().inSingletonScope(),t(hv).to(Cm).inSingletonScope(),t(sv).toService(hv),t(og).toService(bf),po(t,og))}));let vy=!1;const _y=new La((t=>{vy||(vy=!0,t(im).toSelf().inSingletonScope(),t(iv).to(im).inSingletonScope(),t(sv).toService(iv),t(eg).toService(bf),po(t,eg))}));let yy=!1;const by=new La((t=>{yy||(yy=!0,t(cv).to(Im).inSingletonScope(),t(sv).toService(cv),t(lg).toService(bf),po(t,lg))}));let xy=!1;const Sy=new La((t=>{xy||(xy=!0,t(bm).toSelf().inSingletonScope(),t(av).to(bm).inSingletonScope(),t(sv).toService(av),t(ng).toService(bf),po(t,ng))}));let ky=!1;const Ay=new La((t=>{ky||(ky=!0,t(ov).to(Wm).inSingletonScope(),t(sv).toService(ov),t(rg).toService(bf),po(t,rg))}));var My=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 wy=class{constructor(){this.numberType=Ru}reInit(){}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=Ec(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};wy=My([$a()],wy);let Ty=!1;const Cy=new La((t=>{Ty||(Ty=!0,t(uv).to(wy).inSingletonScope(),t(sv).toService(uv))}));var By=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)};let Py=class extends $f{constructor(){super(),this.numberType=ju,this.builtinContributions=[Em],this.init()}drawShape(t,e,i,s,n){const r=Ec(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=Yp(o,l,!0),d=Yp(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),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=Ec(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:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),Of(e,i-t,s-n,v,_,f,!0)),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=Ec(t).richtext;this._draw(t,s,!1,i)}};Py=By([$a(),Ey("design:paramtypes",[])],Py);let Ry=!1;const Oy=new La((t=>{Ry||(Ry=!0,t(dv).to(Py).inSingletonScope(),t(sv).toService(dv))}));let Iy=!1;const Ly=new La((t=>{Iy||(Iy=!0,t(pv).to(Jm).inSingletonScope(),t(sv).toService(pv),t(sg).toService(bf),po(t,sg))}));function Dy(t){const e=[];for(let i=0;i=0&&n>=0&&srt.getInstance().info(`[VChart log]: ${t}`,...e),jy=(t,e)=>(c(Vy.warnHandler)&&Vy.warnHandler.call(null,t,e),e?rt.getInstance().warn(`[VChart warn]: ${t}`,e):rt.getInstance().warn(`[VChart warn]: ${t}`)),Hy=(t,e,i)=>{if(!c(Vy.errorHandler))throw new Error(t);Vy.errorHandler.call(null,t,e)},Vy={silent:!1,warnHandler:!1,errorHandler:!1},Ny=O_(),Wy=Ny&&globalThis?globalThis.document:void 0;function Uy(t){return("desktop-browser"===t||"mobile-browser"===t)&&Ny}function Gy(t){return Yy(t)||"mobile-browser"===t}function Yy(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let Xy=0;function $y(){return Xy>=9999999&&(Xy=0),Xy++}function Ky(t){return null!=t&&""!==t&&(!!x(t)||+t==+t)}function qy(t){return!(!t||0===t.length)&&(!d(t[0])&&!d(t[0].dataId)&&_(t[0].fields))}const Zy=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Jy extends Ep{constructor(t,e){super(t),this._skipRenderAttributes=Zy,(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,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);f(this.attribute[t])&&f(e)&&!c(this.attribute[t])&&!c(e)?z(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.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,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.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){d(e)&&(e=Object.keys(t));for(let i=0;i{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"},wb=(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 Tb extends o{constructor(t,e={}){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.startTime=zc.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.pressTimeout=null}),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=zc.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||Mb(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=wb(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=zc.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=wb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=Mb(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&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("pointerleave",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("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=zc.now()-i>this.config.press.time&&wb(s[0],t){xo.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;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){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){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},Bb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Eb=[0,0,0];let Pb=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t: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(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},Yl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},$l),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Kl),{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 Ne(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ne(1,0,0,1,0,0),this._clearMatrix=new Ne(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&rt.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ne(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&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 Qu.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&&(Qu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(Qu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){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,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=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(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){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-=Ht;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(f,-2*y),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&&yp.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&&(Zu(Eb,[t,e,i],this.modelMatrix),t=Eb[0],e=Eb[1],i=Eb[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&&(Zu(Eb,[t,e,i],this.modelMatrix),t=Eb[0],e=Eb[1],i=Eb[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Zu(Eb,[e,i,s],this.modelMatrix),e=Eb[0],i=Eb[1],s=Eb[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,e=xo.global.measureTextMethod){var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=xo.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Kl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Kl.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&&(Zu(Eb,[e,i,s],this.modelMatrix),e=Eb[0],i=Eb[1],s=Eb[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=vh(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:mh(this,a,this.dpr),r.strokeStyle=vh(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=Ie(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?this.font=t.font:this.font=Ie(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(t=!0,e=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(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Qu.free(t))),this.stack.length=0}};Pb.env="browser",Pb=Cb([$a(),Bb("design:paramtypes",[Object,Number])],Pb);var Rb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ob=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ib=class extends op{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=xo.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new Pb(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 Lb(t,e){return new La((i=>{i(Ih).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Lh).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Ib.env="browser",Ib=Rb([$a(),Ob("design:paramtypes",[Object])],Ib);const Db=Lb(Ib,Pb);var Fb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jb=function(t,e){return function(i,s){e(i,s,t)}};let Hb=class extends Y_{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,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=dc.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 Nb=class{constructor(){this.type="group",this.numberType=Ou}contains(t,e,i){return!1}};Nb=Vb([$a()],Nb);const Wb=new La(((t,e,i,s)=>{Wb.__vloaded||(Wb.__vloaded=!0,t(kb).to(Nb).inSingletonScope(),t(Ab).toService(kb),po(t,Ab))}));Wb.__vloaded=!1;var Ub=Wb;const Gb=new La(((t,e,i,s)=>{i(Hb)||t(Hb).toSelf().inSingletonScope(),i(Pv)?s(Pv).toService(Hb):t(Pv).toService(Hb)}));var Yb,Xb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$b=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Kb=Yb=class extends N_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Yb.idprefix}_${Yb.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=xo.global,this.viewBox=new He,this.modelMatrix=new Ne(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:Yb.GenerateCanvasId(),canvasControled:!0};this.canvas=new Ib(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 Ib({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)}};Kb.env="browser",Kb.idprefix="visactor_window",Kb.prefix_count=0,Kb=Yb=Xb([$a(),$b("design:paramtypes",[])],Kb);const qb=new La((t=>{t(Kb).toSelf(),t(fc).toDynamicValue((t=>t.container.get(Kb))).whenTargetNamed(Kb.env)}));var Zb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qb=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 tx{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function ex(t,e=!1){const i=document.createElement("img");if(xo.global.isImageAnonymous&&(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 ix=class extends j_{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 tx(t)}return new He}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(v(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=v(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return ex(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return ex(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const s=document.createElement("canvas");t.id&&(s.id=null!==(e=t.id)&&void 0!==e?e:Ia.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(...t){}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}}loadFont(t,e,i){return Qb(this,void 0,void 0,(function*(){return new FontFace(t,v(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}};ix=Zb([$a(),Jb("design:paramtypes",[])],ix);const sx=new La((t=>{sx.isBrowserBound||(sx.isBrowserBound=!0,t(ix).toSelf().inSingletonScope(),t(vo).toService(ix))}));function nx(t,e=!0){nx.__loaded||(nx.__loaded=!0,t.load(sx),t.load(Db),t.load(qb),e&&function(t){t.load(Ub),t.load(Gb)}(t))}sx.isBrowserBound=!1,nx.__loaded=!1;var rx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},ox=function(t,e){return function(i,s){e(i,s,t)}};let lx=class extends Y_{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,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 rp(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}};lx=rx([$a(),ox(0,Ya(co)),ox(0,Ka(Qy)),ox(1,Ya(co)),ox(1,Ka(Ov)),ox(2,Ya(co)),ox(2,Ka(Iv)),ax("design:paramtypes",[Object,Object,Object])],lx);const hx=new La((t=>{hx.__vloaded||(hx.__vloaded=!0,po(t,Qy))}));hx.__vloaded=!1;var cx=hx;class dx{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();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,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:mh(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}var ux=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},px=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gx=function(t,e){return function(i,s){e(i,s,t)}};let fx=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Cu}};fx=ux([$a(),gx(0,Ya(tv)),px("design:paramtypes",[Object])],fx);let mx=!1;const vx=new La(((t,e,i,s)=>{mx||(mx=!0,t(tb).to(fx).inSingletonScope(),t(Qy).toService(tb))}));var _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)},bx=function(t,e){return function(i,s){e(i,s,t)}};let xx=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Eu}};xx=_x([$a(),bx(0,Ya(ev)),yx("design:paramtypes",[Object])],xx);let Sx=!1;const kx=new La(((t,e,i,s)=>{Sx||(Sx=!0,t(eb).to(xx).inSingletonScope(),t(Qy).toService(eb))}));var Ax=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wx=function(t,e){return function(i,s){e(i,s,t)}};let Tx=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Pu}};Tx=Ax([$a(),wx(0,Ya(iv)),Mx("design:paramtypes",[Object])],Tx);let Cx=!1;const Bx=new La(((t,e,i,s)=>{Cx||(Cx=!0,t(ib).to(Tx).inSingletonScope(),t(Qy).toService(ib))}));class Ex{constructor(){this.type="glyph",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=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}}var Px=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Ox=function(t,e){return function(i,s){e(i,s,t)}};let Ix=class extends Ex{constructor(t){super(),this.canvasRenderer=t}};Ix=Px([$a(),Ox(0,Ya(uv)),Rx("design:paramtypes",[Object])],Ix);let Lx=!1;const Dx=new La(((t,e,i,s)=>{Lx||(Lx=!0,t(cb).to(Ix).inSingletonScope(),t(Ix).toService(cb))}));var Fx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 zx=class{constructor(){this.type="image",this.numberType=Iu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};zx=Fx([$a()],zx);let jx=!1;const Hx=new La(((t,e,i,s)=>{jx||(jx=!0,t(sb).to(zx).inSingletonScope(),t(zx).toService(sb))}));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)},Wx=function(t,e){return function(i,s){e(i,s,t)}};let Ux=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Lu}};Ux=Vx([$a(),Wx(0,Ya(rv)),Nx("design:paramtypes",[Object])],Ux);let Gx=!1;const Yx=new La(((t,e,i,s)=>{Gx||(Gx=!0,t(nb).to(Ux).inSingletonScope(),t(Qy).toService(nb))}));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},$x=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kx=function(t,e){return function(i,s){e(i,s,t)}};let qx=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Fu}};qx=Xx([$a(),Kx(0,Ya(ov)),$x("design:paramtypes",[Object])],qx);let Zx=!1;const Jx=new La(((t,e,i,s)=>{Zx||(Zx=!0,t(hb).to(qx).inSingletonScope(),t(Qy).toService(hb))}));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 extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Du}};iS=Qx([$a(),eS(0,Ya(av)),tS("design:paramtypes",[Object])],iS);let sS=!1;const nS=new La(((t,e,i,s)=>{sS||(sS=!0,t(rb).to(iS).inSingletonScope(),t(Qy).toService(rb))})),rS=new He;class aS{constructor(){this.type="rect",this.numberType=zu}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=t.getGraphicTheme(),{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||x(r,!0)&&0!==r||_(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,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:mh(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;rS.setValue(i.x1,i.y1,i.x2,i.y2),rS.expand(-r/2),h=!rS.containsPoint(e)}}return s.highPerformanceRestore(),h}}var oS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hS=function(t,e){return function(i,s){e(i,s,t)}};let cS=class extends aS{constructor(t){super(),this.canvasRenderer=t}};cS=oS([$a(),hS(0,Ya(lv)),lS("design:paramtypes",[Object])],cS);let dS=!1;const uS=new La(((t,e,i,s)=>{dS||(dS=!0,t(ab).to(cS).inSingletonScope(),t(Qy).toService(ab))}));let pS=!1;const gS=new La(((t,e,i,s)=>{pS||(pS=!0,t(sb).to(zx).inSingletonScope(),t(zx).toService(sb))}));var fS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mS=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 extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Hu}};_S=fS([$a(),vS(0,Ya(hv)),mS("design:paramtypes",[Object])],_S);let yS=!1;const bS=new La(((t,e,i,s)=>{yS||(yS=!0,t(ob).to(_S).inSingletonScope(),t(Qy).toService(ob))}));var xS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let SS=class{constructor(){this.type="text",this.numberType=Vu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};SS=xS([$a()],SS);let kS=!1;const AS=new La(((t,e,i,s)=>{kS||(kS=!0,t(lb).to(SS).inSingletonScope(),t(Qy).toService(lb))})),MS=new La(((t,e,i,s)=>{i(lx)||t(lx).toSelf().inSingletonScope(),i(Pv)?s(Pv).toService(lx):t(Pv).toService(lx)}));class wS{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 TS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)};let BS=class extends Pb{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 Ne(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};BS.env="node",BS=TS([$a(),CS("design:paramtypes",[Object,Number])],BS);var ES=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},PS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let RS=class extends op{constructor(t){super(t)}init(){this._context=new BS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&c(this._nativeCanvas.release)&&this._nativeCanvas.release()}};RS.env="node",RS=ES([$a(),PS("design:paramtypes",[Object])],RS);const OS=Lb(RS,BS);var IS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},LS=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 FS=class extends N_{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:Ia.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new RS(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new RS({width:n,height:r,dpr:s,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}getImageBuffer(t="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){}};FS.env="node",FS=IS([$a(),DS(0,Ya(_o)),LS("design:paramtypes",[Object])],FS);const zS=new La((t=>{t(FS).toSelf(),t(fc).toDynamicValue((t=>t.container.get(FS))).whenTargetNamed(FS.env)}));var jS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let HS=class extends j_{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 sd.call(t)}}getCancelAnimationFrame(){return t=>{sd.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};HS=jS([$a()],HS);const VS=new La((t=>{VS.isNodeBound||(VS.isNodeBound=!0,t(HS).toSelf().inSingletonScope(),t(vo).toService(HS))}));function NS(t,e=!0){NS.__loaded||(NS.__loaded=!0,t.load(VS),t.load(OS),t.load(zS))}VS.isNodeBound=!1,NS.__loaded=!1;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};let US=class extends Pb{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_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,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:mh(this,l,this.dpr),r.strokeStyle=vh(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||(d&&r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=xo.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,xo.global.devicePixelRatio),super.measureText(t,e)}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;let r="";r=t.font?t.font:Ie(t,e,n&&this.camera&&this.camera.getProjectionScale(i)),s.font=(r||"").replace("px","vp");const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes);let a="";a=t.font?t.font:Ie(t,e,this.camera&&this.camera.getProjectionScale(i)),r.font=(a||"").replace("px","vp");const{fontFamily:o=e.fontFamily,fontSize:l=e.fontSize}=t;this.fontFamily=o,this.fontSize=l,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}createPattern(t,e){return null}drawImage(){const t=this.nativeContext,e=arguments;e[0].drawImage&&(e[0]=e[0].transferToImageBitmap()),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])}draw(){}};US.env="harmony",US=WS([$a()],US);var GS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},YS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let XS=class extends op{constructor(t){super(t)}init(){this._context=new US(this,this._dpr)}resize(t,e){}release(...t){}};XS.env="harmony",XS=GS([$a(),YS("design:paramtypes",[Object])],XS);var $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},KS=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)}};class ZS{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 JS=class extends N_{get container(){return null}constructor(t){super(),this.global=t,this.type="harmony",this.eventManager=new ZS}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{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:Ia.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new XS(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}this.canvas=new XS({width:i,height:s,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}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){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()}};JS.env="harmony",JS=$S([$a(),qS(0,Ya(_o)),KS("design:paramtypes",[Object])],JS);const QS=new La((t=>{t(JS).toSelf(),t(fc).toDynamicValue((t=>t.container.get(JS))).whenTargetNamed(JS.env)})),tk=Lb(XS,US);var ek=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ik=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let sk=class extends j_{constructor(){super(),this.type="harmony",this.supportEvent=!0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0,this.rafSTO=new id(0)}configure(t,e){t.env===this.type&&t.setActiveEnvContribution(this)}getDynamicCanvasCount(){return 9999}getStaticCanvasCount(){return 9999}loadImage(t){}loadSvg(t){return Promise.reject()}createCanvas(t){return function(t,e,i){const s=new OffscreenCanvas(t,e),n=s.getContext("2d");return new wS({width:t,height:e,context:n,_c:s,getBoundingClientRect:()=>({width:t,height:e}),getContext:()=>n},n,1,t,e,i)}(t.width,t.height,t.id)}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return t=>this.rafSTO.call(t)}getCancelAnimationFrame(){return t=>{this.rafSTO.clear(t)}}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return null}getRootElement(){return null}getDocument(){return null}release(...t){}};sk=ek([$a(),ik("design:paramtypes",[])],sk);const nk=new La((t=>{nk.isHarmonyBound||(nk.isHarmonyBound=!0,t(sk).toSelf().inSingletonScope(),t(vo).toService(sk))}));function rk(t,e=!0){rk.__loaded||(rk.__loaded=!0,t.load(nk),t.load(tk),t.load(QS),e&&function(t){t.load(cx),t.load(MS),t.load(vx),t.load(kx),t.load(Bx),t.load(Dx),t.load(Hx),t.load(Yx),t.load(Jx),t.load(nS),t.load(uS),t.load(gS),t.load(bS),t.load(AS)}(t))}nk.isHarmonyBound=!1,rk.__loaded=!1;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 extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Cu}};hk=ak([$a(),lk(0,Ya(tv)),ok("design:paramtypes",[Object])],hk);let ck=!1;const dk=new La(((t,e,i,s)=>{ck||(ck=!0,t(db).to(hk).inSingletonScope(),t(Ab).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 fk=class extends aS{constructor(t){super(),this.canvasRenderer=t}};fk=uk([$a(),gk(0,Ya(lv)),pk("design:paramtypes",[Object])],fk);let mk=!1;const vk=new La(((t,e,i,s)=>{mk||(mk=!0,t(vb).to(fk).inSingletonScope(),t(Ab).toService(vb))}));class _k extends $f{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=t.getGraphicTheme(),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,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:mh(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&tp.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var yk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xk=function(t,e){return function(i,s){e(i,s,t)}};let Sk=class extends _k{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Lu}};Sk=yk([$a(),xk(0,Ya(rv)),bk("design:paramtypes",[Object])],Sk);let kk=!1;const Ak=new La(((t,e,i,s)=>{kk||(kk=!0,t(fb).to(Sk).inSingletonScope(),t(Ab).toService(fb))}));var Mk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wk=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 Ck=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Eu}};Ck=Mk([$a(),Tk(0,Ya(ev)),wk("design:paramtypes",[Object])],Ck);let Bk=!1;const Ek=new La(((t,e,i,s)=>{Bk||(Bk=!0,t(ub).to(Ck).inSingletonScope(),t(Ab).toService(ub))}));class Pk extends $f{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();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,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&tp.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var Rk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Ik=function(t,e){return function(i,s){e(i,s,t)}};let Lk=class extends Pk{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Hu}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=t.getGraphicTheme(),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,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:mh(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&tp.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};Lk=Rk([$a(),Ik(0,Ya(hv)),Ok("design:paramtypes",[Object])],Lk);let Dk=!1;const Fk=new La(((t,e,i,s)=>{Dk||(Dk=!0,t(_b).to(Lk).inSingletonScope(),t(Ab).toService(_b))}));var zk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hk=function(t,e){return function(i,s){e(i,s,t)}};let Vk=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Pu}};Vk=zk([$a(),Hk(0,Ya(iv)),jk("design:paramtypes",[Object])],Vk);let Nk=!1;const Wk=new La(((t,e,i,s)=>{Nk||(Nk=!0,t(pb).to(Vk).inSingletonScope(),t(Ab).toService(pb))}));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},Gk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Yk=function(t,e){return function(i,s){e(i,s,t)}};let Xk=class extends Pk{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=t.getGraphicTheme(),{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(),f=l.width(),m=dg(a,u,n),v=cg(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,s.modelMatrix!==u&&tp.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};Xk=Uk([$a(),Yk(0,Ya(cv)),Gk("design:paramtypes",[Object])],Xk);let $k=!1;const Kk=new La(((t,e,i,s)=>{$k||($k=!0,t(yb).to(Xk).inSingletonScope(),t(Ab).toService(yb))}));var qk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zk=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 Qk=class extends _k{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Du}};Qk=qk([$a(),Jk(0,Ya(av)),Zk("design:paramtypes",[Object])],Qk);let tA=!1;const eA=new La(((t,e,i,s)=>{tA||(tA=!0,t(mb).to(Qk).inSingletonScope(),t(Ab).toService(mb))}));var iA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},nA=function(t,e){return function(i,s){e(i,s,t)}};let rA=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Fu}};rA=iA([$a(),nA(0,Ya(ov)),sA("design:paramtypes",[Object])],rA);let aA=!1;const oA=new La(((t,e,i,s)=>{aA||(aA=!0,t(bb).to(rA).inSingletonScope(),t(Ab).toService(bb))}));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},hA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cA=function(t,e){return function(i,s){e(i,s,t)}};let dA=class extends Ex{constructor(t){super(),this.canvasRenderer=t}};dA=lA([$a(),cA(0,Ya(uv)),hA("design:paramtypes",[Object])],dA);let uA=!1;const pA=new La(((t,e,i,s)=>{uA||(uA=!0,t(Sb).to(dA).inSingletonScope(),t(Ab).toService(Sb))}));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},fA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mA=function(t,e){return function(i,s){e(i,s,t)}};let vA=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=ju}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};vA=gA([$a(),mA(0,Ya(dv)),fA("design:paramtypes",[Object])],vA);let _A=!1;const yA=new La(((t,e,i,s)=>{_A||(_A=!0,t(xb).to(vA).inSingletonScope(),t(Ab).toService(xb))}));var bA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},SA=function(t,e){return function(i,s){e(i,s,t)}};let kA=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=Iu}};kA=bA([$a(),SA(0,Ya(pv)),xA("design:paramtypes",[Object])],kA);let AA=!1;const MA=new La(((t,e,i,s)=>{AA||(AA=!0,t(gb).to(kA).inSingletonScope(),t(Ab).toService(gb))})),wA=O_();function TA(){TA.__loaded||(TA.__loaded=!0,df.RegisterGraphicCreator("arc",rf),yo.load(ly),yo.load(wA?dk:vx))}TA.__loaded=!1;const CA=TA;function BA(){BA.__loaded||(BA.__loaded=!0,df.RegisterGraphicCreator("area",ef),yo.load(gy),yo.load(wA?Ek:kx))}BA.__loaded=!1;const EA=BA;function PA(){PA.__loaded||(PA.__loaded=!0,df.RegisterGraphicCreator("circle",bg),yo.load(_y),yo.load(wA?Wk:Bx))}PA.__loaded=!1;const RA=PA;function OA(){OA.__loaded||(OA.__loaded=!0,df.RegisterGraphicCreator("glyph",Dg),yo.load(Cy),yo.load(wA?pA:Dx))}OA.__loaded=!1;const IA=OA;function LA(){LA.__loaded||(LA.__loaded=!0,df.RegisterGraphicCreator("group",Pp))}LA.__loaded=!1;const DA=LA;function FA(){FA.__loaded||(FA.__loaded=!0,df.RegisterGraphicCreator("image",Ng),yo.load(Ly),yo.load(wA?MA:Hx))}FA.__loaded=!1;const zA=FA;function jA(){jA.__loaded||(jA.__loaded=!0,df.RegisterGraphicCreator("line",Eg),yo.load(uy),yo.load(wA?Ak:Yx))}jA.__loaded=!1;const HA=jA;function VA(){VA.__loaded||(VA.__loaded=!0,df.RegisterGraphicCreator("path",Jg),yo.load(Sy),yo.load(wA?eA:nS))}VA.__loaded=!1;const NA=VA;function WA(){WA.__loaded||(WA.__loaded=!0,df.RegisterGraphicCreator("polygon",lf),yo.load(Ay),yo.load(wA?oA:Jx))}WA.__loaded=!1;const UA=WA;function GA(){GA.__loaded||(GA.__loaded=!0,df.RegisterGraphicCreator("rect",Ig),yo.load(cy),yo.load(wA?vk:uS))}GA.__loaded=!1;const YA=GA;function XA(){XA.__loaded||(XA.__loaded=!0,df.RegisterGraphicCreator("richtext",Kg),yo.load(Oy),yo.load(wA?yA:gS))}XA.__loaded=!1;const $A=XA;function KA(){KA.__loaded||(KA.__loaded=!0,df.RegisterGraphicCreator("shadowRoot",cf))}KA.__loaded=!1;const qA=KA;function ZA(){ZA.__loaded||(ZA.__loaded=!0,df.RegisterGraphicCreator("symbol",Tg),yo.load(my),yo.load(wA?Fk:bS))}ZA.__loaded=!1;const JA=ZA;function QA(){QA.__loaded||(QA.__loaded=!0,df.RegisterGraphicCreator("text",Ag),yo.load(by),yo.load(wA?Kk:AS))}QA.__loaded=!1;const tM=QA;function eM(){DA(),YA()}const iM=-.5*Math.PI,sM=1.5*Math.PI,nM="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 rM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(rM||(rM={}));const aM={[rM.selectedReverse]:{},[rM.selected]:{},[rM.hover]:{},[rM.hoverReverse]:{}},oM={container:"",width:30,height:30,style:{}},lM="scrollDrag";function hM(){return"browser"===S_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const cM={debounce:bt,throttle:xt};eM();let dM=class t extends Jy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{u(this._prePos)&&t.preventDefault()},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=mt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=mt(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=>{this._clearDragEvents();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});const r=hM(),a="browser"===S_.env?S_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=mt(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},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=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:vt(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){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(lM,{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),("browser"===S_.env?S_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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:ni(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,[s,n,r,a]=ni(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,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=mt(t[0],0,1),c=mt(t[1],0,1),d=mt(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_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)}_clearDragEvents(){const t=hM(),e="browser"===S_.env?S_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===S_.env?S_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};dM.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,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};var uM,pM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 gM=uM=class{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new je).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Vt(t.deltaX)>Vt(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new He,e.addEventListener("wheel",this.scroll),this.params=uM.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(lM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new dM(v),h.name=a,e.add(h),h.isScrollBar=!0);const _=this.childrenBounds,{scrollX:y,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/_.width(),1),e=Math.max(Math.min(y/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/_.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=i{i(gM)||(t(gM).toSelf(),t(Nv).toService(gM))}));function mM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&mM(t,e)}))}const vM=t=>!d(t)&&!1!==t.visible;function _M(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function yM(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 xM=["#ffffff","#000000"];function SM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ti(t).toHex(),o=new ti(e).toHex();return kM(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(...xM);for(const n of a)if(t!==n&&kM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function kM(t,e,i,s,n){if("lightness"===n){const i=ti.getColorBrightness(new ti(e));return ti.getColorBrightness(new ti(t))<.5?i>=.5:i<.5}return s?AM(t,e)>s:"largeText"===i?AM(t,e)>3:AM(t,e)>4.5}function AM(t,e){const i=MM(t),s=MM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function MM(t){const e=ii(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function wM(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function TM(t,e){return[t[0]*e,t[1]*e]}function CM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function BM(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=Zt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const EM=(t,e,i,s)=>new Le(Object.assign({defaultFontParams:Object.assign({fontFamily:nM,fontSize:14},s),getTextBounds:i?void 0:gf,specialCharSet:"-/: .,@%'\"~"+Le.ALPHABET_CHAR_SET+Le.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function PM(t,e,i={}){if(!t)return{width:0,height:0};const s=gf({text:t,fontFamily:e.fontFamily||i.fontFamily||nM,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 RM(t,e="type"){var i,s;return p(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 OM(t){var e,i;return u(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function IM(t,e="type"){const i=RM(t,e);return"rich"===i?df.richtext(OM(t)):("html"===i?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"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),df.text(t))}function LM(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 DM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function FM(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 zM(t,e){const{dx:i,dy:s}=FM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function jM(){DA(),YA(),JA(),$A(),tM()}var HM=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);nc&&(w=c,O.setAttribute("maxLineWidth",c-b[1]-b[2]))),A=0,M=0;let H=0;"left"===z||"start"===z?H=1:"right"===z||"end"===z?H=-1:"center"===z&&(H=0),H?H<0?(A-=w,k&&k.setAttribute("x",(k.attribute.x||0)-I),S.setAttribute("x",-b[1]-B)):H>0&&S.setAttribute("x",b[3]):(A-=w/2,k&&k.setAttribute("x",(k.attribute.x||0)-I/2),S.setAttribute("x",-B/2));const V="right"===y||"end"===y,N="left"===y||"start"===y,W=(t,e)=>{"richtext"===O.type?O.setAttributes({x:t,textAlign:e,textConfig:G(O.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):O.setAttributes({x:t,textAlign:e})};if((y?"center"===y:_)&&H){const t=w-b[1]-b[3],e=I+B,i=1===H?(t-e)/2+B+I/2:b[0]+B-(w/2+e/2-B)+I/2;if(W(i,"center"),k){const t=i-I/2-B+F/2;k.setAttributes({x:t})}}if(N&&1!==H){const t=w-b[1]-b[3],e=0===H?-t/2+B/2:-w+b[3]+b[1]+B;if(W(e+B,"left"),k){const t=e+F/2;k.setAttributes({x:t})}}if(V&&-1!==H){const t=w-b[1]-b[3],e=0===H?t/2+B/2:t;if(W(e,"right"),k){const t=e-I-B+F/2;k.setAttributes({x:t})}}"middle"===j?(M-=T/2,k&&k.setAttribute("y",0)):"bottom"===j?(M-=T,k&&k.setAttribute("y",-L/2),S.setAttribute("y",-b[2])):"top"===j&&(S.setAttribute("y",b[0]),k&&k.setAttribute("y",L/2)),E(null==m?void 0:m.text)||(O.states=m.text);const{visible:U}=a,Y=HM(a,["visible"]);if(f&&h(U)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},Y),{visible:U&&!!s,width:w,height:T,x:A,y:M}),"rect");if(E(null==m?void 0:m.panel)||(t.states=m.panel),Y.customShape){const e=Y.customShape;t.pathProxy=t=>e(this,t,new Nl)}this._bgRect=t}this._textShape=O,this._symbol=k,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:z({},VM.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}VM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const NM={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}},WM={poptip:z({},NM)};var UM=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);nk?q=k:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(_(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),L.setAttribute("x",L.attribute.x+e),o.setAttribute("dx",Gt(Ut(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),L.setAttribute("y",L.attribute.y+e),o.setAttribute("dy",Gt(Ut(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?Ft/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:Ft/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?Ft/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?Ft/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:Ft/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?Ft/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?Ft:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:Ft,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?Ft:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}ZM.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"},panel:{},maxWidthPercent:.8,space:8,padding:10};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};let QM=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};z(s,ZM.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new ZM(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};z(e,WM.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,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),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}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}};QM=JM([$a()],QM);var tw=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 ew{constructor(){this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(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)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}let iw=class extends ew{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};iw=tw([$a()],iw);let sw=class extends ew{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}};sw=tw([$a()],sw);const nw=new La(((t,e,i,s)=>{i(QM)||(t(QM).toSelf().inSingletonScope(),t(hg).toService(QM)),i(iw)||(t(iw).toSelf(),t(Nv).toService(iw)),i(sw)||(t(sw).toSelf(),t(Nv).toService(sw))}));class rw extends Jy{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}DA(),HA();class aw extends rw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},aw.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})}}aw.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},DA(),YA();class ow extends rw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ow.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})}}ow.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},DA(),CA();class lw extends rw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},lw.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=ne.distancePP(t,e);this.setAttribute("radius",i)}}lw.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},DA(),CA();class hw extends rw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},hw.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=iM,endAngle:s=sM}=this.attribute,n=s-i,r=ae(ce(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}hw.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},DA(),NA();class cw extends rw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},cw.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=le(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=ne.distancePP(t,e);this.setAttribute("radius",i)}}function dw(){DA(),HA(),UA(),JA()}function uw(){DA(),HA(),CA(),JA()}cw.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},dw();class pw extends Jy{getStartAngle(){return de(this._startAngle)}getEndAngle(){return de(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},pw.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(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 n,r;const a=df.line(Object.assign(Object.assign({points:t},_(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),E(null==s?void 0:s.line)||(a.states=_(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=df.line;G(i)[0].cornerRadius&&(t=df.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},G(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),E(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:f=12}=t;let m,v;"start"===i?(m={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)):(m={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=df.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),E(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?E(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):E(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]:Z(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}}pw.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}}},uw();class gw extends pw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},pw.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=df.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"),E(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var fw,mw;!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.labelHoverOnAxis="axis-label-hover-on-axis",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",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(fw||(fw={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(mw||(mw={}));const vw={[mw.selectedReverse]:{},[mw.selected]:{},[mw.hover]:{},[mw.hoverReverse]:{}},_w={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}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},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}}},yw={size:8,stroke:"#000",lineWidth:1,zIndex:1};const bw=Math.sin(Math.PI/10);function xw(t,e=bw){const i=!d(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function Sw(t,e=bw){const i=!d(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function kw(t){const e={};return mM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function Aw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function Mw(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return TM(r,(s?-1:1)*(n?-1:1)*t/CM(r))}function ww(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function Cw(t,e,i){var s;if(Sw(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>De(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>De(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>Fe(n,r)}function Bw(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!E(s.states)?(s.addState(rM.hover,!0),mM(e,(t=>{t!==s&&t.name&&!E(t.states)&&t.addState(rM.hoverReverse,!0)})),s):i},Pw=(t,e,i)=>i?(mM(e,(t=>{t.name&&!E(t.states)&&(t.removeState(rM.hoverReverse),t.removeState(rM.hover))})),null):i,Rw=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(rM.selected)?(mM(e,(t=>{t.name&&!E(t.states)&&(t.removeState(rM.selectedReverse),t.removeState(rM.selected))})),null):s.name&&!E(s.states)?(s.addState(rM.selected,!0),mM(e,(t=>{t!==s&&t.name&&!E(t.states)&&t.addState(rM.selectedReverse,!0)})),s):i};class Ow extends Jy{_prepareAnimate(t){if(!1!==this.attribute.animation){const{animation:e,animationEnter:i,animationExit:s,animationUpdate:n}=this.attribute,r=p(e)?e:{};this._animationConfig={enter:!1!==i&&z({},t,r,null!=i?i:{}),exit:!1!==s&&z({},t,r,null!=s?s:{}),update:!1!==n&&(_(n)?n:z({},t,r,null!=n?n:{}))}}else this._animationConfig={enter:!1,exit:!1,update:!1}}}const Iw={type:"default",duration:300,easing:"linear"};class Lw extends Ow{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=Ew(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=Pw(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=Rw(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=df.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._prepare(),this._prevInnerView=this._innerView&&kw(this._innerView),this.removeAllChild(!0),this._innerView=df.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation()}_prepare(){this._prepareAnimate(Iw)}_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=df.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=fw.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=df.group({x:0,y:0,pickable:!1});t.name=fw.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",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=df.group({x:0,y:0,pickable:!1});i.name=fw.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=df.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=fw.tick,r.id=this._getNodeId(t.id),E(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=aM;else{const t=this.data[s],e=z({},aM,this.attribute.tick.state);Object.keys(e).forEach((i=>{c(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=df.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=fw.subTick,r.id=this._getNodeId(`${n}`),E(s.state))r.states=aM;else{const i=z({},aM,s.state);Object.keys(i).forEach((s=>{c(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&&c(s)&&(e=s(e,i));const n=this._transformItems(e),r=df.group({x:0,y:0,pickable:!1});return r.name=`${fw.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=IM(this._getLabelAttribute(t,e,n,i));if(a.name=fw.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),E(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=aM;else{const s=z({},aM,this.attribute.label.state);Object.keys(s).forEach((r=>{c(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new VM(Object.assign({},e));i.name=fw.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return Aw(t,this.getVerticalVector(e,i,t))}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&&c(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;Vt(s[0])>Vt(s[1])?o=Ft/2*(l.x>e.x?1:-1):h=Ft/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+P(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+P(this.attribute,"label.space",4))*s);const f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:_}=this.attribute.label;_=c(_)?z({},_w.label.style,_(t,e,i,s)):_;_=z(this.getLabelAlign(m,o,_.angle),_),c(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let y=_.react;return c(y)&&(y=y(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,_)),{text:null!=d?d:v,_originText:t.label,lineHeight:null==_?void 0:_.fontSize,type:h}),_),{react:y})}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}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},mM(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(e.setFinalAttributes(e.attribute),r){r.release();const i=r.attribute,a=e.getFinalAttribute(),o=function(t,e,i){const s={};for(const i in e)i in t&&N(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}(i,a);let l=Object.keys(o).length>0;if("opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l){this._newElementAttrMap[e.id]={state:"update",node:e,attrs:e.attribute};const i=r.attribute;e.setAttributes(i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}])}}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const Dw={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&&Cw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function Fw(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function zw(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=c(n)?n:Dw[n]||Dw.parity;if(s.length>=3&&Bw(s,r)){do{s=a(s,r)}while(s.length>=3&&Bw(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=Y(i);Cw(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),zw(l,s,n,(t=>Cw(t,l,r))),zw(h,s,o,(t=>Cw(t,h,r)||!(!n||t===l)&&Cw(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function Hw(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},Ww(t,e.attribute.angle)),{angle:Nw(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({},Uw(t,e.attribute.angle)),{angle:Nw(e.attribute.angle)}))}))}(t,e),function(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=Ae({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function Nw(t=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 Ww(t,e=0){let 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=Nw(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 Uw(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=Nw(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 Gw(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(E(t)||!k(i))return;const o=function(t){return k(t)?{left:t,right:t}:p(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!d(h),u=c?Math.cos(h):1,g=c?Math.sin(h):0,f=Sw(h),m=xw(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/g);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===_||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=g/u,l=Math.abs(i/g);if(y&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(u);r=Math.min(t,l)}else if(y&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(u);r=Math.min(t,l)}else r=l}else r=Math.abs(i/u);k(t.attribute.maxLineWidth)&&(r=k(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function Yw(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class Xw{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,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=CM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return TM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class $w{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-$w.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*$w.bounceIn(2*t):.5*$w.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ht*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ht/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ht*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Ht/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Ht*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ht/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Ht/e)*.5+1}}static registerFunc(t,e){$w[t]=e}}function Kw(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}$w.quadIn=$w.getPowIn(2),$w.quadOut=$w.getPowOut(2),$w.quadInOut=$w.getPowInOut(2),$w.cubicIn=$w.getPowIn(3),$w.cubicOut=$w.getPowOut(3),$w.cubicInOut=$w.getPowInOut(3),$w.quartIn=$w.getPowIn(4),$w.quartOut=$w.getPowOut(4),$w.quartInOut=$w.getPowInOut(4),$w.quintIn=$w.getPowIn(5),$w.quintOut=$w.getPowOut(5),$w.quintInOut=$w.getPowInOut(5),$w.backIn=$w.getBackIn(1.7),$w.backOut=$w.getBackOut(1.7),$w.backInOut=$w.getBackInOut(1.7),$w.elasticIn=$w.getElasticIn(1,.3),$w.elasticOut=$w.getElasticOut(1,.3),$w.elasticInOut=$w.getElasticInOut(1,.3*1.5),$w.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),$w.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},$w.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)$w[`flicker${t}`]=e=>Kw(e,t);for(let t=2;t<10;t++)$w[`aIn${t}`]=e=>t*e*e+(1-t)*e;function qw(t,e,i){return t+(e-t)*i}const Zw=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=qw(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=qw(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=qw(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=qw(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=qw(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=qw(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=qw(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=qw(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=qw(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=dp(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?pp(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=dp(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?pp(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=qw(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=qw(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=qw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=qw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=qw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=qw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=qw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=qw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=qw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=qw(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=qw(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=qw(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=qw(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=qw(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=qw(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=qw(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=td(e,i,s),r.addUpdateBoundTag()}}};function Jw(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.setAttributes(this.target.attribute)},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=$w[s])&&void 0!==n?n:$w.linear:$w.linear,"wait"===t&&(this.onUpdate=Qw),this.id=Ia.GenAutoIncrementId(),this.syncAttributeUpdate=Qw}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(v(i)&&v(s)){const n=hp.Get(i,lp.Color255),r=hp.Get(s,lp.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(Zw["fill"===e?"fillPure":"strokePure"])}else Zw[e]?t.push(Zw[e]):t.push(Jw)}else Zw[e]?t.push(Zw[e]):t.push(Jw)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate;this.target.animates.forEach((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const i=e.getStartProps();this.propKeys.forEach((t=>{null!=i[t]&&e.preventAttr(t)}))}))}deleteSelfAttr(t){var e;delete this.props[t],this.fromProps&&delete this.fromProps[t];const i=this.propKeys.indexOf(t);-1!==i&&(this.propKeys.splice(i,1),null===(e=this.interpolateUpdateFunctions)||void 0===e||e.splice(i,1))}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){this.target.setAttributes(this.props),t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class eT extends tT{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();this.target.setAttributes(t)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class iT extends o{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Ia.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Oo.END?this.removeAnimate(t,!0):t.status!==Oo.RUNNING&&t.status!==Oo.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const sT=new iT;sT.isGlobal=!0;class nT{constructor(t=Ia.GenAutoIncrementId(),e=sT,i){this.id=t,this.status=Oo.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){return this.target=t,this.target.animates||(this.target.animates=new Map),this.target.animates.set(this.id,this),this.onRemove((()=>{this.stop(),this.target.animates.delete(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new tT(Ro.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new eT(Ro.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new tT(Ro.from,t,e,i);return this._firstStep?(this._lastStep.append(s),this._lastStep=s):(this._firstStep=s,this._lastStep=s),this.updateDuration(),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Oo.RUNNING&&(this.status=Oo.PAUSED)}resume(){this.status===Oo.PAUSED&&(this.status=Oo.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this._preventAttrs.add(t),delete this._startProps[t],delete this._endProps[t];let e=this._firstStep;for(;e;)e.deleteSelfAttr(t),e=e.next}preventAttrs(t){t.forEach((t=>this._preventAttrs.add(t)))}validAttr(t){return!this._preventAttrs.has(t)}runCb(t){var e;return null===(e=this._lastStep)||void 0===e||e.onEnd(t),this}startAt(t){return this._startTime=t,this}customInterpolate(t,e,i,s,n,r){return!1}getFromValue(){return this._startProps}getToValue(){return this._endProps}stop(t){let e=this._firstStep;for(;e;)e.stop(),e=e.next;this.status!==Oo.END&&this.onEnd(),this.status=Oo.END,this.target&&("start"===t?this.target.setAttributes(this._startProps):"end"===t?this.target.setAttributes(this._endProps):t&&this.target.setAttributes(t))}release(){this.status=Oo.END,this._onRemove&&this._onRemove.forEach((t=>t())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Oo.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),void(this.status=Oo.END);this.status=Oo.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&this.target.setAttributes(this._startProps);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const rT=new ko;class aT{constructor(){this.released=!1}tick(t,e){rT.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class oT extends o{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Po.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Po.INITIAL,xo.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),xo.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new aT;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Po.INITIAL&&(this.status=Po.PAUSE,!0)}resume(){return this.status!==Po.INITIAL&&(this.status=Po.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Po.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Po.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Po.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Po.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Po.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Po.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,xo.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}function dT(t){if(!t||!c(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1}return 2}cT.getInstance();class uT{static registerBuiltInAnimate(t,e){uT.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;_(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:uT.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=dT(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:uT.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=dT(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=k(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){Array.isArray(t)?t.forEach((t=>this._execute(t))):this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,d,u;const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:_=0,duration:y=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:k,priority:A=0,options:M,custom:w,customType:T,controlOptions:C}=t,B=e.animate();B.priority=A;const E=c(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],R=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&R&&(i=null!==(h=P[R])&&void 0!==h?h:i),B.startAt(b);const O=i*x+E;O>0&&B.wait(O);let I=null,L=t.to,D=t.from;L||(I||(I=this.createPropsFromChannel(g,e)),L=I.props),D||(I||(I=this.createPropsFromChannel(g,e)),D=I.from),I.attrOutChannel&&e.setAttributes(I.attrOutChannel),this._handleRunAnimate(B,w,T,D,L,y,m,f,C,M,p,e);let F=0;x&&(F=x*(s-i-1));const z=c(_)?_(null===(u=null===(d=e.context)||void 0===d?void 0:d.data)||void 0===u?void 0:u[0],e,{}):_;return z>0&&(F+=z),F>0&&B.wait(F),S&&S>0&&B.loop(S),k&&B.bounce(!0),B}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,d,u){var p,g,f,m,v,_,y,b;if(e&&i){i=dT(e);let d=this.resolveValue(o,u);"function"==typeof d&&(d=d(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),d=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},d);const x=c(h)?h.call(null,null!==(_=d&&(null===(v=d.data)||void 0===v?void 0:v[0]))&&void 0!==_?_:null===(b=null===(y=u.context)||void 0===y?void 0:y.data)||void 0===b?void 0:b[0],u,d):h;d.options=x,d.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,d):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,d)}else"to"===d?t.to(n,r,a):"from"===d&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:d=0,delayAfter:u=0}=t,p=c(d)?d(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):d,g=c(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;u||(d||(d=this.createPropsFromChannel(a,i)),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i)),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const g=null!==(n=t.custom)&&void 0!==n?n:uT.builtInAnimateMap[r],f=t.custom?t.customType:dT(g);this._handleRunAnimate(e,g,f,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e){var i;const s={};let n=null;if(!t)return{from:n,props:s,attrOutChannel:null};const r={};let a=!1;const o=null===(i=e.context)||void 0===i?void 0:i.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===o[e]||(t[e]={to:o[e]}),t)),{})),Object.keys(t).forEach((i=>{var r,a,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?s[i]=h.to(null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,{}):s[i]=h.to),void 0!==h.from&&(n||(n={}),"function"==typeof h.from?n[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):n[i]=h.from)})),o)for(const t in o){const e=o[t];void 0!==e&&(s.hasOwnProperty(t)||(r[t]=e,a=!0))}return{from:n,props:s,attrOutChannel:a?r:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}executeItem(t,e,i=0,s=1){return Array.isArray(t)?t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean):[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Oo.END),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}uT.builtInAnimateMap={};const pT="appear",gT="disappear",fT="update",mT="highlight",vT="unhighlight";class _T{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class yT{constructor(t){this.stateList=null,this.graphic=t}applyState(t,e,i){const s=cT.getInstance(),n=[],r=[];if(this.stateList&&this.stateList.length?t.forEach(((t,i)=>{const a={allowTransition:!0,stopOriginalTransition:!0};this.stateList.forEach((e=>{const i=s.isTransitionAllowed(e.state,t,this.graphic);a.allowTransition=a.allowTransition&&i.allowTransition})),a.allowTransition&&(r.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new uT(this.graphic)}),this.stateList.forEach((e=>{s.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&n.push(e)})))})):t.forEach(((t,i)=>{r.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new uT(this.graphic)})})),n.forEach((t=>{t.executor.stop(null,!1)})),r.length){r[0].executor.execute(r[0].animationConfig);for(let t=0;t{e&&e.executor.execute(e.animationConfig),this.stateList=this.stateList.filter((t=>t!==s)),t===r.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!n.includes(t))):this.stateList=[],this.stateList.push(...r)}applyAppearState(t,e){this.applyState([pT],[{name:pT,animation:t}],e)}applyDisappearState(t,e){this.applyState([gT],[{name:gT,animation:t}],e)}applyUpdateState(t,e){this.applyState([fT],[{name:fT,animation:t}],e)}applyHighlightState(t,e){this.applyState([mT],[{name:mT,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([vT],[{name:vT,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class bT{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new yT(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new _T(t)),t._animationStateStore}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return(new bT)._getAnimationStateManager(t),t}}class xT{getAttributes(t=!1){return t&&this.finalAttribute?this.finalAttribute:this.attribute}animate(t){var e,i,s;const n=new nT(null==t?void 0:t.id,null!==(i=null!==(e=null==t?void 0:t.timeline)&&void 0!==e?e:this.stage&&this.stage.getTimeline())&&void 0!==i?i:sT,null==t?void 0:t.slience);if(n.bind(this),t){const{onStart:e,onEnd:i,onRemove:s}=t;null!=e&&n.onStart(e),null!=i&&n.onEnd(i),null!=s&&n.onRemove(s)}return null===(s=this.stage)||void 0===s||s.ticker.start(),n}createTimeline(){return new iT}createTicker(t){return new oT(t)}setFinalAttributes(t){this.finalAttribute||(this.finalAttribute={}),Object.assign(this.finalAttribute,t)}initFinalAttributes(t){this.finalAttribute=t}initAnimateExecutor(){this._animateExecutor||(this._animateExecutor=new uT(this))}executeAnimation(t){return this.initAnimateExecutor(),this._animateExecutor.execute(t),this}executeAnimations(t){return this.initAnimateExecutor(),t.forEach((t=>{this._animateExecutor.execute(t)})),this}getFinalAttribute(){return this.finalAttribute}getGraphicAttribute(t,e=!1){return!e&&this.finalAttribute?this.finalAttribute[t]:this.attribute[t]}pauseAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function ST(){U(Cp,bT),U(Cp,xT)}class kT extends tT{constructor(t,e,i,s,n){super("customAnimate",e,i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class AT extends kT{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class MT extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0,this.checkStatusAfterRender=!0,this._beforeStageRender=()=>{if(!this.willCallBeforeStageRender)return;this.willCallBeforeStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.beforeStageRender(t,e);i&&this.renderToStage(t,i)},this._afterStageRender=()=>{if(!this.willCallAfterStageRender)return;this.willCallAfterStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.afterStageRender(t,e);i&&this.renderToStage(t,i),this.checkStatusAfterRender&&this.animate.status===Oo.END&&this.animate.timeline.removeAnimate(this.animate)},this.props={}}beforeStageRender(t,e){return!1}afterStageRender(t,e){return!1}onFirstRun(){super.onFirstRun(),this.target.stage.setBeforeRender(this._beforeStageRender),this.target.stage.setAfterRender(this._afterStageRender),this.target.stage.disableDirtyBounds()}stop(){super.stop(),this.target.stage.removeBeforeRender(this._beforeStageRender),this.target.stage.removeAfterRender(this._afterStageRender)}onUpdate(t,e,i){super.onUpdate(t,e,i),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0}renderToStage(t,e){const i=t.window.getContext().canvas.nativeCanvas,s=i.getContext("2d");return!!s&&(s.clearRect(0,0,i.width,i.height),s.drawImage(e,0,0),i)}}class wT{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new uT(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttr(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function TT(t){return new wT(t)}class CT extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,this.target.setAttribute("text",n)}}const BT=1e3,ET="quadInOut",PT=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],RT=(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=dp(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},OT=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?Q_(t):[],n=Q_(e);i&&s&&(i.fromTransform&&ty(s,i.fromTransform.clone().getInverse()),ty(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})))},LT=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],DT=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!LT.includes(n))return;const r=e[n];if(!d(r)&&!d(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?hp.Get(t,lp.Color255):t;i.push({from:_(t[n])?t[n].map(e):e(t[n]),to:_(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class FT extends kT{constructor(t,e,i){super({},{},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;OT(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&RT(this.otherAttrs,i,e),this.target.setAttributes(i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const zT=(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=IT(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=DT(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new FT({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:BT,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:ET);return c.play(d),c};class jT extends kT{constructor(t,e,i){super({},{},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;OT(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&&RT(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const HT=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>PT.includes(t))(i)||(e[i]=t[i])})),e},VT=(t,e,i)=>{const s=HT(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),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=xo.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},NT=(t,e,i)=>{const s=[],n=i?null:HT(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:HT(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=Pg(t.attribute),n=iy(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(xo.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=iy(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(xo.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=iy(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(xo.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 sy(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 sy(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(xo.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:ny(i)}];const s=[];return ay(i,e,s),s})(t,e).forEach((t=>{s.push(xo.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&&x(t.x)&&x(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 ay(l,e,h),h})(t,e).forEach((t=>{s.push(xo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=Q_(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(xo.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(xo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&VT(t,s,e),s};class UT extends kT{constructor(t,e,i,s,n){super(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(){super.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:$o.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:$o.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:$o.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class GT extends UT{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;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 k=0,A=0;"anticlockwise"===S?(A="in"===b?x+2*Math.PI:x,A=x+2*Math.PI):(k=x,A="out"===b?x+2*Math.PI:x);const M=xo.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!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:y/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(_+y)/2,innerRadius:0,startAngle:k,endAngle:A,fill:!0});let w,T;"anticlockwise"===S?(w={startAngle:x+2*Math.PI},T={startAngle:x}):(w={endAngle:x},T={endAngle:x+2*Math.PI}),super("in"===b?w:T,"in"===b?T:w,i,s,{group:null==n?void 0:n.group,clipGraphic:M})}}class YT extends UT{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:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=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=xo.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:f,height:"in"===v&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===y?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class XT extends kT{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){super.onBind();const{points:t,segments:e}=this.target.attribute,{points:i,segments:s}=this.target.getFinalAttribute();this.from={points:t,segments:e},this.to={points:i,segments:s},this.props=this.to;const n=this.getPoints(this.from),r=this.getPoints(this.to,!0);this.fromPoints=n?Array.isArray(n)?n:[n]:[],this.toPoints=r?Array.isArray(r)?r:[r]:[];const a=new Map;this.fromPoints.forEach((t=>{t.context&&a.set(t.context,t)}));let o,l,h=1/0,c=-1/0;for(let t=0;t=0;t-=1)if(a.has(this.toPoints[t].context)){c=t,l=a.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(c)?(this.clipRange=this.toPoints[c][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[c][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=mt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let d=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=a.get(t.context);return i?(d=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ec&&l?[l,t]:[d,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new se(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(t)return Object.keys(this.to).forEach((t=>{this.target.attribute[t]=this.to[t]})),this.target.addUpdatePositionTag(),void this.target.addUpdateShapeAndBoundsTag();if(this.points=this.points.map(((t,i)=>{const s=Qc(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));this.target.setAttributes({clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.target.attribute.segments=e}else this.target.attribute.points=this.points;this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class $T extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0}));const o=this.target.getFinalAttribute();o&&this.target.setAttributes(o),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(a)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class KT extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Object.assign(this.target.attribute,i),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class qT extends $T{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class ZT extends KT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}class JT extends $T{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"],this.from={opacity:0,fillOpacity:0,strokeOpacity:0}}}class QT extends KT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"]}}const tC=(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.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=x(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=x(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.getFinalAttribute();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)};class eC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this._updateFunction=null}updateStartAngle(t){this.target.attribute.startAngle=this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t}updateEndAngle(t){this.target.attribute.endAngle=this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class iC extends eC{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=tC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r),this.determineUpdateFunction()}}class sC extends eC{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=x(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class nC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:u(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:u(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return u(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),u(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:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class rC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:u(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:u(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return u(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),u(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const aC=(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,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?x(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=x(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:d(l)?void 0:c,height:d(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class oC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=aC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class lC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?x(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=x(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:d(o)?void 0:h,height:d(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const hC=(t,e,i)=>{const s=t.getFinalAttribute().points,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.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class cC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(this.target.attribute.points=r.map(((t,i)=>Qc(r[i],a[i],e))),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class dC extends cC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:hC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class uC extends cC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:hC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const pC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class gC extends cC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:pC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class fC extends cC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:pC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const mC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class vC extends cC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:mC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class _C extends cC{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:mC(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const yC=(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.getFinalAttribute(),n=x(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.getFinalAttribute();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)};class bC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class xC extends bC{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=yC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}}class SC extends bC{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const kC=(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.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?x(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=x(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:d(a)?void 0:l,width:d(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class AC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=kC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class MC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?x(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=x(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class wC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c;let d,u;super.onBind();const p=this.target.getFinalAttribute(),g=null!==(t=this.target.attribute)&&void 0!==t?t:{};switch(null===(e=this.params)||void 0===e?void 0:e.direction){case"x":d={scaleX:null!==(i=g.scaleX)&&void 0!==i?i:0},u={scaleX:null!==(s=null==p?void 0:p.scaleX)&&void 0!==s?s:1},this._updateFunction=this.updateX;break;case"y":d={scaleY:null!==(n=g.scaleY)&&void 0!==n?n:0},u={scaleY:null!==(r=null==p?void 0:p.scaleY)&&void 0!==r?r:1},this._updateFunction=this.updateY;break;default:d={scaleX:null!==(a=g.scaleX)&&void 0!==a?a:0,scaleY:null!==(o=g.scaleY)&&void 0!==o?o:0},u={scaleX:null!==(l=null==p?void 0:p.scaleX)&&void 0!==l?l:1,scaleY:null!==(h=null==p?void 0:p.scaleY)&&void 0!==h?h:1},this._updateFunction=this.updateXY}const f=this.target.getFinalAttribute();f&&this.target.setAttributes(f),this.props=u,this.from=d,this.to=u,!1!==(null===(c=this.params.controlOptions)||void 0===c?void 0:c.immediatelyApply)&&this.target.setAttributes(d)}onEnd(t){super.onEnd(t)}updateX(t){this.target.attribute.scaleX=this.from.scaleX+(this.to.scaleX-this.from.scaleX)*t}updateY(t){this.target.attribute.scaleY=this.from.scaleY+(this.to.scaleY-this.from.scaleY)*t}updateXY(t){this.updateX(t),this.updateY(t)}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateXY:"scaleX"===this.propKeys[0]?this._updateFunction=this.updateX:"scaleY"===this.propKeys[0]?this._updateFunction=this.updateY:this._updateFunction=null}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag())}}class TC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n;let r,a;super.onBind();const o=this.target.attribute;switch(null===(t=this.params)||void 0===t?void 0:t.direction){case"x":r={scaleX:null!==(e=null==o?void 0:o.scaleX)&&void 0!==e?e:1},a={scaleX:0};break;case"y":r={scaleY:null!==(i=null==o?void 0:o.scaleY)&&void 0!==i?i:1},a={scaleY:0};break;default:r={scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1,scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1},a={scaleX:0,scaleY:0}}this.props=a,this.from=r,this.to=a}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}}class CC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}class BC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e;super.onBind();let{diffAttrs:i={}}=null!==(t=this.target.context)&&void 0!==t?t:{};const{options:s}=this.params;i=Object.assign({},i),(null===(e=null==s?void 0:s.excludeChannels)||void 0===e?void 0:e.length)&&s.excludeChannels.forEach((t=>{delete i[t]})),this.props=i}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i)}}class EC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class PC extends EC{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:d,excludeChannels:u=[],layoutRect:p={}}=null!=e?e:{};let g=0,f=0;"negative"===l&&(g=null!==(s=p.width)&&void 0!==s?s:t.stage.viewWidth,f=null!==(n=p.height)&&void 0!==n?n:t.stage.viewHeight),g+=o,f+=o;const m=c(d)?d.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):d,v=t.getGraphicAttribute("x"),_=t.getGraphicAttribute("y"),y=u.includes("x")?v:m&&k(m.x)?m.x:g,b=u.includes("y")?_:m&&k(m.y)?m.y:f;switch(h){case"x":return{from:{x:u.includes("x")?v:y},to:{x:v}};case"y":return{from:{y:b},to:{y:_}};default:return{from:{x:y,y:b},to:{x:v,y:_}}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}}class RC extends EC{onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:d}=null!=e?e:{},u=i.group?i.group.AABBBounds:null,p=null!==(s=u.width())&&void 0!==s?s:i.width,g=null!==(n=u.height())&&void 0!==n?n:i.height,f=("negative"===l?p:0)+o,m=("negative"===l?g:0)+o,v=c(d)?d.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):d,_=v&&k(v.x)?v.x:f,y=v&&k(v.y)?v.y:m;switch(h){case"x":return{from:{x:t.getGraphicAttribute("x")},to:{x:_}};case"y":return{from:{y:t.getGraphicAttribute("y")},to:{y:y}};default:return{from:{x:t.getGraphicAttribute("x"),y:t.getGraphicAttribute("y")},to:{x:_,y:y}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=t,this.to=e}}class OC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class IC extends OC{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=ut(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(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:n},to:{angle:s}}})(this.target,this.params.options);this.props=i,this.propKeys=["angle"],this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}}class LC extends OC{onBind(){super.onBind();const{from:t,to:e}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=ut(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(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:n}}})(this.target,this.params.options);this.props=e,this.propKeys=["angle"],this.from=t,this.to=e}}class DC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.from=null!=t?t:{}}onBind(){var t,e;super.onBind(),Object.keys(this.from).forEach((t=>{null==this.props[t]&&(this.props[t]=this.target.getGraphicAttribute(t))}));const i=this.target.getFinalAttribute();"appear"===(null===(t=this.target.context)||void 0===t?void 0:t.animationState)&&i&&this.target.setAttributes(i),!1!==(null===(e=this.params.controlOptions)||void 0===e?void 0:e.immediatelyApply)&&this.target.setAttributes(this.from)}onFirstRun(){this.from=Object.assign(Object.assign({},this.getLastProps()),this.from);const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.from[e]=null!==(i=this.from[e])&&void 0!==i?i:t[e]})),this.target.setAttributes(this.from)}deleteSelfAttr(t){super.deleteSelfAttr(t),delete this.from[t]}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.from,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.from[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}class FC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=xo.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Nl,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=xo.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_;const y=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(y){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:$o.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(_=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==_?_:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:$o.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=ll(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=ll(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(ne.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(ne.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;e{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=df.group({zIndex:999});e.name=fw.axisBreak,e.id=this._getNodeId(`${fw.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=z({},yw,s),a=null!==(e=r.size)&&void 0!==e?e:yw.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=df.symbol(Object.assign({x:s.x,y:s.y},o));l.name=fw.axisBreakSymbol;const h=df.symbol(Object.assign({x:n.x,y:n.y},o));h.name=fw.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=df.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=fw.background,n.id=this._getNodeId("background"),n.states=z({},vw,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new VM(Object.assign({},t));e.name=fw.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=VC(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];E(l)||(c.state={line:z({},vw,l),symbol:z({},vw,l)});const d=new pw(c);d.name=fw.line,d.id=this._getNodeId("line"),t.add(d)}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}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:u}=s,p=VC(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),_=this.getRelativeVector();let y=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+P(this.attribute,"label.space",4);y+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===_[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?y+=i+(e-1)*t:y=0}else if(0===_[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;y+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}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.getActualOffset(x),A=this.getVerticalCoord(v,S,!1),M=this.getVerticalVector(S,!1,{x:0,y:0});let w,T,{angle:C}=p;if(w="start"===n?"start":"end"===n?"end":"center",d(C)&&o){C=BM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;T=1==-1*t?"bottom":"top"}else w=this.getTextAlign(M),T=this.getTextBaseline(M,!1);let B=u;if(d(B)){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(C!==Math.PI/2){const t=Math.abs(Math.cos(null!=C?C:0));B=t<1e-6?1/0:this.attribute.end.x/t}else B=s-S;else if(C&&0!==C){const t=Math.abs(Math.sin(C));B=t<1e-6?1/0:this.attribute.end.y/t}else B=s-S}const E=Object.assign(Object.assign(Object.assign({},A),p),{maxWidth:B,textStyle:Object.assign({textAlign:w,textBaseline:T},a),state:{text:z({},vw,c.text),shape:z({},vw,c.shape),panel:z({},vw,c.background)}});return E.angle=C,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}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:u}=s,p=VC(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),_=this.getVerticalVector(m,!1,{x:0,y:0});let y,{angle:b}=p,x="center";if(d(b)&&a){b=BM(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;y=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(_,!1,o.angle);x=t,y=e}const S=u,k=h?h(c):c,A=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:y},o),text:k});return A.angle=b,l&&l.visible&&(A.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),A}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 Ww(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return Uw(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=Y(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(E(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:d,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(c(h))h(t,e,s,this);else{if(d)!function(t,e){if(E(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,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=re(e)})),Vw(i,t),!Hw(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(E(t)||!k(i))return;const a=t[0].attribute.angle,o=Sw(a),l=xw(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=Yw(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);k(i)&&(c=Gt(c,i))}}else{if(l){const i=Yw(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);k(i)&&(c=Gt(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&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);Gw(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||d?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&jw(t,{orient:o,method:m,separation:v,lastVisible:_,firstVisible: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=df.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=fw.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(u(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(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 f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=PM(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=ni(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(){super.release(),this._breaks=null}}NC.defaultAttributes=_w,U(NC,Xw);class WC{isInValidValue(t){const{startAngle:e=iM,endAngle:i=sM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=iM,endAngle:i=sM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return le(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return Mw(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function UC(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=UC(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var XC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),k(l)&&l>=3){const t=ww(n,l,c,e,i);h=df.path(Object.assign(Object.assign({},a.style),{path:Tw(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=df.circle(t)}h.name=fw.line,h.id=this._getNodeId("line"),E(a.state)||(h.states=z({},vw,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:u={}}=a,p=XC(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=P(this.attribute.label,"style.fontSize",12)+P(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=n+m+f+o;let _="middle",{position:y}=this.attribute.title;d(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({},vw,u.text),shape:z({},vw,u.shape),panel:z({},vw,u.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;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(ut(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=UC(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&GC(e,c,i)}else e.AABBBounds.width()>r&&GC(e,r,i)}else o>a.x&&h.x2>n.x2?(GC(e,n.x2-o,i),r&&YC(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return ut(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}$C.defaultAttributes=_w,U($C,WC);const KC=t=>t.map(((t,e)=>({index:e,value:t}))),qC=(t,e,i=0)=>{const s=new He(t).expand(i/2),n=new He(e).expand(i/2);return s.intersects(n)},ZC=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=re(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,m=0;u||(p?(g=0,m=1):c&&(g=Math.cos(c),m=-Math.sin(c)));const v=EM(a),_=t.range();let y=[];for(let i=0;i{tB[t]=!0}));const rB=t=>-Math.log(-t),aB=t=>-Math.exp(-t),oB=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,lB=t=>10===t?oB:t===Math.E?Math.exp:e=>Math.pow(t,e),hB=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),cB=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),dB=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function uB(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 pB(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function gB(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function fB(t,e,i,s){return 1===i&&(i=0),gB(t,i,s)*(e/(1-i))}function mB(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function vB(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=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 yB{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=mB(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):u(this._rangeFactorStart)&&u(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return d(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(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 d(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(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=mt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=d(s)?(l-o)*i:s;let u=Math.exp(e);u=u/(u-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=u*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const bB=Symbol("implicit");class xB extends yB{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=QC.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=bB}clone(){const t=(new xB).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return u(this._rangeFactorStart)&&u(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!==bB)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&&a>1;)a-=1,r=Math.floor((e-t)/a);return SB(t,e,r,n)}class AB extends xB{constructor(t){super(),this.type=QC.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=fB(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(u(this._rangeFactorStart)&&u(this._rangeFactorEnd)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("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),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]}}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(u(this._rangeFactorStart)&&u(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=[tt(t[0]),tt(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[tt(t[0]),tt(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:kB(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=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(t=10){const e=this.calculateVisibleDomain(this._range);return kB(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=_t(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,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 d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return d(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&&x(this._userBandwidth)}clone(){var t,e,i;return new AB(!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:MB}=si;function wB(t,e){const i=typeof e;let s;if(d(e)||"boolean"===i)return()=>e;if("number"===i)return St(t,e);if("string"===i){if(s=ti.parseColorString(e)){const e=MB(ti.parseColorString(t),s);return t=>e(t).formatRgb()}return St(Number(t),Number(e))}return e instanceof ei?MB(t,e):e instanceof ti?MB(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 TB extends yB{constructor(t=nB,e=nB){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=nB,this._piecewise=pB,this._interpolate=wB}calculateVisibleDomain(t){var e;return u(this._rangeFactorStart)&&u(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,tt);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=_t(i[0],i[r-1])),this._piecewise=r>2?vB:pB,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:nB),this.rescale(i)):this._clamp!==nB}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=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 d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const CB=Math.sqrt(50),BB=Math.sqrt(10),EB=Math.sqrt(2),PB=[1,2,5,10],RB=(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=DB(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)),J(0,e).map((t=>n+t*s))):t>0?IB(0,-(e-1)/s,s):IB((e-1)/s,0,s)},OB=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 RB(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return RB(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=IB(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=IB(t,e,l);return n&&r.reverse(),r})),DB=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=PB[0];return i>=CB?s=PB[3]:i>=BB?s=PB[2]:i>=EB&&(s=PB[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function FB(t,e,i){const s=(e-t)/Math.max(0,i);return DB(s)}function zB(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;e0;){if(s=FB(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function HB(t,e){const i=x(e.forceMin),s=x(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:x(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:x(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),x(r[0])&&x(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=x(r[0])||x(r[1])?x(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const VB=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),NB=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})),WB=ft(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=LB(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?VB(t,e,n):VB(t,e,_B(n)),h=VB(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),UB=ft(((t,e,i,s,n)=>zB(s(t),s(e),i).map((t=>_B(n(t))))));class GB extends TB{constructor(){super(...arguments),this.type=QC.Linear}clone(){var t;const e=new GB;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return OB(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(c(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(u(this._rangeFactorStart)&&u(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=LB(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(t=10){const e=this.calculateVisibleDomain(this._range);return zB(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(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r: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}}function XB(t){return e=>-t(-e)}function $B(t=Number.EPSILON){return e=>Math.max(e,t)}class KB extends TB{constructor(){super(hB(10),lB(10)),this.type=QC.Log,this._limit=$B(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new KB).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=hB(this._base),s=lB(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=XB(i),this._pows=XB(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=rB,this.untransformer=aB):(this._logs=i,this._pows=s,this._limit=$B(),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 nB}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return NB(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return WB(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return UB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return UB(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{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))))}}}U(KB,YB);class qB extends GB{constructor(){super(cB(1),dB(1)),this.type=QC.Symlog,this._const=1}clone(){return(new qB).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=cB(t),this.untransformer=dB(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return NB(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return WB(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return UB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return UB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}U(qB,YB);class ZB{constructor(){this.type=QC.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!d(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 ZB).domain(this._domain).range(this._range).unknown(this._unknown)}}function JB(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function QB(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!eB(t.type))return KC(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return KC([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:d,noDecimals:p=!1,labelStyle:g,breakData:f}=e;let m;if(u(d))v=t.stepTicks(d),_=f&&f()?f().breakDomains:null,m=_&&_.length?v.filter((t=>_.every((e=>te[1])))):v;else if(u(h))m=JB(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=c(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=JB(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:p}):t.d3Ticks(e,{noDecimals:p})))}else{const i=null!==(s=c(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=c(e.tickMode)?e.tickMode:void 0;m=JB(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:p,customTicks:n}):t.ticks(e,{noDecimals:p,customTicks:n})))}var v,_;const y=t.domain();if(e.labelFirstVisible&&y[0]!==m[0]&&!m.includes(y[0])&&m.unshift(y[0]),e.labelLastVisible&&y[y.length-1]!==m[m.length-1]&&!m.includes(y[y.length-1])&&m.push(y[y.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=JC(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=JC(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=Y(l),r=f&&f()?eE.greedy:eE.parity;for(;l.length>=3&&Bw(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;Cw(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),QB(t,l,a,(e=>Cw(e,t,i))),QB(n,l,o,(e=>Cw(e,n,i)||!(!a||e===t)&&Cw(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),Y(h)!==Y(m)&&h.push(Y(m))),m=h}}return KC(m)},eE={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&Cw(i,t,e)||(i=t,0))))}},iE=(t,e,i,s)=>{const n=JC(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},sE=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,nE=(t,e)=>t[1]{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,p=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?KC([s[s.length-1]]):KC([s[0]]);let m;if(u(a))m=t.stepTicks(a);else if(u(r))m=t.forceTicks(r);else if(u(n)){const e=c(n)?n({axisLength:f,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=$(g),a=X(g);if(s.length<=f/n){const i=iE(t,s,e,p);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=aE(s,i,o,e.labelLastVisible,Math.floor(n/l),!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=iE(t,i,e,p);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!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])){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&&!sE(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?nE(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{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=EM(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=le({x:0,y:0},i,t),a=Aw(r,Mw(s,r,e,n));return o=a,l=Mw(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return _.align||(ut(y,f.x)?_.baseline||(_.baseline=b>f.y?"top":"bottom"):y>f.x?_.align="left":y{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||h<=0)return KC(t.domain());let d;if(u(n))d=t.stepTicks(n);else if(u(s))d=t.forceTicks(s);else if(u(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=c(i)?i({axisLength:s,labelStyle:l}):i;d=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=oE(t,i,e),r=$(s),l=X(s),c=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=hE(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/c));d=t.stepTicks(u),d=d.slice(0,d.length-p)}else d=t.domain();return KC(d)},hE=(t,e,i,s)=>{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&&qC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},cE=new Uint32Array(33),dE=new Uint32Array(33);dE[0]=0,cE[0]=~dE[0];for(let t=1;t<=32;++t)dE[t]=dE[t-1]<<1|1,cE[t]=~dE[t];function uE(t,e,i={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:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&cE[31&o]&dE[1+(31&l)])return!0}else{if(i[h]&cE[31&o])return!0;if(i[c]&dE[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,cE[31&o]&dE[1+(31&l)]);else for(s(h,cE[31&o]),s(c,dE[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,dE[31&a]|cE[1+(31&o)]);else for(n(l,dE[31&a]),n(h,cE[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=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 pE(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=mt(i,-o,t.width+l),d=mt(s,-o,t.width+l),u=mt(n,-a,t.height+h),p=mt(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function gE(t,e,i=!1){return i?pE(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function fE(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=gE(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=pE(t,r)),e.getRange(r)))}function mE(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>u(t))),p=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return mE(t,e,n,o,h,d,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?c(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return mE(t,e,n,s,h,d)}if("moveX"===i.type){const s=(i.offset?c(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return mE(t,e,n,s,h,d)}return!1}const _E=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],yE=["top","inside-top","inside"];function bE(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let _=0,y=0;return u<0-h?_=-u:p>m&&(_=m-p),g<0-l?y=-g:f>v&&(y=v-f),{dx:_,dy:y}}const xE={mode:"same-time",duration:300,easing:"linear"};function SE(t){return 3===t||4===t}function kE(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 AE=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 ME(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)}}var wE=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{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const BE=(t,e)=>Math.ceil(t)>Math.floor(e),EE=([t,e],[i,s])=>s>t&&e>i;function PE(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}var RE=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{const e=t.target;e===this._lastHover||E(e.states)||(e.addState(rM.hover,!0),mM(this,(t=>{t===e||E(t.states)||t.addState(rM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(mM(this,(t=>{E(t.states)||(t.removeState(rM.hoverReverse),t.removeState(rM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void mM(this,(t=>{E(t.states)||(t.removeState(rM.selectedReverse),t.removeState(rM.selected))}));E(e.states)||(e.addState(rM.selected,!0),mM(this,(t=>{t===e||E(t.states)||t.addState(rM.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)===$o.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===$o.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(xe(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,f=p-d;return[ME(g,f,c,d,a,o),ME(-g,-f,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds)}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=df.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Nl)}return e&&e.getAttributes(!0).fill&&s.setAttribute("stroke",e.getAttributes(!0).fill),this.attribute.line&&!E(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),d(this._idToGraphic)||this._isCollectionBase&&d(this._idToPoint))return;const t=[];!1!==this._enableAnimation&&this._baseMarks.forEach((e=>{t.push(e.attribute),e.initAttributes(e.getAttributes(!0))}));const{overlap:e,smartInvert:i,dataFilter:s,customLayoutFunc:n,customOverlapFunc:r}=this.attribute;let a=this.attribute.data;if(c(s)&&(a=s(a)),a&&a.length){const t=new Set;a=a.filter((e=>!t.has(e.id)&&t.add(e.id)))}let o=this._initText(a);o=c(n)?n(a,o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(o);const l=[],u=o;if(!h(e)&&c(null==e?void 0:e.filterBeforeOverlap)){const t=this.getRelatedGraphic.bind(this);o.forEach((i=>{e.filterBeforeOverlap(i,t,this)?u.push(i):l.push(i)}))}c(r)?o=r(u,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(l):!1!==e&&(o=this._overlapping(u).concat(l)),c(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),o&&o.length&&o.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==i&&this._smartInvert(o),this._renderLabels(o),!1!==this._enableAnimation&&this._baseMarks.forEach(((e,i)=>{e.initAttributes(t[i])}))}_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&&!E(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!E(e)&&(t.states=e)}_createLabelText(t){var e,i;return IM(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;const i=[];let s;if(s=c(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),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&BE(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&BE(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(ut(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(PE([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!EE([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let y=0,b=t.length-1;for(;y<=b;)y===b?_.push(t[y]):(_.push(t[y]),_.push(t[b])),y++,b--;return _}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&s.setRange(gE(i,t.AABBBounds,!0))}))),h.length>0&&h.forEach((t=>{v(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&&s.setRange(gE(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(gE(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){var s;if(t){if(!1!==t.attribute.visible){if(null===(s=t.context)||void 0===s?void 0:s.animationState){const e=t.clone();return Object.assign(e.attribute,t.getAttributes(!0)),e.AABBBounds}return t.AABBBounds}const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:n,y:r}=e;return{x1:n,x2:n,y1:r,y2:r}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=p(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:g}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{IE[t]=e};var DE=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{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,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*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}FE.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const zE=()=>{LE("symbol",FE),LE("line-data",FE)};var jE=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{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}})(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}}}HE.tag="rect-label",HE.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var VE=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{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=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}}(t,e,i,s)}};NE.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const WE=()=>{LE("line",NE),LE("area",NE)};var UE=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);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=c(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=c(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const d=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}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),h=l.getAttributes(!0),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!d(s[i])&&!d(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,d=h.endAngle-h.startAngle,p=pe(h.endAngle-d/2),g=le(c,h.outerRadius,o),f=le(c,a+e.line.line1MinLength,o),m=new GE(t,g,f,p,d,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=le(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(u=m.quadrant)||2===u?this._arcRight.set(m.refDatum,m):SE(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var u}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":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 f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,_=0;if("inside"===o&&(_="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=le(t.circleCenter,v,t.middleAngle),t.labelLimit=f,pt(f,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.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=SE(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=SE(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.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 c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(gt(t.pointB.x,this._line2MinLength+h)||pt(t.pointB.x,c-this._line2MinLength-h))&&(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(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;k(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=SE(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-y-c:0+y+c;break;default:m=p.x+f*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+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?d(h)||"auto"===h?"edge"===c?SE(t.quadrant)?"left":"right":SE(t.quadrant)?"right":"left":h:d(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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*(SE(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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,f,m;if(ut(l/2,u))g=0,f=1,m=-p;else if(ut(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,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,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?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.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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;e{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 KE(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=ne.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 qE(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=Tw(t,!!n),o=Tw(r,!!n);const h=ne.distancePP(s,l),c=ne.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=KE(e,t,!1,!!n),o=KE(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=Tw(t,!!n),o=Tw(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}$E.defaultAttributes={pickable:!1};class ZE extends Jy{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&kw(this._innerView),this.removeAllChild(!0),this._innerView=df.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 Aw(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?`${fw.grid}-sub`:`${fw.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let d="";if("line"===s||"polygon"===s)d=Tw(o,!!a);else if("circle"===s){const{center:t}=this.attribute;d=KE(t,o,!1,!!a)}const u=df.path(Object.assign({path:d,z:l},c(r)?z({},this.skipDefault?null:ZE.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 d=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(d*d+u*u),g=l/p;o.push({x:n[0].x+d*g,y:n[0].y+u*g});const f=Tw(o,!!a),m=Vt(o[0].x-o[1].x),v=Vt(o[0].y-o[1].y),_=df.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*Ft/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},c(r)?z({},this.skipDefault?null:ZE.defaultAttributes.style,r(t,i)):r));_.name=`${h}-line`,_.id=this._getNodeId(`${h}-path-${s}`),e.add(_)})),n.length>1&&o){const t=_(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!ut(a.value,0)&&!ut(l.value,0),d=!ut(a.value,1)&&!ut(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}ZE.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},DA(),NA();class JE extends ZE{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ZE.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=iM,endAngle:r=sM}=this.attribute;i=ww(t,s,ne.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=z({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}U(JE,Xw);var QE,tP,eP,iP=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){const e=this._getPointsOfSubGrid(p,d);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(sP,WC),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(QE||(QE={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(tP||(tP={})),function(t){t.dataZoomChange="dataZoomChange"}(eP||(eP={}));const nP="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",rP={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:nP,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:nP,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},aP={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}},oP=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var lP=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;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto"},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,k,A,M,w;const{orient:T,middleHandlerStyle:C={},startHandlerStyle:B={},endHandlerStyle:E={},zoomLock:P}=this.attribute,{start:R,end:O}=this._getState(),{position:I,width:L,height:D}=this._getLayoutAttrFromConfig(),F=null!==(t=B.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=E.triggerMinSize)&&void 0!==e?e:40,j=this._getContainer();if(this._isHorizontal){if(C.visible){const t=(null===(i=C.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:I.x+R*L,y:I.y-t,width:(O-R)*L,height:t},null===(s=C.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=C.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:I.x+(R+O)/2*L,y:I.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=C.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square"},C.icon),{pickable:!P&&(null===(h=C.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:I.x+R*L,y:I.y+D/2,size:D,symbolType:null!==(c=B.symbolType)&&void 0!==c?c:"square"},aP.horizontal),B),{pickable:!P&&(null===(d=B.pickable)||void 0===d||d)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:I.x+O*L,y:I.y+D/2,size:D,symbolType:null!==(u=E.symbolType)&&void 0!==u?u:"square"},aP.horizontal),E),{pickable:!P&&(null===(p=E.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+R*L-t/2,y:I.y+D/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:999},aP.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+O*L-g/2,y:I.y+D/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:999},aP.horizontal),{pickable:!P}),"rect")}else{if(C.visible){const t=(null===(g=C.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===T?I.x-t:I.x+L,y:I.y+R*D,width:t,height:(O-R)*D},null===(f=C.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(_=null===(v=null===(m=C.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===_||_)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===T?I.x-t/2:I.x+L+t/2,y:I.y+(R+O)/2*D,angle:Math.PI/180*90,symbolType:null!==(b=null===(y=C.icon)||void 0===y?void 0:y.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0},C.icon),{pickable:!P&&(null===(S=null===(x=C.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:I.x+L/2,y:I.y+R*D,size:L,symbolType:null!==(k=B.symbolType)&&void 0!==k?k:"square"},aP.vertical),B),{pickable:!P&&(null===(A=B.pickable)||void 0===A||A)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:I.x+L/2,y:I.y+O*D,size:L,symbolType:null!==(M=E.symbolType)&&void 0!==M?M:"square"},aP.vertical),E),{pickable:!P&&(null===(w=E.pickable)||void 0===w||w)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+L/2+t/2,y:I.y+R*D-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},aP.vertical),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+L/2+i/2,y:I.y+O*D-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},aP.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move"},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move"},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_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))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){return t.length<=10||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,void 0!==e?e*e:1)}(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(t);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(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){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 je).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)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=lP(c,["formatMethod"]),{formatMethod:g}=d,f=lP(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:_,width:y,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,k={x1:_.x,y1:_.y,x2:_.x+y,y2:_.y+b};let A,M,w,T;this._isHorizontal?(A={x:_.x+m*y,y:_.y+b/2},M={x:_.x+v*y,y:_.y+b/2},w={textAlign:oP(k,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},T={textAlign:oP(k,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(A={x:_.x+y/2,y:_.y+m*b},M={x:_.x+y/2,y:_.y+v*b},w={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:oP(k,t,"start",this._isHorizontal)?"top":"bottom"},T={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:oP(k,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),z({},p,{text:x,x:A.x,y:A.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),z({},f,{text:S,x:M.x,y:M.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new VM(e),s.name=i,t.add(s)),s}}const cP={debounce:bt,throttle:xt};class dP extends o{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=QE.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=QE.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=QE.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=QE.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=QE.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===S_.env?S_:this.stage,s=hM();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===QE.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===QE.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===QE.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===QE.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(tP.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(tP.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(tP.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===QE.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(tP.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(tP.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:cP[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===S_.env?S_:this.stage,e=hM();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===S_.env?S_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===S_.env?S_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:mt(e+t,0,1),end:mt(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=QE.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}jM(),YA(),JA(),EA(),HA();let uP=class t extends Jy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,_;h.visible?this._isHorizontal?(m=p,v=g-f,_={x:a.x,y:a.y+f}):(m=p-f,v=g,_={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(y+b)/2,_={x:_.x+y/2,y:_.y}):(v-=(y+b)/2,_={x:_.x,y:_.y+y/2})),v+=(null!==(n=u.lineWidth)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:_,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new hP(this._getRendererAttrs()),this._interaction=new dP(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(tP.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(tP.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(eP.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(tP.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;u(t)&&u(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(eP.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.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,...G(a))}setPreviewPointsX(t){c(t)&&(this._renderer.previewPointsX=t)}setPreviewPointsY(t){c(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){c(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){c(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){c(t)&&(this._renderer.statePointToData=t)}};var pP,gP,fP,mP;function vP(){DA(),jM(),ST()}uP.defaultAttributes=rP,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"}(pP||(pP={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(gP||(gP={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(fP||(fP={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(mP||(mP={}));class _P extends Jy{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=Ew(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=Pw(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=Rw(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=p(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=df.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=df.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=df.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 yP(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 bP(t,e,i,s){t&&(yP(t.startSymbol,e,i,s),t.lines.forEach((t=>yP(t,e,i,s))),yP(t.line,e,i,s),yP(t.endSymbol,e,i,s))}function xP(t,e,i,s){t&&(yP(t.getTextShape(),e,i,s),yP(t.getBgRect(),e,i,s))}function SP(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 kP(t,e,i,s){t&&(SP(t.startSymbol,e,i,s),t.lines.forEach((t=>SP(t,e,i,s))),SP(t.line,e,i,s),SP(t.endSymbol,e,i,s))}function AP(t,e,i,s){t&&(SP(t.getTextShape(),e,i,s),SP(t.getBgRect(),e,i,s))}function MP(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;yP(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)})),yP(t.endSymbol,s+r+a,o,n),G(e).forEach((t=>{const e=s+r+a+o;yP(t.getTextShape(),e,l,n),yP(t.getBgRect(),e,l,n)}))}function wP(t,e,i,s,n){bP(t,s,i,n),G(e).forEach((t=>{xP(t,s,i,n)}))}function TP(t,e,i,s,n){yP(t,s,i,n),G(e).forEach((t=>{xP(t,s,i,n)}))}function CP(t,e,i,s,n){yP(t,s,i,n),G(e).forEach((t=>{xP(t,s,i,n)}))}function BP(t,e,i,s,n,r){var a;bP(t,n,s,r),yP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?xP(i,n,s,r):yP(i,n,s,r)}function EP(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;yP(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)})),yP(e,n+o+l,h,r),yP(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(yP(i.getTextShape(),n+o+l+h+c,d,r),yP(i.getBgRect(),n+o+l+c,d,r)):yP(i,n+o+l+c,d,r)}function PP(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?MP(t,e,s,r,a):"fadeIn"===i&&wP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?MP(t,e,s,n,a):"fadeIn"===i&&wP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){kP(t,s,i,n),G(e).forEach((t=>{AP(t,s,i,n)}))}(t,e,i,s,n)}}function RP(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&&TP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&TP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){SP(t,s,i,n),G(e).forEach((t=>{AP(t,s,i,n)}))}(t,e,i,s,n)}}function OP(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&&CP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&CP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){SP(t,s,i,n),G(e).forEach((t=>{AP(t,s,i,n)}))}(t,e,i,s,n)}}function IP(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?BP(n,r,e,i,s,o):"callIn"===t&&EP(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?BP(n,r,e,i,s,a):"callIn"===t&&EP(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;kP(t,n,s,r),SP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?AP(i,n,s,r):SP(i,n,s,r)}(n,r,e,t,i,s)}}const LP={type:"clipIn",duration:500,easing:"linear",delay:0},DP={type:"fadeIn",duration:500,easing:"linear",delay:0},FP={type:"callIn",duration:500,easing:"linear",delay:0},zP={type:"fadeOut",duration:500,easing:"linear",delay:0};class jP{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=G(null==n?void 0:n.label),a=G(null==n?void 0:n.labelBackground),o=G(s).map(((s,n)=>{var o,l;const h=z({},i,s),c=new VM(Object.assign(Object.assign({},h),{state:{panel:z({},aM,null!==(o=a[n])&&void 0!==o?o:Y(a)),text:z({},aM,null!==(l=r[n])&&void 0!==l?l:Y(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===G(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=G(this._label),n=G(null==i?void 0:i.label),r=G(null==i?void 0:i.labelBackground);if(s.length){const i=G(e);s.forEach(((e,s)=>{var a,o;const l=z({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:z({},aM,null!==(a=r[s])&&void 0!==a?a:Y(r)),text:z({},aM,null!==(o=n[s])&&void 0!==o?o:Y(n))}})),this.setLabelPos(e,l)}))}}}class HP extends _P{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=LP,this.defaultExitAnimation=zP}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;zM(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}U(HP,jP);const VP=.001,NP={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:pP.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]}},WP={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"}}},UP={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:{autoRotate:!0,position:fP.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]}},GP={interactive:!0,label:{position:gP.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}},YP={interactive:!0,label:{autoRotate:!0,position:fP.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}},XP={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"}},$P={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"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},KP={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 qP(){ZP._animate=PP}vP(),dw(),ST();class ZP extends HP{markerAnimate(t){ZP._animate&&this._animationConfig&&ZP._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ZP.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i: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,e){var i;return(_M(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return yM(Math.abs(e),Math.PI/2,VP)||yM(Math.abs(e),3*Math.PI/2,VP)?bM(i,e,t):_M(e)?WP.postiveXAxis[t]:WP.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new pw({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},aM,null==a?void 0:a.line),startSymbol:z({},aM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},aM,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({},aM,null==a?void 0:a.line),startSymbol:z({},aM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},aM,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}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",ZP.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(ZP.defaultAttributes.label)}}function JP(){QP._animate=RP}ZP.defaultAttributes=NP,vP(),UA(),ST();class QP extends _P{markerAnimate(t){QP._animate&&this._animationConfig&&QP._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},QP.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=DP,this.defaultExitAnimation=zP}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},$P[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;zM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=df.polygon(Object.assign({points:e},i));n.states=z({},aM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",QP.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=z({},aM,null==i?void 0:i.area)),this._updateMarkLabels(QP.defaultAttributes.label)}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}}QP.defaultAttributes=GP,U(QP,jP),vP(),uw(),ST();class tR extends HP{markerAnimate(t){tR._animate&&this._animationConfig&&tR._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},tR.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case fP.arcInnerStart:l=n;case fP.arcOuterStart:l=n;break;case fP.arcInnerEnd:l=r;case fP.arcOuterEnd:l=r;break;case fP.center:case fP.arcInnerMiddle:case fP.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return XP[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new gw({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},aM,null==o?void 0:o.line),startSymbol:z({},aM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},aM,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({},aM,null==o?void 0:o.line),startSymbol:z({},aM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},aM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",tR.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(tR.defaultAttributes.label)}}tR.defaultAttributes=UP,vP(),CA(),ST();class eR extends _P{markerAnimate(t){eR._animate&&this._animationConfig&&eR._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},eR.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=DP,this.defaultExitAnimation=zP}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case fP.center:h=(s+n)/2,c=(r+a)/2;break;case fP.arcInnerStart:h=s,c=r;break;case fP.arcOuterStart:h=n,c=r;break;case fP.arcInnerEnd:h=s,c=a;break;case fP.arcOuterEnd:h=n,c=a;break;case fP.arcInnerMiddle:h=s,c=(r+a)/2;break;case fP.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},XP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;zM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=df.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=z({},aM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",eR.defaultAttributes.label)}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({},aM,null==o?void 0:o.area)),this._updateMarkLabels(eR.defaultAttributes.label)}isValidPoints(){return!0}}function iR(){sR._animate=IP}eR.defaultAttributes=YP,U(eR,jP),vP(),dw(),uw(),JA(),zA(),HA(),ST();class sR extends _P{markerAnimate(t){sR._animate&&this._animationConfig&&sR._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},sR.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=FP,this.defaultExitAnimation=zP,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return yM(Math.abs(s),Math.PI/2,VP)||yM(Math.abs(s),3*Math.PI/2,VP)?bM(t,s,n):_M(s)?KP.postiveXAxis[n]:KP.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,style:d,position:u=mP.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-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,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:z({},aM,null==p?void 0:p.textBackground),text:z({},aM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=z({},aM,null==p?void 0:p.itemContent));const v=_M(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+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",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=df.symbol(Object.assign(Object.assign({},i),r)),o.states=z({},aM,null==s?void 0:s.itemContent)):"text"===n?o=new VM(Object.assign(Object.assign({},i),{state:{panel:z({},aM,null==s?void 0:s.textBackground),text:z({},aM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=df.richtext(Object.assign(Object.assign({},i),r)),o.states=z({},aM,null==s?void 0:s.itemContent)):"image"===n?(o=df.image(Object.assign(Object.assign({},i),r)),o.states=z({},aM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=z({},aM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}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=yM(c,0,VP)||yM(d,0,VP),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=DM(e-u,t-d),o=DM(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*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(uR.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(uR.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===uR.focus||"focus"===o){const s=a.hasState(cR.focus);a.toggleState(cR.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[cR.unSelected,cR.unSelectedHover,cR.focus],t),this._setLegendItemState(e,cR.selected,t)})):(this._setLegendItemState(a,cR.selected,t),this._removeLegendItemState(a,[cR.unSelected,cR.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[cR.selected,cR.selectedHover,cR.focus],t),this._setLegendItemState(e,cR.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(cR.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(cR.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(dR.legendItemClick,a,t);i?(this._removeLegendItemState(a,[cR.selected,cR.selectedHover],t),this._setLegendItemState(a,cR.unSelected,t)):(this._setLegendItemState(a,cR.selected,t),this._removeLegendItemState(a,[cR.unSelected,cR.unSelectedHover],t))}else this._setLegendItemState(a,cR.selected,t),this._removeLegendItemState(a,[cR.unSelected,cR.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[cR.selected,cR.selectedHover],t),this._setLegendItemState(e,cR.unSelected,t))}))}this._dispatchLegendEvent(dR.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,cR.selected),this._removeLegendItemState(e,[cR.unSelected,cR.unSelectedHover])):(this._removeLegendItemState(e,[cR.selected,cR.selectedHover]),this._setLegendItemState(e,cR.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=oR,spaceRow:l=lR,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:p,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:p?i:e,v=this._contentMaxHeight;let y,{doWrap:b,maxWidthInCol:x,startX:S,startY:k,pages:A}=this._itemContext,M=0,w=0;const T=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),y=d[t],y.id||(y.id=y.label),y.index=t;let e=!0;_(n)&&(e=n.includes(y.label));const i=this._renderEachItem(y,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),p?(u(s)&&(f&&a?(A=Math.ceil((S+g)/s),b=A>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||T.forEach((t=>{t.setAttributes({y:t.attribute.y+(w-t.attribute.height)/("middle"===h?2:1)})})),A+=1,S=0,k+=w+l,w=0,T.length=0))),0===S&&0===k||i.setAttributes({x:S,y:k}),S+=o+g,w=Math.max(w,m),T.push(i)):(u(v)&&(f&&a?(A=Math.ceil((k+m)/v),b=A>1):v<=m?(A+=1,b=!0,k=0,t>0&&(S+=M+o)):v{t.setAttributes({y:t.attribute.y+(w-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=k,this._itemContext.maxWidthInCol=x,this._itemContext.pages=A,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=A),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||E(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=df.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:p}=t,g=[];u(c)&&g.push(c),u(d)&&g.push(d),g.length&&(u(s)&&g.push(s),this._itemWidthByUser=$(g)),u(p)&&(this._itemHeightByUser=p);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";p(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";p(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,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:p,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,s),k=this._handleStyle(y,t,e,i,s),A=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),w=ni(c);let T;!1===x.visible?(T=df.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(T,uR.item,t,T)):(T=df.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(T,uR.item,t,T,M.state)),T.id=`${null!=a?a:o}-${i}`,T.addState(e?cR.selected:cR.unSelected);const C=df.group({x:0,y:0,pickable:!1});T.add(C);let B,E=0,R=0,O=0;if(v&&!1!==v.visible){const i=P(S,"style.size",10);R=_(i)?i[0]||0:i,O=P(v,"space",8);const s=df.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&&d(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&d(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,uR.itemShape,t,T,S.state),s.addState(e?cR.selected:cR.unSelected),C.add(s)}let I=0;if(p){const e=P(g,"size",10);B=df.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:w},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(B,uR.focus,t,T),I=e}const L=y.formatMethod?y.formatMethod(o,t,i):o,D=IM(Object.assign(Object.assign({x:R/2+O,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=k.style)||void 0===r?void 0:r.fontSize},k.style),{text:L,_originText:y.formatMethod?o:void 0}));this._appendDataToShape(D,uR.itemLabel,t,T,k.state),D.addState(e?cR.selected:cR.unSelected),C.add(D);const F=P(y,"space",8);if(u(l)){const s=P(b,"space",p?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=IM(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:A.style.fontSize},A.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,uR.itemValue,t,T,A.state),r.addState(e?cR.selected:cR.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-w[1]-w[3]-R-O-F-I-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-R/2-w[1]-w[3]-I-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));E=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-w[1]-w[3]-R-O-I),E=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):E=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);B&&(B.setAttribute("x",E),C.add(B));const z=C.AABBBounds,j=z.width();if("right"===f){const t=z.x2,e=z.x1;C.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===B?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=z.height(),V=u(this.attribute.item.width)?this.attribute.item.width:j+w[1]+w[3],N=this._itemHeightByUser||H+w[0]+w[2];return T.attribute.width=V,T.attribute.height=N,B&&B.setAttribute("visible",!1),C.translateTo(-z.x1+w[3],-z.y1+w[0]),T}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new aR(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},z({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new aR(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new dM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new dM(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?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 i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",xt(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=oR,spaceRow:o=lR}=n,l=this._itemsContainer,{space:h=hR,defaultCurrent:c=1}=r,d=mR(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,_=0,y=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v0&&(y=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:y,y:b}),y+=a+i})),this._itemContext.startX=y,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),_=p-g.AABBBounds.height()-h-t,_<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;_0&&(b=0,y+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:y,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=df.group({x:0,y:t,width:u?v:f,height:u?m:_,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=oR,spaceRow:a=lR}=s,o=this._itemsContainer,{space:l=hR,defaultCurrent:h=1}=n,c=mR(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const _=df.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=df.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];ut(mt(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),ut(mt(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(cR.selected)?this._setLegendItemState(t,cR.selectedHover,e):this._setLegendItemState(t,cR.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===uR.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(dR.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(cR.unSelectedHover)||t.hasState(cR.selectedHover))&&(i=!0),t.removeState(cR.unSelectedHover),t.removeState(cR.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(cR.unSelectedHover)&&!t.hasState(cR.selectedHover)||(i=!0),t.removeState(cR.unSelectedHover),t.removeState(cR.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===uR.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(dR.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(dR.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!==uR.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(dR.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!==uR.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(dR.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(cR.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=z({},vR,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(cR.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(c(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]&&(c(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var yR;function bR(t){return _(t)?t:[t,t]}function xR(t){return t?"ew-resize":"ns-resize"}_R.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:oR,spaceRow:lR,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:hR,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"}(yR||(yR={})),gR();class SR extends Jy{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({},SR.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=mt(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=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=hM(),n="browser"===S_.env?S_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;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=mt(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=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=hM(),n="browser"===S_.env?S_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{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?mt(t+p,h,c):mt(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?mt(t+p,0,c-h):mt(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=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),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(u(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]=G(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:p}=this.attribute;d(p)&&(p=[o,l]),this._currentValue={startValue:bR(p)[0],endValue:bR(p)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=df.group({x:0,y:0});f.name=yR.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=df.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)),m.name=yR.startText,f.add(m);const e=u(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const _=df.group({x:g?v:0,y:g?0:v});f.add(_);const y=df.group({x:0,y:0});let b;if(y.name=yR.railContainer,this._railContainer=y,_.add(y),this._mainContainer=_,this._renderRail(y),v+=g?s:n,a&&a.visible){const t=u(a.space)?a.space:0;b=df.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=yR.endText,f.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=df.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=yR.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;d(c)&&(c=[i,s]);const u=a&&a.visible,p=this._isHorizontal,[g,f]=bR(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":xR(p)},r));if(v.name=yR.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,u){const i=this._renderHandlerText(g,e?"start":"end");i.name=yR.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":xR(p)},r));if(i.name=yR.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,u){const e=this._renderHandlerText(f,"end");e.name=yR.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,u;if(d(h))e?(c=i,u=s):c=u=i;else if(e){const t=vt(h,i,s);c=t[0],u=t[1]}else c=i,u=mt(h,i,s);const g=this._isHorizontal;e||(c=i);const f=df.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=yR.trackContainer;const m=p(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":xR(g);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(u,e?"end":"start"),b=df.rect(Object.assign({x:g?Math.min(_,y):0,y:g?0:Math.min(_,y),width:g?Math.abs(y-_):r,height:g?n:Math.abs(y-_),cursor:v},a));b.name=yR.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return df.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":xR(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),df.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=df.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=df.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),p(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown),("browser"===S_.env?S_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=hM(),e="browser"===S_.env?S_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_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===yR.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===yR.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===yR.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===yR.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}}release(t){super.release(t),("browser"===S_.env?S_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}SR.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}}},fR(),gR();class kR extends pR{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},kR.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!d(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:f,handlerText:m,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:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function AR(t="bottom"){let 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`}kR.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"}}},fR(),gR(),NA();class MR extends pR{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},MR.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:f,showTooltip:m,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=df.group({x:0,y:0});this._innerView.add(x);const S=new SR({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:AR(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,disableTriggerEvent:y,inverse:b});x.add(S);let k,A=0;"horizontal"===e?"top"===i?(k=`M0,0L${a},0L${b?0:a},12Z`,A=o):(k=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?k=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(k=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const M=df.path(Object.assign(Object.assign({x:0,y:A,path:k},_),{zIndex:0}));x.add(M);const w=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,w-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}MR.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)"}},DA(),tM(),$A();let wR=class t extends Jy{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,p,g,f,m,v,y,b,x;const{textType:S,text:k,subtextType:A,textStyle:M={},subtext:w,subtextStyle:T={},width:C,height:B,minWidth:E,maxWidth:P,minHeight:R,maxHeight:O,align:I,verticalAlign:L,padding:D=0}=this.attribute,F=ni(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),j=null!==(t=M.height)&&void 0!==t?t:B;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:p="break-word",maxWidth:g,lineClamp:f}=M;if("rich"===S||u(M.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:C)&&void 0!==e?e:0,height:null!=j?j:0,ellipsis:null==d||d,wordBreak:null!=p?p:"break-word",maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:null!==(i=M.character)&&void 0!==i?i:k},M);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:k},oM),M),x:h,y:c,width:null!==(s=null!=t?t:C)&&void 0!==s?s:0,height:null!=j?j:0,ellipsis:d,wordBreak:p,maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:[]},M);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else u(k)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:_(k)?k:[k],whiteSpace:"normal"},M),{maxLineWidth:null!==(r=null!==(n=M.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:C,heightLimit:null!==(a=M.height)&&void 0!==a?a:O,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const H=this._mainTitle?this._mainTitle.AABBBounds.height():0,V=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==T.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=T,v=Math.max(Number.MIN_VALUE,O-H);if("rich"===A||u(T.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:C)&&void 0!==o?o:0,height:null!==(l=null!=e?e:B)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=T.character)&&void 0!==h?h:w},T);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===A){const o=Object.assign({html:Object.assign(Object.assign({dom:w},oM),T),x:n,y:r,width:null!==(c=null!=t?t:C)&&void 0!==c?c:0,height:null!==(d=null!=e?e:B)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},T);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else u(w)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:_(w)?w:[w],whiteSpace:"normal"},T),{maxLineWidth:null!==(p=T.maxLineWidth)&&void 0!==p?p:C,heightLimit:null!==(g=T.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:H}),"text"))}const N=this._subTitle?this._subTitle.AABBBounds.height():0,W=this._subTitle?this._subTitle.AABBBounds.width():0;let U=Math.max(V,W),G=H+(null!==(f=T.height)&&void 0!==f?f:N);if(u(C)&&(U=C),u(B)&&(G=B),u(E)&&UP&&(U=P),u(R)&&GO&&(G=O),z.attribute.width=U,z.attribute.height=G,z.attribute.boundsPadding=F,this._mainTitle){if(u(I)||u(M.align)){const t=M.align?M.align:I,e=null!==(m=M.width)&&void 0!==m?m:U;"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")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:L,e=null!=j?j:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"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")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(u(I)||u(T.align)){const t=T.align?T.align:I,e=null!==(y=null!==(v=T.width)&&void 0!==v?v:M.width)&&void 0!==y?y:U;"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")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=T.verticalAlign?T.verticalAlign:L,e=this._mainTitle?u(j)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),j):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=T.height)&&void 0!==b?b:B)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"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")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};wR.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 TR={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"}}};DA(),tM(),$A();let CR=class extends Jy{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=z({},P(TR,n),e.style,{visible:e.visible});a.lineHeight=u(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=IM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{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,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(u(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),u(s)){const t=G(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e: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 p=PM(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(p>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/p,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",u(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 p=null!==(o=d.space)&&void 0!==o?o:0;if(c+=p,G(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,f=c/2,m=g**2+1,v=2*f*g,_=f**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*m*_))/(2*m))+f),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",u(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;G(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 BR extends wg{constructor(t){super(t)}}var ER,PR;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(ER||(ER={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(PR||(PR={}));class RR extends Jy{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},RR.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"},RR.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"},RR.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},RR.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},RR.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=()=>{d(this._playController)&&(this._playController=new BR(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{d(this._backwardController)&&(this._backwardController=new BR(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{d(this._forwardController)&&(this._forwardController=new BR(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(ER.OnPlay)},this.pause=()=>{this._dispatchEvent(ER.OnPause)},this.forward=()=>{this._dispatchEvent(ER.OnForward)},this.backward=()=>{this._dispatchEvent(ER.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()}}RR.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},RR.defaultAttributes={[PR.Start]:{},[PR.Pause]:{},[PR.Backward]:{},[PR.Forward]:{}};const OR={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},IR=[200,10];var LR,DR;!function(t){t.Default="default",t.Reverse="reverse"}(LR||(LR={})),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"}(DR||(DR={}));const FR=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===LR.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===LR.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),zR=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===LR.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===LR.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),jR=t=>"top"===t||"bottom"===t;class HR extends Jy{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},HR.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=Ut(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(jR(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:IR[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:IR[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 SR(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 t.layout=jR(this._orient)?"horizontal":"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 RR(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=jR(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:IR[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=x(i)?i:Ut(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(jR(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=x(n)?n:Ut(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:jR(this._orient)?t+s:(this._size.width-r)/2,y:jR(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:jR(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:jR(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=x(n)?n:Ut(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:jR(this._orient)?t+s:(this._size.width-r)/2,y:jR(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]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function VR(){gR(),DA(),JA()}HR.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({},OR),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},OR),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},OR),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},OR),{key:"backward",position:"start"})}},VR();class NR extends HR{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:LR.Default},this._initDataIndex=()=>{var t;this._dataIndex=d(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(ER.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(ER.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(ER.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(ER.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(DR.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(FR({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||zR({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===LR.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(DR.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=S_.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(DR.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(DR.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=S_.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(),S_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(DR.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,S_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(DR.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(DR.change),this.dispatchCustomEvent(DR.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var WR,UR=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())}))};VR();class GR extends HR{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(ER.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(ER.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(ER.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(ER.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(DR.change))},this.play=()=>UR(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(DR.play),this._rafId=S_.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=S_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,S_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(DR.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,S_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(DR.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(DR.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(DR.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.brushActive="brushActive",t.brushClear="brushClear"}(WR||(WR={}));const YR={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],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:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},XR=5;const $R={debounce:bt,throttle:xt};DA(),UA();let KR=class t extends Jy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=YR.updateTrigger,endTrigger:i=YR.endTrigger,brushMoved:s=!0}=this.attribute;G(e).forEach((t=>this.stage.addEventListener(t,this._onBrushingWithDelay))),G(i).forEach((t=>this.stage.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos]},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:$R[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(WR.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const{trigger:t=YR.trigger,resetTrigger:e=YR.resetTrigger}=this.attribute;G(t).forEach((t=>this.stage.addEventListener(t,this._onBrushStart))),G(e).forEach((t=>this.stage.addEventListener(t,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(WR.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;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,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(WR.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=XR}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(WR.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(WR.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;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._dispatchBrushEvent(WR.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=XR}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(WR.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(WR.brushClear,t)):Math.abs(r-s)this.stage.removeEventListener(t,this._onBrushStart))),G(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents()}_releaseBrushUpdateEvents(){const{updateTrigger:t=YR.updateTrigger,endTrigger:e=YR.endTrigger}=this.attribute;G(t).forEach((t=>this.stage.removeEventListener(t,this._onBrushingWithDelay))),G(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushEnd)))}_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=df.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}_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(Ee(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_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.ythis._brushMaskAABBBoundsDict[t].empty()))}};KR.defaultAttributes=YR;const qR=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return z(t,...e,{shape:i.every(d)?void 0:z({},...i),key:s.every(d)?void 0:z({},...s),value:n.every(d)?void 0:z({},...n)})},ZR=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:G(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}},JR={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:nM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:nM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:nM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new He).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},QR=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];DA(),YA(),JA(),tM(),$A();let tO=class t extends Jy{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=ni(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 p=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",z({symbolType:"circle"},p.shape,{visible:vM(p)&&vM(p.shape)}),"symbol"),"object"!=typeof p.value.text||null===p.value.text||"rich"!==p.value.text.type&&"html"!==p.value.text.type?p.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:vM(p)&&vM(p.value)},ZR(p.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=p.value.text)&&void 0!==e?e:"",visible:vM(p)&&vM(p.value)},p.value),"text"):"rich"===p.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:vM(p)&&vM(p.value)},ZR(p.value)),"richtext"):"html"===p.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:p.value.text.text},oM),p.value),visible:vM(p)&&vM(p.value),width:p.value.width,height:p.value.height,wordBreak:p.value.wordBreak,textAlign:p.value.textAlign,textBaseline:p.value.textBaseline,singleLine:!1,textConfig:[]},p.value),"richtext"));const g=vM(p.shape)?p.shape.size+p.shape.spacing:0,{textAlign:f,textBaseline:m}=p.value,v=n.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",p.height):"middle"===m?this._tooltipTitle.setAttribute("y",p.height/2):this._tooltipTitle.setAttribute("y",0);const _=vM(p)?p.height+p.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(!vM(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 p="right"===c?(o?d:0)+(vM(n.key)?r+n.key.spacing:0)+(vM(n.value)?a:0):0;this._createShape("right"===c?p-n.shape.size/2:p+n.shape.size/2,n,h,l),o&&("right"===c?p-=d:p+=d);const g=this._createKey(n,h,l);g&&(LM(c,g,n.key.textAlign,p,r),g.setAttribute("y",0),"right"===c?p-=r+n.key.spacing:p+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";u(n.value.textAlign)?t=n.value.textAlign:vM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),LM(c,f,t,p,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(vM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=nd(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(vM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},ZR(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},ZR(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},oM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(vM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},ZR(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},ZR(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=>QR.includes(t)))?(this._mergeAttributes(e,s),d(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)&&vM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=vM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=EM(d),_=EM(u);let y=0;if(vM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),y=Math.max(y,e)}if(vM(u)){const{width:t,height:e}=_.quickMeasure(u.text);h.push(t),y=Math.max(y,e)}f&&lu[m]&&(t=!0,r.push(p.size),y=Math.max(p.size,y)),e.height=y,o+=y,a{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 qR({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return qR({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};tO.defaultAttributes=JR;const eO=ut;function iO(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:$(i)}function sO(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function nO(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function rO(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 aO(t,e){const i=rO(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 oO(t,e){const i=lO(t),s=lO(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 lO(t,e={x:0,y:0}){return ne.distancePP(t,e)}function hO(t){return k(t.x)&&k(t.y)}function cO(t,e,i){let s=!1;if(e&&c(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 dO(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const uO=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function gO(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&gO(t[i],e)}}var fO,mO,vO;function _O(t){var e,i;const{type:s}=t;return s===mO.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!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.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_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"}(fO||(fO={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",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",t.mosaic="mosaic",t.pictogram="pictogram"}(mO||(mO={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",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.transform="transform",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.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.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(vO||(vO={}));const yO={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},bO={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function xO(t,e){var i;if(!t)return[];const s=CO(t,e);if(!s||_(s))return null!==(i=s)&&void 0!==i?i:[];if(p(s)){const{dataScheme:i}=s;return i?wO(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>MO(i)?kO(t,i,e):i)).filter(u)}))):i.map((i=>MO(i)?kO(t,i,e):i)).filter(u):[]}return[]}function SO(t,e){var i,s;return wO(t)?null!==(s=null===(i=t.find((t=>u(t.isAvailable)?c(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!u(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 kO(t,e,i){var s;const n=CO(t,i);if(!n)return;let r;const{palette:a}=n;if(p(a)&&(r=null!==(s=function(t,e){const i=yO[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=bO[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(d(e.a)&&d(e.l)||!v(r))return r;let o=new ti(r);if(u(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Ge(t,i,s),a=Ue(n,r,e.l),l=new ti(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return u(e.a)&&o.setOpacity(e.a),o.toRGBA()}const AO=(t,e)=>{if(e&&MO(t)){const i=kO(e,t);if(i)return i}return t};function MO(t){return t&&"palette"===t.type&&!!t.key}function wO(t){return!(!_(t)||0===t.length)&&t.every((t=>u(t.scheme)))}function TO(t){return _(t)?{dataScheme:t}:t}function CO(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||d(n))r=null==t?void 0:t.default;else{const a=_O(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 BO extends xB{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(!wO(this._range))return void super.range(this._range);const t=SO(this._range,this._domain);super.range(t)}}const EO={linear:GB,band:AB,point:class extends AB{constructor(t){super(!1),this.type=QC.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:xB,threshold:ZB,colorOrdinal:BO};function PO(t){const e=EO[t];return e?new e:null}function RO(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function OO(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function IO(t){return u(null==t?void 0:t.field)&&u(null==t?void 0:t.scale)}function LO(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function DO(t){return!!v(t)&&(!!t.endsWith("%")&&Ky(t.substring(0,t.length-1)))}function FO(t){return!!p(t)&&("percent"in t||"offset"in t)}function zO(t,e,i,s=0){var n,r;return x(t)?t:DO(t)?Number(t.substring(0,t.length-1))*e/100:c(t)?t(i):p(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function jO(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>x(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]=zO(t[s],e.size,i)}))})),o}function HO(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}}function VO(t){let e={};return _(t)?(d(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),d(t[1])||(e.left=e.right=t[1]),d(t[2])||(e.bottom=t[2]),d(t[3])||(e.left=t[3]),e):x(t)||DO(t)||c(t)||FO(t)?(e.top=e.left=e.bottom=e.right=t,e):p(t)?(e=Object.assign({},t),e):e}function NO(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const WO=(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},UO=[{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"]}];function GO(t,e){return t&&e.key in t?t[e.key]:e.default}function YO(t){return t&&"token"===t.type&&!!t.key}const XO={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%"},$O={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:UO,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)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:XO,component:{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}}},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:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},KO={name:"dark",colorScheme:{default:{dataScheme:UO,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",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},qO=(t,e)=>t===e||!c(t)&&!c(e)&&(_(t)&&_(e)?e.every((e=>t.some((t=>qO(t,e))))):!(!p(t)||!p(e))&&Object.keys(e).every((i=>qO(t[i],e[i])))),ZO=(t,e,i)=>{if(d(e))return t;const s=e[0];return d(s)?t:1===e.length?(t[s]=i,t):(d(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),ZO(t[s],e.slice(1),i))},JO=t=>t instanceof Ba||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)))}}(t);function QO(t,e=["data"]){return I(t,JO,e)}function tI(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=TO(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}eI._charts={},eI._series={},eI._components={},eI._graphicComponents={},eI._marks={},eI._regions={},eI._animations={},eI._implements={},eI._chartPlugin={},eI._vChartPlugin={},eI._componentPlugin={},eI.transforms={fields:Gr,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}},eI.dataParser={csv:(t,e={},i)=>(i.type=Ur.DSV,ia(t)),dsv:(t,e={},i)=>{i.type=Ur.DSV;const s=jr(na,e),{delimiter:n}=s;if(!v(n))throw new TypeError("Invalid delimiter: must be a string!");return ea(n).parse(t)},tsv:(t,e={},i)=>(i.type=Ur.DSV,sa(t))},eI._layout={},eI._grammarTransforms={},eI._stageEventPlugins={},eI.registerStageEventPlugin=(t,e)=>{eI._stageEventPlugins[t]=e},eI.getStageEventPlugin=t=>eI._stageEventPlugins[t],eI._interactionTriggers={},eI.registerInteractionTrigger=(t,e)=>{eI._interactionTriggers[t]=e},eI._composedEventMap={},eI.registerComposedEvent=(t,e)=>{eI._composedEventMap[t]=e},eI._tooltipProcessors={},eI.registerTooltipProcessor=(t,e)=>{eI._tooltipProcessors[t]=e},eI.createTooltipProcessor=(t,e)=>{const i=eI._tooltipProcessors[t];return i?new i(e):null};const nI=t=>{const e={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"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},rI=nI(),aI={[$O.name]:$O},oI=$O.name,lI=new Map(Object.keys(aI).map((t=>[t,aI[t]]))),hI=new Map,cI=new Map(Object.keys(aI).map((t=>[t,t===oI]))),dI=(t,e)=>{if(!t)return;const i=fI(e);lI.set(t,i),cI.set(t,!0)},uI=(t=oI)=>(cI.has(t)&&!cI.get(t)&&dI(t,lI.get(t)),lI.get(t)),pI=t=>lI.delete(t)&&hI.delete(t)&&cI.delete(t),gI=t=>!!v(t)&&lI.has(t),fI=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:oI;return iI({},uI(i),t)};class mI{static registerInstance(t){mI.instances.set(t.id,t)}static unregisterInstance(t){mI.instances.delete(t.id)}static getInstance(t){return mI.instances.get(t)}static instanceExist(t){return mI.instances.has(t)}static forEach(t,e=[],i){const s=G(e);return mI.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}mI.instances=new Map;class vI{static registerTheme(t,e){dI(t,e)}static getTheme(t,e=!1){return uI(t)}static removeTheme(t){return pI(t)}static themeExist(t){return gI(t)}static getDefaultTheme(){return vI.themes.get(oI)}static setCurrentTheme(t){vI.themeExist(t)&&(vI._currentThemeName=t,mI.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return vI.getTheme(vI._currentThemeName,t)}static getCurrentThemeName(){return vI._currentThemeName}}function _I(t){return v(t)?vI.themeExist(t)?vI.getTheme(t):{}:p(t)?t:{}}vI.themes=lI,vI._currentThemeName=oI;const yI=["animationThreshold","colorScheme","name","padding"];function bI(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];yI.includes(n)?s[n]=r:f(r)?MO(r)?s[n]=AO(r,e):YO(r)?s[n]=GO(i,r):s[n]=bI(r,e,i):s[n]=r})),s}function xI(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]=xI(t[s],e)}return i}return _(t)?t.map((t=>xI(t,e))):t}function SI(t,e){if(!t)return t;if(f(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(v(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=SI(t[s],e)}return i}return _(t)?t.map((t=>SI(t,e))):t}function kI(t,...e){return c(t)?t(...e):t}const AI=(t,e,i,s)=>((t,e,i)=>EM(t,e,i,{fontFamily:XO.fontFamily,fontSize:XO.fontSize}))(e,i,s).measure(t),MI="__VCHART",wI=500,TI=500,CI=`${MI}_MEASURE_CANVAS_ID`,BI=`${MI}_DEFAULT_DATA_INDEX`,EI=`${MI}_DEFAULT_DATA_KEY`,PI=`${MI}_DEFAULT_DATA_SERIES_FIELD`,RI=`${MI}_DEFAULT_SERIES_STYLE_NAME`,OI=`${MI}_STACK_KEY`,II=`${MI}_STACK_START`,LI=`${MI}_STACK_END`,DI=`${MI}_STACK_START_PERCENT`,FI=`${MI}_STACK_END_PERCENT`,zI=`${MI}_STACK_START_OffsetSilhouette`,jI=`${MI}_STACK_END_OffsetSilhouette`,HI=`${MI}_STACK_TOTAL`,VI=`${MI}_STACK_TOTAL_PERCENT`,NI=`${MI}_STACK_TOTAL_TOP`,WI=`${MI}_STACK_TOTAL_BOTTOM`,UI=`${MI}_MOSAIC_VALUE_START_PERCENT`,GI=`${MI}_MOSAIC_VALUE_END_PERCENT`,YI=`${MI}_MOSAIC_CAT_START_PERCENT`,XI=`${MI}_MOSAIC_CAT_END_PERCENT`,$I=`${MI}_SEGMENT_START`,KI=`${MI}_SEGMENT_END`,qI=`${MI}_KEY`,ZI=`${MI}_MAP_LOOK_UP_KEY`;function JI(t,e){for(let i=0;it.key===e))}function tL(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 eL(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:{groupField:a.groupField,nodes:{}},aL(t,a,n[o],l,e,r))})),s?iL(n):n}function iL(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))):iL(t[e].nodes);return t}function sL(t,e){if("values"in t&&t.values.length){const i=nO(t.values,e),s=sO(t.values,FI);t.values.forEach((t=>{t[HI]=i,t[VI]=s}))}else for(const i in t.nodes)sL(t.nodes[i],e)}function nL(t){if(!t.values.length)return;const e=t.values[t.values.length-1][LI]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)rL(t.nodes[r],e,i,s,n)}function aL(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[LI]=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 l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},u(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),aL(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const oL=(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]=hL(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function cL(t={}){const e=Object.assign({},t);if(c(t.style)?e.style=(e,i,s,n)=>pL(t.style(e,i,s,n)):E(t.style)||(e.style=pL(t.style)),!E(t.state)){const i={};Object.keys(t.state).forEach((e=>{c(t.state[e])?i[e]=(i,s,n,r)=>pL(t.state[e](i,s,n,r)):E(t.state[e])||(i[e]=pL(t.state[e]))})),e.state=i}return e}function dL(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{c(t[i])?e[i]=(e,s,n,r)=>pL(t[i](e,s,n,r)):E(t[i])||(e[i]=pL(t[i]))})),e}function uL(t,e){if(E(t))return null;const i={};return Object.keys(t).forEach((s=>{c(t[s])?i[s]=t[s](e):i[s]=t[s]})),pL(i)}function pL(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:re(t.angle)}):t}const gL=t=>"line"===t||"area"===t,fL=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return gL(i)?e:null==e?void 0:e[0]},mL=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let vL=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},n=eI.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{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(eI.getComposedEvent(t))if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};var _L;!function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(_L||(_L={}));const yL=["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 bL,xL,SL;!function(t){t.initialized="initialized",t.rendered="rendered",t.renderFinished="renderFinished",t.animationFinished="animationFinished",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleRawDomainUpdate="scaleRawDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",t.layoutRectUpdate="layoutRectUpdate",t.playerPlay="playerPlay",t.playerPause="playerPause",t.playerEnd="playerEnd",t.playerChange="playerChange",t.playerForward="playerForward",t.playerBackward="playerBackward",t.scrollBarChange="scrollBarChange",t.brushStart="brushStart",t.brushChange="brushChange",t.brushEnd="brushEnd",t.brushClear="brushClear",t.brushActive="brushActive",t.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.tooltipShow="tooltipShow",t.tooltipHide="tooltipHide",t.tooltipRelease="tooltipRelease",t.afterResize="afterResize",t.afterRender="afterRender",t.afterLayout="afterLayout",t.afterMarkLayoutEnd="afterMarkLayoutEnd",t.afterWordcloudShapeDraw="afterWordcloudShapeDraw"}(bL||(bL={})),function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(xL||(xL={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(SL||(SL={}));const kL=[SL.mark,SL.model,SL.chart,SL.vchart];class AL{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(SL.vchart,[]),this._levelNodes.set(SL.chart,[]),this._levelNodes.set(SL.model,[]),this._levelNodes.set(SL.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const ML={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"};class wL{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=u(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=u(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=P(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>fL(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||xL.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||xL.chart);o.get(t)||o.set(t,new AL);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||xL.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||xL.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||xL.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||xL.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?kL.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[xL.chart,xL.window,xL.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(c(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&P(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 ML[a]&&(a=ML[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))&&(!u(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:u(t.id)?SL.model:SL.vchart:SL.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=xt(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=bt(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=xL.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==SL.model&&s!==SL.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),u(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=SL.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case xL.chart:return this._viewBubbles;case xL.window:return this._windowBubbles;case xL.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case xL.chart:return this._viewListeners;case xL.window:return this._windowListeners;case xL.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return yL.includes(t)||Object.values(_L).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&eI.hasInteractionTrigger(e)}}function TL(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function CL(t,e,i){t.getParser(e)||t.registerParser(e,i)}const BL=new Map;let EL;function PL(){EL||(EL=new Ca,CL(EL,"geojson",Sa),CL(EL,"topojson",Aa),TL(EL,"simplify",Wr))}function RL(t,e,i={type:"geojson",centroid:!0}){BL.has(t)&&jy(`map type of '${t}' already exists, will be overwritten.`),PL();const s=new Ba(EL),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"}):p(r)&&s.transform({type:"simplify",options:r}),BL.set(t,s)}function OL(t){BL.has(t)?BL.delete(t):jy(`map type of '${t}' does not exists.`)}function IL(t,e=!1){let i=e;return t.latestData instanceof Ba&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const LL=(t,e)=>0===t.length?[]:1===t.length?IL(t[0],null==e?void 0:e.deep):t.map((t=>IL(t,null==e?void 0:e.deep)));function DL(t,e,i){TL(e=e instanceof Ca?e:t.dataSet,"copyDataView",LL);const s=new Ba(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:jL.copyDataView}),s}function FL(t,e,i=[]){var s;if(t instanceof Ba)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new Ba(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return jy(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return jy(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!v(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),jy("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function zL(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var jL,HL,VL,NL;!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"}(jL||(jL={})),function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(HL||(HL={})),function(t){t.data="data",t.mark="mark"}(VL||(VL={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(NL||(NL={}));const WL=["line","area","trail"];function UL(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(qI,i?t.slice().sort(i):t.slice()),{keys:[qI],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const GL=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function YL(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{YL(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function $L(t,e,i,s){const n=UL(t,(t=>i(t))),r=UL(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!d(t)){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}}const KL=`${MI}_BuiltIn_CallBack_Disappear`;var qL;!function(t){t.render="render",t.disappear="disappear"}(qL||(qL={}));class ZL{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(t,e){this._count=0,this._rootMarks=[],this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(bL.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(bL.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var t,e,i,s;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(t=this._compileChart.getEvent())||void 0===t||t.emit(bL.renderFinished,{chart:this._compileChart,vchart:null===(e=this._compileChart.getOption())||void 0===e?void 0:e.globalInstance})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterVRenderDraw)||void 0===s||s.call(i,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=t,this._option=e}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var t,e,i,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:g,background:f}=this._option;S_.setEnv(function(t){switch(t){case s["desktop-browser"]:case s["mobile-browser"]:return"browser";case s.node:case s.worker:return"node";case s.miniApp:case s["desktop-miniApp"]:return"feishu";case s.lynx:return"lynx";case s.wx:return"wx";case s.tt:return"tt";case s.harmony:return"harmony"}return"browser"}(o),null!=l?l:{}),this._stage=null!==(t=this._option.stage)&&void 0!==t?t:new D_(Object.assign({background:f,width:this._width,height:this._height,container:null!==(e=this._container.dom)&&void 0!==e?e:null,canvas:null!==(i=this._container.canvas)&&void 0!==i?i:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:g},ReactDOM:this._option.ReactDOM,autoRefresh:u(r)?r:!u(a)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{})),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const m=Pp({x:0,y:0,width:this._width,height:this._height});m.name="root",this._stage.defaultLayer.appendChild(m),this._rootGroup=m;const v=(u(h)?h:Gy(o))&&!1!==c&&eI.getStageEventPlugin("gesture");v&&(this._gestureController=new v(this._stage,p(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=NL.before}_setCanvasStyle(){if(this._stage&&this._container.dom&&!v(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(S_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=S_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>YL(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>YL(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{YL(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;this._hasCommitedMark()&&(zy(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),this._rootMarks.forEach((t=>{t.render()})),this._layoutState===NL.before&&(this._layoutState=NL.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=NL.reevaluate,this._hasCommitedMark()&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),this.findProgressiveMarks(),this.updateStateAnimation(),this._doRender(!0),this.doPreProgressive(),zy(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=XL(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=$L(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=$L(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=UL(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=UL(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}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];_(s)?e[i]="disappear"===i?s.map((t=>{return"function"==typeof(e=t.callBack)&&/^class\s/.test(e.toString())?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:KL,customParameters:{callBack:t.callBack}});var e})):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{YL(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===HL.appear))?HL.appear:e.every((t=>t===HL.disappear))?HL.disappear:HL.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===xL.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=u(a.context)?a:((t,e)=>{let i=e;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=i.parent,i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=u(l.markId)?l.markId:null,c=u(l.modelId)?l.modelId:null,d=u(l.modelUserId)?l.modelUserId:null,p=u(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:fL(o),markId:h,modelId:c,markUserId:p,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===xL.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===xL.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===xL.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===xL.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===xL.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this.releaseGrammar(!0),this._stage!==(null===(t=this._option)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{YL(t,(t=>{t.removeProduct()}),null,!0)})):this._cachedMarks=XL(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return Uy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&function(t){return bu(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{xo.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()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{YL(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=S_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){S_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function JL(t,i){var s;return e(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==i?void 0:i.onError)&&void 0!==s?s:Hy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function QL(t){t.crosshair=G(t.crosshair||{}).map((e=>tI({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function tD(t,e,i){var s;const{width:n,height:r}=t;if(u(n)&&u(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}=ri(l,i.width,i.height);a=t,o=e}else if(h&&Uy(e.mode)){let t;t=v(h)?S_.getElementById(h):h;const{width:e,height:s}=ri(t,i.width,i.height);a=e,o=s}else if(Yy(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 eD(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function iD(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}}const sD=9,nD=0,rD=-1;var aD,oD,lD,hD,cD,dD;!function(t){t[t.SeriesGroup=0]="SeriesGroup",t[t.Axis_Grid=50]="Axis_Grid",t[t.CrossHair_Grid=100]="CrossHair_Grid",t[t.Region=450]="Region",t[t.Mark=300]="Mark",t[t.Node=400]="Node",t[t.Axis=100]="Axis",t[t.MarkLine=500]="MarkLine",t[t.MarkArea=100]="MarkArea",t[t.MarkPoint=500]="MarkPoint",t[t.DataZoom=500]="DataZoom",t[t.ScrollBar=500]="ScrollBar",t[t.Player=500]="Player",t[t.Legend=500]="Legend",t[t.CrossHair=500]="CrossHair",t[t.Indicator=500]="Indicator",t[t.Title=500]="Title",t[t.Label=500]="Label",t[t.Brush=500]="Brush",t[t.CustomMark=500]="CustomMark",t[t.Interaction=700]="Interaction"}(aD||(aD={})),function(t){t[t.Indicator=10]="Indicator",t[t.Region=20]="Region",t[t.Axis=30]="Axis",t[t.DataZoom=40]="DataZoom",t[t.Player=40]="Player",t[t.ScrollBar=40]="ScrollBar",t[t.Legend=50]="Legend",t[t.Title=70]="Title",t[t.CustomMark=70]="CustomMark"}(oD||(oD={})),function(t){t[t.Default=0]="Default",t[t.Theme=1]="Theme",t[t.Chart=2]="Chart",t[t.Base_Series=3]="Base_Series",t[t.Series=4]="Series",t[t.Mark=5]="Mark",t[t.User_Chart=6]="User_Chart",t[t.User_Series=7]="User_Series",t[t.User_Mark=8]="User_Mark",t[t.User_SeriesStyle=9]="User_SeriesStyle",t[t.Built_In=99]="Built_In"}(lD||(lD={}));class uD{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){d(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,z({},uD.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=G(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]))))}}uD.defaultMarkInfo={};class pD{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class gD{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=>tI({},i,s,t);return _(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 fD extends pD{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}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=gD,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new uD,this._lastLayoutRect=null,this.id=$y(),this.userId=t.id,this._spec=t,this.effect={},this.event=new vL(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){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}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){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_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){u(t)&&u(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!u(t)||!u(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${MI}_${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(e,i={},s){const{type:n,name:r}=e,{parent:a}=i,o=t(i,["parent"]),l=eI.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_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(!d(e))return P(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}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class mD{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}get lastComputeRect(){return this._lastComputeRect}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}get willLayoutTag(){return this._willLayoutTag}constructor(t,e){var i;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=oD.Region,this._willLayoutTag=!0,this._model=t,this._option=e,this.layoutLevel=e.layoutLevel,this.layoutType=e.layoutType,e.layoutOrient&&(this.layoutOrient=e.layoutOrient),this._spec=null===(i=null==t?void 0:t.getSpec)||void 0===i?void 0:i.call(t)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=jO(VO(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=d(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:zO(t.minHeight,e.height,e),this._maxHeight=d(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:zO(t.maxHeight,e.height,e),this._minWidth=d(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:zO(t.minWidth,e.width,e),this._maxWidth=d(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:zO(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:zO(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:zO(t.height,e.height,e)},{height:9}),d(t.offsetX)||(this.layoutOffsetX=zO(t.offsetX,e.width,e)),d(t.offsetY)||(this.layoutOffsetY=zO(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){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{d(this._spec[i])||(e[i]=zO(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};d(s)||(r.width-=s),d(n)||(r.width-=n),d(e)||(r.height-=e),d(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):(d(s)?d(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,d(e)?d(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?(d(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),d(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(d(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),d(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(HO(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class vD extends fD{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,this._transformLayoutPadding=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 mD(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&N(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.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 _D extends gD{_initTheme(t,e){return{spec:t,theme:this._theme}}}class yD extends vD{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(t,e){var i;super(t,e),this.transformerConstructor=_D,this.modelType="region",this.specKey="region",this.type=yD.type,this._series=[],this.layoutType="region",this.layoutZIndex=aD.Region,this.seriesDataFilterOver=()=>{this.event.emit(bL.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=t.id,this.coordinate=null!==(i=t.coordinate)&&void 0!==i?i:"cartesian"}_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 t,e;this.initLayout(),super.created();const i=null!==(t=this._spec.clip)&&void 0!==t?t:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(e=this.userId)&&void 0!==e?e:this.type)+"_interaction",aD.Interaction),E(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",lD.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:aD.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:aD.Mark+1}))}_createGroupMark(t,e,i){var s,n;const r=this._createMark({type:"group",name:t});r.setUserId(e),r.setMarkConfig({zIndex:i});const a=null!==(s=this._spec.clip)&&void 0!==s?s:this._getClipDefaultValue();return this.setMarkStyle(r,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:a},"normal",lD.Built_In),this.setMarkStyle(r,{cornerRadius:null===(n=this._spec.style)||void 0===n?void 0:n.cornerRadius},"normal",lD.User_Mark),this._marks.addMark(r),r}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var t,e;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(t=this._spec.style)||void 0===t?void 0:t.fill)?1:0},this._spec.style),"normal",lD.User_Mark),(null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",lD.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",lD.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return N(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||G(t.userId).includes(e.userId))&&(!u(t.specIndex)||G(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})}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=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function bD(t){const e=[],i=[],s=[];return t.forEach((t=>{d(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 xD(t,e,i){e?t.forEach((t=>{const e=Y(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=Y(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 SD(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 kD(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=TD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),SD(d,!0,p,l),s&&xD(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function AD(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=TD(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=TD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),SD(d,!1,p,o),s&&xD(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function wD(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=TD(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_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){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_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,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=TD(t,this,e);"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,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=bD(t);n.length&&kD(n,e,i,!1,"left",s),r.length&&kD(r,e,i,!0,"left",s),a.length&&AD(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=bD(t);n.length&&MD(n,e,i,!1,"top",s),r.length&&MD(r,e,i,!0,"top",s),a.length&&wD(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=bD(t);n.length&&kD(n,e,i,!1,"right",s),r.length&&kD(r,e,i,!0,"right",s),a.length&&AD(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=bD(t);n.length&&MD(n,e,i,!1,"bottom",s),r.length&&MD(r,e,i,!0,"bottom",s),a.length&&wD(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=TD(t,this,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=>{N(i.getLayoutRect(),e.rect)||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{rect:i}=TD(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);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+c-l})}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+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&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:Hy)("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}}}CD.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(hD||(hD={})),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",t.STATE_HIGHLIGHT="highlight",t.STATE_BLUR="blur",t.STATE_ACTIVE="active"}(cD||(cD={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(dD||(dD={}));const BD=["linear","radial","conical"],ED={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const PD={};Object.values(cD).forEach((t=>{PD[t]=!0})),cD.STATE_HOVER,cD.STATE_HOVER_REVERSE,cD.STATE_SELECTED,cD.STATE_SELECTED_REVERSE,cD.STATE_DIMENSION_HOVER,cD.STATE_DIMENSION_HOVER_REVERSE;class RD extends pD{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(z(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class OD extends RD{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];u(s.domain)&&(n.domain=s.domain),u(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:{}})}))}_isMultiMark(){return!this._mark||(t=this._mark.type,WL.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(u(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!PD[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(_(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(MI)));i=t.datums.some((t=>e&&_(null==t?void 0:t.items)?n.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])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(p(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(MI))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(eB(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class ID extends pD{constructor(){super(...arguments),this.id=$y(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=eI.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class LD extends ID{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}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._data=null,this._data=e}removeProduct(){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const DD=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,FD=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=DD(l.delay,n,a,o),d=DD(l.duration,n,a,o),u=DD(l.oneByOne,n,a,o),p=DD(l.splitPath,n,a,o),g=k(u)&&u>0?t=>x(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)?NT:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:WT)(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);zT(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{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)?NT:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:WT)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>IT(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>DT(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:$o.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 FT({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:BT,null!==(l=i.easing)&&void 0!==l?l:ET))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:$o.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new jT({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:BT,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:ET))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):zT(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},zD=(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))))},jD=t=>{const e=t.getMarkConfig();if(u(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}};class HD extends ID{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){u(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){d(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&u(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];_(n)?s[e]=n.map(i):u(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=G(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=G(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new LD(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(u(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}d(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else u(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=Pp("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){d(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(){this._product&&this._product.parent&&this._product.parent.removeChild(this._product),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(t,e){var i;super(e),this.type=void 0,this.name="mark",this._markConfig={zIndex:aD.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Nl)),i&&(c(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==hD.enter&&t.context.diffState!==hD.update||(t.stateProxy=(e,i)=>{var s;return this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)},t.context.states&&t.useStates(t.context.states,e))},this.name=t,this.model=e.model,this.key=e.key,this.state=new OD(e,this),this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(u(t.id)&&(this._userId=t.id),h(t.interactive)&&(this._markConfig.interactive=t.interactive),u(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),h(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_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,re)}isUserLevel(t){return[lD.User_Mark,lD.User_Series,lD.User_Chart,lD.User_SeriesStyle].includes(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];d(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}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){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[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"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;u(r)&&r<=s&&tI(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(iB(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return v(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=PO(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),e.clamp&&t.clamp&&t.clamp(e.clamp))}(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=c(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):BD.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):iB(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t){t.style&&this.setStyle(t.style,"normal",lD.User_Mark);const e=t.state;e&&Object.keys(e).forEach((t=>{const i=e[t];if("style"in i){const e=i.style;let s={stateValue:t};"level"in i&&(s.level=i.level),"filter"in i&&(s=c(i.filter)?Object.assign({filter:i.filter},s):Object.assign(Object.assign({},i.filter),s)),this.state.addStateInfo(s),this.setStyle(e,t,lD.User_Mark)}else this.setStyle(i,t,lD.User_Mark)}))}_computeGradientAttr(e){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=e,d=t(e,["gradient","scale","field"]);let p=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(p=t),g||(g=e)}const f=SO(xO(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},ED[o]),d);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==p?void 0:p.scale(t[g]);return c(n)&&(a=n(t,this._attributeContext,i)),u(s)&&(a=ti.SetOpacity(a,s)),{offset:c(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):c(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(e){const{scale:i,field:s}=e,n=t(e,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];c(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)BD.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=SO(xO(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return UL(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._graphics=t.getGraphics(),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear)}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return eI.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=c(this.key)?this.key:u(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[EI],this._groupKeyGetter=u(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=UL(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===HL.appear))?HL.appear:t.every((t=>t===HL.disappear))?HL.disappear:t[0];return null!=e?e:HL.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{jD(t),s.push(...t.getGraphics())})),e.forEach((t=>{jD(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);FD([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=zD(e,n),r=zD(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===HL.exit?HL.exit:i===HL.update?HL.update:HL.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===hD.exit&&(t.context.reusing=!0,t.animates&&t.animates.forEach((t=>t.stop())))}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===hD.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,u,p,g;let f,m;return d(e)?(f=this._graphicMap.get(t),f&&(m=hD.exit)):d(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=hD.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=hD.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(u=f.context)||void 0===u?void 0:u.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=HL.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=HL.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return GL(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=GL(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(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||(!!c(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach(((t,e)=>{var i,n;let r=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i.update,t);null===(n=t.currentStates)||void 0===n||n.forEach((e=>{var i;const s=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i[e],t);r=Object.assign(Object.assign({},r),s)})),d(this._markConfig.interactive)||(r.pickable=this._markConfig.interactive);const a=this._transformGraphicAttributes(t,r,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=a}))}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r,a;const o=i.context.finalAttrs,l=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=mL(i,o);i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes({}),i.context.reusing=!1):l||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),!(null===(a=this.renderContext)||void 0===a?void 0:a.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i),e&&i.setFinalAttributes(o)}else{const a=i;i=this._createGraphic(o),e&&(null===(n=i.setFinalAttributes)||void 0===n||n.call(i,o)),i.context=a.context,i.context.diffAttrs=o,i.stateSort=this._stateSort;const l=this._graphics===t?s:s+this._graphics.length-t.length;if(l>=0&&(this._graphics[l]=i),null===(r=this.renderContext)||void 0===r?void 0:r.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,l),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const t={};Object.keys(this.stateStyle).forEach((e=>{if(e===cD.STATE_NORMAL){const{groupStyles:i,updateStyles:s}=this._separateNormalStyle(this.stateStyle[e]);t.group=this._getEncoderOfStyle(e,i),t.update=this._getEncoderOfStyle(e,s)}else t[e]=this._getEncoderOfStyle(e,this.stateStyle[e])})),this._encoderOfState=t}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(d(e)||(t.zIndex=e),d(i)||(t.clip=i),!d(s)){const e=_(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return d(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=eI.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=eI.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=G(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===NL.before||(zy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{"in"===this.state.checkOneState(i,i.context.data,e)?i.addState(t,!0,this.hasAnimationByState("state")):i.removeState(t,this.hasAnimationByState("state"))}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===hD.exit&&!e.isExiting)if(e.context.animationState===hD.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:hD.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=Pp({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||p(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}}var VD;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(VD||(VD={}));class ND extends HD{constructor(){super(...arguments),this.type=ND.type,this._marks=[],this._diffState=hD.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(jy("Mark already exists, add mark failed."),!1):(this._marks.push(t),!0)}removeMark(t){const e=this._marks.findIndex((e=>e.id===t.id||e.name===t.name));return-1===e?(jy("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInUserId(t){let e;return YL(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.diffState===hD.update){const t=this.hasAnimation(),e=mL(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e)),t&&this._product.setFinalAttributes(i)}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=hD.update}render(){this._isCommited&&(zy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct()}}ND.type="group";const WD={measureText:AI};class UD{static instance(){return UD.instance_||(UD.instance_=new UD),UD.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 GD{constructor(){this.id=$y(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?jy("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class YD extends GD{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)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const XD={type:"fadeIn"};function $D(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 XD;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}class KD extends MT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.currentAnimationRatio=0,this.animationTime=0}onUpdate(t,e,i){super.onUpdate(t,e,i),this.currentAnimationRatio=e,this.animationTime=e*Math.PI*2}getAnimationTime(){return this.currentAnimationRatio>0?this.animationTime:Date.now()/1e3}afterStageRender(t,e){var i,s;return null===(s=null===(i=this.params)||void 0===i?void 0:i.callBack)||void 0===s?void 0:s.call(i,t,e,this.currentAnimationRatio,this.animationTime)}}const qD={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"},state:{duration:300,easing:"linear"}},ZD={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},JD={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},QD=()=>{eI.registerAnimation("scaleInOut",(()=>ZD))},tF=()=>{eI.registerAnimation("fadeInOut",(()=>JD))},eF=(t,e)=>({appear:$D(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:XT,duration:qD.update.duration,easing:qD.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),iF=()=>{eI.registerAnimation("line",eF)},sF=()=>{uT.registerBuiltInAnimate("growPointsIn",dC),uT.registerBuiltInAnimate("growPointsOut",uC),uT.registerBuiltInAnimate("growPointsXIn",gC),uT.registerBuiltInAnimate("growPointsXOut",fC),uT.registerBuiltInAnimate("growPointsYIn",vC),uT.registerBuiltInAnimate("growPointsYOut",_C),uT.registerBuiltInAnimate("clipIn",qT),uT.registerBuiltInAnimate("clipOut",ZT)},nF=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};cD.STATE_HIGHLIGHT,cD.STATE_BLUR;class rF{constructor(t){this._markSet=new uD,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){_(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.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 aF={highlightState:cD.STATE_HIGHLIGHT,blurState:cD.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class oF extends rF{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},aF,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return v(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll(e)}}oF.type="element-highlight",oF.defaultOptions=aF;const lF=()=>{eI.registerInteractionTrigger(oF.type,oF)},hF={state:cD.STATE_SELECTED,trigger:"click"};class cF extends rF{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},hF,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=G(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):v(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):x(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(_(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),t.addState(i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll(e)}}cF.type="element-select",cF.defaultOptions=hF;const dF=()=>{eI.registerInteractionTrigger(cF.type,cF)};class uF extends GD{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class pF{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>eI.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>eI.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>eI.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return eI.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>eI.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){eI.registerTransform(t,e)}static registerFunction(t,e){t&&e&&UD.instance().registerFunction(t,e)}static unregisterFunction(t){t&&UD.instance().unregisterFunction(t)}static getFunction(t){return t?UD.instance().getFunction(t):null}static getFunctionList(){return UD.instance().getFunctionNameList()}static registerMap(t,e,i){const s=eI.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=eI.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,BL.get(e);var e}static registerSVG(t,e,i){const s=eI.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=eI.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){mI.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}get event(){return this._event}getDataSet(){return this._dataSet}constructor(e,i){var n,r,a,o,l,h,c,d,p;this.id=$y(),this._userEvents=[],this._autoSize=!0,this._option={mode:s["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._renderState=qL.render,this._disableDimensionHoverEvent=!1,this._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))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;N(n.theme,this._spec.theme)?N(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=eD(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?eI.getSeriesBuiltInTheme(e):eI.getComponentBuiltInTheme(e);i=i?tI({},s,i[e]):s}s===t.length-1&&u(i)&&(i=bI({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},gO(i),this._option=Object.assign(Object.assign({},this._option),i),(null==i?void 0:i.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),i.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:_,stage:y,poptip:b}=g,x=t(g,["dom","renderCanvas","mode","stage","poptip"]),S=Uy(_);if(S?nx(yo):"node"===_&&NS(yo),S&&f&&(this._container=v(f)?S_.getElementById(f):f),m&&(this._canvas=m),y&&(this._stage=y),"node"!==_&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=vI.getCurrentThemeName(),this._setNewSpec(e),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const k=[];!1!==b&&k.push("poptipForText"),"sankey"===e.type&&k.push("scrollbar");const A=new rt(null!==(a=this._option.logLevel)&&void 0!==a?a:nt.Error);rt.setInstance(A),(null===(o=this._option)||void 0===o?void 0:o.onError)&&A.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._compiler=new ZL({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:y,pluginList:k},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new wL(this,this._compiler),this._event=new vL(this._eventDispatcher,_),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=e.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),mI.registerInstance(this),null===(p=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===p||p.call(d,this)}_setNewSpec(t,e){return!!t&&(v(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=tI({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=xI(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;pF.getFunctionList()&&pF.getFunctionList().length&&(t=SI(t,pF)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=eI.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=eI.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(t){var e,i,s;if(!this._compiler)return void(null===(e=this._option)||void 0===e||e.onError("compiler is not initialized"));if(this._chart)return void(null===(i=this._option)||void 0===i||i.onError("chart is already initialized"));const n=eI.createChart(t.type,t,this._getChartOption(t.type));n?(this._chart=n,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(bL.initialized,{chart:n,vchart:this})):null===(s=this._option)||void 0===s||s.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var t,e;this._compiler&&(null===(e=null===(t=this._compiler.getStage())||void 0===t?void 0:t.getTimeline())||void 0===e||e.on("animationEnd",(()=>{this._event.emit(bL.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=xt(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.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 tD(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:wI,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:TI})}_initDataSet(t){this._dataSet=t instanceof Ca?t:new Ca,CL(this._dataSet,"dataview",Ma),CL(this._dataSet,"array",i),TL(this._dataSet,"copyDataView",LL);for(const t in eI.transforms)TL(this._dataSet,t,eI.transforms[t]);for(const t in eI.dataParser)CL(this._dataSet,t,eI.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return c(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake?(null===(n=this._compiler)||void 0===n||n.releaseGrammar(),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.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.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),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),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(bL.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return e(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return e(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?HL.none:HL.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}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._cachedProcessedTheme=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,mI.unregisterInstance(this)}updateData(t,i,s,n){return e(this,void 0,void 0,(function*(){return this.updateDataSync(t,i,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):_(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return e(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=G(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._reSetRenderState(),d(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=G(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=G(this._spec.data);return G(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof Ba?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,u(n)&&(a.parser=n),u(r)&&(a.fields=r));else{const e=FL(t,this._dataSet,s);_(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,i=!0){return e(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,i)}))}updateSpec(t,i=!1,s,n){return e(this,void 0,void 0,(function*(){const e=this._updateSpec(t,i,n);return e?(yield this.updateCustomConfigAndRerender(e,!1,{morphConfig:s,transformSpec:e.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,i,s=!1,n){return e(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,i,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(v(e)&&(e=JSON.parse(e)),c(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(p(e))e.type===n&&(_(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?tI({},t[n][e.index],i):i):t[n]=s?tI({},t[n],i):i);else if(_(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?tI({},t[n][r],i):i)}else t.id===e&&(t[n]=s?tI({},t[n],i):i)}))}(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=tI({},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,i){return e(this,void 0,void 0,(function*(){return this.resizeSync(t,i)}))}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),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,this),!0)}_afterResize(){return this._isReleased||this._event.emit(bL.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)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=iI({},e,e.chart[t])),e};let l;if(E(n)&&E(r))l=_I(this._currentThemeName),this._currentTheme=o(a,l);else if(v(n)&&(!r||v(r))||v(r)&&(!n||v(n))){const t=iI({},_I(this._currentThemeName),_I(n),_I(r));this._currentTheme=o(a,t)}else{const t=iI({},_I(this._currentThemeName),_I(n),_I(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),z(WM.poptip,NM,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;d(this._spec.width)?!d(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),d(this._spec.height)?!d(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!Uy(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||p(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return _I(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return e(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!vI.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),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}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(n.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=u(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(n.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(n.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(n.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return e(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield JL(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var i,s;return e(this,void 0,void 0,(function*(){if(!Uy(this._option.mode))return void(null===(i=this._option)||void 0===i||i.onError(new TypeError("non-browser environment can not export img")));const e=yield this.getDataURL();e?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,e):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;this._chart.resetLayoutItemTag(),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(u(this._container))return this._container;let e;return e=v(this._canvas)?S_.getElementById(this._canvas):this._canvas,u(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)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(E(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(u(r)?o=this._chart.getSeriesInUserId(r):u(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?NO(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||d(t)||E(e))return null;if(!_(t)){const{axisId:n,axisIndex:r}=e;let a;if(u(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):u(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return jy("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return u(r)?o=this._chart.getSeriesInUserId(r):u(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?NO(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(jy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return UD.instance().getFunction(t)}registerFunction(t,e){t&&e&&UD.instance().registerFunction(t,e)}unregisterFunction(t){t&&UD.instance().unregisterFunction(t)}getFunctionList(){return UD.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(n.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,r;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(r=this._chart)||void 0===r?void 0:r.getComponentsByType(n.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=eI.getChartPlugins();t.length>0&&(this._chartPlugin=new YD(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=eI.getVChartPlugins();e.length>0&&(this._vChartPlugin=new uF(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||s["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_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,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=qL.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){this._renderState=qL.render,this.getStage().eventSystem.resumeTriggerEvent()}}pF.InstanceManager=mI,pF.ThemeManager=vI,pF.globalConfig={uniqueTooltip:!0},pF.Utils=WD,pF.vglobal=S_;eI.registerRegion("region",yD),eI.registerLayout("base",CD),qA(),DA(),eI.registerMark(ND.type,ND),eI.registerStageEventPlugin("gesture",Tb),lF(),dF(),dI(KO.name,KO);const gF="monotone",fF="linear",mF="bevel";var vF;function _F(t,e){return e("component",t)}function yF(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=eI.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}!function(t){t.vertical="vertical",t.horizontal="horizontal"}(vF||(vF={}));const bF=(t,e,i,s)=>{if(d(t[e]))return;const n=_(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},xF=(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(c(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(d(i))for(let i=0;i(l(t),t)))},SF="2.0.19",kF=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},AF=(t,e,i,s)=>{let n;if(n=c(t)?t(e,i):f(t)&&u(t.field)?P(e,t.field):t,s){const{formatFunc:i,args:r}=yF(void 0,s,t,e);i&&r&&(n=i(...r))}return n},MF=(t,e,i)=>d(t)?t:c(t)?t(e,i):t;const wF=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(_(e.activeType)?e.activeType.includes(t):e.activeType===t)));function TF(e,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=d(i.key)&&d(i.value)&&!E(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:p,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:_}=l,y=t(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=BF(AF(h,r,a,c),p,g),o.value=BF(AF(f,r,a,m),v,_),Object.keys(y).forEach((t=>{o[t]=AF(l[t],r,a)})),!1!==o.visible&&(u(o.key)||u(o.value))&&e.push(o)}};_(i)?i.forEach((t=>{o(t)})):o(i)}function CF(t,e,i,s,n,r,a){if(c(e)){TF(t,e(n,a),i,s,r,a)}else e&&TF(t,e,i,s,r,a)}const BF=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=gi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class EF{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:u(n)?G(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(u(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 G(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(u(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.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{_(t)?t.forEach((t=>{CF(a,t,e,i,s,n,r)})):c(t)?CF(a,t,e,i,s,n,r):t&&TF(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=c(e)?e(s,n):e;if(r?d(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){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}(s),e={visible:AF(r.visible,t,n),value:BF(AF(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:AF(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=AF(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&wF(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const PF={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}},RF=(t,e)=>{var i,s;let n=e.fields;if(c(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=JI([],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 OF(a,n,o)},OF=(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&&t.forEach((t=>{t&&n.push(t[a])}));const u=n.length;if(h){r.length=0,n.forEach(((t,e)=>{Ky(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===u}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{Ky(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&&!0===o.lockStatisticsByDomain&&!d(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=PF[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},IF=(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=>{Ky(t[e])||(t[e]=0)}))})),t},LF=`${MI}_HIERARCHY_DEPTH`,DF=`${MI}_HIERARCHY_ROOT`,FF=`${MI}_HIERARCHY_ROOT_INDEX`;function zF(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function jF(t,e,i){t&&(i.needDefaultSeriesField&&(t[PI]=i.defaultSeriesField),t[BI]=e,t[EI]=i.getKey(t,e,i))}function HF(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function VF(t,e,i,s=0,n,r){void 0===r&&(r=e),jF(t,e,i),t[LF]=s,t[DF]=n||t[i.categoryField],t[FF]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>VF(e,s,i,t[LF]+1,t[DF],r)))}const NF={label:{name:"label",type:"text"}},WF=`${MI}_rect_x`,UF=`${MI}_rect_x1`,GF=`${MI}_rect_y`,YF=`${MI}_rect_y1`,XF={data:!0},$F={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},KF=[...Object.keys(qD),"normal"];function qF(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=_(a)?a.map(((t,e)=>{var s;let n=t;return ez(n)&&delete n.type,n.oneByOne&&(n=JF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:QF,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=tI({},o[e],a);return ez(n)&&delete n.type,n.oneByOne&&(n=JF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:QF,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function ZF(t,e,i){var s,n,r,a,o,l;const h={};return u(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),u(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),u(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),u(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),u(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),u(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=I(t,null,i),iz(t,(t=>{var i;if(c(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function JF(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=c(n)?n(t,i,a):k(n)?n:0,h=c(r)?r(t,i,a):k(r)?r:0;let d=c(s)?s(t,i,a):s;return!1===d?h:(d=!0===d?0:d,h+o*(l+d))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=c(n)?n(t,r,o):k(n)?n:0,d=c(a)?a(t,r,o):k(a)?a:0;let u=c(s)?s(t,r,o):s;if(!1===u)return d;return u=!0===u?0:u,d+((i?i():r.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function QF(t,e){var i;return null!==(i=null==t?void 0:t[BI])&&void 0!==i?i:e.context.graphicIndex}function tz(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 ez(t){return!function(t){return u(t.timeSlices)}(t)&&u(t.channel)}function iz(t,e,i=[]){if(_(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),iz(t[n],e,i)}));else if(p(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),iz(t[s],e,i))}function sz(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class nz extends gD{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=G(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=_O(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=eI.getSeriesMarkMap(o)?function(t,e,i){const s=eI.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=tI({},i("mark",G(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return tI({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_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){h(t.stack)&&(this.stack=t.stack),h(t.percent)&&(this.stack=t.percent||this.stack),d(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;G(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:d=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(c(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&d)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,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 u(s)&&(i.outerRadius=s),u(n)&&(i.innerRadius=n),u(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=tI({},i,s,t),n=i.label;return n&&p(n)&&_(e.label)&&(e.label=e.label.map((t=>tI({},n,t)))),e};return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class rz extends fD{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){u(t)&&(this._seriesField=t)}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:`${MI}_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=nz,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=aD.SeriesGroup,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(bL.afterInitData,{model:this}),this.initRootMark(),this.initMark();const t=sz(this);this._initExtensionMark({hasAnimation:t}),this.initMarkStyle(),this.initMarkState(),t&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(bL.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 d(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),u(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)&&(TL(this._rawData.dataSet,"invalidTravel",IF),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;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=FL(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=DL(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=DL(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new LD(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(d(this._rawStatisticsCache[t].min)||d(this._rawStatisticsCache[t].max))||!e&&d(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=$(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=OF(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=z(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){TL(this._dataSet,"dimensionStatistics",RF);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new Ba(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&&JI(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){TL(this._dataSet,"dimensionStatistics",RF);const s=new Ba(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=JI(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&JI(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new Ba(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 d(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)}`)}:v(t)?e=>e[t]:_(t)&&t.every((t=>v(t)))?e=>t.map((t=>e[t])).join("-"):c(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)&&(TL(this._rawData.dataSet,"addVChartProperty",kF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:zF.bind(this),call:jF}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){var e;null===(e=this._rawDataStatistics)||void 0===e||e.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(bL.rawDataUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(bL.viewDataFilterOver,{model:this})}viewDataUpdate(t){var e;this.event.emit(bL.viewDataUpdate,{model:this}),null===(e=this._data)||void 0===e||e.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(bL.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||d(e)?null:t[e]}getDatumPositionValues(t,e){return!t||d(e)?[]:v(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;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.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(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:u(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(u(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=qF({},ZF(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)}))),!d(t.dataId)||!d(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(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:u(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(t){if(!(null==t?void 0:t.length))return[];const e=(i=this._option.mode)===s["desktop-browser"]||i===s["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:Gy(i)||Yy(i)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var i;let n=Object.assign({},null==e?void 0:e.hover),r=Object.assign({},null==e?void 0:e.select);const a=this._spec.hover;h(a)?n.enable=a:p(a)&&(n.enable=!0,n=tI(n,a));const o=this._spec.select;h(o)?r.enable=o:p(o)&&(r.enable=!0,r=tI(r,o));const l=[{trigger:{type:"dimension-hover"},marks:t}];if(n.enable){const e=nF(n,t);e.length&&l.push({trigger:this._defaultHoverConfig(n),marks:e})}if(r.enable){const e=nF(r,t);e.length&&l.push({trigger:this._defaultSelectConfig(r),marks:e})}return l}_defaultHoverConfig(t){return{type:"element-highlight",trigger:t.trigger,triggerOff:t.triggerOff,blurState:cD.STATE_HOVER_REVERSE,highlightState:cD.STATE_HOVER}}_defaultSelectConfig(t){const e="multiple"===t.mode,i=u(t.triggerOff)?t.triggerOff:e?["empty"]:["empty",t.trigger];return{type:"element-select",trigger:t.trigger,triggerOff:i,reverseState:cD.STATE_SELECTED_REVERSE,state:cD.STATE_SELECTED,isMultiple:e}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=nF(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}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:PI;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:RI,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],u(o)?o:t.getAttribute(e,s)}})),this.setMarkStyle(t,a,RI,lD.User_SeriesStyle)}))}afterInitMark(){this.event.emit(bL.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{var e,i;(null===(i=null===(e=t.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&t.setAttribute("stroke",this.getColorAttribute(),"normal",lD.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.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()}initTooltip(){this._tooltipHelper=new EF(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||e.visible!==t[i].visible))?i.reMake=!0:!i.reCompile&&e.some(((e,i)=>!N(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!N(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},XF),$F),i),{extensionMark:!0,label:!0,totalLabel:!0});return this._compareExtensionMarksSpec(G(t.extensionMark),G(e.extensionMark),s),!s.reMake&&this._compareLabelSpec(G(t.label),G(e.label),s),!s.reMake&&this._compareLabelSpec(G(t.totalLabel),G(e.totalLabel),s),s.reMake?s:(!s.reCompile&&this._marks.getMarks().some((i=>{var s,n;return r[i.name]=!0,(null===(s=e[i.name])||void 0===s?void 0:s.visible)!==(null===(n=t[i.name])||void 0===n?void 0:n.visible)}))&&(s.reCompile=!0),!s.reCompile&&n.some((i=>$F[i]&&!N(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!N(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Ba||zL(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.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();sz(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),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:PI,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new BO).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return xO(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:PI}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:p={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:_=!1}=e,y=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:_,parent:!1!==m?null!=m?m:this._rootMark:null});if(u(y)){const e=this.getSpec()||{};this._marks.addMark(y,{name:t.name}),v&&(this._seriesMark=y),d(f)?y.setData(this._data):!1!==f&&y.setDataView(f),y.setSkipBeforeLayouted(!1!==c),d(h)||y.setGroupKey(h);const l=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:null!==(s=i.morph)&&void 0!==s&&s,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(n=i.support3d)&&void 0!==n?n:e.support3d||!!e.zField,morphKey:(null===(r=e.morph)||void 0===r?void 0:r.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});y.setMarkConfig(l),this.initMarkStyleWithSpec(y,tI({},p,g||e[y.name]))}return y}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:EI}_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!==LI&&t!==FI&&t!==II&&t!==DI||(t=this.getStackValueField()),null!==(e=tL(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>Ky(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:PI]}}function az(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();eB(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 oz(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}}}rz.mark=NF,rz.transformerConstructor=nz;class lz extends rz{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=G(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=G(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&G(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);eB(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:`${MI}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?G(this._spec.xField)[0]:G(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(LI),this.setFieldX2(II)):(this.setFieldY(LI),this.setFieldY2(II))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(FI),this.setFieldX2(DI)):(this.setFieldY(FI),this.setFieldY2(DI))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(jI),this.setFieldX2(zI)):(this.setFieldY(jI),this.setFieldY2(zI))}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=G(this._spec.xField),this._specYField=G(this._spec.yField),u(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(),u(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(G(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(G(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(bL.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)&&(az("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()!==n.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==n.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)}}function hz(t){return"bottom"===t||"top"===t}function cz(t){return"left"===t||"right"===t}function dz(t){return"z"===t}function uz(t,e){return LO(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function pz(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function gz(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?hz(t)?"linear":"band":hz(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${n.cartesianAxis}-${s}`}}const fz=(t,e,i)=>{var s;const n=null!==(s="band"===e?_F("axisBand",i):["linear","log","symlog"].includes(e)?_F("axisLinear",i):{})&&void 0!==s?s:{},r=hz(t)?_F("axisX",i):cz(t)?_F("axisY",i):_F("axisZ",i);return tI({},_F("axis",i),n,r)};class mz{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:Hy)("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:Hy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;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)))),r=n.filter((t=>sB(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return hz(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class vz extends mz{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(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:xL.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const _z=(t,e)=>{var i,s;return t===e||!d(t)&&!d(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))},yz=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},bz=(t,e,i,s)=>{var n;const r=e.getScale(),a=sB(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=G(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.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))})),o.push({series:h,datum:e,key:xz(h,s)})}else if(u(i[1])){const e=[],s=[];l.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||u(n[i[0]])&&u(n[i[1]])&&t>=n[i[0]]&&t{if(u(e[i[0]])){const r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{if(u(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,Sz=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(G(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};class kz extends mz{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!_z(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:xL.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:xL.canvas}),callback:this.onMouseOut}),Gy(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:xL.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Gy(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var Az;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Az||(Az={}));const Mz={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class wz{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",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.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(Mz.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(t,e){var i,s;const n=this._lineMark;if(n){if(this.setMarkStyle(n,{stroke:this.getColorAttribute()},"normal",lD.Series),"zero"!==this._invalidType&&this.setMarkStyle(n,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",lD.Series),this.event.on(bL.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(n,"defined")})),"polar"===this.coordinate)this.setMarkStyle(n,{lineJoin:mF,curveType:fF,closePath:!0},"normal",lD.Series);else{const r=null!=e?e:null===(s=null===(i=this.getSpec().line)||void 0===i?void 0:i.style)||void 0===s?void 0:s.curveType,a=r===gF?"horizontal"===t?"monotoneY":"monotoneX":r;this.setMarkStyle(n,{curveType:a},"normal",lD.Built_In)}this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",lD.Series)}return n}_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){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(Mz.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:tz(this._spec,Mz.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new Ba(this._option.dataSet,{name:`${MI}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const t=this._symbolMark;if(!t)return this._initSymbolActiveMarkAlone(),t;if(this._initSymbolMark(t),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(Az.dimensionHover,this._dimensionTrigger.bind(this));for(const e in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[e]={};for(const i in this._symbolMark.stateStyle[e])"visible"!==i&&(this._symbolActiveMark.stateStyle[e][i]={style:null,level:lD.Series,referer:t})}this._symbolActiveMark.state.changeStateInfo({stateValue:cD.STATE_DIMENSION_HOVER,filter:()=>!0})}return t}_initSymbolMark(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",lD.Series),this.setMarkStyle(t,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",lD.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[Mz.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(Az.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,tI({},this._spec[Mz.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:cD.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(t){var e;t&&("symbol"!==(null===(e=t.getTarget())||void 0===e?void 0:e.type)&&t.setRule("line-data"),this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},"normal",lD.Series),this.event.on(bL.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(t,e){var i,s,n,r;if(!t)return;const a=this._isFieldAllValid();if("zero"===this._invalidType||a){if(!0===(null===(s=null===(i=t.stateStyle.normal)||void 0===i?void 0:i[e])||void 0===s?void 0:s.style))return;this.setMarkStyle(t,{[e]:!0},"normal",lD.Series)}else{if(!0!==(null===(r=null===(n=t.stateStyle.normal)||void 0===n?void 0:n[e])||void 0===r?void 0:r.style))return;this.setMarkStyle(t,{[e]:this._getInvalidDefined.bind(this)},"normal",lD.Series)}t.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const Tz=Object.assign(Object.assign({},NF),Mz),Cz=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(v(t))return!1;if(_(t))return t.length===e.length&&t.every(((t,i)=>Cz(t,e[i])));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]))},Bz=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class Ez extends HD{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return Bz}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(d(o)||s.includes(a))return;r&&n.includes(a)&&(iB(null==o?void 0:o.type)||(null==o?void 0:o.scale)||c(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!d(t)||!d(e))||!d(t)&&!d(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?Cz(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,d(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n,r;const a=e.context.data,o=[],l=[],h={},c=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,d=c&&0===c.currentIndex;if(a.forEach(((e,i)=>{var s;l[i]={},o[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?l[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!c?o[i][s]=t[s](e):0!==i||c&&!d||(h[s]=t[s](e))})),l[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),c){const t=null!==(r=null===(n=e.attribute)||void 0===n?void 0:n.segments)&&void 0!==r?r:[];return t.push({points:l}),d?Object.assign(Object.assign({},h),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(o,l);if(t)return Object.assign(Object.assign(Object.assign({},h),o[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},h),o[0]),{points:l,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:hD.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[EI]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}class Pz extends Ez{constructor(){super(...arguments),this.type=Pz.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)===mO.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}Pz.type="line";const Rz=()=>{eI.registerMark(Pz.type,Pz),qA(),HA(),WE(),zE(),sF(),eI.registerGraphicComponent("line",Eg)};class Oz extends HD{constructor(){super(...arguments),this.type=Oz.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="circle":a.symbolType=o,a}}Oz.type="symbol";const Iz=()=>{eI.registerMark(Oz.type,Oz),qA(),JA(),zE(),eI.registerGraphicComponent("symbol",Tg)};class Lz extends nz{_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)}}function Dz(t){return t.length>=2&&k(t[0])&&k(Y(t))&&Y(t)>=t[0]}function Fz(t,e){var i;const s=Y(e)-e[0],n=Y(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=Y(e)>0?Y(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!k(o.min),extendable_max:!k(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):Y(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function zz(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 jz(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 Hz(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 Vz(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 Nz=(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=>t.type.includes("ticks"))))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=Y(p)-p[0];if(0===g)return t;const f=c.domain(),m=Y(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=ie(t,e),a=Math.max(te(i),te(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return KC(v)};class Wz{constructor(t){this.id=$y(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class Uz extends Wz{constructor(){super(Uz.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!eB(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(t,e){const i=this._checkEnableSync(e);if(!i)return;if(!i.zeroAlign)return;const s=this._getTargetAxis(e,i);s&&e.event.on(bL.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id||t.id===s.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&&Dz(c)&&Dz(d)))return;const u=Fz(t,c),p=Fz(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:k}=p;if(0===g&&0===f){if(!jz(u,p))return}else if(0===y&&0===b){if(!jz(p,u))return}else if(_||k)if(_&&!k){if(!zz(u,p))return}else if(k&&!_){if(!zz(p,u))return}else{if(f===b)return;if(f>b){if(!Hz(u,p))return}else if(!Hz(p,u))return}else{if(0===f&&0===y){if(!Vz(u,p))return}else if(0===b&&0===g&&!Vz(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===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)})(s,e)}))}onDidCompile(t,e){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){TL(e.getOption().dataSet,"tickAlign",Nz);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}Uz.pluginType="component",Uz.type="AxisSyncPlugin";const Gz={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function Yz(t){let e=0;return P(t,"tick.visible")&&(e+=P(t,"tick.tickSize")),P(t,"label.visible")&&(e+=P(t,"label.space")),e}function Xz(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 $z(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const Kz=t=>"band"===t||"ordinal"===t||"point"===t;function qz(t,e){return{id:t,label:t,value:e,rawValue:t}}function Zz(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class Jz extends GD{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const Qz=`${MI}_ARC_TRANSFORM_VALUE`,tj=`${MI}_ARC_RATIO`,ej=`${MI}_ARC_START_ANGLE`,ij=`${MI}_ARC_END_ANGLE`,sj=`${MI}_ARC_K`,nj=`${MI}_ARC_MIDDLE_ANGLE`,rj=`${MI}_ARC_QUADRANT`,aj=`${MI}_ARC_RADIAN`,oj=-Math.PI/2,lj=3*Math.PI/2,hj=.6,cj=(t,e,i,s)=>{const n=t();if(x(n))return n;if(c(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return ue(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},dj=(t,e,i)=>{var s;const n=null!==(s="band"===e?_F("axisBand",i):"linear"===e?_F("axisLinear",i):{})&&void 0!==s?s:{},r=_F("angle"===t?"axisAngle":"axisRadius",i);return tI({},_F("axis",i),n,r)};function uj(t,e,i,s){switch(t){case n.cartesianBandAxis:return fz(uz(i,["z"]),"band",e);case n.cartesianLinearAxis:return fz(uz(i,["z"]),"linear",e);case n.cartesianLogAxis:return fz(uz(i,["z"]),"log",e);case n.cartesianSymlogAxis:return fz(uz(i,["z"]),"symlog",e);case n.cartesianAxis:case n.cartesianTimeAxis:return fz(uz(i),void 0,e);case n.polarBandAxis:return dj(i.orient,"band",e);case n.polarLinearAxis:return dj(i.orient,"linear",e);case n.polarAxis:return dj(i.orient,void 0,e);case n.cartesianCrosshair:return((t,e)=>{var i,s;const r=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:d}=null!==(s=_F(n.crosshair,t))&&void 0!==s?s:{},p=r.find((t=>hz(t.orient)));let g;g=u(p)?tI({},Kz(p.type)?a:o,l):l;const f=r.find((t=>cz(t.orient)));let m;return m=u(f)?tI({},sB(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(e,s);case n.polarCrosshair:return((t,e)=>{var i,s;const r=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:d}=null!==(s=_F(n.crosshair,t))&&void 0!==s?s:{},p=r.find((t=>"angle"===t.orient));let g;g=u(p)?tI({},Kz(p.type)?a:o,l):l;const f=r.find((t=>"radius"===t.orient));let m;return m=u(f)?tI({},sB(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case n.colorLegend:case n.sizeLegend:case n.discreteLegend:case n.dataZoom:case n.scrollBar:return pj(i,_F(t,e));default:return _F(t,e)}}const pj=(t,e)=>{var i;const s=tI({},e,e[pz(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class gj extends gD{getTheme(t,e){return uj(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({},VO(e)),{[s]:0}))}}class fj extends vD{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=gj,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof Fc||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:xL.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new Jz(this)}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)))}_getNeedClearVRenderComponents(){return[]}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=>!N(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&&(t.release(!0),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=>{e.compile({group:t,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}}getDatum(t){}}var mj,vj;fj.transformerConstructor=gj,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(mj||(mj={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(vj||(vj={}));class _j extends HD{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}clearComponent(){this._component&&(this._component.parent&&this._component.parent.removeChild(this._component),this._component=null)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=eI.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(_L.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){super.release(),this.removeProduct()}}_j.type="component";const yj=()=>{eI.registerMark(_j.type,_j)},bj=t=>t;class xj extends fj{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._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(u)}created(){var t,e,i,s,n,r,a,o,l,h,c,d,p,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()?mj.circleAxis:mj.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(b),this._axisMark=b,b.setMarkConfig({zIndex:this.layoutZIndex}),u(this._spec.id)&&b.setUserId(this._spec.id),b.setMarkConfig({interactive:null!==(t=this._spec.interactive)&&void 0!==t?t:this.getDefaultInteractive()}),this._marks.addMark(b),null===(e=this._spec.grid)||void 0===e?void 0:e.visible){const t=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?vj.circleAxisGrid:vj.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(t),t.setMarkConfig({zIndex: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:aD.Axis_Grid,interactive:!1}),this._marks.addMark(t),this._gridMark=t}if((null===(o=this._option.globalInstance)||void 0===o?void 0:o.isAnimationEnable())&&!1!==P(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=qF(null===(l=eI.getAnimationInKey("axis"))||void 0===l?void 0:l(),{appear:null!==(c=null!==(h=this._spec.animationAppear)&&void 0!==h?h:P(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==c?c:P(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(p=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:P(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==p?p:P(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(f=null!==(g=this._spec.animationEnter)&&void 0!==g?g:P(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==f?f:P(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(v=null!==(m=this._spec.animationExit)&&void 0!==m?m:P(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==v?v:P(this._option.getChart().getSpec(),"animationExit"),update:null!==(y=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:P(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==y?y:P(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()),e=new LD(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return cO(this._regions,(s=>{var r;let a=this.collectSeriesField(t,s);if(a=_(a)?eB(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!eB(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(r=s.getViewDataStatistics)||void 0===r?void 0:r.call(s),o=this.type===n.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return cO(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:s}=this._spec;u(t)&&(this._seriesUserId=G(t)),u(i)&&(this._regionUserId=G(i)),u(e)&&(this._seriesIndex=G(e)),u(s)&&(this._regionIndex=G(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(bL.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const t=dO(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));t.length>1?this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()})):1===t.length&&t[0].target.addListener("change",(()=>{this.updateScaleDomain()})),cO(this._regions,(t=>{t.event.on(bL.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(bL.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&N(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):cO(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(cO(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_getAxisAttributes(){const e=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&e.select,hover:!0!==this._option.disableTriggerEvent&&e.hover};var s;if(e.domainLine&&e.domainLine.visible?i.line=((s=cL(s=e.domainLine)).startSymbol=cL(s.startSymbol),s.endSymbol=cL(s.endSymbol),s):i.line={visible:!1},e.label&&e.label.visible){const t=j(e.label,["style","formatMethod","state"]);i.label=t,e.label.style&&(i.label.style=c(e.label.style)?(t,i,s,n)=>{var r;const a=e.label.style(t.rawValue,i,t,s,n);return pL(tI({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:pL(e.label.style)),(e.label.formatMethod||e.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),e.label.state&&(i.label.state=function(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{c(t[i])?e[i]=(e,s,n,r)=>pL(t[i](e.rawValue,s,e,n,r)):E(t[i])||(e[i]=pL(t[i]))})),e}(e.label.state)),c(e.label.dataFilter)&&(i.label.dataFilter=(t,i)=>e.label.dataFilter(t,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(e.tick&&e.tick.visible?(i.tick={visible:e.tick.visible,length:e.tick.tickSize,inside:e.tick.inside,alignWithLabel:e.tick.alignWithLabel,dataFilter:c(e.tick.dataFilter)?t=>e.tick.dataFilter(t,{vchart:this._option.globalInstance}):void 0},e.tick.style&&(i.tick.style=c(e.tick.style)?(t,i,s,n)=>{var r;const a=e.tick.style(t,i,s,n);return pL(tI({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:pL(e.tick.style)),e.tick.state&&(i.tick.state=dL(e.tick.state))):i.tick={visible:!1},e.subTick&&e.subTick.visible?(i.subTick={visible:e.subTick.visible,length:e.subTick.tickSize,inside:e.subTick.inside,count:e.subTick.tickCount},e.subTick.style&&(i.subTick.style=c(e.subTick.style)?(t,i,s,n)=>{var r;const a=e.subTick.style(t,i,s,n);return pL(tI({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:pL(e.subTick.style)),e.subTick.state&&(i.subTick.state=dL(e.subTick.state))):i.subTick={visible:!1},e.title&&e.title.visible){const s=e.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=t(s,["autoRotate","angle","style","background","state","shape"]);let u,p=r;"left"!==e.orient&&"right"!==e.orient||n&&d(p)&&(p="left"===e.orient?-90:90,u=Gz[e.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?re(p):null,textStyle:tI({},u,pL(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:pL(h.style)}),h.state&&(i.title.state.shape=dL(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:pL(o.style)}),o.state&&(i.title.state.background=dL(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=dL(l))}else i.title={visible:!1};return e.background&&e.background.visible?(i.panel={visible:!0},e.background.style&&(i.panel.style=pL(e.background.style)),e.background.state&&(i.panel.state=dL(e.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:kI(t.grid.alternateColor),alignWithLabel:t.grid.alignWithLabel,style:c(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 pL(tI({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:pL(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:kI(t.subGrid.alternateColor),style:pL(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=yF(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){CL(this._option.dataSet,"scale",bj);const i=this.registerTicksTransform();return new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,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)}getDatum(t){var e;return t&&t.name===fw.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}xj.specKey="axes";const Sj=()=>{yj(),eI.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},kj=[Uz];class Aj extends xj{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}constructor(e,i){super(e,i),this.type=n.cartesianAxis,this.name=n.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=aD.Axis,this.layoutLevel=oD.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),cO(this._regions,(t=>{const e=this.getOrient();hz(e)?Zz(t.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):cz(e)?Zz(t.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):dz(e)&&Zz(t.getZAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&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._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{const e=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=t(i,["grid"]),r=tI({x:e.x,y:e.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(tI({x:e.x,y:e.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=hz(this.getOrient()),n=t=>{var e;return(s?!hz(t.getOrient()):hz(t.getOrient()))&&eB(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&&Y(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(u(t))a=r.find((e=>e.id===t));else if(u(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=uz(e,["z"]),dz(this._orient)&&(this.layoutType="absolute"),this._dataSet=i.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!_(e)){if(!$z(e))return null;const{axisType:t,componentName:s}=gz(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=>cz(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(!$z(t))return;const{axisType:s,componentName:n}=gz(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]),r=eI.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}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return hz(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):dz(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(kj.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){hz(this.getOrient())?m(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):m(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&&!hz(t.orient)&&(i=!u(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!dz(this.getOrient())&&this._spec.innerOffset){const t=this._spec;cz(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=zO(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=zO(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=hz(this.getOrient())?t.fieldX:dz(this.getOrient())?t.fieldZ:t.fieldY,eB(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;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,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:eB(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 t;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(_L.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(hz(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._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=hz(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)}))}collectScale(){const t=[];return cO(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]:hz(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:dz(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();cO(this._regions,(e=>{hz(t)?Zz(e.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):cz(t)?Zz(e.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):dz(t)&&Zz(e.getZAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(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=hz(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 s={skipLayout:!1},n=hz(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)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=tI(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new je).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=hz(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?mt(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):mt(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-Y(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&d(null===(e=a.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=a.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 o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return qz(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:eB(this._scale.type)?i>=s[0]&&i<=Y(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(bL.layoutEnd,this._updateAxisLayout),this.event.on(bL.layoutEnd,this._fixAxisOnZero),this.event.on(bL.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 i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}Aj.type=n.cartesianAxis,Aj.specKey="axes";const Mj=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function wj(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,Cj=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function Bj(t,e,i="count"){const s=Cj(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const Ej=Math.sqrt(50),Pj=Math.sqrt(10),Rj=Math.sqrt(2);class Oj{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){u(this._spec.nice)&&(this._nice=this._spec.nice),u(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=Xz(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(i.forceTickCount))e=i.forceTickCount;else if(c(i.tickCount)){const t=this._scale.range();let s=Math.abs(Y(t)-t[0]);if(1===s&&this._option){s=hz(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=k(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return d(s)&&d(n)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice(e):(u(s)||u(this._softMinValue))&&d(n)&&d(this._softMaxValue)?this._scale.niceMax(e):!(!d(s)||!d(this._softMinValue)||!u(n)&&!u(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return d(e)&&d(i)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice():(u(e)||u(this._softMinValue))&&d(i)&&d(this._softMaxValue)?this._scale.niceMax():!(!d(e)||!d(this._softMinValue)||!u(i)&&!u(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=d(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(Tj),e.sort(Tj),{domain:wj(t,e),scope:Bj(t,e,i)}}(r,Dy(t),this._spec.breaks[0].scopeType);e=Dy(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=Y(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),u(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),u(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=Xz(this._spec);if(u(e)||u(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[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=Ej?10:n>=Pj?5:n>=Rj?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(Y(t),0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();if(this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(bL.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=Y(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}updateScaleDomainByModel(t){if(t=null!=t?t:this._scale.domain(),this.extendDomain(t),this.includeZero(t),this.setDomainMinMax(t),this.niceDomain(t),this._scale.domain(t,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(t),this._domainAfterSpec=this._scale.domain(),this.event.emit(bL.scaleDomainUpdate,{model:this}),this.event.emit(bL.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(Y(t)-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}_updateRawDomain(){const t=this.collectData(0,!0),e=this.computeLinearDomain(t);this._rawDomain=e,this.event.emit(bL.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}const Ij={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},Lj={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},Dj={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}}},Fj={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}}};class zj extends Aj{constructor(){super(...arguments),this.type=n.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new GB}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];u(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),u(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!dz(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=hz(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=DO(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=Dy(this._break.scope).map((t=>i[0]+(Y(i)-i[0])*t))),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}registerTicksTransform(){const t=`${this.type}-ticks`;return TL(this._option.dataSet,t,tE),t}}zj.type=n.cartesianLinearAxis,zj.specKey="axes",zj.builtInTheme={axis:Fj,axisLinear:Ij,axisX:Lj,axisY:Dj},U(zj,Oj);const jj=()=>{eI.registerGraphicComponent(mj.lineAxis,((t,e)=>new NC(t,e))),eI.registerGraphicComponent(vj.lineAxisGrid,((t,e)=>new JE(t,e))),Sj(),eI.registerComponent(zj.type,zj)};class Hj{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new LD(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{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(bL.scaleDomainUpdate,{model:this}),this.event.emit(bL.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).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=G(e).concat(i);if(n.push(r),o){const e=qz(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=>qz(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const t=this._spec.domain;for(let e=0;ethis._rawDomainIndex[e][t]=i))}this.event.emit(bL.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const Vj={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}};class Nj extends Aj{constructor(){super(...arguments),this.type=n.cartesianBandAxis,this._scale=new AB}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}}registerTicksTransform(){const t=`${this.type}-ticks`;return TL(this._option.dataSet,t,rE),t}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=fB(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(),p=e=>{const i=t===n?a:0;if(d(r)||t{eI.registerGraphicComponent(mj.lineAxis,((t,e)=>new NC(t,e))),eI.registerGraphicComponent(vj.lineAxisGrid,((t,e)=>new JE(t,e))),Sj(),eI.registerComponent(Nj.type,Nj,!1)};class Uj extends zj{constructor(){super(...arguments),this.type=n.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),cO(this._regions,(t=>{hz(this.getOrient())?Zz(t.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):Zz(t.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=tI({},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 Ba(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.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 LD(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=gi.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=>qz(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=>qz(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return TL(this._option.dataSet,t,tE),t}transformScaleDomain(){}}Uj.type=n.cartesianTimeAxis,Uj.specKey="axes",Uj.builtInTheme={axis:Fj,axisX:Lj,axisY:Dj};class Gj extends zj{constructor(){super(...arguments),this.type=n.cartesianLogAxis,this._zero=!1,this._scale=new KB}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return TL(this._option.dataSet,t,tE),t}transformScaleDomain(){}}Gj.type=n.cartesianLogAxis,Gj.specKey="axes",Gj.builtInTheme={axis:Fj,axisLinear:Ij,axisX:Lj,axisY:Dj},U(Gj,Oj);class Yj extends zj{constructor(){super(...arguments),this.type=n.cartesianSymlogAxis,this._zero=!1,this._scale=new qB}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return TL(this._option.dataSet,t,tE),t}transformScaleDomain(){}}Yj.type=n.cartesianSymlogAxis,Yj.specKey="axes",Yj.builtInTheme={axis:Fj,axisLinear:Ij,axisX:Lj,axisY:Dj},U(Yj,Oj);const Xj=`${MI}_hide_`;function $j(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const Kj=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[Xj]&&($j(t,!0),t[Xj]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=d(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[Xj]=!0,$j(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=d(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},qj=()=>{eI.registerGrammarTransform("symbolOverlap",{transform:Kj,runType:"afterEncode"})},Zj={min:$,max:X,average:rO,sum:nO};function Jj(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}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function Qj(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 tH(t,e,i,s){return Qj(t,e,i,"min",s)}function eH(t,e,i,s){return Qj(t,e,i,"max",s)}function iH(t,e,i,s){return Qj(t,e,i,"average",s)}function sH(t,e,i,s){return Qj(t,e,i,"sum",s)}const nH=(t,e)=>{let i=c(t.size)?t.size():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=Jj;if("min"===n?l=tH:"max"===n?l=eH:"average"===n?l=iH:"sum"===n&&(l=sH),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[]},rH=()=>{eI.registerGrammarTransform("dataSampling",{transform:nH})};class aH extends lz{constructor(){super(...arguments),this.type=mO.line,this.transformerConstructor=Lz,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.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(qF(null===(i=eI.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),ZF("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=oz(this);this._symbolMark.setAnimationConfig(qF(null===(s=eI.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),ZF("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),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]}}aH.type=mO.line,aH.mark=Tz,aH.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},aH.transformerConstructor=Lz,U(aH,wz);class oH{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=G(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{zL(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof Ba)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];jy(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];jy(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class lH{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)=>{qy(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{JI(e,[{key:t,operations:eB(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&&JI(e,[{key:i.field,operations:eB(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?PO("colorOrdinal"):PO(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(qy(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),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(N(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;if(!N(r.specified,s.specified))return e.reMake=!0,e;s.range&&!N(s.range,n.range())&&(n.range(s.range),e.reRender=!0),qy(s.domain)?e.reRender=!0:N(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(!qy(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=eB(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=eB(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(d(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),d(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;eB(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(d(t.changeDomain)||"none"===t.changeDomain||d(t.seriesId))return void(eB(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=eB(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!E(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)));eB(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(d(t.field)||!d(t.changeDomain)&&"none"!==t.changeDomain&&!d(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class hH{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&t.addState(i,!0,l):a&&t.addState(s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&t.addState(i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{t.removeState(i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&t.removeState(e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}class cH extends pD{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){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=$y(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:wI,height:TI},this._viewRect={width:wI,height:TI},this._viewBox={x1:0,y1:0,x2:wI,y2:TI},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)=>G(t).some((t=>u(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=VO(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new vL(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new oH(this._dataSet),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===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new hH;const t=this.getAllSeries(),e=[],i={};t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=`${n}-${t.type}`;i[r]?s.forEach((t=>{i[r].marks.push(t)})):(i[r]=Object.assign(Object.assign({},t),{marks:s}),e.push(i[r]))}))}})),e.forEach((t=>{const e=eI.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(qF({},ZF("stage",this._spec,{}),null))}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.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||u(t.gradient))return;const e=j(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=eI.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},e),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:aD.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(e,i){if(!e)return;const{spec:s}=i,n=t(i,["spec"]),r=new e(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(e,i){if(!e)return;const{spec:s}=i,n=t(i,["spec"]);let r;if(u(s.regionId)?r=this.getRegionsInUserId(s.regionId):u(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new e(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(v(t))return this.getAllModels().find((e=>e.userId===t));if(c(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){const s=eI.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"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(){var t,e,i,s;if(null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeLayoutWithSceneGraph)||void 0===e||e.call(t,this._option.globalInstance),this.getLayoutTag()){this._event.emit(bL.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const t=this.getLayoutElements();this._layoutFunc(this,t,this._layoutRect,this._viewBox),this._event.emit(bL.afterLayout,{elements:t,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(bL.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterLayoutWithSceneGraph)||void 0===s||s.call(i,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof fD)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 HD))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof HD)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}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){G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&zL(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=tD(this._spec,this._option,{width:wI,height:TI})),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(_(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),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=xO(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new lH(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){eD(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=xO(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0};return Object.keys(t).filter((t=>!e[t])).sort()}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=this._getSpecKeys(this._spec);if(!N(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{eD(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[n.title]:!0,[n.brush]:!0,[n.indicator]:!0};this._components.forEach((s=>{var r,a;if(s.type===n.label||s.type===n.totalLabel)return;i[s.type]&&(i[s.type]=!1);const o=s.specKey||s.type,l=null!==(r=this._spec[o])&&void 0!==r?r:{};_(l)?(e[o]=e[o]||{specCount:l.length,componentCount:0},e[o].componentCount++,eD(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):eD(t,s.updateSpec(l))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}const s=t=>t&&!1!==t.visible;Object.keys(i).forEach((e=>{if(i[e]){const i=this._spec[e];(_(i)?i.some(s):s(i))&&(t.reMake=!0)}}))}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];eD(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(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:s=0,x2:n,y2:r}=t;e={width:n-i,height:r-s}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=jO(this._paddingSpec,e,e),this._layoutRect.width=e.width-this.padding.left-this.padding.right,this._layoutRect.height=e.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(bL.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),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(){this._backgroundMark&&this._backgroundMark.compile()}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._option.globalInstance),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,this._option.globalInstance)}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._option.globalInstance),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,this._option.globalInstance)}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._option.globalInstance),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,this._option.globalInstance)}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(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(E(t[s]))continue;const n=t[s];let r={stateValue:s};r=c(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(cD.STATE_SELECTED,t,e,i)}setHovered(t,e,i){this._setStateInDatum(cD.STATE_HOVER,t,e,i)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(cD.STATE_SELECTED)}clearHovered(){this.clearState(cD.STATE_HOVER)}_initEvent(){[bL.dataZoomChange,bL.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(_L.AFTER_MARK_RENDER_END,e)};this._event.on(_L.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?G(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:fL;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||c(e.filter)&&e.filter(o,l))){if(gL(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let r=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===Az.dimensionHover||s===Az.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(r=i)}}));const a=d(t)||!r||r.every((t=>sB(t.axis.getScale().type)&&d(t.index))),o=a||r.every((t=>sB(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(n.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};r.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(n.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(r))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(n.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(n.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),r=[];s.forEach((e=>{const i=t(e);!1!==i&&r.push({axis:e,value:i})})),i.showCrosshair(r)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const dH=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(u(n)){const t=G(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(u(r))return G(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(u)};class uH{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={}),u(t.stackInverse)&&t.region.forEach((e=>{!u(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),u(t.stackSort)&&t.region.forEach((e=>{!u(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):ZO(t,a,c.spec),ZO(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));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=dH(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=dH(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(u(n)){const t=G(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(u(r))return G(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(u)})(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,e,i){var s,n,r,a,o;const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,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},h=this.seriesType;return h&&(l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(eI.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(eI.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,r,a;const o=[],l=eI.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=eI.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=eI.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(r=d.getSpecInfo(t,i))||void 0===r||r.forEach((t=>{o.push(e(d,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):bF(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=bF(t,u.specKey,u.type))||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"];return i.find((i=>{if(!s.includes(i.orient))return!1;if(u(i.seriesId)){if(G(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(u(i.seriesIndex)){if(G(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;x(n)?(t.minBandSize=n,o=!0):x(r)?(t.minBandSize=r,o=!0):x(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:_(a)?a[a.length-1]:a})}}class pH extends uH{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_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;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{d(i[t])&&(i[t]=n[t])})),P(i,"trimPadding")&&tI(i,iD(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class gH extends pH{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),QL(t)}}const fH=(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&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=eL(t,!0);for(const e in o)for(const i in o[e].nodes)rL(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)nL(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&sL(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(bL.regionSeriesDataFilterOver,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class vH{_beforeInit(){this._dataSet&&TL(this._dataSet,"stackSplit",fH)}_initStack(){this._stack=new mH(this),this._stack.init()}}const _H={state:cD.STATE_DIMENSION_HOVER,reverseState:cD.STATE_DIMENSION_HOVER_REVERSE,trigger:Az.dimensionHover};class yH extends rF{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},_H,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=fL(i);let n;return n=_(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}yH.type="dimension-hover",yH.defaultOptions=_H;const bH=()=>{eI.registerInteractionTrigger(yH.type,yH)},xH=()=>{eI.registerComposedEvent(Az.dimensionHover,kz),eI.registerComposedEvent(Az.dimensionClick,vz)},SH=t=>t.fieldX[0],kH=t=>t.fieldY[0],AH=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},MH=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},wH=(t,e)=>t?e?SH:AH:e?kH:MH,TH=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=Sz(t,(t=>hz(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=Sz(t,(t=>cz(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{sB(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((t=>{if(d.size>0){if(d.has(t)){const s=CH(t,i,wH(e,sB(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=CH(t,i,wH(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},CH=(t,e,i)=>{const s=t.positionToData(e,!0);return d(s)?null:BH(t,s,i)},BH=(t,e,i)=>{const s=t.getScale();if(d(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=bz(e,t,"cartesian",null!=i?i:hz(t.getOrient())?SH:kH);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},EH=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:p,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,_=0,y=null;if(d.size){const t=Array.from(d.values())[0];_=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,y=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(_)&&!Number.isNaN(_),x=s&&!b&&u(p),S=x?p:{coordRange:[0,0],sizeRange:[0,0],coord:_,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:y};let k;S&&(S._isCache=x);let A=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(sB(m.type))k=m.bandwidth(),0===k&&m.step&&(A=m.step());else if(eB(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(k=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):k=1,_=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=Yz(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(a=y.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&y&&null!==(o=y.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(l=y.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&y&&null!==(h=y.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(c=y.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&y&&null!==(d=y.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(u=y.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&y&&null!==(p=y.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};RH(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=_+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=_+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&PH(S.labels[t],t,f.label)}))}t[n].bandSize=null!=k?k:0,t[n].offsetSize=A,t[n].cacheInfo=S})),t),PH=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=yF(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},RH=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},OH=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=IH(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},IH=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},LH=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return EH(c,r,e),c.xField.cacheInfo?OH(c.xField):c.yField.cacheInfo?OH(c.yField):void 0},DH=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],FH=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&DH.forEach((e=>{u(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(zH(s).every((t=>{var e;return!wF("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},zH=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{u(t.series)&&e.push(t.series)}))})),e},jH={dom:`${MI}_TOOLTIP_HANDLER_DOM`,canvas:`${MI}_TOOLTIP_HANDLER_CANVAS`},HH={key:"其他",value:"..."};var VH;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(VH||(VH={}));class NH{constructor(t){this._showTooltipByHandler=(t,e)=>{var i,s,n;if(d(t))return 1;e.changePositionOnly||this.clearCache(),this._updateViewSpec(t,e);const r=this._cacheActiveSpec;if(d(r)||!1===r.visible)return 1;e.tooltipSpec=this.component.getSpec(),e.activeTooltipSpec=r;const{title:a,content:o}=r,l=d(null==a?void 0:a.key)&&d(null==a?void 0:a.value)&&!(null==o?void 0:o.length);if(this.component.event.emit(bL.tooltipShow,Object.assign(Object.assign({},e),{isEmptyTooltip:l,tooltipData:t,activeType:this.activeType,tooltip:this.component})),l)return 1;let h;return(null===(i=r.handler)||void 0===i?void 0:i.showTooltip)?h=r.handler.showTooltip.bind(r.handler):(null===(s=this.component.tooltipHandler)||void 0===s?void 0:s.showTooltip)&&(h=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),h?null!==(n=h(this.activeType,t,e))&&void 0!==n?n:0:1},this.component=t}_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}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:p,model:g}=e;if(!p||!this._cacheActiveSpec){const p=this.component.getSpec();if(this._cacheActiveSpec=FH(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){d(this._cacheActiveSpec.handler)&&u(p.handler)&&(this._cacheActiveSpec.handler=p.handler);const g=null!==(i=p[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},HH),t):HH;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!d(e)&&wF(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class WH extends NH{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)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],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(!sB(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(u(s))break}return u(s)&&s.getDimensionField()[0]===s.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}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const UH=()=>{eI.registerTooltipProcessor("dimension",WH)};class GH extends NH{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,Xo.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(fL(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const YH=()=>{eI.registerTooltipProcessor("mark",GH)};class XH extends NH{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:G(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?G(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return G(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=G(s)[0][a];return r.filter((t=>t[a]===o))}}const $H=()=>{eI.registerTooltipProcessor("group",XH)};class KH extends cH{constructor(){super(...arguments),this.transformerConstructor=gH,this.type="line",this.seriesType=mO.line}_setModelOption(){this._modelOption.getDimensionInfo=TH,this._modelOption.getDimensionInfoByValue=BH,this._modelOption.getRectByDimensionData=LH}}KH.type="line",KH.seriesType=mO.line,KH.transformerConstructor=gH,U(KH,vH);const qH=[...Bz,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class ZH extends Ez{constructor(){super(...arguments),this.type=ZH.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return qH}_getIgnoreAttributes(){return[]}}ZH.type="area";const JH=()=>{eI.registerMark(ZH.type,ZH),qA(),EA(),WE(),zE(),sF(),eI.registerGraphicComponent("area",ef)};class QH extends EF{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of G(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")),u(e))return e}return i}}}const tV=Object.assign(Object.assign(Object.assign({},NF),Mz),{area:{name:"area",type:"area"}}),eV=()=>{eI.registerAnimation("area",eF),iF(),QD()};class iV extends Lz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!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,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_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),p=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=u(l.zIndex)||u(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||p&&!d)&&(g=h,f=l),l.style=tI({},f.style,g.style),l.state=tI({},f.state,g.state),!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),t.area=l,t.line=h}}class sV extends lz{constructor(){super(...arguments),this.type=mO.area,this.transformerConstructor=iV,this._sortDataByAxis=!1}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(sV.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var t,e,i,s,n;const r=null!==(i=null===(e=null===(t=this.getSpec().area)||void 0===t?void 0:t.style)||void 0===e?void 0:e.curveType)&&void 0!==i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,a=r===gF?"horizontal"===this._direction?"monotoneY":"monotoneX":r,o=this._areaMark;if(o){const t=this._isAreaVisible(),e=this._isLineVisible();t||e?o.setVisible(!0):o.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return RO(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),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",lD.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return RO(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",lD.Series),this.setMarkStyle(o,{fill:!!t&&this.getColorAttribute(),stroke:!!e&&this.getColorAttribute()},"normal",lD.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",lD.Series),this.getStack()&&this.setMarkStyle(o,{zIndex:t=>-t[LI]},"normal",lD.Series),this.setMarkStyle(o,{curveType:a},"normal",lD.Built_In),Object.keys(o.stateStyle).forEach((t=>{o.stateStyle[t].stroke&&o.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(qF(null===(e=eI.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),ZF("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(qF(null===(i=eI.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),ZF("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=oz(this);this._symbolMark.setAnimationConfig(qF(null===(s=eI.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),ZF("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new QH(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.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(){super.onLayoutEnd(),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&&_(l)?l[0]:l}}}sV.type=mO.area,sV.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},sV.mark=tV,sV.transformerConstructor=iV,U(sV,wz);class nV extends pH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),QL(t)}}class rV extends cH{constructor(){super(...arguments),this.transformerConstructor=nV,this.type="area",this.seriesType=mO.area}_setModelOption(){this._modelOption.getDimensionInfo=TH,this._modelOption.getDimensionInfoByValue=BH,this._modelOption.getRectByDimensionData=LH}}rV.type="area",rV.seriesType=mO.area,rV.transformerConstructor=nV,U(rV,vH);function aV(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 oV=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:aV(t,e)}),lV=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:aV(t,e)}),hV={type:"fadeIn"},cV={type:"growCenterIn"};function dV(t,e){if(!1===e)return{};switch(e){case"fadeIn":return hV;case"scaleIn":return cV;default:return oV(t)}}class uV extends HD{constructor(){super(...arguments),this.type=uV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}uV.type="rect";const pV=()=>{qA(),YA(),LE("rect",HE),eI.registerMark(uV.type,uV),uT.registerBuiltInAnimate("growHeightIn",oC),uT.registerBuiltInAnimate("growHeightOut",lC),uT.registerBuiltInAnimate("growWidthIn",AC),uT.registerBuiltInAnimate("growWidthOut",MC),uT.registerBuiltInAnimate("growCenterIn",nC),uT.registerBuiltInAnimate("growCenterOut",rC),eI.registerGraphicComponent("rect",Ig)},gV=Object.assign(Object.assign({},NF),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function fV(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;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=WO(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[WF]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):RO(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[UF]):RO(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=RO(this._dataToPosX(t),e,i),n=RO(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[GF]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):RO(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[YF]):RO(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=RO(this._dataToPosY(t),e,i),n=RO(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},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(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},_V.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:tz(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(_V.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",lD.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===n.cartesianBandAxis));let r;if(TL(this._option.dataSet,"addVChartProperty",kF),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=d(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};TL(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();r=new Ba(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:zF.bind(this),call:jF}},!1),null==e||e.target.addListener("change",r.reRunAllTransform)}this._barBackgroundViewData=new LD(this._option,r)}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=YF,s=GF,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=UF,s=WF,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=eL(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)fV(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=RO(this[r](t),l,i),u=RO(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!OO(t[this.getStackValueField()],l)?p=0:pthis._getBarXStart(t,n),x1:t=>this._getBarXEnd(t,n),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",lD.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",lD.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.setMarkConfig({clip:!0,clipPath:()=>{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[II],n=t[LI],r=t[DI],h=t[FI];i=Math.min(i,e,n),s=Math.max(s,e,n),u(r)&&u(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]),{[II]:i,[LI]:s}),a?{[DI]:o,[FI]:l}:void 0),d="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)};t.push(Ig(Object.assign(Object.assign({},d),{cornerRadius:c(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(d,h,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),t}})}initLinearRectMarkStyle(){var t,e,i,s;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);if("horizontal"===this.direction){const t=u(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,r,!0)[0],y1:t=>this._getLinearBarYRange(t,r,!0)[1]}:{y:t=>RO(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,r,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,n,!0),x1:t=>this._getBarXEnd(t,n,!0)},t),"normal",lD.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(n),x1:()=>this._getBarBackgroundXEnd(n)},t),"normal",lD.Series)}else{const t=u(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,n,!0)[0],x1:t=>this._getLinearBarXRange(t,n,!0)[1]}:{x:t=>RO(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,n,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},t),{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r)}),"normal",lD.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},t),{y:()=>this._getBarBackgroundYStart(r),y1:()=>this._getBarBackgroundYEnd(r)}),"normal",lD.Series)}}_initBandBarBackgroundMarkStyle(){var t,e,i,s,n;if(!this._barBackgroundMark)return;const r=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),a=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),o=null!==(n=this._spec.barBackground)&&void 0!==n?n:{},l=d(o.fieldLevel)?void 0:o.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r),y:t=>this._getPosition(this.direction,t,l,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,l),width:()=>{},y1:()=>{}},"normal",lD.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,l,"barBackground"),y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a),width:()=>this._getBarWidth(this._xAxisHelper,l),x1:()=>{},height:()=>{}},"normal",lD.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=$(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=oz(this);this._barMark.setAnimationConfig(qF(null===(e=eI.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),ZF(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=d(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=u(this._spec.barWidth)&&r===n,l=u(this._spec.barMinWidth),h=u(this._spec.barMaxWidth);let c=a;return o&&(c=WO(this._spec.barWidth,a)),l&&(c=Math.max(c,WO(this._spec.barMinWidth,a))),h&&(c=Math.min(c,WO(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,p;"horizontal"===t?(h=this.getYAxisHelper(),c="height",p="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",p="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=d(i)?f:Math.min(f,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,m-1))&&void 0!==r?r:6,_=m===f?this._barMark.getAttribute(c,e):v;if(m>1&&u(this._spec.barGapInGroup)){const t=this._groups.fields,i=G(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=WO(null!==(l=i[r-1])&&void 0!==l?l:Y(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=eB(g.type||"band");return p(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(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}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}}_V.type=mO.bar,_V.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},_V.mark=gV,_V.transformerConstructor=vV;const yV=()=>{rH(),pV(),eI.registerAnimation("bar",((t,e)=>({appear:dV(t,e),enter:oV(t,!1),exit:lV(t,!1),disappear:{duration:qD.disappear.duration}}))),Wj(),jj(),eI.registerSeries(_V.type,_V)};class bV extends pH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),QL(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=p(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 xV extends cH{constructor(){super(...arguments),this.transformerConstructor=bV,this.type="bar",this.seriesType=mO.bar}_setModelOption(){this._modelOption.getDimensionInfo=TH,this._modelOption.getDimensionInfoByValue=BH,this._modelOption.getRectByDimensionData=LH}}xV.type="bar",xV.seriesType=mO.bar,xV.transformerConstructor=bV,U(xV,vH);const SV=[10,20],kV=QC.Linear,AV="circle",MV=QC.Ordinal,wV=["circle","square","triangle","diamond","star"],TV=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},CV=Object.assign(Object.assign({},NF),{point:{name:"point",type:"symbol"}});class BV extends nz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class EV extends lz{constructor(){super(...arguments),this.type=mO.scatter,this.transformerConstructor=BV,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(c(e))return e;if(_(e)){if(d(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=`${MI}_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(p(e)){if(d(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${MI}_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 d(e)?10:x(e)?e:v(e)&&S(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:kV,defaultRange:SV},"size")}getShapeAttribute(t,e){return d(e)?AV:v(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:MV,defaultRange:wV},"shape")}initMark(){this._symbolMark=this._createMark(EV.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:tz(this._spec,EV.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=oz(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(qF(null===(i=eI.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),ZF("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const t=this._symbolMark;t&&("zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:x(this._size)||c(this._size)?this._size:10,symbolType:v(this._shape)||c(this._shape)?this._shape:AV},cD.STATE_NORMAL,lD.Series),(u(this._sizeField)||u(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},cD.STATE_NORMAL,lD.User_Mark),(u(this._shapeField)||u(this._shape))&&this.setMarkStyle(t,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},cD.STATE_NORMAL,lD.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t);const e=[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||e?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",lD.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",lD.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},cD.STATE_NORMAL,lD.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},cD.STATE_NORMAL,lD.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{if(!t)return;const e=t.getGraphics();e&&e.length&&e.forEach(((t,e)=>{var i,s;const n=null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],r=this.dataToPosition(n);r&&t&&t.translateTo(r.x,r.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){this.handleZoom(t)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}EV.type=mO.scatter,EV.mark=CV,EV.builtInTheme={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"}}}}},EV.transformerConstructor=BV;const PV=()=>{Iz(),eI.registerAnimation("scatter",((t,e)=>Object.assign({appear:TV(0,e)},ZD))),Wj(),jj(),eI.registerSeries(EV.type,EV)};class RV extends pH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class OV extends cH{constructor(){super(...arguments),this.transformerConstructor=RV,this.type="scatter",this.seriesType=mO.scatter}_setModelOption(){this._modelOption.getDimensionInfo=TH,this._modelOption.getDimensionInfoByValue=BH,this._modelOption.getRectByDimensionData=LH}}OV.type="scatter",OV.seriesType=mO.scatter,OV.transformerConstructor=RV,U(OV,vH);class IV extends rz{constructor(){super(...arguments),this.type=mO.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 d(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(d(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return d(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=`${MI}_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 LV=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[BI]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[ZI]=e.nameMap[n]:t[ZI]=n})),t.features);class DV extends EF{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 FV extends HD{constructor(){super(...arguments),this.type=FV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}FV.type="path";const zV=()=>{eI.registerMark(FV.type,FV),qA(),NA(),eI.registerGraphicComponent("path",Jg)},jV=Object.assign(Object.assign({},NF),{area:{name:"area",type:"path"}});class HV{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Oa(i,e):Pa[i]?(Ea[i]||(Ea[i]=Oa(i,Pa[i])),Ea[i]):null}(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 VV{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(){}}class NV{constructor(){this._lastScale=0}clearZoom(){this._lastScale=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 WV(t){return t===s["desktop-browser"]||t===s["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:VV}:Gy(t)||Yy(t)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:NV}:null}const UV={debounce:bt,throttle:xt};class GV{constructor(){this._isGestureListener=!1}initZoomable(t,e=s["desktop-browser"]){this._eventObj=t,this._renderMode=e,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=Gy(this._renderMode)||Yy(this._renderMode),WV(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return WV(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(d(r))return;if(!Se({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{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(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:SL.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:SL.chart,consume:!1}];l.on(...c,UV[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,UV[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||WV(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||WV(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 d(r)&&d(a)?s:Se({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:SL.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:SL.chart,consume:!1}];l.on(...c,UV[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,UV[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){WV(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||WV(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(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:SL.chart},(t=>{if(!t.event)return;const{event:n}=t;Se({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:SL.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||WV(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:SL.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||WV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:SL.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:SL.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:SL.chart,source:xL.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:SL.chart,source:xL.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=UV[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=UV[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:SL.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:SL.chart,source:xL.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:SL.chart,source:xL.chart},this._handleDragMouseUp)}))}}function YV(t,e){return`${MI}_${e}_${t}`}class XV extends fj{constructor(){super(...arguments),this.type=n.geoCoordinate,this.name=n.geoCoordinate,this.layoutType="none",this.layoutZIndex=aD.Mark,this._projectionSpec={name:YV(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;const l=u(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,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,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):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,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(d(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:n.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=tI(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var t,e,i;this.event.on(bL.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:s}=this._spec;if(s){let n=!0,r=!0,a=!1;!0!==s&&(n=null===(t=s.zoom)||void 0===t||t,r=null===(e=s.drag)||void 0===e||e,a=null!==(i=s.blank)&&void 0!==i&&i),n&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!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 HV(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===mO.map||e.type===mO.pictogram?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(d(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(d(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(d(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(d(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(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),cO(this._regions,(t=>{var e;if(t.type===mO.map||t.type===mO.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ne})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==mO.map&&e.type!==mO.pictogram||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[ZI],s=t.getDatumCenter(e);i&&u(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!N(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}XV.type=n.geoCoordinate,U(XV,GV);const $V=()=>{eI.registerComponent(XV.type,XV)};class KV extends nz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class qV extends IV{constructor(){super(...arguments),this.type=mO.map,this.transformerConstructor=KV,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 !`),BL.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),TL(this._dataSet,"copyDataView",LL),TL(this._dataSet,"map",LV),TL(this._dataSet,"lookup",xF);const i=BL.get(this.map);i||null===(t=this._option)||void 0===t||t.onError("no valid map data found!");const s=new Ba(this._dataSet,{name:`map_${this.id}_data`});s.parse([i],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:jL.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:ZI,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 LD(this._option,s)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(qV.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:tz(this._spec,qV.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>{var e,i,s,n;return u(t[null!==(e=this._seriesField)&&void 0!==e?e:PI])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:PI]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",lD.Series),t.setPostProcess("fill",(t=>u(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(t,{smoothScale:!0},"normal",lD.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(qF(null===(t=eI.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),ZF("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new DV(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[BI]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[BI],{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;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ne}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ne}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}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 BI}getActiveMarks(){return[this._pathMark]}}qV.type=mO.map,qV.mark=jV,qV.builtInTheme={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"}}}}},qV.transformerConstructor=KV;const ZV=`${MI}_waterfall_default_seriesField`,JV=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n,calculationMode:r}=e,a=[],{dimensionValues:o,dimensionData:l}=n().latestData;let h=Array.from(o[i]);"decrease"===r&&(h=h.reverse());let c={start:0,end:0,positive:0,negative:0,lastIndex:null};return h.forEach(((t,i)=>{const n={start:c.end,end:c.end,lastIndex:c.lastIndex,lastEnd:c.end,index:t,isTotal:!1,positive:c.end,negative:c.end},r=!0===e.stackInverse?l[t].reverse():l[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[NI]=!0:delete t[NI]})),r.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===h.length-1)return!0;return!1};if(r.some((t=>o(t))))return c=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,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=QV([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 f=g[0];let{start:m,end:v}=tN(f,i,s,n,u);i.start=m,i.end=v;let _=m,y=m,b=v-m;const x=p.reduce(((t,e)=>ie(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=ee(_,e)):(t[c]=+y,y=ee(y,e)),t[d]=ee(t[c],e),m=ee(m,e),b=ie(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,n,a,c,h,i,e,o),void a.push(n)}c=QV(r,t,n,a,c,h,i,e),a.push(n)})),a};function QV(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:u,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(u&&"end"!==u.type){if("field"===u.type||"custom"===u.type){if(t[u.tagField]){e=!0;const{start:r,end:a}=tN(t,i,s,n,u);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=ee(i.positive,e)):(t[h]=+i.negative,i.negative=ee(i.negative,e)),t[c]=ee(t[h],e),i.end=ee(i.end,e)}i.isTotal=e,(d(p)||p===ZV)&&(t[ZV]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function tN(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&&!d(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?jy("total.collectCountField error"):n=e[a].start;o<0?jy("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!d(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!d(t[i.valueField])&&(n=ee(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 eN=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>ee(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?t.unshift(o):t.push(o),t},iN={type:"fadeIn"},sN={type:"growCenterIn"};function nN(t,e){switch(e){case"fadeIn":return iN;case"scaleIn":return sN;default:return oV(t,!1)}}class rN extends HD{constructor(){super(...arguments),this.type=rN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(e,i,s){const n=super._transformGraphicAttributes(e,i,s),{x:r,x1:a,y:o,y1:l}=n,h=t(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return Eg(t)}}rN.type="rule";const aN=()=>{eI.registerMark(rN.type,rN),qA(),HA(),eI.registerGraphicComponent("line",Eg)},oN=Object.assign(Object.assign({},gV),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),lN=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:hN(t.map((t=>t.latestData)).flat(),e.fields,i)}};function hN(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)=>hN(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class cN{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 Ba(e instanceof Ca?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),TL(e,"dimensionTree",lN),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 dN extends vV{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const uN={rect:_N,symbol:mN,arc:bN,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=mN(t);h(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:xN,line:SN,area:SN,rect3d:_N,arc3d:bN,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function pN(t,e){var i;const{labelSpec:s}=e;s.overlap&&!p(s.overlap)&&(s.overlap={});const n=null!==(i=uN[t])&&void 0!==i?i:uN.point;return e.series.type===mO.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=fN(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;v(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!v(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:kN(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function gN(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==mO.sankey){const{formatFunc:t,args:n}=yF(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function fN(t){return c(t)?e=>t(e.data):t}function mN(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=fN(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:vN(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function vN(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function _N(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=fN(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;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:yN(o)};let g=!1;return v(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function yN(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 bN(t){var e;const{labelSpec:i}=t,s=null!==(e=fN(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:v(s)&&s.includes("inside"),{position:n,smartInvert:r}}function xN(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=gN(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),Ag(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 SN(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}))):[{index:0,[PI]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function kN(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class AN extends _V{constructor(){super(...arguments),this.type=mO.waterfall,this.transformerConstructor=dN,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&sL(t,e)}}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 cN(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]],d(this._seriesField)&&(this._seriesField=ZV)}getSeriesKeys(){return this._seriesField===ZV?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t,e,i;super.initData(),TL(this._dataSet,"waterfallFillTotal",eN),TL(this._dataSet,"waterfall",JV),(d(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,calculationMode:null!==(e=this._spec.calculationMode)&&void 0!==e?e:"increase",stackInverse:this.getRegion().getStackInverse()}},!1));const s=DL(this.getViewData(),this._dataSet,{name:`${MI}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",s.reRunAllTransform),this._totalData=new LD(this._option,s),s.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:II,endAs:LI,total:this._spec.total,calculationMode:null!==(i=this._spec.calculationMode)&&void 0!==i?i:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}},!1),s.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}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=oz(this);this._barMark.setAnimationConfig(qF(null===(i=eI.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),ZF("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(qF(null===(s=eI.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),ZF("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(){super.initMark();const t=this._createMark(AN.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:ie(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:ie(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return xN(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?RO(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):RO(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle();const t="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:e=>e.lastIndex?this.totalPositionY(e,"lastIndex",t?0:1):0,y1:e=>this.totalPositionY(e,"index",t?1:0)},"normal",lD.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:e=>e.lastIndex?this.totalPositionX(e,"lastIndex",t?0:1):0,x1:e=>this.totalPositionX(e,"index",t?1:0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",lD.Series))}isVisibleLeaderLine(t){return!d(t.lastIndex)&&OO([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}AN.type=mO.waterfall,AN.mark=oN,AN.builtInTheme={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}}}},AN.transformerConstructor=dN;const MN=()=>{aN(),pV(),eI.registerAnimation("waterfall",((t,e)=>({appear:nN(t,e),enter:oV(t,!1),exit:lV(t,!1),disappear:{duration:qD.disappear.duration}}))),tF(),Wj(),jj(),eI.registerSeries(AN.type,AN)},wN=`${MI}_BOX_PLOT_OUTLIER_VALUE`;var TN;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(TN||(TN={}));const CN=(t,e)=>{const i=[],{outliersField:s,dimensionField:n,seriesField:r}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];_(e)||(e=[e]),i.push(...e.map((e=>{const i={[wN]:e};return n.forEach((e=>{i[e]=t[e]})),u(r)&&(i[r]=t[r]),i})))})),i};class BN extends EF{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===TN.OUTLIER)return this.series.getOutliersField();if(t===TN.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case TN.MIN:return this.series.getMinField();case TN.MAX:return this.series.getMaxField();case TN.MEDIAN:return this.series.getMedianField();case TN.Q1:return this.series.getQ1Field();case TN.Q3:return this.series.getQ3Field();case TN.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===TN.OUTLIER)return e[wN];if(t===TN.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case TN.MIN:return e[this.series.getMinField()];case TN.MAX:return e[this.series.getMaxField()];case TN.MEDIAN:return e[this.series.getMedianField()];case TN.Q1:return e[this.series.getQ1Field()];case TN.Q3:return e[this.series.getQ3Field()];case TN.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,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>u(t[wN])}getDefaultContentList(t){return[{key:this.getContentKey(TN.OUTLIER),value:this.getContentValue(TN.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(TN.MAX),value:this.getContentValue(TN.MAX)},{key:this.getContentKey(TN.Q3),value:this.getContentValue(TN.Q3)},{key:this.getContentKey(TN.MEDIAN),value:this.getContentValue(TN.MEDIAN)},{key:this.getContentKey(TN.Q1),value:this.getContentValue(TN.Q1)},{key:this.getContentKey(TN.MIN),value:this.getContentValue(TN.MIN)},{key:this.getContentKey(TN.SERIES_FIELD),value:this.getContentValue(TN.SERIES_FIELD)}]}}class EN extends HD{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==hD.enter&&t.context.diffState!==hD.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;return this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?z(r,i):i}})),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=Dg(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=eI.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const PN=()=>{eI.registerGraphicComponent("glyph",Dg),qA(),IA()},RN=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],ON=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class IN extends EN{constructor(){super(...arguments),this.type=IN.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=RN,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=ON,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}IN.type="boxPlot";const LN=Object.assign(Object.assign({},NF),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),DN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},FN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},zN=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),jN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,M;if(i&&k(i.center))return i.center;let w,T,C,B,E;if("horizontal"===e){w=null===(r=null===(n=(null===(s=zN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,T=null===(h=null===(l=null===(o=null===(a=zN(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,C=null===(p=null===(u=null===(d=null===(c=zN(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=zN(t,"box").attribute.width,i=zN(t,"box").attribute.x;B=i,E=i+e}else{w=null===(m=null===(f=(null===(g=zN(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,T=null===(b=null===(y=null===(_=null===(v=zN(t,"max"))||void 0===v?void 0:v.attribute)||void 0===_?void 0:_.points)||void 0===y?void 0:y[0])||void 0===b?void 0:b.y,C=null===(M=null===(A=null===(S=null===(x=zN(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===M?void 0:M.y;const e=zN(t,"box").attribute.height,i=zN(t,"box").attribute.y;B=i,E=i+e}return k(w)?w:k(B)&&k(E)?(B+E)/2:k(T)&&k(C)?(T+C)/2:k(C)?C:k(T)?T:NaN},HN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,_,y,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=zN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=zN(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=zN(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;y=i,_=i+e;const c=(null===(l=zN(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=zN(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=zN(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=zN(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=zN(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;y=i,_=i+e;const s=(null===(f=zN(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=zN(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(_)&&k(y)?(_+y)/2:k(y)?y:k(_)?_:NaN};class VN extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return DN(jN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class NN extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return FN(jN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class WN extends VN{computeAttribute(){return DN(HN)(this.target,this.params,this.params.options)}}class UN extends NN{computeAttribute(){return FN(HN)(this.target,this.params,this.params.options)}}class GN extends nz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}class YN extends lz{constructor(){super(...arguments),this.type=mO.boxPlot,this.transformerConstructor=GN,this._bandPosition=0}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,r,a;super.setAttrFromSpec();const o=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=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(YN.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(YN.mark.outlier,{key:BI,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var t,e,i,s,n,r;const a=this._boxPlotMark;if(a){const i={lineWidth:this._lineWidth,fill:null!==(t=this._boxFillColor)&&void 0!==t?t:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(e=this._strokeColor)&&void 0!==e?e:"line"!==this._shaftShape?"#000":this.getColorAttribute()};a.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const s="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return WO(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return WO(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return WO(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return WO(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return WO(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return WO(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return WO(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return WO(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(a,i,cD.STATE_NORMAL,lD.Series),this.setMarkStyle(a,s,cD.STATE_NORMAL,lD.Built_In)}const o=this._outlierMark;o&&this.setMarkStyle(o,{fill:null!==(n=null!==(s=null===(i=this._outliersStyle)||void 0===i?void 0:i.fill)&&void 0!==s?s:this._boxFillColor)&&void 0!==n?n:this.getColorAttribute(),stroke:this.getColorAttribute(),size:x(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10},cD.STATE_NORMAL,lD.Series)}initBoxPlotMarkStyle(){var t,e;const i=this._boxPlotMark,s="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(i&&s){const{dataToPosition:e}=s,n=null===(t=null==s?void 0:s.getScale)||void 0===t?void 0:t.call(s,0);this.setMarkStyle(i,{min:t=>RO(e(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>RO(e(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>RO(e(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>RO(e(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>RO(e(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},cD.STATE_NORMAL,lD.Series)}const n=this._outlierMark;if(n&&s){const{dataToPosition:t}=s,i=null===(e=null==s?void 0:s.getScale)||void 0===e?void 0:e.call(s,0),r="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),x:e=>RO(t(this.getDatumPositionValues(e,wN),{bandPosition:this._bandPosition}),i)}:{x:t=>this._getPosition(this.direction,t),y:e=>RO(t(this.getDatumPositionValues(e,wN),{bandPosition:this._bandPosition}),i)};this.setMarkStyle(n,r,cD.STATE_NORMAL,lD.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;TL(this._dataSet,"foldOutlierData",CN),TL(this._dataSet,"addVChartProperty",kF);const t=new Ba(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${MI}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField}}),t.transform({type:"addVChartProperty",options:{beforeCall:zF.bind(this),call:jF}},!1),this._outlierData=new LD(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t;if(this._autoBoxWidth)return this._autoBoxWidth;const e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,i=this._groups?this._groups.fields.length:1,s=null===(t=e.getBandwidth)||void 0===t?void 0:t.call(e,i-1);let n=s;return u(this._spec.boxWidth)&&(n=WO(this._spec.boxWidth,s)),u(this._spec.boxMinWidth)&&(n=Math.max(n,WO(this._spec.boxMinWidth,s))),u(this._spec.boxMaxWidth)&&(n=Math.min(n,WO(this._spec.boxMaxWidth,s))),this._autoBoxWidth=n,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r;let a,o,l;"horizontal"===t?(a=this.getYAxisHelper(),o="boxHeight",l=this.dataToPositionY.bind(this)):(a=this.getXAxisHelper(),o="boxWidth",l=this.dataToPositionX.bind(this));const h=a.getScale(0),c=this._groups?this._groups.fields.length:1,d=null===(i=a.getBandwidth)||void 0===i?void 0:i.call(a,c-1),p=this._boxPlotMark.getAttribute(o,e);if(c>1&&u(this._spec.boxGapInGroup)){const t=this._groups.fields,i=G(this._spec.boxGapInGroup);let o=0,l=0;for(let h=t.length-1;h>=1;h--){const c=t[h],u=null!==(n=null===(s=a.getScale(h))||void 0===s?void 0:s.domain())&&void 0!==n?n:[],g=u.length,f=WO(null!==(r=i[h-1])&&void 0!==r?r:Y(i),d),m=u.indexOf(e[c]);h===t.length-1?(o+=g*p+(g-1)*f,l+=m*(p+f)):(l+=m*(o+f),o+=o+(g-1)*f)}return h.scale(e[t[0]])+a.getBandwidth(0)/2-o/2+l+p/2}const g=eB(h.type||"band");return l(e)+.5*d+(g?-d/2:0)}onLayoutEnd(){super.onLayoutEnd(),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="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=oz(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=eI.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(ZF("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(qF(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(qF(null===(a=eI.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new BN(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}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}YN.type=mO.boxPlot,YN.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},YN.mark=LN,YN.transformerConstructor=GN;const XN=()=>{PN(),HA(),YA(),eI.registerGraphicComponent("line",(t=>Eg(t))),eI.registerGraphicComponent("rect",(t=>Ig(t))),eI.registerMark(IN.type,IN),Iz(),QD(),Wj(),jj(),uT.registerBuiltInAnimate("boxplotScaleIn",VN),uT.registerBuiltInAnimate("boxplotScaleOut",NN),uT.registerBuiltInAnimate("barBoxplotScaleIn",WN),uT.registerBuiltInAnimate("barBoxplotScaleOut",UN),eI.registerSeries(YN.type,YN)};class $N extends HD{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=$N.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return p(n)&&u(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?Kg(t):Ag(t)}}$N.type="text";const KN=()=>{eI.registerMark($N.type,$N),qA(),tM(),$A(),eI.registerGraphicComponent("text",Ag),eI.registerGraphicComponent("richtext",Kg)};class qN extends EF{constructor(){super(...arguments),this._getMeasureData=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]]}}const ZN=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),JN={type:"fadeIn"},QN=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function tW(t,e){return"fadeIn"===e?JN:ZN(t)}const eW=Object.assign(Object.assign({},gV),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class iW extends vV{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 sW extends _V{constructor(){super(...arguments),this.type=mO.rangeColumn,this._barMarkType="rect",this._barName=mO.bar,this.transformerConstructor=iW}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(sW.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:tz(this._spec,sW.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(sW.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(sW.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(t,e,i,s){var n,r,a,o;if(t){this.setMarkStyle(t,{fill:null!==(r=null===(n=null==e?void 0:e.style)||void 0===n?void 0:n.fill)&&void 0!==r?r:this.getColorAttribute(),text:t=>{const s="horizontal"===this._spec.direction?t[this._spec.xField[i]]:t[this._spec.yField[i]];return(null==e?void 0:e.formatMethod)?e.formatMethod(s,t):s}});!function(t,e,i,s,n,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if("vertical"===l())return"center";const e=n(t),s=r(t);if("middle"===i)return"center";if(e>=s){if("start"===i)return"left";if("end"===i)return"right";if("outside"===i)return"left"}else{if("start"===i)return"right";if("end"===i)return"left";if("outside"===i)return"right"}return"center"},textBaseline:t=>{if("horizontal"===l())return"middle";const e=a(t),s=o(t);if("middle"===i)return"middle";if(s>=e){if("start"===i)return"bottom";if("end"===i)return"top";if("outside"===i)return"bottom"}else{if("start"===i)return"top";if("end"===i)return"bottom";if("outside"===i)return"top"}return"middle"}}),t.setMarkStyle(e,{x:t=>{const e=l(),a=n(t),o=r(t);if("vertical"===e)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+s;if("end"===i)return a-s;if("outside"===i)return a+s}else{if("start"===i)return o-s;if("end"===i)return a+s;if("outside"===i)return a-s}return(a+o)/2},y:t=>{const e=l(),n=a(t),r=o(t);if("horizontal"===e)return(n+r)/2;if("middle"===i)return(n+r)/2;if(n>=r){if("start"===i)return r+s;if("end"===i)return n-s;if("outside"===i)return n+s}else{if("start"===i)return r-s;if("end"===i)return n+s;if("outside"===i)return n-s}return(n+r)/2}},"normal",lD.Series)}(this,t,null!==(a=null==e?void 0:e.position)&&void 0!==a?a:s,null!==(o=null==e?void 0:e.offset)&&void 0!==o?o:"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=oz(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(qF(null===(i=eI.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),ZF("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(qF(null===(s=eI.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),ZF("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(qF(null===(n=eI.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),ZF("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new qN(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)}}sW.type=mO.rangeColumn,sW.mark=eW,sW.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},sW.transformerConstructor=iW;const nW=()=>{pV(),KN(),eI.registerAnimation("rangeColumn",((t,e)=>({appear:tW(t,e),enter:ZN(t),exit:QN(t),disappear:{duration:qD.disappear.duration}}))),tF(),Wj(),jj(),eI.registerSeries(sW.type,sW)};var rW,aW;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(rW||(rW={})),function(t){t.middle="middle",t.start="start",t.end="end"}(aW||(aW={}));class oW extends EF{constructor(){super(...arguments),this._getMeasureData=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]]}}const lW=Object.assign({},tV);class hW extends sV{constructor(){super(...arguments),this.type=mO.rangeArea}initMark(){this._areaMark=this._createMark(hW.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const t=this._areaMark;t&&(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",lD.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",lD.Series),this.setMarkStyle(t,{stroke:!1},"normal",lD.Series))}initTooltip(){this._tooltipHelper=new oW(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}hW.type=mO.rangeArea,hW.mark=lW;class cW extends rz{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=hj,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=u(t)?G(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=u(t)?G(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=G(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(d(t)||d(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(G(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(G(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}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:[]};eB(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:[]};eB(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),u(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),u(this._spec.radius)&&(this._outerRadius=this._spec.radius),u(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),u(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(bL.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)&&az(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}}function dW(t){return Ky(t)?Number.parseFloat(t):0}const uW=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&pW(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=pe(e+a/2)};let _=0,y=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let k=p,A=S,M=0;const w=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))}(x);if(m.forEach(((t,e)=>{const i=t[Qz],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=A/M;k=p,m.forEach((e=>{const i=e[r]===f?f:e[Qz]*t;v(e,k,i),k+=i}))}if(0!==_&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},pW=(t,e,i)=>!!d(t)||(0===t.length||(!!t.every((t=>0===dW(t[e])))||!i&&0===t.reduce(((t,i)=>t+dW(i[e])),0)));function gW(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const fW=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:gW(t,!0,HL.appear)}),mW={type:"fadeIn"},vW=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:gW(t,!0,HL.enter)}),_W=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:gW(t,!0,HL.exit)});function yW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return mW;case"growRadius":return fW(Object.assign(Object.assign({},t),{growField:"radius"}));default:return fW(Object.assign(Object.assign({},t),{growField:"angle"}))}}class bW extends HD{constructor(t,e){super(t,e),this.type=xW.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>le({x:0,y:0},this.getAttribute("centerOffset",e,i),e[nj])[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 xW extends bW{constructor(){super(...arguments),this.type=xW.type}}xW.type="arc";const SW=()=>{qA(),CA(),LE("arc",YE),uT.registerBuiltInAnimate("growRadiusIn",xC),uT.registerBuiltInAnimate("growRadiusOut",SC),uT.registerBuiltInAnimate("growAngleIn",iC),uT.registerBuiltInAnimate("growAngleOut",sC),eI.registerGraphicComponent("arc",rf),eI.registerMark(xW.type,xW)},kW=Object.assign(Object.assign({},NF),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class AW extends nz{_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=tI({},this._theme,i,t);const n=(t,e)=>tI({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);_(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 u(s)&&(i.centerX=s),u(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const MW=`${MI}_LABEL_VISIBLE`;class wW extends cW{constructor(){super(...arguments),this.transformerConstructor=AW,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:zO(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:zO(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=oj,this._endAngle=lj,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[nj];if(d(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return le(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;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 a=function(t,e){let i=0,s=2*Math.PI;const n=u(t),r=u(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}}(u(this._spec.startAngle)?re(this._spec.startAngle):this._startAngle,u(this._spec.endAngle)?re(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=u(this._spec.padAngle)?re(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=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;TL(this._dataSet,"pie",uW),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>u(this._spec.minAngle)?re(this._spec.minAngle):0,asStartAngle:ej,asEndAngle:ij,asRatio:tj,asMiddleAngle:nj,asRadian:aj,asQuadrant:rj,asK:sj,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new Ba(this._dataSet,{name:`${MI}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new LD(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},wW.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:EI,groupKey:this._seriesField,isSeriesMark:!0},{morph:tz(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return pO(ej)(t)}endAngleScale(t){return pO(ij)(t)}_computeLayoutRadius(){return cj((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const t={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:IO(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:IO(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},e=this._pieMark;e&&this.setMarkStyle(e,t,"normal",lD.Series);const i=this._emptyArcMark;i&&this.setMarkStyle(i,Object.assign(Object.assign({},t),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",lD.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(t,e){if(super.initMarkStyleWithSpec(t,e),t.name===this._pieMarkName){const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,lD.User_Mark)}"emptyCircle"===t.name&&this.setMarkStyle(t,this.generateRadiusStyle(e.style),"normal",lD.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:pO(MW).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(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(bL.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*(d(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[nj];if(d(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return le(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===HL.appear)return this._startAngle;if(i===HL.disappear)return this._endAngle;const r=[HL.disappear,HL.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[BI];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[BI]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[BI])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[BI])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+le({x:0,y:0},a,e[nj]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+le({x:0,y:0},a,e[nj]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+le({x:0,y:0},a,e[nj]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+le({x:0,y:0},a,e[nj]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=qF(null===(i=eI.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}wW.transformerConstructor=AW,wW.mark=kW,wW.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class TW extends wW{constructor(){super(...arguments),this.type=mO.pie}}TW.type=mO.pie;const CW=()=>{SW(),eI.registerAnimation("pie",((t,e)=>({appear:yW(t,e),enter:vW(t),exit:_W(t),disappear:{duration:qD.disappear.duration}}))),eI.registerAnimation("emptyCircle",((t,e)=>({appear:yW(t,e)}))),eI.registerSeries(TW.type,TW)};function BW(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const EW=t=>({type:BW(t.growField),options:{overall:!0}}),PW={type:"fadeIn"},RW=t=>({type:BW(t.growField)}),OW=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function IW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return PW;case"growAngle":return EW(Object.assign(Object.assign({},t),{growField:"angle"}));default:return EW(Object.assign(Object.assign({},t),{growField:"radius"}))}}class LW extends cW{getStackGroupFields(){return this._angleField}getStackValueField(){return G(this._spec.valueField)[0]||G(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(LI),this.setInnerRadiusField(II)}setValueFieldToPercent(){this.setRadiusField(FI),this.setInnerRadiusField(DI)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const DW=Object.assign(Object.assign({},NF),{rose:{name:"rose",type:"arc"}});class FW extends nz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class zW extends xj{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=_(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let r,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:p,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((t,e)=>{var i,s,r,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${n.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,p=null!==(r=t.endAngle)&&void 0!==r?r:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=p?p:u(d)?d+360:270,center:u(e.center)?e.center:u(null==e?void 0:e.centerX)||u(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.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=p,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const _={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(_),"radius"===i.orient?(o.push(_),a=h):(l.push(_),r=h)})),o.forEach((t=>{t.angleAxisIndex=r})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]),r=eI.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(t,e){super(t,e),this.type=n.polarAxis,this.name=n.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=aD.Axis,this._tick=void 0,this._center=null,this._startAngle=oj,this._endAngle=lj,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),cO(this._regions,(t=>{"radius"===this.getOrient()?Zz(t.radiusAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):Zz(t.angleAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(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.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:zO(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:zO(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this.visible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=re(this._spec.startAngle),this._endAngle=re(this._spec.endAngle),this._inverse=this._spec.inverse}_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:Yz(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}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(){cO(this._regions,(t=>{"radius"===this.getOrient()?Zz(t.radiusAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):Zz(t.angleAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(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 eB(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:eB(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 le(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return he(t,this.getCenter(),this._startAngle,this._endAngle)}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=>qz(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_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=ne.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",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(u(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return cj((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=hj,e=0;const i=this.getChart().getSpec();return cO(this.getRegions(),(s=>{const n=s;if(r=n.type,[mO.rose,mO.radar,mO.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(e){const{grid:i}=e,s=t(e,["grid"]);if(this._axisMark.getComponent().setAttributes(tI({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(tI({},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)}}zW.type=n.polarAxis,zW.specKey="axes";const jW={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},HW={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class VW extends zW{constructor(){super(...arguments),this.type=n.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new GB}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}registerTicksTransform(){const t=`${this.type}-ticks`;return TL(this._option.dataSet,t,tE),t}}VW.type=n.polarLinearAxis,VW.specKey="axes",VW.builtInTheme={axis:Fj,axisLinear:Ij,axisAngle:HW,axisRadius:jW},U(VW,Oj);const NW=()=>{eI.registerGraphicComponent(mj.lineAxis,((t,e)=>new NC(t,e))),eI.registerGraphicComponent(vj.lineAxisGrid,((t,e)=>new JE(t,e))),eI.registerGraphicComponent(mj.circleAxis,((t,e)=>new $C(t,e))),eI.registerGraphicComponent(vj.circleAxisGrid,((t,e)=>new sP(t,e))),Sj(),eI.registerComponent(VW.type,VW)};class WW extends zW{constructor(){super(...arguments),this.type=n.polarBandAxis,this._scale=new AB}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)}registerTicksTransform(){const t=`${this.type}-ticks`;return TL(this._option.dataSet,t,lE),t}transformScaleDomain(){}}WW.type=n.polarBandAxis,WW.specKey="axes",WW.builtInTheme={axis:Fj,axisBand:Vj,axisAngle:HW,axisRadius:jW},U(WW,Hj);const UW=()=>{eI.registerGraphicComponent(mj.lineAxis,((t,e)=>new NC(t,e))),eI.registerGraphicComponent(vj.lineAxisGrid,((t,e)=>new JE(t,e))),eI.registerGraphicComponent(mj.circleAxis,((t,e)=>new $C(t,e))),eI.registerGraphicComponent(vj.circleAxisGrid,((t,e)=>new sP(t,e))),Sj(),eI.registerComponent(WW.type,WW)};class GW extends LW{constructor(){super(...arguments),this.type=mO.rose,this.transformerConstructor=FW,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(){this._roseMark=this._createMark(GW.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:tz(this._spec,GW.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}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=>RO(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=RO(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(qF(null===(i=eI.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),ZF("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}GW.type=mO.rose,GW.mark=DW,GW.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},GW.transformerConstructor=FW;const YW=()=>{eI.registerSeries(GW.type,GW),SW(),eI.registerAnimation("rose",((t,e)=>({appear:IW(t,e),enter:RW(t),exit:OW(t),disappear:{duration:qD.disappear.duration}}))),UW(),NW()};class XW extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:le(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=he(this.from,this._prevCenter),{angle:i,radius:s}=he(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,eO(this._fromAngle,this._toAngle)&&eO(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=le({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class $W extends XT{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!hO(t)&&!hO(e))return e;const s=he(t,this._prevCenter),n=he(e,this._center);let r=de(s.angle),a=de(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return le({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new se(s,n,r,a);return o.defined=e.defined,o}}const KW=t=>({type:"in"===t?"fadeIn":"fadeOut"});function qW(t,e,i){return"fadeIn"===e?KW(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function ZW(t,e,i){return"fadeIn"===e?KW(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 JW=(t,e)=>({custom:GT,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),QW=Object.assign(Object.assign(Object.assign({},NF),Mz),{area:{name:"area",type:"area"}});class tU extends LW{constructor(){super(...arguments),this.type=mO.radar,this.transformerConstructor=Lz,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!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),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(tU.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const t=this._areaMark;t&&(this.setMarkStyle(t,{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:fF,closePath:!0},"normal",lD.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",lD.Series),this.event.on(bL.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.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:u(this._spec.startAngle)?re(this._spec.startAngle):oj},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(qF(null===(s=eI.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),ZF("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(u(t)){const i=eI.getAnimationInKey(e);t.setAnimationConfig(qF(null==i?void 0:i(n,r),ZF(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&&_(a)?a[0]:a}}}tU.type=mO.radar,tU.mark=QW,tU.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},tU.transformerConstructor=Lz,U(tU,wz);const eU=()=>{eI.registerSeries(tU.type,tU),JH(),Rz(),Iz(),eI.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:qW(t,e,"in"),enter:qW(t,e,"in"),exit:qW(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:qD.disappear.duration},update:[{channel:["points","center"],custom:$W,customParameters:t,duration:qD.update.duration,easing:qD.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),eI.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:ZW(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:qD.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:XW,customParameters:t,duration:qD.update.duration,easing:qD.update.easing}]}))),eI.registerAnimation("radarGroup",((t,e)=>({appear:JW(t,"in"),disappear:{duration:qD.disappear.duration}}))),CA(),UW(),NW()};class iU extends EF{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>gi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const sU=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(MI)||(i[n]=t[n],s=u(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[BI]:r,[EI]:`${s}_${e}`})),r++}))})),n},nU={fill:"#bbb",fillOpacity:.2},rU=Object.assign(Object.assign({},NF),{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"}});class aU extends lz{constructor(){super(...arguments),this.type=mO.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){u(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){u(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){u(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){u(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){u(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){u(t)&&(this._gridBackground=t)}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),TL(this._option.dataSet,"objFlat",sU),TL(this._option.dataSet,"copyDataView",LL),CL(this._option.dataSet,"dataview",Ma),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:jL.dotObjFlat},!1)}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(tI(nU,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(aU.mark.group),this._containerMark=this._createMark(aU.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(aU.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(aU.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(aU.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(aU.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(aU.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(aU.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var t;const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-(null!==(t=this._spec.leftAppendPadding)&&void 0!==t?t:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",lD.Series),e.setMarkConfig({interactive:!1,clip:!0}));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",lD.Series),i.setMarkConfig({interactive:!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",lD.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",lD.Series);const r=this._dotMark;r&&this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",lD.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",lD.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",lD.Series);const l=this._symbolMark;l&&this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",lD.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(){var t,e;super.onLayoutEnd();const i=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.leftAppendPadding)&&void 0!==e?e:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+i},"normal",lD.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:PI}}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 BO).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:PI}}initTooltip(){this._tooltipHelper=new iU(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}aU.type=mO.dot,aU.mark=rU,aU.builtInTheme={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"}}}}};class oU extends EF{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>gi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const lU=Object.assign(Object.assign({},NF),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),hU=(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 cU extends lz{constructor(){super(...arguments),this.type=mO.link}getFromField(){return this._fromField}setFromField(t){u(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){u(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){u(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){u(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(),TL(this._option.dataSet,"linkDotInfo",hU),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:jL.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(cU.mark.group),this._containerMark=this._createMark(cU.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(cU.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(cU.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var t,e,i,s;const n=this._clipMark;n&&(this.setMarkStyle(n,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",lD.Series),n.setMarkConfig({interactive:!1,clip:!0}));const r=this._containerMark;r&&(this.setMarkStyle(r,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",lD.Series),r.setMarkConfig({interactive:!1}));const a=this._linkMark;a&&this.setMarkStyle(a,{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",lD.Series);const o=this._arrowMark;if(o){const n=null!==(s=null===(i=null===(e=null===(t=this._theme)||void 0===t?void 0:t.arrow)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size)&&void 0!==s?s:10;this.setMarkStyle(o,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,n),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:n,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",lD.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:PI}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new oU(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}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]}}cU.type=mO.link,cU.mark=lU,cU.builtInTheme={link:{arrow:{style:{size:10}}}};const dU=Object.assign(Object.assign({},NF),{group:{name:"group",type:"group"}});class uU extends cW{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()?II:$I],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=re(i.offsetAngle);let o;if(u(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 d(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()?LI:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=re(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=u(n)?re(n):oj;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=u(r)?re(r):lj,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)||u(null==s?void 0:s.startAngle)||u(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=RO(this.angleAxisHelper.dataToPosition([t[II]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=RO(this.angleAxisHelper.dataToPosition([t[LI]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?RO(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(uU.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const t=this._arcGroupMark;t.created(),this.setMarkStyle(t,{x:0,y:0},"normal",lD.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+re(a),o=re(r)/2;return rf(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[Ig({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_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 mU=()=>{eI.registerAnimation("circularProgress",((t,e)=>({appear:fU(t,e),enter:{type:"growAngleIn"},disappear:{duration:qD.disappear.duration}})))};class vU extends nz{constructor(){super(...arguments),this._supportStack=!0}}class _U extends uU{constructor(){super(...arguments),this.type=mO.circularProgress,this.transformerConstructor=vU,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(){return this._progressMark=this._createMark(_U.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:tz(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var t;const e=this._progressMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",lD.Series)}getInteractionTriggers(){const t=[];return 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(){return this._trackMark=this._createMark(_U.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&this.setMarkStyle(t,{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()?II:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?LI: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",lD.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(qF(null===(i=eI.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),ZF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(qF(null===(s=eI.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),ZF("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}_U.type=mO.circularProgress,_U.mark=pU,_U.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},_U.transformerConstructor=vU;const yU=()=>{eI.registerSeries(_U.type,_U),SW(),mU(),tF(),UW(),NW()};function bU(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const xU={type:"fadeIn"};function SU(t,e="grow"){return!1===e?{}:"fadeIn"===e?xU:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:bU(t)}))(t)}class kU extends EF{enableByType(t){return"dimension"!==t}}const AU=Object.assign(Object.assign({},NF),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class MU extends lz{constructor(){super(...arguments),this.type=mO.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=u(e.width)?e.width:e.x1-e.x,o=u(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(MU.mark.progress,{isSeriesMark:!0}),d(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var t,e,i,s;const n=this._progressMark;if(n)if("vertical"===this._spec.direction){const i=this._spec.progress||{},s=null!==(t=i.leftPadding)&&void 0!==t?t:0,r=null!==(e=i.rightPadding)&&void 0!==e?e:0;this.setMarkStyle(n,{x:t=>{var e,i;return RO(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),!0)-this._spec.bandWidth/2+s},y1:t=>{var e,i;return RO(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))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?RO(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-s-r,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",lD.Series)}else{const t=this._spec.progress||{},e=null!==(i=t.topPadding)&&void 0!==i?i:0,r=null!==(s=t.bottomPadding)&&void 0!==s?s:0;this.setMarkStyle(n,{x1:t=>{var e,i;return RO(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))},y:t=>{var i,s;return RO(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),!0)-this._spec.bandWidth/2+e},height:this._spec.bandWidth-e-r,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?RO(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",lD.Series)}}_initTrackMark(){return this._trackMark=this._createMark(MU.mark.track),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>{var e,i;return RO(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),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",lD.Series):this.setMarkStyle(t,{x:0,y:t=>{var e,i;return RO(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),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",lD.Series))}getInteractionTriggers(){const t=[];return 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(qF(null===(i=eI.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),ZF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(qF(null===(s=eI.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),ZF("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new kU(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}MU.type=mO.linearProgress,MU.mark=AU,MU.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const wU=()=>{pV(),eI.registerAnimation("linearProgress",((t,e)=>({appear:SU(t,e),enter:SU(t),disappear:{duration:qD.disappear.duration}}))),tF(),eI.registerSeries(MU.type,MU)},TU=[0],CU=[20,40],BU=[200,500],EU={shrink:!1,enlarge:!1,fontSizeLimitMin:0},PU=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class RU{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const OU=`${MI}_WORD_CLOUD_TEXT`,IU=Object.assign(Object.assign({},NF),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),LU={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic",scaleX:1,scaleY:1}}};class DU extends rz{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},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._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){u(t)&&(this._valueField=t)}setFontSizeRange(t){u(t)?this._fontSizeRange=t:this._fontSizeRange=CU}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,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:BU,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:TU,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?OU:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:EU},this._spec.wordCloudConfig),r&&!d(r.layoutMode)||Uy(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:TU,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!PU.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new RU(1e3))}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",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var t;this._wordMark=this._createMark(DU.mark.word,{key:EI,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(t=this._spec.wordMask)||void 0===t?void 0:t.visible)&&(this._maskMark=this._createMark(DU.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:aD.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",lD.Series)}initMarkStyleOfWord(t,e,i,s,n){var r,a;t&&(this.setMarkStyle(t,{text:(null==e?void 0:e.formatMethod)?t=>e.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",lD.Series),this.setMarkStyle(t,{fill:null!==(a=null===(r=null==e?void 0:e.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",lD.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(qF(eI.getAnimationInKey("wordCloud")(n,s),ZF("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 BO).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:PI])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new GB).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new GB).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[BI])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var t,e,i,s,n;const{width:r,height:a}=this._region.getLayoutRect(),o=null!==(t=this._spec.word)&&void 0!==t?t:{},l=null!==(e=o.style)&&void 0!==e?e:{};return{size:[r,a],shape:p(this._maskShape)&&"text"===this._maskShape.type&&d(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const t=()=>{var e,i,s,n;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((e=>e.fn!==t)),null===(i=(e=this._option).dispatchEvent)||void 0===i||i.call(e,bL.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(n=null===(s=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===s?void 0:s.afterWordcloudShapeDraw)||void 0===n||n.call(s,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:t})},dataIndexKey:EI,text:o.formatMethod?t=>o.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(s=null===(i=this._spec.word)||void 0===i?void 0:i.padding)&&void 0!==s?s:1,fontFamily:u(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(n=l.fontFamily)&&void 0!==n?n:this._defaultFontFamily,fontWeight:u(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:u(l.fontWeight)?l.fontWeight:u(this._valueField)?this._calculateFontWeight:"normal",fontStyle:u(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:l.fontStyle,createCanvas:S_.createCanvas.bind(S_),getTextBounds:gf}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,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,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:Ng,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:u(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:u(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:u(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}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(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}DU.mark=IU,DU.builtInTheme={wordCloud:LU};function FU(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||qD.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,u;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(u=t.children)||void 0===u?void 0:u.length){p.children=[],p.isLeaf=!1;const e=zU(t.children,p.children,i+1,l,p,r,a);p.value=d(t[a])?e.sum:Math.max(e.sum,At(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=At(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},jU=(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=jU(t.children,e,t,n))})),s},HU=(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=HU(t.children,e,t,n)),n=e(t,s,i,n)})),n},VU=(t,e=[],i)=>{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):VU(t.children,e,i)))})),e};function NU(t,e){let i,s;if(GU(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function GU(t,e){for(let i=0;i1e-6?(T+Math.sqrt(T*T-4*w*C))/(2*w):C/T);return{x:s+S+k*B,y:n+A+M*B,radius:B}}function KU(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 qU(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 ZU(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 JU(t){return{_:t,next:null,prev:null}}function QU(t,e){const i=(t=G(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];KU(n,s,r);let a,o,l,h,c,d,u,p=JU(s),g=JU(n),f=JU(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:_(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=zU(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%wt)/wt}(),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:d,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=c(l)?this.options.nodeKey:sG.defaultOpionts.nodeSort;jU([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)jU([o],tG(h)),HU([o],eG(this._getPadding,.5,a)),jU([o],iG(1,this._maxDepth));else{const t=Math.min(s.width,s.height);jU([o],tG(sG.defaultOpionts.setRadius)),HU([o],eG(Pt,1,a)),d&&HU([o],eG(this._getPadding,o.radius/t,a)),jU([o],iG(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}sG.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const nG=t=>{let e=0;return t.forEach(((t,i)=>{var s;d(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=nG(t.children):t.value=0),e+=Math.abs(t.value)})),e};function rG(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){nG(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=d(t.value)?0:At(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=j(t,["parents"]);if(a.parents=t.parents.map((t=>j(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=At(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function aG(t){return t.depth}function oG(t,e){return e-1-t.endDepth}const lG=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),hG=(t,e)=>{if(d(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(d(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},cG={left:aG,right:oG,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:aG,end:oG},dG=_t(0,1);class uG{constructor(t){this._ascendingSourceBreadth=(t,e)=>lG(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>lG(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},uG.defaultOptions,t);const e=this.options.nodeKey,i=c(e)?e:e?Bt(e):null;this._getNodeKey=i,this._logger=rt.getInstance(),this._alignFunc=c(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):cG[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)};"vertical"===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<=0)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!d(t.source)&&!d(t.target))),t.targetLinks=t.targetLinks.filter((t=>!d(t.source)&&!d(t.target)))})),r=r.filter((t=>!d(t.source)&&!d(t.target))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;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}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return 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){return rG(t,this._getNodeKey)}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=!d(r.source),l=!d(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&&d(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=[hG(s[t.source]),hG(s[t.target],!0)].filter((t=>!d(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){return function(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=At(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=At(e.value))&&void 0!==i?i:0)}),0))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=c(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}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(v(e)){const t=mt(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(x(e)){if(r=e,x(i))a=i;else if(d(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else c(e)&&x(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,u=null;if(c(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)u=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=x(this.options.nodeHeight)?t=>this.options.nodeHeight:c(this.options.nodeHeight)?this.options.nodeHeight:u>0?t=>u:t=>Math.max(t.value*l,0),m=x(this.options.linkHeight)?()=>this.options.linkHeight:c(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*dG(t.value/e.value):0,n,0),o);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;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,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)}d(this.options.nodeSortBy)&&n.sort(lG),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(lG),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{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];pG(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),gG);const s=_(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,h(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},fG.defaultOpionts,t):Object.assign({},fG.defaultOpionts);const e=this.options.nodeKey,i=c(e)?e:e?Bt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Et(this.options.center[0],t.width),s=t.y0+Et(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=_(r),l=o?r.map((t=>Et(t,n))):Et(r,n),h=_(a),c=this.options.gapRadius,u=h?a.map((t=>Et(t,n))):Et(a,n),p=J(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return d(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=u[i])&&void 0!==s?s:n:id(u[e])?n:u[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(_(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=Et(r,n),i=(u-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-(_(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=zU(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=le({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)}}}function mG(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(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,f,m,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,_=Math.max(v/x,x/m),_>y){f-=h;break}y=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{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*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:pG,slice:mG,sliceDice:function(t,e,i,s,n){(t.depth%2==1?mG:pG)(t,e,i,s,n)}};class yG{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=_(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=_(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=_(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=_(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({},yG.defaultOpionts,t);const i=this.options.nodeKey,s=c(i)?i:i?Bt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?vG(this.options.aspectRatio):null!==(e=_G[this.options.splitType])&&void 0!==e?e:_G.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=zU(t,n,0,-1,null,this._getNodeKey,this.options.valueField);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(x(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(x(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)}))}}function bG(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+li?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return rt.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=bG(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=wi(o.map(wi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rMt(e)));u=Pi(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=xG(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&rt.getInstance().error("Area "+r+" not represented on screen")}return i}function CG(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Bi((function(i){return-1*BG({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},PG=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=G(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!E(G(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:G(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||kG,s=e.lossFunction||SG,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=G(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];hi(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rne.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:EG(f),arcs:f})}))},RG={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:OG,triangle:OG,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.955)%(2*Math.PI/5)-2*Math.PI/10>=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 OG(){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 IG(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*.4),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"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const LG=t=>RG[t]?RG[t]():RG.circle(),DG=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function FG(t){return c(t)?t:function(){return t}}class zG{constructor(t){var e,i;switch(this.options=z({},zG.defaultOptions,t),c(this.options.shape)?this.shape=this.options.shape:this.shape=LG(this.options.shape),this.getText=null!==(e=FG(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=FG(this.options.fontWeight),this.getTextFontSize=FG(this.options.fontSize),this.getTextFontStyle=FG(this.options.fontStyle),this.getTextFontFamily=FG(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>DG(10,50);break;case"random-light":this.getTextColor=()=>DG(50,90);break;default:this.getTextColor=FG(this.options.color)}if(d(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=c(this.options.rotate)?t=>{var e;return re(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=G(this.options.rotate),s=this.options.random?Math.random():Mt(e);return re(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+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:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1: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&&!d(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 HG extends zG{constructor(t){var e;super(z({},HG.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<=HG.defaultOptions.minFontSize&&(this.options.minFontSize=HG.defaultOptions.minFontSize),this.spiral=v(this.options.spiral)?null!==(e=jG[this.options.spiral])&&void 0!==e?e:jG.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=FG(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}=IG(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,f,m;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,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,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._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=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(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=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}));if(this.originalData=s,this.data=s,this.progressiveRun(),!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._originSize[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],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});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 f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);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*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(UG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(WG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}UG(p,this._size)&&(p=GG(p,this._size))}else if(UG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||NG(p,i))&&(!i||!VG(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 VG(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 NG(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,UG=(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 GG(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{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const p=n.measureText(h),g="normal"!==o?1.1:1,f=u(p.actualBoundingBoxRight)&&u(p.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(p.actualBoundingBoxRight)+Math.abs(p.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(p.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},XG=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>le(t,e,i+r*n)))},$G=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},KG=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=IG(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=LG("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return le(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)$G(n,XG({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)$G(n,XG({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)$G(n,XG({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)$G(n,XG({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)$G(n,XG({x:l,y:h},o,0,3));else if("star"===t.shape){const t=XG({x:l,y:h},o,-Math.PI/2,5),e=XG({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);$G(n,i)}else n.fillRect(0,0,i,s)}; +function t(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 s,n;function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}!function(t){t["desktop-browser"]="desktop-browser",t["mobile-browser"]="mobile-browser",t.node="node",t.worker="worker",t.miniApp="miniApp",t.wx="wx",t.tt="tt",t.harmony="harmony",t["desktop-miniApp"]="desktop-miniApp",t.lynx="lynx"}(s||(s={})),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.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"}(n||(n={}));var a={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 h=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||l(t,"Boolean");var c=t=>"function"==typeof t;var d=t=>null==t;var u=t=>null!=t;var p=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var g=t=>"object"==typeof t&&null!==t;var f=function(t){if(!g(t)||!l(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 m=t=>void 0===t;var v=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||l(t,"String")};var _=t=>Array.isArray?Array.isArray(t):l(t,"Array");var y=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var b=t=>l(t,"Date");var x=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||l(t,"Number")};var S=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var k=t=>x(t)&&Number.isFinite(t);var A=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var M=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 T=Object.prototype;var C=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||T)};const B=Object.prototype.hasOwnProperty;function E(t){if(d(t))return!0;if(y(t))return!t.length;const e=w(t);if("Map"===e||"Set"===e)return!t.size;if(C(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var P=(t,e,i)=>{const s=v(e)?e.split("."):e;for(let e=0;enull!=t&&R.call(t,e);function I(t,e,i){let s;if(!u(t)||"object"!=typeof t||e&&e(t))return t;const n=_(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:h(t)||x(t)||v(t)?t:b(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=I(r,e,i)}return s}function L(t,e,i=!1,s=!1){if(e){if(t===e)return;if(u(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!u(n[a])||"object"!=typeof n[a]||s&&_(t[a])?F(t,a,n[a]):D(t,e,a,i,s)}}}}function D(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(_(a)){if(s)o=[];else if(_(r))o=r;else if(y(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(v(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function H(t){return Object.prototype.toString.call(t)}function V(t){return Object.keys(t)}function N(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(H(t)!==H(e))return!1;if(c(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 s=t.length-1;s>=0;s--)if(!N(t[s],e[s],i))return!1;return!0}if(!f(t))return!1;const s=V(t),n=V(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!N(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;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;ne?1:t>=e?0:NaN}function tt(t){return Number(t)}function et(t,e,i=tt){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)}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&&x(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(t=nt.None,e){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(...t){this._onErrorHandler.forEach((e=>e(...t)))}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(...t){var e;return this._level>=nt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):st(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=nt.Warn&&st(this._method||"warn","WARN",t),this}info(...t){return this._level>=nt.Info&&st(this._method||"log","INFO",t),this}debug(...t){return this._level>=nt.Debug&&st(this._method||"log","DEBUG",t),this}}function at(t,e,i=0,s){for(d(s)&&(s=t.length);i>>1;Q(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(Q)),et(i,.5)},ct=1e-10,dt=1e-10;function ut(t,e,i=dt,s=ct){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}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(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var mt=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 g=!e&&0!==e&&yt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return g?(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=m(_,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?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(_,e),c?f(t):a}(l);if(d)return o=m(_,e),f(l)}return void 0===o&&(o=m(_,e)),a}return e=+e||0,p(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(g)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:y(Date.now())},b.pending=function(){return void 0!==o},b}function xt(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return p(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),bt(t,e,{leading:s,trailing:n,maxWait:e})}function St(t,e){return i=>t*(1-i)+e*i}function kt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function At(t){if(k(t))return t;const e=+t;return k(e)?e:0}function Mt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}yt=!1;const wt=4294967296;const Tt=t=>e=>P(e,t),Ct=(t,e={})=>{if(c(t))return t;const i=[t];return(e&&e.get||Tt)(i)},Bt=(t,e={})=>{if(_(t)){const i=t.map((t=>Ct(t,e)));return t=>i.map((e=>e(t)))}return Ct(t,e)},Et=(t,e)=>d(t)?e:v(t)?e*parseFloat(t)/100:t,Pt=t=>0,Rt=(t,e)=>{const i=c(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function It(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Lt(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!d(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:u,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)u+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!d(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!d(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:u,b:p},predict:g,rSquared:It(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=Ot(f.min,f);for(let r=0;r=1?zt:t<=-1?-zt:Math.asin(t)}function qt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Zt(t,e){return t[0]*e[1]-t[1]*e[0]}function Jt(t,e){let i=0;for(let s=0;s0?i:0}function ee(t,e){return Qt(t+e,10**Math.max(te(t),te(e)))}function ie(t,e){return Qt(t-e,10**Math.max(te(t),te(e)))}class se{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new se(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 x(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return x(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 ne{static distancePP(t,e){return Xt($t(t.x-e.x,2)+$t(t.y-e.y,2))}static distanceNN(t,e,i,s){return Xt($t(t-i,2)+$t(e-s,2))}static distancePN(t,e,i){return Xt($t(e-t.x,2)+$t(i-t.y,2))}static pointAtPP(t,e,i){return new se((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function re(t){return t*(Math.PI/180)}function ae(t){return 180*t/Math.PI}const oe=(t=0)=>{if(t<0)for(;t<-jt;)t+=jt;else if(t>0)for(;t>jt;)t-=jt;return t};function le(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 he(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function ce(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function de(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ue(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=de(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)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function pe(t){return(t=de(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 ge(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function fe(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function ve(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=ye(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var _e;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(_e||(_e={}));const ye=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function be(t,e,i){if(!t||!e)return _e.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=ye(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function ke(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Ae({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Me(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function we(t,e){const i=e?re(t.angle):t.angle,s=Me(t);return[Ae({x:t.x1,y:t.y1},i,s),Ae({x:t.x2,y:t.y1},i,s),Ae({x:t.x2,y:t.y2},i,s),Ae({x:t.x1,y:t.y2},i,s)]}function Te(t,e,i=!1){const s=we(t,i),n=we(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Me(t),Me(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?re(t.angle):t.angle;let u=i?re(90-t.angle):t.angle+zt;const p=i?re(e.angle):e.angle;let g=i?re(90-e.angle):e.angle+zt;u>Ht&&(u-=Ht),g>Ht&&(g-=Ht);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(ke(n,i)+ke(n,s))/2>ke(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Ce=1e-8;function Be(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Re(t,e){return Math.abs(t-e){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"};function Ie(t,e={},i){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")}class Le{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(),u(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=u(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(d(this._canvas)&&(u(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),d(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&u(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),d(this._context)&&u(this._canvas)){const t=this._canvas.getContext("2d");u(t)&&(t.save(),t.font=Ie(this.textSpec),this._contextSaved=!0,this._context=t)}return!d(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:f=o}=this._userSpec;if(v(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,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(d(t))return{width:0,height:0};if(d(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,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}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(d(this._numberCharSize)){const t=this._standardMethod(Le.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Le.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return d(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Le.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(d(this._letterCharSize)){const t=this._standardMethod(Le.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Le.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return u(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){u(this._canvas)&&(this._canvas=null),u(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Le.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Le.NUMBERS_CHAR_SET="0123456789",Le.FULL_SIZE_CHAR="字";const De=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),Fe=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=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(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=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(t=0,e=0,i=0,s=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(t=0,e=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(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return ze(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 He extends je{}class Ve extends je{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Te(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new Ve(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Ae({x:this.x1,y:this.y1},this.angle,t),Ae({x:this.x2,y:this.y1},this.angle,t),Ae({x:this.x1,y:this.y2},this.angle,t),Ae({x:this.x2,y:this.y2},this.angle,t)]}}class Ne{constructor(t=1,e=0,i=0,s=1,n=0,r=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 Ne,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,f=o*n+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 Ne;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:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ne(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=ae(r.rotateDeg),r}}class We{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 Ue(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 Ge(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 Ye=/^#([0-9a-f]{3,8})$/,Xe={transparent:4294967040},$e={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 Ke(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function qe(t){return x(t)?new ei(t>>16,t>>8&255,255&t,1):_(t)?new ei(t[0],t[1],t[2]):new ei(255,255,255)}function Ze(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Je(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const Qe=(t,e)=>{const i=Ye.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ei((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?qe(t):8===e?new ei(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class ti{static Brighter(t,e=1){return 1===e?t:new ti(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new ti(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof ti?t:new ti(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();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(u(Xe[t]))return function(t){return x(t)?new ei(t>>>24,t>>>16&255,t>>>8&255,255&t):_(t)?new ei(t[0],t[1],t[2],t[3]):new ei(255,255,255,1)}(Xe[t]);if(u($e[t]))return qe($e[t]);const e=`${t}`.trim().toLowerCase(),i=Qe(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new ei(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=Ue(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ei(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ti.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ei(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=Ge(this.color.r,this.color.g,this.color.b),r=Ue(d(t)?n.h:mt(t,0,360),d(e)?n.s:e>=0&&e<=1?100*e:e,d(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new ei(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!d(t)&&(this.color.r=t),!d(e)&&(this.color.g=e),!d(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=Qe(e,!0);return null!=i?i:this}setColorName(t){const e=$e[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(t=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}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new ti(this.color.toString())}copyGammaToLinear(t,e=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,e=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=Ze(t.color.r),this.color.g=Ze(t.color.g),this.color.b=Ze(t.color.b),this}copyLinearToSRGB(t){return this.color.r=Je(t.color.r),this.color.g=Je(t.color.g),this.color.b=Je(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ei{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)),u(s)?this.opacity=isNaN(+s)?1:Math.max(0,Math.min(1,+s)):this.opacity=1}formatHex(){return`#${Ke(this.r)+Ke(this.g)+Ke(this.b)+(1===this.opacity?"":Ke(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}=Ge(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ii(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 ei(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:Ge});function ni(t){if(k(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,s]=t;return[e,i,s,i]}if(4===e)return t}if(p(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 ri(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=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:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}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}const li=1e-10;function hi(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+li)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=pi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=ne.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=ci(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-li,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function ci(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function di(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return ci(t,t-(i*i-e*e+t*t)/(2*i))+ci(e,s)}function ui(t,e){const i=ne.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function pi(t){const e={x:0,y:0};for(let i=0;ithis.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 mi;function vi(t,e){const i=fi(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 _i{constructor(t={}){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 yi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function bi(t){let e;if(e=yi.exec(t))return new _i({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 xi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Si{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 Si.instance||(Si.instance=new Si),Si.instance}newFormat(t){const e=bi(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"):ki[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=ki[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:_,group:y,numerals:b}=this;function x(t){let e,r,x,S=u,k=p,A=t;if("c"===d)k=g(A)+k,A="";else{A=+A;let t=A<0||1/A<0;if(A=isNaN(A)?m:g(Math.abs(A),h),c&&(A=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}(A)),t&&0==+A&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,k=("s"===d?xi[8+mi/3]:"")+k+(t&&"("===n?")":""),f)for(e=-1,r=A.length;++ex||x>57){k=(46===x?_+A.slice(e+1):A.slice(e))+k,A=A.slice(0,e);break}}l&&!a&&(A=y(A,1/0));let M=S.length+A.length+k.length,w=M>1)+S+A+k+w.slice(M);break;default:A=w+S+A+k}return b(A)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=bi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=fi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=xi[8+n/3];return function(t){return s(r*t)+a}}}const ki={"%":(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)=>vi(100*t,e),r:vi,s:function(t,e){const i=fi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(mi=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")+fi(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 Ai(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(_.fx>e.fx?(Ci(y,1+c,v,-c,e),y.fx=t(y),y.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Ci(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=Jt(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Pi(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Ti(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},Ji=Math.sqrt,Qi=Math.tan;function ts(t){return t>1?0:t<-1?Fi:Math.acos(t)}function es(t){return t>1?zi:t<-1?-zi:Math.asin(t)}function is(){}function ss(t,e){t&&rs.hasOwnProperty(t.type)&&rs[t.type](t,e)}var ns={Feature:function(t,e){ss(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sFi?t+Math.round(-t/Hi)*Hi:t,e]}function _s(t,e,i){return(t%=Hi)?e||i?ms(bs(t),xs(e,i)):bs(t):e||i?xs(e,i):vs}function ys(t){return function(e,i){return[(e+=t)>Fi?e-Hi:e<-Fi?e+Hi:e,i]}}function bs(t){var e=ys(t);return e.invert=ys(-t),e}function xs(t,e){var i=Yi(t),s=qi(t),n=Yi(e),r=qi(e);function a(t,e){var a=Yi(e),o=Yi(t)*a,l=qi(t)*a,h=qi(e),c=h*i+o*s;return[Gi(l*n-c*r,o*i-h*s),es(c*n+l*r)]}return a.invert=function(t,e){var a=Yi(e),o=Yi(t)*a,l=qi(t)*a,h=qi(e),c=h*n-l*r;return[Gi(l*n+h*r,o*i+c*s),es(c*i-o*s)]},a}function Ss(t,e){(e=cs(e))[0]-=t,fs(e);var i=ts(-e[1]);return((-e[2]<0?-i:i)+Hi-Di)%Hi}function ks(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:is,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function As(t,e){return Wi(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 Ts(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Os(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 Is(t,e,i,s){return function(n){var r,a,o,l=e(n),h=ks(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Os(a);var t=function(t,e){var i=Ps(e),s=e[1],n=qi(s),r=[qi(i),-Yi(i),0],a=0,o=0;Es.reset(),1===n?s=zi+Di:-1===n&&(s=-zi-Di);for(var l=0,h=t.length;l=0?1:-1,M=A*k,w=M>Fi,T=f*x;if(Es.add(Gi(T*A*qi(M),m*S+T*Yi(M))),a+=w?k+A*Hi:k,w^p>=i^y>=i){var C=us(cs(u),cs(_));fs(C);var B=us(r,C);fs(B);var E=(w^k>=0?-1:1)*es(B[2]);(s>E||s===E&&(C[0]||C[1]))&&(o+=w^k>=0?1:-1)}}return(a<-Di||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(Ls))}return u}}function Ls(t){return t.length>1}function Ds(t,e){return((t=t.x)[0]<0?t[1]-zi-Di:zi-t[1])-((e=e.x)[0]<0?e[1]-zi-Di:zi-e[1])}1===(Cs=Rs).length&&(Bs=Cs,Cs=function(t,e){return Rs(Bs(t),e)});var Fs=Is((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?Fi:-Fi,l=Wi(r-i);Wi(l-Fi)0?zi:-zi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Fi&&(Wi(i-n)Di?Ui((qi(e)*(r=Yi(s))*qi(i)-qi(s)*(n=Yi(e))*qi(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*zi,s.point(-Fi,n),s.point(0,n),s.point(Fi,n),s.point(Fi,0),s.point(Fi,-n),s.point(0,-n),s.point(-Fi,-n),s.point(-Fi,0),s.point(-Fi,n);else if(Wi(t[0]-e[0])>Di){var r=t[0]0,n=Wi(e)>Di;function r(t,i){return Yi(t)*Yi(i)>e}function a(t,i,s){var n=[1,0,0],r=us(cs(t),cs(i)),a=ds(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=us(n,r),u=gs(n,h);ps(u,gs(r,c));var p=d,g=ds(u,p),f=ds(p,p),m=g*g-f*(ds(u,u)-1);if(!(m<0)){var v=Ji(m),_=gs(p,(-g-v)/f);if(ps(_,u),_=hs(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],k=i[1];x0^_[1]<(Wi(_[0]-b)Fi^(b<=_[0]&&_[0]<=x)){var w=gs(p,(-g+v)/f);return ps(w,u),[_,hs(w)]}}}function o(e,i){var n=s?t:Fi-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Is(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],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?Fi:-Fi),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||As(e,p)||As(g,p))&&(g[2]=1),f!==l)c=0,f?(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^f){var v;m&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)))}!f||e&&As(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},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=Yi(e),o=qi(e),l=s*i;null==n?(n=e+s*Hi,r=e-l/2):(n=Ss(a,n),r=Ss(a,r),(s>0?nr)&&(n+=s*Hi));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 Wi(s[0]-t)0?0:3:Wi(s[0]-i)0?2:1:Wi(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,f,m,v,_,y=a,b=ks(),x={point:S,lineStart:function(){x.point=k,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(k(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&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=Os(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&ws(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 k(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&&m)y.point(r,a);else{var l=[g=Math.max(Hs,Math.min(js,g)),f=Math.max(Hs,Math.min(js,f))],b=[r=Math.max(Hs,Math.min(js,r)),a=Math.max(Hs,Math.min(js,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):(m||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Ns(t){return t}var Ws,Us,Gs,Ys,Xs=Ri(),$s=Ri(),Ks={point:is,lineStart:is,lineEnd:is,polygonStart:function(){Ks.lineStart=qs,Ks.lineEnd=Qs},polygonEnd:function(){Ks.lineStart=Ks.lineEnd=Ks.point=is,Xs.add(Wi($s)),$s.reset()},result:function(){var t=Xs/2;return Xs.reset(),t}};function qs(){Ks.point=Zs}function Zs(t,e){Ks.point=Js,Ws=Gs=t,Us=Ys=e}function Js(t,e){$s.add(Ys*t-Gs*e),Gs=t,Ys=e}function Qs(){Js(Ws,Us)}var tn=Ks,en=1/0,sn=en,nn=-en,rn=nn;var an,on,ln,hn,cn={point:function(t,e){tnn&&(nn=t);ern&&(rn=e)},lineStart:is,lineEnd:is,polygonStart:is,polygonEnd:is,result:function(){var t=[[en,sn],[nn,rn]];return nn=rn=-(sn=en=1/0),t}},dn=0,un=0,pn=0,gn=0,fn=0,mn=0,vn=0,_n=0,yn=0,bn={point:xn,lineStart:Sn,lineEnd:Mn,polygonStart:function(){bn.lineStart=wn,bn.lineEnd=Tn},polygonEnd:function(){bn.point=xn,bn.lineStart=Sn,bn.lineEnd=Mn},result:function(){var t=yn?[vn/yn,_n/yn]:mn?[gn/mn,fn/mn]:pn?[dn/pn,un/pn]:[NaN,NaN];return dn=un=pn=gn=fn=mn=vn=_n=yn=0,t}};function xn(t,e){dn+=t,un+=e,++pn}function Sn(){bn.point=kn}function kn(t,e){bn.point=An,xn(ln=t,hn=e)}function An(t,e){var i=t-ln,s=e-hn,n=Ji(i*i+s*s);gn+=n*(ln+t)/2,fn+=n*(hn+e)/2,mn+=n,xn(ln=t,hn=e)}function Mn(){bn.point=xn}function wn(){bn.point=Cn}function Tn(){Bn(an,on)}function Cn(t,e){bn.point=Bn,xn(an=ln=t,on=hn=e)}function Bn(t,e){var i=t-ln,s=e-hn,n=Ji(i*i+s*s);gn+=n*(ln+t)/2,fn+=n*(hn+e)/2,mn+=n,vn+=(n=hn*t-ln*e)*(ln+t),_n+=n*(hn+e),yn+=3*n,xn(ln=t,hn=e)}var En=bn;function Pn(t){this._context=t}Pn.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,Hi)}},result:is};var Rn,On,In,Ln,Dn,Fn=Ri(),zn={point:is,lineStart:function(){zn.point=jn},lineEnd:function(){Rn&&Hn(On,In),zn.point=is},polygonStart:function(){Rn=!0},polygonEnd:function(){Rn=null},result:function(){var t=+Fn;return Fn.reset(),t}};function jn(t,e){zn.point=Hn,On=Ln=t,In=Dn=e}function Hn(t,e){Ln-=t,Dn-=e,Fn.add(Ji(Ln*Ln+Dn*Dn)),Ln=t,Dn=e}var Vn=zn;function Nn(){this._string=[]}function Wn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Un(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),ls(t,i(s))),s.result()}return r.area=function(t){return ls(t,i(tn)),tn.result()},r.measure=function(t){return ls(t,i(Vn)),Vn.result()},r.bounds=function(t){return ls(t,i(cn)),cn.result()},r.centroid=function(t){return ls(t,i(En)),En.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ns):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Nn):new Pn(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 Gn(t){return function(e){var i=new Yn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Yn(){}function Xn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),ls(i,t.stream(cn)),e(cn.result()),null!=s&&t.clipExtent(s),t}function $n(t,e,i){return Xn(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 Kn(t,e,i){return $n(t,[[0,0],e],i)}function qn(t,e,i){return Xn(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 Xn(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)}Nn.prototype={_radius:4.5,_circle:Wn(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=Wn(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}},Yn.prototype={constructor:Yn,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 Jn=16,Qn=Yi(30*Ni);function tr(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&f--){var b=a+u,x=o+p,S=l+g,k=Ji(b*b+x*x+S*S),A=es(S/=k),M=Wi(Wi(S)-1)e||Wi((v*B+_*E)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Ni:0,B()):[m*Vi,v*Vi,_*Vi]},T.angle=function(t){return arguments.length?(y=t%360*Ni,B()):y*Vi},T.reflectX=function(t){return arguments.length?(b=t?-1:1,B()):b<0},T.reflectY=function(t){return arguments.length?(x=t?-1:1,B()):x<0},T.precision=function(t){return arguments.length?(a=tr(o,w=t*t),E()):Ji(w)},T.fitExtent=function(t,e){return $n(T,t,e)},T.fitSize=function(t,e){return Kn(T,t,e)},T.fitWidth=function(t,e){return qn(T,t,e)},T.fitHeight=function(t,e){return Zn(T,t,e)},function(){return e=t.apply(this,arguments),T.invert=e.invert&&C,B()}}function ar(t){var e=0,i=Fi/3,s=rr(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Ni,i=t[1]*Ni):[e*Vi,i*Vi]},n}function or(t,e){var i=qi(t),s=(i+qi(e))/2;if(Wi(s)2?t[2]*Ni:0),e.invert=function(e){return(e=t.invert(e[0]*Ni,e[1]*Ni))[0]*=Vi,e[1]*=Vi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===gr?[[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 mr(t){return Qi((zi+t)/2)}function vr(t,e){var i=Yi(t),s=t===e?qi(t):$i(i/Yi(e))/$i(mr(e)/mr(t)),n=i*Ki(mr(t),s)/s;if(!s)return gr;function r(t,e){n>0?e<-zi+Di&&(e=-zi+Di):e>zi-Di&&(e=zi-Di);var i=n/Ki(mr(e),s);return[i*qi(s*t),n-i*Yi(s*t)]}return r.invert=function(t,e){var i=n-e,r=Zi(s)*Ji(t*t+i*i),a=Gi(t,Wi(i))*Zi(i);return i*s<0&&(a-=Fi*Zi(t)*Zi(i)),[a/s,2*Ui(Ki(n/r,1/s))-zi]},r}function _r(t,e){return[t,e]}function yr(t,e){var i=Yi(t),s=t===e?qi(t):(i-Yi(e))/(e-t),n=i/s+t;if(Wi(s)Di&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Cr.invert=dr(es),Br.invert=dr((function(t){return 2*Ui(t)})),Er.invert=function(t,e){return[-e,2*Ui(Xi(t))-zi]};var Or={exports:{}},Ir=function(t,e){this.p1=t,this.p2=e};Ir.prototype.rise=function(){return this.p2[1]-this.p1[1]},Ir.prototype.run=function(){return this.p2[0]-this.p1[0]},Ir.prototype.slope=function(){return this.rise()/this.run()},Ir.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Ir.prototype.isVertical=function(){return!isFinite(this.slope())},Ir.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Ir.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Ir.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Ir.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)},Ir.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Lr=Ir,Dr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Lr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Dr(t.slice(0,s),e),o=Dr(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},Fr=Dr;!function(t){var e=Fr;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;r{const i=jr(Nr,e),{tolerance:s}=i;return zr(t,s)};var Ur;!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"}(Ur||(Ur={}));const Gr=(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.sort&&(k(l.sortIndex)||(l.sortIndex=0),u(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!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;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,y=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],k=new Set,A=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),k.has(i)||(k.add(i),S.push(i),_(m)?A.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):A.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else y[r][l]+=a;e&&e.includeValues&&!v&&y[r][c].push(t[n]);break}}}let M=0;const w=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=y.length;t0?y[t][l]/M:0,w.push(y[t])}return w},Xr=(t,e)=>{var i,s,n,r,a,o,l,h,c,u;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,y=-1/0;if(e.extent)v=e.extent[0],y=e.extent[1];else for(let e=0;ey&&(y=s))}if(!Number.isFinite(v)||!Number.isFinite(y)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=y;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(y-v>1){const e=Math.floor(v),i=Math.ceil((y-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>y){t=s,m.length=t+1;break}}else{const e=(y-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>y){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",k=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",A=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",M=null!==(u=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==u?u:"percentage",w=_(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],T=_(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],C=T.length?T:void 0,B=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:k,percentageName:M,valuesName:A,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:C});if(!w.length)return Yr(t,B);const E={};return t.forEach((t=>{const e=w.map((e=>null==t?void 0:t[e])).join("-&&-");E[e]?E[e].push(t):E[e]=[t]})),Object.values(E).map((t=>{const e=[...T,...w];return Yr(t,Object.assign(Object.assign({},B),{groupField:e.length?e:void 0,n:t.length}))})).flat()},$r=(t,e)=>{var i,s,n,r,a,o,l,h,c,u,p,g,f,m,v,y;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const k=!!(null==e?void 0:e.includeValues),A=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},M=null!==(n=A.key)&&void 0!==n?n:_(x)?null:null!==(r=x)&&void 0!==r?r:"key",w=null!==(a=A.count)&&void 0!==a?a:"count",T=null!==(o=A.mean)&&void 0!==o?o:"mean",C=null!==(l=A.q1)&&void 0!==l?l:"q1",B=null!==(h=A.median)&&void 0!==h?h:"median",E=null!==(c=A.q3)&&void 0!==c?c:"q3",P=null!==(u=A.iqr)&&void 0!==u?u:"iqr",R=null!==(p=A.min)&&void 0!==p?p:"min",O=null!==(g=A.max)&&void 0!==g?g:"max",I=null!==(f=A.lowerWhisker)&&void 0!==f?f:"lowerWhisker",L=null!==(m=A.upperWhisker)&&void 0!==m?m:"upperWhisker",D=null!==(v=A.outliers)&&void 0!==v?v:"outliers",F=null!==(y=A.values)&&void 0!==y?y:"values",z=new Map,j=new Map,H=new Map,V=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),k&&j.set(r,[]),_(x)?H.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):H.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),k){const t=j.get(r);t&&t.push(i)}}_(S)&&(S=[mt(Math.min.apply(null,S),0,1),mt(Math.max.apply(null,S),0,1)]);const N=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=H.get(t);if(null!==M)f[M]=m;else if(_(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[w]=s,f[T]=o,f[C]=l,f[B]=h,f[E]=c,f[P]=d,f[R]=n,f[O]=r,f[I]=u,f[L]=p,f[D]=g,k&&(f[F]=j.get(t)||[]),N.push(f)}return N};var Kr={},qr={};function Zr(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function Jr(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function Qr(t,e){var i=t+"",s=i.length;return s9999?"+"+Qr(e,6):Qr(e,4))+"-"+Qr(t.getUTCMonth()+1,2)+"-"+Qr(t.getUTCDate(),2)+(r?"T"+Qr(i,2)+":"+Qr(s,2)+":"+Qr(n,2)+"."+Qr(r,3)+"Z":n?"T"+Qr(i,2)+":"+Qr(s,2)+":"+Qr(n,2)+"Z":s||i?"T"+Qr(i,2)+":"+Qr(s,2)+"Z":"")}function ea(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 qr;if(h)return h=!1,Kr;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(;a0}function ua(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=ra(t));var r=[];switch(t.type){case"GeometryCollection":return pa(t,(function(t){fa(t,s)})),t;case"FeatureCollection":return ua(t,(function(t){ua(fa(t,s),(function(t){r.push(t)}))})),oi(r)}return fa(t,s)}function fa(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return pa(t,(function(t){fa(t,e)})),t;case"LineString":return ma(ca(t),e),t;case"Polygon":return va(ca(t),e),t;case"MultiLineString":return ca(t).forEach((function(t){ma(t,e)})),t;case"MultiPolygon":return ca(t).forEach((function(t){va(t,e)})),t;case"Point":case"MultiPoint":return t}}function ma(t,e){da(t)===e&&t.reverse()}function va(t,e){da(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=_a(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Sa=(t,e={},i)=>{i.type=Ur.GEO;const s=jr(ba,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(xa(t))})):e.push(xa(t))})),e})(t);let l=t.features;return o&&(l=ga(t,{reverse:!p(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=ya.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=ya.bounds(t);t.bbox=e}})),t.features=l,t},ka={},Aa=(t,e,i)=>{i.type=Ur.GEO;const s=jr(ba,ka,e),{object:n}=s;if(!v(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 Rr(a,t)}))}:Rr(a,o));var a,o;return Sa(r,s,i)},Ma=(t,e,i)=>{const s=!h(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))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let wa=0;function Ta(t="dataset"){return wa>1e8&&(wa=0),t+"_"+wa++}class Ca{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new o,i=(null==t?void 0:t.name)?t.name:Ta("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()}}class Ba{constructor(t,e){let i;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new o,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&N(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Ta("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){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,e=!0){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)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}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,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&N(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof Ba||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?z({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!d(this._fields)&&d(i)?(this.dataSet.registerTransform("fields",Gr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Un();const Ea={},Pa={albers:hr,albersusa:function(){var t,e,i,s,n,r,a=hr(),o=lr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=lr().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)}},Ra=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Oa(t,e){return function i(){const s=e();return s.type=t,s.path=Un().projection(s),s.copy=s.copy||function(){const t=i();return Ra.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Ia{static GenAutoIncrementId(){return Ia.auto_increment_id++}}Ia.auto_increment_id=0;class La{constructor(t){this.id=Ia.GenAutoIncrementId(),this.registry=t}}const Da="named",Fa="inject",za="multi_inject",ja="inversify:tagged",Ha="inversify:paramtypes";class Va{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===Da?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var Na=function(t){var e;return function(t){const e="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),s=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),n=new WeakMap;function r(t,e,i){let r=n.get(t);if(h(r)){if(!i)return;r=new s,n.set(t,r)}let a=r.get(e);if(h(a)){if(!i)return;a=new s,r.set(e,a)}return a}function a(t,e,i){if(o(t,e,i))return!0;const s=f(e);return!c(s)&&a(t,s,i)}function o(t,e,i){const s=r(e,i,!1);return!h(s)&&!!s.has(t)}function l(t,e,i){if(o(t,e,i))return function(t,e,i){const s=r(e,i,!1);if(!h(s))return s.get(t)}(t,e,i);const s=f(e);return c(s)?void 0:l(t,s,i)}function h(t){return void 0===t}function c(t){return null===t}function d(t){return"object"==typeof t?null!==t:"function"==typeof t}function u(t,i){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const s=3===i?"string":5===i?"number":"default",n=function(t,e){const i=t[e];if(null!=i){if(!g(i))throw new TypeError;return i}}(t,e);if(void 0!==n){const e=n.call(t,s);if(d(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.valueOf;if(g(i)){const e=i.call(t);if(!d(e))return e}}else{const e=t.valueOf;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.toString;if(g(i)){const e=i.call(t);if(!d(e))return e}}throw new TypeError}(t,"default"===s?"number":s)}function p(t){const e=u(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function g(t){return"function"==typeof t}function f(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const s=t.prototype,n=s&&Object.getPrototypeOf(s);if(null==n||n===Object.prototype)return e;const r=n.constructor;return"function"!=typeof r||r===t?e:r}t("defineMetadata",(function(t,e,i,s){if(!d(i))throw new TypeError;return n=t,a=e,void r(i,s,!0).set(n,a);var n,a})),t("hasMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),l(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function Wa(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};Na.hasOwnMetadata(t,e)&&(r=Na.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,Na.defineMetadata(t,r,e)}(ja,t,i.toString(),s)}function Ua(t){return(e,i,s)=>{Wa(e,0,s,t)}}function Ga(t){return e=>(i,s,n)=>Ua(new Va(t,e))(i,s,n)}const Ya=Ga(Fa),Xa=Ga(za);function $a(){return function(t){return Na.defineMetadata(Ha,null,t),t}}function Ka(t){return Ua(new Va(Da,t))}const qa="Singleton",Za="Transient",Ja="ConstantValue",Qa="DynamicValue",to="Factory",eo="Function",io="Instance",so="Invalid";class no{constructor(t,e){this.id=Ia.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=so,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new no(this.serviceIdentifier,this.scope);return t.activated=t.scope===qa&&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 ro{getConstructorMetadata(t){return{compilerGeneratedMetadata:Na.getMetadata(Ha,t),userGeneratedMetadata:Na.getMetadata(ja,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const ao=(oo=Da,t=>{const e=e=>{if(null==e)return!1;if(e.key===oo&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const co=Symbol("ContributionProvider");class uo{constructor(t,e){this.serviceIdentifier=t,this.container=e,go.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function po(t,e){t(co).toDynamicValue((({container:t})=>new uo(e,t))).inSingletonScope().whenTargetNamed(e)}class go{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}go.store=new Map;class fo{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 mo extends fo{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const vo=Symbol.for("EnvContribution"),_o=Symbol.for("VGlobal"),yo=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Za,this.options=e,this.id=Ia.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new ro}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,Da,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new no(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new ho(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[Fa],multiInject:s[za]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:a,metadata:e,bindings:l};n.push(t)}}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 eo:e=t.cache;break;case io: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===qa&&(t.cache=e,t.activated=!0)}},bo=Symbol.for("RenderService");const xo=new class{get renderService(){return this._renderService||(this._renderService=yo.get(bo)),this._renderService}};let So=0;class ko{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=xo.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++So,t),this.tryRunAnimationFrameNextFrame(),So}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class Ao{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var Mo=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wo=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},To=function(t,e){return function(i,s){e(i,s,t)}},Co=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 Bo=class extends Ao{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}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){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Ia.GenAutoIncrementId(),this.hooks={onSetEnv:new mo(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}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)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new ko);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}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)}loadFont(t,e,i){return Co(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}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,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var Eo,Po,Ro,Oo;Bo=Mo([$a(),To(0,Ya(co)),To(0,Ka(vo)),wo("design:paramtypes",[Object])],Bo),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(Eo||(Eo={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(Po||(Po={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(Ro||(Ro={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(Oo||(Oo={}));const Io=jt-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)>Io)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%=jt)<0&&(s+=jt),(n%=jt)<0&&(n+=jt),nn;++o,a-=zt)g(a);else for(a=s-s%zt+zt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const Fo=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,zo={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},jo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let Ho,Vo,No,Wo,Uo,Go;var Yo,Xo,$o,Ko,qo,Zo;function Jo(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),f=Math.cos(n),m=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+f,k=i+m,A=S+y*m,M=k-y*f;return[h*b+c*x,d*b+u*x,h*A+c*M,d*A+u*M,h*S+c*k,d*S+u*k]}function Qo(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=re(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 f=d/i,m=c/i,v=-c/s,_=d/s,y=f*o+m*l,b=v*o+_*l,x=f*t+m*e,S=v*t+_*e;let k=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;k<0&&(k=0);let A=Math.sqrt(k);r===n&&(A=-A);const M=.5*(y+x)-A*(S-b),w=.5*(b+S)+A*(x-y),T=Math.atan2(b-w,y-M);let C=Math.atan2(S-w,x-M)-T;C<0&&1===r?C+=jt:C>0&&0===r&&(C-=jt);const B=Math.ceil(Math.abs(C/(zt+.001))),E=[];for(let t=0;te.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 el(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=ll(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Ut(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Ut(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function cl(t,e){const{p0:i,p1:s}=t,n=ne.pointAtPP(i,s,e);return[new dl(i,n),new dl(n,s)]}class dl extends il{constructor(t,e){super(),this.type=qo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return ne.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Nt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?ne.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Ko.ROW?Vt(this.p0.x-this.p1.x):t===Ko.COLUMN?Vt(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class ul{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new hl(new se(this._lastX,this._lastY),new se(t,e),new se(i,s),new se(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new dl(new se(this._lastX,this._lastY),new se(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===Ko.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Vt(t.p0.y-s.y)}if(t===Ko.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Vt(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class pl extends ul{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 gl(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function fl(t,e,i){const s=null!=e?e:Vt(i[i.length-1].x-i[0].x)>Vt(i[i.length-1].y-i[0].y)?Ko.ROW:Ko.COLUMN;return"monotoneY"===t?new pl(t,s):new ul(t,s)}class ml{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 vl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=fl("linear",i,t);return function(t,e){gl(t,e,1)}(new ml(n,s),t),n}function _l(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 yl{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&&_l(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:_l(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 bl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return vl(t,e);const n=fl("basis",i,t);return function(t,e){gl(t,e,2)}(new yl(n,s),t),n}function xl(t){return t<0?-1:1}function Sl(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(xl(r)+xl(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function kl(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Al(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 Ml{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:Al(this,this._t0,kl(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,Al(this,kl(this,e=Sl(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Al(this,this._t0,e=Sl(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 wl extends Ml{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Tl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return vl(t,e);const n=fl("monotoneX",i,t);return function(t,e){gl(t,e,2)}(new Ml(n,s),t),n}function Cl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return vl(t,e);const n=fl("monotoneY",i,t);return function(t,e){gl(t,e,2)}(new wl(n,s),t),n}let Bl=class{constructor(t,e=.5,i){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;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):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()}};class El extends Bl{lineEnd(){this.context.closePath()}}function Pl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new ul("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?Ko.ROW:Ko.COLUMN);return Rl(new Bl(r,e,n),t),r}function Rl(t,e){return gl(t,e,1)}class Ol extends ml{lineEnd(){this.context.closePath()}}function Il(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=fl("linear",i,t);return function(t,e){gl(t,e,1)}(new Ol(n,s),t),n}function Ll(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Dt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>Dt){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function Dl(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return vl(i,n);const o=fl(t,r,i);return gl(new e(o,s,a),i,2),o}}const Fl=Dl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:Ll(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const zl=Dl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:Ll(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class jl extends il{constructor(t,e,i){super(),this.type=qo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return ol(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,sl([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===Ko.ROW?Vt(this.p0.x-this.p2.x):t===Ko.COLUMN?Vt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Ut(t-.01,0),i=Gt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Nt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=ol(i,s,n,e),a=ne.pointAtPP(i,s,e),o=ne.pointAtPP(s,n,e);return[new jl(i,a,r),new jl(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Hl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new dl(new se(this._lastX,this._lastY),new se(t,e))}quadraticCurveTo(t,e,i,s){const n=new jl(new se(this._lastX,this._lastY),new se(t,e),new se(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new hl(new se(this._lastX,this._lastY),new se(t,e),new se(i,s),new se(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Vl(t,e,i){var s,n;switch(e){case"linear":default:return vl(t,i);case"basis":return bl(t,i);case"monotoneX":return Tl(t,i);case"monotoneY":return Cl(t,i);case"step":return Pl(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new ul("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?Ko.ROW:Ko.COLUMN);return Rl(new El(r,e,n),t),r}(t,.5,i);case"stepBefore":return Pl(t,0,i);case"stepAfter":return Pl(t,1,i);case"catmullRom":return Fl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return zl(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return Il(t,i)}}class Nl extends Do{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Lo(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([jo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([jo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([jo.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([jo.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([jo.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([jo.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([jo.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([jo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([jo.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()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Hl(this);el(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[jo.M]=t=>`M${t[1]} ${t[2]}`,t[jo.L]=t=>`L${t[1]} ${t[2]}`,t[jo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[jo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[jo.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3];((t,e,i,s,n,r,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;e`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[jo.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;tGo){let t,e=No;for(let s=1,r=i.length;s{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,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),el(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Ko.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.y-e.p1.y)}if(this.direction===Ko.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{rt.getInstance().warn("空函数")}}),ah=Object.assign(Object.assign({},Jl),{points:[],cornerRadius:0,closePath:!0}),oh=Object.assign(Object.assign({},Jl),{width:100,height:100,spikes:5,thickness:.5}),lh=Object.assign(Object.assign({},Jl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},Jl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const hh=Object.assign(Object.assign({},Jl),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),ch=Object.assign(Object.assign(Object.assign({},Jl),Kl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),dh=Object.assign(Object.assign(Object.assign({},Jl),Kl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",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}),uh=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0,maxWidth:500,maxHeight:500},Jl),{fill:!0,cornerRadius:0,cornerType:"round"}),ph=Object.assign(Object.assign({},uh),{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}),gh=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 m("directional",t.sideOrCorner,1)||m("angular",t.angleValue,1)}function a(){return m("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=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 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=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 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 fh{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(fh.IsGradientStr(t))try{const e=gh(t)[0];if(e){if("linear"===e.type)return fh.ParseLinear(e);if("radial"===e.type)return fh.ParseRadial(e);if("conic"===e.type)return fh.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Ft/2,n=parseFloat(e.value)/180*Ft-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Ht,stops:fh.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:fh.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Ft/2;let n="angular"===e.type?parseFloat(e.value)/180*Ft:0;for(;n<0;)n+=Ht;for(;n>=Ht;)n-=Ht;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}const _h={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"}},yh=!0,bh=!1,xh=/\w|\(|\)|-/,Sh=/[.?!,;:/,。?!、;:]/,kh=/\S/,Ah=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function Mh(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=xo.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=wh(t,a)),a}function wh(t,e,i=!1){let s=e;for(;xh.test(t[s-1])&&xh.test(t[s])||Sh.test(t[s]);)if(s--,s<=0)return i?Th(t,e):e;return s}function Th(t,e){let i=e;for(;xh.test(t[i+1])&&xh.test(t[i])||Sh.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Ch(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=xo.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}var Bh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Eh=class{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=ch.fontSize}){let i=0,s=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 a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=wh(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_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){if(s===n){rt.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}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),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);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}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,a=!1){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=wh(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}};Eh=Bh([$a()],Eh);var Ph=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Rh=Symbol.for("TextMeasureContribution");let Oh=class extends Eh{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}};Oh=Ph([$a()],Oh);const Ih=Symbol.for("CanvasFactory"),Lh=Symbol.for("Context2dFactory");function Dh(t){return yo.getNamed(Ih,xo.global.env)(t)}const Fh=1e-4,zh=Math.sqrt(3),jh=1/3;function Hh(t){return t>-Qh&&tQh||t<-Qh}const Nh=[0,0],Wh=[0,0],Uh=[0,0];function Gh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Yh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function Xh(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 $h(t){return(t%=Ht)<0&&(t+=Ht),t}function Kh(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+=Ht);let d=Math.atan2(l,o);return d<0&&(d+=Ht),d>=s&&d<=n||d+Ht>=s&&d+Ht<=n}function Jh(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(Hh(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 ec=[-1,-1,-1],ic=[-1,-1];function sc(){const t=ic[0];ic[0]=ic[1],ic[1]=t}function nc(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(Hh(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,jh):Math.pow(i,jh),s=s<0?-Math.pow(-s,jh):Math.pow(s,jh);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+zh*Math.sin(e)))/(3*a),h=(-o+i*(s-zh*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,ec);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&sc(),p=Xh(e,s,r,o,ic[0]),u>1&&(g=Xh(e,s,r,o,ic[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Hh(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,ec);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=Yh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);ec[0]=-l,ec[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Ht-1e-4){s=0,n=Ht;const e=r?1:-1;return a>=ec[0]+t&&a<=ec[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Ht,n+=Ht);let c=0;for(let e=0;e<2;e++){const i=ec[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Ht+t),(t>=s&&t<=n||t+Ht>=s&&t+Ht<=n)&&(t>Ft/2&&t<1.5*Ft&&(e=-e),c+=e)}}return c}function oc(t){return Math.round(t/Ft*1e8)/1e8%2*Ft}function lc(t,e){let i=oc(t[0]);i<0&&(i+=Ht);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Ht?n=i+Ht:e&&i-n>=Ht?n=i-Ht:!e&&i>n?n=i+(Ht-oc(i-n)):e&&i1&&(i||(h+=Pe(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],v=a[2],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,k=b;hc[0]=S,hc[1]=k,lc(hc,Boolean(a[6])),S=hc[0],k=hc[1];const A=S,M=k-S,w=!!(1-(a[6]?0:1)),T=(s-m)*_/_+m;switch(f){case jo.M:u=m,p=v,c=u,d=p;break;case jo.L:if(i){if(Jh(c,d,m,v,e,s,n))return!0}else h+=Pe(c,d,m,v,s,n)||0;c=m,d=v;break;case jo.C:if(i){if(qh(c,d,m,v,_,y,b,x,e,s,n))return!0}else h+=nc(c,d,m,v,_,y,b,x,s,n)||0;c=b,d=x;break;case jo.Q:if(i){if(Kh(c,d,m,v,_,y,e,s,n))return!0}else h+=rc(c,d,m,v,_,y,s,n)||0;c=_,d=y;break;case jo.A:if(o=Math.cos(A)*_+m,l=Math.sin(A)*_+v,g?(u=o,p=l):h+=Pe(c,d,o,l,s,n),i){if(Zh(m,v,_,A,A+M,w,e,T,n))return!0}else h+=ac(m,v,_,A,A+M,w,T,n);c=Math.cos(A+M)*_+m,d=Math.sin(A+M)*_+v;break;case jo.R:if(u=c=m,p=d=v,o=u+_,l=p+y,i){if(Jh(u,p,o,p,e,s,n)||Jh(o,p,o,l,e,s,n)||Jh(o,l,u,l,e,s,n)||Jh(u,l,u,p,e,s,n))return!0}else h+=Pe(o,p,o,l,s,n),h+=Pe(u,l,u,p,s,n);break;case jo.Z:if(i){if(Jh(c,d,u,p,e,s,n))return!0}else h+=Pe(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},pc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const gc=Symbol.for("VWindow"),fc=Symbol.for("WindowHandlerContribution");let mc=class extends Ao{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(){super(),this.hooks={onChange:new mo(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(yo.getNamed(fc,t.env).configure(this,t),this.actived=!0)},this._uid=Ia.GenAutoIncrementId(),this.global=xo.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}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.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}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&&ut(this.width,t.width())&&ut(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)}};mc=uc([$a(),pc("design:paramtypes",[])],mc);var vc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},yc=function(t,e){return function(i,s){e(i,s,t)}};let bc=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=xo.global,this._textMeasureMap=new Map,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}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||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=dc.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="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:Kl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Le(Object.assign({defaultFontParams:{fontFamily:Kl.fontFamily,fontSize:Kl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Le.ALPHABET_CHAR_SET+Le.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=yo.get(gc),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 xc;bc=vc([$a(),yc(0,Ya(co)),yc(0,Ka(Rh)),_c("design:paramtypes",[Object])],bc),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(xc||(xc={}));const Sc=new Ne;let kc=class{constructor(){this.matrix=new Ne}init(t){return this.mode=xc.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=xc.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Sc.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(Sc.a,Sc.b,Sc.c,Sc.d,Sc.e,Sc.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Sc.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(Sc.a,Sc.b,Sc.c,Sc.d,Sc.e,Sc.f),this}scale(t,e,i){return this.mode===xc.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===xc.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Sc.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Sc.a,Sc.b,Sc.c,Sc.d,Sc.e,Sc.f),this}translate(t,e){return this.mode===xc.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===xc.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};kc=vc([$a(),_c("design:paramtypes",[])],kc);const Ac={arc:Ql,area:th,circle:eh,line:nh,path:rh,symbol:hh,text:ch,rect:lh,polygon:ah,star:oh,richtext:dh,richtextIcon:ph,image:uh,group:ih,glyph:sh},Mc=Object.keys(Ac);function wc(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Tc={arc:Object.assign({},Ac.arc),area:Object.assign({},Ac.area),circle:Object.assign({},Ac.circle),line:Object.assign({},Ac.line),path:Object.assign({},Ac.path),symbol:Object.assign({},Ac.symbol),text:Object.assign({},Ac.text),rect:Object.assign({},Ac.rect),polygon:Object.assign({},Ac.polygon),star:Object.assign({},Ac.star),richtext:Object.assign({},Ac.richtext),richtextIcon:Object.assign({},Ac.richtextIcon),image:Object.assign({},Ac.image),group:Object.assign({},Ac.group),glyph:Object.assign({},Ac.glyph)};class Cc{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Mc.forEach((t=>{this._defaultTheme[t]=Object.create(Tc[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,i=!1){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;Mc.forEach((s=>{const n=Object.create(Tc[s]);t&&t[s]&&wc(n,t[s]),i[s]&&wc(n,i[s]),e[s]&&wc(n,e[s]),this.combinedTheme[s]=n})),e.common&&Mc.forEach((t=>{wc(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 Bc=new Cc;function Ec(t,e){return t.glyphHost?Ec(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)):Bc.getTheme()}return null}(t)||t.attachedThemeGraphic&&Ec(t.attachedThemeGraphic)||Bc.getTheme()}var Pc=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 Rc extends o{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=Ia.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){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,e=!1){return Pc(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,e=!0){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,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)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===t||t===e)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===t)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,e=!1){let 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,e=!1){let 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,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Lc))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(jc(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 Lc))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=jc(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 Lc))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=jc(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 Lc))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=jc(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 Lc))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=zc.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(jc(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(jc(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,jc(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(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 Lc))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"):jc(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 Dc))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=zc.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.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),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 Hc(s,{clickInterval:a,supportsTouchEvents:o}),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 Lc,this.rootWheelEvent=new Dc,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&&v(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.addEventListener("pointermove",this.onPointerMove,!0),t.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.addEventListener("mousemove",this.onPointerMove,!0),t.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.removeEventListener("pointermove",this.onPointerMove,!0),t.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.removeEventListener("mousemove",this.onPointerMove,!0),t.removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}class Uc{static GetImage(t,e){var i;const s=Uc.cache.get(t);s?"fail"===s.loadState?xo.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):Uc.loadImage(t,e)}static GetSvg(t,e){var i;let s=Uc.cache.get(t);s?"fail"===s.loadState?xo.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"},Uc.cache.set(t,s),s.dataPromise=xo.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.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Uc.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Uc.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=xo.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=xo.global.loadBlob(t):"json"===e&&(i.dataPromise=xo.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Uc.isLoading&&Uc.toLoadAueue.length){Uc.isLoading=!0;const t=Uc.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Uc.cache.set(i,n),n.dataPromise=xo.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))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Uc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Uc.loading()})).catch((t=>{console.error(t),Uc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Uc.loading()}))}}),0)}static loadImage(t,e){const i=Gc(t,Uc.toLoadAueue);if(-1!==i)return Uc.toLoadAueue[i].marks.push(e),void Uc.loading();Uc.toLoadAueue.push({url:t,marks:[e]}),Uc.loading()}static improveImageLoading(t){const e=Gc(t,Uc.toLoadAueue);if(-1!==e){const t=Uc.toLoadAueue.splice(e,1);Uc.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Gc(t,e){for(let i=0;it?_(t)?0===t.length?0:1===t.length?t[0]:2===t.length?($c[0]=t[0],$c[2]=t[0],$c[1]=t[1],$c[3]=t[1],$c):t:t:0,qc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Zc=[1,2,3,0,1,2,3,0];function Jc(t,e,i,s){for(;t>=Ht;)t-=Ht;for(;t<0;)t+=Ht;for(;t>e;)e+=Ht;qc[0].x=i,qc[1].y=i,qc[2].x=-i,qc[3].y=-i;const n=Math.ceil(t/zt)%4,r=Math.ceil(e/zt)%4;if(s.add(Wt(t)*i,Yt(t)*i),s.add(Wt(e)*i,Yt(e)*i),n!==r||e-t>Ft){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new se(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new se(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{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)}}id.TimeOut=1e3/60;const sd=new id,nd=(t,e)=>{const i=((t,e)=>v(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};class rd{bounds(t,e){if(x(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}parseSize(t){return x(t)?t:Math.min(t[0],t[1])}}function ad(t,e,i,s,n){return n?t.arc(i,s,e,0,jt,!1,n):t.arc(i,s,e,0,jt),!1}var od=new class extends rd{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 ad(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return ad(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(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 ld=new class extends rd{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,this.parseSize(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,this.parseSize(e)/6,i,s,n,r)}};function hd(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 cd=new class extends rd{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 hd(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return hd(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return hd(t,this.parseSize(e)/2+n,i,s,r)}};function dd(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var ud=new class extends rd{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return dd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return dd(t,this.parseSize(e)/2+n,i,s)}};function pd(t,e,i,s,n=0){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}class gd extends rd{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 pd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return pd(t,this.parseSize(e)/2,i,s,n)}}var fd=new gd;var md=new class extends gd{constructor(){super(...arguments),this.type="triangle"}};const vd=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),_d=Math.sin(jt/10)*vd,yd=-Math.cos(jt/10)*vd;function bd(t,e,i,s){const n=_d*e,r=yd*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=jt*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 xd=new class extends rd{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 bd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return bd(t,this.parseSize(e)/2+n,i,s)}};const Sd=Xt(3);function kd(t,e,i,s){const n=e,r=n/Sd,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 Ad=new class extends rd{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 kd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return kd(t,this.parseSize(e)/2+n,i,s)}};function Md(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 wd=new class extends rd{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Md(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Md(t,this.parseSize(e)/2+n,i,s)}};function Td(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Cd=new class extends rd{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Td(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Td(t,this.parseSize(e)/2+n,i,s)}};const Bd=-.5,Ed=Xt(3)/2,Pd=1/Xt(12);function Rd(t,e,i,s){const n=e/2,r=e*Pd,a=n,o=e*Pd+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(Bd*n-Ed*r+i,Ed*n+Bd*r+s),t.lineTo(Bd*a-Ed*o+i,Ed*a+Bd*o+s),t.lineTo(Bd*l-Ed*h+i,Ed*l+Bd*h+s),t.lineTo(Bd*n+Ed*r+i,Bd*r-Ed*n+s),t.lineTo(Bd*a+Ed*o+i,Bd*o-Ed*a+s),t.lineTo(Bd*l+Ed*h+i,Bd*h-Ed*l+s),t.closePath(),!1}var Od=new class extends rd{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 Rd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Rd(t,this.parseSize(e)/2+n,i,s)}};function Id(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}var Ld=new class extends rd{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 Id(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Id(t,this.parseSize(e)/2,i,s,n)}};function Dd(t,e,i,s,n=0){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}var Fd=new class extends rd{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 Dd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Dd(t,this.parseSize(e)/2,i,s,n)}};function zd(t,e,i,s,n=0){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}var jd=new class extends rd{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 zd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return zd(t,this.parseSize(e)/2,i,s,n)}};const Hd=Xt(3);function Vd(t,e,i,s){const n=e*Hd;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var Nd=new class extends rd{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Vd(t,this.parseSize(e)/2/Hd,i,s)}drawOffset(t,e,i,s,n){return Vd(t,this.parseSize(e)/2/Hd+n,i,s)}};function Wd(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 Ud=new class extends rd{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 Wd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Wd(t,this.parseSize(e)/4+n,i,s)}};function Gd(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 Yd=new class extends rd{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 Gd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Gd(t,this.parseSize(e)/4+n,i,s)}};function Xd(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 $d=new class extends rd{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 Xd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Xd(t,this.parseSize(e)/4+n,i,s)}};function Kd(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 qd=new class extends rd{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 Kd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Kd(t,this.parseSize(e)/4+n,i,s)}};function Zd(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var Jd=new class extends rd{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return Zd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Zd(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function Qd(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var tu=new class extends rd{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return Qd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Qd(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function eu(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 iu=new class extends rd{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 eu(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return eu(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function su(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function nu(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var ru=new class extends rd{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 x(e)?nu(t,e,i,s):su(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){x(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return x(e)?nu(t,e+2*n,i,s):su(t,[e[0]+2*n,e[1]+2*n],i,s)}};const au=new He;class ou{constructor(t,e,i=!1){this.pathStr="",this.type=t,_(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),el(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(el(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return x(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{au.x1=i.bounds.x1*t,au.y1=i.bounds.y1*t,au.x2=i.bounds.x2*t,au.y2=i.bounds.y2*t,e.union(au)}))}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 lu={};[od,ld,cd,ud,Nd,md,xd,Ad,wd,Cd,Od,Ld,Fd,fd,jd,Ud,Yd,$d,qd,ru,Jd,tu,iu].forEach((t=>{lu[t.type]=t}));const hu={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"};class cu{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 du(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function uu(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",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=uu(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=du(t,"--\x3e",r+4,"Comment is not closed.");else{const a=uu(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 cu(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 cu(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 fu(t,e){return mu(t)}function mu(t,e){const i={};for(let e=0;eMu.set(t,!0)));const wu=new Map;function Tu(t){if(Mu.has(t))return!0;if(wu.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>wu.set(t,!0)));const Cu=ku(),Bu=ku(),Eu=ku(),Pu=ku(),Ru=ku(),Ou=ku(),Iu=ku(),Lu=ku(),Du=ku(),Fu=ku();ku();const zu=ku();ku();const ju=ku();ku();const Hu=ku(),Vu=ku(),Nu=Symbol.for("GraphicService"),Wu=Symbol.for("GraphicCreator"),Uu={"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"},Gu=Object.keys(Uu),Yu={duration:200,easing:"cubicOut"};function Xu(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}function $u(t,e,i){const s=i[0],n=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]*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],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*s+c*n+g*r+e[12],t[13]=o*s+d*n+f*r+e[13],t[14]=l*s+u*n+m*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function Ku(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 qu(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],f=e[12],m=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*f,t[1]=y*n+b*l+x*u+S*m,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*f,t[5]=y*n+b*l+x*u+S*m,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*f,t[9]=y*n+b*l+x*u+S*m,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*f,t[13]=y*n+b*l+x*u+S*m,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function Zu(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 Ju{constructor(){this.pools=[]}static identity(t){return Xu(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 Ju.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},ip=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const sp=new Ne(1,0,0,1,0,0),np={x:0,y:0};let rp=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new Ne(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ne(1,0,0,1,0,0),this.path=new Nl,this._clearMatrix=new Ne(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Qu.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ne(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(Qu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Qu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){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,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=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(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){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},np),function(t,e,i){return cc(t,0,!1,e,i)}(this.path.commandList,np.x,np.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},np);const i=mh(this,this.lineWidth,this.dpr);return function(t,e,i,s){return cc(t,e,!0,i,s)}(this.path.commandList,i,np.x,np.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(t=!0,e=this.dpr){this.setTransformFromMatrix(sp,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Qu.free(t))),this.stack.length=0}};rp=ep([$a(),ip("design:paramtypes",[Object,Number])],rp);const ap={WIDTH:500,HEIGHT:500,DPR:1};class op{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}set nativeCanvas(t){this._nativeCanvas=t}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=ap.WIDTH,height:n=ap.HEIGHT,dpr:r=ap.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(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var lp;op.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(lp||(lp={}));class hp{static Get(t,e=lp.Color1,i=[0,0,0,1]){if(e===lp.Color1){const e=hp.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ti.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];hp.store1[t]=e,hp.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=hp.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ti.parseColorString(t);return n&&(hp.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],hp.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===lp.Color1){if(hp.store1[t])return;hp.store1[t]=i,hp.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(hp.store255[t])return;hp.store255[t]=i,hp.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function cp(t,e=!1){return Array.isArray(t)&&x(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 dp(t,e,i,s,n){return Array.isArray(t)&&!x(t[0])||Array.isArray(e)&&!x(e[0])?new Array(4).fill(0).map(((n,r)=>{var a,o;return up(_(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,_(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):up(t,e,i,s,n)}function up(t,e,i,s,n){if(!t||!e)return t&&cp(t)||e&&cp(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=hp.Get(t,lp.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=hp.Get(e,lp.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:cp(a)})))});return o?dp(r,l,i,s,n):dp(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:mp(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:mp(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:mp(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),cp(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)}function pp(t,e,i){return`rgba(${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})`}hp.store255={},hp.store1={};const gp=[0,0,0,0],fp=[0,0,0,0];function mp(t,e,i){return hp.Get(t,lp.Color255,gp),hp.Get(e,lp.Color255,fp),`rgba(${Math.round(gp[0]+(fp[0]-gp[0])*i)},${Math.round(gp[1]+(fp[1]-gp[1])*i)},${Math.round(gp[2]+(fp[2]-gp[2])*i)},${gp[3]+(fp[3]-gp[3])*i})`}class vp{static GetCanvas(){try{return vp.canvas||(vp.canvas=xo.global.createCanvas({})),vp.canvas}catch(t){return null}}static GetCtx(){if(!vp.ctx){const t=vp.GetCanvas();vp.ctx=t.getContext("2d")}return vp.ctx}}class _p extends We{static getInstance(){return _p._instance||(_p._instance=new _p),_p._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=vp.GetCanvas(),s=vp.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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new _p(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class yp{static GetSize(t){for(let e=0;e=t)return yp.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=yp.GenKey(t,e,i,s,n),l=yp.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=yp.GenKey(t,e,i,s,n);yp.cache[l]?yp.cache[l].push({width:a,height:o,pattern:r}):yp.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}yp.cache={},yp.ImageSize=[20,40,80,160,320,640,1280,2560];const bp=new He,xp=new Ne;new He;const Sp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],kp=["x","y"],Ap=["scaleX","scaleY"],Mp=["angle"],wp=new se,Tp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Cp extends Rc{static mixin(t){const e=Object.keys(t);for(let i=0;i10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=lu[t];if(e)return e;if(e=Cp.userSymbolMap[t],e)return e;if(!0===((i=t=hu[t]||t).startsWith("{const e=(new Nl).fromString(t.d),i={};Gu.forEach((e=>{t[e]&&(i[Uu[e]]=t[e])})),n.push({path:e,attribute:i}),bp.union(e.bounds)}));const r=bp.width(),a=bp.height(),o=1/Ut(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new ou(t,n,!0);return Cp.userSymbolMap[t]=l,l}var i;const s=(new Nl).fromString(t),n=s.bounds.width(),r=s.bounds.height(),a=1/Ut(n,r);s.transform(0,0,a,a);const o=new ou(t,s);return Cp.userSymbolMap[t]=o,o}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,s=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:n=e.boundsPadding}=i,r=Kc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new Lo(t);return el(e.commandList,i,0,0),!0}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(t=!0){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(t=!0){return this._transMatrix||(this._transMatrix=new Ne),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&Yo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&Yo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}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===Xo.GLOBAL){const i=new se(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){this.setAttributes(t,e,i),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||s)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,i){t&&((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,e=!1,i){const s=Object.keys(t);for(let e=0;e{i[e]?(o||(o={}),o[e]=t[e]):a[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(r=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==r?r:Yu;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:a,duration:l.duration,easing:l.easing}}]),o&&this.setAttributesAndPreventAnimate(o,!1,{type:$o.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t)}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:$o.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{type:$o.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(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,i;const s=this.attribute[t];return this.animates&&this.animates.size?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=s?s:null===(i=this.finalAttribute)||void 0===i?void 0:i[t]}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){const i=_(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);s.length!==this.currentStates.length&&this.useStates(s,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;this.stateSort&&(t=t.sort(this.stateSort));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,i){const s=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Gl.x,y:e=Gl.y,scaleX:i=Gl.scaleX,scaleY:s=Gl.scaleY,angle:n=Gl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(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=Wt(a),f=Yt(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const _=m-i,y=v-s,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,k=d*g-h*f;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*k,t.e=u+l*m+c*v-b*_-S*y,t.f=p+h*m+d*v-x*_-k*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,!0),xo.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Gl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=xp.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.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:$o.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:xo.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),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 v(t,!0)?this.pathProxy=(new Nl).fromString(t):this.pathProxy=new Nl,this.pathProxy}loadImage(t,e=!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(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",this.stopAnimates(),xo.graphicService.onRelease(this),super.release()}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new Fc(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)}}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||xo.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new rp(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}var Bp;Cp.userSymbolMap={},Cp.mixin(Vc),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Bp||(Bp={}));let Ep=class t extends Cp{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Ou,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 Cc),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Cc)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===Xo.GLOBAL){const i=new se(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;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Gl.x,y:e=Gl.y,dx:i=Gl.dx,dy:s=Gl.dy,scaleX:n=Gl.scaleX,scaleY:r=Gl.scaleY,angle:a=Gl.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()}getGraphicTheme(){return Ec(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return xo.graphicService.updateTempAABBBounds(i),xo.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=Yo.CLEAR_BOUNDS,this._childUpdateTag&=Yo.CLEAR_BOUNDS}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(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().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),this.getGraphicService().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(t=!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=xo.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}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}};function Pp(t){return new Ep(t)}Ep.NOWORK_ANIMATE_ATTR=Tp;class Rp extends Ep{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 Cc,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!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=>{xo.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=>{xo.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 Op=Symbol.for("TransformUtil"),Ip=Symbol.for("GraphicUtil"),Lp=Symbol.for("LayerService"),Dp=Symbol.for("StaticLayerHandlerContribution"),Fp=Symbol.for("DynamicLayerHandlerContribution"),zp=Symbol.for("VirtualLayerHandlerContribution");var jp,Hp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Np=jp=class{static GenerateLayerId(){return`${jp.idprefix}_${jp.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=xo.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?yo.get(Dp):"dynamic"===t?yo.get(Fp):yo.get(zp),e}createLayer(t,e={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 Rp(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:jp.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)}};Np.idprefix="visactor_layer",Np.prefix_count=0,Np=jp=Hp([$a(),Vp("design:paramtypes",[])],Np);var Wp=new La((t=>{t(_o).to(Bo).inSingletonScope(),t(gc).to(mc),t(Ip).to(bc).inSingletonScope(),t(Op).to(kc).inSingletonScope(),t(Lp).to(Np).inSingletonScope()}));function Up(t,e){return!(!t&&!e)}function Gp(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Yp(t,e,i){return i&&t*e>0}function Xp(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function $p(t,e){return t*e>0}function Kp(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function qp(t,e,i,s,n,r,a){const o=t-i,l=e-s,h=(a?r:-r)/Math.sqrt(o*o+l*l),c=h*l,d=-h*o,u=t+c,p=e+d,g=i+c,f=s+d,m=(u+g)/2,v=(p+f)/2,_=g-u,y=f-p,b=_*_+y*y,x=n-r,S=u*f-g*p,k=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let A=(S*y-_*k)/b,M=(-S*_-y*k)/b;const w=(S*y+_*k)/b,T=(-S*_+y*k)/b,C=A-m,B=M-v,E=w-m,P=T-v;return C*C+B*B>E*E+P*P&&(A=w,M=T),{cx:A,cy:M,x01:-c,y01:-d,x11:A*(n/x-1),y11:M*(n/x-1)}}function Zp(t,e,i,s,n){const r=Vt(i-e),a=t.getParsedCornerRadius(),o=_(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,y=Math.max(f,g),b=Math.max(m,v);let x=y,S=b;const k=n*Wt(c),A=n*Yt(c),M=s*Wt(u),w=s*Yt(u);let T,C,B,E;if((b>Dt||y>Dt)&&(T=n*Wt(d),C=n*Yt(d),B=s*Wt(p),E=s*Yt(p),r1?0:P<-1?Ft:Math.acos(P))/2),l=Xt(t[0]*t[0]+t[1]*t[1]);S=Gt(b,(s-l)/(o-1)),x=Gt(y,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:k,yors:A,xirs:B,yirs:E,xore:T,yore:C,xire:M,yire:w,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:y,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function Jp(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(n=Ht-Dt)e.moveTo(i+n*Wt(o),s+n*Yt(o)),e.arc(i,s,n,o,l,!c),r>Dt&&(e.moveTo(i+r*Wt(l),s+r*Yt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:k,outerStartAngle:A,outerEndAngle:M,limitedIcr:w,innerDeltaAngle:T,innerEndAngle:C,innerStartAngle:B,innerCornerRadiusStart:E,innerCornerRadiusEnd:P,maxInnerCornerRadius:R}=Zp(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>Dt){const t=Gt(v,m),r=Gt(_,m),o=qp(g,f,u,p,n,t,Number(c)),l=qp(b,x,S,k,n,r,Number(c));m0&&e.arc(i+o.cx,s+o.cy,t,Nt(o.y01,o.x01),Nt(o.y11,o.x11),!c),e.arc(i,s,n,Nt(o.cy+o.y11,o.cx+o.x11),Nt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Nt(l.y11,l.x11),Nt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Wt(Nt(l.y01,l.x01)),s+l.cy+r*Yt(Nt(l.y01,l.x01))):e.moveTo(i+b,s+n*Yt(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,A,M,!c)):e.moveTo(i+n*Wt(M),s+n*Yt(M));if(!(r>Dt)||T<.001)!a||a[1]?e.lineTo(i+S,s+k):e.moveTo(i+S,s+k),d=!0;else if(w>Dt){const t=Gt(E,w),n=Gt(P,w),o=qp(S,k,b,x,r,-n,Number(c)),l=qp(u,p,g,f,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),w0&&e.arc(i+o.cx,s+o.cy,n,Nt(o.y01,o.x01),Nt(o.y11,o.x11),!c),e.arc(i,s,r,Nt(o.cy+o.y11,o.cx+o.x11),Nt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Nt(l.y11,l.x11),Nt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Wt(Nt(l.y01,l.x01)),s+l.cy+t*Yt(Nt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+k):e.moveTo(i+S,s+k),!a||a[2]?e.arc(i,s,r,C,B,c):e.moveTo(i+r*Wt(B),s+r*Yt(B))}return a?a[3]&&e.lineTo(i+n*Wt(o),s+n*Yt(o)):e.closePath(),d}const Qp=Symbol.for("ArcRenderContribution"),tg=Symbol.for("AreaRenderContribution"),eg=Symbol.for("CircleRenderContribution"),ig=Symbol.for("GroupRenderContribution"),sg=Symbol.for("ImageRenderContribution"),ng=Symbol.for("PathRenderContribution"),rg=Symbol.for("PolygonRenderContribution"),ag=Symbol.for("RectRenderContribution"),og=Symbol.for("SymbolRenderContribution"),lg=Symbol.for("TextRenderContribution"),hg=Symbol.for("InteractiveSubRenderContribution");function cg(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function dg(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}var ug=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},gg=function(t,e){return function(i,s){e(i,s,t)}};function fg(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:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:v}=e.attribute,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(s=m[2])&&void 0!==s?s:0}if(Xu(t),$u(t,t,[n+o,r+l,a+h]),$u(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),$u(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]),f){const i=tp.allocate(),s=[0,0];if(v){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=m[1]}$u(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,f),$u(i,i,[-s[0],-s[1],0]),qu(t,t,i)}}let mg=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new mo(["graphic"]),onSetStage:new mo(["graphic","stage"]),onRemove:new mo(["graphic"]),onRelease:new mo(["graphic"]),onAddIncremental:new mo(["graphic","group","stage"]),onClearIncremental:new mo(["graphic","group","stage"]),beforeUpdateAABBBounds:new mo(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new mo(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new mo(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new He,this.tempAABBBounds2=new He}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)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}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 el(i.commandList,s,0,0),!0}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=x(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=dg(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=x(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=cg(n,e);i.set(s,i.y1,s+e,i.y2)}}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){xu(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;xu(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&&ze(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};mg=ug([$a(),gg(0,Ya(Wu)),pg("design:paramtypes",[Object])],mg);const vg=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},_g=["radius","startAngle","endAngle",...Sp];class yg extends Cp{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=Pu}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)}getGraphicTheme(){return Ec(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=xo.graphicService.updateTempAABBBounds(i);return vg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,xo.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Ht-Dt?i.set(-r,-r,r,r):Jc(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,_g)}needUpdateTag(t){return super.needUpdateTag(t,_g)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Nl,s.arc(0,0,r,a,o),s}clone(){return new yg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return yg.NOWORK_ANIMATE_ATTR}}function bg(t){return new yg(t)}yg.NOWORK_ANIMATE_ATTR=Tp;class xg{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Eo.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,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;a{t+=e.str})),(Array.isArray(r)?r.join(""):r).toString()!==t}return"vertical"===s.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==s.text.toString():null!=this.clipedText&&this.clipedText!==s.text.toString()}get multilineLayout(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=Vu,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}getGraphicTheme(){return Ec(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new kg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Ae(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=xo.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){xu(n,o/Math.abs(r+a),!0,l),i.union(n)}return xo.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||xo.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,ze(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:_=s.ignoreBuf,keepCenterInLine:y=s.keepCenterInLine}=n,b=_?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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(f/2),this._AABBBounds}const S=xo.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),k=new xg(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:y}),{bbox:A}=k;return this.cache.layoutData=k,this.clearUpdateShapeTag(),this._AABBBounds.set(A.xOffset,A.yOffset,A.xOffset+A.width,A.yOffset+A.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{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,measureMode:v=r.measureMode,suffixPosition:y=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,k=m?0:this.guessLineHeightBuf(h),A=this.getLineHeight(this.attribute,r,k);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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 M=xo.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),w={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:A},T=new xg(a,w,M),C=_(t)?t.map((t=>t.toString())):[t.toString()],B=[],E=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/A),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),E[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Ut(e,a)}));const t=cg(_,a),e=this.cache.verticalList.length*v,i=dg(y,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>function(t){const e=[];let i=0,s="";for(let n=0;n{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===Au.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))})),this.cache.verticalList=b,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Ut(e,a)}));const x=cg(_,a),S=this.cache.verticalList.length*v,k=dg(y,S,d);return this._AABBBounds.set(k,x,k+S,x+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=nd(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=Sg){return super.needUpdateTags(t,e)}needUpdateTag(t,e=Sg){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new kg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return kg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return kg.baselineMapAlign}getAlignMapBaseline(){return kg.alignMapBaseline}}function Ag(t){return new kg(t)}kg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Tp),kg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},kg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Mg=["symbolType","size",...Sp];let wg=class t extends Cp{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=Hu}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}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{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return Ec(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=xo.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;xu(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){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){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,Mg)}needUpdateTag(t){return super.needUpdateTag(t,Mg)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new Nl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Nl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Tg(t){return new wg(t)}wg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Tp);const Cg=["segments","points","curveType","curveTension",...Sp];let Bg=class t extends Cp{constructor(t={}){super(t),this.type="line",this.numberType=Lu}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=td(i,s,e))}getGraphicTheme(){return Ec(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),xo.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Cg)}needUpdateTag(t){return super.needUpdateTag(t,Cg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Nl;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Eg(t){return new Bg(t)}Bg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Tp);const Pg=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=d(t.width)?t.x1-t.x:t.width,i=d(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}},Rg=["width","x1","y1","height","cornerRadius",...Sp];class Og extends Cp{constructor(t){super(t),this.type="rect",this.numberType=zu}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Ec(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=xo.graphicService.updateTempAABBBounds(i);return vg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,xo.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Rg)}needUpdateTag(t){return super.needUpdateTag(t,Rg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=Pg(e);return t=new Nl,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new Og(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Og.NOWORK_ANIMATE_ATTR}}function Ig(t){return new Og(t)}Og.NOWORK_ANIMATE_ATTR=Tp;class Lg extends Cp{constructor(t){super(t),this.type="glyph",this.numberType=Ru,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,e=!1,i){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}getGraphicTheme(){return Ec(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}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(),this.stateSort&&(t=t.sort(this.stateSort));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.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Lg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Lg.NOWORK_ANIMATE_ATTR}}function Dg(t){return new Lg(t)}Lg.NOWORK_ANIMATE_ATTR=Tp;class Fg{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=_h[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}}}function zg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class jg{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=nd(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Ch(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||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,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r: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}=Ch(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Mh(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Ch(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=zg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Mh(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Ch(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=zg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=zg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=zg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=zg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&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=Mh(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Ch(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const Hg=["width","height","image",...Sp];class Vg extends Cp{constructor(t){super(t),this.type="image",this.numberType=Iu,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}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()})),this.addUpdateBoundTag()}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)}getGraphicTheme(){return Ec(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=xo.graphicService.updateTempAABBBounds(i);return vg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,xo.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return uh[t]}needUpdateTags(t){return super.needUpdateTags(t,Hg)}needUpdateTag(t){return super.needUpdateTag(t,Hg)}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({image:1,repeatX:1,repeatY:1},Tp);class Wg extends Vg{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=Kc(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=Kc(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=uh.width,height:e=uh.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 Ug{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 Wg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=_h[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof jg){const e=kh.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,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Wg)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Ch(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Wg)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Wg)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||bh;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,Ah(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||yh;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?vh(t,s,{AABBBounds:i}):s,Ah(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Wg)break;const{width:n}=Ch(t,s.character,s.ascentDescentMode),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.forEach(((t,e)=>{i+=t instanceof Wg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Gg{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=_h[this.direction]}store(t){if(t instanceof Wg){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 Ug(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,e=!1){t instanceof Wg?"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||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Mh(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new jg(i,t.newLine,t.character,t.ascentDescentMode),new jg(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Yg=!1;try{Yg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Yg=!1}const Xg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...Sp];class $g extends Cp{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=ju,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:dh.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:dh.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:dh.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:dh.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:dh.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:dh.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:dh.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:dh.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Ec(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&v(t.text)&&$g.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&v(t.text)&&$g.splitText(t.text).length>1)))}static splitText(t){if(Yg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=$g.splitText(t.text.toString());if(v(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),xo.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||xo.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,xo.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Xg)}needUpdateTag(t){return super.needUpdateTag(t,Xg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!$g.AllSingleCharacter(_)&&(_=$g.TransformTextConfig2SingleCharacter(_),this.attribute.textConfig=_);const y=[],b=null!=t?t:_;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,y.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(x(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,k="number"==typeof s&&Number.isFinite(s)&&s>0,A="number"==typeof n&&Number.isFinite(n)&&n>0&&(!S||n<=i),M="number"==typeof r&&Number.isFinite(r)&&r>0&&(!k||r<=s),w=new Fg(0,0,(A?n:S?i:0)||0,(M?r:k?s:0)||0,a,o,l,h,c,d||"horizontal",!A&&S,!M&&k,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),T=new Gg(w);if(T.newLine=v,p){let t=0,e=!1;for(let i=0;i{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=w}clone(){return new $g(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(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())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return $g.NOWORK_ANIMATE_ATTR}}function Kg(t){return new $g(t)}$g.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Tp);const qg=["path","customPath",...Sp];class Zg extends Cp{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=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Nl?e.path:(d(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Nl?this.cache:t.path)}getGraphicTheme(){return Ec(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=xo.graphicService.updateTempAABBBounds(i);vg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;v(t.path,!0)?this.cache=(new Nl).fromString(t.path):t.customPath&&(this.cache=new Nl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,qg)}needUpdateTag(t){return super.needUpdateTag(t,qg)}toCustomPath(){return(new Nl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Zg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Zg.NOWORK_ANIMATE_ATTR}}function Jg(t){return new Zg(t)}Zg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Tp);const Qg=["segments","points","curveType","curveTension",...Sp];class tf extends Cp{constructor(t){super(t),this.type="area",this.numberType=Eu}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}getGraphicTheme(){return Ec(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),xo.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),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}_interpolate(t,e,i,s,n){"points"===t&&(n.points=td(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Qg)}needUpdateTag(t){return super.needUpdateTag(t,Qg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Nl;const 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 tf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return tf.NOWORK_ANIMATE_ATTR}}function ef(t){return new tf(t)}tf.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Tp);const sf=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Sp];class nf extends Cp{constructor(t){super(t),this.type="arc",this.numberType=Cu}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=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(x(t,!0)?t:a*parseFloat(t)/100,a/2);if(_(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();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=oe(e),i=e+r,s&&Vt(r)Dt&&o>Dt)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=this.getGraphicTheme(),{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=Xt(a*a+o*o)}=this.attribute,h=Vt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>Dt&&l>Dt){const i=e>t?1:-1;let s=Kt(Number(l)/o*Yt(g)),n=Kt(Number(l)/a*Yt(g));return(f-=2*s)>Dt?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>Dt?(n*=i,c+=n,d-=n):(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}}getGraphicTheme(){return Ec(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=xo.graphicService.updateTempAABBBounds(i);vg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=Dt?i.set(0,0,0,0):Math.abs(o-l)>Ht-Dt?i.set(-s,-s,s,s):(Jc(l,o,s,i),Jc(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,sf)}needUpdateTag(t){return super.needUpdateTag(t,sf)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Vt(o-a),d=o>a;if(h=Ht-Dt)n.moveTo(0+h*Wt(a),0+h*Yt(a)),n.arc(0,0,h,a,o,!d),l>Dt&&(n.moveTo(0+l*Wt(o),0+l*Yt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Wt(a),e=h*Yt(a),i=l*Wt(o),s=l*Yt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new nf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return nf.NOWORK_ANIMATE_ATTR}}function rf(t){return new nf(t)}nf.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Tp);const af=["points","cornerRadius",...Sp];class of extends Cp{constructor(t){super(t),this.type="polygon",this.numberType=Fu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Ec(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),xo.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return xo.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=td(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,af)}needUpdateTag(t){return super.needUpdateTag(t,af)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Nl,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new of(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return of.NOWORK_ANIMATE_ATTR}}function lf(t){return new of(t)}of.NOWORK_ANIMATE_ATTR=Tp;class hf extends Ep{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!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 cf(t){return new hf(t)}const df=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 uf,pf;function gf(t){return uf||(uf=df.CreateGraphic("text",{})),uf.initAttributes(t),uf.AABBBounds}var ff=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},vf=function(t,e){return function(i,s){e(i,s,t)}};class _f{constructor(){this.time=Zo.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:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit,backgroundKeepAspectRatio:y=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:k=l.backgroundClip}=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=Ec(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}k&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:_,backgroundKeepAspectRatio:y,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s){const{backgroundMode:n,backgroundFit:r,backgroundKeepAspectRatio:a,backgroundScale:o=1,backgroundOffsetX:l=0,backgroundOffsetY:h=0}=s,c=i.width(),d=i.height();let u=c,p=d;if("no-repeat"===n)if(r)if(a){const s=Math.max(c/e.width,d/e.height);t.drawImage(e,i.x1+l,i.y1+h,e.width*s*o,e.height*s*o)}else t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const s=e.width*o,n=e.height*o;t.drawImage(e,i.x1+l,i.y1+h,s,n)}else{if(r&&"repeat"!==n&&(e.width||e.height)){const i=e.width,s=e.height;"repeat-x"===n?(u=i*(d/s),p=d):"repeat-y"===n&&(p=s*(c/i),u=c);const r=t.dpr,a=dc.allocate({width:u,height:p,dpr:r}),o=a.getContext("2d");o&&(o.inuse=!0,o.clearMatrix(),o.setTransformForCurrent(!0),o.clearRect(0,0,u,p),o.drawImage(e,0,0,u,p),e=a.nativeCanvas),dc.free(a)}const s=t.dpr,a=t.createPattern(e,n);a.setTransform&&a.setTransform(new DOMMatrix([1/s,0,0,1/s,0,0])),t.fillStyle=a,t.translate(i.x1,i.y1),t.fillRect(0,0,c,d),t.translate(-i.x1,-i.y1)}}}const yf=new _f;let bf=class{constructor(t){this.subRenderContribitions=t,this.time=Zo.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)}))}};bf=ff([$a(),vf(0,Ya(co)),vf(0,Ka(hg)),mf("design:paramtypes",[Object])],bf);const xf=new class{constructor(){this.time=Zo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),_=t.AABBBounds,y=null!==(p=t.attribute.width)&&void 0!==p?p:_.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:_.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[y,b],i+y/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const Sf=new class{constructor(){this.time=Zo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}};class kf{constructor(){this.time=Zo.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=dc.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])),dc.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,Ht),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:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h;const{textureRatio:c=r.textureRatio,textureOptions:d=null}=e.attribute;let u=this.textureMap.get(t);if(!u)switch(t){case"circle":u=this.createCirclePattern(o,l,a,i);break;case"diamond":u=this.createDiamondPattern(o,l,a,i);break;case"rect":u=this.createRectPattern(o,l,a,i);break;case"vertical-line":u=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":u=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":u=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":u=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":u=this.createGridPattern(o,l,a,i)}if(d&&d.dynamicTexture){const{gridConfig:u={},useNewCanvas:p}=d,g=e.AABBBounds;s=g.x1,n=g.y1;const f=i;let m;if(p){m=dc.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=m.getContext("2d");t.clearRect(0,0,g.width(),g.height()),s=0,n=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,s,n,r),f.clip();const v=g.width(),_=g.height(),y=l,b=o,x=u.columns?u.columns:Math.ceil(v/b),S=u.rows?u.rows:Math.ceil(_/b),k=u.gutterColumn?u.gutterColumn:2*y,A=u.gutterRow?u.gutterRow:2*y;this._tempSymbolGraphic||(this._tempSymbolGraphic=Tg({}));const M=u.columns?v/u.columns:b,w=u.rows?_/u.rows:b;this._tempSymbolGraphic.setAttributes({size:[M-k,w-A],symbolType:t});const T=this._tempSymbolGraphic.getParsedPath();for(let t=0;t{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:mh(e,o,e.dpr),c=o/T,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:T+u*h,innerRadius:w-u*h,startAngle:_-u*c,endAngle:y+u*c}),e.beginPath(),Jp(t,e,i,s,T+u*h,w-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/k,(S-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder"),t.setAttributes({outerRadius:T,innerRadius:w,startAngle:_,endAngle:y})}},wf=Af,Tf=yf;const Cf=new class{constructor(){this.time=Zo.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,f=p&&!1!==p.visible;if(!g&&!f)return;const{radius:m=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:k=l.scaleY,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:mh(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),f&&M(p,"innerBorder")}},Bf=Af,Ef=yf;const Pf=new class extends _f{constructor(){super(...arguments),this.time=Zo.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,backgroundKeepAspectRatio:f=l.backgroundKeepAspectRatio,backgroundScale:m=l.backgroundScale,backgroundOffsetX:v=l.backgroundOffsetX,backgroundOffsetY:_=l.backgroundOffsetY}=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,{backgroundMode:p,backgroundFit:g,backgroundKeepAspectRatio:f,backgroundScale:m,backgroundOffsetX:v,backgroundOffsetY:_}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Rf=Ft/2;function Of(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),x(r,!0))l=[r=Vt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Vt(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Vt(t[0]),i=Vt(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Vt(l[0]),l[1]=Vt(l[1]),l[2]=Vt(l[2]),l[3]=Vt(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],_=[c[0],c[1]+g[1]],y=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],S=[u[0]+g[3],u[1]],k=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!K(v,_)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Rf,0,!1)}if(o&&o[1]?o[1](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!K(y,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Rf,!1)}if(o&&o[2]?o[2](y[0],y[1],S[0],S[1]):t.lineTo(S[0],S[1]),!K(S,k)){const e=S[0],i=S[1]-g[3];o&&o[2]&&t.moveTo(S[0],S[1]),t.arc(e,i,g[3],Rf,Ft,!1)}if(o&&o[3]?o[3](k[0],k[1],m[0],m[1]):t.lineTo(m[0],m[1]),!K(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],Ft,Ft+Rf,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),o&&o[2]?o[2](y[0],y[1],S[0],S[1]):t.lineTo(S[0],S[1]),o&&o[2]?o[2](S[0],S[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}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};class Lf{constructor(){this.time=Zo.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,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:k=l.scaleY,x1:A,y1:M,keepStrokeScale:w=l.keepStrokeScale}=t.attribute;let{width:T,height:C}=t.attribute;T=(null!=T?T:A-i)||0,C=(null!=C?C:M-s)||0;const B=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=w?h:mh(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||_(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,T-o*g,C-o*g)):(e.beginPath(),Of(e,u,p,T-o*g,C-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&B(u,"outerBorder"),f&&B(p,"innerBorder")}}let Df=class{constructor(){this.time=Zo.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)}};Df=If([$a()],Df);let Ff=class{constructor(){this.time=Zo.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:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:y=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||_(v)&&v.every((t=>0===t)))){let n,r=0;return Of(e,i,s,b,x,v,"bevel"!==y,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};Ff=If([$a()],Ff);const zf=new Lf,jf=Af,Hf=yf;const Vf=new class extends Lf{constructor(){super(...arguments),this.time=Zo.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)}},Nf=yf;const Wf=new class{constructor(){this.time=Zo.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,f=p&&!1!==p.visible,m=g&&!1!==g.visible;if(!f&&!m)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,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,A=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:mh(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(y-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&A(p,"outerBorder"),m&&A(g,"innerBorder")}},Uf=new class{constructor(){this.time=Zo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:_=l.scaleX,scaleY:y=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/_,(f-s)/y,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/_,(f-s)/y,l),e.stroke())))}},Gf=Af,Yf=yf;const Xf={x:0,y:0,z:0,lastModelMatrix:null};class $f{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(xf),this.builtinContributions.push(Sf),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===Zo.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Zo.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}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)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Ec(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,_=Yp(d,u,h),y=$p(d,g),b=Up(h),x=Gp(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(_||y||a||o))return!0;e.beginPath();return el(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),!0}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=Yp(o,l,n),p=$p(o,c),g=Up(n,r),f=Gp(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){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;Xf.x=n,Xf.y=r,Xf.z=a,Xf.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=tp.allocate(),n=tp.allocate();fg(n,t,e),qu(s,d||s,n),Xf.x=0,Xf.y=0,Xf.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),tp.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Xf.x+=s.x,Xf.y+=s.y,Xf.z=a,i.setTransformForCurrent()}else if(p)Xf.x=0,Xf.y=0,Xf.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Xf.x+=s.x,Xf.y+=s.y,this.transformWithoutTranslate(i,Xf.x,Xf.y,Xf.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Xf.x=0,Xf.y=0,Xf.z=0;return Xf}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,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,_=(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,f,m,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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&tp.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}var Kf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zf=function(t,e){return function(i,s){e(i,s,t)}};let Jf=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Cu,this.builtinContributions=[Mf,Tf,wf],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=d>c;let p=!1;if(nDt){const t=Gt(b,y),r=Gt(x,y),a=qp(v,_,f,m,n,t,Number(u)),o=qp(k,A,M,w,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,Nt(o.y11,o.x11),Nt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>Dt)||C<.001)e.lineTo(i+M,s+w),p=!0;else if(T>Dt){const t=Gt(E,T),n=Gt(P,T),a=qp(M,w,k,A,r,-n,Number(u)),o=qp(f,m,v,_,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),T0&&e.arc(i+a.cx,s+a.cy,n,Nt(a.y01,a.x01),Nt(a.y11,a.x11),!u);const t=Nt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Wt(B),s+r*Yt(B));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Ec(t,null==r?void 0:r.theme).arc;const{fill:c=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:k=l.forceShowCap}=t.attribute;let{outerRadius:A=l.outerRadius,innerRadius:M=l.innerRadius}=t.attribute;A+=b,M-=x;let w=0;const T=(h(S)&&S||S[0])&&"conical"===c.gradient;if(T){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Vt(s-i){var e;let i=!0;if(h(t,!0)){for(let s=0;s<4;s++)Xc[s]=t,i&&(i=!(null!==(e=Xc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Xc[e]=!!t[e],i&&(i=!!Xc[e]);else Xc[0]=!1,Xc[1]=!1,Xc[2]=!1,Xc[3]=!1;return{isFullStroke:i,stroke:Xc}})(d);if((_||B)&&(e.beginPath(),Jp(t,e,i,s,A,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),g?(this._runStroke(t,e,i,s,l,y,B,v,o),this._runFill(t,e,i,s,l,_,m,u,p,a)):(this._runFill(t,e,i,s,l,_,m,u,p,a),this._runStroke(t,e,i,s,l,y,B,v,o))),!B&&y&&(e.beginPath(),Jp(t,e,i,s,A,M,E),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(h(S)&&S||S[1])&&k){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Vt(h-r)>=Ht-Dt){e.beginPath();const r=Math.abs(A-M)/2/A,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,A,M,d,d+r),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o);const u=()=>{if(_){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+=Ht;for(;i>Ht;)i-=Ht;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),dp(o.color,l.color,h,!1)}(0,0,h,n);a||Yp&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}},p=()=>{y&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};u(),p()}}this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),T&&(c.startAngle+=w,c.endAngle+=w)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}};Jf=Kf([$a(),Zf(0,Ya(co)),Zf(0,Ka(Qp)),qf("design:paramtypes",[Object])],Jf);var Qf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},em=function(t,e){return function(i,s){e(i,s,t)}};let im=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Pu,this.builtinContributions=[Cf,Ef,Bf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Ec(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,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f;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,_,y,m,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{y&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o)}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function sm(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]=ll(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 nm(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function rm(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=nm(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),sm(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=Ko.ROW:"y"===s?u=Ko.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.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 om=class extends $f{constructor(){super(...arguments),this.numberType=Lu}draw(t,e,i,s){const n=Ec(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 f;if(!e)return;t.beginPath();rm(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),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:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!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:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===_)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}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=Vl(x(t.points,v),_,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===_){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===y){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],y,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=y*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Gt(_,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,y,b,i,s,t,a,o)}};function lm(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),sm(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),sm(t,l,1,s),o=!1):o=!0}t.closePath()}om=am([$a()],om);const hm=new class extends kf{constructor(){super(...arguments),this.time=Zo.afterFillStroke}drawShape(t,e,i,s,n,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:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:ed(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:ed(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:ed(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:ed(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},cm=yf;var dm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},um=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pm=function(t,e){return function(i,s){e(i,s,t)}};let gm=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Eu,this.builtinContributions=[hm,cm],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,y=m[0];e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const i=m[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,v)}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:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(_(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Ec(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:k}=S,A=S.doStroke&&S.sVisible,{clipRange:M=g.clipRange,closePath:w,points:T,segments:C}=t.attribute;let{curveType:B=g.curveType}=t.attribute;function E(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(w&&"linear"===B&&(B="linearClosed"),1===M&&!C&&!T.some((t=>!1===t.defined))&&"linear"===B)return this.drawLinearAreaHighPerformance(t,e,!!f,A,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(C&&C.length){let e,i;const s=C.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=Vl(E(t.points,x),B,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=C.length-1;t>=0;t--){const e=C[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=C[t-1].points,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=Vl(E(i,x),"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!T||!T.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=E(T,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Vl(e,B,{curveTension:b}),n=Vl(i,"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===M){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,k,v,A,y,r[c],[g,t.attribute],M,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=M*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,k,v,A,y,r[u],[g,t.attribute],Gt(f,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,k,v,A,y,t.attribute,g,M,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Ec(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,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let y,b,x=Ko.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],y=t.points[t.points.length-1]}else b=m[0],y=m[m.length-1];const S=Vt(y.x-b.x),k=Vt(y.y-b.y);x=null==y.x1?Ko.ROW:null==y.y1?Ko.COLUMN:Number.isFinite(S+k)?S>k?Ko.ROW:Ko.COLUMN:Ko.ROW,function(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?Ko.ROW:Ko.COLUMN,Number.isFinite(c)||(o=Ko.COLUMN),Number.isFinite(d)||(o=Ko.ROW);const u=i*(o===Ko.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;_(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),rm(t,i[0]?e.top:e.bottom,l,x===Ko.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,A-h,M-c,o),t.stroke()}})(),!1}};gm=dm([$a(),pm(0,Ya(co)),pm(0,Ka(tg)),um("design:paramtypes",[Object])],gm);const fm=Af,mm=yf;var vm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},ym=function(t,e){return function(i,s){e(i,s,t)}};let bm=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Du,this.builtinContributions=[mm,fm],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:Ec(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:_,doFill:y,doStroke:b}=m;if(e.beginPath(),t.pathShape)el(t.pathShape.commandList,e,i,s,1,1,f);else{el((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,y,b,v,_,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):_&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{y&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,y,b,v,_,d,n,a,o)}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};bm=vm([$a(),ym(0,Ya(co)),ym(0,Ka(ng)),_m("design:paramtypes",[Object])],bm);var xm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},km=function(t,e){return function(i,s){e(i,s,t)}};let Am=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=zu,this.builtinContributions=[zf,Hf,jf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Ec(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:y=l.visible,x1:b,y1:x,x:S=l.x,y:k=l.y,fillStrokeOrder:A=l.fillStrokeOrder,drawStrokeWhenZeroWH:M=l.drawStrokeWhenZeroWH}=t.attribute;let{width:w,height:T}=t.attribute;w=(null!=w?w:b-S)||0,T=(null!=T?T:x-k)||0;const C=Xp(g,f,w,T,h),B=Kp(g,v,w,T,M),E=Up(h,c),P=Gp(d,m);if(!t.valid||!y)return;if(!E&&!P)return;if(!(C||B||a||o||c))return;0===u||_(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,w,T)):(e.beginPath(),Of(e,i,s,w,T,u,"bevel"!==p));const R={doFill:E,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,E,P,C,B,l,n,a,o,R),A?(this._runStroke(t,e,i,s,l,R,B,S,k,o),this._runFill(t,e,i,s,l,R,C,S,k,a)):(this._runFill(t,e,i,s,l,R,C,S,k,a),this._runStroke(t,e,i,s,l,R,B,S,k,o)),this.afterRenderStep(t,e,i,s,E,P,C,B,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}};Am=xm([$a(),km(0,Ya(co)),km(0,Ka(ag)),Sm("design:paramtypes",[Object])],Am);var Mm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tm=function(t,e){return function(i,s){e(i,s,t)}};let Cm=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Hu,this.builtinContributions=[Wf,Yf,Gf,Uf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:Ec(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v,k=t.getParsedPath();if(!k)return;const{keepDirIn3d:A=l.keepDirIn3d}=t.attribute,M=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let w=i,T=s,C=M;const B=e.camera;if(A&&B&&e.project){const t=e.project(i,s,M);e.camera=null,_(c)&&(c[0],c[1]),w=t.x,T=t.y,C=void 0}!1===k.draw(e,c,w,T,C,((n,r)=>{var h,c,v,_;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(_=r.lineWidth)&&void 0!==_?_:t.attribute.lineWidth,r=e}const y=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),y()):(y(),x())}))&&e.closePath(),e.camera=B,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,y,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,k,m,p,g,o),this._runFill(t,e,i,s,l,x,y,d,u,k,a)):(this._runFill(t,e,i,s,l,x,y,d,u,k,a),this._runStroke(t,e,i,s,l,S,b,d,u,k,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,y,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Cm=Mm([$a(),Tm(0,Ya(co)),Tm(0,Ka(og)),wm("design:paramtypes",[Object])],Cm);const Bm=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new He)}allocate(t,e,i,s){if(!this.pools.length)return(new He).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 He(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(...t){this.pools=[]}};const Em=new class extends _f{constructor(){super(...arguments),this.time=Zo.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,g,f,m,v,_,y,b,x,S;const{backgroundMode:k=l.backgroundMode,backgroundFit:A=l.backgroundFit,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio}=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 B;"richtext"===t.type&&(w=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const E=p(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!==(g=T.dx)&&void 0!==g?g:0),s=(null!==(f=T.y)&&void 0!==f?f:e.y1)+(null!==(m=T.dy)&&void 0!==m?m:0),n=null!==(v=T.width)&&void 0!==v?v:e.width(),r=null!==(_=T.height)&&void 0!==_?_:e.height();if(B=Bm.allocate(i,s,i+n,s+r),T=T.background,!P){const t=B.width(),e=B.height();B.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 B=t.AABBBounds,P||(B=gf(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 C();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,B,{backgroundMode:k,backgroundFit:A,backgroundKeepAspectRatio:M}),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n,backgroundOpacity:r=1}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=r,e.fillStyle=T,n?(Of(e,B.x1,B.y1,B.width(),B.height(),n,!0),e.fill()):e.fillRect(B.x1,B.y1,B.width(),B.height()),e.highPerformanceRestore()}E&&Bm.free(B),C()}};var Pm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Om=function(t,e){return function(i,s){e(i,s,t)}};let Im=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Vu,this.builtinContributions=[Em],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Ec(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,fontSize:v=d.fontSize,verticalMode:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute,x=null!==(l=nd(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:k,sVisible:A,doFill:M,doStroke:w}=S,T=!f,C=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,M,w,k,A,d,n,a,o),T&&this.transformUseContext2d(t,d,C,e);const B=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=Qu.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),Qu.free(t)}w&&(o?o(e,t.attribute,d):A&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,C))),M&&(a?a(e,t.attribute,d):k&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,C))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,C),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;w&&(o?o(e,t.attribute,d):A&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,C)})))),M&&(a?a(e,t.attribute,d):k&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,C),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,C,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!_){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Ut(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;B(i,a-(e+1)*x+u,r,n),r+=s}))}))}T&&this.restoreTransformUseContext2d(t,d,C,e),this.afterRenderStep(t,e,i,s,M,w,k,A,d,n,a,o)}draw(t,e,i,s){const n=Ec(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,l,h,c){if(e+t<=0)return;const{textAlign:u=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,_=!d(c),y=_?c.width:i.clipedWidth,b=_?0:cg(u,y),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+y,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+y,t,o),h.stroke()}}};function Lm(t,e,i,s){if(e&&e.length){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},Vm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nm=function(t,e){return function(i,s){e(i,s,t)}};let Wm=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Fu,this.builtinContributions=[jm,zm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Ec(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,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:b}=f;e.beginPath(),c<=0||_(c)&&c.every((t=>0===t))?Lm(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Lm(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,f=(Math.atan2(u,d)-Math.atan2(g,p))/2,m=Math.abs(Math.tan(f));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,_=v/m;const y=Dm(d,u),b=Dm(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*m);const S=Fm(h,_,y,d,u),k=Fm(h,_,b,p,g),A=2*h.x-S.x-k.x,M=2*h.y-S.y-k.y,w=Dm(A,M),T=Fm(h,Dm(_,v),w,A,M);let C=Math.atan2(S.y-T.y,S.x-T.x);const B=Math.atan2(k.y-T.y,k.x-T.x);let E=B-C;E<0&&(C=B,E=-E),E>Math.PI&&(E-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),E&&t.arcTo(h.x+i,h.y+s,k.x+i,k.y+s,v),t.lineTo(k.x+i,k.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,y,b,m,v,l,n,a,o);const x=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,y,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=Ec(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Wm=Hm([$a(),Nm(0,Ya(co)),Nm(0,Ka(rg)),Vm("design:paramtypes",[Object])],Wm);var Um=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Gm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ym=function(t,e){return function(i,s){e(i,s,t)}};let Xm=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Ou}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Pf)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:Ec(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:y=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:k=l.fillStrokeOrder,cornerType:A=l.cornerType,x:M=l.x,y:w=l.y}=t.attribute,T=Xp(p,m,g,f,c),C=Kp(p,v,g,f),B=Up(c,u),E=Gp(d,x);if(!t.valid||!S)return;if(!h){if(!B&&!E)return;if(!(T||C||a||o||u))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||_(y)&&y.every((t=>0===t))?(e.beginPath(),e.rect(i,s,g,f)):(e.beginPath(),Of(e,i,s,g,f,y,"bevel"!==A));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Pf));const P={doFill:B,doStroke:E};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===Zo.beforeFillStroke&&r.drawShape(t,e,i,s,B,E,T,C,l,n,a,o,P)})),h&&e.clip();const R=()=>{P.doFill&&(a?a(e,t.attribute,l):T&&(e.setCommonStyle(t,t.attribute,M-i,w-s,l),e.fill()))},O=()=>{P.doStroke&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,M-i,w-s,l),e.stroke()))};k?(O(),R()):(R(),O()),this._groupRenderContribitions.forEach((r=>{r.time===Zo.afterFillStroke&&r.drawShape(t,e,i,s,B,E,T,C,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=xo.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=Ec(t,null==s?void 0:s.theme).group,i=tp.allocate(),n=tp.allocate();fg(n,t,e),qu(i,p||i,n),a.modelMatrix=i,tp.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&tp.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}};Xm=Um([$a(),Ym(0,Ya(co)),Ym(0,Ka(ig)),Gm("design:paramtypes",[Object])],Xm);var $m=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},qm=function(t,e){return function(i,s){e(i,s,t)}};const Zm=["","repeat-x","repeat-y","repeat"];let Jm=class extends $f{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Iu,this.builtinContributions=[Vf,Nf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Ec(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,image:m}=t.attribute,v=this.valid(t,l,a);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v;if(!m||!t.resources)return;const k=t.resources.get(m);if("success"!==k.state)return;const A=t.width,M=t.height;e.beginPath();let w=!1;0===p||_(p)&&p.every((t=>0===t))?e.rect(i,s,A,M):(Of(e,i,s,A,M,p,"bevel"!==f),w=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const T=()=>{if(x)if(a)a(e,t.attribute,l);else if(y){e.setCommonStyle(t,t.attribute,i,s,l);let n=0;if("repeat"===h&&(n|=1),"repeat"===c&&(n|=2),n){const t=e.createPattern(k.data,Zm[n]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,A,M),e.translate(-i,-s,!0)}else e.drawImage(k.data,i,s,A,M)}},C=()=>{S&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(C(),w&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,y,!1,l,n,a),T(),w&&e.restore()):(w&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,y,!1,l,n,a),T(),w&&e.restore(),C()),this.afterRenderStep(t,e,i,s,x,!1,y,!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&&v(s))return void Uc.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Ec(t).image;this._draw(t,a,!1,i)}};Jm=$m([$a(),qm(0,Ya(co)),qm(0,Ka(sg)),Km("design:paramtypes",[Object])],Jm);const Qm=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"),fv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Bu,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];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+=Ht;for(;o<0;)o+=Ht;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};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},vv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const _v=Symbol.for("DrawItemInterceptor"),yv=new He,bv=new He;class xv{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){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,Qu.allocate(1,0,0,1,0,0)),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 kv=class{constructor(){this.order=1,this.interceptors=[new xv,new Mv,new Av,new Sv]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&tp.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var wv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Cv=function(t,e){return function(i,s){e(i,s,t)}};let Bv=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))}reInit(){this.drawContribution.reInit()}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}};Bv=wv([$a(),Cv(0,Ya(gv)),Tv("design:paramtypes",[Object])],Bv);var Ev=new La((t=>{t(bo).to(Bv)}));const Pv=Symbol.for("PickerService"),Rv=Symbol.for("GlobalPickerService"),Ov=Symbol.for("PickItemInterceptor"),Iv=Symbol.for("PickServiceInterceptor");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};let Dv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};Dv=Lv([$a()],Dv);let Fv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Ec(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=Qu.allocateByObj(a),u=new se(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};Fv=Lv([$a()],Fv);let zv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new se(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}};zv=Lv([$a()],zv);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){const a=fv(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};jv=Lv([$a()],jv);var Hv=new La(((t,e,i)=>{i(Pv)||(t(Rv).toSelf(),t(Pv).toService(Rv)),t(jv).toSelf().inSingletonScope(),t(Ov).toService(jv),t(Fv).toSelf().inSingletonScope(),t(Ov).toService(Fv),t(zv).toSelf().inSingletonScope(),t(Ov).toService(zv),po(t,Ov),t(Dv).toSelf().inSingletonScope(),t(Iv).toService(Dv),po(t,Iv)})),Vv=new La((t=>{t(Nu).to(mg),t(Wu).toConstantValue(df)}));const Nv=Symbol.for("AutoEnablePlugins"),Wv=Symbol.for("PluginService");var Uv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Yv=function(t,e){return function(i,s){e(i,s,t)}};let Xv=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&&yo.isBound(Nv)&&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(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Xv=Uv([$a(),Yv(0,Ya(co)),Yv(0,Ka(Nv)),Gv("design:paramtypes",[Object])],Xv);var $v=new La((t=>{t(Wv).to(Xv),function(t,e){t(co).toDynamicValue((({container:t})=>new uo(e,t))).whenTargetNamed(e)}(t,Nv)})),Kv=new La((t=>{po(t,vo)})),qv=new La((t=>{t(Rh).to(Oh).inSingletonScope(),po(t,Rh)})),Zv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Qv=class{constructor(){this.type="static",this.offscreen=!1,this.global=xo.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=Dh({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()}};Qv=Zv([$a(),Jv("design:paramtypes",[])],Qv);var t_=new La((t=>{t(Qv).toSelf(),t(Dp).toService(Qv)}));var e_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function i_(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function s_(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=i_(t,e,s);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;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=i_(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var a_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},o_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},l_=function(t,e){return function(i,s){e(i,s,t)}};let h_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):s_(e,Jl.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new je,this.backupDirtyBounds=new je,this.global=xo.global,this.layerService=xo.layerService,_(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}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){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=ve(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.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,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Jl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Jl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Qu.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=r_(e,i,Jl.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&&!xe(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Bm.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Qu.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Bm.free(n),Qu.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||yo.get(Qm);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let d_=class extends om{constructor(){super(...arguments),this.numberType=Lu}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=Ec(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=Yp(u,p,c),_=$p(u,g),y=Up(c),b=Gp(d,f);if(!t.valid||!m)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())}};d_=c_([$a()],d_);var u_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 p_=class extends gm{constructor(){super(...arguments),this.numberType=Eu}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=Ec(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Yp(u,d,c),f=Up(c);if(!t.valid||!p)return;if(!f)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())}};p_=u_([$a()],p_);var g_,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},m_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},v_=function(t,e){return function(i,s){e(i,s,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"}(g_||(g_={}));let y_=class extends h_{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=g_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new mo([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return __(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:Jl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Jl.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 __(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return __(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>__(this,void 0,void 0,(function*(){if(2!==t.count)yield n_(t,Jl.zIndex,((i,s)=>{if(this.status===g_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return __(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return __(this,void 0,void 0,(function*(){this.rendering&&(this.status=g_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=g_.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 __(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:()=>__(this,void 0,void 0,(function*(){yield n_(t,Jl.zIndex,(t=>__(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};y_=f_([$a(),v_(0,Xa(sv)),v_(1,Ya(d_)),v_(2,Ya(p_)),v_(3,Ya(co)),v_(3,Ka(_v)),m_("design:paramtypes",[Array,Object,Object,Object])],y_);var b_=new La((t=>{t(_f).toSelf().inSingletonScope(),t(kf).toSelf().inSingletonScope(),t(gv).to(h_),t(Qm).to(y_),t(nv).to(Xm).inSingletonScope(),t(sv).toService(nv),po(t,ig),t(bf).toSelf().inSingletonScope(),po(t,hg),po(t,sv),t(kv).toSelf().inSingletonScope(),t(_v).toService(kv),po(t,_v)}));function x_(){x_.__loaded||(x_.__loaded=!0,yo.load(Wp),yo.load(Vv),yo.load(Ev),yo.load(Hv),yo.load($v),function(t){t.load(Kv),t.load(qv),t.load(t_)}(yo),function(t){t.load(b_)}(yo))}x_.__loaded=!1,x_();const S_=yo.get(_o);xo.global=S_;const k_=yo.get(Ip);xo.graphicUtil=k_;const A_=yo.get(Op);xo.transformUtil=A_;const M_=yo.get(Nu);xo.graphicService=M_;const w_=yo.get(Lp);xo.layerService=w_;class T_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class C_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=xo.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=xo.global.getRequestAnimationFrame();this.rafId=t((()=>{xo.global.devicePixelRatio!==this.dpr&&(this.dpr=xo.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=xo.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class B_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.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))})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,xo.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())}}const E_=new He;class P_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Ia.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()}));const e=this.pluginService.stage;e&&(e.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&&(E_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(E_,t.parent&&t.parent.globalTransMatrix)))})),e.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))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let R_;function O_(){!function(){if(null==R_)try{const t=document.createElement("canvas"),e=t.getContext("2d");R_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),R_&&(R_=!!document.createElement)}catch(t){R_=!1}}();const t=xo.global&&xo.global.env;return t?"browser"===t:R_}let I_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};I_._pluginClasses={};const L_="white";class D_ extends Ep{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:L_}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={}){var e,i;super({}),this.tickedBeforeRender=!0,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._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Cc,this.hooks={beforeRender:new mo(["stage"]),afterRender:new mo(["stage"]),afterClearScreen:new mo(["stage"]),afterClearRect:new mo(["stage"])},this.global=xo.global,!this.global.env&&O_()&&this.global.setEnv("browser"),this.window=yo.get(gc),this.renderService=yo.get(bo),this.pluginService=yo.get(Wv),this.layerService=yo.get(Lp),this.graphicService=yo.get(Nu),this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],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:L_,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(),t.autoRefresh&&this.enableAutoRefresh(),!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),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&v(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(i=t.rafId)&&void 0!==i?i:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new Wc(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(t=!1){t&&(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:f=[1,1,-1],color:m="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,k=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+y,k=Math.cos(d)*Math.cos(u)*1);const A=I_.getPlugin("DirectionalLight");A&&(this.light=new A(f,m,v));const M={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,k],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=M;else{const t=I_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=I_.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}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 T_))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new C_))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new B_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new je;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new P_,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=I_.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=I_.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=I_.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();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.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();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===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),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.dirtyBounds&&this.dirtyBounds.clear(),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,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new se(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;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.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=yo.get(gc),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=yo.get(Pv)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}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},z_=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 j_=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new He}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}}loadFont(t,e,i){return z_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}};j_=F_([$a()],j_);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},V_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let N_=class{constructor(){this._uid=Ia.GenAutoIncrementId(),this.viewBox=new He,this.modelMatrix=new Ne(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){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}};N_=H_([$a(),V_("design:paramtypes",[])],N_);var W_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},U_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},G_=function(t,e){return function(i,s){e(i,s,t)}};let Y_=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=xo.global}reInit(){this._init()}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.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 He).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 Ne(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),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new se(e.x,e.y),a=Ec(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 se(e.x,e.y);l.transformPoint(a,a);const o=Ec(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&&tp.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),Qu.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function X_(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 $_(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function ty(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;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&&x(t.x)&&x(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}))),ry=(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]},ay=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new je;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 ry(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return ry(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);ay(n[0],s,i),ay(n[1],e-s,i)}};let oy=!1;const ly=new La((t=>{oy||(oy=!0,t(Jf).toSelf().inSingletonScope(),t(tv).to(Jf).inSingletonScope(),t(sv).toService(tv),t(Qp).toService(bf),po(t,Qp))}));let hy=!1;const cy=new La((t=>{hy||(hy=!0,t(Am).toSelf().inSingletonScope(),t(lv).to(Am).inSingletonScope(),t(sv).toService(lv),t(Ff).toSelf(),t(Df).toSelf(),t(ag).toService(Ff),t(ag).toService(Df),t(ag).toService(bf),po(t,ag))}));let dy=!1;const uy=new La((t=>{dy||(dy=!0,t(om).toSelf().inSingletonScope(),t(d_).toSelf().inSingletonScope(),t(rv).to(om).inSingletonScope(),t(sv).toService(rv))}));let py=!1;const gy=new La((t=>{py||(py=!0,t(gm).toSelf().inSingletonScope(),t(ev).to(gm).inSingletonScope(),t(sv).toService(ev),t(tg).toService(bf),po(t,tg),t(p_).toSelf().inSingletonScope())}));let fy=!1;const my=new La((t=>{fy||(fy=!0,t(Cm).toSelf().inSingletonScope(),t(hv).to(Cm).inSingletonScope(),t(sv).toService(hv),t(og).toService(bf),po(t,og))}));let vy=!1;const _y=new La((t=>{vy||(vy=!0,t(im).toSelf().inSingletonScope(),t(iv).to(im).inSingletonScope(),t(sv).toService(iv),t(eg).toService(bf),po(t,eg))}));let yy=!1;const by=new La((t=>{yy||(yy=!0,t(cv).to(Im).inSingletonScope(),t(sv).toService(cv),t(lg).toService(bf),po(t,lg))}));let xy=!1;const Sy=new La((t=>{xy||(xy=!0,t(bm).toSelf().inSingletonScope(),t(av).to(bm).inSingletonScope(),t(sv).toService(av),t(ng).toService(bf),po(t,ng))}));let ky=!1;const Ay=new La((t=>{ky||(ky=!0,t(ov).to(Wm).inSingletonScope(),t(sv).toService(ov),t(rg).toService(bf),po(t,rg))}));var My=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 wy=class{constructor(){this.numberType=Ru}reInit(){}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=Ec(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};wy=My([$a()],wy);let Ty=!1;const Cy=new La((t=>{Ty||(Ty=!0,t(uv).to(wy).inSingletonScope(),t(sv).toService(uv))}));var By=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)};let Py=class extends $f{constructor(){super(),this.numberType=ju,this.builtinContributions=[Em],this.init()}drawShape(t,e,i,s,n){const r=Ec(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=Yp(o,l,!0),d=Yp(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),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=Ec(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:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),Of(e,i-t,s-n,v,_,f,!0)),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=Ec(t).richtext;this._draw(t,s,!1,i)}};Py=By([$a(),Ey("design:paramtypes",[])],Py);let Ry=!1;const Oy=new La((t=>{Ry||(Ry=!0,t(dv).to(Py).inSingletonScope(),t(sv).toService(dv))}));let Iy=!1;const Ly=new La((t=>{Iy||(Iy=!0,t(pv).to(Jm).inSingletonScope(),t(sv).toService(pv),t(sg).toService(bf),po(t,sg))}));function Dy(t){const e=[];for(let i=0;i=0&&n>=0&&srt.getInstance().info(`[VChart log]: ${t}`,...e),jy=(t,e)=>(c(Vy.warnHandler)&&Vy.warnHandler.call(null,t,e),e?rt.getInstance().warn(`[VChart warn]: ${t}`,e):rt.getInstance().warn(`[VChart warn]: ${t}`)),Hy=(t,e,i)=>{if(!c(Vy.errorHandler))throw new Error(t);Vy.errorHandler.call(null,t,e)},Vy={silent:!1,warnHandler:!1,errorHandler:!1},Ny=O_(),Wy=Ny&&globalThis?globalThis.document:void 0;function Uy(t){return("desktop-browser"===t||"mobile-browser"===t)&&Ny}function Gy(t){return Yy(t)||"mobile-browser"===t}function Yy(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let Xy=0;function $y(){return Xy>=9999999&&(Xy=0),Xy++}function Ky(t){return null!=t&&""!==t&&(!!x(t)||+t==+t)}function qy(t){return!(!t||0===t.length)&&(!d(t[0])&&!d(t[0].dataId)&&_(t[0].fields))}const Zy=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Jy extends Ep{constructor(t,e){super(t),this._skipRenderAttributes=Zy,(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,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);f(this.attribute[t])&&f(e)&&!c(this.attribute[t])&&!c(e)?z(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.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,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.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){d(e)&&(e=Object.keys(t));for(let i=0;i{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"},wb=(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 Tb extends o{constructor(t,e={}){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.startTime=zc.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.pressTimeout=null}),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=zc.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||Mb(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=wb(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=zc.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=wb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=Mb(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&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("pointerleave",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("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=zc.now()-i>this.config.press.time&&wb(s[0],t){xo.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;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){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){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},Bb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Eb=[0,0,0];let Pb=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t: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(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},Yl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},$l),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Kl),{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 Ne(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ne(1,0,0,1,0,0),this._clearMatrix=new Ne(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&rt.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ne(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&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 Qu.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&&(Qu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(Qu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){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,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=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(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){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-=Ht;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(f,-2*y),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&&yp.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&&(Zu(Eb,[t,e,i],this.modelMatrix),t=Eb[0],e=Eb[1],i=Eb[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&&(Zu(Eb,[t,e,i],this.modelMatrix),t=Eb[0],e=Eb[1],i=Eb[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Zu(Eb,[e,i,s],this.modelMatrix),e=Eb[0],i=Eb[1],s=Eb[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,e=xo.global.measureTextMethod){var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=xo.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Kl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Kl.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&&(Zu(Eb,[e,i,s],this.modelMatrix),e=Eb[0],i=Eb[1],s=Eb[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=vh(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:mh(this,a,this.dpr),r.strokeStyle=vh(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=Ie(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?this.font=t.font:this.font=Ie(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(t=!0,e=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(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Qu.free(t))),this.stack.length=0}};Pb.env="browser",Pb=Cb([$a(),Bb("design:paramtypes",[Object,Number])],Pb);var Rb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ob=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ib=class extends op{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=xo.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new Pb(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 Lb(t,e){return new La((i=>{i(Ih).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Lh).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Ib.env="browser",Ib=Rb([$a(),Ob("design:paramtypes",[Object])],Ib);const Db=Lb(Ib,Pb);var Fb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jb=function(t,e){return function(i,s){e(i,s,t)}};let Hb=class extends Y_{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,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=dc.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 Nb=class{constructor(){this.type="group",this.numberType=Ou}contains(t,e,i){return!1}};Nb=Vb([$a()],Nb);const Wb=new La(((t,e,i,s)=>{Wb.__vloaded||(Wb.__vloaded=!0,t(kb).to(Nb).inSingletonScope(),t(Ab).toService(kb),po(t,Ab))}));Wb.__vloaded=!1;var Ub=Wb;const Gb=new La(((t,e,i,s)=>{i(Hb)||t(Hb).toSelf().inSingletonScope(),i(Pv)?s(Pv).toService(Hb):t(Pv).toService(Hb)}));var Yb,Xb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$b=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Kb=Yb=class extends N_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Yb.idprefix}_${Yb.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=xo.global,this.viewBox=new He,this.modelMatrix=new Ne(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:Yb.GenerateCanvasId(),canvasControled:!0};this.canvas=new Ib(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 Ib({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)}};Kb.env="browser",Kb.idprefix="visactor_window",Kb.prefix_count=0,Kb=Yb=Xb([$a(),$b("design:paramtypes",[])],Kb);const qb=new La((t=>{t(Kb).toSelf(),t(fc).toDynamicValue((t=>t.container.get(Kb))).whenTargetNamed(Kb.env)}));var Zb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qb=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 tx{get x1(){return this.dom.getBoundingClientRect().left}get x2(){return this.dom.getBoundingClientRect().right}get y1(){return this.dom.getBoundingClientRect().top}get y2(){return this.dom.getBoundingClientRect().bottom}get width(){return this.dom.getBoundingClientRect().width}get height(){return this.dom.getBoundingClientRect().height}constructor(t){this.dom=t}}function ex(t,e=!1){const i=document.createElement("img");if(xo.global.isImageAnonymous&&(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 ix=class extends j_{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 tx(t)}return new He}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(v(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=v(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return ex(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return ex(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const s=document.createElement("canvas");t.id&&(s.id=null!==(e=t.id)&&void 0!==e?e:Ia.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(...t){}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}}loadFont(t,e,i){return Qb(this,void 0,void 0,(function*(){return new FontFace(t,v(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}};ix=Zb([$a(),Jb("design:paramtypes",[])],ix);const sx=new La((t=>{sx.isBrowserBound||(sx.isBrowserBound=!0,t(ix).toSelf().inSingletonScope(),t(vo).toService(ix))}));function nx(t,e=!0){nx.__loaded||(nx.__loaded=!0,t.load(sx),t.load(Db),t.load(qb),e&&function(t){t.load(Ub),t.load(Gb)}(t))}sx.isBrowserBound=!1,nx.__loaded=!1;var rx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},ox=function(t,e){return function(i,s){e(i,s,t)}};let lx=class extends Y_{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,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 rp(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}};lx=rx([$a(),ox(0,Ya(co)),ox(0,Ka(Qy)),ox(1,Ya(co)),ox(1,Ka(Ov)),ox(2,Ya(co)),ox(2,Ka(Iv)),ax("design:paramtypes",[Object,Object,Object])],lx);const hx=new La((t=>{hx.__vloaded||(hx.__vloaded=!0,po(t,Qy))}));hx.__vloaded=!1;var cx=hx;class dx{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();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,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:mh(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}var ux=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},px=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gx=function(t,e){return function(i,s){e(i,s,t)}};let fx=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Cu}};fx=ux([$a(),gx(0,Ya(tv)),px("design:paramtypes",[Object])],fx);let mx=!1;const vx=new La(((t,e,i,s)=>{mx||(mx=!0,t(tb).to(fx).inSingletonScope(),t(Qy).toService(tb))}));var _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)},bx=function(t,e){return function(i,s){e(i,s,t)}};let xx=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Eu}};xx=_x([$a(),bx(0,Ya(ev)),yx("design:paramtypes",[Object])],xx);let Sx=!1;const kx=new La(((t,e,i,s)=>{Sx||(Sx=!0,t(eb).to(xx).inSingletonScope(),t(Qy).toService(eb))}));var Ax=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wx=function(t,e){return function(i,s){e(i,s,t)}};let Tx=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Pu}};Tx=Ax([$a(),wx(0,Ya(iv)),Mx("design:paramtypes",[Object])],Tx);let Cx=!1;const Bx=new La(((t,e,i,s)=>{Cx||(Cx=!0,t(ib).to(Tx).inSingletonScope(),t(Qy).toService(ib))}));class Ex{constructor(){this.type="glyph",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=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}}var Px=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Ox=function(t,e){return function(i,s){e(i,s,t)}};let Ix=class extends Ex{constructor(t){super(),this.canvasRenderer=t}};Ix=Px([$a(),Ox(0,Ya(uv)),Rx("design:paramtypes",[Object])],Ix);let Lx=!1;const Dx=new La(((t,e,i,s)=>{Lx||(Lx=!0,t(cb).to(Ix).inSingletonScope(),t(Ix).toService(cb))}));var Fx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 zx=class{constructor(){this.type="image",this.numberType=Iu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};zx=Fx([$a()],zx);let jx=!1;const Hx=new La(((t,e,i,s)=>{jx||(jx=!0,t(sb).to(zx).inSingletonScope(),t(zx).toService(sb))}));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)},Wx=function(t,e){return function(i,s){e(i,s,t)}};let Ux=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Lu}};Ux=Vx([$a(),Wx(0,Ya(rv)),Nx("design:paramtypes",[Object])],Ux);let Gx=!1;const Yx=new La(((t,e,i,s)=>{Gx||(Gx=!0,t(nb).to(Ux).inSingletonScope(),t(Qy).toService(nb))}));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},$x=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kx=function(t,e){return function(i,s){e(i,s,t)}};let qx=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Fu}};qx=Xx([$a(),Kx(0,Ya(ov)),$x("design:paramtypes",[Object])],qx);let Zx=!1;const Jx=new La(((t,e,i,s)=>{Zx||(Zx=!0,t(hb).to(qx).inSingletonScope(),t(Qy).toService(hb))}));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 extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Du}};iS=Qx([$a(),eS(0,Ya(av)),tS("design:paramtypes",[Object])],iS);let sS=!1;const nS=new La(((t,e,i,s)=>{sS||(sS=!0,t(rb).to(iS).inSingletonScope(),t(Qy).toService(rb))})),rS=new He;class aS{constructor(){this.type="rect",this.numberType=zu}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=t.getGraphicTheme(),{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||x(r,!0)&&0!==r||_(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,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:mh(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;rS.setValue(i.x1,i.y1,i.x2,i.y2),rS.expand(-r/2),h=!rS.containsPoint(e)}}return s.highPerformanceRestore(),h}}var oS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hS=function(t,e){return function(i,s){e(i,s,t)}};let cS=class extends aS{constructor(t){super(),this.canvasRenderer=t}};cS=oS([$a(),hS(0,Ya(lv)),lS("design:paramtypes",[Object])],cS);let dS=!1;const uS=new La(((t,e,i,s)=>{dS||(dS=!0,t(ab).to(cS).inSingletonScope(),t(Qy).toService(ab))}));let pS=!1;const gS=new La(((t,e,i,s)=>{pS||(pS=!0,t(sb).to(zx).inSingletonScope(),t(zx).toService(sb))}));var fS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mS=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 extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Hu}};_S=fS([$a(),vS(0,Ya(hv)),mS("design:paramtypes",[Object])],_S);let yS=!1;const bS=new La(((t,e,i,s)=>{yS||(yS=!0,t(ob).to(_S).inSingletonScope(),t(Qy).toService(ob))}));var xS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let SS=class{constructor(){this.type="text",this.numberType=Vu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};SS=xS([$a()],SS);let kS=!1;const AS=new La(((t,e,i,s)=>{kS||(kS=!0,t(lb).to(SS).inSingletonScope(),t(Qy).toService(lb))})),MS=new La(((t,e,i,s)=>{i(lx)||t(lx).toSelf().inSingletonScope(),i(Pv)?s(Pv).toService(lx):t(Pv).toService(lx)}));class wS{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 TS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)};let BS=class extends Pb{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 Ne(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};BS.env="node",BS=TS([$a(),CS("design:paramtypes",[Object,Number])],BS);var ES=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},PS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let RS=class extends op{constructor(t){super(t)}init(){this._context=new BS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&c(this._nativeCanvas.release)&&this._nativeCanvas.release()}};RS.env="node",RS=ES([$a(),PS("design:paramtypes",[Object])],RS);const OS=Lb(RS,BS);var IS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},LS=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 FS=class extends N_{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:Ia.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new RS(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new RS({width:n,height:r,dpr:s,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}getImageBuffer(t="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){}};FS.env="node",FS=IS([$a(),DS(0,Ya(_o)),LS("design:paramtypes",[Object])],FS);const zS=new La((t=>{t(FS).toSelf(),t(fc).toDynamicValue((t=>t.container.get(FS))).whenTargetNamed(FS.env)}));var jS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let HS=class extends j_{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 sd.call(t)}}getCancelAnimationFrame(){return t=>{sd.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};HS=jS([$a()],HS);const VS=new La((t=>{VS.isNodeBound||(VS.isNodeBound=!0,t(HS).toSelf().inSingletonScope(),t(vo).toService(HS))}));function NS(t,e=!0){NS.__loaded||(NS.__loaded=!0,t.load(VS),t.load(OS),t.load(zS))}VS.isNodeBound=!1,NS.__loaded=!1;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};let US=class extends Pb{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}setLineDash(t){const e=arguments,i=this.nativeContext;if(this.nativeContext.setLineDash){const t=e[0];if(0===t[0]&&0===t[1])return;t&&i.setLineDash(t)}}_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,keepStrokeScale:g=n.keepStrokeScale,lineDashOffset:f=n.lineDashOffset}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,r.lineWidth=g?l:mh(this,l,this.dpr),r.strokeStyle=vh(this,h,t,i,s),r.lineJoin=c,0===d[0]&&0===d[1]||(d&&r.setLineDash(d),r.lineDashOffset=f),r.lineCap=u,r.miterLimit=p}}measureText(t,e=xo.global.measureTextMethod){return this.setTransform(1,0,0,1,0,0,!0,xo.global.devicePixelRatio),super.measureText(t,e)}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;let r="";r=t.font?t.font:Ie(t,e,n&&this.camera&&this.camera.getProjectionScale(i)),s.font=(r||"").replace("px","vp");const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes);let a="";a=t.font?t.font:Ie(t,e,this.camera&&this.camera.getProjectionScale(i)),r.font=(a||"").replace("px","vp");const{fontFamily:o=e.fontFamily,fontSize:l=e.fontSize}=t;this.fontFamily=o,this.fontSize=l,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}createPattern(t,e){return null}drawImage(){const t=this.nativeContext,e=arguments;e[0].drawImage&&(e[0]=e[0].transferToImageBitmap()),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])}draw(){}};US.env="harmony",US=WS([$a()],US);var GS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},YS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let XS=class extends op{constructor(t){super(t)}init(){this._context=new US(this,this._dpr)}resize(t,e){}release(...t){}};XS.env="harmony",XS=GS([$a(),YS("design:paramtypes",[Object])],XS);var $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},KS=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)}};class ZS{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 JS=class extends N_{get container(){return null}constructor(t){super(),this.global=t,this.type="harmony",this.eventManager=new ZS}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{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:Ia.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new XS(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}this.canvas=new XS({width:i,height:s,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}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){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()}};JS.env="harmony",JS=$S([$a(),qS(0,Ya(_o)),KS("design:paramtypes",[Object])],JS);const QS=new La((t=>{t(JS).toSelf(),t(fc).toDynamicValue((t=>t.container.get(JS))).whenTargetNamed(JS.env)})),tk=Lb(XS,US);var ek=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ik=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let sk=class extends j_{constructor(){super(),this.type="harmony",this.supportEvent=!0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0,this.rafSTO=new id(0)}configure(t,e){t.env===this.type&&t.setActiveEnvContribution(this)}getDynamicCanvasCount(){return 9999}getStaticCanvasCount(){return 9999}loadImage(t){}loadSvg(t){return Promise.reject()}createCanvas(t){return function(t,e,i){const s=new OffscreenCanvas(t,e),n=s.getContext("2d");return new wS({width:t,height:e,context:n,_c:s,getBoundingClientRect:()=>({width:t,height:e}),getContext:()=>n},n,1,t,e,i)}(t.width,t.height,t.id)}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return t=>this.rafSTO.call(t)}getCancelAnimationFrame(){return t=>{this.rafSTO.clear(t)}}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return null}getRootElement(){return null}getDocument(){return null}release(...t){}};sk=ek([$a(),ik("design:paramtypes",[])],sk);const nk=new La((t=>{nk.isHarmonyBound||(nk.isHarmonyBound=!0,t(sk).toSelf().inSingletonScope(),t(vo).toService(sk))}));function rk(t,e=!0){rk.__loaded||(rk.__loaded=!0,t.load(nk),t.load(tk),t.load(QS),e&&function(t){t.load(cx),t.load(MS),t.load(vx),t.load(kx),t.load(Bx),t.load(Dx),t.load(Hx),t.load(Yx),t.load(Jx),t.load(nS),t.load(uS),t.load(gS),t.load(bS),t.load(AS)}(t))}nk.isHarmonyBound=!1,rk.__loaded=!1;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 extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Cu}};hk=ak([$a(),lk(0,Ya(tv)),ok("design:paramtypes",[Object])],hk);let ck=!1;const dk=new La(((t,e,i,s)=>{ck||(ck=!0,t(db).to(hk).inSingletonScope(),t(Ab).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 fk=class extends aS{constructor(t){super(),this.canvasRenderer=t}};fk=uk([$a(),gk(0,Ya(lv)),pk("design:paramtypes",[Object])],fk);let mk=!1;const vk=new La(((t,e,i,s)=>{mk||(mk=!0,t(vb).to(fk).inSingletonScope(),t(Ab).toService(vb))}));class _k extends $f{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=t.getGraphicTheme(),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,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:mh(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&tp.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var yk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xk=function(t,e){return function(i,s){e(i,s,t)}};let Sk=class extends _k{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Lu}};Sk=yk([$a(),xk(0,Ya(rv)),bk("design:paramtypes",[Object])],Sk);let kk=!1;const Ak=new La(((t,e,i,s)=>{kk||(kk=!0,t(fb).to(Sk).inSingletonScope(),t(Ab).toService(fb))}));var Mk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wk=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 Ck=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Eu}};Ck=Mk([$a(),Tk(0,Ya(ev)),wk("design:paramtypes",[Object])],Ck);let Bk=!1;const Ek=new La(((t,e,i,s)=>{Bk||(Bk=!0,t(ub).to(Ck).inSingletonScope(),t(Ab).toService(ub))}));class Pk extends $f{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();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,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&tp.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var Rk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Ik=function(t,e){return function(i,s){e(i,s,t)}};let Lk=class extends Pk{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Hu}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=t.getGraphicTheme(),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,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:mh(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&tp.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};Lk=Rk([$a(),Ik(0,Ya(hv)),Ok("design:paramtypes",[Object])],Lk);let Dk=!1;const Fk=new La(((t,e,i,s)=>{Dk||(Dk=!0,t(_b).to(Lk).inSingletonScope(),t(Ab).toService(_b))}));var zk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hk=function(t,e){return function(i,s){e(i,s,t)}};let Vk=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Pu}};Vk=zk([$a(),Hk(0,Ya(iv)),jk("design:paramtypes",[Object])],Vk);let Nk=!1;const Wk=new La(((t,e,i,s)=>{Nk||(Nk=!0,t(pb).to(Vk).inSingletonScope(),t(Ab).toService(pb))}));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},Gk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Yk=function(t,e){return function(i,s){e(i,s,t)}};let Xk=class extends Pk{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=t.getGraphicTheme(),{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(),f=l.width(),m=dg(a,u,n),v=cg(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,s.modelMatrix!==u&&tp.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};Xk=Uk([$a(),Yk(0,Ya(cv)),Gk("design:paramtypes",[Object])],Xk);let $k=!1;const Kk=new La(((t,e,i,s)=>{$k||($k=!0,t(yb).to(Xk).inSingletonScope(),t(Ab).toService(yb))}));var qk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zk=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 Qk=class extends _k{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Du}};Qk=qk([$a(),Jk(0,Ya(av)),Zk("design:paramtypes",[Object])],Qk);let tA=!1;const eA=new La(((t,e,i,s)=>{tA||(tA=!0,t(mb).to(Qk).inSingletonScope(),t(Ab).toService(mb))}));var iA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},nA=function(t,e){return function(i,s){e(i,s,t)}};let rA=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=Fu}};rA=iA([$a(),nA(0,Ya(ov)),sA("design:paramtypes",[Object])],rA);let aA=!1;const oA=new La(((t,e,i,s)=>{aA||(aA=!0,t(bb).to(rA).inSingletonScope(),t(Ab).toService(bb))}));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},hA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cA=function(t,e){return function(i,s){e(i,s,t)}};let dA=class extends Ex{constructor(t){super(),this.canvasRenderer=t}};dA=lA([$a(),cA(0,Ya(uv)),hA("design:paramtypes",[Object])],dA);let uA=!1;const pA=new La(((t,e,i,s)=>{uA||(uA=!0,t(Sb).to(dA).inSingletonScope(),t(Ab).toService(Sb))}));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},fA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mA=function(t,e){return function(i,s){e(i,s,t)}};let vA=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=ju}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};vA=gA([$a(),mA(0,Ya(dv)),fA("design:paramtypes",[Object])],vA);let _A=!1;const yA=new La(((t,e,i,s)=>{_A||(_A=!0,t(xb).to(vA).inSingletonScope(),t(Ab).toService(xb))}));var bA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},SA=function(t,e){return function(i,s){e(i,s,t)}};let kA=class extends dx{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=Iu}};kA=bA([$a(),SA(0,Ya(pv)),xA("design:paramtypes",[Object])],kA);let AA=!1;const MA=new La(((t,e,i,s)=>{AA||(AA=!0,t(gb).to(kA).inSingletonScope(),t(Ab).toService(gb))})),wA=O_();function TA(){TA.__loaded||(TA.__loaded=!0,df.RegisterGraphicCreator("arc",rf),yo.load(ly),yo.load(wA?dk:vx))}TA.__loaded=!1;const CA=TA;function BA(){BA.__loaded||(BA.__loaded=!0,df.RegisterGraphicCreator("area",ef),yo.load(gy),yo.load(wA?Ek:kx))}BA.__loaded=!1;const EA=BA;function PA(){PA.__loaded||(PA.__loaded=!0,df.RegisterGraphicCreator("circle",bg),yo.load(_y),yo.load(wA?Wk:Bx))}PA.__loaded=!1;const RA=PA;function OA(){OA.__loaded||(OA.__loaded=!0,df.RegisterGraphicCreator("glyph",Dg),yo.load(Cy),yo.load(wA?pA:Dx))}OA.__loaded=!1;const IA=OA;function LA(){LA.__loaded||(LA.__loaded=!0,df.RegisterGraphicCreator("group",Pp))}LA.__loaded=!1;const DA=LA;function FA(){FA.__loaded||(FA.__loaded=!0,df.RegisterGraphicCreator("image",Ng),yo.load(Ly),yo.load(wA?MA:Hx))}FA.__loaded=!1;const zA=FA;function jA(){jA.__loaded||(jA.__loaded=!0,df.RegisterGraphicCreator("line",Eg),yo.load(uy),yo.load(wA?Ak:Yx))}jA.__loaded=!1;const HA=jA;function VA(){VA.__loaded||(VA.__loaded=!0,df.RegisterGraphicCreator("path",Jg),yo.load(Sy),yo.load(wA?eA:nS))}VA.__loaded=!1;const NA=VA;function WA(){WA.__loaded||(WA.__loaded=!0,df.RegisterGraphicCreator("polygon",lf),yo.load(Ay),yo.load(wA?oA:Jx))}WA.__loaded=!1;const UA=WA;function GA(){GA.__loaded||(GA.__loaded=!0,df.RegisterGraphicCreator("rect",Ig),yo.load(cy),yo.load(wA?vk:uS))}GA.__loaded=!1;const YA=GA;function XA(){XA.__loaded||(XA.__loaded=!0,df.RegisterGraphicCreator("richtext",Kg),yo.load(Oy),yo.load(wA?yA:gS))}XA.__loaded=!1;const $A=XA;function KA(){KA.__loaded||(KA.__loaded=!0,df.RegisterGraphicCreator("shadowRoot",cf))}KA.__loaded=!1;const qA=KA;function ZA(){ZA.__loaded||(ZA.__loaded=!0,df.RegisterGraphicCreator("symbol",Tg),yo.load(my),yo.load(wA?Fk:bS))}ZA.__loaded=!1;const JA=ZA;function QA(){QA.__loaded||(QA.__loaded=!0,df.RegisterGraphicCreator("text",Ag),yo.load(by),yo.load(wA?Kk:AS))}QA.__loaded=!1;const tM=QA;function eM(){DA(),YA()}const iM=-.5*Math.PI,sM=1.5*Math.PI,nM="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 rM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(rM||(rM={}));const aM={[rM.selectedReverse]:{},[rM.selected]:{},[rM.hover]:{},[rM.hoverReverse]:{}},oM={container:"",width:30,height:30,style:{}},lM="scrollDrag";function hM(){return"browser"===S_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const cM={debounce:bt,throttle:xt};eM();let dM=class t extends Jy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{u(this._prePos)&&t.preventDefault()},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=mt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=mt(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=>{this._clearDragEvents();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});const r=hM(),a="browser"===S_.env?S_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=mt(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},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=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:vt(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){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(lM,{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),("browser"===S_.env?S_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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:ni(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,[s,n,r,a]=ni(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,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=mt(t[0],0,1),c=mt(t[1],0,1),d=mt(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_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)}_clearDragEvents(){const t=hM(),e="browser"===S_.env?S_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===S_.env?S_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};dM.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,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};var uM,pM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 gM=uM=class{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new je).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Vt(t.deltaX)>Vt(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new He,e.addEventListener("wheel",this.scroll),this.params=uM.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(lM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new dM(v),h.name=a,e.add(h),h.isScrollBar=!0);const _=this.childrenBounds,{scrollX:y,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/_.width(),1),e=Math.max(Math.min(y/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/_.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=i{i(gM)||(t(gM).toSelf(),t(Nv).toService(gM))}));function mM(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&mM(t,e)}))}const vM=t=>!d(t)&&!1!==t.visible;function _M(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function yM(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 xM=["#ffffff","#000000"];function SM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ti(t).toHex(),o=new ti(e).toHex();return kM(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(...xM);for(const n of a)if(t!==n&&kM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function kM(t,e,i,s,n){if("lightness"===n){const i=ti.getColorBrightness(new ti(e));return ti.getColorBrightness(new ti(t))<.5?i>=.5:i<.5}return s?AM(t,e)>s:"largeText"===i?AM(t,e)>3:AM(t,e)>4.5}function AM(t,e){const i=MM(t),s=MM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function MM(t){const e=ii(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function wM(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function TM(t,e){return[t[0]*e,t[1]*e]}function CM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function BM(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=Zt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const EM=(t,e,i,s)=>new Le(Object.assign({defaultFontParams:Object.assign({fontFamily:nM,fontSize:14},s),getTextBounds:i?void 0:gf,specialCharSet:"-/: .,@%'\"~"+Le.ALPHABET_CHAR_SET+Le.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function PM(t,e,i={}){if(!t)return{width:0,height:0};const s=gf({text:t,fontFamily:e.fontFamily||i.fontFamily||nM,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 RM(t,e="type"){var i,s;return p(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 OM(t){var e,i;return u(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function IM(t,e="type"){const i=RM(t,e);return"rich"===i?df.richtext(OM(t)):("html"===i?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"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),df.text(t))}function LM(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 DM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function FM(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 zM(t,e){const{dx:i,dy:s}=FM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function jM(){DA(),YA(),JA(),$A(),tM()}var HM=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);nc&&(w=c,O.setAttribute("maxLineWidth",c-b[1]-b[2]))),A=0,M=0;let H=0;"left"===z||"start"===z?H=1:"right"===z||"end"===z?H=-1:"center"===z&&(H=0),H?H<0?(A-=w,k&&k.setAttribute("x",(k.attribute.x||0)-I),S.setAttribute("x",-b[1]-B)):H>0&&S.setAttribute("x",b[3]):(A-=w/2,k&&k.setAttribute("x",(k.attribute.x||0)-I/2),S.setAttribute("x",-B/2));const V="right"===y||"end"===y,N="left"===y||"start"===y,W=(t,e)=>{"richtext"===O.type?O.setAttributes({x:t,textAlign:e,textConfig:G(O.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):O.setAttributes({x:t,textAlign:e})};if((y?"center"===y:_)&&H){const t=w-b[1]-b[3],e=I+B,i=1===H?(t-e)/2+B+I/2:b[0]+B-(w/2+e/2-B)+I/2;if(W(i,"center"),k){const t=i-I/2-B+F/2;k.setAttributes({x:t})}}if(N&&1!==H){const t=w-b[1]-b[3],e=0===H?-t/2+B/2:-w+b[3]+b[1]+B;if(W(e+B,"left"),k){const t=e+F/2;k.setAttributes({x:t})}}if(V&&-1!==H){const t=w-b[1]-b[3],e=0===H?t/2+B/2:t;if(W(e,"right"),k){const t=e-I-B+F/2;k.setAttributes({x:t})}}"middle"===j?(M-=T/2,k&&k.setAttribute("y",0)):"bottom"===j?(M-=T,k&&k.setAttribute("y",-L/2),S.setAttribute("y",-b[2])):"top"===j&&(S.setAttribute("y",b[0]),k&&k.setAttribute("y",L/2)),E(null==m?void 0:m.text)||(O.states=m.text);const{visible:U}=a,Y=HM(a,["visible"]);if(f&&h(U)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},Y),{visible:U&&!!s,width:w,height:T,x:A,y:M}),"rect");if(E(null==m?void 0:m.panel)||(t.states=m.panel),Y.customShape){const e=Y.customShape;t.pathProxy=t=>e(this,t,new Nl)}this._bgRect=t}this._textShape=O,this._symbol=k,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:z({},VM.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}VM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const NM={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}},WM={poptip:z({},NM)};var UM=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);nk?q=k:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(_(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),L.setAttribute("x",L.attribute.x+e),o.setAttribute("dx",Gt(Ut(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),L.setAttribute("y",L.attribute.y+e),o.setAttribute("dy",Gt(Ut(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?Ft/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:Ft/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?Ft/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?Ft/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:Ft/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?Ft/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?Ft:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:Ft,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?Ft:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}ZM.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"},panel:{},maxWidthPercent:.8,space:8,padding:10};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};let QM=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};z(s,ZM.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new ZM(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};z(e,WM.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,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),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}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}};QM=JM([$a()],QM);var tw=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 ew{constructor(){this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(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)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}let iw=class extends ew{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};iw=tw([$a()],iw);let sw=class extends ew{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}};sw=tw([$a()],sw);const nw=new La(((t,e,i,s)=>{i(QM)||(t(QM).toSelf().inSingletonScope(),t(hg).toService(QM)),i(iw)||(t(iw).toSelf(),t(Nv).toService(iw)),i(sw)||(t(sw).toSelf(),t(Nv).toService(sw))}));class rw extends Jy{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}DA(),HA();class aw extends rw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},aw.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})}}aw.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},DA(),YA();class ow extends rw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ow.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})}}ow.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},DA(),CA();class lw extends rw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},lw.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=ne.distancePP(t,e);this.setAttribute("radius",i)}}lw.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},DA(),CA();class hw extends rw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},hw.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=iM,endAngle:s=sM}=this.attribute,n=s-i,r=ae(ce(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}hw.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},DA(),NA();class cw extends rw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},cw.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=le(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=ne.distancePP(t,e);this.setAttribute("radius",i)}}function dw(){DA(),HA(),UA(),JA()}function uw(){DA(),HA(),CA(),JA()}cw.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},dw();class pw extends Jy{getStartAngle(){return de(this._startAngle)}getEndAngle(){return de(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},pw.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(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 n,r;const a=df.line(Object.assign(Object.assign({points:t},_(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),E(null==s?void 0:s.line)||(a.states=_(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=df.line;G(i)[0].cornerRadius&&(t=df.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},G(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),E(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:f=12}=t;let m,v;"start"===i?(m={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)):(m={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=df.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),E(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?E(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):E(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]:Z(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}}pw.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}}},uw();class gw extends pw{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},pw.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=df.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"),E(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var fw,mw;!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.labelHoverOnAxis="axis-label-hover-on-axis",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",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(fw||(fw={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(mw||(mw={}));const vw={[mw.selectedReverse]:{},[mw.selected]:{},[mw.hover]:{},[mw.hoverReverse]:{}},_w={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}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},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}}},yw={size:8,stroke:"#000",lineWidth:1,zIndex:1};const bw=Math.sin(Math.PI/10);function xw(t,e=bw){const i=!d(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function Sw(t,e=bw){const i=!d(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function kw(t){const e={};return mM(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function Aw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function Mw(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return TM(r,(s?-1:1)*(n?-1:1)*t/CM(r))}function ww(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function Cw(t,e,i){var s;if(Sw(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>De(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>De(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>Fe(n,r)}function Bw(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!E(s.states)?(s.addState(rM.hover,!0),mM(e,(t=>{t!==s&&t.name&&!E(t.states)&&t.addState(rM.hoverReverse,!0)})),s):i},Pw=(t,e,i)=>i?(mM(e,(t=>{t.name&&!E(t.states)&&(t.removeState(rM.hoverReverse),t.removeState(rM.hover))})),null):i,Rw=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(rM.selected)?(mM(e,(t=>{t.name&&!E(t.states)&&(t.removeState(rM.selectedReverse),t.removeState(rM.selected))})),null):s.name&&!E(s.states)?(s.addState(rM.selected,!0),mM(e,(t=>{t!==s&&t.name&&!E(t.states)&&t.addState(rM.selectedReverse,!0)})),s):i};class Ow extends Jy{_prepareAnimate(t){if(!1!==this.attribute.animation){const{animation:e,animationEnter:i,animationExit:s,animationUpdate:n}=this.attribute,r=p(e)?e:{};this._animationConfig={enter:!1!==i&&z({},t,r,null!=i?i:{}),exit:!1!==s&&z({},t,r,null!=s?s:{}),update:!1!==n&&(_(n)?n:z({},t,r,null!=n?n:{}))}}else this._animationConfig={enter:!1,exit:!1,update:!1}}}const Iw={type:"default",duration:300,easing:"linear"};class Lw extends Ow{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=Ew(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=Pw(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=Rw(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=df.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._prepare(),this._prevInnerView=this._innerView&&kw(this._innerView),this.removeAllChild(!0),this._innerView=df.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation()}_prepare(){this._prepareAnimate(Iw)}_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=df.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=fw.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=df.group({x:0,y:0,pickable:!1});t.name=fw.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",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=df.group({x:0,y:0,pickable:!1});i.name=fw.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=df.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=fw.tick,r.id=this._getNodeId(t.id),E(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=aM;else{const t=this.data[s],e=z({},aM,this.attribute.tick.state);Object.keys(e).forEach((i=>{c(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=df.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=fw.subTick,r.id=this._getNodeId(`${n}`),E(s.state))r.states=aM;else{const i=z({},aM,s.state);Object.keys(i).forEach((s=>{c(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&&c(s)&&(e=s(e,i));const n=this._transformItems(e),r=df.group({x:0,y:0,pickable:!1});return r.name=`${fw.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=IM(this._getLabelAttribute(t,e,n,i));if(a.name=fw.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),E(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=aM;else{const s=z({},aM,this.attribute.label.state);Object.keys(s).forEach((r=>{c(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new VM(Object.assign({},e));i.name=fw.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return Aw(t,this.getVerticalVector(e,i,t))}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&&c(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;Vt(s[0])>Vt(s[1])?o=Ft/2*(l.x>e.x?1:-1):h=Ft/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+P(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+P(this.attribute,"label.space",4))*s);const f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:_}=this.attribute.label;_=c(_)?z({},_w.label.style,_(t,e,i,s)):_;_=z(this.getLabelAlign(m,o,_.angle),_),c(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let y=_.react;return c(y)&&(y=y(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,_)),{text:null!=d?d:v,_originText:t.label,lineHeight:null==_?void 0:_.fontSize,type:h}),_),{react:y})}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}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},mM(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(e.setFinalAttributes(e.attribute),r){r.release();const i=r.attribute,a=e.getFinalAttribute(),o=function(t,e,i){const s={};for(const i in e)i in t&&N(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}(i,a);let l=Object.keys(o).length>0;if("opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l){this._newElementAttrMap[e.id]={state:"update",node:e,attrs:e.attribute};const i=r.attribute;e.setAttributes(i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}])}}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const Dw={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&&Cw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function Fw(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function zw(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=c(n)?n:Dw[n]||Dw.parity;if(s.length>=3&&Bw(s,r)){do{s=a(s,r)}while(s.length>=3&&Bw(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=Y(i);Cw(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),zw(l,s,n,(t=>Cw(t,l,r))),zw(h,s,o,(t=>Cw(t,h,r)||!(!n||t===l)&&Cw(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function Hw(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},Ww(t,e.attribute.angle)),{angle:Nw(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({},Uw(t,e.attribute.angle)),{angle:Nw(e.attribute.angle)}))}))}(t,e),function(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=Ae({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function Nw(t=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 Ww(t,e=0){let 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=Nw(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 Uw(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=Nw(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 Gw(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(E(t)||!k(i))return;const o=function(t){return k(t)?{left:t,right:t}:p(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!d(h),u=c?Math.cos(h):1,g=c?Math.sin(h):0,f=Sw(h),m=xw(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/g);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===_||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=g/u,l=Math.abs(i/g);if(y&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(u);r=Math.min(t,l)}else if(y&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(u);r=Math.min(t,l)}else r=l}else r=Math.abs(i/u);k(t.attribute.maxLineWidth)&&(r=k(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function Yw(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class Xw{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,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=CM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return TM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class $w{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-$w.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*$w.bounceIn(2*t):.5*$w.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ht*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ht/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Ht*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Ht/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Ht*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Ht/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Ht/e)*.5+1}}static registerFunc(t,e){$w[t]=e}}function Kw(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}$w.quadIn=$w.getPowIn(2),$w.quadOut=$w.getPowOut(2),$w.quadInOut=$w.getPowInOut(2),$w.cubicIn=$w.getPowIn(3),$w.cubicOut=$w.getPowOut(3),$w.cubicInOut=$w.getPowInOut(3),$w.quartIn=$w.getPowIn(4),$w.quartOut=$w.getPowOut(4),$w.quartInOut=$w.getPowInOut(4),$w.quintIn=$w.getPowIn(5),$w.quintOut=$w.getPowOut(5),$w.quintInOut=$w.getPowInOut(5),$w.backIn=$w.getBackIn(1.7),$w.backOut=$w.getBackOut(1.7),$w.backInOut=$w.getBackInOut(1.7),$w.elasticIn=$w.getElasticIn(1,.3),$w.elasticOut=$w.getElasticOut(1,.3),$w.elasticInOut=$w.getElasticInOut(1,.3*1.5),$w.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),$w.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},$w.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)$w[`flicker${t}`]=e=>Kw(e,t);for(let t=2;t<10;t++)$w[`aIn${t}`]=e=>t*e*e+(1-t)*e;function qw(t,e,i){return t+(e-t)*i}const Zw=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=qw(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=qw(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=qw(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=qw(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=qw(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=qw(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=qw(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=qw(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=qw(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=dp(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?pp(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=dp(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?pp(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=qw(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=qw(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=qw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=qw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=qw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=qw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=qw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=qw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=qw(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=qw(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=qw(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=qw(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=qw(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=qw(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=qw(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=qw(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=td(e,i,s),r.addUpdateBoundTag()}}};function Jw(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.setAttributes(this.target.attribute)},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=$w[s])&&void 0!==n?n:$w.linear:$w.linear,"wait"===t&&(this.onUpdate=Qw),this.id=Ia.GenAutoIncrementId(),this.syncAttributeUpdate=Qw}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(v(i)&&v(s)){const n=hp.Get(i,lp.Color255),r=hp.Get(s,lp.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(Zw["fill"===e?"fillPure":"strokePure"])}else Zw[e]?t.push(Zw[e]):t.push(Jw)}else Zw[e]?t.push(Zw[e]):t.push(Jw)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate;this.target.animates.forEach((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const i=e.getStartProps();this.propKeys.forEach((t=>{null!=i[t]&&e.preventAttr(t)}))}))}deleteSelfAttr(t){var e;delete this.props[t],this.fromProps&&delete this.fromProps[t];const i=this.propKeys.indexOf(t);-1!==i&&(this.propKeys.splice(i,1),null===(e=this.interpolateUpdateFunctions)||void 0===e||e.splice(i,1))}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){this.target.setAttributes(this.props),t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class eT extends tT{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();this.target.setAttributes(t)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class iT extends o{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Ia.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Oo.END?this.removeAnimate(t,!0):t.status!==Oo.RUNNING&&t.status!==Oo.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const sT=new iT;sT.isGlobal=!0;class nT{constructor(t=Ia.GenAutoIncrementId(),e=sT,i){this.id=t,this.status=Oo.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){return this.target=t,this.target.animates||(this.target.animates=new Map),this.target.animates.set(this.id,this),this.onRemove((()=>{this.stop(),this.target.animates.delete(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new tT(Ro.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new eT(Ro.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new tT(Ro.from,t,e,i);return this._firstStep?(this._lastStep.append(s),this._lastStep=s):(this._firstStep=s,this._lastStep=s),this.updateDuration(),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Oo.RUNNING&&(this.status=Oo.PAUSED)}resume(){this.status===Oo.PAUSED&&(this.status=Oo.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this._preventAttrs.add(t),delete this._startProps[t],delete this._endProps[t];let e=this._firstStep;for(;e;)e.deleteSelfAttr(t),e=e.next}preventAttrs(t){t.forEach((t=>this._preventAttrs.add(t)))}validAttr(t){return!this._preventAttrs.has(t)}runCb(t){var e;return null===(e=this._lastStep)||void 0===e||e.onEnd(t),this}startAt(t){return this._startTime=t,this}customInterpolate(t,e,i,s,n,r){return!1}getFromValue(){return this._startProps}getToValue(){return this._endProps}stop(t){let e=this._firstStep;for(;e;)e.stop(),e=e.next;this.status!==Oo.END&&this.onEnd(),this.status=Oo.END,this.target&&("start"===t?this.target.setAttributes(this._startProps):"end"===t?this.target.setAttributes(this._endProps):t&&this.target.setAttributes(t))}release(){this.status=Oo.END,this._onRemove&&this._onRemove.forEach((t=>t())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Oo.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),void(this.status=Oo.END);this.status=Oo.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&this.target.setAttributes(this._startProps);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const rT=new ko;class aT{constructor(){this.released=!1}tick(t,e){rT.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class oT extends o{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Po.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Po.INITIAL,xo.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),xo.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new aT;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Po.INITIAL&&(this.status=Po.PAUSE,!0)}resume(){return this.status!==Po.INITIAL&&(this.status=Po.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Po.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Po.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Po.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Po.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Po.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Po.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,xo.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}function dT(t){if(!t||!c(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1}return 2}cT.getInstance();class uT{static registerBuiltInAnimate(t,e){uT.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;_(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:uT.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=dT(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:uT.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=dT(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=k(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){Array.isArray(t)?t.forEach((t=>this._execute(t))):this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,d,u;const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:_=0,duration:y=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:k,priority:A=0,options:M,custom:w,customType:T,controlOptions:C}=t,B=e.animate();B.priority=A;const E=c(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],R=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&R&&(i=null!==(h=P[R])&&void 0!==h?h:i),B.startAt(b);const O=i*x+E;O>0&&B.wait(O);let I=null,L=t.to,D=t.from;L||(I||(I=this.createPropsFromChannel(g,e)),L=I.props),D||(I||(I=this.createPropsFromChannel(g,e)),D=I.from),I.attrOutChannel&&e.setAttributes(I.attrOutChannel),this._handleRunAnimate(B,w,T,D,L,y,m,f,C,M,p,e);let F=0;x&&(F=x*(s-i-1));const z=c(_)?_(null===(u=null===(d=e.context)||void 0===d?void 0:d.data)||void 0===u?void 0:u[0],e,{}):_;return z>0&&(F+=z),F>0&&B.wait(F),S&&S>0&&B.loop(S),k&&B.bounce(!0),B}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,d,u){var p,g,f,m,v,_,y,b;if(e&&i){i=dT(e);let d=this.resolveValue(o,u);"function"==typeof d&&(d=d(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),d=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},d);const x=c(h)?h.call(null,null!==(_=d&&(null===(v=d.data)||void 0===v?void 0:v[0]))&&void 0!==_?_:null===(b=null===(y=u.context)||void 0===y?void 0:y.data)||void 0===b?void 0:b[0],u,d):h;d.options=x,d.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,d):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,d)}else"to"===d?t.to(n,r,a):"from"===d&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:d=0,delayAfter:u=0}=t,p=c(d)?d(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):d,g=c(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;u||(d||(d=this.createPropsFromChannel(a,i)),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i)),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const g=null!==(n=t.custom)&&void 0!==n?n:uT.builtInAnimateMap[r],f=t.custom?t.customType:dT(g);this._handleRunAnimate(e,g,f,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e){var i;const s={};let n=null;if(!t)return{from:n,props:s,attrOutChannel:null};const r={};let a=!1;const o=null===(i=e.context)||void 0===i?void 0:i.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===o[e]||(t[e]={to:o[e]}),t)),{})),Object.keys(t).forEach((i=>{var r,a,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?s[i]=h.to(null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,{}):s[i]=h.to),void 0!==h.from&&(n||(n={}),"function"==typeof h.from?n[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):n[i]=h.from)})),o)for(const t in o){const e=o[t];void 0!==e&&(s.hasOwnProperty(t)||(r[t]=e,a=!0))}return{from:n,props:s,attrOutChannel:a?r:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}executeItem(t,e,i=0,s=1){return Array.isArray(t)?t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean):[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Oo.END),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}uT.builtInAnimateMap={};const pT="appear",gT="disappear",fT="update",mT="highlight",vT="unhighlight";class _T{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class yT{constructor(t){this.stateList=null,this.graphic=t}applyState(t,e,i){const s=cT.getInstance(),n=[],r=[];if(this.stateList&&this.stateList.length?t.forEach(((t,i)=>{const a={allowTransition:!0,stopOriginalTransition:!0};this.stateList.forEach((e=>{const i=s.isTransitionAllowed(e.state,t,this.graphic);a.allowTransition=a.allowTransition&&i.allowTransition})),a.allowTransition&&(r.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new uT(this.graphic)}),this.stateList.forEach((e=>{s.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&n.push(e)})))})):t.forEach(((t,i)=>{r.push({state:t,animationConfig:_(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new uT(this.graphic)})})),n.forEach((t=>{t.executor.stop(null,!1)})),r.length){r[0].executor.execute(r[0].animationConfig);for(let t=0;t{e&&e.executor.execute(e.animationConfig),this.stateList=this.stateList.filter((t=>t!==s)),t===r.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!n.includes(t))):this.stateList=[],this.stateList.push(...r)}applyAppearState(t,e){this.applyState([pT],[{name:pT,animation:t}],e)}applyDisappearState(t,e){this.applyState([gT],[{name:gT,animation:t}],e)}applyUpdateState(t,e){this.applyState([fT],[{name:fT,animation:t}],e)}applyHighlightState(t,e){this.applyState([mT],[{name:mT,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([vT],[{name:vT,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class bT{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new yT(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new _T(t)),t._animationStateStore}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return(new bT)._getAnimationStateManager(t),t}}class xT{getAttributes(t=!1){return t&&this.finalAttribute?this.finalAttribute:this.attribute}animate(t){var e,i,s;const n=new nT(null==t?void 0:t.id,null!==(i=null!==(e=null==t?void 0:t.timeline)&&void 0!==e?e:this.stage&&this.stage.getTimeline())&&void 0!==i?i:sT,null==t?void 0:t.slience);if(n.bind(this),t){const{onStart:e,onEnd:i,onRemove:s}=t;null!=e&&n.onStart(e),null!=i&&n.onEnd(i),null!=s&&n.onRemove(s)}return null===(s=this.stage)||void 0===s||s.ticker.start(),n}createTimeline(){return new iT}createTicker(t){return new oT(t)}setFinalAttributes(t){this.finalAttribute||(this.finalAttribute={}),Object.assign(this.finalAttribute,t)}initFinalAttributes(t){this.finalAttribute=t}initAnimateExecutor(){this._animateExecutor||(this._animateExecutor=new uT(this))}executeAnimation(t){return this.initAnimateExecutor(),this._animateExecutor.execute(t),this}executeAnimations(t){return this.initAnimateExecutor(),t.forEach((t=>{this._animateExecutor.execute(t)})),this}getFinalAttribute(){return this.finalAttribute}getGraphicAttribute(t,e=!1){return!e&&this.finalAttribute?this.finalAttribute[t]:this.attribute[t]}pauseAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function ST(){U(Cp,bT),U(Cp,xT)}class kT extends tT{constructor(t,e,i,s,n){super("customAnimate",e,i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class AT extends kT{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class MT extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0,this.checkStatusAfterRender=!0,this._beforeStageRender=()=>{if(!this.willCallBeforeStageRender)return;this.willCallBeforeStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.beforeStageRender(t,e);i&&this.renderToStage(t,i)},this._afterStageRender=()=>{if(!this.willCallAfterStageRender)return;this.willCallAfterStageRender=!1;const t=this.target.stage,e=t.window.getContext().canvas.nativeCanvas,i=this.afterStageRender(t,e);i&&this.renderToStage(t,i),this.checkStatusAfterRender&&this.animate.status===Oo.END&&this.animate.timeline.removeAnimate(this.animate)},this.props={}}beforeStageRender(t,e){return!1}afterStageRender(t,e){return!1}onFirstRun(){super.onFirstRun(),this.target.stage.setBeforeRender(this._beforeStageRender),this.target.stage.setAfterRender(this._afterStageRender),this.target.stage.disableDirtyBounds()}stop(){super.stop(),this.target.stage.removeBeforeRender(this._beforeStageRender),this.target.stage.removeAfterRender(this._afterStageRender)}onUpdate(t,e,i){super.onUpdate(t,e,i),this.willCallBeforeStageRender=!0,this.willCallAfterStageRender=!0}renderToStage(t,e){const i=t.window.getContext().canvas.nativeCanvas,s=i.getContext("2d");return!!s&&(s.clearRect(0,0,i.width,i.height),s.drawImage(e,0,0),i)}}class wT{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new uT(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttr(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function TT(t){return new wT(t)}class CT extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,this.target.setAttribute("text",n)}}const BT=1e3,ET="quadInOut",PT=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],RT=(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=dp(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},OT=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?Q_(t):[],n=Q_(e);i&&s&&(i.fromTransform&&ty(s,i.fromTransform.clone().getInverse()),ty(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})))},LT=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],DT=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!LT.includes(n))return;const r=e[n];if(!d(r)&&!d(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?hp.Get(t,lp.Color255):t;i.push({from:_(t[n])?t[n].map(e):e(t[n]),to:_(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class FT extends kT{constructor(t,e,i){super({},{},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;OT(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&RT(this.otherAttrs,i,e),this.target.setAttributes(i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const zT=(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=IT(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=DT(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new FT({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:BT,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:ET);return c.play(d),c};class jT extends kT{constructor(t,e,i){super({},{},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;OT(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&&RT(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const HT=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>PT.includes(t))(i)||(e[i]=t[i])})),e},VT=(t,e,i)=>{const s=HT(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),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=xo.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},NT=(t,e,i)=>{const s=[],n=i?null:HT(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:HT(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=Pg(t.attribute),n=iy(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(xo.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=iy(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(xo.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=iy(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(xo.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 sy(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 sy(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(xo.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:ny(i)}];const s=[];return ay(i,e,s),s})(t,e).forEach((t=>{s.push(xo.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&&x(t.x)&&x(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 ay(l,e,h),h})(t,e).forEach((t=>{s.push(xo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=Q_(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(xo.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(xo.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&VT(t,s,e),s};class UT extends kT{constructor(t,e,i,s,n){super(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(){super.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:$o.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:$o.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:$o.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class GT extends UT{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;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 k=0,A=0;"anticlockwise"===S?(A="in"===b?x+2*Math.PI:x,A=x+2*Math.PI):(k=x,A="out"===b?x+2*Math.PI:x);const M=xo.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!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:y/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(_+y)/2,innerRadius:0,startAngle:k,endAngle:A,fill:!0});let w,T;"anticlockwise"===S?(w={startAngle:x+2*Math.PI},T={startAngle:x}):(w={endAngle:x},T={endAngle:x+2*Math.PI}),super("in"===b?w:T,"in"===b?T:w,i,s,{group:null==n?void 0:n.group,clipGraphic:M})}}class YT extends UT{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:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=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=xo.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:f,height:"in"===v&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===y?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class XT extends kT{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){super.onBind();const{points:t,segments:e}=this.target.attribute,{points:i,segments:s}=this.target.getFinalAttribute();this.from={points:t,segments:e},this.to={points:i,segments:s},this.props=this.to;const n=this.getPoints(this.from),r=this.getPoints(this.to,!0);this.fromPoints=n?Array.isArray(n)?n:[n]:[],this.toPoints=r?Array.isArray(r)?r:[r]:[];const a=new Map;this.fromPoints.forEach((t=>{t.context&&a.set(t.context,t)}));let o,l,h=1/0,c=-1/0;for(let t=0;t=0;t-=1)if(a.has(this.toPoints[t].context)){c=t,l=a.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(c)?(this.clipRange=this.toPoints[c][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[c][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=mt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let d=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=a.get(t.context);return i?(d=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ec&&l?[l,t]:[d,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new se(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(t)return Object.keys(this.to).forEach((t=>{this.target.attribute[t]=this.to[t]})),this.target.addUpdatePositionTag(),void this.target.addUpdateShapeAndBoundsTag();if(this.points=this.points.map(((t,i)=>{const s=Qc(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));this.target.setAttributes({clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.target.attribute.segments=e}else this.target.attribute.points=this.points;this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class $T extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0}));const o=this.target.getFinalAttribute();o&&this.target.setAttributes(o),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(a)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class KT extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Object.assign(this.target.attribute,i),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class qT extends $T{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class ZT extends KT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}class JT extends $T{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"],this.from={opacity:0,fillOpacity:0,strokeOpacity:0}}}class QT extends KT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["opacity","fillOpacity","strokeOpacity"]}}const tC=(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.getFinalAttribute();if(e&&"anticlockwise"===e.orient){const t=x(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=x(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.getFinalAttribute();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)};class eC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this._updateFunction=null}updateStartAngle(t){this.target.attribute.startAngle=this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t}updateEndAngle(t){this.target.attribute.endAngle=this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class iC extends eC{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=tC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r),this.determineUpdateFunction()}}class sC extends eC{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=x(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class nC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:u(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:u(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return u(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/2,o.width=void 0),u(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:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class rC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:u(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:u(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return u(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),u(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const aC=(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,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?x(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=x(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:d(l)?void 0:c,height:d(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class oC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=aC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class lC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?x(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=x(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:d(o)?void 0:h,height:d(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const hC=(t,e,i)=>{const s=t.getFinalAttribute().points,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.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class cC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(this.target.attribute.points=r.map(((t,i)=>Qc(r[i],a[i],e))),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class dC extends cC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:hC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class uC extends cC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:hC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const pC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class gC extends cC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:pC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class fC extends cC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:pC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const mC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class vC extends cC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:mC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class _C extends cC{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:mC(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const yC=(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.getFinalAttribute(),n=x(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.getFinalAttribute();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)};class bC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class xC extends bC{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=yC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}}class SC extends bC{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=x(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const kC=(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.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?x(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=x(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:d(a)?void 0:l,width:d(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class AC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=kC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class MC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?x(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=x(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=u(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0}}}const o=u(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class wC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n,r,a,o,l,h,c;let d,u;super.onBind();const p=this.target.getFinalAttribute(),g=null!==(t=this.target.attribute)&&void 0!==t?t:{};switch(null===(e=this.params)||void 0===e?void 0:e.direction){case"x":d={scaleX:null!==(i=g.scaleX)&&void 0!==i?i:0},u={scaleX:null!==(s=null==p?void 0:p.scaleX)&&void 0!==s?s:1},this._updateFunction=this.updateX;break;case"y":d={scaleY:null!==(n=g.scaleY)&&void 0!==n?n:0},u={scaleY:null!==(r=null==p?void 0:p.scaleY)&&void 0!==r?r:1},this._updateFunction=this.updateY;break;default:d={scaleX:null!==(a=g.scaleX)&&void 0!==a?a:0,scaleY:null!==(o=g.scaleY)&&void 0!==o?o:0},u={scaleX:null!==(l=null==p?void 0:p.scaleX)&&void 0!==l?l:1,scaleY:null!==(h=null==p?void 0:p.scaleY)&&void 0!==h?h:1},this._updateFunction=this.updateXY}const f=this.target.getFinalAttribute();f&&this.target.setAttributes(f),this.props=u,this.from=d,this.to=u,!1!==(null===(c=this.params.controlOptions)||void 0===c?void 0:c.immediatelyApply)&&this.target.setAttributes(d)}onEnd(t){super.onEnd(t)}updateX(t){this.target.attribute.scaleX=this.from.scaleX+(this.to.scaleX-this.from.scaleX)*t}updateY(t){this.target.attribute.scaleY=this.from.scaleY+(this.to.scaleY-this.from.scaleY)*t}updateXY(t){this.updateX(t),this.updateY(t)}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateXY:"scaleX"===this.propKeys[0]?this._updateFunction=this.updateX:"scaleY"===this.propKeys[0]?this._updateFunction=this.updateY:this._updateFunction=null}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag())}}class TC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i,s,n;let r,a;super.onBind();const o=this.target.attribute;switch(null===(t=this.params)||void 0===t?void 0:t.direction){case"x":r={scaleX:null!==(e=null==o?void 0:o.scaleX)&&void 0!==e?e:1},a={scaleX:0};break;case"y":r={scaleY:null!==(i=null==o?void 0:o.scaleY)&&void 0!==i?i:1},a={scaleY:0};break;default:r={scaleX:null!==(s=null==o?void 0:o.scaleX)&&void 0!==s?s:1,scaleY:null!==(n=null==o?void 0:o.scaleY)&&void 0!==n?n:1},a={scaleX:0,scaleY:0}}this.props=a,this.from=r,this.to=a}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}}class CC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}class BC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e;super.onBind();let{diffAttrs:i={}}=null!==(t=this.target.context)&&void 0!==t?t:{};const{options:s}=this.params;i=Object.assign({},i),(null===(e=null==s?void 0:s.excludeChannels)||void 0===e?void 0:e.length)&&s.excludeChannels.forEach((t=>{delete i[t]})),this.props=i}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i)}}class EC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class PC extends EC{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:d,excludeChannels:u=[],layoutRect:p={}}=null!=e?e:{};let g=0,f=0;"negative"===l&&(g=null!==(s=p.width)&&void 0!==s?s:t.stage.viewWidth,f=null!==(n=p.height)&&void 0!==n?n:t.stage.viewHeight),g+=o,f+=o;const m=c(d)?d.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):d,v=t.getGraphicAttribute("x"),_=t.getGraphicAttribute("y"),y=u.includes("x")?v:m&&k(m.x)?m.x:g,b=u.includes("y")?_:m&&k(m.y)?m.y:f;switch(h){case"x":return{from:{x:u.includes("x")?v:y},to:{x:v}};case"y":return{from:{y:b},to:{y:_}};default:return{from:{x:y,y:b},to:{x:v,y:_}}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}}class RC extends EC{onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{var s,n,r,a;const{offset:o=0,orient:l,direction:h,point:d}=null!=e?e:{},u=i.group?i.group.AABBBounds:null,p=null!==(s=u.width())&&void 0!==s?s:i.width,g=null!==(n=u.height())&&void 0!==n?n:i.height,f=("negative"===l?p:0)+o,m=("negative"===l?g:0)+o,v=c(d)?d.call(null,null===(a=null===(r=t.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],t,i):d,_=v&&k(v.x)?v.x:f,y=v&&k(v.y)?v.y:m;switch(h){case"x":return{from:{x:t.getGraphicAttribute("x")},to:{x:_}};case"y":return{from:{y:t.getGraphicAttribute("y")},to:{y:y}};default:return{from:{x:t.getGraphicAttribute("x"),y:t.getGraphicAttribute("y")},to:{x:_,y:y}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=t,this.to=e}}class OC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class IC extends OC{onBind(){var t;super.onBind();const{from:e,to:i}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=ut(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(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:n},to:{angle:s}}})(this.target,this.params.options);this.props=i,this.propKeys=["angle"],this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}}class LC extends OC{onBind(){super.onBind();const{from:t,to:e}=((t,e)=>{var i;const s=null!==(i=t.getFinalAttribute().angle)&&void 0!==i?i:0;let n=0;return n=ut(s/(2*Math.PI),0)?Math.round(s/(2*Math.PI))*Math.PI*2:k(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:n}}})(this.target,this.params.options);this.props=e,this.propKeys=["angle"],this.from=t,this.to=e}}class DC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.from=null!=t?t:{}}onBind(){var t,e;super.onBind(),Object.keys(this.from).forEach((t=>{null==this.props[t]&&(this.props[t]=this.target.getGraphicAttribute(t))}));const i=this.target.getFinalAttribute();"appear"===(null===(t=this.target.context)||void 0===t?void 0:t.animationState)&&i&&this.target.setAttributes(i),!1!==(null===(e=this.params.controlOptions)||void 0===e?void 0:e.immediatelyApply)&&this.target.setAttributes(this.from)}onFirstRun(){this.from=Object.assign(Object.assign({},this.getLastProps()),this.from);const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.from[e]=null!==(i=this.from[e])&&void 0!==i?i:t[e]})),this.target.setAttributes(this.from)}deleteSelfAttr(t){super.deleteSelfAttr(t),delete this.from[t]}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.from,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.from[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}}class FC extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=xo.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Nl,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=xo.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_;const y=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(y){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:$o.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(_=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==_?_:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:$o.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=ll(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=ll(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(ne.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(ne.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;e{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=df.group({zIndex:999});e.name=fw.axisBreak,e.id=this._getNodeId(`${fw.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=z({},yw,s),a=null!==(e=r.size)&&void 0!==e?e:yw.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=df.symbol(Object.assign({x:s.x,y:s.y},o));l.name=fw.axisBreakSymbol;const h=df.symbol(Object.assign({x:n.x,y:n.y},o));h.name=fw.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=df.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=fw.background,n.id=this._getNodeId("background"),n.states=z({},vw,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new VM(Object.assign({},t));e.name=fw.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=VC(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];E(l)||(c.state={line:z({},vw,l),symbol:z({},vw,l)});const d=new pw(c);d.name=fw.line,d.id=this._getNodeId("line"),t.add(d)}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}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:u}=s,p=VC(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),_=this.getRelativeVector();let y=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+P(this.attribute,"label.space",4);y+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===_[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?y+=i+(e-1)*t:y=0}else if(0===_[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;y+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}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.getActualOffset(x),A=this.getVerticalCoord(v,S,!1),M=this.getVerticalVector(S,!1,{x:0,y:0});let w,T,{angle:C}=p;if(w="start"===n?"start":"end"===n?"end":"center",d(C)&&o){C=BM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;T=1==-1*t?"bottom":"top"}else w=this.getTextAlign(M),T=this.getTextBaseline(M,!1);let B=u;if(d(B)){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(C!==Math.PI/2){const t=Math.abs(Math.cos(null!=C?C:0));B=t<1e-6?1/0:this.attribute.end.x/t}else B=s-S;else if(C&&0!==C){const t=Math.abs(Math.sin(C));B=t<1e-6?1/0:this.attribute.end.y/t}else B=s-S}const E=Object.assign(Object.assign(Object.assign({},A),p),{maxWidth:B,textStyle:Object.assign({textAlign:w,textBaseline:T},a),state:{text:z({},vw,c.text),shape:z({},vw,c.shape),panel:z({},vw,c.background)}});return E.angle=C,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}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:u}=s,p=VC(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),_=this.getVerticalVector(m,!1,{x:0,y:0});let y,{angle:b}=p,x="center";if(d(b)&&a){b=BM(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;y=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(_,!1,o.angle);x=t,y=e}const S=u,k=h?h(c):c,A=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:y},o),text:k});return A.angle=b,l&&l.visible&&(A.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),A}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 Ww(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return Uw(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=Y(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(E(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:d,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(c(h))h(t,e,s,this);else{if(d)!function(t,e){if(E(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,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=re(e)})),Vw(i,t),!Hw(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(E(t)||!k(i))return;const a=t[0].attribute.angle,o=Sw(a),l=xw(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=Yw(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);k(i)&&(c=Gt(c,i))}}else{if(l){const i=Yw(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);k(i)&&(c=Gt(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&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);Gw(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||d?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&jw(t,{orient:o,method:m,separation:v,lastVisible:_,firstVisible: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=df.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=fw.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(u(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(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 f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=PM(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=ni(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(){super.release(),this._breaks=null}}NC.defaultAttributes=_w,U(NC,Xw);class WC{isInValidValue(t){const{startAngle:e=iM,endAngle:i=sM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=iM,endAngle:i=sM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return le(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return Mw(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function UC(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=UC(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var XC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),k(l)&&l>=3){const t=ww(n,l,c,e,i);h=df.path(Object.assign(Object.assign({},a.style),{path:Tw(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=df.circle(t)}h.name=fw.line,h.id=this._getNodeId("line"),E(a.state)||(h.states=z({},vw,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:u={}}=a,p=XC(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=P(this.attribute.label,"style.fontSize",12)+P(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=n+m+f+o;let _="middle",{position:y}=this.attribute.title;d(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({},vw,u.text),shape:z({},vw,u.shape),panel:z({},vw,u.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;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(ut(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=UC(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&GC(e,c,i)}else e.AABBBounds.width()>r&&GC(e,r,i)}else o>a.x&&h.x2>n.x2?(GC(e,n.x2-o,i),r&&YC(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return ut(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}$C.defaultAttributes=_w,U($C,WC);const KC=t=>t.map(((t,e)=>({index:e,value:t}))),qC=(t,e,i=0)=>{const s=new He(t).expand(i/2),n=new He(e).expand(i/2);return s.intersects(n)},ZC=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=re(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,m=0;u||(p?(g=0,m=1):c&&(g=Math.cos(c),m=-Math.sin(c)));const v=EM(a),_=t.range();let y=[];for(let i=0;i{tB[t]=!0}));const rB=t=>-Math.log(-t),aB=t=>-Math.exp(-t),oB=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,lB=t=>10===t?oB:t===Math.E?Math.exp:e=>Math.pow(t,e),hB=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),cB=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),dB=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function uB(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 pB(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function gB(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function fB(t,e,i,s){return 1===i&&(i=0),gB(t,i,s)*(e/(1-i))}function mB(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function vB(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=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 yB{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:u(this._rangeFactorStart)&&u(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=mB(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):u(this._rangeFactorStart)&&u(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return d(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(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 d(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(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=mt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=d(s)?(l-o)*i:s;let u=Math.exp(e);u=u/(u-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=u*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const bB=Symbol("implicit");class xB extends yB{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=QC.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=bB}clone(){const t=(new xB).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return u(this._rangeFactorStart)&&u(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!==bB)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&&a>1;)a-=1,r=Math.floor((e-t)/a);return SB(t,e,r,n)}class AB extends xB{constructor(t){super(),this.type=QC.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=fB(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(u(this._rangeFactorStart)&&u(this._rangeFactorEnd)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("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),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]}}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(u(this._rangeFactorStart)&&u(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=[tt(t[0]),tt(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[tt(t[0]),tt(t[1])],this._round=!0,this.rescale(e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:kB(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=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(t=10){const e=this.calculateVisibleDomain(this._range);return kB(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=_t(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,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 d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return d(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&&x(this._userBandwidth)}clone(){var t,e,i;return new AB(!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:MB}=si;function wB(t,e){const i=typeof e;let s;if(d(e)||"boolean"===i)return()=>e;if("number"===i)return St(t,e);if("string"===i){if(s=ti.parseColorString(e)){const e=MB(ti.parseColorString(t),s);return t=>e(t).formatRgb()}return St(Number(t),Number(e))}return e instanceof ei?MB(t,e):e instanceof ti?MB(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 TB extends yB{constructor(t=nB,e=nB){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=nB,this._piecewise=pB,this._interpolate=wB}calculateVisibleDomain(t){var e;return u(this._rangeFactorStart)&&u(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,tt);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=_t(i[0],i[r-1])),this._piecewise=r>2?vB:pB,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:nB),this.rescale(i)):this._clamp!==nB}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=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 d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const CB=Math.sqrt(50),BB=Math.sqrt(10),EB=Math.sqrt(2),PB=[1,2,5,10],RB=(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=DB(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)),J(0,e).map((t=>n+t*s))):t>0?IB(0,-(e-1)/s,s):IB((e-1)/s,0,s)},OB=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 RB(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return RB(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=IB(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=IB(t,e,l);return n&&r.reverse(),r})),DB=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=PB[0];return i>=CB?s=PB[3]:i>=BB?s=PB[2]:i>=EB&&(s=PB[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function FB(t,e,i){const s=(e-t)/Math.max(0,i);return DB(s)}function zB(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;e0;){if(s=FB(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function HB(t,e){const i=x(e.forceMin),s=x(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:x(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:x(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),x(r[0])&&x(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=x(r[0])||x(r[1])?x(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const VB=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),NB=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})),WB=ft(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=LB(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?VB(t,e,n):VB(t,e,_B(n)),h=VB(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),UB=ft(((t,e,i,s,n)=>zB(s(t),s(e),i).map((t=>_B(n(t))))));class GB extends TB{constructor(){super(...arguments),this.type=QC.Linear}clone(){var t;const e=new GB;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return OB(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(c(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(u(this._rangeFactorStart)&&u(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=LB(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(t=10){const e=this.calculateVisibleDomain(this._range);return zB(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(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r: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}}function XB(t){return e=>-t(-e)}function $B(t=Number.EPSILON){return e=>Math.max(e,t)}class KB extends TB{constructor(){super(hB(10),lB(10)),this.type=QC.Log,this._limit=$B(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new KB).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=hB(this._base),s=lB(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=XB(i),this._pows=XB(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=rB,this.untransformer=aB):(this._logs=i,this._pows=s,this._limit=$B(),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 nB}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return NB(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return WB(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return UB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return UB(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{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))))}}}U(KB,YB);class qB extends GB{constructor(){super(cB(1),dB(1)),this.type=QC.Symlog,this._const=1}clone(){return(new qB).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=cB(t),this.untransformer=dB(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return NB(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return WB(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return UB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return UB(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}U(qB,YB);class ZB{constructor(){this.type=QC.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!d(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 ZB).domain(this._domain).range(this._range).unknown(this._unknown)}}function JB(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function QB(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!eB(t.type))return KC(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return KC([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:d,noDecimals:p=!1,labelStyle:g,breakData:f}=e;let m;if(u(d))v=t.stepTicks(d),_=f&&f()?f().breakDomains:null,m=_&&_.length?v.filter((t=>_.every((e=>te[1])))):v;else if(u(h))m=JB(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=c(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=JB(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:p}):t.d3Ticks(e,{noDecimals:p})))}else{const i=null!==(s=c(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=c(e.tickMode)?e.tickMode:void 0;m=JB(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:p,customTicks:n}):t.ticks(e,{noDecimals:p,customTicks:n})))}var v,_;const y=t.domain();if(e.labelFirstVisible&&y[0]!==m[0]&&!m.includes(y[0])&&m.unshift(y[0]),e.labelLastVisible&&y[y.length-1]!==m[m.length-1]&&!m.includes(y[y.length-1])&&m.push(y[y.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=JC(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=JC(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=Y(l),r=f&&f()?eE.greedy:eE.parity;for(;l.length>=3&&Bw(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;Cw(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),QB(t,l,a,(e=>Cw(e,t,i))),QB(n,l,o,(e=>Cw(e,n,i)||!(!a||e===t)&&Cw(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),Y(h)!==Y(m)&&h.push(Y(m))),m=h}}return KC(m)},eE={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&Cw(i,t,e)||(i=t,0))))}},iE=(t,e,i,s)=>{const n=JC(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},sE=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,nE=(t,e)=>t[1]{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,p=(t=>["bottom","top","z"].includes(t))(l),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?KC([s[s.length-1]]):KC([s[0]]);let m;if(u(a))m=t.stepTicks(a);else if(u(r))m=t.forceTicks(r);else if(u(n)){const e=c(n)?n({axisLength:f,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=$(g),a=X(g);if(s.length<=f/n){const i=iE(t,s,e,p);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=aE(s,i,o,e.labelLastVisible,Math.floor(n/l),!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=iE(t,i,e,p);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!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])){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&&!sE(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?nE(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{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=EM(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=le({x:0,y:0},i,t),a=Aw(r,Mw(s,r,e,n));return o=a,l=Mw(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return _.align||(ut(y,f.x)?_.baseline||(_.baseline=b>f.y?"top":"bottom"):y>f.x?_.align="left":y{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||h<=0)return KC(t.domain());let d;if(u(n))d=t.stepTicks(n);else if(u(s))d=t.forceTicks(s);else if(u(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=c(i)?i({axisLength:s,labelStyle:l}):i;d=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=oE(t,i,e),r=$(s),l=X(s),c=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=hE(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/c));d=t.stepTicks(u),d=d.slice(0,d.length-p)}else d=t.domain();return KC(d)},hE=(t,e,i,s)=>{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&&qC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},cE=new Uint32Array(33),dE=new Uint32Array(33);dE[0]=0,cE[0]=~dE[0];for(let t=1;t<=32;++t)dE[t]=dE[t-1]<<1|1,cE[t]=~dE[t];function uE(t,e,i={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:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&cE[31&o]&dE[1+(31&l)])return!0}else{if(i[h]&cE[31&o])return!0;if(i[c]&dE[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,cE[31&o]&dE[1+(31&l)]);else for(s(h,cE[31&o]),s(c,dE[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,dE[31&a]|cE[1+(31&o)]);else for(n(l,dE[31&a]),n(h,cE[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=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 pE(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=mt(i,-o,t.width+l),d=mt(s,-o,t.width+l),u=mt(n,-a,t.height+h),p=mt(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function gE(t,e,i=!1){return i?pE(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function fE(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=gE(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=pE(t,r)),e.getRange(r)))}function mE(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>u(t))),p=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return mE(t,e,n,o,h,d,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?c(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return mE(t,e,n,s,h,d)}if("moveX"===i.type){const s=(i.offset?c(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return mE(t,e,n,s,h,d)}return!1}const _E=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],yE=["top","inside-top","inside"];function bE(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let _=0,y=0;return u<0-h?_=-u:p>m&&(_=m-p),g<0-l?y=-g:f>v&&(y=v-f),{dx:_,dy:y}}const xE={mode:"same-time",duration:300,easing:"linear"};function SE(t){return 3===t||4===t}function kE(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 AE=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 ME(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)}}var wE=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{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const BE=(t,e)=>Math.ceil(t)>Math.floor(e),EE=([t,e],[i,s])=>s>t&&e>i;function PE(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}var RE=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{const e=t.target;e===this._lastHover||E(e.states)||(e.addState(rM.hover,!0),mM(this,(t=>{t===e||E(t.states)||t.addState(rM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(mM(this,(t=>{E(t.states)||(t.removeState(rM.hoverReverse),t.removeState(rM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void mM(this,(t=>{E(t.states)||(t.removeState(rM.selectedReverse),t.removeState(rM.selected))}));E(e.states)||(e.addState(rM.selected,!0),mM(this,(t=>{t===e||E(t.states)||t.addState(rM.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)===$o.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===$o.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(xe(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,f=p-d;return[ME(g,f,c,d,a,o),ME(-g,-f,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds)}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=df.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Nl)}return e&&e.getAttributes(!0).fill&&s.setAttribute("stroke",e.getAttributes(!0).fill),this.attribute.line&&!E(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),d(this._idToGraphic)||this._isCollectionBase&&d(this._idToPoint))return;const t=[];!1!==this._enableAnimation&&this._baseMarks.forEach((e=>{t.push(e.attribute),e.initAttributes(e.getAttributes(!0))}));const{overlap:e,smartInvert:i,dataFilter:s,customLayoutFunc:n,customOverlapFunc:r}=this.attribute;let a=this.attribute.data;if(c(s)&&(a=s(a)),a&&a.length){const t=new Set;a=a.filter((e=>!t.has(e.id)&&t.add(e.id)))}let o=this._initText(a);o=c(n)?n(a,o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(o);const l=[],u=o;if(!h(e)&&c(null==e?void 0:e.filterBeforeOverlap)){const t=this.getRelatedGraphic.bind(this);o.forEach((i=>{e.filterBeforeOverlap(i,t,this)?u.push(i):l.push(i)}))}c(r)?o=r(u,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(l):!1!==e&&(o=this._overlapping(u).concat(l)),c(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),o&&o.length&&o.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==i&&this._smartInvert(o),this._renderLabels(o),!1!==this._enableAnimation&&this._baseMarks.forEach(((e,i)=>{e.initAttributes(t[i])}))}_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&&!E(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!E(e)&&(t.states=e)}_createLabelText(t){var e,i;return IM(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;const i=[];let s;if(s=c(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),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&BE(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&BE(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(ut(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(PE([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!EE([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let y=0,b=t.length-1;for(;y<=b;)y===b?_.push(t[y]):(_.push(t[y]),_.push(t[b])),y++,b--;return _}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&s.setRange(gE(i,t.AABBBounds,!0))}))),h.length>0&&h.forEach((t=>{v(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&&s.setRange(gE(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(gE(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){var s;if(t){if(!1!==t.attribute.visible){if(null===(s=t.context)||void 0===s?void 0:s.animationState){const e=t.clone();return Object.assign(e.attribute,t.getAttributes(!0)),e.AABBBounds}return t.AABBBounds}const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:n,y:r}=e;return{x1:n,x2:n,y1:r,y2:r}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=p(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:g}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{IE[t]=e};var DE=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{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,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*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}FE.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const zE=()=>{LE("symbol",FE),LE("line-data",FE)};var jE=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{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}})(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}}}HE.tag="rect-label",HE.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var VE=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{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=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}}(t,e,i,s)}};NE.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const WE=()=>{LE("line",NE),LE("area",NE)};var UE=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);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=c(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=c(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const d=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}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),h=l.getAttributes(!0),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!d(s[i])&&!d(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,d=h.endAngle-h.startAngle,p=pe(h.endAngle-d/2),g=le(c,h.outerRadius,o),f=le(c,a+e.line.line1MinLength,o),m=new GE(t,g,f,p,d,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=le(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(u=m.quadrant)||2===u?this._arcRight.set(m.refDatum,m):SE(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var u}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":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 f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,_=0;if("inside"===o&&(_="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=le(t.circleCenter,v,t.middleAngle),t.labelLimit=f,pt(f,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.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=SE(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=SE(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.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 c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(gt(t.pointB.x,this._line2MinLength+h)||pt(t.pointB.x,c-this._line2MinLength-h))&&(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(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;k(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=SE(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-y-c:0+y+c;break;default:m=p.x+f*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+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?d(h)||"auto"===h?"edge"===c?SE(t.quadrant)?"left":"right":SE(t.quadrant)?"right":"left":h:d(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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*(SE(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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,f,m;if(ut(l/2,u))g=0,f=1,m=-p;else if(ut(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,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,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?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.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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;e{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 KE(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=ne.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 qE(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=Tw(t,!!n),o=Tw(r,!!n);const h=ne.distancePP(s,l),c=ne.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=KE(e,t,!1,!!n),o=KE(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=Tw(t,!!n),o=Tw(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}$E.defaultAttributes={pickable:!1};class ZE extends Jy{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&kw(this._innerView),this.removeAllChild(!0),this._innerView=df.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 Aw(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?`${fw.grid}-sub`:`${fw.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let d="";if("line"===s||"polygon"===s)d=Tw(o,!!a);else if("circle"===s){const{center:t}=this.attribute;d=KE(t,o,!1,!!a)}const u=df.path(Object.assign({path:d,z:l},c(r)?z({},this.skipDefault?null:ZE.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 d=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(d*d+u*u),g=l/p;o.push({x:n[0].x+d*g,y:n[0].y+u*g});const f=Tw(o,!!a),m=Vt(o[0].x-o[1].x),v=Vt(o[0].y-o[1].y),_=df.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*Ft/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},c(r)?z({},this.skipDefault?null:ZE.defaultAttributes.style,r(t,i)):r));_.name=`${h}-line`,_.id=this._getNodeId(`${h}-path-${s}`),e.add(_)})),n.length>1&&o){const t=_(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!ut(a.value,0)&&!ut(l.value,0),d=!ut(a.value,1)&&!ut(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}ZE.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},DA(),NA();class JE extends ZE{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},ZE.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=iM,endAngle:r=sM}=this.attribute;i=ww(t,s,ne.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=z({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}U(JE,Xw);var QE,tP,eP,iP=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){const e=this._getPointsOfSubGrid(p,d);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(sP,WC),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(QE||(QE={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(tP||(tP={})),function(t){t.dataZoomChange="dataZoomChange"}(eP||(eP={}));const nP="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",rP={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:nP,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:nP,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},aP={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}},oP=0,lP=1,hP=2,cP=3,dP=4,uP=5,pP=5,gP=999,fP=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var mP=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;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s,zIndex:hP},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s,zIndex:hP},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto",zIndex:oP},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,k,A,M,w;const{orient:T,middleHandlerStyle:C={},startHandlerStyle:B={},endHandlerStyle:E={},zoomLock:P}=this.attribute,{start:R,end:O}=this._getState(),{position:I,width:L,height:D}=this._getLayoutAttrFromConfig(),F=null!==(t=B.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=E.triggerMinSize)&&void 0!==e?e:40,j=this._getContainer();if(this._isHorizontal){if(C.visible){const t=(null===(i=C.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:I.x+R*L,y:I.y-t,width:(O-R)*L,height:t,zIndex:uP},null===(s=C.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=C.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:I.x+(R+O)/2*L,y:I.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=C.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square",zIndex:uP},C.icon),{pickable:!P&&(null===(h=C.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+R*L,y:I.y+D/2,size:D,symbolType:null!==(c=B.symbolType)&&void 0!==c?c:"square"},aP.horizontal),{zIndex:uP}),B),{pickable:!P&&(null===(d=B.pickable)||void 0===d||d)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+O*L,y:I.y+D/2,size:D,symbolType:null!==(u=E.symbolType)&&void 0!==u?u:"square"},aP.horizontal),{zIndex:uP}),E),{pickable:!P&&(null===(p=E.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+R*L-t/2,y:I.y+D/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:gP},aP.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+O*L-g/2,y:I.y+D/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:gP},aP.horizontal),{pickable:!P}),"rect")}else{if(C.visible){const t=(null===(g=C.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===T?I.x-t:I.x+L,y:I.y+R*D,width:t,height:(O-R)*D,zIndex:uP},null===(f=C.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(_=null===(v=null===(m=C.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===_||_)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===T?I.x-t/2:I.x+L+t/2,y:I.y+(R+O)/2*D,angle:Math.PI/180*90,symbolType:null!==(b=null===(y=C.icon)||void 0===y?void 0:y.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0,zIndex:uP},C.icon),{pickable:!P&&(null===(S=null===(x=C.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:I.x+L/2,y:I.y+R*D,size:L,symbolType:null!==(k=B.symbolType)&&void 0!==k?k:"square"},aP.vertical),{zIndex:uP}),B),{pickable:!P&&(null===(A=B.pickable)||void 0===A||A)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:I.x+L/2,y:I.y+O*D,size:L,symbolType:null!==(M=E.symbolType)&&void 0!==M?M:"square",zIndex:uP},aP.vertical),E),{pickable:!P&&(null===(w=E.pickable)||void 0===w||w)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:I.x+L/2+t/2,y:I.y+R*D-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:gP},aP.vertical),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:I.x+L/2+i/2,y:I.y+O*D-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:gP},aP.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move",zIndex:cP},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move",zIndex:cP},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1,zIndex:lP},"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))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1,zIndex:dP},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){return t.length<=10||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,void 0!==e?e*e:1)}(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(t);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(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){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 je).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)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=mP(c,["formatMethod"]),{formatMethod:g}=d,f=mP(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:_,width:y,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,k={x1:_.x,y1:_.y,x2:_.x+y,y2:_.y+b};let A,M,w,T;this._isHorizontal?(A={x:_.x+m*y,y:_.y+b/2},M={x:_.x+v*y,y:_.y+b/2},w={textAlign:fP(k,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},T={textAlign:fP(k,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(A={x:_.x+y/2,y:_.y+m*b},M={x:_.x+y/2,y:_.y+v*b},w={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:fP(k,t,"start",this._isHorizontal)?"top":"bottom"},T={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:fP(k,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),z({},p,{text:x,x:A.x,y:A.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w,zIndex:pP}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),z({},f,{text:S,x:M.x,y:M.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T,zIndex:pP}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new VM(e),s.name=i,t.add(s)),s}}const _P={debounce:bt,throttle:xt};class yP extends o{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=QE.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=QE.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=QE.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=QE.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=QE.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===S_.env?S_:this.stage,s=hM();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===QE.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===QE.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===QE.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===QE.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(tP.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(tP.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(tP.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===QE.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(tP.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(tP.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:_P[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===S_.env?S_:this.stage,e=hM();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===S_.env?S_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===S_.env?S_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:mt(e+t,0,1),end:mt(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=QE.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}jM(),YA(),JA(),EA(),HA();let bP=class t extends Jy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,_;h.visible?this._isHorizontal?(m=p,v=g-f,_={x:a.x,y:a.y+f}):(m=p-f,v=g,_={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(y+b)/2,_={x:_.x+y/2,y:_.y}):(v-=(y+b)/2,_={x:_.x,y:_.y+y/2})),v+=(null!==(n=u.lineWidth)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:_,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new vP(this._getRendererAttrs()),this._interaction=new yP(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(tP.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(tP.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(eP.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(tP.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;u(t)&&u(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(eP.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.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,...G(a))}setPreviewPointsX(t){c(t)&&(this._renderer.previewPointsX=t)}setPreviewPointsY(t){c(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){c(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){c(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){c(t)&&(this._renderer.statePointToData=t)}};var xP,SP,kP,AP;function MP(){DA(),jM(),ST()}bP.defaultAttributes=rP,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"}(xP||(xP={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(SP||(SP={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(kP||(kP={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(AP||(AP={}));class wP extends Jy{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=Ew(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=Pw(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=Rw(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=p(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=df.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=df.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=df.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 TP(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 CP(t,e,i,s){t&&(TP(t.startSymbol,e,i,s),t.lines.forEach((t=>TP(t,e,i,s))),TP(t.line,e,i,s),TP(t.endSymbol,e,i,s))}function BP(t,e,i,s){t&&(TP(t.getTextShape(),e,i,s),TP(t.getBgRect(),e,i,s))}function EP(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 PP(t,e,i,s){t&&(EP(t.startSymbol,e,i,s),t.lines.forEach((t=>EP(t,e,i,s))),EP(t.line,e,i,s),EP(t.endSymbol,e,i,s))}function RP(t,e,i,s){t&&(EP(t.getTextShape(),e,i,s),EP(t.getBgRect(),e,i,s))}function OP(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;TP(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)})),TP(t.endSymbol,s+r+a,o,n),G(e).forEach((t=>{const e=s+r+a+o;TP(t.getTextShape(),e,l,n),TP(t.getBgRect(),e,l,n)}))}function IP(t,e,i,s,n){CP(t,s,i,n),G(e).forEach((t=>{BP(t,s,i,n)}))}function LP(t,e,i,s,n){TP(t,s,i,n),G(e).forEach((t=>{BP(t,s,i,n)}))}function DP(t,e,i,s,n){TP(t,s,i,n),G(e).forEach((t=>{BP(t,s,i,n)}))}function FP(t,e,i,s,n,r){var a;CP(t,n,s,r),TP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?BP(i,n,s,r):TP(i,n,s,r)}function zP(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;TP(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)})),TP(e,n+o+l,h,r),TP(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(TP(i.getTextShape(),n+o+l+h+c,d,r),TP(i.getBgRect(),n+o+l+c,d,r)):TP(i,n+o+l+c,d,r)}function jP(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?OP(t,e,s,r,a):"fadeIn"===i&&IP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?OP(t,e,s,n,a):"fadeIn"===i&&IP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){PP(t,s,i,n),G(e).forEach((t=>{RP(t,s,i,n)}))}(t,e,i,s,n)}}function HP(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&&LP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&LP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){EP(t,s,i,n),G(e).forEach((t=>{RP(t,s,i,n)}))}(t,e,i,s,n)}}function VP(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&&DP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&DP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){EP(t,s,i,n),G(e).forEach((t=>{RP(t,s,i,n)}))}(t,e,i,s,n)}}function NP(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?FP(n,r,e,i,s,o):"callIn"===t&&zP(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?FP(n,r,e,i,s,a):"callIn"===t&&zP(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;PP(t,n,s,r),EP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?RP(i,n,s,r):EP(i,n,s,r)}(n,r,e,t,i,s)}}const WP={type:"clipIn",duration:500,easing:"linear",delay:0},UP={type:"fadeIn",duration:500,easing:"linear",delay:0},GP={type:"callIn",duration:500,easing:"linear",delay:0},YP={type:"fadeOut",duration:500,easing:"linear",delay:0};class XP{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=G(null==n?void 0:n.label),a=G(null==n?void 0:n.labelBackground),o=G(s).map(((s,n)=>{var o,l;const h=z({},i,s),c=new VM(Object.assign(Object.assign({},h),{state:{panel:z({},aM,null!==(o=a[n])&&void 0!==o?o:Y(a)),text:z({},aM,null!==(l=r[n])&&void 0!==l?l:Y(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===G(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=G(this._label),n=G(null==i?void 0:i.label),r=G(null==i?void 0:i.labelBackground);if(s.length){const i=G(e);s.forEach(((e,s)=>{var a,o;const l=z({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:z({},aM,null!==(a=r[s])&&void 0!==a?a:Y(r)),text:z({},aM,null!==(o=n[s])&&void 0!==o?o:Y(n))}})),this.setLabelPos(e,l)}))}}}class $P extends wP{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=WP,this.defaultExitAnimation=YP}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;zM(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}U($P,XP);const KP=.001,qP={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:xP.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]}},ZP={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"}}},JP={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:{autoRotate:!0,position:kP.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]}},QP={interactive:!0,label:{position:SP.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}},tR={interactive:!0,label:{autoRotate:!0,position:kP.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}},eR={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"}},iR={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"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},sR={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 nR(){rR._animate=jP}MP(),dw(),ST();class rR extends $P{markerAnimate(t){rR._animate&&this._animationConfig&&rR._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},rR.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i: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,e){var i;return(_M(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return yM(Math.abs(e),Math.PI/2,KP)||yM(Math.abs(e),3*Math.PI/2,KP)?bM(i,e,t):_M(e)?ZP.postiveXAxis[t]:ZP.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new pw({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},aM,null==a?void 0:a.line),startSymbol:z({},aM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},aM,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({},aM,null==a?void 0:a.line),startSymbol:z({},aM,null==a?void 0:a.lineStartSymbol),endSymbol:z({},aM,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}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",rR.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(rR.defaultAttributes.label)}}function aR(){oR._animate=HP}rR.defaultAttributes=qP,MP(),UA(),ST();class oR extends wP{markerAnimate(t){oR._animate&&this._animationConfig&&oR._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},oR.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=UP,this.defaultExitAnimation=YP}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},iR[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;zM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=df.polygon(Object.assign({points:e},i));n.states=z({},aM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",oR.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=z({},aM,null==i?void 0:i.area)),this._updateMarkLabels(oR.defaultAttributes.label)}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}}oR.defaultAttributes=QP,U(oR,XP),MP(),uw(),ST();class lR extends $P{markerAnimate(t){lR._animate&&this._animationConfig&&lR._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},lR.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case kP.arcInnerStart:l=n;case kP.arcOuterStart:l=n;break;case kP.arcInnerEnd:l=r;case kP.arcOuterEnd:l=r;break;case kP.center:case kP.arcInnerMiddle:case kP.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return eR[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new gw({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},aM,null==o?void 0:o.line),startSymbol:z({},aM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},aM,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({},aM,null==o?void 0:o.line),startSymbol:z({},aM,null==o?void 0:o.lineStartSymbol),endSymbol:z({},aM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",lR.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(lR.defaultAttributes.label)}}lR.defaultAttributes=JP,MP(),CA(),ST();class hR extends wP{markerAnimate(t){hR._animate&&this._animationConfig&&hR._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},hR.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=UP,this.defaultExitAnimation=YP}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case kP.center:h=(s+n)/2,c=(r+a)/2;break;case kP.arcInnerStart:h=s,c=r;break;case kP.arcOuterStart:h=n,c=r;break;case kP.arcInnerEnd:h=s,c=a;break;case kP.arcOuterEnd:h=n,c=a;break;case kP.arcInnerMiddle:h=s,c=(r+a)/2;break;case kP.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},eR[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;zM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=df.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=z({},aM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",hR.defaultAttributes.label)}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({},aM,null==o?void 0:o.area)),this._updateMarkLabels(hR.defaultAttributes.label)}isValidPoints(){return!0}}function cR(){dR._animate=NP}hR.defaultAttributes=tR,U(hR,XP),MP(),dw(),uw(),JA(),zA(),HA(),ST();class dR extends wP{markerAnimate(t){dR._animate&&this._animationConfig&&dR._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},dR.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=GP,this.defaultExitAnimation=YP,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return yM(Math.abs(s),Math.PI/2,KP)||yM(Math.abs(s),3*Math.PI/2,KP)?bM(t,s,n):_M(s)?sR.postiveXAxis[n]:sR.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,style:d,position:u=AP.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-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,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:z({},aM,null==p?void 0:p.textBackground),text:z({},aM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=z({},aM,null==p?void 0:p.itemContent));const v=_M(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+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",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=df.symbol(Object.assign(Object.assign({},i),r)),o.states=z({},aM,null==s?void 0:s.itemContent)):"text"===n?o=new VM(Object.assign(Object.assign({},i),{state:{panel:z({},aM,null==s?void 0:s.textBackground),text:z({},aM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=df.richtext(Object.assign(Object.assign({},i),r)),o.states=z({},aM,null==s?void 0:s.itemContent)):"image"===n?(o=df.image(Object.assign(Object.assign({},i),r)),o.states=z({},aM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=z({},aM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}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=yM(c,0,KP)||yM(d,0,KP),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=DM(e-u,t-d),o=DM(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*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(bR.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(bR.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===bR.focus||"focus"===o){const s=a.hasState(_R.focus);a.toggleState(_R.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[_R.unSelected,_R.unSelectedHover,_R.focus],t),this._setLegendItemState(e,_R.selected,t)})):(this._setLegendItemState(a,_R.selected,t),this._removeLegendItemState(a,[_R.unSelected,_R.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[_R.selected,_R.selectedHover,_R.focus],t),this._setLegendItemState(e,_R.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(_R.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(_R.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(yR.legendItemClick,a,t);i?(this._removeLegendItemState(a,[_R.selected,_R.selectedHover],t),this._setLegendItemState(a,_R.unSelected,t)):(this._setLegendItemState(a,_R.selected,t),this._removeLegendItemState(a,[_R.unSelected,_R.unSelectedHover],t))}else this._setLegendItemState(a,_R.selected,t),this._removeLegendItemState(a,[_R.unSelected,_R.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[_R.selected,_R.selectedHover],t),this._setLegendItemState(e,_R.unSelected,t))}))}this._dispatchLegendEvent(yR.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,_R.selected),this._removeLegendItemState(e,[_R.unSelected,_R.unSelectedHover])):(this._removeLegendItemState(e,[_R.selected,_R.selectedHover]),this._setLegendItemState(e,_R.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=fR,spaceRow:l=mR,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:p,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:p?i:e,v=this._contentMaxHeight;let y,{doWrap:b,maxWidthInCol:x,startX:S,startY:k,pages:A}=this._itemContext,M=0,w=0;const T=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),y=d[t],y.id||(y.id=y.label),y.index=t;let e=!0;_(n)&&(e=n.includes(y.label));const i=this._renderEachItem(y,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),p?(u(s)&&(f&&a?(A=Math.ceil((S+g)/s),b=A>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||T.forEach((t=>{t.setAttributes({y:t.attribute.y+(w-t.attribute.height)/("middle"===h?2:1)})})),A+=1,S=0,k+=w+l,w=0,T.length=0))),0===S&&0===k||i.setAttributes({x:S,y:k}),S+=o+g,w=Math.max(w,m),T.push(i)):(u(v)&&(f&&a?(A=Math.ceil((k+m)/v),b=A>1):v<=m?(A+=1,b=!0,k=0,t>0&&(S+=M+o)):v{t.setAttributes({y:t.attribute.y+(w-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=k,this._itemContext.maxWidthInCol=x,this._itemContext.pages=A,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=A),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||E(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=df.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:p}=t,g=[];u(c)&&g.push(c),u(d)&&g.push(d),g.length&&(u(s)&&g.push(s),this._itemWidthByUser=$(g)),u(p)&&(this._itemHeightByUser=p);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";p(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";p(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,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:p,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,s),k=this._handleStyle(y,t,e,i,s),A=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),w=ni(c);let T;!1===x.visible?(T=df.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(T,bR.item,t,T)):(T=df.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(T,bR.item,t,T,M.state)),T.id=`${null!=a?a:o}-${i}`,T.addState(e?_R.selected:_R.unSelected);const C=df.group({x:0,y:0,pickable:!1});T.add(C);let B,E=0,R=0,O=0;if(v&&!1!==v.visible){const i=P(S,"style.size",10);R=_(i)?i[0]||0:i,O=P(v,"space",8);const s=df.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&&d(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&d(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,bR.itemShape,t,T,S.state),s.addState(e?_R.selected:_R.unSelected),C.add(s)}let I=0;if(p){const e=P(g,"size",10);B=df.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:w},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(B,bR.focus,t,T),I=e}const L=y.formatMethod?y.formatMethod(o,t,i):o,D=IM(Object.assign(Object.assign({x:R/2+O,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=k.style)||void 0===r?void 0:r.fontSize},k.style),{text:L,_originText:y.formatMethod?o:void 0}));this._appendDataToShape(D,bR.itemLabel,t,T,k.state),D.addState(e?_R.selected:_R.unSelected),C.add(D);const F=P(y,"space",8);if(u(l)){const s=P(b,"space",p?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=IM(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:A.style.fontSize},A.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,bR.itemValue,t,T,A.state),r.addState(e?_R.selected:_R.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-w[1]-w[3]-R-O-F-I-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-R/2-w[1]-w[3]-I-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));E=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-w[1]-w[3]-R-O-I),E=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):E=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);B&&(B.setAttribute("x",E),C.add(B));const z=C.AABBBounds,j=z.width();if("right"===f){const t=z.x2,e=z.x1;C.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===B?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=z.height(),V=u(this.attribute.item.width)?this.attribute.item.width:j+w[1]+w[3],N=this._itemHeightByUser||H+w[0]+w[2];return T.attribute.width=V,T.attribute.height=N,B&&B.setAttribute("visible",!1),C.translateTo(-z.x1+w[3],-z.y1+w[0]),T}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new gR(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},z({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new gR(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new dM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new dM(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?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 i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",xt(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=fR,spaceRow:o=mR}=n,l=this._itemsContainer,{space:h=vR,defaultCurrent:c=1}=r,d=AR(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,_=0,y=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v0&&(y=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:y,y:b}),y+=a+i})),this._itemContext.startX=y,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),_=p-g.AABBBounds.height()-h-t,_<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;_0&&(b=0,y+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:y,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=df.group({x:0,y:t,width:u?v:f,height:u?m:_,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=fR,spaceRow:a=mR}=s,o=this._itemsContainer,{space:l=vR,defaultCurrent:h=1}=n,c=AR(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const _=df.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=df.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];ut(mt(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),ut(mt(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(_R.selected)?this._setLegendItemState(t,_R.selectedHover,e):this._setLegendItemState(t,_R.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===bR.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(yR.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(_R.unSelectedHover)||t.hasState(_R.selectedHover))&&(i=!0),t.removeState(_R.unSelectedHover),t.removeState(_R.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(_R.unSelectedHover)&&!t.hasState(_R.selectedHover)||(i=!0),t.removeState(_R.unSelectedHover),t.removeState(_R.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===bR.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(yR.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(yR.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!==bR.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(yR.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!==bR.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(yR.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(_R.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=z({},MR,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(_R.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(c(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]&&(c(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var TR;function CR(t){return _(t)?t:[t,t]}function BR(t){return t?"ew-resize":"ns-resize"}wR.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:fR,spaceRow:mR,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:vR,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"}(TR||(TR={})),SR();class ER extends Jy{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({},ER.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=mt(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=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=hM(),n="browser"===S_.env?S_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;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=mt(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=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=hM(),n="browser"===S_.env?S_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{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?mt(t+p,h,c):mt(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?mt(t+p,0,c-h):mt(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=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),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(u(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]=G(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:p}=this.attribute;d(p)&&(p=[o,l]),this._currentValue={startValue:CR(p)[0],endValue:CR(p)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=df.group({x:0,y:0});f.name=TR.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=df.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)),m.name=TR.startText,f.add(m);const e=u(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const _=df.group({x:g?v:0,y:g?0:v});f.add(_);const y=df.group({x:0,y:0});let b;if(y.name=TR.railContainer,this._railContainer=y,_.add(y),this._mainContainer=_,this._renderRail(y),v+=g?s:n,a&&a.visible){const t=u(a.space)?a.space:0;b=df.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=TR.endText,f.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=df.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=TR.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;d(c)&&(c=[i,s]);const u=a&&a.visible,p=this._isHorizontal,[g,f]=CR(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":BR(p)},r));if(v.name=TR.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,u){const i=this._renderHandlerText(g,e?"start":"end");i.name=TR.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":BR(p)},r));if(i.name=TR.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,u){const e=this._renderHandlerText(f,"end");e.name=TR.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,u;if(d(h))e?(c=i,u=s):c=u=i;else if(e){const t=vt(h,i,s);c=t[0],u=t[1]}else c=i,u=mt(h,i,s);const g=this._isHorizontal;e||(c=i);const f=df.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=TR.trackContainer;const m=p(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":BR(g);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(u,e?"end":"start"),b=df.rect(Object.assign({x:g?Math.min(_,y):0,y:g?0:Math.min(_,y),width:g?Math.abs(y-_):r,height:g?n:Math.abs(y-_),cursor:v},a));b.name=TR.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return df.symbol(t)}_renderHandlerText(t,e){return df.text(this._getHandlerTextAttributes(t,e))}_getHandlerPosition(t){return this.attribute.range&&t?"start":"end"}_getHandlerTextStyle(t,e){const{align:i,handlerSize:s=14,handlerText:n={},railHeight:r,railWidth:a,slidable:o}=this.attribute;return c(n.style)?n.style(t,e,{layout:this.attribute.layout,align:i,railWidth:a,railHeight:r,handlerSize:s,slidable:o}):n.style}_getHandlerTextAttributes(t,e){var i,s;const{align:n,handlerSize:r=14,handlerText:a={},railHeight:o,railWidth:l,slidable:h}=this.attribute,c=this._isHorizontal,d=this.calculatePosByValue(t,e),u=null!==(i=a.space)&&void 0!==i?i:4,p=this._getHandlerTextStyle(t,e),g={text:a.formatter?a.formatter(t):t.toFixed(null!==(s=a.precision)&&void 0!==s?s:0),lineHeight:null==p?void 0:p.lineHeight,cursor:!1===h?"default":BR(c)};return c?"top"===n?(g.textBaseline="bottom",g.textAlign="center",g.x=d,g.y=(o-r)/2-u):(g.textBaseline="top",g.textAlign="center",g.x=d,g.y=(o+r)/2+u):"left"===n?(g.textBaseline="middle",g.textAlign="end",g.x=(l-r)/2-u,g.y=d):(g.textBaseline="middle",g.textAlign="start",g.x=(l+r)/2+u,g.y=d),Object.assign(Object.assign({},g),p)}_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=df.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=df.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),p(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown),("browser"===S_.env?S_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=hM(),e="browser"===S_.env?S_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_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){const s=this._isHorizontal;t.setAttribute(s?"x":"y",e);const n=t.name===TR.startHandler?this._startHandlerText:this._endHandlerText;if(n){const e=this._getHandlerPosition(t.name===TR.startHandler);n.setAttributes(this._getHandlerTextAttributes(i,e))}t.name===TR.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){const s=this._isHorizontal,n=this._getHandlerPosition(t.name===TR.startHandlerText);t.setAttributes(this._getHandlerTextAttributes(i,n));const r=t.name===TR.startHandlerText?this._startHandler:this._endHandler;r&&r.setAttributes({[s?"x":"y"]:e}),t.name===TR.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}}release(t){super.release(t),("browser"===S_.env?S_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}ER.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}}},kR(),SR();class PR extends xR{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},PR.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!d(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:f,handlerText:m,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:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function RR(t="bottom"){let 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`}PR.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"}}},kR(),SR(),NA();class OR extends xR{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},OR.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:f,showTooltip:m,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=df.group({x:0,y:0});this._innerView.add(x);const S=new ER({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:RR(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,tooltip:v,disableTriggerEvent:y,inverse:b});x.add(S);let k,A=0;"horizontal"===e?"top"===i?(k=`M0,0L${a},0L${b?0:a},12Z`,A=o):(k=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?k=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(k=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const M=df.path(Object.assign(Object.assign({x:0,y:A,path:k},_),{zIndex:0}));x.add(M);const w=this._title?this._title.AABBBounds.height()+P(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,w-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}OR.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)"}},DA(),tM(),$A();let IR=class t extends Jy{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,p,g,f,m,v,y,b,x;const{textType:S,text:k,subtextType:A,textStyle:M={},subtext:w,subtextStyle:T={},width:C,height:B,minWidth:E,maxWidth:P,minHeight:R,maxHeight:O,align:I,verticalAlign:L,padding:D=0}=this.attribute,F=ni(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),j=null!==(t=M.height)&&void 0!==t?t:B;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:p="break-word",maxWidth:g,lineClamp:f}=M;if("rich"===S||u(M.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:C)&&void 0!==e?e:0,height:null!=j?j:0,ellipsis:null==d||d,wordBreak:null!=p?p:"break-word",maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:null!==(i=M.character)&&void 0!==i?i:k},M);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:k},oM),M),x:h,y:c,width:null!==(s=null!=t?t:C)&&void 0!==s?s:0,height:null!=j?j:0,ellipsis:d,wordBreak:p,maxHeight:null!=o?o:O,maxWidth:null!=l?l:g,textConfig:[]},M);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else u(k)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:_(k)?k:[k],whiteSpace:"normal"},M),{maxLineWidth:null!==(r=null!==(n=M.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:C,heightLimit:null!==(a=M.height)&&void 0!==a?a:O,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const H=this._mainTitle?this._mainTitle.AABBBounds.height():0,V=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==T.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=T,v=Math.max(Number.MIN_VALUE,O-H);if("rich"===A||u(T.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:C)&&void 0!==o?o:0,height:null!==(l=null!=e?e:B)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=T.character)&&void 0!==h?h:w},T);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===A){const o=Object.assign({html:Object.assign(Object.assign({dom:w},oM),T),x:n,y:r,width:null!==(c=null!=t?t:C)&&void 0!==c?c:0,height:null!==(d=null!=e?e:B)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},T);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else u(w)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:_(w)?w:[w],whiteSpace:"normal"},T),{maxLineWidth:null!==(p=T.maxLineWidth)&&void 0!==p?p:C,heightLimit:null!==(g=T.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:H}),"text"))}const N=this._subTitle?this._subTitle.AABBBounds.height():0,W=this._subTitle?this._subTitle.AABBBounds.width():0;let U=Math.max(V,W),G=H+(null!==(f=T.height)&&void 0!==f?f:N);if(u(C)&&(U=C),u(B)&&(G=B),u(E)&&UP&&(U=P),u(R)&&GO&&(G=O),z.attribute.width=U,z.attribute.height=G,z.attribute.boundsPadding=F,this._mainTitle){if(u(I)||u(M.align)){const t=M.align?M.align:I,e=null!==(m=M.width)&&void 0!==m?m:U;"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")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:L,e=null!=j?j:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"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")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(u(I)||u(T.align)){const t=T.align?T.align:I,e=null!==(y=null!==(v=T.width)&&void 0!==v?v:M.width)&&void 0!==y?y:U;"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")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=T.verticalAlign?T.verticalAlign:L,e=this._mainTitle?u(j)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),j):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=T.height)&&void 0!==b?b:B)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"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")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};IR.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 LR={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"}}};DA(),tM(),$A();let DR=class extends Jy{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=z({},P(LR,n),e.style,{visible:e.visible});a.lineHeight=u(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=IM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{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,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(u(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),u(s)){const t=G(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e: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 p=PM(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(p>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/p,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",u(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 p=null!==(o=d.space)&&void 0!==o?o:0;if(c+=p,G(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,f=c/2,m=g**2+1,v=2*f*g,_=f**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*m*_))/(2*m))+f),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",u(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;G(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 FR extends wg{constructor(t){super(t)}}var zR,jR;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(zR||(zR={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(jR||(jR={}));class HR extends Jy{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},HR.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"},HR.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"},HR.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},HR.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},HR.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=()=>{d(this._playController)&&(this._playController=new FR(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{d(this._backwardController)&&(this._backwardController=new FR(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{d(this._forwardController)&&(this._forwardController=new FR(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(zR.OnPlay)},this.pause=()=>{this._dispatchEvent(zR.OnPause)},this.forward=()=>{this._dispatchEvent(zR.OnForward)},this.backward=()=>{this._dispatchEvent(zR.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()}}HR.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},HR.defaultAttributes={[jR.Start]:{},[jR.Pause]:{},[jR.Backward]:{},[jR.Forward]:{}};const VR={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},NR=[200,10];var WR,UR;!function(t){t.Default="default",t.Reverse="reverse"}(WR||(WR={})),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"}(UR||(UR={}));const GR=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===WR.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===WR.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),YR=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===WR.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===WR.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),XR=t=>"top"===t||"bottom"===t;class $R extends Jy{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},$R.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=Ut(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(XR(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:NR[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:NR[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 ER(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 t.layout=XR(this._orient)?"horizontal":"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 HR(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=XR(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:NR[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=x(i)?i:Ut(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(XR(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=x(n)?n:Ut(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:XR(this._orient)?t+s:(this._size.width-r)/2,y:XR(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:XR(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:XR(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=x(n)?n:Ut(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:XR(this._orient)?t+s:(this._size.width-r)/2,y:XR(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]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function KR(){SR(),DA(),JA()}$R.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({},VR),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},VR),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},VR),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},VR),{key:"backward",position:"start"})}},KR();class qR extends $R{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:WR.Default},this._initDataIndex=()=>{var t;this._dataIndex=d(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(zR.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(zR.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(zR.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(zR.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(UR.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(GR({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||YR({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===WR.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(UR.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=S_.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(UR.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(UR.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=S_.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(),S_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(UR.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,S_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(UR.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(UR.change),this.dispatchCustomEvent(UR.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var ZR,JR=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())}))};KR();class QR extends $R{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(zR.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(zR.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(zR.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(zR.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(UR.change))},this.play=()=>JR(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(UR.play),this._rafId=S_.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=S_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,S_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(UR.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,S_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(UR.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(UR.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(UR.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.brushActive="brushActive",t.brushClear="brushClear"}(ZR||(ZR={}));const tO={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],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:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},eO=5;const iO={debounce:bt,throttle:xt};DA(),UA();let sO=class t extends Jy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=tO.updateTrigger,endTrigger:i=tO.endTrigger,brushMoved:s=!0}=this.attribute;G(e).forEach((t=>this.stage.addEventListener(t,this._onBrushingWithDelay))),G(i).forEach((t=>this.stage.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos]},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:iO[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(ZR.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const{trigger:t=tO.trigger,resetTrigger:e=tO.resetTrigger}=this.attribute;G(t).forEach((t=>this.stage.addEventListener(t,this._onBrushStart))),G(e).forEach((t=>this.stage.addEventListener(t,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(ZR.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;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,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(ZR.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=eO}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(ZR.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(ZR.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;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._dispatchBrushEvent(ZR.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=eO}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(ZR.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(ZR.brushClear,t)):Math.abs(r-s)this.stage.removeEventListener(t,this._onBrushStart))),G(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents()}_releaseBrushUpdateEvents(){const{updateTrigger:t=tO.updateTrigger,endTrigger:e=tO.endTrigger}=this.attribute;G(t).forEach((t=>this.stage.removeEventListener(t,this._onBrushingWithDelay))),G(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushEnd)))}_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=df.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}_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(Ee(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_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.ythis._brushMaskAABBBoundsDict[t].empty()))}};sO.defaultAttributes=tO;const nO=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return z(t,...e,{shape:i.every(d)?void 0:z({},...i),key:s.every(d)?void 0:z({},...s),value:n.every(d)?void 0:z({},...n)})},rO=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:G(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}},aO={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:nM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:nM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:nM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new He).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},oO=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];DA(),YA(),JA(),tM(),$A();let lO=class t extends Jy{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=ni(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 p=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",z({symbolType:"circle"},p.shape,{visible:vM(p)&&vM(p.shape)}),"symbol"),"object"!=typeof p.value.text||null===p.value.text||"rich"!==p.value.text.type&&"html"!==p.value.text.type?p.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:vM(p)&&vM(p.value)},rO(p.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=p.value.text)&&void 0!==e?e:"",visible:vM(p)&&vM(p.value)},p.value),"text"):"rich"===p.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:vM(p)&&vM(p.value)},rO(p.value)),"richtext"):"html"===p.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:p.value.text.text},oM),p.value),visible:vM(p)&&vM(p.value),width:p.value.width,height:p.value.height,wordBreak:p.value.wordBreak,textAlign:p.value.textAlign,textBaseline:p.value.textBaseline,singleLine:!1,textConfig:[]},p.value),"richtext"));const g=vM(p.shape)?p.shape.size+p.shape.spacing:0,{textAlign:f,textBaseline:m}=p.value,v=n.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",p.height):"middle"===m?this._tooltipTitle.setAttribute("y",p.height/2):this._tooltipTitle.setAttribute("y",0);const _=vM(p)?p.height+p.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(!vM(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 p="right"===c?(o?d:0)+(vM(n.key)?r+n.key.spacing:0)+(vM(n.value)?a:0):0;this._createShape("right"===c?p-n.shape.size/2:p+n.shape.size/2,n,h,l),o&&("right"===c?p-=d:p+=d);const g=this._createKey(n,h,l);g&&(LM(c,g,n.key.textAlign,p,r),g.setAttribute("y",0),"right"===c?p-=r+n.key.spacing:p+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";u(n.value.textAlign)?t=n.value.textAlign:vM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),LM(c,f,t,p,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(vM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=nd(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(vM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},rO(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},rO(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},oM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(vM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},rO(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},rO(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=>oO.includes(t)))?(this._mergeAttributes(e,s),d(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)&&vM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=vM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=EM(d),_=EM(u);let y=0;if(vM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),y=Math.max(y,e)}if(vM(u)){const{width:t,height:e}=_.quickMeasure(u.text);h.push(t),y=Math.max(y,e)}f&&lu[m]&&(t=!0,r.push(p.size),y=Math.max(p.size,y)),e.height=y,o+=y,a{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 nO({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return nO({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};lO.defaultAttributes=aO;const hO=ut;function cO(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:$(i)}function dO(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function uO(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function pO(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 gO(t,e){const i=pO(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 fO(t,e){const i=mO(t),s=mO(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 mO(t,e={x:0,y:0}){return ne.distancePP(t,e)}function vO(t){return k(t.x)&&k(t.y)}function _O(t,e,i){let s=!1;if(e&&c(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 yO(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const bO=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function SO(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&SO(t[i],e)}}var kO,AO,MO;function wO(t){var e,i;const{type:s}=t;return s===AO.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!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.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_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"}(kO||(kO={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",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",t.mosaic="mosaic",t.pictogram="pictogram"}(AO||(AO={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",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.transform="transform",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.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.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(MO||(MO={}));const TO={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},CO={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function BO(t,e){var i;if(!t)return[];const s=DO(t,e);if(!s||_(s))return null!==(i=s)&&void 0!==i?i:[];if(p(s)){const{dataScheme:i}=s;return i?IO(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>OO(i)?PO(t,i,e):i)).filter(u)}))):i.map((i=>OO(i)?PO(t,i,e):i)).filter(u):[]}return[]}function EO(t,e){var i,s;return IO(t)?null!==(s=null===(i=t.find((t=>u(t.isAvailable)?c(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!u(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 PO(t,e,i){var s;const n=DO(t,i);if(!n)return;let r;const{palette:a}=n;if(p(a)&&(r=null!==(s=function(t,e){const i=TO[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=CO[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(d(e.a)&&d(e.l)||!v(r))return r;let o=new ti(r);if(u(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Ge(t,i,s),a=Ue(n,r,e.l),l=new ti(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return u(e.a)&&o.setOpacity(e.a),o.toRGBA()}const RO=(t,e)=>{if(e&&OO(t)){const i=PO(e,t);if(i)return i}return t};function OO(t){return t&&"palette"===t.type&&!!t.key}function IO(t){return!(!_(t)||0===t.length)&&t.every((t=>u(t.scheme)))}function LO(t){return _(t)?{dataScheme:t}:t}function DO(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||d(n))r=null==t?void 0:t.default;else{const a=wO(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 FO extends xB{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(!IO(this._range))return void super.range(this._range);const t=EO(this._range,this._domain);super.range(t)}}const zO={linear:GB,band:AB,point:class extends AB{constructor(t){super(!1),this.type=QC.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:xB,threshold:ZB,colorOrdinal:FO};function jO(t){const e=zO[t];return e?new e:null}function HO(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function VO(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function NO(t){return u(null==t?void 0:t.field)&&u(null==t?void 0:t.scale)}function WO(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function UO(t){return!!v(t)&&(!!t.endsWith("%")&&Ky(t.substring(0,t.length-1)))}function GO(t){return!!p(t)&&("percent"in t||"offset"in t)}function YO(t,e,i,s=0){var n,r;return x(t)?t:UO(t)?Number(t.substring(0,t.length-1))*e/100:c(t)?t(i):p(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function XO(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>x(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]=YO(t[s],e.size,i)}))})),o}function $O(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}}function KO(t){let e={};return _(t)?(d(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),d(t[1])||(e.left=e.right=t[1]),d(t[2])||(e.bottom=t[2]),d(t[3])||(e.left=t[3]),e):x(t)||UO(t)||c(t)||GO(t)?(e.top=e.left=e.bottom=e.right=t,e):p(t)?(e=Object.assign({},t),e):e}function qO(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const ZO=(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},JO=[{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"]}];function QO(t,e){return t&&e.key in t?t[e.key]:e.default}function tI(t){return t&&"token"===t.type&&!!t.key}const eI={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%"},iI={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:JO,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)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:eI,component:{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}}},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:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},sI={name:"dark",colorScheme:{default:{dataScheme:JO,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",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},nI=(t,e)=>t===e||!c(t)&&!c(e)&&(_(t)&&_(e)?e.every((e=>t.some((t=>nI(t,e))))):!(!p(t)||!p(e))&&Object.keys(e).every((i=>nI(t[i],e[i])))),rI=(t,e,i)=>{if(d(e))return t;const s=e[0];return d(s)?t:1===e.length?(t[s]=i,t):(d(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),rI(t[s],e.slice(1),i))},aI=t=>t instanceof Ba||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)))}}(t);function oI(t,e=["data"]){return I(t,aI,e)}function lI(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=LO(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}hI._charts={},hI._series={},hI._components={},hI._graphicComponents={},hI._marks={},hI._regions={},hI._animations={},hI._implements={},hI._chartPlugin={},hI._vChartPlugin={},hI._componentPlugin={},hI.transforms={fields:Gr,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}},hI.dataParser={csv:(t,e={},i)=>(i.type=Ur.DSV,ia(t)),dsv:(t,e={},i)=>{i.type=Ur.DSV;const s=jr(na,e),{delimiter:n}=s;if(!v(n))throw new TypeError("Invalid delimiter: must be a string!");return ea(n).parse(t)},tsv:(t,e={},i)=>(i.type=Ur.DSV,sa(t))},hI._layout={},hI._grammarTransforms={},hI._stageEventPlugins={},hI.registerStageEventPlugin=(t,e)=>{hI._stageEventPlugins[t]=e},hI.getStageEventPlugin=t=>hI._stageEventPlugins[t],hI._interactionTriggers={},hI.registerInteractionTrigger=(t,e)=>{hI._interactionTriggers[t]=e},hI._composedEventMap={},hI.registerComposedEvent=(t,e)=>{hI._composedEventMap[t]=e},hI._tooltipProcessors={},hI.registerTooltipProcessor=(t,e)=>{hI._tooltipProcessors[t]=e},hI.createTooltipProcessor=(t,e)=>{const i=hI._tooltipProcessors[t];return i?new i(e):null};const uI=t=>{const e={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"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},pI=uI(),gI={[iI.name]:iI},fI=iI.name,mI=new Map(Object.keys(gI).map((t=>[t,gI[t]]))),vI=new Map,_I=new Map(Object.keys(gI).map((t=>[t,t===fI]))),yI=(t,e)=>{if(!t)return;const i=kI(e);mI.set(t,i),_I.set(t,!0)},bI=(t=fI)=>(_I.has(t)&&!_I.get(t)&&yI(t,mI.get(t)),mI.get(t)),xI=t=>mI.delete(t)&&vI.delete(t)&&_I.delete(t),SI=t=>!!v(t)&&mI.has(t),kI=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:fI;return cI({},bI(i),t)};class AI{static registerInstance(t){AI.instances.set(t.id,t)}static unregisterInstance(t){AI.instances.delete(t.id)}static getInstance(t){return AI.instances.get(t)}static instanceExist(t){return AI.instances.has(t)}static forEach(t,e=[],i){const s=G(e);return AI.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}AI.instances=new Map;class MI{static registerTheme(t,e){yI(t,e)}static getTheme(t,e=!1){return bI(t)}static removeTheme(t){return xI(t)}static themeExist(t){return SI(t)}static getDefaultTheme(){return MI.themes.get(fI)}static setCurrentTheme(t){MI.themeExist(t)&&(MI._currentThemeName=t,AI.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return MI.getTheme(MI._currentThemeName,t)}static getCurrentThemeName(){return MI._currentThemeName}}function wI(t){return v(t)?MI.themeExist(t)?MI.getTheme(t):{}:p(t)?t:{}}MI.themes=mI,MI._currentThemeName=fI;const TI=["animationThreshold","colorScheme","name","padding"];function CI(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];TI.includes(n)?s[n]=r:f(r)?OO(r)?s[n]=RO(r,e):tI(r)?s[n]=QO(i,r):s[n]=CI(r,e,i):s[n]=r})),s}function BI(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]=BI(t[s],e)}return i}return _(t)?t.map((t=>BI(t,e))):t}function EI(t,e){if(!t)return t;if(f(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(v(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=EI(t[s],e)}return i}return _(t)?t.map((t=>EI(t,e))):t}function PI(t,...e){return c(t)?t(...e):t}const RI=(t,e,i,s)=>((t,e,i)=>EM(t,e,i,{fontFamily:eI.fontFamily,fontSize:eI.fontSize}))(e,i,s).measure(t),OI="__VCHART",II=500,LI=500,DI=`${OI}_MEASURE_CANVAS_ID`,FI=`${OI}_DEFAULT_DATA_INDEX`,zI=`${OI}_DEFAULT_DATA_KEY`,jI=`${OI}_DEFAULT_DATA_SERIES_FIELD`,HI=`${OI}_DEFAULT_SERIES_STYLE_NAME`,VI=`${OI}_STACK_KEY`,NI=`${OI}_STACK_START`,WI=`${OI}_STACK_END`,UI=`${OI}_STACK_START_PERCENT`,GI=`${OI}_STACK_END_PERCENT`,YI=`${OI}_STACK_START_OffsetSilhouette`,XI=`${OI}_STACK_END_OffsetSilhouette`,$I=`${OI}_STACK_TOTAL`,KI=`${OI}_STACK_TOTAL_PERCENT`,qI=`${OI}_STACK_TOTAL_TOP`,ZI=`${OI}_STACK_TOTAL_BOTTOM`,JI=`${OI}_MOSAIC_VALUE_START_PERCENT`,QI=`${OI}_MOSAIC_VALUE_END_PERCENT`,tL=`${OI}_MOSAIC_CAT_START_PERCENT`,eL=`${OI}_MOSAIC_CAT_END_PERCENT`,iL=`${OI}_SEGMENT_START`,sL=`${OI}_SEGMENT_END`,nL=`${OI}_KEY`,rL=`${OI}_MAP_LOOK_UP_KEY`;function aL(t,e){for(let i=0;it.key===e))}function lL(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 hL(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:{groupField:a.groupField,nodes:{}},gL(t,a,n[o],l,e,r))})),s?cL(n):n}function cL(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))):cL(t[e].nodes);return t}function dL(t,e){if("values"in t&&t.values.length){const i=uO(t.values,e),s=dO(t.values,GI);t.values.forEach((t=>{t[$I]=i,t[KI]=s}))}else for(const i in t.nodes)dL(t.nodes[i],e)}function uL(t){if(!t.values.length)return;const e=t.values[t.values.length-1][WI]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)pL(t.nodes[r],e,i,s,n)}function gL(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[WI]=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 l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},u(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),gL(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const fL=(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]=vL(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function _L(t={}){const e=Object.assign({},t);if(c(t.style)?e.style=(e,i,s,n)=>xL(t.style(e,i,s,n)):E(t.style)||(e.style=xL(t.style)),!E(t.state)){const i={};Object.keys(t.state).forEach((e=>{c(t.state[e])?i[e]=(i,s,n,r)=>xL(t.state[e](i,s,n,r)):E(t.state[e])||(i[e]=xL(t.state[e]))})),e.state=i}return e}function yL(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{c(t[i])?e[i]=(e,s,n,r)=>xL(t[i](e,s,n,r)):E(t[i])||(e[i]=xL(t[i]))})),e}function bL(t,e){if(E(t))return null;const i={};return Object.keys(t).forEach((s=>{c(t[s])?i[s]=t[s](e):i[s]=t[s]})),xL(i)}function xL(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:re(t.angle)}):t}const SL=t=>"line"===t||"area"===t,kL=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return SL(i)?e:null==e?void 0:e[0]},AL=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let ML=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},n=hI.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{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(hI.getComposedEvent(t))if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};var wL;!function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(wL||(wL={}));const TL=["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 CL,BL,EL;!function(t){t.initialized="initialized",t.rendered="rendered",t.renderFinished="renderFinished",t.animationFinished="animationFinished",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleRawDomainUpdate="scaleRawDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",t.layoutRectUpdate="layoutRectUpdate",t.playerPlay="playerPlay",t.playerPause="playerPause",t.playerEnd="playerEnd",t.playerChange="playerChange",t.playerForward="playerForward",t.playerBackward="playerBackward",t.scrollBarChange="scrollBarChange",t.brushStart="brushStart",t.brushChange="brushChange",t.brushEnd="brushEnd",t.brushClear="brushClear",t.brushActive="brushActive",t.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.tooltipShow="tooltipShow",t.tooltipHide="tooltipHide",t.tooltipRelease="tooltipRelease",t.afterResize="afterResize",t.afterRender="afterRender",t.afterLayout="afterLayout",t.afterMarkLayoutEnd="afterMarkLayoutEnd",t.afterWordcloudShapeDraw="afterWordcloudShapeDraw"}(CL||(CL={})),function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(BL||(BL={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(EL||(EL={}));const PL=[EL.mark,EL.model,EL.chart,EL.vchart];class RL{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(EL.vchart,[]),this._levelNodes.set(EL.chart,[]),this._levelNodes.set(EL.model,[]),this._levelNodes.set(EL.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const OL={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"};class IL{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=u(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=u(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=P(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>kL(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||BL.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||BL.chart);o.get(t)||o.set(t,new RL);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||BL.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||BL.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||BL.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||BL.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?PL.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[BL.chart,BL.window,BL.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(c(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&P(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 OL[a]&&(a=OL[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))&&(!u(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:u(t.id)?EL.model:EL.vchart:EL.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=xt(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=bt(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=BL.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==EL.model&&s!==EL.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),u(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=EL.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case BL.chart:return this._viewBubbles;case BL.window:return this._windowBubbles;case BL.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case BL.chart:return this._viewListeners;case BL.window:return this._windowListeners;case BL.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return TL.includes(t)||Object.values(wL).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&hI.hasInteractionTrigger(e)}}function LL(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function DL(t,e,i){t.getParser(e)||t.registerParser(e,i)}const FL=new Map;let zL;function jL(){zL||(zL=new Ca,DL(zL,"geojson",Sa),DL(zL,"topojson",Aa),LL(zL,"simplify",Wr))}function HL(t,e,i={type:"geojson",centroid:!0}){FL.has(t)&&jy(`map type of '${t}' already exists, will be overwritten.`),jL();const s=new Ba(zL),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"}):p(r)&&s.transform({type:"simplify",options:r}),FL.set(t,s)}function VL(t){FL.has(t)?FL.delete(t):jy(`map type of '${t}' does not exists.`)}function NL(t,e=!1){let i=e;return t.latestData instanceof Ba&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const WL=(t,e)=>0===t.length?[]:1===t.length?NL(t[0],null==e?void 0:e.deep):t.map((t=>NL(t,null==e?void 0:e.deep)));function UL(t,e,i){LL(e=e instanceof Ca?e:t.dataSet,"copyDataView",WL);const s=new Ba(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:XL.copyDataView}),s}function GL(t,e,i=[]){var s;if(t instanceof Ba)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new Ba(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return jy(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return jy(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!v(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),jy("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function YL(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var XL,$L,KL,qL;!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"}(XL||(XL={})),function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}($L||($L={})),function(t){t.data="data",t.mark="mark"}(KL||(KL={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(qL||(qL={}));const ZL=["line","area","trail"];function JL(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(nL,i?t.slice().sort(i):t.slice()),{keys:[nL],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const QL=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function tD(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{tD(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function iD(t,e,i,s){const n=JL(t,(t=>i(t))),r=JL(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!d(t)){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}}const sD=`${OI}_BuiltIn_CallBack_Disappear`;var nD;!function(t){t.render="render",t.disappear="disappear"}(nD||(nD={}));class rD{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(t,e){this._count=0,this._rootMarks=[],this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(CL.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(CL.afterRender,{chart:this._compileChart})},this._handleAfterNextRender=()=>{var t,e,i,s;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(t=this._compileChart.getEvent())||void 0===t||t.emit(CL.renderFinished,{chart:this._compileChart,vchart:null===(e=this._compileChart.getOption())||void 0===e?void 0:e.globalInstance})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterVRenderDraw)||void 0===s||s.call(i,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=t,this._option=e}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var t,e,i,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:g,background:f}=this._option;S_.setEnv(function(t){switch(t){case s["desktop-browser"]:case s["mobile-browser"]:return"browser";case s.node:case s.worker:return"node";case s.miniApp:case s["desktop-miniApp"]:return"feishu";case s.lynx:return"lynx";case s.wx:return"wx";case s.tt:return"tt";case s.harmony:return"harmony"}return"browser"}(o),null!=l?l:{}),this._stage=null!==(t=this._option.stage)&&void 0!==t?t:new D_(Object.assign({background:f,width:this._width,height:this._height,container:null!==(e=this._container.dom)&&void 0!==e?e:null,canvas:null!==(i=this._container.canvas)&&void 0!==i?i:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:g},ReactDOM:this._option.ReactDOM,autoRefresh:u(r)?r:!u(a)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{})),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const m=Pp({x:0,y:0,width:this._width,height:this._height});m.name="root",this._stage.defaultLayer.appendChild(m),this._rootGroup=m;const v=(u(h)?h:Gy(o))&&!1!==c&&hI.getStageEventPlugin("gesture");v&&(this._gestureController=new v(this._stage,p(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=qL.before}_setCanvasStyle(){if(this._stage&&this._container.dom&&!v(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(S_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=S_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>tD(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>tD(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{tD(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;this._hasCommitedMark()&&(zy(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),this._rootMarks.forEach((t=>{t.render()})),this._layoutState===qL.before&&(this._layoutState=qL.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=qL.reevaluate,this._hasCommitedMark()&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),this.findProgressiveMarks(),this.updateStateAnimation(),this._doRender(!0),this.doPreProgressive(),zy(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=eD(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=iD(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=iD(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=JL(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=JL(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}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];_(s)?e[i]="disappear"===i?s.map((t=>{return"function"==typeof(e=t.callBack)&&/^class\s/.test(e.toString())?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:sD,customParameters:{callBack:t.callBack}});var e})):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{tD(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===$L.appear))?$L.appear:e.every((t=>t===$L.disappear))?$L.disappear:$L.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===BL.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=u(a.context)?a:((t,e)=>{let i=e;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=i.parent,i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=u(l.markId)?l.markId:null,c=u(l.modelId)?l.modelId:null,d=u(l.modelUserId)?l.modelUserId:null,p=u(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:kL(o),markId:h,modelId:c,markUserId:p,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===BL.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===BL.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===BL.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===BL.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===BL.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this.releaseGrammar(!0),this._stage!==(null===(t=this._option)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{tD(t,(t=>{t.removeProduct()}),null,!0)})):this._cachedMarks=eD(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return Uy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&function(t){return bu(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{xo.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()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{tD(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=S_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){S_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function aD(t,i){var s;return e(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==i?void 0:i.onError)&&void 0!==s?s:Hy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function oD(t){t.crosshair=G(t.crosshair||{}).map((e=>lI({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function lD(t,e,i){var s;const{width:n,height:r}=t;if(u(n)&&u(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}=ri(l,i.width,i.height);a=t,o=e}else if(h&&Uy(e.mode)){let t;t=v(h)?S_.getElementById(h):h;const{width:e,height:s}=ri(t,i.width,i.height);a=e,o=s}else if(Yy(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 hD(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function cD(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}}const dD=9,uD=0,pD=-1;var gD,fD,mD,vD,_D,yD;!function(t){t[t.SeriesGroup=0]="SeriesGroup",t[t.Axis_Grid=50]="Axis_Grid",t[t.CrossHair_Grid=100]="CrossHair_Grid",t[t.Region=450]="Region",t[t.Mark=300]="Mark",t[t.Node=400]="Node",t[t.Axis=100]="Axis",t[t.MarkLine=500]="MarkLine",t[t.MarkArea=100]="MarkArea",t[t.MarkPoint=500]="MarkPoint",t[t.DataZoom=500]="DataZoom",t[t.ScrollBar=500]="ScrollBar",t[t.Player=500]="Player",t[t.Legend=500]="Legend",t[t.CrossHair=500]="CrossHair",t[t.Indicator=500]="Indicator",t[t.Title=500]="Title",t[t.Label=500]="Label",t[t.Brush=500]="Brush",t[t.CustomMark=500]="CustomMark",t[t.Interaction=700]="Interaction"}(gD||(gD={})),function(t){t[t.Indicator=10]="Indicator",t[t.Region=20]="Region",t[t.Axis=30]="Axis",t[t.DataZoom=40]="DataZoom",t[t.Player=40]="Player",t[t.ScrollBar=40]="ScrollBar",t[t.Legend=50]="Legend",t[t.Title=70]="Title",t[t.CustomMark=70]="CustomMark"}(fD||(fD={})),function(t){t[t.Default=0]="Default",t[t.Theme=1]="Theme",t[t.Chart=2]="Chart",t[t.Base_Series=3]="Base_Series",t[t.Series=4]="Series",t[t.Mark=5]="Mark",t[t.User_Chart=6]="User_Chart",t[t.User_Series=7]="User_Series",t[t.User_Mark=8]="User_Mark",t[t.User_SeriesStyle=9]="User_SeriesStyle",t[t.Built_In=99]="Built_In"}(mD||(mD={}));class bD{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){d(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,z({},bD.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=G(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]))))}}bD.defaultMarkInfo={};class xD{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class SD{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=>lI({},i,s,t);return _(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 kD extends xD{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}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=SD,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new bD,this._lastLayoutRect=null,this.id=$y(),this.userId=t.id,this._spec=t,this.effect={},this.event=new ML(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){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}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){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_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){u(t)&&u(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e){if(!u(t)||!u(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${OI}_${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(e,i={},s){const{type:n,name:r}=e,{parent:a}=i,o=t(i,["parent"]),l=hI.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_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(!d(e))return P(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}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class AD{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}get lastComputeRect(){return this._lastComputeRect}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}get willLayoutTag(){return this._willLayoutTag}constructor(t,e){var i;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=fD.Region,this._willLayoutTag=!0,this._model=t,this._option=e,this.layoutLevel=e.layoutLevel,this.layoutType=e.layoutType,e.layoutOrient&&(this.layoutOrient=e.layoutOrient),this._spec=null===(i=null==t?void 0:t.getSpec)||void 0===i?void 0:i.call(t)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){let a=XO(KO(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=d(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:YO(t.minHeight,e.height,e),this._maxHeight=d(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:YO(t.maxHeight,e.height,e),this._minWidth=d(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:YO(t.minWidth,e.width,e),this._maxWidth=d(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:YO(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:YO(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:YO(t.height,e.height,e)},{height:9}),d(t.offsetX)||(this.layoutOffsetX=YO(t.offsetX,e.width,e)),d(t.offsetY)||(this.layoutOffsetY=YO(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){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{d(this._spec[i])||(e[i]=YO(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};d(s)||(r.width-=s),d(n)||(r.width-=n),d(e)||(r.height-=e),d(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):(d(s)?d(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,d(e)?d(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?(d(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),d(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(d(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),d(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($O(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class MD extends kD{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,this._transformLayoutPadding=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 AD(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&N(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.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 wD extends SD{_initTheme(t,e){return{spec:t,theme:this._theme}}}class TD extends MD{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(t,e){var i;super(t,e),this.transformerConstructor=wD,this.modelType="region",this.specKey="region",this.type=TD.type,this._series=[],this.layoutType="region",this.layoutZIndex=gD.Region,this.seriesDataFilterOver=()=>{this.event.emit(CL.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=t.id,this.coordinate=null!==(i=t.coordinate)&&void 0!==i?i:"cartesian"}_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 t,e;this.initLayout(),super.created();const i=null!==(t=this._spec.clip)&&void 0!==t?t:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(e=this.userId)&&void 0!==e?e:this.type)+"_interaction",gD.Interaction),E(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",mD.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:gD.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:gD.Mark+1}))}_createGroupMark(t,e,i){var s,n;const r=this._createMark({type:"group",name:t});r.setUserId(e),r.setMarkConfig({zIndex:i});const a=null!==(s=this._spec.clip)&&void 0!==s?s:this._getClipDefaultValue();return this.setMarkStyle(r,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:a},"normal",mD.Built_In),this.setMarkStyle(r,{cornerRadius:null===(n=this._spec.style)||void 0===n?void 0:n.cornerRadius},"normal",mD.User_Mark),this._marks.addMark(r),r}init(t){super.init(t),this.initMark(),this.initSeriesDataflow()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var t,e;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(t=this._spec.style)||void 0===t?void 0:t.fill)?1:0},this._spec.style),"normal",mD.User_Mark),(null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",mD.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0,pickable:!1}),"normal",mD.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return N(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||G(t.userId).includes(e.userId))&&(!u(t.specIndex)||G(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})}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=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function CD(t){const e=[],i=[],s=[];return t.forEach((t=>{d(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 BD(t,e,i){e?t.forEach((t=>{const e=Y(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=Y(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 ED(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 PD(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=LD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),ED(d,!0,p,l),s&&BD(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function RD(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=LD(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=LD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),ED(d,!1,p,o),s&&BD(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function ID(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=LD(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_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){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_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,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=LD(t,this,e);"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,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=CD(t);n.length&&PD(n,e,i,!1,"left",s),r.length&&PD(r,e,i,!0,"left",s),a.length&&RD(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=CD(t);n.length&&OD(n,e,i,!1,"top",s),r.length&&OD(r,e,i,!0,"top",s),a.length&&ID(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=CD(t);n.length&&PD(n,e,i,!1,"right",s),r.length&&PD(r,e,i,!0,"right",s),a.length&&RD(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=CD(t);n.length&&OD(n,e,i,!1,"bottom",s),r.length&&OD(r,e,i,!0,"bottom",s),a.length&&ID(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=LD(t,this,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=>{N(i.getLayoutRect(),e.rect)||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{rect:i}=LD(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);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+c-l})}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+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&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:Hy)("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}}}DD.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(vD||(vD={})),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",t.STATE_HIGHLIGHT="highlight",t.STATE_BLUR="blur",t.STATE_ACTIVE="active"}(_D||(_D={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(yD||(yD={}));const FD=["linear","radial","conical"],zD={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const jD={};Object.values(_D).forEach((t=>{jD[t]=!0})),_D.STATE_HOVER,_D.STATE_HOVER_REVERSE,_D.STATE_SELECTED,_D.STATE_SELECTED_REVERSE,_D.STATE_DIMENSION_HOVER,_D.STATE_DIMENSION_HOVER_REVERSE;class HD extends xD{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(z(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class VD extends HD{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];u(s.domain)&&(n.domain=s.domain),u(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:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||(t=this._mark.type,ZL.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(u(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!jD[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(_(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(OI)));i=t.datums.some((t=>e&&_(null==t?void 0:t.items)?n.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])})):n.every((e=>(null==t?void 0:t[e])===(null==s?void 0:s[e])))))}else if(p(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(OI))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(eB(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class ND extends xD{constructor(){super(...arguments),this.id=$y(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=hI.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class WD extends ND{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}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._data=null,this._data=e}removeProduct(){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const UD=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,GD=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=UD(l.delay,n,a,o),d=UD(l.duration,n,a,o),u=UD(l.oneByOne,n,a,o),p=UD(l.splitPath,n,a,o),g=k(u)&&u>0?t=>x(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)?NT:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:WT)(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);zT(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{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)?NT:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:WT)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>IT(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>DT(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:$o.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 FT({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:BT,null!==(l=i.easing)&&void 0!==l?l:ET))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:$o.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new jT({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:BT,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:ET))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):zT(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},YD=(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))))},XD=t=>{const e=t.getMarkConfig();if(u(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}};class $D extends ND{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){u(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t){d(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&u(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];_(n)?s[e]=n.map(i):u(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=G(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=G(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new WD(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(u(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}d(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else u(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=Pp("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){d(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(){this._product&&this._product.parent&&this._product.parent.removeChild(this._product),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(t,e){var i;super(e),this.type=void 0,this.name="mark",this._markConfig={zIndex:gD.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Nl)),i&&(c(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==vD.enter&&t.context.diffState!==vD.update||(t.stateProxy=(e,i)=>{var s;return this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)},t.context.states&&t.useStates(t.context.states,e))},this.name=t,this.model=e.model,this.key=e.key,this.state=new VD(e,this),this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(u(t.id)&&(this._userId=t.id),h(t.interactive)&&(this._markConfig.interactive=t.interactive),u(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),h(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_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,re)}isUserLevel(t){return[mD.User_Mark,mD.User_Series,mD.User_Chart,mD.User_SeriesStyle].includes(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];d(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}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){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[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"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;u(r)&&r<=s&&lI(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(iB(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return v(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=jO(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),e.clamp&&t.clamp&&t.clamp(e.clamp))}(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=c(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):FD.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):iB(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t){t.style&&this.setStyle(t.style,"normal",mD.User_Mark);const e=t.state;e&&Object.keys(e).forEach((t=>{const i=e[t];if("style"in i){const e=i.style;let s={stateValue:t};"level"in i&&(s.level=i.level),"filter"in i&&(s=c(i.filter)?Object.assign({filter:i.filter},s):Object.assign(Object.assign({},i.filter),s)),this.state.addStateInfo(s),this.setStyle(e,t,mD.User_Mark)}else this.setStyle(i,t,mD.User_Mark)}))}_computeGradientAttr(e){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=e,d=t(e,["gradient","scale","field"]);let p=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(p=t),g||(g=e)}const f=EO(BO(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},zD[o]),d);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==p?void 0:p.scale(t[g]);return c(n)&&(a=n(t,this._attributeContext,i)),u(s)&&(a=ti.SetOpacity(a,s)),{offset:c(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):c(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(e){const{scale:i,field:s}=e,n=t(e,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];c(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)FD.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=EO(BO(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return JL(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return hI.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=c(this.key)?this.key:u(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[zI],this._groupKeyGetter=u(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=JL(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===$L.appear))?$L.appear:t.every((t=>t===$L.disappear))?$L.disappear:t[0];return null!=e?e:$L.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{XD(t),s.push(...t.getGraphics())})),e.forEach((t=>{XD(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);GD([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=YD(e,n),r=YD(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===$L.exit?$L.exit:i===$L.update?$L.update:$L.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===vD.exit&&(t.context.reusing=!0,t.animates&&t.animates.forEach((t=>t.stop())))}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===vD.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,u,p,g;let f,m;return d(e)?(f=this._graphicMap.get(t),f&&(m=vD.exit)):d(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=vD.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=vD.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(u=f.context)||void 0===u?void 0:u.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=$L.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=$L.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return QL(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=QL(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(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||(!!c(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach(((t,e)=>{var i,n;let r=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i.update,t);null===(n=t.currentStates)||void 0===n||n.forEach((e=>{var i;const s=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i[e],t);r=Object.assign(Object.assign({},r),s)})),d(this._markConfig.interactive)||(r.pickable=this._markConfig.interactive);const a=this._transformGraphicAttributes(t,r,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=a}))}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r,a;const o=i.context.finalAttrs,l=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=AL(i,o);i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes({}),i.context.reusing=!1):l||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),!(null===(a=this.renderContext)||void 0===a?void 0:a.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i),e&&i.setFinalAttributes(o)}else{const a=i;i=this._createGraphic(o),e&&(null===(n=i.setFinalAttributes)||void 0===n||n.call(i,o)),i.context=a.context,i.context.diffAttrs=o,i.stateSort=this._stateSort;const l=this._graphics===t?s:s+this._graphics.length-t.length;if(l>=0&&(this._graphics[l]=i),null===(r=this.renderContext)||void 0===r?void 0:r.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,l),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const t={};Object.keys(this.stateStyle).forEach((e=>{if(e===_D.STATE_NORMAL){const{groupStyles:i,updateStyles:s}=this._separateNormalStyle(this.stateStyle[e]);t.group=this._getEncoderOfStyle(e,i),t.update=this._getEncoderOfStyle(e,s)}else t[e]=this._getEncoderOfStyle(e,this.stateStyle[e])})),this._encoderOfState=t}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(d(e)||(t.zIndex=e),d(i)||(t.clip=i),!d(s)){const e=_(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return d(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=hI.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=hI.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=G(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===qL.before||(this._product||this._initProduct(),zy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{"in"===this.state.checkOneState(i,i.context.data,e)?i.addState(t,!0,this.hasAnimationByState("state")):i.removeState(t,this.hasAnimationByState("state"))}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===vD.exit&&!e.isExiting)if(e.context.animationState===vD.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:vD.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=Pp({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||p(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{t.clearStates()}))}}var KD;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(KD||(KD={}));class qD extends $D{constructor(){super(...arguments),this.type=qD.type,this._marks=[],this._diffState=vD.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(jy("Mark already exists, add mark failed."),!1):(this._marks.push(t),!0)}removeMark(t){const e=this._marks.findIndex((e=>e.id===t.id||e.name===t.name));return-1===e?(jy("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInUserId(t){let e;return tD(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.diffState===vD.update){const t=this.hasAnimation(),e=AL(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e)),t&&this._product.setFinalAttributes(i)}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=vD.update}render(){this._isCommited&&(zy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct()}}qD.type="group";const ZD={measureText:RI};class JD{static instance(){return JD.instance_||(JD.instance_=new JD),JD.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 QD{constructor(){this.id=$y(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?jy("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class tF extends QD{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)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const eF={type:"fadeIn"};function iF(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 eF;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}class sF extends MT{constructor(t,e,i,s,n){super(t,e,i,s,n),this.currentAnimationRatio=0,this.animationTime=0}onUpdate(t,e,i){super.onUpdate(t,e,i),this.currentAnimationRatio=e,this.animationTime=e*Math.PI*2}getAnimationTime(){return this.currentAnimationRatio>0?this.animationTime:Date.now()/1e3}afterStageRender(t,e){var i,s;return null===(s=null===(i=this.params)||void 0===i?void 0:i.callBack)||void 0===s?void 0:s.call(i,t,e,this.currentAnimationRatio,this.animationTime)}}const nF={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"},state:{duration:300,easing:"linear"}},rF={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},aF={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},oF=()=>{hI.registerAnimation("scaleInOut",(()=>rF))},lF=()=>{hI.registerAnimation("fadeInOut",(()=>aF))},hF=(t,e)=>({appear:iF(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:XT,duration:nF.update.duration,easing:nF.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),cF=()=>{hI.registerAnimation("line",hF)},dF=()=>{uT.registerBuiltInAnimate("growPointsIn",dC),uT.registerBuiltInAnimate("growPointsOut",uC),uT.registerBuiltInAnimate("growPointsXIn",gC),uT.registerBuiltInAnimate("growPointsXOut",fC),uT.registerBuiltInAnimate("growPointsYIn",vC),uT.registerBuiltInAnimate("growPointsYOut",_C),uT.registerBuiltInAnimate("clipIn",qT),uT.registerBuiltInAnimate("clipOut",ZT)},uF=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};_D.STATE_HIGHLIGHT,_D.STATE_BLUR;class pF{constructor(t){this._markSet=new bD,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){_(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.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 gF={highlightState:_D.STATE_HIGHLIGHT,blurState:_D.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class fF extends pF{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},gF,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return v(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll(e)}}fF.type="element-highlight",fF.defaultOptions=gF;const mF=()=>{hI.registerInteractionTrigger(fF.type,fF)},vF={state:_D.STATE_SELECTED,trigger:"click"};class _F extends pF{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},vF,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=G(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):v(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):x(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(_(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),t.addState(i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll(e)}}_F.type="element-select",_F.defaultOptions=vF;const yF=()=>{hI.registerInteractionTrigger(_F.type,_F)};class bF extends QD{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class xF{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>hI.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>hI.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>hI.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return hI.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>hI.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){hI.registerTransform(t,e)}static registerFunction(t,e){t&&e&&JD.instance().registerFunction(t,e)}static unregisterFunction(t){t&&JD.instance().unregisterFunction(t)}static getFunction(t){return t?JD.instance().getFunction(t):null}static getFunctionList(){return JD.instance().getFunctionNameList()}static registerMap(t,e,i){const s=hI.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=hI.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,FL.get(e);var e}static registerSVG(t,e,i){const s=hI.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=hI.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){AI.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}get event(){return this._event}getDataSet(){return this._dataSet}constructor(e,i){var n,r,a,o,l,h,c,d,p;this.id=$y(),this._userEvents=[],this._autoSize=!0,this._option={mode:s["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._renderState=nD.render,this._disableDimensionHoverEvent=!1,this._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))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;N(n.theme,this._spec.theme)?N(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=hD(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?hI.getSeriesBuiltInTheme(e):hI.getComponentBuiltInTheme(e);i=i?lI({},s,i[e]):s}s===t.length-1&&u(i)&&(i=CI({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},SO(i),this._option=Object.assign(Object.assign({},this._option),i),(null==i?void 0:i.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),i.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:_,stage:y,poptip:b}=g,x=t(g,["dom","renderCanvas","mode","stage","poptip"]),S=Uy(_);if(S?nx(yo):"node"===_&&NS(yo),S&&f&&(this._container=v(f)?S_.getElementById(f):f),m&&(this._canvas=m),y&&(this._stage=y),"node"!==_&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=MI.getCurrentThemeName(),this._setNewSpec(e),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const k=[];!1!==b&&k.push("poptipForText"),"sankey"===e.type&&k.push("scrollbar");const A=new rt(null!==(a=this._option.logLevel)&&void 0!==a?a:nt.Error);rt.setInstance(A),(null===(o=this._option)||void 0===o?void 0:o.onError)&&A.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._compiler=new rD({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:y,pluginList:k},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new IL(this,this._compiler),this._event=new ML(this._eventDispatcher,_),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=e.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),AI.registerInstance(this),null===(p=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===p||p.call(d,this)}_setNewSpec(t,e){return!!t&&(v(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=lI({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=BI(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;xF.getFunctionList()&&xF.getFunctionList().length&&(t=EI(t,xF)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=hI.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=hI.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(t){var e,i,s;if(!this._compiler)return void(null===(e=this._option)||void 0===e||e.onError("compiler is not initialized"));if(this._chart)return void(null===(i=this._option)||void 0===i||i.onError("chart is already initialized"));const n=hI.createChart(t.type,t,this._getChartOption(t.type));n?(this._chart=n,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(this._chartSpecTransformer),this._chart.init(),this._event.emit(CL.initialized,{chart:n,vchart:this})):null===(s=this._option)||void 0===s||s.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindViewEvent(){var t,e;this._compiler&&(null===(e=null===(t=this._compiler.getStage())||void 0===t?void 0:t.getTimeline())||void 0===e||e.on("animationEnd",(()=>{this._event.emit(CL.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=xt(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.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 lD(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:II,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:LI})}_initDataSet(t){this._dataSet=t instanceof Ca?t:new Ca,DL(this._dataSet,"dataview",Ma),DL(this._dataSet,"array",i),LL(this._dataSet,"copyDataView",WL);for(const t in hI.transforms)LL(this._dataSet,t,hI.transforms[t]);for(const t in hI.dataParser)DL(this._dataSet,t,hI.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return c(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake?(null===(n=this._compiler)||void 0===n||n.releaseGrammar(),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.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.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),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),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(this._event.emit(CL.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return e(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return e(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?$L.none:$L.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}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._cachedProcessedTheme=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,AI.unregisterInstance(this)}updateData(t,i,s,n){return e(this,void 0,void 0,(function*(){return this.updateDataSync(t,i,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):_(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return e(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=G(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._reSetRenderState(),d(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=G(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=G(this._spec.data);return G(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof Ba?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,u(n)&&(a.parser=n),u(r)&&(a.fields=r));else{const e=GL(t,this._dataSet,s);_(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,i=!0){return e(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,i)}))}updateSpec(t,i=!1,s,n){return e(this,void 0,void 0,(function*(){const e=this._updateSpec(t,i,n);return e?(yield this.updateCustomConfigAndRerender(e,!1,{morphConfig:s,transformSpec:e.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,i,s=!1,n){return e(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,i,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(v(e)&&(e=JSON.parse(e)),c(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(p(e))e.type===n&&(_(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?lI({},t[n][e.index],i):i):t[n]=s?lI({},t[n],i):i);else if(_(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?lI({},t[n][r],i):i)}else t.id===e&&(t[n]=s?lI({},t[n],i):i)}))}(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=lI({},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,i){return e(this,void 0,void 0,(function*(){return this.resizeSync(t,i)}))}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),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,this),!0)}_afterResize(){return this._isReleased||this._event.emit(CL.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)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=cI({},e,e.chart[t])),e};let l;if(E(n)&&E(r))l=wI(this._currentThemeName),this._currentTheme=o(a,l);else{const t=cI({},wI(p(r)&&r.type?r.type:p(n)&&n.type?n.type:this._currentThemeName),wI(n),wI(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),z(WM.poptip,NM,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;d(this._spec.width)?!d(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),d(this._spec.height)?!d(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!Uy(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||p(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return wI(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return e(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!MI.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),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}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(n.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=u(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(n.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(n.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(n.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return e(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield aD(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var i,s;return e(this,void 0,void 0,(function*(){if(!Uy(this._option.mode))return void(null===(i=this._option)||void 0===i||i.onError(new TypeError("non-browser environment can not export img")));const e=yield this.getDataURL();e?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,e):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;this._chart.resetLayoutItemTag(),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(u(this._container))return this._container;let e;return e=v(this._canvas)?S_.getElementById(this._canvas):this._canvas,u(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)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(E(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(u(r)?o=this._chart.getSeriesInUserId(r):u(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?qO(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||d(t)||E(e))return null;if(!_(t)){const{axisId:n,axisIndex:r}=e;let a;if(u(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):u(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return jy("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return u(r)?o=this._chart.getSeriesInUserId(r):u(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?qO(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(jy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return JD.instance().getFunction(t)}registerFunction(t,e){t&&e&&JD.instance().registerFunction(t,e)}unregisterFunction(t){t&&JD.instance().unregisterFunction(t)}getFunctionList(){return JD.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(n.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,r;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(r=this._chart)||void 0===r?void 0:r.getComponentsByType(n.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=hI.getChartPlugins();t.length>0&&(this._chartPlugin=new tF(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=hI.getVChartPlugins();e.length>0&&(this._vChartPlugin=new bF(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||s["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_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,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=nD.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){this._renderState=nD.render,this.getStage().eventSystem.resumeTriggerEvent()}}xF.InstanceManager=AI,xF.ThemeManager=MI,xF.globalConfig={uniqueTooltip:!0},xF.Utils=ZD,xF.vglobal=S_;hI.registerRegion("region",TD),hI.registerLayout("base",DD),qA(),DA(),hI.registerMark(qD.type,qD),hI.registerStageEventPlugin("gesture",Tb),mF(),yF(),yI(sI.name,sI);const SF="monotone",kF="linear",AF="bevel";var MF;function wF(t,e){return e("component",t)}function TF(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=hI.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}!function(t){t.vertical="vertical",t.horizontal="horizontal"}(MF||(MF={}));const CF=(t,e,i,s)=>{if(d(t[e]))return;const n=_(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},BF=(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(c(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(d(i))for(let i=0;i(l(t),t)))},EF="2.0.20",PF=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},RF=(t,e,i,s)=>{let n;if(n=c(t)?t(e,i):f(t)&&u(t.field)?P(e,t.field):t,s){const{formatFunc:i,args:r}=TF(void 0,s,t,e);i&&r&&(n=i(...r))}return n},OF=(t,e,i)=>d(t)?t:c(t)?t(e,i):t;const IF=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(_(e.activeType)?e.activeType.includes(t):e.activeType===t)));function LF(e,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=d(i.key)&&d(i.value)&&!E(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:p,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:_}=l,y=t(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=FF(RF(h,r,a,c),p,g),o.value=FF(RF(f,r,a,m),v,_),Object.keys(y).forEach((t=>{o[t]=RF(l[t],r,a)})),!1!==o.visible&&(u(o.key)||u(o.value))&&e.push(o)}};_(i)?i.forEach((t=>{o(t)})):o(i)}function DF(t,e,i,s,n,r,a){if(c(e)){LF(t,e(n,a),i,s,r,a)}else e&&LF(t,e,i,s,r,a)}const FF=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=gi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class zF{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:u(n)?G(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(u(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 G(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(u(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.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{_(t)?t.forEach((t=>{DF(a,t,e,i,s,n,r)})):c(t)?DF(a,t,e,i,s,n,r):t&&LF(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=c(e)?e(s,n):e;if(r?d(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){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}(s),e={visible:RF(r.visible,t,n),value:FF(RF(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:RF(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=RF(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&IF(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const jF={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}},HF=(t,e)=>{var i,s;let n=e.fields;if(c(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=aL([],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 VF(a,n,o)},VF=(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&&t.forEach((t=>{t&&n.push(t[a])}));const u=n.length;if(h){r.length=0,n.forEach(((t,e)=>{Ky(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===u}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{Ky(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&&!0===o.lockStatisticsByDomain&&!d(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=jF[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},NF=(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=>{Ky(t[e])||(t[e]=0)}))})),t},WF=`${OI}_HIERARCHY_DEPTH`,UF=`${OI}_HIERARCHY_ROOT`,GF=`${OI}_HIERARCHY_ROOT_INDEX`;function YF(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function XF(t,e,i){t&&(i.needDefaultSeriesField&&(t[jI]=i.defaultSeriesField),t[FI]=e,t[zI]=i.getKey(t,e,i))}function $F(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function KF(t,e,i,s=0,n,r){void 0===r&&(r=e),XF(t,e,i),t[WF]=s,t[UF]=n||t[i.categoryField],t[GF]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>KF(e,s,i,t[WF]+1,t[UF],r)))}const qF={label:{name:"label",type:"text"}},ZF=`${OI}_rect_x`,JF=`${OI}_rect_x1`,QF=`${OI}_rect_y`,tz=`${OI}_rect_y1`,ez={data:!0},iz={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},sz=[...Object.keys(nF),"normal"];function nz(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=_(a)?a.map(((t,e)=>{var s;let n=t;return hz(n)&&delete n.type,n.oneByOne&&(n=az(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:oz,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=lI({},o[e],a);return hz(n)&&delete n.type,n.oneByOne&&(n=az(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:oz,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function rz(t,e,i){var s,n,r,a,o,l;const h={};return u(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),u(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),u(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),u(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),u(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),u(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=I(t,null,i),cz(t,(t=>{var i;if(c(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function az(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=c(n)?n(t,i,a):k(n)?n:0,h=c(r)?r(t,i,a):k(r)?r:0;let d=c(s)?s(t,i,a):s;return!1===d?h:(d=!0===d?0:d,h+o*(l+d))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=c(n)?n(t,r,o):k(n)?n:0,d=c(a)?a(t,r,o):k(a)?a:0;let u=c(s)?s(t,r,o):s;if(!1===u)return d;return u=!0===u?0:u,d+((i?i():r.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function oz(t,e){var i;return null!==(i=null==t?void 0:t[FI])&&void 0!==i?i:e.context.graphicIndex}function lz(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 hz(t){return!function(t){return u(t.timeSlices)}(t)&&u(t.channel)}function cz(t,e,i=[]){if(_(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),cz(t[n],e,i)}));else if(p(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),cz(t[s],e,i))}function dz(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class uz extends SD{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=G(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=wO(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=hI.getSeriesMarkMap(o)?function(t,e,i){const s=hI.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=lI({},i("mark",G(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return lI({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_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){h(t.stack)&&(this.stack=t.stack),h(t.percent)&&(this.stack=t.percent||this.stack),d(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;G(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:d=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(c(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&d)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,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 u(s)&&(i.outerRadius=s),u(n)&&(i.innerRadius=n),u(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=lI({},i,s,t),n=i.label;return n&&p(n)&&_(e.label)&&(e.label=e.label.map((t=>lI({},n,t)))),e};return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class pz extends kD{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){u(t)&&(this._seriesField=t)}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:`${OI}_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=uz,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=gD.SeriesGroup,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(CL.afterInitData,{model:this}),this.initRootMark(),this.initMark();const t=dz(this);this._initExtensionMark({hasAnimation:t}),this.initMarkStyle(),this.initMarkState(),t&&this.initAnimation(),this.afterInitMark(),this.initEvent(),this.event.emit(CL.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 d(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),u(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)&&(LL(this._rawData.dataSet,"invalidTravel",NF),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;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=GL(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=UL(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=UL(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new WD(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(d(this._rawStatisticsCache[t].min)||d(this._rawStatisticsCache[t].max))||!e&&d(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=$(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=VF(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=z(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){LL(this._dataSet,"dimensionStatistics",HF);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new Ba(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&&aL(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){LL(this._dataSet,"dimensionStatistics",HF);const s=new Ba(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=aL(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&aL(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new Ba(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 d(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)}`)}:v(t)?e=>e[t]:_(t)&&t.every((t=>v(t)))?e=>t.map((t=>e[t])).join("-"):c(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)&&(LL(this._rawData.dataSet,"addVChartProperty",PF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:YF.bind(this),call:XF}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){var e;null===(e=this._rawDataStatistics)||void 0===e||e.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(CL.rawDataUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(CL.viewDataFilterOver,{model:this})}viewDataUpdate(t){var e;this.event.emit(CL.viewDataUpdate,{model:this}),null===(e=this._data)||void 0===e||e.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(CL.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||d(e)?null:t[e]}getDatumPositionValues(t,e){return!t||d(e)?[]:v(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;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.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(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:u(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(u(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=nz({},rz(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)}))),!d(t.dataId)||!d(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(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:u(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseDefaultInteractionConfig(t){if(!(null==t?void 0:t.length))return[];const e=(i=this._option.mode)===s["desktop-browser"]||i===s["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:Gy(i)||Yy(i)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var i;let n=Object.assign({},null==e?void 0:e.hover),r=Object.assign({},null==e?void 0:e.select);const a=this._spec.hover;h(a)?n.enable=a:p(a)&&(n.enable=!0,n=lI(n,a));const o=this._spec.select;h(o)?r.enable=o:p(o)&&(r.enable=!0,r=lI(r,o));const l=[{trigger:{type:"dimension-hover"},marks:t}];if(n.enable){const e=uF(n,t);e.length&&l.push({trigger:this._defaultHoverConfig(n),marks:e})}if(r.enable){const e=uF(r,t);e.length&&l.push({trigger:this._defaultSelectConfig(r),marks:e})}return l}_defaultHoverConfig(t){return{type:"element-highlight",trigger:t.trigger,triggerOff:t.triggerOff,blurState:_D.STATE_HOVER_REVERSE,highlightState:_D.STATE_HOVER}}_defaultSelectConfig(t){const e="multiple"===t.mode,i=u(t.triggerOff)?t.triggerOff:e?["empty"]:["empty",t.trigger];return{type:"element-select",trigger:t.trigger,triggerOff:i,reverseState:_D.STATE_SELECTED_REVERSE,state:_D.STATE_SELECTED,isMultiple:e}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=uF(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}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:jI;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:HI,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],u(o)?o:t.getAttribute(e,s)}})),this.setMarkStyle(t,a,HI,mD.User_SeriesStyle)}))}afterInitMark(){this.event.emit(CL.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{var e,i;(null===(i=null===(e=t.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&t.setAttribute("stroke",this.getColorAttribute(),"normal",mD.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.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()}initTooltip(){this._tooltipHelper=new zF(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||e.visible!==t[i].visible))?i.reMake=!0:!i.reCompile&&e.some(((e,i)=>!N(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!N(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},ez),iz),i),{extensionMark:!0,label:!0,totalLabel:!0});return this._compareExtensionMarksSpec(G(t.extensionMark),G(e.extensionMark),s),!s.reMake&&this._compareLabelSpec(G(t.label),G(e.label),s),!s.reMake&&this._compareLabelSpec(G(t.totalLabel),G(e.totalLabel),s),s.reMake?s:(!s.reCompile&&this._marks.getMarks().some((i=>{var s,n;return r[i.name]=!0,(null===(s=e[i.name])||void 0===s?void 0:s.visible)!==(null===(n=t[i.name])||void 0===n?void 0:n.visible)}))&&(s.reCompile=!0),!s.reCompile&&n.some((i=>iz[i]&&!N(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!N(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Ba||YL(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();dz(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),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:jI,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new FO).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return BO(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:jI}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:p={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:_=!1}=e,y=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:_,parent:!1!==m?null!=m?m:this._rootMark:null});if(u(y)){const e=this.getSpec()||{};this._marks.addMark(y,{name:t.name}),v&&(this._seriesMark=y),d(f)?y.setData(this._data):!1!==f&&y.setDataView(f),y.setSkipBeforeLayouted(!1!==c),d(h)||y.setGroupKey(h);const l=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:null!==(s=i.morph)&&void 0!==s&&s,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(n=i.support3d)&&void 0!==n?n:e.support3d||!!e.zField,morphKey:(null===(r=e.morph)||void 0===r?void 0:r.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});y.setMarkConfig(l),this.initMarkStyleWithSpec(y,lI({},p,g||e[y.name]))}return y}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:zI}_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!==WI&&t!==GI&&t!==NI&&t!==UI||(t=this.getStackValueField()),null!==(e=lL(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>Ky(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:jI]}}function gz(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();eB(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 fz(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}}}pz.mark=qF,pz.transformerConstructor=uz;class mz extends pz{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=G(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=G(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&G(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);eB(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:`${OI}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?G(this._spec.xField)[0]:G(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(WI),this.setFieldX2(NI)):(this.setFieldY(WI),this.setFieldY2(NI))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(GI),this.setFieldX2(UI)):(this.setFieldY(GI),this.setFieldY2(UI))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(XI),this.setFieldX2(YI)):(this.setFieldY(XI),this.setFieldY2(YI))}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=G(this._spec.xField),this._specYField=G(this._spec.yField),u(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(),u(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(G(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(G(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(CL.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)&&(gz("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()!==n.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==n.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)}}function vz(t){return"bottom"===t||"top"===t}function _z(t){return"left"===t||"right"===t}function yz(t){return"z"===t}function bz(t,e){return WO(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function xz(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function Sz(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?vz(t)?"linear":"band":vz(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${n.cartesianAxis}-${s}`}}const kz=(t,e,i)=>{var s;const n=null!==(s="band"===e?wF("axisBand",i):["linear","log","symlog"].includes(e)?wF("axisLinear",i):{})&&void 0!==s?s:{},r=vz(t)?wF("axisX",i):_z(t)?wF("axisY",i):wF("axisZ",i);return lI({},wF("axis",i),n,r)};class Az{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:Hy)("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:Hy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;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)))),r=n.filter((t=>sB(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return vz(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class Mz extends Az{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(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:BL.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const wz=(t,e)=>{var i,s;return t===e||!d(t)&&!d(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))},Tz=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},Cz=(t,e,i,s)=>{var n;const r=e.getScale(),a=sB(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=G(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.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))})),o.push({series:h,datum:e,key:Bz(h,s)})}else if(u(i[1])){const e=[],s=[];l.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||u(n[i[0]])&&u(n[i[1]])&&t>=n[i[0]]&&t{if(u(e[i[0]])){const r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{if(u(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,Ez=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(G(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};class Pz extends Az{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!wz(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:BL.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:BL.canvas}),callback:this.onMouseOut}),Gy(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:BL.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Gy(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var Rz;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(Rz||(Rz={}));const Oz={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class Iz{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",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.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(Oz.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),this._lineMark}initLineMarkStyle(t,e){var i,s;const n=this._lineMark;if(n){if(this.setMarkStyle(n,{stroke:this.getColorAttribute()},"normal",mD.Series),"zero"!==this._invalidType&&this.setMarkStyle(n,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",mD.Series),this.event.on(CL.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(n,"defined")})),"polar"===this.coordinate)this.setMarkStyle(n,{lineJoin:AF,curveType:kF,closePath:!0},"normal",mD.Series);else{const r=null!=e?e:null===(s=null===(i=this.getSpec().line)||void 0===i?void 0:i.style)||void 0===s?void 0:s.curveType,a=r===SF?"horizontal"===t?"monotoneY":"monotoneX":r;this.setMarkStyle(n,{curveType:a},"normal",mD.Built_In)}this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",mD.Series)}return n}_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){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(Oz.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:lz(this._spec,Oz.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new Ba(this._option.dataSet,{name:`${OI}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const t=this._symbolMark;if(!t)return this._initSymbolActiveMarkAlone(),t;if(this._initSymbolMark(t),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(Rz.dimensionHover,this._dimensionTrigger.bind(this));for(const e in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[e]={};for(const i in this._symbolMark.stateStyle[e])"visible"!==i&&(this._symbolActiveMark.stateStyle[e][i]={style:null,level:mD.Series,referer:t})}this._symbolActiveMark.state.changeStateInfo({stateValue:_D.STATE_DIMENSION_HOVER,filter:()=>!0})}return t}_initSymbolMark(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",mD.Series),this.setMarkStyle(t,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",mD.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[Oz.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(Rz.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,lI({},this._spec[Oz.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:_D.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(t){var e;t&&("symbol"!==(null===(e=t.getTarget())||void 0===e?void 0:e.type)&&t.setRule("line-data"),this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},"normal",mD.Series),this.event.on(CL.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(t,e){var i,s,n,r;if(!t)return;const a=this._isFieldAllValid();if("zero"===this._invalidType||a){if(!0===(null===(s=null===(i=t.stateStyle.normal)||void 0===i?void 0:i[e])||void 0===s?void 0:s.style))return;this.setMarkStyle(t,{[e]:!0},"normal",mD.Series)}else{if(!0!==(null===(r=null===(n=t.stateStyle.normal)||void 0===n?void 0:n[e])||void 0===r?void 0:r.style))return;this.setMarkStyle(t,{[e]:this._getInvalidDefined.bind(this)},"normal",mD.Series)}t.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const Lz=Object.assign(Object.assign({},qF),Oz),Dz=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(v(t))return!1;if(_(t))return t.length===e.length&&t.every(((t,i)=>Dz(t,e[i])));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]))},Fz=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class zz extends $D{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return Fz}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(d(o)||s.includes(a))return;r&&n.includes(a)&&(iB(null==o?void 0:o.type)||(null==o?void 0:o.scale)||c(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!d(t)||!d(e))||!d(t)&&!d(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?Dz(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,d(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n,r;const a=e.context.data,o=[],l=[],h={},c=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,d=c&&0===c.currentIndex;if(a.forEach(((e,i)=>{var s;l[i]={},o[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?l[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!c?o[i][s]=t[s](e):0!==i||c&&!d||(h[s]=t[s](e))})),l[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),c){const t=null!==(r=null===(n=e.attribute)||void 0===n?void 0:n.segments)&&void 0!==r?r:[];return t.push({points:l}),d?Object.assign(Object.assign({},h),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(o,l);if(t)return Object.assign(Object.assign(Object.assign({},h),o[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},h),o[0]),{points:l,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:vD.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[zI]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}class jz extends zz{constructor(){super(...arguments),this.type=jz.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)===AO.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}jz.type="line";const Hz=()=>{hI.registerMark(jz.type,jz),qA(),HA(),WE(),zE(),dF(),hI.registerGraphicComponent("line",Eg)};class Vz extends $D{constructor(){super(...arguments),this.type=Vz.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="circle":a.symbolType=o,a}}Vz.type="symbol";const Nz=()=>{hI.registerMark(Vz.type,Vz),qA(),JA(),zE(),hI.registerGraphicComponent("symbol",Tg)};class Wz extends uz{_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)}}function Uz(t){return t.length>=2&&k(t[0])&&k(Y(t))&&Y(t)>=t[0]}function Gz(t,e){var i;const s=Y(e)-e[0],n=Y(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=Y(e)>0?Y(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!k(o.min),extendable_max:!k(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):Y(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function Yz(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 Xz(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 $z(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 Kz(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 qz=(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=>t.type.includes("ticks"))))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=Y(p)-p[0];if(0===g)return t;const f=c.domain(),m=Y(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=ie(t,e),a=Math.max(te(i),te(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return KC(v)};class Zz{constructor(t){this.id=$y(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class Jz extends Zz{constructor(){super(Jz.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!eB(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(t,e){const i=this._checkEnableSync(e);if(!i)return;if(!i.zeroAlign)return;const s=this._getTargetAxis(e,i);s&&e.event.on(CL.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id||t.id===s.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&&Uz(c)&&Uz(d)))return;const u=Gz(t,c),p=Gz(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:k}=p;if(0===g&&0===f){if(!Xz(u,p))return}else if(0===y&&0===b){if(!Xz(p,u))return}else if(_||k)if(_&&!k){if(!Yz(u,p))return}else if(k&&!_){if(!Yz(p,u))return}else{if(f===b)return;if(f>b){if(!$z(u,p))return}else if(!$z(p,u))return}else{if(0===f&&0===y){if(!Kz(u,p))return}else if(0===b&&0===g&&!Kz(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===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)})(s,e)}))}onDidCompile(t,e){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){LL(e.getOption().dataSet,"tickAlign",qz);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}Jz.pluginType="component",Jz.type="AxisSyncPlugin";const Qz={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function tj(t){let e=0;return P(t,"tick.visible")&&(e+=P(t,"tick.tickSize")),P(t,"label.visible")&&(e+=P(t,"label.space")),e}function ej(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 ij(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const sj=t=>"band"===t||"ordinal"===t||"point"===t;function nj(t,e){return{id:t,label:t,value:e,rawValue:t}}function rj(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class aj extends QD{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const oj=`${OI}_ARC_TRANSFORM_VALUE`,lj=`${OI}_ARC_RATIO`,hj=`${OI}_ARC_START_ANGLE`,cj=`${OI}_ARC_END_ANGLE`,dj=`${OI}_ARC_K`,uj=`${OI}_ARC_MIDDLE_ANGLE`,pj=`${OI}_ARC_QUADRANT`,gj=`${OI}_ARC_RADIAN`,fj=-Math.PI/2,mj=3*Math.PI/2,vj=.6,_j=(t,e,i,s)=>{const n=t();if(x(n))return n;if(c(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return ue(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},yj=(t,e,i)=>{var s;const n=null!==(s="band"===e?wF("axisBand",i):"linear"===e?wF("axisLinear",i):{})&&void 0!==s?s:{},r=wF("angle"===t?"axisAngle":"axisRadius",i);return lI({},wF("axis",i),n,r)};function bj(t,e,i,s){switch(t){case n.cartesianBandAxis:return kz(bz(i,["z"]),"band",e);case n.cartesianLinearAxis:return kz(bz(i,["z"]),"linear",e);case n.cartesianLogAxis:return kz(bz(i,["z"]),"log",e);case n.cartesianSymlogAxis:return kz(bz(i,["z"]),"symlog",e);case n.cartesianAxis:case n.cartesianTimeAxis:return kz(bz(i),void 0,e);case n.polarBandAxis:return yj(i.orient,"band",e);case n.polarLinearAxis:return yj(i.orient,"linear",e);case n.polarAxis:return yj(i.orient,void 0,e);case n.cartesianCrosshair:return((t,e)=>{var i,s;const r=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:d}=null!==(s=wF(n.crosshair,t))&&void 0!==s?s:{},p=r.find((t=>vz(t.orient)));let g;g=u(p)?lI({},sj(p.type)?a:o,l):l;const f=r.find((t=>_z(t.orient)));let m;return m=u(f)?lI({},sB(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(e,s);case n.polarCrosshair:return((t,e)=>{var i,s;const r=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:d}=null!==(s=wF(n.crosshair,t))&&void 0!==s?s:{},p=r.find((t=>"angle"===t.orient));let g;g=u(p)?lI({},sj(p.type)?a:o,l):l;const f=r.find((t=>"radius"===t.orient));let m;return m=u(f)?lI({},sB(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case n.colorLegend:case n.sizeLegend:case n.discreteLegend:case n.dataZoom:case n.scrollBar:return xj(i,wF(t,e));default:return wF(t,e)}}const xj=(t,e)=>{var i;const s=lI({},e,e[xz(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class Sj extends SD{getTheme(t,e){return bj(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({},KO(e)),{[s]:0}))}}class kj extends MD{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=Sj,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof Fc||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:BL.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new aj(this)}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)))}_getNeedClearVRenderComponents(){return[]}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=>!N(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&&(t.release(!0),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=>{e.compile({group:t,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}}getDatum(t){}}var Aj,Mj;kj.transformerConstructor=Sj,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(Aj||(Aj={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(Mj||(Mj={}));class wj extends $D{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}clearComponent(){this._component&&(this._component.parent&&this._component.parent.removeChild(this._component),this._component=null)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=hI.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(wL.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){super.release(),this.removeProduct()}}wj.type="component";const Tj=()=>{hI.registerMark(wj.type,wj)},Cj=t=>t;class Bj extends kj{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}getVisible(){return this._visible}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i,s;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._specVisible=!0,this._hideWhenEmpty=!1,this._tick=void 0,this._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._specVisible=null===(i=t.visible)||void 0===i||i,this._hideWhenEmpty=null!==(s=t.hideWhenEmpty)&&void 0!==s&&s,this._visible=this._specVisible,this._coordinateType="none"}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._specVisible=null===(t=this._spec.visible)||void 0===t||t,this._hideWhenEmpty=null!==(e=this._spec.hideWhenEmpty)&&void 0!==e&&e,this._visible=this._specVisible,this._scale&&this._refreshVisibilityByData()}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(u)}created(){var t,e,i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,_,y;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._refreshVisibilityByData(),this._shouldComputeTickData()&&this._initData(),this._specVisible){const b=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?Aj.circleAxis:Aj.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(b),this._axisMark=b,b.setMarkConfig({zIndex:this.layoutZIndex}),u(this._spec.id)&&b.setUserId(this._spec.id),b.setMarkConfig({interactive:null!==(t=this._spec.interactive)&&void 0!==t?t:this.getDefaultInteractive()}),this._marks.addMark(b),null===(e=this._spec.grid)||void 0===e?void 0:e.visible){const t=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?Mj.circleAxisGrid:Mj.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(t),t.setMarkConfig({zIndex: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:gD.Axis_Grid,interactive:!1}),this._marks.addMark(t),this._gridMark=t}if(this._syncComponentVisibility(),(null===(o=this._option.globalInstance)||void 0===o?void 0:o.isAnimationEnable())&&!1!==P(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=nz(null===(l=hI.getAnimationInKey("axis"))||void 0===l?void 0:l(),{appear:null!==(c=null!==(h=this._spec.animationAppear)&&void 0!==h?h:P(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==c?c:P(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(p=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:P(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==p?p:P(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(f=null!==(g=this._spec.animationEnter)&&void 0!==g?g:P(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==f?f:P(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(v=null!==(m=this._spec.animationExit)&&void 0!==m?m:P(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==v?v:P(this._option.getChart().getSpec(),"animationExit"),update:null!==(y=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:P(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==y?y:P(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._specVisible&&(this.getVisible()||this._spec.forceInitTick||this._hideWhenEmpty)}_initData(){const t=this._initTickDataSet(this._tickTransformOption()),e=new WD(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return this._regions&&_O(this._regions,(s=>{var r;let a=this.collectSeriesField(t,s);if(a=_(a)?eB(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!eB(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(r=s.getViewDataStatistics)||void 0===r?void 0:r.call(s),o=this.type===n.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return _O(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:s}=this._spec;u(t)&&(this._seriesUserId=G(t)),u(i)&&(this._regionUserId=G(i)),u(e)&&(this._seriesIndex=G(e)),u(s)&&(this._regionIndex=G(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(CL.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const t=yO(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));t.length>1?this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()})):1===t.length&&t[0].target.addListener("change",(()=>{this.updateScaleDomain()})),_O(this._regions,(t=>{t.event.on(CL.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_hasCollectedSeriesData(){return this.collectData(0).length>0}_refreshVisibilityByData(){const t=this._specVisible&&(!this._hideWhenEmpty||this._hasCollectedSeriesData()),e=this._visible!==t;return this._visible=t,(this._axisMark||this._gridMark)&&this._syncComponentVisibility(),e&&this._forceLayout(),e}_syncComponentVisibility(){var t,e,i,s,n,r,a,o,l,h,c,d;null===(t=this._axisMark)||void 0===t||t.setVisible(this._visible),null===(e=this._gridMark)||void 0===e||e.setVisible(this._visible&&!1!==(null===(i=this._spec.grid)||void 0===i?void 0:i.visible)),null===(a=null===(r=null===(n=null===(s=this._axisMark)||void 0===s?void 0:s.getComponent)||void 0===n?void 0:n.call(s))||void 0===r?void 0:r.setAttributes)||void 0===a||a.call(r,{visibleAll:this._visible}),null===(c=null===(h=null===(l=null===(o=this._gridMark)||void 0===o?void 0:o.getComponent)||void 0===l?void 0:l.call(o))||void 0===h?void 0:h.setAttributes)||void 0===c||c.call(h,{visibleAll:this._visible&&!1!==(null===(d=this._spec.grid)||void 0===d?void 0:d.visible)})}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(CL.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&N(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):_O(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(_O(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_getAxisAttributes(){const e=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&e.select,hover:!0!==this._option.disableTriggerEvent&&e.hover};var s;if(e.domainLine&&e.domainLine.visible?i.line=((s=_L(s=e.domainLine)).startSymbol=_L(s.startSymbol),s.endSymbol=_L(s.endSymbol),s):i.line={visible:!1},e.label&&e.label.visible){const t=j(e.label,["style","formatMethod","state"]);i.label=t,e.label.style&&(i.label.style=c(e.label.style)?(t,i,s,n)=>{var r;const a=e.label.style(t.rawValue,i,t,s,n);return xL(lI({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:xL(e.label.style)),(e.label.formatMethod||e.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),e.label.state&&(i.label.state=function(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{c(t[i])?e[i]=(e,s,n,r)=>xL(t[i](e.rawValue,s,e,n,r)):E(t[i])||(e[i]=xL(t[i]))})),e}(e.label.state)),c(e.label.dataFilter)&&(i.label.dataFilter=(t,i)=>e.label.dataFilter(t,i,{vchart:this._option.globalInstance}))}else i.label={visible:!1};if(e.tick&&e.tick.visible?(i.tick={visible:e.tick.visible,length:e.tick.tickSize,inside:e.tick.inside,alignWithLabel:e.tick.alignWithLabel,dataFilter:c(e.tick.dataFilter)?t=>e.tick.dataFilter(t,{vchart:this._option.globalInstance}):void 0},e.tick.style&&(i.tick.style=c(e.tick.style)?(t,i,s,n)=>{var r;const a=e.tick.style(t,i,s,n);return xL(lI({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:xL(e.tick.style)),e.tick.state&&(i.tick.state=yL(e.tick.state))):i.tick={visible:!1},e.subTick&&e.subTick.visible?(i.subTick={visible:e.subTick.visible,length:e.subTick.tickSize,inside:e.subTick.inside,count:e.subTick.tickCount},e.subTick.style&&(i.subTick.style=c(e.subTick.style)?(t,i,s,n)=>{var r;const a=e.subTick.style(t,i,s,n);return xL(lI({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:xL(e.subTick.style)),e.subTick.state&&(i.subTick.state=yL(e.subTick.state))):i.subTick={visible:!1},e.title&&e.title.visible){const s=e.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=t(s,["autoRotate","angle","style","background","state","shape"]);let u,p=r;"left"!==e.orient&&"right"!==e.orient||n&&d(p)&&(p="left"===e.orient?-90:90,u=Qz[e.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?re(p):null,textStyle:lI({},u,xL(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:xL(h.style)}),h.state&&(i.title.state.shape=yL(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:xL(o.style)}),o.state&&(i.title.state.background=yL(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=yL(l))}else i.title={visible:!1};return e.background&&e.background.visible?(i.panel={visible:!0},e.background.style&&(i.panel.style=xL(e.background.style)),e.background.state&&(i.panel.state=yL(e.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:PI(t.grid.alternateColor),alignWithLabel:t.grid.alignWithLabel,style:c(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 xL(lI({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:xL(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:PI(t.subGrid.alternateColor),style:xL(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=TF(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){DL(this._option.dataSet,"scale",Cj);const i=this.registerTicksTransform();return new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,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)}getDatum(t){var e;return t&&t.name===fw.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}Bj.specKey="axes";const Ej=()=>{Tj(),hI.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},Pj=[Jz];class Rj extends Bj{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}constructor(e,i){super(e,i),this.type=n.cartesianAxis,this.name=n.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=gD.Axis,this.layoutLevel=fD.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),_O(this._regions,(t=>{const e=this.getOrient();vz(e)?rj(t.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):_z(e)?rj(t.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):yz(e)&&rj(t.getZAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&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._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{if(!this._visible)return void this._syncComponentVisibility();const e=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=t(i,["grid"]),r=lI({x:e.x,y:e.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(lI({x:e.x,y:e.y},this._getGridAttributes(),s)),this._syncComponentVisibility()},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=vz(this.getOrient()),n=t=>{var e;return(s?!vz(t.getOrient()):vz(t.getOrient()))&&eB(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&&Y(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(u(t))a=r.find((e=>e.id===t));else if(u(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=bz(e,["z"]),yz(this._orient)&&(this.layoutType="absolute"),this._dataSet=i.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!_(e)){if(!ij(e))return null;const{axisType:t,componentName:s}=Sz(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=>_z(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(!ij(t))return;const{axisType:s,componentName:n}=Sz(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]),r=hI.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}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return vz(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):yz(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(Pj.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this._specVisible){vz(this.getOrient())?m(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):m(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&&!vz(t.orient)&&(i=!u(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!yz(this.getOrient())&&this._spec.innerOffset){const t=this._spec;_z(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=YO(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=YO(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=vz(this.getOrient())?t.fieldX:yz(this.getOrient())?t.fieldZ:t.fieldY,eB(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;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,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:eB(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 t;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(wL.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(vz(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._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=vz(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)}))}collectScale(){const t=[];return _O(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]:vz(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:yz(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();_O(this._regions,(e=>{vz(t)?rj(e.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):_z(t)?rj(e.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):yz(t)&&rj(e.getZAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(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=vz(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 s={skipLayout:!1},n=vz(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)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=lI(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new je).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=vz(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?mt(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):mt(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-Y(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&d(null===(e=a.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=a.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 o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return nj(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:eB(this._scale.type)?i>=s[0]&&i<=Y(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this._specVisible&&(this.event.on(CL.layoutEnd,this._updateAxisLayout),this.event.on(CL.layoutEnd,this._fixAxisOnZero),this.event.on(CL.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 i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}Rj.type=n.cartesianAxis,Rj.specKey="axes";const Oj=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function Ij(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,Dj=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function Fj(t,e,i="count"){const s=Dj(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const zj=Math.sqrt(50),jj=Math.sqrt(10),Hj=Math.sqrt(2);class Vj{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){u(this._spec.nice)&&(this._nice=this._spec.nice),u(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=ej(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(i.forceTickCount))e=i.forceTickCount;else if(c(i.tickCount)){const t=this._scale.range();let s=Math.abs(Y(t)-t[0]);if(1===s&&this._option){s=vz(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=k(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return d(s)&&d(n)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice(e):(u(s)||u(this._softMinValue))&&d(n)&&d(this._softMaxValue)?this._scale.niceMax(e):!(!d(s)||!d(this._softMinValue)||!u(n)&&!u(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return d(e)&&d(i)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice():(u(e)||u(this._softMinValue))&&d(i)&&d(this._softMaxValue)?this._scale.niceMax():!(!d(e)||!d(this._softMinValue)||!u(i)&&!u(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=d(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(Lj),e.sort(Lj),{domain:Ij(t,e),scope:Fj(t,e,i)}}(r,Dy(t),this._spec.breaks[0].scopeType);e=Dy(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=Y(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),u(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),u(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=ej(this._spec);if(u(e)||u(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[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=zj?10:n>=jj?5:n>=Hj?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(Y(t),0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();if(this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(CL.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=Y(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}updateScaleDomainByModel(t){if(t=null!=t?t:this._scale.domain(),this.extendDomain(t),this.includeZero(t),this.setDomainMinMax(t),this.niceDomain(t),this._scale.domain(t,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(t),this._domainAfterSpec=this._scale.domain(),this._refreshVisibilityByData(),this.event.emit(CL.scaleDomainUpdate,{model:this}),this.event.emit(CL.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(Y(t)-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}_updateRawDomain(){const t=this.collectData(0,!0),e=this.computeLinearDomain(t);this._rawDomain=e,this.event.emit(CL.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}const Nj={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},Wj={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}}},Uj={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}}},Gj={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}}};class Yj extends Rj{constructor(){super(...arguments),this.type=n.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new GB}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}initScales(){var t,e;super.initScales();const i=[0,1];u(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),u(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!yz(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=vz(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=UO(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=Dy(this._break.scope).map((t=>i[0]+(Y(i)-i[0])*t))),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}registerTicksTransform(){const t=`${this.type}-ticks`;return LL(this._option.dataSet,t,tE),t}}Yj.type=n.cartesianLinearAxis,Yj.specKey="axes",Yj.builtInTheme={axis:Gj,axisLinear:Nj,axisX:Wj,axisY:Uj},U(Yj,Vj);const Xj=()=>{hI.registerGraphicComponent(Aj.lineAxis,((t,e)=>new NC(t,e))),hI.registerGraphicComponent(Mj.lineAxisGrid,((t,e)=>new JE(t,e))),Ej(),hI.registerComponent(Yj.type,Yj)};class $j{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new WD(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{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._refreshVisibilityByData(),this.event.emit(CL.scaleDomainUpdate,{model:this}),this.event.emit(CL.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return(this._spec.showAllGroupLayers?this._scales:[this._scales[0]]).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=G(e).concat(i);if(n.push(r),o){const e=nj(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=>nj(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const t=this._spec.domain;for(let e=0;ethis._rawDomainIndex[e][t]=i))}this.event.emit(CL.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const Kj={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}};class qj extends Rj{constructor(){super(...arguments),this.type=n.cartesianBandAxis,this._scale=new AB}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}}registerTicksTransform(){const t=`${this.type}-ticks`;return LL(this._option.dataSet,t,rE),t}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=fB(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(),p=e=>{const i=t===n?a:0;if(d(r)||t{hI.registerGraphicComponent(Aj.lineAxis,((t,e)=>new NC(t,e))),hI.registerGraphicComponent(Mj.lineAxisGrid,((t,e)=>new JE(t,e))),Ej(),hI.registerComponent(qj.type,qj,!1)};class Jj extends Yj{constructor(){super(...arguments),this.type=n.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),_O(this._regions,(t=>{vz(this.getOrient())?rj(t.getXAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):rj(t.getYAxisHelper(),this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=lI({},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 Ba(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.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 WD(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=gi.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=>nj(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=>nj(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return LL(this._option.dataSet,t,tE),t}transformScaleDomain(){}}Jj.type=n.cartesianTimeAxis,Jj.specKey="axes",Jj.builtInTheme={axis:Gj,axisX:Wj,axisY:Uj};class Qj extends Yj{constructor(){super(...arguments),this.type=n.cartesianLogAxis,this._zero=!1,this._scale=new KB}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return LL(this._option.dataSet,t,tE),t}transformScaleDomain(){}}Qj.type=n.cartesianLogAxis,Qj.specKey="axes",Qj.builtInTheme={axis:Gj,axisLinear:Nj,axisX:Wj,axisY:Uj},U(Qj,Vj);class tH extends Yj{constructor(){super(...arguments),this.type=n.cartesianSymlogAxis,this._zero=!1,this._scale=new qB}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return LL(this._option.dataSet,t,tE),t}transformScaleDomain(){}}tH.type=n.cartesianSymlogAxis,tH.specKey="axes",tH.builtInTheme={axis:Gj,axisLinear:Nj,axisX:Wj,axisY:Uj},U(tH,Vj);const eH=`${OI}_hide_`;function iH(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const sH=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[eH]&&(iH(t,!0),t[eH]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=d(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[eH]=!0,iH(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=d(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},nH=()=>{hI.registerGrammarTransform("symbolOverlap",{transform:sH,runType:"afterEncode"})},rH={min:$,max:X,average:pO,sum:uO};function aH(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}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function oH(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 lH(t,e,i,s){return oH(t,e,i,"min",s)}function hH(t,e,i,s){return oH(t,e,i,"max",s)}function cH(t,e,i,s){return oH(t,e,i,"average",s)}function dH(t,e,i,s){return oH(t,e,i,"sum",s)}const uH=(t,e)=>{let i=c(t.size)?t.size():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=aH;if("min"===n?l=lH:"max"===n?l=hH:"average"===n?l=cH:"sum"===n&&(l=dH),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[]},pH=()=>{hI.registerGrammarTransform("dataSampling",{transform:uH})};class gH extends mz{constructor(){super(...arguments),this.type=AO.line,this.transformerConstructor=Wz,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.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(nz(null===(i=hI.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),rz("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=fz(this);this._symbolMark.setAnimationConfig(nz(null===(s=hI.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),rz("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),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]}}gH.type=AO.line,gH.mark=Lz,gH.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},gH.transformerConstructor=Wz,U(gH,Iz);class fH{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=G(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{YL(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof Ba)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];jy(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];jy(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class mH{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)=>{qy(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{aL(e,[{key:t,operations:eB(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&&aL(e,[{key:i.field,operations:eB(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?jO("colorOrdinal"):jO(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(qy(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),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(N(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;if(!N(r.specified,s.specified))return e.reMake=!0,e;s.range&&!N(s.range,n.range())&&(n.range(s.range),e.reRender=!0),qy(s.domain)?e.reRender=!0:N(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(!qy(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=eB(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=eB(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(d(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),d(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;eB(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(d(t.changeDomain)||"none"===t.changeDomain||d(t.seriesId))return void(eB(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=eB(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!E(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)));eB(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(d(t.field)||!d(t.changeDomain)&&"none"!==t.changeDomain&&!d(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class vH{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&t.addState(i,!0,l):a&&t.addState(s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&t.addState(i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{t.removeState(i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&t.removeState(e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}class _H extends xD{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){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=$y(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:II,height:LI},this._viewRect={width:II,height:LI},this._viewBox={x1:0,y1:0,x2:II,y2:LI},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)=>G(t).some((t=>u(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=KO(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new ML(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new fH(this._dataSet),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===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new vH;const t=this.getAllSeries(),e=[],i={};t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=`${n}-${t.type}`;i[r]?s.forEach((t=>{i[r].marks.push(t)})):(i[r]=Object.assign(Object.assign({},t),{marks:s}),e.push(i[r]))}))}})),e.forEach((t=>{const e=hI.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(nz({},rz("stage",this._spec,{}),null))}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.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||u(t.gradient))return;const e=j(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=hI.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},e),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:gD.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_createRegion(e,i){if(!e)return;const{spec:s}=i,n=t(i,["spec"]),r=new e(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(e,i){if(!e)return;const{spec:s}=i,n=t(i,["spec"]);let r;if(u(s.regionId)?r=this.getRegionsInUserId(s.regionId):u(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new e(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(v(t))return this.getAllModels().find((e=>e.userId===t));if(c(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){const s=hI.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"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(){var t,e,i,s;if(null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeLayoutWithSceneGraph)||void 0===e||e.call(t,this._option.globalInstance),this.getLayoutTag()){this._event.emit(CL.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const t=this.getLayoutElements();this._layoutFunc(this,t,this._layoutRect,this._viewBox),this._event.emit(CL.afterLayout,{elements:t,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(CL.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterLayoutWithSceneGraph)||void 0===s||s.call(i,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof kD)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 $D))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof $D)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}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){G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&YL(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=lD(this._spec,this._option,{width:II,height:LI})),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(_(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),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=BO(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new mH(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){hD(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=BO(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0};return Object.keys(t).filter((t=>!e[t])).sort()}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=this._getSpecKeys(this._spec);if(!N(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{hD(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[n.title]:!0,[n.brush]:!0,[n.indicator]:!0};this._components.forEach((s=>{var r,a;if(s.type===n.label||s.type===n.totalLabel)return;i[s.type]&&(i[s.type]=!1);const o=s.specKey||s.type,l=null!==(r=this._spec[o])&&void 0!==r?r:{};_(l)?(e[o]=e[o]||{specCount:l.length,componentCount:0},e[o].componentCount++,hD(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):hD(t,s.updateSpec(l))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}const s=t=>t&&!1!==t.visible;Object.keys(i).forEach((e=>{if(i[e]){const i=this._spec[e];(_(i)?i.some(s):s(i))&&(t.reMake=!0)}}))}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];hD(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(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:s=0,x2:n,y2:r}=t;e={width:n-i,height:r-s}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=XO(this._paddingSpec,e,e),this._layoutRect.width=e.width-this.padding.left-this.padding.right,this._layoutRect.height=e.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(CL.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.resetLayoutItemTag(),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(){this._backgroundMark&&this._backgroundMark.compile()}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._option.globalInstance),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,this._option.globalInstance)}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._option.globalInstance),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,this._option.globalInstance)}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._option.globalInstance),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,this._option.globalInstance)}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(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(E(t[s]))continue;const n=t[s];let r={stateValue:s};r=c(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(_D.STATE_SELECTED,t,e,i)}setHovered(t,e,i){this._setStateInDatum(_D.STATE_HOVER,t,e,i)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(_D.STATE_SELECTED)}clearHovered(){this.clearState(_D.STATE_HOVER)}_initEvent(){[CL.dataZoomChange,CL.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(wL.AFTER_MARK_RENDER_END,e)};this._event.on(wL.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?G(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:kL;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||c(e.filter)&&e.filter(o,l))){if(SL(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let r=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===Rz.dimensionHover||s===Rz.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(r=i)}}));const a=d(t)||!r||r.every((t=>sB(t.axis.getScale().type)&&d(t.index))),o=a||r.every((t=>sB(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(n.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};r.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(n.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(r))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(n.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(n.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),r=[];s.forEach((e=>{const i=t(e);!1!==i&&r.push({axis:e,value:i})})),i.showCrosshair(r)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const yH=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(u(n)){const t=G(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(u(r))return G(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(u)};class bH{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={}),u(t.stackInverse)&&t.region.forEach((e=>{!u(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),u(t.stackSort)&&t.region.forEach((e=>{!u(e.stackSort)&&(e.stackSort=t.stackSort)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):rI(t,a,c.spec),rI(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));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=yH(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=yH(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(u(n)){const t=G(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(u(r))return G(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(u)})(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,e,i){var s,n,r,a,o;const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,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},h=this.seriesType;return h&&(l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(hI.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(hI.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,r,a;const o=[],l=hI.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=hI.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=hI.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(r=d.getSpecInfo(t,i))||void 0===r||r.forEach((t=>{o.push(e(d,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):CF(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=CF(t,u.specKey,u.type))||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"];return i.find((i=>{if(!s.includes(i.orient))return!1;if(u(i.seriesId)){if(G(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(u(i.seriesIndex)){if(G(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;x(n)?(t.minBandSize=n,o=!0):x(r)?(t.minBandSize=r,o=!0):x(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:_(a)?a[a.length-1]:a})}}class xH extends bH{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_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;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{d(i[t])&&(i[t]=n[t])})),P(i,"trimPadding")&&lI(i,cD(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class SH extends xH{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),oD(t)}}const kH=(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&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=hL(t,!0);for(const e in o)for(const i in o[e].nodes)pL(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)uL(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&dL(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(CL.regionSeriesDataFilterOver,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class MH{_beforeInit(){this._dataSet&&LL(this._dataSet,"stackSplit",kH)}_initStack(){this._stack=new AH(this),this._stack.init()}}const wH={state:_D.STATE_DIMENSION_HOVER,reverseState:_D.STATE_DIMENSION_HOVER_REVERSE,trigger:Rz.dimensionHover};class TH extends pF{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},wH,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=kL(i);let n;return n=_(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}TH.type="dimension-hover",TH.defaultOptions=wH;const CH=()=>{hI.registerInteractionTrigger(TH.type,TH)},BH=()=>{hI.registerComposedEvent(Rz.dimensionHover,Pz),hI.registerComposedEvent(Rz.dimensionClick,Mz)},EH=t=>t.fieldX[0],PH=t=>t.fieldY[0],RH=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},OH=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},IH=(t,e)=>t?e?EH:RH:e?PH:OH,LH=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=Ez(t,(t=>vz(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=Ez(t,(t=>_z(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{sB(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((t=>{if(d.size>0){if(d.has(t)){const s=DH(t,i,IH(e,sB(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=DH(t,i,IH(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},DH=(t,e,i)=>{const s=t.positionToData(e,!0);return d(s)?null:FH(t,s,i)},FH=(t,e,i)=>{const s=t.getScale();if(d(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=Cz(e,t,"cartesian",null!=i?i:vz(t.getOrient())?EH:PH);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},zH=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:p,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,_=0,y=null;if(d.size){const t=Array.from(d.values())[0];_=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,y=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(_)&&!Number.isNaN(_),x=s&&!b&&u(p),S=x?p:{coordRange:[0,0],sizeRange:[0,0],coord:_,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:y};let k;S&&(S._isCache=x);let A=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(sB(m.type))k=m.bandwidth(),0===k&&m.step&&(A=m.step());else if(eB(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(k=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):k=1,_=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=tj(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(a=y.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&y&&null!==(o=y.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(l=y.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&y&&null!==(h=y.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(c=y.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&y&&null!==(d=y.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(u=y.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&y&&null!==(p=y.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};HH(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=_+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=_+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&jH(S.labels[t],t,f.label)}))}t[n].bandSize=null!=k?k:0,t[n].offsetSize=A,t[n].cacheInfo=S})),t),jH=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=TF(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},HH=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},VH=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=NH(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},NH=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},WH=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return zH(c,r,e),c.xField.cacheInfo?VH(c.xField):c.yField.cacheInfo?VH(c.yField):void 0},UH=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],GH=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&UH.forEach((e=>{u(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(YH(s).every((t=>{var e;return!IF("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},YH=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{u(t.series)&&e.push(t.series)}))})),e},XH={dom:`${OI}_TOOLTIP_HANDLER_DOM`,canvas:`${OI}_TOOLTIP_HANDLER_CANVAS`},$H={key:"其他",value:"..."};var KH;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(KH||(KH={}));class qH{constructor(t){this._showTooltipByHandler=(t,e)=>{var i,s,n;if(d(t))return 1;e.changePositionOnly||this.clearCache(),this._updateViewSpec(t,e);const r=this._cacheActiveSpec;if(d(r)||!1===r.visible)return 1;e.tooltipSpec=this.component.getSpec(),e.activeTooltipSpec=r;const{title:a,content:o}=r,l=d(null==a?void 0:a.key)&&d(null==a?void 0:a.value)&&!(null==o?void 0:o.length);if(this.component.event.emit(CL.tooltipShow,Object.assign(Object.assign({},e),{isEmptyTooltip:l,tooltipData:t,activeType:this.activeType,tooltip:this.component})),l)return 1;let h;return(null===(i=r.handler)||void 0===i?void 0:i.showTooltip)?h=r.handler.showTooltip.bind(r.handler):(null===(s=this.component.tooltipHandler)||void 0===s?void 0:s.showTooltip)&&(h=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),h?null!==(n=h(this.activeType,t,e))&&void 0!==n?n:0:1},this.component=t}_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}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:p,model:g}=e;if(!p||!this._cacheActiveSpec){const p=this.component.getSpec();if(this._cacheActiveSpec=GH(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){d(this._cacheActiveSpec.handler)&&u(p.handler)&&(this._cacheActiveSpec.handler=p.handler);const g=null!==(i=p[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},$H),t):$H;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!d(e)&&IF(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class ZH extends qH{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)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],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(!sB(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(u(s))break}return u(s)&&s.getDimensionField()[0]===s.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}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const JH=()=>{hI.registerTooltipProcessor("dimension",ZH)};class QH extends qH{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,Xo.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(kL(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const tV=()=>{hI.registerTooltipProcessor("mark",QH)};class eV extends qH{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:G(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?G(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return G(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=G(s)[0][a];return r.filter((t=>t[a]===o))}}const iV=()=>{hI.registerTooltipProcessor("group",eV)};class sV extends _H{constructor(){super(...arguments),this.transformerConstructor=SH,this.type="line",this.seriesType=AO.line}_setModelOption(){this._modelOption.getDimensionInfo=LH,this._modelOption.getDimensionInfoByValue=FH,this._modelOption.getRectByDimensionData=WH}}sV.type="line",sV.seriesType=AO.line,sV.transformerConstructor=SH,U(sV,MH);const nV=[...Fz,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class rV extends zz{constructor(){super(...arguments),this.type=rV.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return nV}_getIgnoreAttributes(){return[]}}rV.type="area";const aV=()=>{hI.registerMark(rV.type,rV),qA(),EA(),WE(),zE(),dF(),hI.registerGraphicComponent("area",ef)};class oV extends zF{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of G(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")),u(e))return e}return i}}}const lV=Object.assign(Object.assign(Object.assign({},qF),Oz),{area:{name:"area",type:"area"}}),hV=()=>{hI.registerAnimation("area",hF),cF(),oF()};class cV extends Wz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!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,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_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),p=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=u(l.zIndex)||u(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||p&&!d)&&(g=h,f=l),l.style=lI({},f.style,g.style),l.state=lI({},f.state,g.state),!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),t.area=l,t.line=h}}class dV extends mz{constructor(){super(...arguments),this.type=AO.area,this.transformerConstructor=cV,this._sortDataByAxis=!1}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(dV.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var t,e,i,s,n;const r=null!==(i=null===(e=null===(t=this.getSpec().area)||void 0===t?void 0:t.style)||void 0===e?void 0:e.curveType)&&void 0!==i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,a=r===SF?"horizontal"===this._direction?"monotoneY":"monotoneX":r,o=this._areaMark;if(o){const t=this._isAreaVisible(),e=this._isLineVisible();t||e?o.setVisible(!0):o.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return HO(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),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",mD.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return HO(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",mD.Series),this.setMarkStyle(o,{fill:!!t&&this.getColorAttribute(),stroke:!!e&&this.getColorAttribute()},"normal",mD.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",mD.Series),this.getStack()&&this.setMarkStyle(o,{zIndex:t=>-t[WI]},"normal",mD.Series),this.setMarkStyle(o,{curveType:a},"normal",mD.Built_In),Object.keys(o.stateStyle).forEach((t=>{o.stateStyle[t].stroke&&o.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(nz(null===(e=hI.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),rz("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(nz(null===(i=hI.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),rz("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=fz(this);this._symbolMark.setAnimationConfig(nz(null===(s=hI.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),rz("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new oV(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.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(){super.onLayoutEnd(),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&&_(l)?l[0]:l}}}dV.type=AO.area,dV.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},dV.mark=lV,dV.transformerConstructor=cV,U(dV,Iz);class uV extends xH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),oD(t)}}class pV extends _H{constructor(){super(...arguments),this.transformerConstructor=uV,this.type="area",this.seriesType=AO.area}_setModelOption(){this._modelOption.getDimensionInfo=LH,this._modelOption.getDimensionInfoByValue=FH,this._modelOption.getRectByDimensionData=WH}}pV.type="area",pV.seriesType=AO.area,pV.transformerConstructor=uV,U(pV,MH);function gV(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 fV=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:gV(t,e)}),mV=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:gV(t,e)}),vV={type:"fadeIn"},_V={type:"growCenterIn"};function yV(t,e){if(!1===e)return{};switch(e){case"fadeIn":return vV;case"scaleIn":return _V;default:return fV(t)}}class bV extends $D{constructor(){super(...arguments),this.type=bV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}bV.type="rect";const xV=()=>{qA(),YA(),LE("rect",HE),hI.registerMark(bV.type,bV),uT.registerBuiltInAnimate("growHeightIn",oC),uT.registerBuiltInAnimate("growHeightOut",lC),uT.registerBuiltInAnimate("growWidthIn",AC),uT.registerBuiltInAnimate("growWidthOut",MC),uT.registerBuiltInAnimate("growCenterIn",nC),uT.registerBuiltInAnimate("growCenterOut",rC),hI.registerGraphicComponent("rect",Ig)},SV=Object.assign(Object.assign({},qF),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function kV(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;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=ZO(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[ZF]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):HO(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[JF]):HO(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=HO(this._dataToPosX(t),e,i),n=HO(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[QF]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):HO(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[tz]):HO(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=HO(this._dataToPosY(t),e,i),n=HO(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},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(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},wV.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:lz(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(wV.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",mD.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===n.cartesianBandAxis));let r;if(LL(this._option.dataSet,"addVChartProperty",PF),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=d(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};LL(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();r=new Ba(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:YF.bind(this),call:XF}},!1),null==e||e.target.addListener("change",r.reRunAllTransform)}this._barBackgroundViewData=new WD(this._option,r)}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=tz,s=QF,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=JF,s=ZF,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=hL(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)kV(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=HO(this[r](t),l,i),u=HO(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!VO(t[this.getStackValueField()],l)?p=0:pthis._getBarXStart(t,n),x1:t=>this._getBarXEnd(t,n),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",mD.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",mD.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.setMarkConfig({clip:!0,clipPath:()=>{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[NI],n=t[WI],r=t[UI],h=t[GI];i=Math.min(i,e,n),s=Math.max(s,e,n),u(r)&&u(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]),{[NI]:i,[WI]:s}),a?{[UI]:o,[GI]:l}:void 0),d="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)};t.push(Ig(Object.assign(Object.assign({},d),{cornerRadius:c(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(d,h,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),t}})}initLinearRectMarkStyle(){var t,e,i,s;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);if("horizontal"===this.direction){const t=u(this._fieldY2)?{y:t=>this._getLinearBarYRange(t,r,!0)[0],y1:t=>this._getLinearBarYRange(t,r,!0)[1]}:{y:t=>HO(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,r,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,n,!0),x1:t=>this._getBarXEnd(t,n,!0)},t),"normal",mD.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(n),x1:()=>this._getBarBackgroundXEnd(n)},t),"normal",mD.Series)}else{const t=u(this._fieldX2)?{x:t=>this._getLinearBarXRange(t,n,!0)[0],x1:t=>this._getLinearBarXRange(t,n,!0)[1]}:{x:t=>HO(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,n,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},t),{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r)}),"normal",mD.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},t),{y:()=>this._getBarBackgroundYStart(r),y1:()=>this._getBarBackgroundYEnd(r)}),"normal",mD.Series)}}_initBandBarBackgroundMarkStyle(){var t,e,i,s,n;if(!this._barBackgroundMark)return;const r=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),a=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),o=null!==(n=this._spec.barBackground)&&void 0!==n?n:{},l=d(o.fieldLevel)?void 0:o.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r),y:t=>this._getPosition(this.direction,t,l,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,l),width:()=>{},y1:()=>{}},"normal",mD.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,l,"barBackground"),y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a),width:()=>this._getBarWidth(this._xAxisHelper,l),x1:()=>{},height:()=>{}},"normal",mD.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=$(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=fz(this);this._barMark.setAnimationConfig(nz(null===(e=hI.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),rz(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=d(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=u(this._spec.barWidth)&&r===n,l=u(this._spec.barMinWidth),h=u(this._spec.barMaxWidth);let c=a;return o&&(c=ZO(this._spec.barWidth,a)),l&&(c=Math.max(c,ZO(this._spec.barMinWidth,a))),h&&(c=Math.min(c,ZO(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,p;"horizontal"===t?(h=this.getYAxisHelper(),c="height",p="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",p="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=d(i)?f:Math.min(f,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,m-1))&&void 0!==r?r:6,_=m===f?this._barMark.getAttribute(c,e):v;if(m>1&&u(this._spec.barGapInGroup)){const t=this._groups.fields,i=G(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=ZO(null!==(l=i[r-1])&&void 0!==l?l:Y(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=eB(g.type||"band");return p(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(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}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}}wV.type=AO.bar,wV.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},wV.mark=SV,wV.transformerConstructor=MV;const TV=()=>{pH(),xV(),hI.registerAnimation("bar",((t,e)=>({appear:yV(t,e),enter:fV(t,!1),exit:mV(t,!1),disappear:{duration:nF.disappear.duration}}))),Zj(),Xj(),hI.registerSeries(wV.type,wV)};class CV extends xH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),oD(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=p(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 BV extends _H{constructor(){super(...arguments),this.transformerConstructor=CV,this.type="bar",this.seriesType=AO.bar}_setModelOption(){this._modelOption.getDimensionInfo=LH,this._modelOption.getDimensionInfoByValue=FH,this._modelOption.getRectByDimensionData=WH}}BV.type="bar",BV.seriesType=AO.bar,BV.transformerConstructor=CV,U(BV,MH);const EV=[10,20],PV=QC.Linear,RV="circle",OV=QC.Ordinal,IV=["circle","square","triangle","diamond","star"],LV=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},DV=Object.assign(Object.assign({},qF),{point:{name:"point",type:"symbol"}});class FV extends uz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class zV extends mz{constructor(){super(...arguments),this.type=AO.scatter,this.transformerConstructor=FV,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(c(e))return e;if(_(e)){if(d(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=`${OI}_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(p(e)){if(d(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${OI}_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 d(e)?10:x(e)?e:v(e)&&S(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:PV,defaultRange:EV},"size")}getShapeAttribute(t,e){return d(e)?RV:v(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:OV,defaultRange:IV},"shape")}initMark(){this._symbolMark=this._createMark(zV.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:lz(this._spec,zV.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=fz(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(nz(null===(i=hI.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),rz("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const t=this._symbolMark;t&&("zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:x(this._size)||c(this._size)?this._size:10,symbolType:v(this._shape)||c(this._shape)?this._shape:RV},_D.STATE_NORMAL,mD.Series),(u(this._sizeField)||u(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},_D.STATE_NORMAL,mD.User_Mark),(u(this._shapeField)||u(this._shape))&&this.setMarkStyle(t,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},_D.STATE_NORMAL,mD.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t);const e=[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||e?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",mD.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",mD.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},_D.STATE_NORMAL,mD.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},_D.STATE_NORMAL,mD.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{if(!t)return;const e=t.getGraphics();e&&e.length&&e.forEach(((t,e)=>{var i,s;const n=null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],r=this.dataToPosition(n);r&&t&&t.translateTo(r.x,r.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){this.handleZoom(t)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}zV.type=AO.scatter,zV.mark=DV,zV.builtInTheme={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"}}}}},zV.transformerConstructor=FV;const jV=()=>{Nz(),hI.registerAnimation("scatter",((t,e)=>Object.assign({appear:LV(0,e)},rF))),Zj(),Xj(),hI.registerSeries(zV.type,zV)};class HV extends xH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class VV extends _H{constructor(){super(...arguments),this.transformerConstructor=HV,this.type="scatter",this.seriesType=AO.scatter}_setModelOption(){this._modelOption.getDimensionInfo=LH,this._modelOption.getDimensionInfoByValue=FH,this._modelOption.getRectByDimensionData=WH}}VV.type="scatter",VV.seriesType=AO.scatter,VV.transformerConstructor=HV,U(VV,MH);class NV extends pz{constructor(){super(...arguments),this.type=AO.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 d(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(d(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return d(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=`${OI}_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 WV=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[FI]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[rL]=e.nameMap[n]:t[rL]=n})),t.features);class UV extends zF{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 GV extends $D{constructor(){super(...arguments),this.type=GV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}GV.type="path";const YV=()=>{hI.registerMark(GV.type,GV),qA(),NA(),hI.registerGraphicComponent("path",Jg)},XV=Object.assign(Object.assign({},qF),{area:{name:"area",type:"path"}});class $V{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Oa(i,e):Pa[i]?(Ea[i]||(Ea[i]=Oa(i,Pa[i])),Ea[i]):null}(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 KV{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(){}}class qV{constructor(){this._lastScale=0}clearZoom(){this._lastScale=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 ZV(t){return t===s["desktop-browser"]||t===s["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:KV}:Gy(t)||Yy(t)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:qV}:null}const JV={debounce:bt,throttle:xt};class QV{constructor(){this._isGestureListener=!1}initZoomable(t,e=s["desktop-browser"]){this._eventObj=t,this._renderMode=e,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=Gy(this._renderMode)||Yy(this._renderMode),ZV(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return ZV(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(d(r))return;if(!Se({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{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(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:EL.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:EL.chart,consume:!1}];l.on(...c,JV[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,JV[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||ZV(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||ZV(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 d(r)&&d(a)?s:Se({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:EL.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:EL.chart,consume:!1}];l.on(...c,JV[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,JV[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){ZV(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||ZV(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(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:EL.chart},(t=>{if(!t.event)return;const{event:n}=t;Se({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:EL.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||ZV(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:EL.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||ZV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:EL.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:EL.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:EL.chart,source:BL.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:EL.chart,source:BL.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=JV[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=JV[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:EL.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:EL.chart,source:BL.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:EL.chart,source:BL.chart},this._handleDragMouseUp)}))}}function tN(t,e){return`${OI}_${e}_${t}`}class eN extends kj{constructor(){super(...arguments),this.type=n.geoCoordinate,this.name=n.geoCoordinate,this.layoutType="none",this.layoutZIndex=gD.Mark,this._projectionSpec={name:tN(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;const l=u(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,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,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):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,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(d(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:n.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=lI(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var t,e,i;this.event.on(CL.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:s}=this._spec;if(s){let n=!0,r=!0,a=!1;!0!==s&&(n=null===(t=s.zoom)||void 0===t||t,r=null===(e=s.drag)||void 0===e||e,a=null!==(i=s.blank)&&void 0!==i&&i),n&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!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 $V(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===AO.map||e.type===AO.pictogram?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(d(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(d(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(d(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(d(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(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),_O(this._regions,(t=>{var e;if(t.type===AO.map||t.type===AO.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ne})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==AO.map&&e.type!==AO.pictogram||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[rL],s=t.getDatumCenter(e);i&&u(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!N(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}eN.type=n.geoCoordinate,U(eN,QV);const iN=()=>{hI.registerComponent(eN.type,eN)};class sN extends uz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class nN extends NV{constructor(){super(...arguments),this.type=AO.map,this.transformerConstructor=sN,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 !`),FL.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),LL(this._dataSet,"copyDataView",WL),LL(this._dataSet,"map",WV),LL(this._dataSet,"lookup",BF);const i=FL.get(this.map);i||null===(t=this._option)||void 0===t||t.onError("no valid map data found!");const s=new Ba(this._dataSet,{name:`map_${this.id}_data`});s.parse([i],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:XL.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:rL,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 WD(this._option,s)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(nN.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:lz(this._spec,nN.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>{var e,i,s,n;return u(t[null!==(e=this._seriesField)&&void 0!==e?e:jI])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:jI]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",mD.Series),t.setPostProcess("fill",(t=>u(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(t,{smoothScale:!0},"normal",mD.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(nz(null===(t=hI.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),rz("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new UV(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[FI]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[FI],{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;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ne}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ne}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}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 FI}getActiveMarks(){return[this._pathMark]}}nN.type=AO.map,nN.mark=XV,nN.builtInTheme={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"}}}}},nN.transformerConstructor=sN;const rN=`${OI}_waterfall_default_seriesField`,aN=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n,calculationMode:r}=e,a=[],{dimensionValues:o,dimensionData:l}=n().latestData;let h=Array.from(o[i]);"decrease"===r&&(h=h.reverse());let c={start:0,end:0,positive:0,negative:0,lastIndex:null};return h.forEach(((t,i)=>{const n={start:c.end,end:c.end,lastIndex:c.lastIndex,lastEnd:c.end,index:t,isTotal:!1,positive:c.end,negative:c.end},r=!0===e.stackInverse?l[t].reverse():l[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[qI]=!0:delete t[qI]})),r.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===h.length-1)return!0;return!1};if(r.some((t=>o(t))))return c=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,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=oN([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 f=g[0];let{start:m,end:v}=lN(f,i,s,n,u);i.start=m,i.end=v;let _=m,y=m,b=v-m;const x=p.reduce(((t,e)=>ie(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=ee(_,e)):(t[c]=+y,y=ee(y,e)),t[d]=ee(t[c],e),m=ee(m,e),b=ie(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,n,a,c,h,i,e,o),void a.push(n)}c=oN(r,t,n,a,c,h,i,e),a.push(n)})),a};function oN(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:u,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(u&&"end"!==u.type){if("field"===u.type||"custom"===u.type){if(t[u.tagField]){e=!0;const{start:r,end:a}=lN(t,i,s,n,u);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=ee(i.positive,e)):(t[h]=+i.negative,i.negative=ee(i.negative,e)),t[c]=ee(t[h],e),i.end=ee(i.end,e)}i.isTotal=e,(d(p)||p===rN)&&(t[rN]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function lN(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&&!d(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?jy("total.collectCountField error"):n=e[a].start;o<0?jy("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!d(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!d(t[i.valueField])&&(n=ee(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 hN=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>ee(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?t.unshift(o):t.push(o),t},cN={type:"fadeIn"},dN={type:"growCenterIn"};function uN(t,e){switch(e){case"fadeIn":return cN;case"scaleIn":return dN;default:return fV(t,!1)}}class pN extends $D{constructor(){super(...arguments),this.type=pN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(e,i,s){const n=super._transformGraphicAttributes(e,i,s),{x:r,x1:a,y:o,y1:l}=n,h=t(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return Eg(t)}}pN.type="rule";const gN=()=>{hI.registerMark(pN.type,pN),qA(),HA(),hI.registerGraphicComponent("line",Eg)},fN=Object.assign(Object.assign({},SV),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),mN=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:vN(t.map((t=>t.latestData)).flat(),e.fields,i)}};function vN(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)=>vN(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class _N{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 Ba(e instanceof Ca?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),LL(e,"dimensionTree",mN),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 yN extends MV{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const bN={rect:wN,symbol:AN,arc:CN,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=AN(t);h(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:BN,line:EN,area:EN,rect3d:wN,arc3d:CN,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function xN(t,e){var i;const{labelSpec:s}=e;s.overlap&&!p(s.overlap)&&(s.overlap={});const n=null!==(i=bN[t])&&void 0!==i?i:bN.point;return e.series.type===AO.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=kN(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;v(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!v(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:PN(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function SN(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==AO.sankey){const{formatFunc:t,args:n}=TF(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function kN(t){return c(t)?e=>t(e.data):t}function AN(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=kN(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:MN(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function MN(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function wN(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=kN(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;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:TN(o)};let g=!1;return v(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function TN(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 CN(t){var e;const{labelSpec:i}=t,s=null!==(e=kN(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:v(s)&&s.includes("inside"),{position:n,smartInvert:r}}function BN(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=SN(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),Ag(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 EN(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}))):[{index:0,[jI]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function PN(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class RN extends wV{constructor(){super(...arguments),this.type=AO.waterfall,this.transformerConstructor=yN,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&dL(t,e)}}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 _N(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]],d(this._seriesField)&&(this._seriesField=rN)}getSeriesKeys(){return this._seriesField===rN?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t,e,i;super.initData(),LL(this._dataSet,"waterfallFillTotal",hN),LL(this._dataSet,"waterfall",aN),(d(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,calculationMode:null!==(e=this._spec.calculationMode)&&void 0!==e?e:"increase",stackInverse:this.getRegion().getStackInverse()}},!1));const s=UL(this.getViewData(),this._dataSet,{name:`${OI}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",s.reRunAllTransform),this._totalData=new WD(this._option,s),s.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:NI,endAs:WI,total:this._spec.total,calculationMode:null!==(i=this._spec.calculationMode)&&void 0!==i?i:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}},!1),s.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}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=fz(this);this._barMark.setAnimationConfig(nz(null===(i=hI.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),rz("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(nz(null===(s=hI.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),rz("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(){super.initMark();const t=this._createMark(RN.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:ie(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:ie(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return BN(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?HO(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):HO(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle();const t="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:e=>e.lastIndex?this.totalPositionY(e,"lastIndex",t?0:1):0,y1:e=>this.totalPositionY(e,"index",t?1:0)},"normal",mD.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:e=>e.lastIndex?this.totalPositionX(e,"lastIndex",t?0:1):0,x1:e=>this.totalPositionX(e,"index",t?1:0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",mD.Series))}isVisibleLeaderLine(t){return!d(t.lastIndex)&&VO([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}RN.type=AO.waterfall,RN.mark=fN,RN.builtInTheme={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}}}},RN.transformerConstructor=yN;const ON=()=>{gN(),xV(),hI.registerAnimation("waterfall",((t,e)=>({appear:uN(t,e),enter:fV(t,!1),exit:mV(t,!1),disappear:{duration:nF.disappear.duration}}))),lF(),Zj(),Xj(),hI.registerSeries(RN.type,RN)},IN=`${OI}_BOX_PLOT_OUTLIER_VALUE`;var LN;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(LN||(LN={}));const DN=(t,e)=>{const i=[],{outliersField:s,dimensionField:n,seriesField:r}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];_(e)||(e=[e]),i.push(...e.map((e=>{const i={[IN]:e};return n.forEach((e=>{i[e]=t[e]})),u(r)&&(i[r]=t[r]),i})))})),i};class FN extends zF{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===LN.OUTLIER)return this.series.getOutliersField();if(t===LN.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case LN.MIN:return this.series.getMinField();case LN.MAX:return this.series.getMaxField();case LN.MEDIAN:return this.series.getMedianField();case LN.Q1:return this.series.getQ1Field();case LN.Q3:return this.series.getQ3Field();case LN.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===LN.OUTLIER)return e[IN];if(t===LN.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case LN.MIN:return e[this.series.getMinField()];case LN.MAX:return e[this.series.getMaxField()];case LN.MEDIAN:return e[this.series.getMedianField()];case LN.Q1:return e[this.series.getQ1Field()];case LN.Q3:return e[this.series.getQ3Field()];case LN.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,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>u(t[IN])}getDefaultContentList(t){return[{key:this.getContentKey(LN.OUTLIER),value:this.getContentValue(LN.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(LN.MAX),value:this.getContentValue(LN.MAX)},{key:this.getContentKey(LN.Q3),value:this.getContentValue(LN.Q3)},{key:this.getContentKey(LN.MEDIAN),value:this.getContentValue(LN.MEDIAN)},{key:this.getContentKey(LN.Q1),value:this.getContentValue(LN.Q1)},{key:this.getContentKey(LN.MIN),value:this.getContentValue(LN.MIN)},{key:this.getContentKey(LN.SERIES_FIELD),value:this.getContentValue(LN.SERIES_FIELD)}]}}class zN extends $D{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==vD.enter&&t.context.diffState!==vD.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;return this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?z(r,i):i}})),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=Dg(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=hI.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const jN=()=>{hI.registerGraphicComponent("glyph",Dg),qA(),IA()},HN=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],VN=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class NN extends zN{constructor(){super(...arguments),this.type=NN.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=HN,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=VN,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}NN.type="boxPlot";const WN=Object.assign(Object.assign({},qF),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),UN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},GN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},YN=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),XN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,M;if(i&&k(i.center))return i.center;let w,T,C,B,E;if("horizontal"===e){w=null===(r=null===(n=(null===(s=YN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,T=null===(h=null===(l=null===(o=null===(a=YN(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,C=null===(p=null===(u=null===(d=null===(c=YN(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=YN(t,"box").attribute.width,i=YN(t,"box").attribute.x;B=i,E=i+e}else{w=null===(m=null===(f=(null===(g=YN(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,T=null===(b=null===(y=null===(_=null===(v=YN(t,"max"))||void 0===v?void 0:v.attribute)||void 0===_?void 0:_.points)||void 0===y?void 0:y[0])||void 0===b?void 0:b.y,C=null===(M=null===(A=null===(S=null===(x=YN(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===M?void 0:M.y;const e=YN(t,"box").attribute.height,i=YN(t,"box").attribute.y;B=i,E=i+e}return k(w)?w:k(B)&&k(E)?(B+E)/2:k(T)&&k(C)?(T+C)/2:k(C)?C:k(T)?T:NaN},$N=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,_,y,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=YN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=YN(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=YN(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;y=i,_=i+e;const c=(null===(l=YN(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=YN(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=YN(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=YN(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=YN(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;y=i,_=i+e;const s=(null===(f=YN(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=YN(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(_)&&k(y)?(_+y)/2:k(y)?y:k(_)?_:NaN};class KN extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return UN(XN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class qN extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return GN(XN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class ZN extends KN{computeAttribute(){return UN($N)(this.target,this.params,this.params.options)}}class JN extends qN{computeAttribute(){return GN($N)(this.target,this.params,this.params.options)}}class QN extends uz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}class tW extends mz{constructor(){super(...arguments),this.type=AO.boxPlot,this.transformerConstructor=QN,this._bandPosition=0}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,r,a;super.setAttrFromSpec();const o=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=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(tW.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(tW.mark.outlier,{key:FI,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var t,e,i,s,n,r;const a=this._boxPlotMark;if(a){const i={lineWidth:this._lineWidth,fill:null!==(t=this._boxFillColor)&&void 0!==t?t:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(e=this._strokeColor)&&void 0!==e?e:"line"!==this._shaftShape?"#000":this.getColorAttribute()};a.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const s="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return ZO(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return ZO(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return ZO(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return ZO(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return ZO(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return ZO(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return ZO(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return ZO(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(a,i,_D.STATE_NORMAL,mD.Series),this.setMarkStyle(a,s,_D.STATE_NORMAL,mD.Built_In)}const o=this._outlierMark;o&&this.setMarkStyle(o,{fill:null!==(n=null!==(s=null===(i=this._outliersStyle)||void 0===i?void 0:i.fill)&&void 0!==s?s:this._boxFillColor)&&void 0!==n?n:this.getColorAttribute(),stroke:this.getColorAttribute(),size:x(null===(r=this._outliersStyle)||void 0===r?void 0:r.size)?this._outliersStyle.size:10},_D.STATE_NORMAL,mD.Series)}initBoxPlotMarkStyle(){var t,e;const i=this._boxPlotMark,s="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(i&&s){const{dataToPosition:e}=s,n=null===(t=null==s?void 0:s.getScale)||void 0===t?void 0:t.call(s,0);this.setMarkStyle(i,{min:t=>HO(e(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>HO(e(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>HO(e(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>HO(e(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>HO(e(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},_D.STATE_NORMAL,mD.Series)}const n=this._outlierMark;if(n&&s){const{dataToPosition:t}=s,i=null===(e=null==s?void 0:s.getScale)||void 0===e?void 0:e.call(s,0),r="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),x:e=>HO(t(this.getDatumPositionValues(e,IN),{bandPosition:this._bandPosition}),i)}:{x:t=>this._getPosition(this.direction,t),y:e=>HO(t(this.getDatumPositionValues(e,IN),{bandPosition:this._bandPosition}),i)};this.setMarkStyle(n,r,_D.STATE_NORMAL,mD.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;LL(this._dataSet,"foldOutlierData",DN),LL(this._dataSet,"addVChartProperty",PF);const t=new Ba(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${OI}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField}}),t.transform({type:"addVChartProperty",options:{beforeCall:YF.bind(this),call:XF}},!1),this._outlierData=new WD(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t;if(this._autoBoxWidth)return this._autoBoxWidth;const e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,i=this._groups?this._groups.fields.length:1,s=null===(t=e.getBandwidth)||void 0===t?void 0:t.call(e,i-1);let n=s;return u(this._spec.boxWidth)&&(n=ZO(this._spec.boxWidth,s)),u(this._spec.boxMinWidth)&&(n=Math.max(n,ZO(this._spec.boxMinWidth,s))),u(this._spec.boxMaxWidth)&&(n=Math.min(n,ZO(this._spec.boxMaxWidth,s))),this._autoBoxWidth=n,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r;let a,o,l;"horizontal"===t?(a=this.getYAxisHelper(),o="boxHeight",l=this.dataToPositionY.bind(this)):(a=this.getXAxisHelper(),o="boxWidth",l=this.dataToPositionX.bind(this));const h=a.getScale(0),c=this._groups?this._groups.fields.length:1,d=null===(i=a.getBandwidth)||void 0===i?void 0:i.call(a,c-1),p=this._boxPlotMark.getAttribute(o,e);if(c>1&&u(this._spec.boxGapInGroup)){const t=this._groups.fields,i=G(this._spec.boxGapInGroup);let o=0,l=0;for(let h=t.length-1;h>=1;h--){const c=t[h],u=null!==(n=null===(s=a.getScale(h))||void 0===s?void 0:s.domain())&&void 0!==n?n:[],g=u.length,f=ZO(null!==(r=i[h-1])&&void 0!==r?r:Y(i),d),m=u.indexOf(e[c]);h===t.length-1?(o+=g*p+(g-1)*f,l+=m*(p+f)):(l+=m*(o+f),o+=o+(g-1)*f)}return h.scale(e[t[0]])+a.getBandwidth(0)/2-o/2+l+p/2}const g=eB(h.type||"band");return l(e)+.5*d+(g?-d/2:0)}onLayoutEnd(){super.onLayoutEnd(),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="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=fz(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=hI.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(rz("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(nz(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(nz(null===(a=hI.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new FN(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}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}tW.type=AO.boxPlot,tW.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},tW.mark=WN,tW.transformerConstructor=QN;const eW=()=>{jN(),HA(),YA(),hI.registerGraphicComponent("line",(t=>Eg(t))),hI.registerGraphicComponent("rect",(t=>Ig(t))),hI.registerMark(NN.type,NN),Nz(),oF(),Zj(),Xj(),uT.registerBuiltInAnimate("boxplotScaleIn",KN),uT.registerBuiltInAnimate("boxplotScaleOut",qN),uT.registerBuiltInAnimate("barBoxplotScaleIn",ZN),uT.registerBuiltInAnimate("barBoxplotScaleOut",JN),hI.registerSeries(tW.type,tW)};class iW extends $D{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=iW.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return p(n)&&u(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?Kg(t):Ag(t)}}iW.type="text";const sW=()=>{hI.registerMark(iW.type,iW),qA(),tM(),$A(),hI.registerGraphicComponent("text",Ag),hI.registerGraphicComponent("richtext",Kg)};class nW extends zF{constructor(){super(...arguments),this._getMeasureData=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]]}}const rW=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),aW={type:"fadeIn"},oW=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function lW(t,e){return"fadeIn"===e?aW:rW(t)}const hW=Object.assign(Object.assign({},SV),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class cW extends MV{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 dW extends wV{constructor(){super(...arguments),this.type=AO.rangeColumn,this._barMarkType="rect",this._barName=AO.bar,this.transformerConstructor=cW}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(dW.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:lz(this._spec,dW.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(dW.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(dW.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(t,e,i,s){var n,r,a,o;if(t){this.setMarkStyle(t,{fill:null!==(r=null===(n=null==e?void 0:e.style)||void 0===n?void 0:n.fill)&&void 0!==r?r:this.getColorAttribute(),text:t=>{const s="horizontal"===this._spec.direction?t[this._spec.xField[i]]:t[this._spec.yField[i]];return(null==e?void 0:e.formatMethod)?e.formatMethod(s,t):s}});!function(t,e,i,s,n,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if("vertical"===l())return"center";const e=n(t),s=r(t);if("middle"===i)return"center";if(e>=s){if("start"===i)return"left";if("end"===i)return"right";if("outside"===i)return"left"}else{if("start"===i)return"right";if("end"===i)return"left";if("outside"===i)return"right"}return"center"},textBaseline:t=>{if("horizontal"===l())return"middle";const e=a(t),s=o(t);if("middle"===i)return"middle";if(s>=e){if("start"===i)return"bottom";if("end"===i)return"top";if("outside"===i)return"bottom"}else{if("start"===i)return"top";if("end"===i)return"bottom";if("outside"===i)return"top"}return"middle"}}),t.setMarkStyle(e,{x:t=>{const e=l(),a=n(t),o=r(t);if("vertical"===e)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+s;if("end"===i)return a-s;if("outside"===i)return a+s}else{if("start"===i)return o-s;if("end"===i)return a+s;if("outside"===i)return a-s}return(a+o)/2},y:t=>{const e=l(),n=a(t),r=o(t);if("horizontal"===e)return(n+r)/2;if("middle"===i)return(n+r)/2;if(n>=r){if("start"===i)return r+s;if("end"===i)return n-s;if("outside"===i)return n+s}else{if("start"===i)return r-s;if("end"===i)return n+s;if("outside"===i)return n-s}return(n+r)/2}},"normal",mD.Series)}(this,t,null!==(a=null==e?void 0:e.position)&&void 0!==a?a:s,null!==(o=null==e?void 0:e.offset)&&void 0!==o?o:"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=fz(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(nz(null===(i=hI.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),rz("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(nz(null===(s=hI.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),rz("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(nz(null===(n=hI.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),rz("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new nW(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)}}dW.type=AO.rangeColumn,dW.mark=hW,dW.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},dW.transformerConstructor=cW;const uW=()=>{xV(),sW(),hI.registerAnimation("rangeColumn",((t,e)=>({appear:lW(t,e),enter:rW(t),exit:oW(t),disappear:{duration:nF.disappear.duration}}))),lF(),Zj(),Xj(),hI.registerSeries(dW.type,dW)};var pW,gW;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(pW||(pW={})),function(t){t.middle="middle",t.start="start",t.end="end"}(gW||(gW={}));class fW extends zF{constructor(){super(...arguments),this._getMeasureData=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]]}}const mW=Object.assign({},lV);class vW extends dV{constructor(){super(...arguments),this.type=AO.rangeArea}initMark(){this._areaMark=this._createMark(vW.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const t=this._areaMark;t&&(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",mD.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",mD.Series),this.setMarkStyle(t,{stroke:!1},"normal",mD.Series))}initTooltip(){this._tooltipHelper=new fW(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}vW.type=AO.rangeArea,vW.mark=mW;class _W extends pz{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=vj,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=u(t)?G(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=u(t)?G(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=G(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(d(t)||d(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(G(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(G(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}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:[]};eB(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:[]};eB(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),i}setAttrFromSpec(){super.setAttrFromSpec(),u(this._spec.outerRadius)&&(this._outerRadius=this._spec.outerRadius),u(this._spec.radius)&&(this._outerRadius=this._spec.radius),u(this._spec.innerRadius)&&(this._innerRadius=this._spec.innerRadius),u(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(CL.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)&&gz(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}}function yW(t){return Ky(t)?Number.parseFloat(t):0}const bW=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&xW(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=pe(e+a/2)};let _=0,y=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let k=p,A=S,M=0;const w=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))}(x);if(m.forEach(((t,e)=>{const i=t[oj],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=A/M;k=p,m.forEach((e=>{const i=e[r]===f?f:e[oj]*t;v(e,k,i),k+=i}))}if(0!==_&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},xW=(t,e,i)=>!!d(t)||(0===t.length||(!!t.every((t=>0===yW(t[e])))||!i&&0===t.reduce(((t,i)=>t+yW(i[e])),0)));function SW(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const kW=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:SW(t,!0,$L.appear)}),AW={type:"fadeIn"},MW=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:SW(t,!0,$L.enter)}),wW=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:SW(t,!0,$L.exit)});function TW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return AW;case"growRadius":return kW(Object.assign(Object.assign({},t),{growField:"radius"}));default:return kW(Object.assign(Object.assign({},t),{growField:"angle"}))}}class CW extends $D{constructor(t,e){super(t,e),this.type=BW.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>le({x:0,y:0},this.getAttribute("centerOffset",e,i),e[uj])[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 BW extends CW{constructor(){super(...arguments),this.type=BW.type}}BW.type="arc";const EW=()=>{qA(),CA(),LE("arc",YE),uT.registerBuiltInAnimate("growRadiusIn",xC),uT.registerBuiltInAnimate("growRadiusOut",SC),uT.registerBuiltInAnimate("growAngleIn",iC),uT.registerBuiltInAnimate("growAngleOut",sC),hI.registerGraphicComponent("arc",rf),hI.registerMark(BW.type,BW)},PW=Object.assign(Object.assign({},qF),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class RW extends uz{_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=lI({},this._theme,i,t);const n=(t,e)=>lI({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);_(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 u(s)&&(i.centerX=s),u(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const OW=`${OI}_LABEL_VISIBLE`;class IW extends _W{constructor(){super(...arguments),this.transformerConstructor=RW,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:YO(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:YO(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=fj,this._endAngle=mj,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[uj];if(d(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return le(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;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 a=function(t,e){let i=0,s=2*Math.PI;const n=u(t),r=u(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}}(u(this._spec.startAngle)?re(this._spec.startAngle):this._startAngle,u(this._spec.endAngle)?re(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=u(this._spec.padAngle)?re(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=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;LL(this._dataSet,"pie",bW),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>u(this._spec.minAngle)?re(this._spec.minAngle):0,asStartAngle:hj,asEndAngle:cj,asRatio:lj,asMiddleAngle:uj,asRadian:gj,asQuadrant:pj,asK:dj,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new Ba(this._dataSet,{name:`${OI}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new WD(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},IW.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:zI,groupKey:this._seriesField,isSeriesMark:!0},{morph:lz(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return xO(hj)(t)}endAngleScale(t){return xO(cj)(t)}_computeLayoutRadius(){return _j((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const t={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:NO(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:NO(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},e=this._pieMark;e&&this.setMarkStyle(e,t,"normal",mD.Series);const i=this._emptyArcMark;i&&this.setMarkStyle(i,Object.assign(Object.assign({},t),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",mD.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(t,e){if(super.initMarkStyleWithSpec(t,e),t.name===this._pieMarkName){const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,mD.User_Mark)}"emptyCircle"===t.name&&this.setMarkStyle(t,this.generateRadiusStyle(e.style),"normal",mD.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:xO(OW).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(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(CL.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*(d(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[uj];if(d(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return le(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===$L.appear)return this._startAngle;if(i===$L.disappear)return this._endAngle;const r=[$L.disappear,$L.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[FI];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[FI]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[FI])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[FI])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+le({x:0,y:0},a,e[uj]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+le({x:0,y:0},a,e[uj]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+le({x:0,y:0},a,e[uj]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+le({x:0,y:0},a,e[uj]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=nz(null===(i=hI.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}IW.transformerConstructor=RW,IW.mark=PW,IW.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class LW extends IW{constructor(){super(...arguments),this.type=AO.pie}}LW.type=AO.pie;const DW=()=>{EW(),hI.registerAnimation("pie",((t,e)=>({appear:TW(t,e),enter:MW(t),exit:wW(t),disappear:{duration:nF.disappear.duration}}))),hI.registerAnimation("emptyCircle",((t,e)=>({appear:TW(t,e)}))),hI.registerSeries(LW.type,LW)};function FW(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const zW=t=>({type:FW(t.growField),options:{overall:!0}}),jW={type:"fadeIn"},HW=t=>({type:FW(t.growField)}),VW=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function NW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return jW;case"growAngle":return zW(Object.assign(Object.assign({},t),{growField:"angle"}));default:return zW(Object.assign(Object.assign({},t),{growField:"radius"}))}}class WW extends _W{getStackGroupFields(){return this._angleField}getStackValueField(){return G(this._spec.valueField)[0]||G(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(WI),this.setInnerRadiusField(NI)}setValueFieldToPercent(){this.setRadiusField(GI),this.setInnerRadiusField(UI)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const UW=Object.assign(Object.assign({},qF),{rose:{name:"rose",type:"arc"}});class GW extends uz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class YW extends Bj{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=_(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let r,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:p,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((t,e)=>{var i,s,r,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${n.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,p=null!==(r=t.endAngle)&&void 0!==r?r:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=p?p:u(d)?d+360:270,center:u(e.center)?e.center:u(null==e?void 0:e.centerX)||u(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.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=p,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const _={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(_),"radius"===i.orient?(o.push(_),a=h):(l.push(_),r=h)})),o.forEach((t=>{t.angleAxisIndex=r})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(e,i){const{spec:s}=e,n=t(e,["spec"]),r=hI.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(t,e){super(t,e),this.type=n.polarAxis,this.name=n.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=gD.Axis,this._tick=void 0,this._center=null,this._startAngle=fj,this._endAngle=mj,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),_O(this._regions,(t=>{"radius"===this.getOrient()?rj(t.radiusAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):rj(t.angleAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(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.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:YO(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:YO(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this._specVisible&&(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=re(this._spec.startAngle),this._endAngle=re(this._spec.endAngle),this._inverse=this._spec.inverse}_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:tj(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}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(){_O(this._regions,(t=>{"radius"===this.getOrient()?rj(t.radiusAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):rj(t.angleAxisHelper,this.axisHelper(),u(this._seriesUserId)||u(this._seriesIndex))&&(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 eB(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:eB(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 le(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return he(t,this.getCenter(),this._startAngle,this._endAngle)}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=>nj(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_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=ne.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",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(u(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return _j((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=vj,e=0;const i=this.getChart().getSpec();return _O(this.getRegions(),(s=>{const n=s;if(r=n.type,[AO.rose,AO.radar,AO.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(e){const{grid:i}=e,s=t(e,["grid"]);if(this._axisMark.getComponent().setAttributes(lI({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(lI({},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)}}YW.type=n.polarAxis,YW.specKey="axes";const XW={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},$W={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class KW extends YW{constructor(){super(...arguments),this.type=n.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new GB}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}registerTicksTransform(){const t=`${this.type}-ticks`;return LL(this._option.dataSet,t,tE),t}}KW.type=n.polarLinearAxis,KW.specKey="axes",KW.builtInTheme={axis:Gj,axisLinear:Nj,axisAngle:$W,axisRadius:XW},U(KW,Vj);const qW=()=>{hI.registerGraphicComponent(Aj.lineAxis,((t,e)=>new NC(t,e))),hI.registerGraphicComponent(Mj.lineAxisGrid,((t,e)=>new JE(t,e))),hI.registerGraphicComponent(Aj.circleAxis,((t,e)=>new $C(t,e))),hI.registerGraphicComponent(Mj.circleAxisGrid,((t,e)=>new sP(t,e))),Ej(),hI.registerComponent(KW.type,KW)};class ZW extends YW{constructor(){super(...arguments),this.type=n.polarBandAxis,this._scale=new AB}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)}registerTicksTransform(){const t=`${this.type}-ticks`;return LL(this._option.dataSet,t,lE),t}transformScaleDomain(){}}ZW.type=n.polarBandAxis,ZW.specKey="axes",ZW.builtInTheme={axis:Gj,axisBand:Kj,axisAngle:$W,axisRadius:XW},U(ZW,$j);const JW=()=>{hI.registerGraphicComponent(Aj.lineAxis,((t,e)=>new NC(t,e))),hI.registerGraphicComponent(Mj.lineAxisGrid,((t,e)=>new JE(t,e))),hI.registerGraphicComponent(Aj.circleAxis,((t,e)=>new $C(t,e))),hI.registerGraphicComponent(Mj.circleAxisGrid,((t,e)=>new sP(t,e))),Ej(),hI.registerComponent(ZW.type,ZW)};class QW extends WW{constructor(){super(...arguments),this.type=AO.rose,this.transformerConstructor=GW,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(){this._roseMark=this._createMark(QW.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:lz(this._spec,QW.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}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=>HO(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=HO(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(nz(null===(i=hI.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),rz("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}QW.type=AO.rose,QW.mark=UW,QW.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},QW.transformerConstructor=GW;const tU=()=>{hI.registerSeries(QW.type,QW),EW(),hI.registerAnimation("rose",((t,e)=>({appear:NW(t,e),enter:HW(t),exit:VW(t),disappear:{duration:nF.disappear.duration}}))),JW(),qW()};class eU extends kT{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:le(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=he(this.from,this._prevCenter),{angle:i,radius:s}=he(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,hO(this._fromAngle,this._toAngle)&&hO(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=le({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class iU extends XT{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!vO(t)&&!vO(e))return e;const s=he(t,this._prevCenter),n=he(e,this._center);let r=de(s.angle),a=de(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return le({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new se(s,n,r,a);return o.defined=e.defined,o}}const sU=t=>({type:"in"===t?"fadeIn":"fadeOut"});function nU(t,e,i){return"fadeIn"===e?sU(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function rU(t,e,i){return"fadeIn"===e?sU(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 aU=(t,e)=>({custom:GT,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),oU=Object.assign(Object.assign(Object.assign({},qF),Oz),{area:{name:"area",type:"area"}});class lU extends WW{constructor(){super(...arguments),this.type=AO.radar,this.transformerConstructor=Wz,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!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),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(lU.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}initAreaMarkStyle(){const t=this._areaMark;t&&(this.setMarkStyle(t,{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:kF,closePath:!0},"normal",mD.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",mD.Series),this.event.on(CL.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.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:u(this._spec.startAngle)?re(this._spec.startAngle):fj},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(nz(null===(s=hI.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),rz("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(u(t)){const i=hI.getAnimationInKey(e);t.setAnimationConfig(nz(null==i?void 0:i(n,r),rz(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&&_(a)?a[0]:a}}}lU.type=AO.radar,lU.mark=oU,lU.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},lU.transformerConstructor=Wz,U(lU,Iz);const hU=()=>{hI.registerSeries(lU.type,lU),aV(),Hz(),Nz(),hI.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:nU(t,e,"in"),enter:nU(t,e,"in"),exit:nU(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:nF.disappear.duration},update:[{channel:["points","center"],custom:iU,customParameters:t,duration:nF.update.duration,easing:nF.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),hI.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:rU(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:nF.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:eU,customParameters:t,duration:nF.update.duration,easing:nF.update.easing}]}))),hI.registerAnimation("radarGroup",((t,e)=>({appear:aU(t,"in"),disappear:{duration:nF.disappear.duration}}))),CA(),JW(),qW()};class cU extends zF{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>gi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const dU=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(OI)||(i[n]=t[n],s=u(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[FI]:r,[zI]:`${s}_${e}`})),r++}))})),n},uU={fill:"#bbb",fillOpacity:.2},pU=Object.assign(Object.assign({},qF),{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"}});class gU extends mz{constructor(){super(...arguments),this.type=AO.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){u(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){u(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){u(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){u(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){u(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){u(t)&&(this._gridBackground=t)}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),LL(this._option.dataSet,"objFlat",dU),LL(this._option.dataSet,"copyDataView",WL),DL(this._option.dataSet,"dataview",Ma),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:XL.dotObjFlat},!1)}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(lI(uU,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(gU.mark.group),this._containerMark=this._createMark(gU.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(gU.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(gU.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(gU.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(gU.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(gU.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(gU.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var t;const e=this._clipMark;e&&(this.setMarkStyle(e,{x:-(null!==(t=this._spec.leftAppendPadding)&&void 0!==t?t:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",mD.Series),e.setMarkConfig({interactive:!1,clip:!0}));const i=this._containerMark;i&&(this.setMarkStyle(i,{x:this._spec.leftAppendPadding},"normal",mD.Series),i.setMarkConfig({interactive:!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",mD.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",mD.Series);const r=this._dotMark;r&&this.setMarkStyle(r,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",mD.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",mD.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",mD.Series);const l=this._symbolMark;l&&this.setMarkStyle(l,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",mD.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(){var t,e;super.onLayoutEnd();const i=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.leftAppendPadding)&&void 0!==e?e:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+i},"normal",mD.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:jI}}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 FO).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:jI}}initTooltip(){this._tooltipHelper=new cU(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}gU.type=AO.dot,gU.mark=pU,gU.builtInTheme={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"}}}}};class fU extends zF{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>gi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const mU=Object.assign(Object.assign({},qF),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),vU=(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 _U extends mz{constructor(){super(...arguments),this.type=AO.link}getFromField(){return this._fromField}setFromField(t){u(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){u(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){u(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){u(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(),LL(this._option.dataSet,"linkDotInfo",vU),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:XL.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(_U.mark.group),this._containerMark=this._createMark(_U.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(_U.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(_U.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var t,e,i,s;const n=this._clipMark;n&&(this.setMarkStyle(n,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",mD.Series),n.setMarkConfig({interactive:!1,clip:!0}));const r=this._containerMark;r&&(this.setMarkStyle(r,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",mD.Series),r.setMarkConfig({interactive:!1}));const a=this._linkMark;a&&this.setMarkStyle(a,{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",mD.Series);const o=this._arrowMark;if(o){const n=null!==(s=null===(i=null===(e=null===(t=this._theme)||void 0===t?void 0:t.arrow)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size)&&void 0!==s?s:10;this.setMarkStyle(o,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,n),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:n,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",mD.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:jI}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new fU(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}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]}}_U.type=AO.link,_U.mark=mU,_U.builtInTheme={link:{arrow:{style:{size:10}}}};const yU=Object.assign(Object.assign({},qF),{group:{name:"group",type:"group"}});class bU extends _W{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()?NI:iL],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=re(i.offsetAngle);let o;if(u(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 d(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()?WI:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=re(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=u(n)?re(n):fj;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=u(r)?re(r):mj,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)||u(null==s?void 0:s.startAngle)||u(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=HO(this.angleAxisHelper.dataToPosition([t[NI]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=HO(this.angleAxisHelper.dataToPosition([t[WI]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?HO(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(bU.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const t=this._arcGroupMark;t.created(),this.setMarkStyle(t,{x:0,y:0},"normal",mD.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+re(a),o=re(r)/2;return rf(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[Ig({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_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 AU=()=>{hI.registerAnimation("circularProgress",((t,e)=>({appear:kU(t,e),enter:{type:"growAngleIn"},disappear:{duration:nF.disappear.duration}})))};class MU extends uz{constructor(){super(...arguments),this._supportStack=!0}}class wU extends bU{constructor(){super(...arguments),this.type=AO.circularProgress,this.transformerConstructor=MU,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(){return this._progressMark=this._createMark(wU.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:lz(this._spec,"progress")}),this._progressMark}_initProgressMarkStyle(){var t;const e=this._progressMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",mD.Series)}getInteractionTriggers(){const t=[];return 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(){return this._trackMark=this._createMark(wU.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&this.setMarkStyle(t,{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()?NI:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?WI: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",mD.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(nz(null===(i=hI.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),rz("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(nz(null===(s=hI.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),rz("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}wU.type=AO.circularProgress,wU.mark=xU,wU.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},wU.transformerConstructor=MU;const TU=()=>{hI.registerSeries(wU.type,wU),EW(),AU(),lF(),JW(),qW()};function CU(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const BU={type:"fadeIn"};function EU(t,e="grow"){return!1===e?{}:"fadeIn"===e?BU:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:CU(t)}))(t)}class PU extends zF{enableByType(t){return"dimension"!==t}}const RU=Object.assign(Object.assign({},qF),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class OU extends mz{constructor(){super(...arguments),this.type=AO.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=u(e.width)?e.width:e.x1-e.x,o=u(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(OU.mark.progress,{isSeriesMark:!0}),d(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var t,e,i,s;const n=this._progressMark;if(n)if("vertical"===this._spec.direction){const i=this._spec.progress||{},s=null!==(t=i.leftPadding)&&void 0!==t?t:0,r=null!==(e=i.rightPadding)&&void 0!==e?e:0;this.setMarkStyle(n,{x:t=>{var e,i;return HO(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),!0)-this._spec.bandWidth/2+s},y1:t=>{var e,i;return HO(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))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?HO(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-s-r,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",mD.Series)}else{const t=this._spec.progress||{},e=null!==(i=t.topPadding)&&void 0!==i?i:0,r=null!==(s=t.bottomPadding)&&void 0!==s?s:0;this.setMarkStyle(n,{x1:t=>{var e,i;return HO(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))},y:t=>{var i,s;return HO(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),!0)-this._spec.bandWidth/2+e},height:this._spec.bandWidth-e-r,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?HO(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",mD.Series)}}_initTrackMark(){return this._trackMark=this._createMark(OU.mark.track),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>{var e,i;return HO(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),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",mD.Series):this.setMarkStyle(t,{x:0,y:t=>{var e,i;return HO(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),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",mD.Series))}getInteractionTriggers(){const t=[];return 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(nz(null===(i=hI.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),rz("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(nz(null===(s=hI.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),rz("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new PU(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}OU.type=AO.linearProgress,OU.mark=RU,OU.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const IU=()=>{xV(),hI.registerAnimation("linearProgress",((t,e)=>({appear:EU(t,e),enter:EU(t),disappear:{duration:nF.disappear.duration}}))),lF(),hI.registerSeries(OU.type,OU)},LU=[0],DU=[20,40],FU=[200,500],zU={shrink:!1,enlarge:!1,fontSizeLimitMin:0},jU=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class HU{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const VU=`${OI}_WORD_CLOUD_TEXT`,NU=Object.assign(Object.assign({},qF),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),WU={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic",scaleX:1,scaleY:1}}};class UU extends pz{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},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._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){u(t)&&(this._valueField=t)}setFontSizeRange(t){u(t)?this._fontSizeRange=t:this._fontSizeRange=DU}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,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:FU,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:LU,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?VU:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:zU},this._spec.wordCloudConfig),r&&!d(r.layoutMode)||Uy(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:LU,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!jU.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new HU(1e3))}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",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var t;this._wordMark=this._createMark(UU.mark.word,{key:zI,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(t=this._spec.wordMask)||void 0===t?void 0:t.visible)&&(this._maskMark=this._createMark(UU.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:gD.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",mD.Series)}initMarkStyleOfWord(t,e,i,s,n){var r,a;t&&(this.setMarkStyle(t,{text:(null==e?void 0:e.formatMethod)?t=>e.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",mD.Series),this.setMarkStyle(t,{fill:null!==(a=null===(r=null==e?void 0:e.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",mD.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(nz(hI.getAnimationInKey("wordCloud")(n,s),rz("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 FO).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:jI])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new GB).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new GB).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[FI])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var t,e,i,s,n;const{width:r,height:a}=this._region.getLayoutRect(),o=null!==(t=this._spec.word)&&void 0!==t?t:{},l=null!==(e=o.style)&&void 0!==e?e:{};return{size:[r,a],shape:p(this._maskShape)&&"text"===this._maskShape.type&&d(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const t=()=>{var e,i,s,n;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((e=>e.fn!==t)),null===(i=(e=this._option).dispatchEvent)||void 0===i||i.call(e,CL.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(n=null===(s=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===s?void 0:s.afterWordcloudShapeDraw)||void 0===n||n.call(s,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:t})},dataIndexKey:zI,text:o.formatMethod?t=>o.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(s=null===(i=this._spec.word)||void 0===i?void 0:i.padding)&&void 0!==s?s:1,fontFamily:u(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(n=l.fontFamily)&&void 0!==n?n:this._defaultFontFamily,fontWeight:u(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:u(l.fontWeight)?l.fontWeight:u(this._valueField)?this._calculateFontWeight:"normal",fontStyle:u(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:l.fontStyle,createCanvas:S_.createCanvas.bind(S_),getTextBounds:gf}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,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,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:Ng,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:u(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:u(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:u(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}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(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}UU.mark=NU,UU.builtInTheme={wordCloud:WU};function GU(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||nF.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,u;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(u=t.children)||void 0===u?void 0:u.length){p.children=[],p.isLeaf=!1;const e=YU(t.children,p.children,i+1,l,p,r,a);p.value=d(t[a])?e.sum:Math.max(e.sum,At(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=At(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},XU=(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=XU(t.children,e,t,n))})),s},$U=(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=$U(t.children,e,t,n)),n=e(t,s,i,n)})),n},KU=(t,e=[],i)=>{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):KU(t.children,e,i)))})),e};function qU(t,e){let i,s;if(QU(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function QU(t,e){for(let i=0;i1e-6?(T+Math.sqrt(T*T-4*w*C))/(2*w):C/T);return{x:s+S+k*B,y:n+A+M*B,radius:B}}function sG(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 nG(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 rG(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 aG(t){return{_:t,next:null,prev:null}}function oG(t,e){const i=(t=G(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];sG(n,s,r);let a,o,l,h,c,d,u,p=aG(s),g=aG(n),f=aG(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.next=p,g.prev=p;for(let e=3;et.padding:_(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,this._valueField=null!==(e=null==t?void 0:t.valueField)&&void 0!==e?e:"value"}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=YU(t,n,0,-1,null,this._getNodeKey,this._valueField);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%wt)/wt}(),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:d,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=c(l)?this.options.nodeKey:dG.defaultOpionts.nodeSort;XU([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)XU([o],lG(h)),$U([o],hG(this._getPadding,.5,a)),XU([o],cG(1,this._maxDepth));else{const t=Math.min(s.width,s.height);XU([o],lG(dG.defaultOpionts.setRadius)),$U([o],hG(Pt,1,a)),d&&$U([o],hG(this._getPadding,o.radius/t,a)),XU([o],cG(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}dG.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const uG=t=>{let e=0;return t.forEach(((t,i)=>{var s;d(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=uG(t.children):t.value=0),e+=Math.abs(t.value)})),e};function pG(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){uG(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=d(t.value)?0:At(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=j(t,["parents"]);if(a.parents=t.parents.map((t=>j(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=At(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function gG(t){return t.depth}function fG(t,e){return e-1-t.endDepth}const mG=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),vG=(t,e)=>{if(d(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(d(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},_G={left:gG,right:fG,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:gG,end:fG},yG=_t(0,1);class bG{constructor(t){this._ascendingSourceBreadth=(t,e)=>mG(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>mG(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},bG.defaultOptions,t);const e=this.options.nodeKey,i=c(e)?e:e?Bt(e):null;this._getNodeKey=i,this._logger=rt.getInstance(),this._alignFunc=c(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):_G[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)};"vertical"===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<=0)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!d(t.source)&&!d(t.target))),t.targetLinks=t.targetLinks.filter((t=>!d(t.source)&&!d(t.target)))})),r=r.filter((t=>!d(t.source)&&!d(t.target))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;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}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return 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){return pG(t,this._getNodeKey)}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=!d(r.source),l=!d(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&&d(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=[vG(s[t.source]),vG(s[t.target],!0)].filter((t=>!d(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){return function(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=At(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=At(e.value))&&void 0!==i?i:0)}),0))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=c(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}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(v(e)){const t=mt(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(x(e)){if(r=e,x(i))a=i;else if(d(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else c(e)&&x(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,u=null;if(c(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)u=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=x(this.options.nodeHeight)?t=>this.options.nodeHeight:c(this.options.nodeHeight)?this.options.nodeHeight:u>0?t=>u:t=>Math.max(t.value*l,0),m=x(this.options.linkHeight)?()=>this.options.linkHeight:c(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*yG(t.value/e.value):0,n,0),o);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;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,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)}d(this.options.nodeSortBy)&&n.sort(mG),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(mG),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{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];xG(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),SG);const s=_(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,h(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},kG.defaultOpionts,t):Object.assign({},kG.defaultOpionts);const e=this.options.nodeKey,i=c(e)?e:e?Bt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Et(this.options.center[0],t.width),s=t.y0+Et(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=_(r),l=o?r.map((t=>Et(t,n))):Et(r,n),h=_(a),c=this.options.gapRadius,u=h?a.map((t=>Et(t,n))):Et(a,n),p=J(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return d(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=u[i])&&void 0!==s?s:n:id(u[e])?n:u[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(_(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=Et(r,n),i=(u-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-(_(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=YU(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=le({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)}}}function AG(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(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,f,m,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,_=Math.max(v/x,x/m),_>y){f-=h;break}y=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{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*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:xG,slice:AG,sliceDice:function(t,e,i,s,n){(t.depth%2==1?AG:xG)(t,e,i,s,n)}};class TG{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=_(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=_(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=_(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=_(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({},TG.defaultOpionts,t);const i=this.options.nodeKey,s=c(i)?i:i?Bt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?MG(this.options.aspectRatio):null!==(e=wG[this.options.splitType])&&void 0!==e?e:wG.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=YU(t,n,0,-1,null,this._getNodeKey,this.options.valueField);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(x(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(x(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)}))}}function CG(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+li?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return rt.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=CG(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=wi(o.map(wi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rMt(e)));u=Pi(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=BG(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&rt.getInstance().error("Area "+r+" not represented on screen")}return i}function DG(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Bi((function(i){return-1*FG({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},jG=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=G(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!E(G(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:G(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||PG,s=e.lossFunction||EG,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=G(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];hi(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rne.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:zG(f),arcs:f})}))},HG={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:VG,triangle:VG,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.955)%(2*Math.PI/5)-2*Math.PI/10>=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 VG(){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 NG(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*.4),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"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const WG=t=>HG[t]?HG[t]():HG.circle(),UG=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function GG(t){return c(t)?t:function(){return t}}class YG{constructor(t){var e,i;switch(this.options=z({},YG.defaultOptions,t),c(this.options.shape)?this.shape=this.options.shape:this.shape=WG(this.options.shape),this.getText=null!==(e=GG(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=GG(this.options.fontWeight),this.getTextFontSize=GG(this.options.fontSize),this.getTextFontStyle=GG(this.options.fontStyle),this.getTextFontFamily=GG(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>UG(10,50);break;case"random-light":this.getTextColor=()=>UG(50,90);break;default:this.getTextColor=GG(this.options.color)}if(d(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=c(this.options.rotate)?t=>{var e;return re(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=G(this.options.rotate),s=this.options.random?Math.random():Mt(e);return re(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+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:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1: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&&!d(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 $G extends YG{constructor(t){var e;super(z({},$G.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<=$G.defaultOptions.minFontSize&&(this.options.minFontSize=$G.defaultOptions.minFontSize),this.spiral=v(this.options.spiral)?null!==(e=XG[this.options.spiral])&&void 0!==e?e:XG.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=GG(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}=NG(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,f,m;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,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,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._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=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(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=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}));if(this.originalData=s,this.data=s,this.progressiveRun(),!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._originSize[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],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});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 f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);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*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(JG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(ZG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}JG(p,this._size)&&(p=QG(p,this._size))}else if(JG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||qG(p,i))&&(!i||!KG(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 KG(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 qG(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,JG=(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 QG(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{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const p=n.measureText(h),g="normal"!==o?1.1:1,f=u(p.actualBoundingBoxRight)&&u(p.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(p.actualBoundingBoxRight)+Math.abs(p.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(p.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},eY=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>le(t,e,i+r*n)))},iY=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},sY=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=NG(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=WG("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return le(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)iY(n,eY({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)iY(n,eY({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)iY(n,eY({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)iY(n,eY({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)iY(n,eY({x:l,y:h},o,0,3));else if("star"===t.shape){const t=eY({x:l,y:h},o,-Math.PI/2,5),e=eY({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);iY(n,i)}else n.fillRect(0,0,i,s)}; /*! * wordcloud2.js * http://timdream.org/wordcloud2.js/ @@ -20,4 +20,4 @@ function t(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s * Copyright 2011 - 2019 Tim Guan-tin Chien and contributors. * Released under the MIT license */ -let qG=class t extends zG{constructor(e){super(z({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{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,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize: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=this.options.createCanvas({width:1,height:1}),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 f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),_=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*Math.abs(Math.sin(h)))/this.gridSize),k=S*this.gridSize,A=x*this.gridSize;d.setAttribute("width",""+k),d.setAttribute("height",""+A),u.scale(1,1),u.translate(k/2,A/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,k,A).data;if(this.exceedTime())return null;const w=[];let T,C=S;const B=[x/2,S/2,x/2,S/2],E=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*k+(t*this.gridSize+n))+3])return i.push([t,e]),tB[1]&&(B[1]=t),eB[2]&&(B[2]=e))}};for(;C--;)for(T=x;T--;)E(C,T,w);return{datum:t,occupied:w,bounds:B,gw:S,gh:x,fillTextOffsetX:y,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=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,e=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),q(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){this.grid=[];const e=this.options.shape;if(p(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?YG(t,o,l.width,l.height,h):"geometric"===t.type&&KG(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!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)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,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}=IG(this.options.shape,[e.width,e.height]);return 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),this.result=[],this.progressiveRun()}};qG.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class ZG extends zG{constructor(t){super(z({},ZG.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,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)}ZG.defaultOptions={enlarge:!1};const QG={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},tY=(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?eY(t.fontFamily):"sans-serif",d=t.fontStyle?eY(t.fontStyle):"normal",u=t.fontWeight?eY(t.fontWeight):"normal",p=t.rotate?eY(t.rotate):0,g=eY(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?eY(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,S=t.minFontSize,k=t.randomVisible,A=t.as?Object.assign(Object.assign({},QG),t.as):QG,M=t.depth_3d,w=t.postProjection;let T=t.fontSize?eY(t.fontSize):14;const C=t.fontSizeRange;if(C&&!x(T)){const t=T,e=sY(nY(t,l),C);T=i=>e(t(i))}let B=HG;"fast"===t.layoutType?B=ZG:"grid"===t.layoutType&&(B=qG);const E=new B(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:T,shrink:_,clip:b,enlarge:y,minFontSize:S,random:k,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:E}:E.output()},eY=t=>v(t)||x(t)||c(t)||_(t)?t:e=>e[t.field],iY=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),sY=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=iY(t[0]),n=iY(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(iY(t)-r)/(a-r)*(e[1]-e[0])+e[0]},nY=(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 rY(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{eI.registerGrammarTransform("wordcloud",{transform:tY}),KN(),eI.registerAnimation("wordCloud",((t,e)=>({appear:FU(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:qD.disappear.duration}}))),eI.registerSeries(aY.type,aY)},lY=(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:f=!1,isCone:m=!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===f?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?m?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},hY=(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},cY=`${MI}_FUNNEL_TRANSFORM_RATIO`,dY=`${MI}_FUNNEL_REACH_RATIO`,uY=`${MI}_FUNNEL_HEIGHT_RATIO`,pY=`${MI}_FUNNEL_VALUE_RATIO`,gY=`${MI}_FUNNEL_LAST_VALUE_RATIO`,fY=`${MI}_FUNNEL_NEXT_VALUE_RATIO`,mY=`${MI}_FUNNEL_LAST_VALUE`,vY=`${MI}_FUNNEL_CURRENT_VALUE`,_Y=`${MI}_FUNNEL_NEXT_VALUE`,yY=`${MI}_FUNNEL_TRANSFORM_LEVEL`;class bY extends EF{constructor(t){var e,i;super(t),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)?this._transformRatioText: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[dY])).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 this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return u(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class xY extends HD{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class SY extends xY{constructor(){super(...arguments),this.type=SY.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}SY.type="polygon";const kY=()=>{eI.registerMark(SY.type,SY),qA(),UA(),uT.registerBuiltInAnimate("growPointsOut",uC),eI.registerGraphicComponent("polygon",lf)},AY=Object.assign(Object.assign({},NF),{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"}});class MY extends nz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class wY extends rz{constructor(){super(...arguments),this.type=mO.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=MY,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,i,s,n;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._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;TL(this._dataSet,"funnel",lY),TL(this._dataSet,"funnelTransform",hY);const t=new Ba(this._dataSet,{name:`${MI}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new LD(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}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:vY,asTransformRatio:cY,asReachRatio:dY,asHeightRatio:uY,asValueRatio:pY,asNextValueRatio:fY,asLastValueRatio:gY,asLastValue:mY,asNextValue:_Y,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:yY}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},wY.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:tz(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},wY.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),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(wY.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(wY.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new bY(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(){var t,e,i,s;const n=this._funnelMark;n&&this.setMarkStyle(n,{points:t=>this.getPoints(t),visible:t=>u(t[this._valueField]),fill:this.getColorAttribute()},"normal",lD.Series);const r=this._funnelTransformMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t)},"normal",lD.Series);const a=this._funnelOuterLabelMark.label;a&&(this.setMarkStyle(a,{text:t=>`${t[this.getCategoryField()]}`,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),width:0,height:0},"normal",lD.Series),c(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(a,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",lD.User_Mark));const o=this._funnelOuterLabelMark.line;if(o&&a){this.setMarkStyle(o,{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",lD.Series);const n=null!==(i=null===(e=null===(t=this._spec.outerLabel)||void 0===t?void 0:t.line)||void 0===e?void 0:e.visible)&&void 0!==i?i:null===(s=this._spec.outerLabel)||void 0===s?void 0:s.visible;u(n)&&o.setVisible(n)}}initLabelMarkStyle(t){var e;if(!t)return;const i=t.getTarget(),s=t.getComponent();if(i===this._funnelMark){this._labelMark=t,this.setMarkStyle(t,{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",lD.Series);const i=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&Fy(i,this._funnelOuterLabelMark.label,s),this._funnelOuterLabelMark.line&&Fy(i,this._funnelOuterLabelMark.line,null!==(e=this._funnelOuterLabelMark.label)&&void 0!==e?e:s)}else this._funnelTransformMark&&i===this._funnelTransformMark&&(this._transformLabelMark=t,this.setMarkStyle(t,{text:t=>`${(100*pO(dY).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",lD.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(qF(null===(s=eI.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.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),ZF("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(qF(eI.getAnimationInKey("fadeInOut")(),ZF(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(qF(eI.getAnimationInKey("funnel")({},o),ZF(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(qF(null===(a=eI.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),ZF("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[gY])/2:this._getSecondaryAxisLength(t[pY])/2,n=this._getSecondaryAxisLength(t[pY])/2):(s=this._getSecondaryAxisLength(t[pY])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[fY])/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[yY])}_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 u(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[EI]===t[EI]));if(!u(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(x(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,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,_,y;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h: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!==f.alignLabel?(null==u?void 0:u.y2)+e:_-e,m=this._getPolygonCenter(i).x,_-y{kY(),KN(),aN(),eI.registerSeries(wY.type,wY),eI.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},JD))),eI.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:YT,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),tF()},CY=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},BY=t=>{const e=t.filter((t=>t.context.diffState===hD.update)),i=$(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},EY=(t,e,i)=>{if(E(t))return[e,i];const s=$(t.map((t=>1*t.getFinalAttribute().startAngle))),n=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},PY=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=BY(i.parent.children),a=EY(r,s,n);return CY(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=BY(i.parent.children),a=EY(r,s,n);return CY(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),RY=t=>{const e=$(t.map((t=>1*t.getFinalAttribute().startAngle))),i=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},OY=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=BY(i.parent.children),a=RY(r);return CY(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=BY(i.parent.children),a=RY(r);return CY(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),IY=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},LY=(t,e={})=>{if(!t)return[];const i=[];return VU(t,i,e),i},DY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new fG(i).layout(t,{width:s,height:n})};class FY extends EF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var zY;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(zY||(zY={}));const jY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(d(n))return t;if(i.type===zY.DrillDown){return G(oL(t,n,s,"children"))}if(i.type===zY.DrillUp){const e=lL(t,n,s,"children");if(e)return G(e)}return t};class HY{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=WV(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(n.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;TL(t,"drillFilter",jY),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(d(t.datum)||d(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(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!_(t)||E(t))return t;const s=t[t.length-1];return this._drillInfo={key:s,path:t,type:zY.DrillDown},e().reRunAllTransform(),i.emit(bL.drill,{value:{path:t,type:zY.DrillDown},model:this}),t}drillUp(){var t,e;const{getRawData:i,event:s}=this._drillParams,n=null!==(e=null===(t=this._drillInfo)||void 0===t?void 0:t.path)&&void 0!==e?e:[];if(!_(n)||E(n))return n;const r=n.pop();return this._drillInfo={key:r,path:n,type:zY.DrillUp},i().reRunAllTransform(),s.emit(bL.drill,{value:{path:n,type:zY.DrillUp},model:this}),n}}const VY=Object.assign(Object.assign({},NF),{sunburst:{name:"sunburst",type:"arc"}}),NY=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:LF,operations:["max","min","values"]}),t.push({key:DF,operations:["values"]}),t),WY={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,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"}}}};class UY extends cW{constructor(){super(...arguments),this.type=mO.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:DF),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:EI},getRawData:()=>this.getRawData()}),this._startAngle=re(this._spec.startAngle),this._endAngle=re(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),TL(this._dataSet,"sunburstLayout",DY),TL(this._dataSet,"flatten",LY),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:[u(this._centerX)?this._centerX:this.getLayoutRect().width/2,u(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 NY(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();d(null==t?void 0:t.dataSet)||(TL(t.dataSet,"addVChartProperty",kF),t.transform({type:"addVChartProperty",options:{beforeCall:HF.bind(this),call:VF}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(UY.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_initArcMarkStyle(){d(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(u(this._offsetX)?this._offsetX:0),y:t=>t.y+(u(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},cD.STATE_NORMAL,lD.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(UY.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){d(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return p(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)+(u(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(u(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},cD.STATE_NORMAL,lD.Series)}initTooltip(){this._tooltipHelper=new FY(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(G(this.__innerRadius))[0],outerRadius:this._computeRadius(G(this.__outerRadius))[0],startAngle:G(this._startAngle)[0],endAngle:G(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(qF(null===(e=eI.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),ZF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(qF(null===(e=eI.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),ZF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_computeRadius(t){return _(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]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}UY.type=mO.sunburst,UY.mark=VY,UY.builtInTheme={sunburst:WY},U(UY,HY);const GY=()=>{eI.registerSeries(UY.type,UY),SW(),KN(),tF(),eI.registerAnimation("sunburst",((t,e)=>({appear:IY(0,e),enter:PY(t),exit:OY(t),disappear:{duration:qD.disappear.duration}})))},YY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new sG(i).layout(t,{width:s,height:n})};class XY extends EF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const $Y=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},KY=Object.assign(Object.assign({},NF),{circlePacking:{name:"circlePacking",type:"arc"}});class qY extends lz{constructor(){super(...arguments),this.type=mO.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:DF),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:EI},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();d(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),TL(this._dataSet,"circlePackingLayout",YY),TL(this._dataSet,"flatten",LY),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();d(null==t?void 0:t.dataSet)||(TL(t.dataSet,"addVChartProperty",kF),t.transform({type:"addVChartProperty",options:{beforeCall:HF.bind(this),call:VF}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(qY.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_initCirclePackingMarkStyle(){d(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},cD.STATE_NORMAL,lD.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(qY.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){d(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},cD.STATE_NORMAL,lD.Series)}getStatisticFields(){return NY(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new XY(this),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(qF(null===(i=eI.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),ZF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(qF(null===(e=eI.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),ZF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}qY.type=mO.circlePacking,qY.mark=KY,qY.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,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"}}}}},U(qY,HY);const ZY=()=>{eI.registerSeries(qY.type,qY),SW(),KN(),QD(),eI.registerAnimation("circlePacking",((t,e)=>({appear:$Y(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:qD.disappear.duration}})))},JY=(t,e,i)=>{e.forEach((e=>{d(e[i])||t.add(e[i]),e.children&&e.children.length>0&&JY(t,e.children,i)}))},QY=t=>{var e;if(!t||!_(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},tX=(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 uG(e),r=[];return r.push(n.layout(s,i)),r},eX=t=>{var e,i;return t&&_(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:[]},iX=t=>{var e,i;return t&&_(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 sX extends EF{constructor(){super(...arguments),this._getDimensionData=t=>{if(t.source){if(x(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},this.markTooltipValueCallback=t=>t.value}}const nX=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),rX=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:nX(t),aX=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class oX extends kT{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class lX extends kT{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const hX=(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,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=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}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},cX=(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,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=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}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class dX extends EN{constructor(){super(...arguments),this.type=dX.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?cX:hX,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}dX.type="linkPath";const uX=Object.assign(Object.assign({},NF),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class pX extends nz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const gX=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&t.removeState(e),t.addState(e,s,n)};class fX extends lz{constructor(){super(...arguments),this.type=mO.sankey,this.transformerConstructor=pX,this._nodeLayoutZIndex=aD.Node,this._labelLayoutZIndex=aD.Label,this._viewBox=new je,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(u(a))return a;if(u(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;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(u(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=x(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var t,e;if(!this._needClear)return;const i=null===(t=this._nodeMark)||void 0===t?void 0:t.getGraphics();if(!i||!i.length)return;const s=null===(e=this._linkMark)||void 0===e?void 0:e.getGraphics();s&&s.length&&(i.forEach((t=>{t.removeState(cD.STATE_SANKEY_EMPHASIS),t.removeState(cD.STATE_SANKEY_EMPHASIS_REVERSE)})),s.forEach((t=>{t.removeState(cD.STATE_SANKEY_EMPHASIS),t.removeState(cD.STATE_SANKEY_EMPHASIS_REVERSE)})),this._needClear=!1)},this._handleNodeAdjacencyClick=t=>{const e=fL(t),i=[e.key];if(this._linkMark){const t=this._linkMark.getGraphics();if(!t||!t.length)return;t.forEach(((t,s)=>{const n=fL(t);n.source===e.key?(i.includes(n.target)||i.push(n.target),t.removeState(cD.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(cD.STATE_SANKEY_EMPHASIS,!0)):n.target===e.key?(i.includes(n.source)||i.push(n.source),t.removeState(cD.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(cD.STATE_SANKEY_EMPHASIS,!0)):(t.removeState(cD.STATE_SANKEY_EMPHASIS),t.addState(cD.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),i),this._needClear=!0},this._handleLinkAdjacencyClick=t=>{const e=fL(t),i=[e.source,e.target];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach((e=>{e===t?(e.removeState(cD.STATE_SANKEY_EMPHASIS_REVERSE),gX(e,cD.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState(cD.STATE_SANKEY_EMPHASIS),e.addState(cD.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),i),this._needClear=!0},this._handleNodeRelatedClick=t=>{var e;const i=fL(t),s=this._nodeMark.getGraphics();if(!s||!s.length)return;const n=this._linkMark.getGraphics();if(!n||!n.length)return;const r=(null===(e=fL(n[0]))||void 0===e?void 0:e.parents)?"parents":"source";if("source"===r){const t=[i.key],e=[];if(n.forEach(((n,r)=>{var a,o,l,h;const c=fL(n),d=(null==c?void 0:c.parents)?"parents":"source";if(G(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.getGraphics();if(!t||!t.length)return;t.forEach(((t,i)=>{var s;const n=fL(t);e.includes(null!==(s=n.key)&&void 0!==s?s:n.index)?(t.removeState(cD.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(cD.STATE_SANKEY_EMPHASIS,!0)):(t.removeState(cD.STATE_SANKEY_EMPHASIS),t.addState(cD.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),t)}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(G(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 a=fL(s),o=a.datum,l=o?o.filter((t=>t[r].some((t=>t.key===i.key)))):null,h=e.find((t=>t.source===a.source&&t.target===a.target));if(l&&l.length){t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target);const e=l.reduce(((t,e)=>t+e.value),0),i=e/a.value;return s.removeState(cD.STATE_SANKEY_EMPHASIS_REVERSE),void gX(s,cD.STATE_SANKEY_EMPHASIS,{ratio:i})}if(h)return t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target),s.removeState(cD.STATE_SANKEY_EMPHASIS_REVERSE),void gX(s,cD.STATE_SANKEY_EMPHASIS,{ratio:h.value/a.value});s.removeState(cD.STATE_SANKEY_EMPHASIS),s.addState(cD.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),t)}this._needClear=!0},this._handleLinkRelatedClick=t=>{const e=this._nodeMark.getGraphics();if(!e||!e.length)return;const i=this._linkMark.getGraphics();if(!i||!i.length)return;if("source"===(fL(t)?"parents":"source"))this._linkMark&&i.forEach((t=>{t.removeState(cD.STATE_SANKEY_EMPHASIS),t.removeState(cD.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&e.forEach((t=>{t.removeState(cD.STATE_SANKEY_EMPHASIS),t.removeState(cD.STATE_SANKEY_EMPHASIS_REVERSE)}));else{const s=fL(t),n=[s.source,s.target],r=[];G(s.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})}})),i.forEach((t=>{const e=fL(t),i=e.datum;if(e.source===s.source&&e.target===s.target)return t.removeState(cD.STATE_SANKEY_EMPHASIS_REVERSE),void gX(t,cD.STATE_SANKEY_EMPHASIS,{ratio:1});const a=i?i.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(s.source)&&e.includes(s.target)})):null;if(a&&a.length){n.includes(e.source)||n.push(e.source),n.includes(e.target)||n.push(e.target);const i=a.filter((t=>t.parents.some(((e,i)=>{var n;return e.key===s.source&&(null===(n=t.parents[i+1])||void 0===n?void 0:n.key)===s.target})))).reduce(((t,e)=>t+e.value),0),r=i/e.value;return t.removeState(cD.STATE_SANKEY_EMPHASIS_REVERSE),void gX(t,cD.STATE_SANKEY_EMPHASIS,{ratio:r})}const o=r.find((t=>t.source===e.source&&t.target===e.target));if(o)return n.includes(e.source)||n.push(e.source),n.includes(e.target)||n.push(e.target),t.removeState(cD.STATE_SANKEY_EMPHASIS_REVERSE),void gX(t,cD.STATE_SANKEY_EMPHASIS,{ratio:o.value/e.value});t.removeState(cD.STATE_SANKEY_EMPHASIS),t.addState(cD.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(e,n)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}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:this._spec.categoryField)}initData(){var t,e,i,s;super.initData();const n=this.getViewData(),r=this.getRawData();if(r&&n){TL(this._dataSet,"sankeyLayout",tX),TL(this._dataSet,"sankeyFormat",QY),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.direction,crossNodeAlign:this._spec.crossNodeAlign,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,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,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,inverse:this._spec.inverse},level:jL.sankeyLayout});const{dataSet:a}=this._option;TL(a,"sankeyNodes",eX),TL(a,"flatten",LY);const o=new Ba(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:zF.bind(this),call:jF}},!1),this._nodesSeriesData=o,TL(a,"sankeyLinks",iX);const l=new Ba(a,{name:`sankey-link-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyLinks"}),l.transform({type:"addVChartProperty",options:{beforeCall:zF.bind(this),call:jF}},!1),this._linksSeriesData=l}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(fX.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(fX.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=G(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,i=G(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()}_initNodeMarkStyle(){var t,e;const i=this._nodeMark;i&&(this.setMarkStyle(i,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},cD.STATE_NORMAL,lD.Mark),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.node.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByNode},"normal",lD.User_Mark))}_initLinkMarkStyle(){var t,e;const i=this._linkMark;i&&(i.setGlyphConfig({direction:this.direction}),this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},cD.STATE_NORMAL,lD.Series),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.link.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByLink},"normal",lD.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(d(t)||d(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=yF(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={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;this._nodeMark&&this._nodeMark.setAnimationConfig(qF(null===(i=eI.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),ZF("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(qF(null===(s=eI.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),ZF("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:SL.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(t,e){t&&t.length&&t.forEach((t=>{t.removeState([cD.STATE_SANKEY_EMPHASIS_REVERSE,cD.STATE_SANKEY_EMPHASIS]),e.includes(fL(t).key)?t.addState(cD.STATE_SANKEY_EMPHASIS,!0):t.addState(cD.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new sX(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_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&&!d(a[0])||(a=this.getNodeList(),a&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new BO;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_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=>{u(t[i])&&e.add(t[i]),u(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 JY(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),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]}getMarkData(t){return t.datum?_(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}fX.type=mO.sankey,fX.transformerConstructor=pX,fX.mark=uX,fX.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const mX=()=>{pV(),PN(),NA(),eI.registerGraphicComponent("path",(t=>Jg(t))),eI.registerMark(dX.type,dX),KN(),eI.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:rX(t,e)},JD))),eI.registerAnimation("sankeyLinkPath",((t,e)=>({appear:aX(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:qD.disappear.duration}}))),uT.registerBuiltInAnimate("linkPathGrowOut",lX),uT.registerBuiltInAnimate("linkPathGrowIn",oX),tF(),eI.registerSeries(fX.type,fX)},vX=(t,e)=>{let i={},s=e.fields;if(c(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=LY(n);return i=RF([{latestData:r}],e),i};class _X extends EF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const yX=Object.assign(Object.assign({},NF),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),bX=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class xX extends nz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const SX=(t,e)=>{if(e.getViewBox()){const i=new yG(e).layout(t,e.getViewBox()),s=[];return VU(i,s,{maxDepth:null==e?void 0:e.maxDepth}),s.forEach(((t,i)=>{t&&[DF,"name"].forEach((i=>{t[i]=t.datum[t.depth][e.nameField]}))})),s}return[]};class kX extends lz{constructor(){super(...arguments),this.type=mO.treemap,this.transformerConstructor=xX,this._categoryField="name",this._valueField="value",this._viewBox=new je,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:DF),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ne),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:EI},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,s,n;super.initData(),TL(this._dataSet,"treemap",SX),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{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}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(TL(this._rawData.dataSet,"addVChartProperty",kF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:HF.bind(this),call:VF}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=vX([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=z(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){TL(this._dataSet,"hierarchyDimensionStatistics",vX),TL(this._dataSet,"flatten",LY);const i=new Ba(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 NY(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(kX.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(kX.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}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()},cD.STATE_NORMAL,lD.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()},cD.STATE_NORMAL,lD.Series)}_initRichStyleOfLabelMark(t){"rich"===t.getTextType()&&this.setMarkStyle(t,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},cD.STATE_NORMAL,lD.Series)}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{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},cD.STATE_NORMAL,lD.Series),this._initRichStyleOfLabelMark(t))}initNonLeafLabelMarkStyle(t){t&&(this._nonLeafLabelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{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},cD.STATE_NORMAL,lD.Series),this._initRichStyleOfLabelMark(t))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(qF(null===(e=eI.getAnimationInKey("treemap"))||void 0===e?void 0:e(),ZF(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(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(_L.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(_L.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}kX.type=mO.treemap,kX.mark=yX,kX.builtInTheme={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"}}}},kX.transformerConstructor=xX,U(kX,HY),U(kX,GV);const AX=()=>{eI.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),eI.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),pV(),KN(),eI.registerAnimation("treemap",((t,e)=>({appear:bX(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:qD.disappear.duration}}))),tF(),eI.registerSeries(kX.type,kX)},MX=Object.assign(Object.assign({},dU),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),wX=Object.assign(Object.assign({},NF),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),TX={type:"fadeIn"};function CX(t,e){return"fadeIn"===e?TX:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class BX extends nz{constructor(){super(...arguments),this._supportStack=!1}}class EX extends EF{enableByType(t){return"dimension"!==t}}const PX="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",RX={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:PX,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:PX,fill:"#ddd"}}};class OX extends uU{constructor(){super(...arguments),this.type=mO.gaugePointer,this.transformerConstructor=BX,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(OX.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},OX.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(OX.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(){this._tooltipHelper=new EX(this),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 u(this.radiusAxisHelper)&&u(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=mt(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})}getInteractionTriggers(){return 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(qF(null===(i=eI.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),ZF("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}OX.type=mO.gaugePointer,OX.mark=wX,OX.builtInTheme={gaugePointer:RX},OX.transformerConstructor=BX;const IX=()=>{eI.registerSeries(OX.type,OX),zV(),pV(),eI.registerAnimation("gaugePointer",((t,e)=>{const i=CX(t,e);return{appear:i,enter:i,disappear:{duration:qD.disappear.duration}}})),UW(),NW()};class LX extends nz{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class DX extends uU{constructor(){super(...arguments),this.type=mO.gauge,this.transformerConstructor=LX,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=re(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();TL(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[KI]=t[this._angleField[0]],t[$I]=e>0?i[e-1][KI]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(DX.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(DX.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})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(t,e){if(super.initMarkStyleWithSpec(t,e),t&&"segment"===t.name){const e=this.getSpec().segment;if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,lD.User_Mark)}}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),s=_t(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?RO(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=_t(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?RO(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return u(t[$I])?this.angleAxisHelper.dataToPosition([t[$I]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[KI]])}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(qF(null===(i=eI.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),ZF("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}DX.type=mO.gauge,DX.mark=MX,DX.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},DX.transformerConstructor=LX;class FX extends HD{constructor(){super(...arguments),this.type=FX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Tg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="rect":a.symbolType=o,a}}FX.type="cell";function zX(t){return!1===t?{}:{type:"fadeIn"}}class jX extends EF{enableByType(t){return"dimension"!==t}}const HX=Object.assign(Object.assign({},NF),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class VX extends nz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class NX extends lz{constructor(){super(...arguments),this.type=mO.heatmap,this.transformerConstructor=VX}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=G(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(NX.mark.cell,{isSeriesMark:!0},{morph:tz(this._spec,NX.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(NX.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){var e,i,s;t&&this.setMarkStyle(t,{fill:null!==(s=null===(i=null===(e=this._spec.cell)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s: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",lD.Series)}initCellBackgroundMarkStyle(){var t,e,i;const s=ni(null!==(i=null===(e=null===(t=this._spec.cellBackground)||void 0===t?void 0:t.style)||void 0===e?void 0:e.padding)&&void 0!==i?i:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+s[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+s[0]},width:()=>this.getCellSize(this._xAxisHelper)-s[1]-s[3],height:()=>this.getCellSize(this._yAxisHelper)-s[0]-s[2]},"normal",lD.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue()[0]}}getInteractionTriggers(){return 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=oz(this);this._cellMark.setAnimationConfig(qF(null===(i=eI.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),ZF("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 jX(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}NX.type=mO.heatmap,NX.mark=HX,NX.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1},label:{style:{lineWidth:2}}}},NX.transformerConstructor=VX;const WX=()=>{KN(),eI.registerMark(FX.type,FX),eI.registerGraphicComponent("symbol",Tg),qA(),JA(),zE(),eI.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},JD),{appear:zX(e)}))),Wj(),jj(),eI.registerSeries(NX.type,NX)},UX=Object.assign(Object.assign({},NF),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),GX=`${MI}_CORRELATION_X`,YX=`${MI}_CORRELATION_Y`,XX=`${MI}_CORRELATION_SIZE`,$X=(t,e)=>{var i,s,n,r,a,o,l,h,c,u,p,g,f,m,v;if(!t||!(null==e?void 0:e.view)||!_(t))return t;const y=e.view();if(y.x1-y.x0==0||y.y1-y.y0==0||y.x1-y.x0==-1/0||y.x1-y.x0==1/0||y.y1-y.y0==-1/0||y.y1-y.y0==1/0)return t;const b=re(null!==(i=e.startAngle)&&void 0!==i?i:-90),S=re(null!==(s=e.endAngle)&&void 0!==s?s:270),k=Math.max((y.x1-y.x0)/2,(y.y1-y.y0)/2),A=Et(null!==(n=e.innerRadius)&&void 0!==n?n:0,k),M=Et(e.outerRadius,k),w=[x(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:y.x0+Et(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",y.x1-y.x0),x(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:y.y0+Et(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",y.y1-y.y0)],T=Bt(e.field),C=t.map(T),[B,E]=Rt(C),P=B===E?t=>(A+M)/2:t=>A+(M-A)*(t-B)/(E-B),R=d(e.radiusField)?T:Bt(e.radiusField),O=null!==(p=null===(u=null==e?void 0:e.radiusRange)||void 0===u?void 0:u[1])&&void 0!==p?p:5;let I=t=>O;if(R){const[i,s]=R!==T?Rt(t.map(R)):[B,E],n=null!==(f=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==f?f:5,r=null!==(v=null===(m=e.radiusRange)||void 0===m?void 0:m[1])&&void 0!==v?v:5;i!==s&&(I=t=>n+(r-n)*(R(t)-i)/(s-i))}const L=Math.min(b,S),D=Math.max(b,S),F=KX(L,D,t.length),z=[],j=(D-L)/60;return t.forEach(((t,e)=>{const i=P(C[e]),s=I(t);let n,r,a=F[e];for(let t=0;t<60&&(n=w[0]+i*Math.cos(a),r=w[1]+i*Math.sin(a),qX({x:n,y:r,size:s},z)||n-sy.x1||r-sy.y1);t++)t<59&&(a+=j,a>D?a=L: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},qX=(t,e)=>!(!e||!e.length)&&e.some((e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2){if(!t||!_(t))return[];const{keyword:i,categoryField:s}=e,n=t[0].latestData[0];return{[s]:i,[BI]:null==n?void 0:n[BI],[PI]:null==n?void 0:n[PI]}};class JX extends EN{constructor(){super(...arguments),this.type=JX.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=mt(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}JX.type="ripple";const QX=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class t$ extends nz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class e$ extends cW{constructor(){super(...arguments),this.type=mO.correlation,this.transformerConstructor=t$,this._viewBox=new je}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){u(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){u(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){u(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;TL(this._dataSet,"correlation",$X);const s=new Ca;CL(s,"dataview",Ma),TL(s,"correlationCenter",ZX);const n=new Ba(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 LD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_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(){const t=this._createMark(e$.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:BI});t&&(t.setMarkConfig({zIndex:aD.Node}),this._nodePointMark=t);const e=this._createMark(e$.mark.ripplePoint,{key:BI,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});e&&(this._ripplePointMark=e);const i=this._createMark(e$.mark.centerPoint,{key:BI,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(i.setMarkConfig({zIndex:aD.Node}),this._centerPointMark=i)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var t,e,i,s;const n=this._nodePointMark;if(!n)return;const r=null!==(e=null===(t=this._spec.nodePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(n,{x:t=>t[GX],y:t=>t[YX],size:t=>t[XX],fill:null!==(i=r.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(s=r.fillOpacity)&&void 0!==s?s:1,lineWidth:0},cD.STATE_NORMAL,lD.Series)}_initRipplePointMarkStyle(){var t,e,i,s,n;const r=this._ripplePointMark;if(!r)return;const a=null!==(e=null===(t=this._spec.ripplePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(r,{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!==(i=a.fill)&&void 0!==i?i:this.getColorAttribute(),opacity:null!==(s=a.fillOpacity)&&void 0!==s?s:.2,ripple:null!==(n=a.ripple)&&void 0!==n?n:0},cD.STATE_NORMAL,lD.Series)}_initCenterPointMarkStyle(){var t,e,i,s,n,r;const a=this._centerPointMark;a&&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:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(i=null===(e=null===(t=this._spec.centerPoint)||void 0===t?void 0:t.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(r=null===(n=null===(s=this._spec.centerPoint)||void 0===s?void 0:s.style)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1},cD.STATE_NORMAL,lD.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},cD.STATE_NORMAL,lD.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(qF(null===(e=eI.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),ZF("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(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}e$.type=mO.correlation,e$.mark=UX,e$.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},e$.transformerConstructor=t$;const i$=()=>{Iz(),PN(),JA(),eI.registerMark(JX.type,JX),eI.registerGraphicComponent("symbol",(t=>Tg(t))),eI.registerSeries(e$.type,e$),eI.registerAnimation("correlation",((t,e)=>Object.assign({appear:QX(0,e)},ZD)))},s$=Object.assign(Object.assign({},NF),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class n$ extends EN{constructor(){super(...arguments),this.type=n$.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}n$.type="liquid";const r$=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class a$ extends EF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class o$ extends rz{constructor(){super(...arguments),this.type=mO.liquid,this.transformerConstructor=Lz,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Ig({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Tg({x:s,y:n,size:r,symbolType:r$(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){u(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=VO(this._spec.outlineMargin),this._paddingSpec=VO(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Ut(...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(o$.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(o$.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(o$.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(o$.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const t=this._liquidOutlineMark;t.created(),this.setMarkStyle(t,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",lD.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const t=this._liquidBackgroundMark;t.created(),this.setMarkStyle(t,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",lD.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const t=this._liquidMark,e=this._liquidGroupMark;e&&this.setMarkStyle(e,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),t&&this.setMarkStyle(t,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",lD.Series)}initTooltip(){this._tooltipHelper=new a$(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(qF(null===(i=eI.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),ZF("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(qF(null===(s=eI.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),ZF("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(bL.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=SM(t.attribute.fill,n.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]}}o$.type=mO.liquid,o$.mark=s$,o$.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},o$.transformerConstructor=Lz;const l$=t=>G(t).join(",");class h$ extends EF{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>l$(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>l$(null==t?void 0:t[this.series.getDimensionField()[0]])}}const c$=Object.assign(Object.assign({},NF),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class d$ extends nz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const u$=(t,e)=>{const i=e.getViewBox();return i&&(null==t?void 0:t.length)?PG(Object.assign({setField:e.setField,valueField:e.valueField},i),t):[]};class p$ extends rz{constructor(){super(...arguments),this.type=mO.venn,this.transformerConstructor=d$,this._viewBox=new je}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:EI)}initData(){var t;super.initData(),TL(this._dataSet,"venn",u$),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:{getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField}})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(p$.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(p$.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()},cD.STATE_NORMAL,lD.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},cD.STATE_NORMAL,lD.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},cD.STATE_HOVER,lD.Series))}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>l$(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)}},cD.STATE_NORMAL,lD.Series))}initOverlapLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>l$(t.sets)},cD.STATE_NORMAL,lD.Series))}initTooltip(){this._tooltipHelper=new h$(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(){super.onLayoutEnd(),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:l$(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return l$(i)}legendSelectedFilter(t,e){if(t.type===n.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[l$(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>G(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(l$(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(qF(null===(e=eI.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),ZF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(qF(null===(e=eI.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),ZF(t.name,this._spec,this._markAttributeContext)))}))}}p$.type=mO.venn,p$.mark=c$,p$.builtInTheme={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"}}}}},p$.transformerConstructor=d$;class g$ extends _V{constructor(){super(...arguments),this.type=mO.mosaic,this.transformerConstructor=vV}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(GI),this.setFieldX2(UI)),this.setFieldY(XI),this.setFieldY2(YI)):(t&&(this.setFieldY(GI),this.setFieldY2(UI)),this.setFieldX(XI),this.setFieldX2(YI)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&d(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];d(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}g$.type=mO.mosaic,g$.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},g$.transformerConstructor=vV;class f$ extends uH{_isValidSeries(t){return t===mO.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class m$ extends cH{constructor(){super(...arguments),this.transformerConstructor=f$,this.type="map",this.seriesType=mO.map}}m$.type="map",m$.seriesType=mO.map,m$.transformerConstructor=f$;class v$ extends uH{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=G(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 u(r)&&n.forEach((t=>{d(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],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),u(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class _$ extends v${needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_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)),d(l.type)&&(l.type="linear"),d(o.type)&&(o.type="band");const h=Xz(l,{min:0,max:1});d(l.min)&&(l.min=h.min),d(l.max)&&(l.max=h.max),s&&Object.assign(l,tI({},s,l)),n&&Object.assign(o,tI({},n,o))}}class y$ extends v${needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}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 b$ extends v${needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class x$ extends cH{constructor(){super(...arguments),this.transformerConstructor=b$}}x$.transformerConstructor=b$;class S$ extends x${constructor(){super(...arguments),this.transformerConstructor=b$,this.type="pie",this.seriesType=mO.pie}}S$.type="pie",S$.seriesType=mO.pie,S$.transformerConstructor=b$;class k$ extends y${_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return n.radius=null!==(e=t.radius)&&void 0!==e?e:hj,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:hj,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}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&&d(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=G(t.crosshair||{}).map((t=>tI({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const A$=(t,e)=>{if(!t)return null;const i=Sz(t,(t=>"angle"===t.getOrient()),e),s=Sz(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&sB(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),u={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=oO({x:1,y:0},u);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=lO(u),f=null===(e=s[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(d(v))return;let _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=bz(v,t,"polar",r);n.push({index:_,value:v,position:i.scale(v),axis:t,data:y})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&sB(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let u=oO({x:1,y:0},c);u<-Math.PI/2&&(u=2*Math.PI+u);const p=lO(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((u-(null==f?void 0:f[0]))*(u-(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=s.invert(p);if(d(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const _=bz(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:_})}})),n.length?n:null};class M$ extends cH{constructor(){super(...arguments),this.transformerConstructor=k$,this.type="rose",this.seriesType=mO.rose}_setModelOption(){this._modelOption.getDimensionInfo=A$}}M$.type="rose",M$.seriesType=mO.rose,M$.transformerConstructor=k$,U(M$,vH);class w$ extends y${_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t);return i.line=t.line,i.point=t.point,i.stack=t.stack,i.percent=t.percent,i.area=tI({visible:!1},t.area),i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"area",i.activePoint=t.activePoint,i.pointDis=t.pointDis,i.pointDisMul=t.pointDisMul,i.markOverlap=t.markOverlap,i}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=G(t.crosshair||{}).map((t=>tI({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class T$ extends cH{constructor(){super(...arguments),this.transformerConstructor=w$,this.type="radar",this.seriesType=mO.radar}_setModelOption(){this._modelOption.getDimensionInfo=A$}}T$.type="radar",T$.seriesType=mO.radar,T$.transformerConstructor=w$,U(T$,vH);class C$ extends uH{_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=p(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=>{P(e,"trimPadding")&&tI(e,iD(this.type,t))})),this._transformAxisSpec(t)}}class B$ extends cH{constructor(){super(...arguments),this.transformerConstructor=C$,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=TH(t,e,i))&&void 0!==s?s:[],...null!==(n=A$(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=BH,this._modelOption.getRectByDimensionData=LH}}B$.type="common",B$.transformerConstructor=C$,U(B$,vH);class E$ extends pH{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class P$ extends cH{constructor(){super(...arguments),this.transformerConstructor=E$}}P$.transformerConstructor=E$,U(P$,vH);class R$ extends E${transformSpec(t){super.transformSpec(t),QL(t)}}class O$ extends P${constructor(){super(...arguments),this.transformerConstructor=R$,this.type="histogram",this.seriesType=mO.bar}_setModelOption(){this._modelOption.getDimensionInfo=TH,this._modelOption.getDimensionInfoByValue=BH,this._modelOption.getRectByDimensionData=LH}}O$.type="histogram",O$.seriesType=mO.bar,O$.transformerConstructor=R$;class I$ extends _${_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class L$ extends cH{constructor(){super(...arguments),this.transformerConstructor=I$,this.type="circularProgress",this.seriesType=mO.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=A$}}L$.type="circularProgress",L$.seriesType=mO.circularProgress,L$.transformerConstructor=I$,U(L$,vH);class D$ extends _${_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=mO.circularProgress,e}transformSpec(t){var e,i,s,n,r;super.transformSpec(t);let a=null===(e=t.series)||void 0===e?void 0:e.find((t=>t.type===mO.gauge||t.type===mO.circularProgress));d(a)&&(a=null!==(i=t.gauge)&&void 0!==i?i:this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===a.type&&(d(a.radiusField)&&d(a.categoryField)&&(a.radiusField=null!==(n=null!==(s=t.radiusField)&&void 0!==s?s:t.categoryField)&&void 0!==n?n:t.seriesField),d(a.valueField)&&d(a.angleField)&&(a.valueField=null!==(r=t.valueField)&&void 0!==r?r:t.angleField)),1===t.series.length?t.series.push(a):t.series.forEach((t=>{t.type===a.type&&Object.keys(a).forEach((e=>{e in t||(t[e]=a[e])}))}))),a.type===mO.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:aD.Region+50}):this._transformGaugeAxisSpec(t)}_transformGaugeAxisSpec(t){var e;t.axes||(t.axes=[]);const i={radius:null,angle:null};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=t),"angle"===e&&(i.angle=t)})),i.angle||(i.angle={orient:"angle",visible:!0},t.axes.push(i.angle)),i.radius||(i.radius={orient:"radius",visible:!1},t.axes.push(i.radius)),d(i.angle.type)&&(i.angle.type="linear"),d(i.radius.type)&&(i.radius.type="linear"),d(i.angle.zIndex)&&(i.angle.zIndex=aD.Region+50)}}class F$ extends cH{constructor(){super(...arguments),this.transformerConstructor=D$,this.type="gauge",this.seriesType=mO.gaugePointer}}F$.type="gauge",F$.seriesType=mO.gaugePointer,F$.transformerConstructor=D$;class z$ extends uH{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class j$ extends cH{constructor(){super(...arguments),this.transformerConstructor=z$,this.type="wordCloud",this.seriesType=mO.wordCloud}}j$.transformerConstructor=z$;class H$ extends j${constructor(){super(...arguments),this.transformerConstructor=z$,this.type="wordCloud",this.seriesType=mO.wordCloud}}H$.type="wordCloud",H$.seriesType=mO.wordCloud,H$.transformerConstructor=z$;class V$ extends uH{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class N$ extends cH{constructor(){super(...arguments),this.transformerConstructor=V$,this.type="funnel",this.seriesType=mO.funnel}}N$.type="funnel",N$.seriesType=mO.funnel,N$.transformerConstructor=V$;class W$ extends pH{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}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)),d(s.type)&&(s.type="band"),d(i.type)&&(i.type="linear");const n=Xz(i,{min:0,max:1});d(i.min)&&(i.min=n.min),d(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)),d(s.type)&&(s.type="linear"),d(e.type)&&(e.type="band");const n=Xz(s,{min:0,max:1});d(s.min)&&(s.min=n.min),d(s.max)&&(s.max=n.max)}}}class U$ extends cH{constructor(){super(...arguments),this.transformerConstructor=W$,this.type="linearProgress",this.seriesType=mO.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=TH,this._modelOption.getDimensionInfoByValue=BH,this._modelOption.getRectByDimensionData=LH}}U$.type="linearProgress",U$.seriesType=mO.linearProgress,U$.transformerConstructor=W$,U(U$,vH);class G$ extends pH{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"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),QL(t)}}class Y$ extends cH{constructor(){super(...arguments),this.transformerConstructor=G$,this.type="rangeColumn",this.seriesType=mO.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=TH,this._modelOption.getDimensionInfoByValue=BH,this._modelOption.getRectByDimensionData=LH}}Y$.type="rangeColumn",Y$.seriesType=mO.rangeColumn,Y$.transformerConstructor=G$;class X$ extends uH{_getDefaultSeriesSpec(t){const e=u(t.startAngle)?t.startAngle:-90,i=u(t.endAngle)?t.endAngle:e+ae(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class $$ extends cH{constructor(){super(...arguments),this.transformerConstructor=X$,this.type="sunburst",this.seriesType=mO.sunburst}}$$.type="sunburst",$$.seriesType=mO.sunburst,$$.transformerConstructor=X$;class K$ extends uH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class q$ extends cH{constructor(){super(...arguments),this.transformerConstructor=K$,this.type="circlePacking",this.seriesType=mO.circlePacking}}q$.type="circlePacking",q$.seriesType=mO.circlePacking,q$.transformerConstructor=K$;class Z$ extends uH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class J$ extends cH{constructor(){super(...arguments),this.transformerConstructor=Z$,this.type="treemap",this.seriesType=mO.treemap}}J$.type="treemap",J$.seriesType=mO.treemap,J$.transformerConstructor=Z$;class Q$ extends bV{transformSpec(t){super.transformSpec(t),t.legends&&G(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),QL(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class tK extends xV{constructor(){super(...arguments),this.transformerConstructor=Q$,this.type="waterfall",this.seriesType=mO.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=TH,this._modelOption.getDimensionInfoByValue=BH,this._modelOption.getRectByDimensionData=LH}}tK.type="waterfall",tK.seriesType=mO.waterfall,tK.transformerConstructor=Q$;class eK extends pH{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),QL(t)}}class iK extends cH{constructor(){super(...arguments),this.transformerConstructor=eK,this.type="boxPlot",this.seriesType=mO.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=TH,this._modelOption.getDimensionInfoByValue=BH,this._modelOption.getRectByDimensionData=LH}}iK.type="boxPlot",iK.seriesType=mO.boxPlot,iK.transformerConstructor=eK;class sK extends uH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class nK extends cH{constructor(){super(...arguments),this.transformerConstructor=sK,this.type="sankey",this.seriesType=mO.sankey}_setStateInDatum(t,e,i,s){const n=_(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=fL(t))||void 0===e?void 0:e.datum;return _(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}nK.type="sankey",nK.seriesType=mO.sankey,nK.transformerConstructor=sK;class rK extends pH{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.area=t.area,s.point=t.point,s.line=t.line,"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),QL(t)}}class aK extends cH{constructor(){super(...arguments),this.transformerConstructor=rK,this.type="rangeArea",this.seriesType=mO.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=TH,this._modelOption.getDimensionInfoByValue=BH,this._modelOption.getRectByDimensionData=LH}}aK.type="rangeArea",aK.seriesType=mO.rangeArea,aK.transformerConstructor=rK;class oK extends pH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class lK extends cH{constructor(){super(...arguments),this.transformerConstructor=oK,this.type="heatmap",this.seriesType=mO.heatmap}}lK.type="heatmap",lK.seriesType=mO.heatmap,lK.transformerConstructor=oK;class hK extends uH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class cK extends cH{constructor(){super(...arguments),this.transformerConstructor=hK,this.type="correlation",this.seriesType=mO.correlation}}cK.type="correlation",cK.seriesType=mO.correlation,cK.transformerConstructor=hK;function dK(t){var e,i;const s=Object.assign({},t);return E(t.style)||(s.textStyle=pL(t.style)),E(t.textStyle)||tI(s.textStyle,pL(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&pL(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&pL(s.background.style),s}const uK=(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},pK=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const p={};c.forEach((t=>{p[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:PI;return h?h(t,c,g):(_(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===p[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===p[t.source]&&!0===p[t.target])))):u(g)&&(t=t.filter((t=>!0===p[r.getSeriesFieldValue(t,g)]))),t)};class gK extends fj{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=aD.Legend,this.layoutLevel=oD.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{cO(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),cO(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=LO(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;u(s)&&(this._seriesUserId=G(s)),u(e)&&(this._regionUserId=G(e)),u(n)&&(this._seriesIndex=G(n)),u(i)&&(this._regionUserIndex=G(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_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):(N(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const t=this._initLegendData();t.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new LD(this._option,t),this._initSelectedData(),cO(this._regions,(t=>{t.event.on(bL.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){var e,i,s;const n=this._selectedData;d(t)||JSON.stringify(n)===JSON.stringify(t)||(cO(this._regions,(e=>{e.legendSelectedFilter&&(t=e.legendSelectedFilter(this,t))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...t],null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(bL.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;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)N(s,this._cacheAttrs)||this._legendComponent.setAttributes(tI({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(tI({},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 t,e;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());N(t,this._cacheAttrs)||this._legendComponent.setAttributes(tI({},t,{defaultSelected:this._selectedData}))}null===(e=(t=this.effect).onSelectedDataChange)||void 0===e||e.call(t),this.event.emit(bL.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}gK.specKey="legends";class fK extends gK{constructor(){super(...arguments),this.type=n.discreteLegend,this.name=n.discreteLegend}static getSpecInfo(t){return bF(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(t){super.init(t),cO(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:jL.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){TL(this._option.dataSet,"discreteLegendFilter",pK),TL(this._option.dataSet,"discreteLegendDataMake",uK);const t=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return cO(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(d(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(!qy(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 c(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)&&d(t.title.text)&&d(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=tL(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(e){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(e,i){const s=t(e,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:n={},item:r={},pager:a={},background:o={}}=e;n=I(n),r=I(r),a=I(a),o=I(o);const l=s;return n.visible?l.title=dK(n):l.title={visible:!1},E(r.focusIconStyle)||pL(r.focusIconStyle),r.shape&&(r.shape=cL(r.shape)),r.label&&(r.label=cL(r.label)),r.value&&(r.value=cL(r.value)),r.background&&(r.background=cL(r.background)),DO(r.maxWidth)&&(r.maxWidth=Number(r.maxWidth.substring(0,r.maxWidth.length-1))*i.width/100),DO(r.width)&&(r.width=Number(r.width.substring(0,r.width.length-1))*i.width/100),DO(r.height)&&(r.height=Number(r.height.substring(0,r.height.length-1))*i.width/100),l.item=r,"scrollbar"===a.type?(E(a.railStyle)||pL(a.railStyle),E(a.sliderStyle)||pL(a.sliderStyle)):(E(a.textStyle)||pL(a.textStyle),a.handler&&cL(a.handler)),l.pager=a,o.visible&&!E(o.style)&&(tI(l,o.style),u(o.padding)&&(l.padding=o.padding)),l}(this._spec,e)),{maxWidth:e.width,maxHeight:e.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return _R}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(dR.legendItemClick,(e=>{const i=P(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(bL.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(dR.legendItemHover,(t=>{const e=P(t,"detail");this.event.emit(bL.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(dR.legendItemUnHover,(t=>{const e=P(t,"detail");this.event.emit(bL.legendItemUnHover,{model:this,value:e,event:t})}))}}_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 c(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}=yF(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=yF(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}fK.specKey="legends",fK.builtInTheme={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}},fK.type=n.discreteLegend;const mK=(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[]},vK=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!p(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!E(o)){const[e,i]=o;return a?a(t,o,l):h(t)?hL(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};const _K={color:kR,size:MR},yK={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}},bK=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},yK),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},xK={horizontal:bK(!0),vertical:bK(!1)},SK=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},yK),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},kK={horizontal:SK(!0),vertical:SK(!1)},AK=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],MK=[2,10];class wK extends gK{static getSpecInfo(t){const e=bF(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?n.colorLegend:n.sizeLegend})),e}constructor(t,e){super(t,e),this.type=n.colorLegend,this.name=n.colorLegend;const i="color"===this._spec.type?n.colorLegend:n.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),cO(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData,customFilter:this._spec.customFilter},level:jL.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(){TL(this._option.dataSet,"continuousLegendFilter",vK),TL(this._option.dataSet,"continuousLegendDataMake",mK);const t=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>dO(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)&&d(t.title.text)&&d(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=tL(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!qy(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=tL(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(e){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()),E(a)&&(a="color"===this._legendType?AK:MK);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(e){const i=tI({},e),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:d={},type:p,id:g,visible:f,orient:m,position:v,data:_,defaultSelected:y,field:b,filter:x,regionId:S,regionIndex:k,seriesIndex:A,seriesId:M,padding:w}=i,T=t(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?T.title=dK(s):T.title={visible:!1},T.showHandler=!1!==n.visible,E(n.style)||(T.handlerStyle=pL(n.style)),u(r.width)&&(T.railWidth=r.width),u(r.height)&&(T.railHeight=r.height),E(r.style)||(T.railStyle=pL(r.style)),E(a.style)||(T.trackStyle=pL(a.style)),T.startText=cL(o),T.endText=cL(l),T.handlerText=cL(h),E(c)||(T.sizeBackground=pL(c)),d.visible&&!E(d.style)&&(tI(T,d.style),u(d.padding)&&(T.padding=d.padding)),T}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return _K[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",bt((e=>{const i=P(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(bL.legendFilter,{model:this,value:i,event:e})}),30))}}}wK.specKey="legends",wK.builtInTheme={colorLegend:xK,sizeLegend:kK},wK.type=n.continuousLegend;const TK=(t,e)=>u(e)?t.map((t=>e[t])):void 0,CK=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),BK=t=>!d(t)&&(_(t)?t.length>0&&t.every(u):Object.keys(t).length>0);function EK(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),p=i.getOption(),g=p.getRegionsInUserIdOrIndex(u(c.regionId)?[c.regionId]:void 0,u(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=PK(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),_=g.getLayoutRect(),y=p.globalInstance.getContainer(),b=Object.assign({x:0,y:0},y?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(y):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>CK(i,s)(t)&&CK(n,r)(t)&&(d(a)||CK([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),k=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),_.width),y:Math.min(Math.max(t.y,0),_.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.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 l=[{value:t[e.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=>x(t))))&&void 0!==i?i:[]}}))}];u(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=p.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:xL.chart,event:k({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=p.globalInstance;return pF.globalConfig.uniqueTooltip&&pF.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=p.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:xL.chart,event:k(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=p.globalInstance;return pF.globalConfig.uniqueTooltip&&pF.hideTooltip(a.id),m}return"none"}const PK=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),p=e.getMeasureField(),g=e.getSeriesField(),f=u(g)?t[g]:void 0,m=u(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=TK(c,t);let _=TK(p,t);const y=BK(_),b=!y&&u(g)&&d(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(CK(c,v));if(!y&&(_=TK(p,i),!BK(_)))return;const n=e.type===mO.pie?e.dataToCentralPosition(i):e.dataToPosition(i);d(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:p,measureData:_,hasMeasureData:y,groupField:g,groupData:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=sB(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])=>d(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(CK(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=TK(p,o),!BK(_))return;const l=t.dataToPosition(o);d(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:p,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(CK(c,n));if(!y&&(_=TK(p,r),!BK(_)))return;const o=t.dataToPosition(r);if(d(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:p,measureData:_,hasMeasureData:y,groupField:g,groupData:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===mO.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(CK(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(_=TK(p,i),!BK(_))return;const r=t.dataToPosition(i);d(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:p,measureData:_,hasMeasureData:y,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&(()=>{var i,n,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(CK(c,v));const o=e.getNameMap(),l=null===(r=null===(n=e.getMapViewData)||void 0===n?void 0:n.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=_;if(l&&!a&&(a=Object.assign({},t)),!y){if(_=TK(p,a),h=_,!BK(_)&&!a)return;BK(_)||(_=[null])}const u=e.dataToPosition(a);d(u)||isNaN(u.x)||isNaN(u.y)||s.push({pos:u,data:{dimensionFields:c,dimensionData:v,measureFields:p,measureData:h,hasMeasureData:y,groupField:g,groupData:f,originDatum:a},series:e})})()})),s},RK=t=>u(t)&&!_(t),OK=t=>u(t)&&_(t);class IK extends gj{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i,s,n;const{spec:r,theme:a}=super._initTheme(t,e);return r.style=tI({},this._theme,r.style),r.offset=tI({},a.offset,t.offset),r.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:a.transitionDuration,r.trigger=null!==(s=t.trigger)&&void 0!==s?s:a.trigger,r.triggerOff=null!==(n=t.triggerOff)&&void 0!==n?n:a.triggerOff,{spec:r,theme:a}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(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 u(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]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:Yy(this._option.mode)||!Uy(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.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,u(t.parentElement)?v(t.parentElement)&&(t.parentElement=S_.getElementById(t.parentElement)):Uy(this._option.mode)&&(t.parentElement=null==Wy?void 0:Wy.body)}}const LK={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}};class DK extends fj{constructor(){super(...arguments),this.layoutZIndex=1,this.type=n.tooltip,this.name=n.tooltip,this.transformerConstructor=IK,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=Uy(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||p(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return d(t.mark)&&d(t.model)&&d(t.datum)}(t)&&(n&&RK(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):u(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!d(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&pF.globalConfig.uniqueTooltip&&l&&pF.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=t=>{var e,i,s;if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return 0;this.event.emit(bL.tooltipHide,Object.assign(Object.assign({},t),{source:xL.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const n=null!==(s=this._spec.handler)&&void 0!==s?s:this.tooltipHandler;if(null==n?void 0:n.hideTooltip){const e=n.hideTooltip.call(n,t);return e||(this._isTooltipShown=!1),e}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:xL.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),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(bL.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(bL.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,this._enterable=!1;else{const t="canvas"===s?jH.canvas:jH.dom,n=eI.getComponentPluginInType(t);n||Hy("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,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=eI.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=G(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=G(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(Gy(s)||Yy(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):p(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>p(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=x(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,xt(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(p(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===s||s.call(i)}else 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=EK(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(d(this._cacheInfo)||d(t))return!1;if(OK(t)){if(RK(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>_z(t,e[i])))}if(OK(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!d(n)&&!d(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: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}getVisible(){return!1!==this._spec.visible}}DK.type=n.tooltip,DK.transformerConstructor=IK,DK.builtInTheme={tooltip:LK},DK.specKey="tooltip";var FK,zK;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(FK||(FK={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(zK||(zK={}));const jK={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class HK extends fj{get enableRemain(){return"none"===this.triggerOff}constructor(t,e){super(t,e),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=aD.CrossHair_Grid,this.labelZIndex=aD.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),x(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=xt((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(p(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.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{sB(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_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}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||N(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(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:SL.chart}:{source:xL.chart};_(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;_(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}onBeforeRender(){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:t=s["desktop-browser"]}=this._option,e=function(t){return t===s["desktop-browser"]||t===s["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:Gy(t)||Yy(t)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(t);if(e){const t=G(this.trigger||"hover"),i=t=>"click"===t?"none"===this.triggerOff?null:e.clickOut:e.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:e[t],out:i(t)})})),s}return null}_registerTooltipEvent(){this.event.on(bL.tooltipHide,{source:xL.chart},this._handleTooltipHideOrRelease),this.event.on(bL.tooltipShow,{source:xL.chart},this._handleTooltipShow),this.event.on(bL.tooltipRelease,{source:xL.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=P(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{jK[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=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const u=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+u.left),o=Math.min(o,i-d+u.top),l=Math.max(l,e+t.getLayoutRect().width-c-u.right),h=Math.max(h,i+t.getLayoutRect().height-d-u.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_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)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||x(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(e,i){var s,n,r;const a={},{line:o={},label:l={},visible:c}=e;if(a.visible=c,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=t(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(x(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=P(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==e?void 0:e.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=e.line.style.stroke);const t=P(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 e=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=e.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:c,outerBorder:d}=n,u=t(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:e.minWidth,maxWidth:e.maxWidth,padding:e.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:P(s,"stroke")}),panel:(h(e.visible)?e.visible:e)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:c,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{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||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}HK.specKey="crosshair";const VK={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}}}}};class NK extends HK{static getSpecInfo(t){return bF(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=n.cartesianCrosshair,this.name=n.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_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)}}_getDatumAtPoint(t,e){const i=hz(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){hz(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(u(t.dimType)?"y"===t.dimType:cz(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();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 o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=uO(this._regions,"cartesian");e&&(EH(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=OH(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new aw(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new ow(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}NK.specKey="crosshair",NK.builtInTheme={crosshair:VK},NK.type=n.cartesianCrosshair;class WK extends HK{static getSpecInfo(t){return bF(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=n.polarCrosshair,this.name=n.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_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)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_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}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=uO(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&u(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=Yz(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=yF(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:le(d,a.getInnerRadius(),o),end:le(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=ce(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=le(t,o,r),d=le(t,o,h),m=me([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=mt(ne.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new aw(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new hw(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new cw(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new lw(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=de(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}}(u):function(t){let e="center",i="middle";return e=(t=de(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}}(g.startAngle),a="angle"===l?le(e,p[1]+m.offset,u):le(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}WK.specKey="crosshair",WK.builtInTheme={crosshair:VK},WK.type=n.polarCrosshair;const UK=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(d(o)||d(a))return t;const l=r(),h=_(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},GK=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(d(a)||d(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=>{let e=!1;return G(r).every((i=>{t[i]>=a[0]&&t[i]<=Y(a)&&(e=!0)})),e}:t=>{let e=!1;return G(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},YK=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],p=[],g=[];let f=!1,m=!1;n.forEach(((t,e)=>{var n;if(d(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);u(null==t?void 0:t.max)&&u(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{d(h[t])&&(g.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{G(i[e]).forEach((i=>{d(t[i])||(d(h[t[i]])&&(g.push(t[i]),h[t[i]]=0,c.push(t[i])),d(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const v=f?g:!1===r||m?g.sort(((t,e)=>t-e)):c;return v.forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),p.push(e)})),p},XK=(t,e,i)=>{const s=e.domain();if(eB(e.type))return i?s[0]+(Y(s)-s[0])*(1-t):s[0]+(Y(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+(Y(n)-n[0])*t;return e.invert(r)},$K=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&eB(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/(Y(n)-n[0])))},KK=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},qK=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}},ZK=(t,e,i)=>"start"===t?"percent"===e&&u(i.start)||"value"===e&&u(i.startValue):"percent"===e&&u(i.end)||"value"===e&&u(i.endValue),JK=(t,e,i)=>{if(eB(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class QK{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})}constructor(t,e,i,s,n,r,a,o){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.initZoomEvent=()=>{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:u(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,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),d=Math.abs(this.getState().start-this.getState().end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=mt(this.getState().start+f,0,1),_=mt(this.getState().end-m,0,1);this._handleChange(Math.min(v,_),Math.max(v,_),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Vt(s/n)>=.5:Vt(n/s)>=.5;if(this._scrollAttr.reverse||(r=-r),a){const t=this._spec.scrollStep;if(k(t)){r=(r>0?1:-1)*(t*(this.getState().end-this.getState().start)/1)}this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1)}const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))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.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===pz(uz(e))}setEventAttrFromSpec(){!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,h(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&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.getEvent(),this._option.mode)}}U(QK,GV);class tq extends fj{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:$K(t,this._stateScale,this._isHorizontal),a="percent"===n?e:$K(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var t;this._dataFilterEvent.initZoomEvent(),null===(t=this._relatedAxisComponent)||void 0===t||t.event.on(bL.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_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)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=KK(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[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._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._currentDataCollection=[],this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=JK(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!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&&qK(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({value:"force"})}else cO(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),cO(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=uz(t),this._isHorizontal="horizontal"===pz(this._orient),this._dataFilterEvent=new QK(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){this._handleDataCollectionChangeBound=this._handleDataCollectionChange.bind(this),super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||N(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])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(eB(n.type)){const r=n.domain(),a=r[0],o=Y(r)-a,l=u(t)?a+o*t:+e,h=u(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=u(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=u(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}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}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_setAxisFromSpec(){if(u(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):u(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),d(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>pz(t._orient)===pz(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!eB(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(u(i)&&(u(i.userId)&&(this._seriesUserId=G(i.userId)),u(i.specIndex)&&(this._seriesIndex=G(i.specIndex))),u(this._spec.seriesId)){const t=G(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(u(this._spec.seriesIndex)){const t=G(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(u(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(G(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(u(this._spec.regionId)){const t=G(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}_collectDataInfo(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};cO(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l,u=eB(d.getScale(0).type),p=eB(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?G(g.xField):G(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?G(g.yField):G(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:d===l?f:m;u&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else cO(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});return{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}}_initData(){const{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}=this._collectDataInfo(),{dataSet:r}=this._option;CL(r,"dataview",Ma),TL(r,"dataFilterComputeDomain",YK);const a=new Ba(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new LD(this._option,a),a.reRunAllTransform(),this._currentDataCollection=t,r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChangeBound)}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(TL(this._option.dataSet,"dataFilterWithNewDomain",GK),TL(this._option.dataSet,"lockStatisticsFilter",UK),cO(this._regions,(t=>{t.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>t.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>eB(this._stateScale.type)},level:1},!1),t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>eB(this._stateScale.type)},level:jL.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r}=this._collectDataInfo();if(this._currentDataCollection.length!==e.length||this._currentDataCollection.some(((t,i)=>t!==e[i]))){this._currentDataCollection.forEach((t=>{var e;null===(e=null==t?void 0:t.target)||void 0===e||e.removeListener("change",this._handleDataCollectionChangeBound)})),this._currentDataCollection=e;const{dataSet:t}=this._option;t.multipleDataViewAddListener(this._currentDataCollection,"change",this._handleDataCollectionChangeBound)}this._data.getDataView().transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data.getDataView().reRunAllTransform();const a=this._computeDomainOfStateScale(eB(this._stateScale.type));this._stateScale.domain(a,!1),(u(this._spec.start)||u(this._spec.end))&&this._setStateFromSpec(),this._handleChange(this._start,this._end,!0),this._spec.auto&&!N(this._domainCache,a)&&(this._domainCache=a,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;ZK("start",i,this._spec)&&ZK("end",s,this._spec)&&(t="percent"===i?this._spec.start:$K(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:$K(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?$K(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?$K(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=XK(this._start,this._stateScale,KK(i,this._isHorizontal)),this._endValue=XK(this._end,this._stateScale,KK(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,eB(this._stateScale.type)&&this._stateScale.domain()[0]!==Y(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(Y(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(Y(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=JK(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&cO(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);k(null==i?void 0:i.min)&&k(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new GB:new AB,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_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}_autoVisible(t){if(!this._auto)return;t?this.show():this.hide();const e=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[e]:t?this[`_${e}`]:0},{[e]:lD.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_autoUpdate(t){var e,i,s,r,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(),u=qK(h);if(!this._dataUpdating&&sB(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==u?void 0:u.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===(r=this._cacheRect)||void 0===r?void 0:r.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==u?void 0:u.bandSize,sB(c.type)){u&&(this._start||this._end)&&(this.type===n.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!d(t)||!d(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),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}U(tq,GV);class eq extends gj{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=tI({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=_(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}const iq=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),sq={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:iq(!1),startHandler:{style:{symbolType:"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;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"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;",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:iq(!0)};class nq extends tq{constructor(t,e){var i;super(t,e),this.type=n.dataZoom,this.name=n.dataZoom,this.transformerConstructor=eq,this.specKey="dataZoom",this.layoutZIndex=aD.DataZoom,this.layoutLevel=oD.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,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=this._isHorizontal?0:this._middleHandlerSize,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._getPreviewStateScale(),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._getPreviewStateScale(),n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"filter"}_handleChange(t,e,i,s){if(super._handleChange(t,e,i),this._shouldChange)if(i&&this._component)this._component.setStartAndEnd(t,e);else{const i=this._relatedAxisComponent,n=XK(t,this._stateScale,KK(i,this._isHorizontal)),r=XK(e,this._stateScale,KK(i,this._isHorizontal));if(!u(n)||!u(r))return;this._start=t,this._end=e;(c(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,n,r):this._handleStateChange(n,r,s))&&this.event.emit(bL.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:t,end:e,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){this._data.getDataView().reRunAllTransform();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new GB),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(KK(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=KK(t,this._isHorizontal),this.effect.onZoomChange())}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,d=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+d,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+d),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);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(),d(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=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize),d(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=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize);const u=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=u?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new GB;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(KK(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[$(e),X(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!eB(t.type)||e[0]!==Y(e))&&(!sB(t.type)||1!==(i=e,i&&_(i)?Array.from(new Set(G(i))):i).length);var i}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_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:x(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:x(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_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._computeWidth(),height:this._computeHeight()},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:u(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,isReverse:KK(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=this._isHorizontal?this._stateScale:this._valueScale,i=this._isHorizontal?this._valueScale:this._stateScale,s=this._isScaleValid(e)&&this._isScaleValid(i)&&!1!==this._spec.showBackgroundChart,n=this._getAttrs(s),r=this._relatedAxisComponent;if(this._component)this._component.setAttributes(n),t&&(this._component.setPreviewData(this._data.getDataView().latestData),s&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>XK(t,this._stateScale,KK(r,this._isHorizontal))))));else{const t=this.getContainer();this._component=new uP(n),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?s&&this._component.setPreviewPointsY1(this._dataToPositionY2):s&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>XK(t,this._stateScale,KK(r,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:pL(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:pL(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:pL(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:pL(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:pL(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:pL(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:pL(g.style)},selectedBackgroundStyle:pL(this._spec.selectedBackground.style),dragMaskStyle:pL(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:tI(pL(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},pL(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:tI(pL(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},pL(null===(d=m.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}=yF(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(KK(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}}nq.type=n.dataZoom,nq.transformerConstructor=eq,nq.builtInTheme={dataZoom:sq},nq.specKey="dataZoom";const rq={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}};class aq extends tq{constructor(t,e){var i;super(t,e),this.type=n.scrollBar,this.name=n.scrollBar,this.specKey="scrollBar",this.layoutZIndex=aD.DataZoom,this.layoutLevel=oD.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"axis"}_handleChange(t,e,i){super._handleChange(t,e,i);const s=eO(this._start,t)&&eO(this._end,e);if(this._shouldChange&&(!s||!1===this._spec.realTime)){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;const s=XK(t,this._stateScale,!1),n=XK(e,this._stateScale,!1);(c(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,s,n):this._handleStateChange(s,n))&&this.event.emit(bL.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:x(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:x(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r,a;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:u(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,minSliderSize:null===(a=this._spec)||void 0===a?void 0:a.minSliderSize},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new dM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return d(i)||(s.padding=i),E(null==t?void 0:t.style)||(s.railStyle=pL(t.style)),E(null==e?void 0:e.style)||(s.sliderStyle=pL(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}aq.type=n.scrollBar,aq.builtInTheme={scrollBar:rq},aq.specKey="scrollBar";const oq=(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}),G(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r},lq=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),hq={title:{visible:!0,autoLimit:!1,autoFit:!1,style:lq("l1FontSize","primaryFontColor")},content:{visible:!0,style:lq("l2FontSize","tertiaryFontColor")}};class cq extends fj{constructor(){super(...arguments),this.type=n.indicator,this.name=n.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=aD.Indicator,this.layoutLevel=oD.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return bF(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=G(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(G(this._spec.regionId),G(this._spec.regionIndex))}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(fL(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(fL(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){TL(this._option.dataSet,"indicatorFilter",oq);const t=new Ba(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 LD(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const e=this._regions[0],{width:i,height:s}=e.getLayoutRect(),{x:n,y:r}=e.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,p=t(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return G(o).forEach((t=>{const e=tI({},this._theme.content,t);g.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({},uL(j(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?WO(l,this._computeLayoutRadius()):0,dy:h?WO(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!u(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},uL(j(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},p)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)N(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new CR(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":c(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.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}cq.type=n.indicator,cq.builtInTheme={indicator:hq},cq.specKey="indicator";const dq=["sum","average","min","max","variance","standardDeviation","median"];function uq(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=X(s);return er}function pq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return x(t.x)&&uq(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=DO(t.x)?vq(t.x,n)+r.x:_q(l.getXAxisHelper(),[t.x])+r.x,h}function gq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return x(t.y)&&uq(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=DO(t.y)?vq(t.y,n)+r.y:_q(l.getYAxisHelper(),[t.y])+r.y,h}function fq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return x(t.angle)&&uq(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)),_q(a.angleAxisHelper,[t.angle])}function mq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return x(t.radius)&&uq(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)),_q(a.radiusAxisHelper,[t.radius])}function vq(t,e){return Number(t.substring(0,t.length-1))*e/100}function _q(t,e){const i=t.getScale(0);return eB(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function yq(t){return dq.includes(t)}function bq(t,e,i,s,n,r=!1){const a=e.getRegion(),o=a.getLayoutStartPoint(),l=i.getRegion(),h=l.getLayoutStartPoint(),c=Math.abs(Math.min(o.x,h.x)-Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width)),d=Math.abs(Math.min(o.y,h.y)-Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height)),p={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},g=[],f=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper(),v=s.getYAxisHelper(),_=m.getScale(0).domain(),y=v.getScale(0).domain(),b=r&&!m.isContinuous&&!!m.getBandwidth,x=r&&!v.isContinuous&&!!v.getBandwidth,S={min:null,max:null},k={min:null,max:null};return f.forEach((t=>{const e=u(t.x),i=u(t.y);let s,r;if(e&&i)s=pq(t,_,n,p,c,o),r=gq(t,y,n,p,d,o),xq(s,b,S,g.length),xq(r,x,k,g.length),g.push([{x:s,y:r}]);else if(e){s=pq(t,_,n,p,c,o),r=Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height);const e=Math.min(o.y,h.y);xq(s,b,S,g.length),g.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(o.x,h.x),r=gq(t,y,n,p,d,o);const e=Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width);xq(r,x,k,g.length),g.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(g,m,v,S,k),g}function xq(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=u(t.angle),i=u(t.radius);if(e&&i){const e=fq(t,l,n,r),i=mq(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=fq(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=mq(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function kq(t,e,i,s){const n=[],r=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,a=_(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:f}=u.getLayoutRect();let m=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(m=DO(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=DO(i)?Number(i.substring(0,i.length-1))*f/100:i)}const _=d.getXAxisHelper().getScale(0).domain(),y=d.getYAxisHelper().getScale(0).domain(),b=G(t.x),S=G(t.y);1===b.length&&x(b[0])&&uq(_,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===S.length&&x(S[0])&&uq(y,S[0],i)&&(null===(c=null===(h=d.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",S[0])),n.push({x:_q(d.getXAxisHelper(),b)+p.x+m,y:_q(d.getYAxisHelper(),S)+p.y+v})})),n}function Aq(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=G(t.angle),u=G(t.radius);1===d.length&&x(d[0])&&uq(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&&x(u[0])&&uq(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:_q(l.angleAxisHelper,d),radius:_q(l.radiusAxisHelper,u)})})),s}function Mq(t,e,i){let{x:s,y:n}=t;return DO(s)&&(s=vq(s,e)),DO(n)&&(n=vq(n,i)),{x:s,y:n}}function wq(t,e,i){let s;if(s=c(t)?G(t(e.getData().getLatestData(),e)):G(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=Mq(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>Mq(t,n,r)))}function Tq(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 Cq(e,i,s){const{labelBackground:n={},style:r,shape:a}=e,o=t(e,["labelBackground","style","shape"]);if(!1!==e.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},pL(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},Eq(pL(n.style),i,s)),u(n.padding)&&(t.padding=ni(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=Eq(pL(r),i,s)),t}return{visible:!1}}function Bq(t,e,i){for(const s in t)c(t[s])&&(t[s]=t[s](e,i));return t}function Eq(t,e,i){return c(t)?t(e,i):t}function Pq(t,e){return c(t)?t(e):t}function Rq(t,e,i){return u(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 Oq(t){return{isXProcess:u(t.x),isYProcess:u(t.y),isX1Process:u(t.x1),isY1Process:u(t.y1),isAngleProcess:u(t.angle),isRadiusProcess:u(t.radius),isAngle1Process:u(t.angle1),isRadius1Process:u(t.radius1),isCoordinatesProcess:u(t.coordinates),isValidProcess:u(t.process)}}function Iq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=Oq(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:h&&(!c||"process"in t&&"xy"in t.process)}}function Lq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=Oq(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function Dq(t){return{doXYProcess:u(t.x)&&u(t.y),doPolarProcess:u(t.angle)&&u(t.radius),doGeoProcess:u(t.areaName)}}function Fq(e,i){let s;if(i.coordinates){const e=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=e,o=t(e,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(c(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=G(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;u(r)&&(c=G(i)[r]),n&&G(i).includes(n)&&(c=n);let d=s;u(l)&&(d=G(s)[l]),a&&G(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),v(t[c])&&yq(t[c])?h.x={field:c,aggrType:t[c]}:h.x=G(c).map((e=>t[e])),v(t[d])&&yq(t[d])?h.y={field:d,aggrType:t[d]}:h.y=G(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;u(r)&&(a=G(s)[r]),n&&G(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),v(t[a])&&yq(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=G(a).map((e=>t[e])),v(t[l])&&yq(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=G(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((t=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(u(t.x)){const s=t.x;_(s)?i.x=s.map((i=>jq(i,e,t))):i.x=jq(s,e,t)}if(u(t.y)){const s=t.y;_(s)?i.y=s.map((i=>jq(i,e,t))):i.y=jq(s,e,t)}if(u(t.angle)){const s=t.angle;_(s)?i.angle=s.map((i=>jq(i,e,t))):i.angle=jq(s,e,t)}if(u(t.radius)){const s=t.radius;_(s)?i.radius=s.map((i=>jq(i,e,t))):i.radius=jq(s,e,t)}if(u(t.areaName)){const s=t.areaName;i.areaName=jq(s,e,t)}t.getRefRelativeSeries&&(i.getRefRelativeSeries=t.getRefRelativeSeries),n.push(i)})),n}const zq={min:(t,e)=>iO(t[0].latestData,e.field),max:(t,e)=>sO(t[0].latestData,e.field),sum:function(t,e){return nO(t[0].latestData,e.field)},average:function(t,e){return rO(t[0].latestData,e.field)},variance:function(t,e){return aO(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(aO(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 jq(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(c(t))return t(a,o,l,s,n,r);if(f(t)){const{aggrType:i,field:s}=t;return zq[i](e,{field:s})}return t}function Hq(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 Vq extends fj{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){return bF(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_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 v(e)&&yq(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){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];G(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Ca;return e.registerParser("array",i),new Ba(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(u(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)))}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=uO(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){d(this._spec.offsetX)||(this._layoutOffsetX=zO(this._spec.offsetX,e.width,e)),d(this._spec.offsetY)||(this._layoutOffsetY=zO(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return N(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();TL(this._option.dataSet,"markerAggregation",Fq),TL(this._option.dataSet,"markerFilter",Hq);const i=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),i.target.on("change",(()=>{this._markerLayout()})),this._markerData=i}}function Nq(t,e){return function(t,e,i){const{predict:s}=Lt(t,(t=>t[e]),(t=>t[i])),n=iO(t,e),r=sO(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class Wq extends Vq{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=aD.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=Iq(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;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=G(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={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},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:Eq(pL(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>Cq(t,this._markerData,this._markAttributeContext))),state:{line:Bq(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:Bq(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:Bq(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return Bq(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return Bq(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:Eq(pL(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:Eq(pL(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||G(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=Tq([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=G((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=G(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,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}=Iq(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;TL(this._option.dataSet,"markerAggregation",Fq),TL(this._option.dataSet,"markerRegression",Nq),TL(this._option.dataSet,"markerFilter",Hq);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new Ba(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",(()=>{this._markerLayout()})),this._markerData=m}}Wq.specKey="markLine";const Uq=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),Gq={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"}}},refY:5},Yq={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:Uq(!1),endSymbol:Uq(!0),label:Gq};class Xq extends Wq{constructor(){super(...arguments),this.type=n.markLine,this.name=n.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new ZP(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=u(e.coordinates),o=u(e.process),l=o&&u(e.process.x),h=o&&u(e.process.y),c=u(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:p,doYProcess:g,doXYY1Process:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:_}=Iq(e);let y=[];if(p||f||g||m||v||a&&l||a&&h){const t=bq(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=kq(i,r,d,e.coordinatesOffset):c&&(y=wq(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n;const r=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const n=this._startRelativeSeries,a=this._endRelativeSeries,{multiSegment:o,mainSegmentIndex:l}=this._spec.line||{},{connectDirection:h,expandDistance:c=0}=this._spec;let d;if(DO(c)){const t=n.getRegion(),e=t.getLayoutStartPoint(),i=a.getRegion(),s=i.getLayoutStartPoint();if("bottom"===h||"top"===h){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));d=Number(c.substring(0,c.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));d=Number(c.substring(0,c.length-1))*n/100}}else d=c;const{points:p,limitRect:g}=r;if(!p||p.length<2)return void(null===(t=this._markerComponent)||void 0===t||t.setAttributes(r));const f=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}(p[0],p[1],h,d);let m;m=o&&u(l)?{position:"middle",autoRotate:!1}: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)}:{}}(p[0],p[1],h,d));const v=G((null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{}).label),_=G(r.label),y=G(this._spec.label);null===(s=this._markerComponent)||void 0===s||s.setAttributes({points:o?[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]]]:f,label:_.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=m.dx)&&void 0!==i?i:0,h=null!==(s=m.dy)&&void 0!==s?s:0;const c=null!==(n=y[e])&&void 0!==n?n:y[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),m),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=v[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:g,multiSegment:o,mainSegmentIndex:l,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(n=this._markerComponent)||void 0===n||n.setAttributes(r)}_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}=Iq(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 Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&u(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&u(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&u(n.process.xy)){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}}}Xq.type=n.markLine,Xq.coordinateType="cartesian",Xq.builtInTheme={markLine:Yq};class $q extends Wq{constructor(){super(...arguments),this.type=n.polarMarkLine,this.name=n.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=Iq(this._spec);return e||i?new tR(t):new ZP(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}=Iq(e);let p=[],g={};const f={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=Sq(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:f}:{points:p.map((t=>le(f,t.radius,t.angle)))}}else u&&(p=Aq(i,r,a),g={points:p.map((t=>le(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=Iq(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}}}$q.type=n.polarMarkLine,$q.coordinateType="polar",$q.builtInTheme={polarMarkLine:Yq};class Kq extends fj{get orient(){return this._orient}constructor(t,e){super(t,e),this.type=n.title,this.specKey=n.title,this.layoutType="normal",this.layoutZIndex=aD.Title,this.layoutLevel=oD.Title,this._orient="top",this._orient=LO(t.orient)?t.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return bF(t,this.specKey,n.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}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;if(!1===this._spec.visible)return{visible:!1};const a=this.getLayoutRect(),o=zO(this._spec.width,a.width,null,a.width),l=zO(this._spec.maxWidth,a.width,null,a.width),h=Math.max(Math.min(o,l,a.width),0),c=u(this._spec.text)&&""!==this._spec.text,d=u(this._spec.subtext)&&""!==this._spec.subtext,p=Object.assign(Object.assign({},j(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:c?this._spec.text:void 0,subtextType:null!==(e=this._spec.subtextType)&&void 0!==e?e:"text",subtext:d?this._spec.subtext:void 0,x:null!==(i=this._spec.x)&&void 0!==i?i:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:h,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(n=this._spec.align)&&void 0!==n?n:"left",verticalAlign:null!==(r=this._spec.verticalAlign)&&void 0!==r?r:"top",textStyle:Object.assign({maxLineWidth:h},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:h},this._spec.subtextStyle)});if(c&&(p.textStyle.width=h),d&&(p.subtextStyle.width=h),u(this._spec.width)){const t=Math.max(Math.min(o,a.width),0);c?p.textStyle.width=t:delete p.textStyle.width,d&&(p.subtextStyle.width=t)}return p}_createOrUpdateTitleComponent(t){if(this._titleComponent)N(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new wR(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}}Kq.type=n.title,Kq.specKey=n.title,Kq.builtInTheme={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"}}}};class qq extends Vq{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=aD.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=Lq(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=G(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={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:Eq(pL(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>Cq(t,this._markerData,this._markAttributeContext))),state:{area:Bq(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>Bq(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return Bq(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||G(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=Tq([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=G(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=G(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,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}=Lq(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}qq.specKey="markArea";const Zq={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"}}}}};class Jq extends qq{constructor(){super(...arguments),this.type=n.markArea,this.name=n.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new QP(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=Lq(i),d=u(i.positions),p=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=bq(s,n,r,a,p,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=bq(s,n,r,a,p,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=kq(s,a,p,i.coordinatesOffset):d&&(f=wq(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=Lq(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}}}Jq.type=n.markArea,Jq.coordinateType="cartesian",Jq.builtInTheme={markArea:Zq};class Qq extends qq{constructor(){super(...arguments),this.type=n.polarMarkArea,this.name=n.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=Lq(this._spec);return i||e||s?new eR(t):new QP(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}=Lq(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=Sq(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=Aq(i,r,c),u={points:d.map((t=>le(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=Lq(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}}}Qq.type=n.polarMarkArea,Qq.coordinateType="polar",Qq.builtInTheme={polarMarkArea:Zq};const tZ=t=>pL(Object.assign({},t)),eZ=t=>Object.assign(Object.assign({},t),{style:Object.assign({},pL(t.style))}),iZ=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=tZ(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=tZ(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:{},pL(Object.assign({},y)));var y;const b=eZ(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=eZ(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=eZ(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),k=eZ(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),A=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:k})});return t.visible||(A.controller.visible=!1,A.slider.visible=!1),A},sZ=t=>"left"===t||"right"===t,nZ=t=>"top"===t||"bottom"===t,rZ={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:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,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:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class aZ extends fj{constructor(){super(...arguments),this.layoutZIndex=aD.Player,this.layoutLevel=oD.Player,this.specKey="player",this.type=n.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({},iZ(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({},iZ(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?N(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new NR(t):this._playerComponent=new GR(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(...G(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...G(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...G(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...G(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=sZ(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=sZ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...G(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...G(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...G(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...G(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.autoPlayCallback=()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.off(bL.rendered,this.autoPlayCallback),this._option.globalInstance.on(bL.rendered,this.autoPlayCallback),this._playerComponent.addEventListener(DR.end,(()=>{var t;this.event.emit(bL.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===(t=this._spec)||void 0===t?void 0:t.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(DR.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(DR.backward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(bL.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(DR.forward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(bL.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(DR.play,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(bL.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(DR.pause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(bL.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}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=sZ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=nZ(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}_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 x(this._spec.width)?Math.min(t.width,Number(this._spec.width)):sZ(this._orient)?this._maxSize():t.width}_computeHeight(t){return x(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):nZ(this._orient)?this._maxSize():t.height}_computeDx(t){return sZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return nZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(t){const e=this._specs[t];this._option.globalInstance.updateFullData(e.data),this.event.emit(bL.playerChange,{model:this,value:{spec:e,index:t,specs:this._specs}})}release(){this._option.globalInstance.off(bL.rendered,this.autoPlayCallback)}}aZ.builtInTheme={player:rZ},aZ.specKey="player",aZ.type=n.player;class oZ extends fj{constructor(t,e){super(t,e),this.type=n.label,this.name=n.label,this.layoutType="none",this.layoutZIndex=aD.Label,this._regions=e.getRegionsInIndex(e.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,N(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=AO({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:G(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==hD.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}))})),f(a.overlap)&&d(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}oZ.type=n.label;class lZ extends $N{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}render(){}}lZ.type="text",lZ.constructorType="label";const hZ=()=>{KN(),eI.registerMark(lZ.constructorType,lZ)};class cZ extends gj{_initTheme(t,e){return{spec:t,theme:this._theme}}}class dZ extends oZ{constructor(t,e){super(t,e),this.type=n.label,this.name=n.label,this.specKey="label",this.transformerConstructor=cZ,this.layoutZIndex=aD.Label,this._layoutRule=t.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,r)=>{(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:n.label,specInfoPath:["component",this.specKey,r],regionIndexes:[r]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(bL.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(_L.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(_L.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),cO(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{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&u(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(u(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{G(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((t=>{t.forEach((t=>{var e,i;const{labelMark:s,labelSpec:n,series:r}=t;if(this.initMarkStyleWithSpec(s,n),c(null==n?void 0:n.getStyleHandler)){const t=n.getStyleHandler(r);null==t||t.call(r,s,n)}(null===(i=null===(e=s.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&s.setAttribute("stroke",r.getColorAttribute(),"normal",lD.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,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=tI({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},pN(h,r),Object.assign(Object.assign(Object.assign({},j(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[WI])):t=>t.filter((t=>t.data[NI]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?gN(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=_(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=G(i())[t])}))}return e}}dZ.type=n.label,dZ.specKey="label",dZ.transformerConstructor=cZ;class uZ extends oZ{constructor(){super(...arguments),this.type=n.totalLabel,this.name=n.totalLabel,this.specKey="totalLabel",this.layoutZIndex=aD.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 r;null===(r=t.seriesIndexes)||void 0===r||r.forEach((t=>{const{spec:r}=e.series[t],a=r[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:n.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()}reInit(t){super.reInit(t),this._initTextMark()}_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 t;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[HI]},"normal",lD.Default);const e=this._getSeries();null===(t=e.initTotalLabelMarkStyle)||void 0===t||t.call(e,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return tI({textStyle:{pickable:!0===this._spec.interactive},position:pZ(t,this._baseMark.type,a),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=>"bottom"===a?t.data[WI]:t.data[NI]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>gN({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function pZ(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}uZ.type=n.totalLabel,uZ.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},uZ.specKey="totalLabel";class gZ extends Vq{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=aD.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=Dq(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,k,A,M,w,T,C,B,E,P,R,O,I;const{itemContent:L={},itemLine:D={},targetSymbol:F={}}=this._spec,j=L,{type:H="text",text:V,symbol:N,image:W,richText:U,customMark:G,textStyle:Y,symbolStyle:X,imageStyle:$,richTextStyle:K,customMarkStyle:q,style:Z={},state:J={}}=j,Q=t(j,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let tt=null,et=null,it={};"text"===H?(tt=null!==(e=null==V?void 0:V.state)&&void 0!==e?e:J,it={dx:0,dy:0},et=Cq(Object.assign(Object.assign({},V),{style:z(it,null!==(n=null!==(s=null!==(i=null==V?void 0:V.style)&&void 0!==i?i:null==V?void 0:V.textStyle)&&void 0!==s?s:Y)&&void 0!==n?n:Z)}),this._markerData,this._markAttributeContext)):"richText"===H?(tt=null!==(r=null==U?void 0:U.state)&&void 0!==r?r:J,it={width:100,height:100},et=Eq(z(it,null!==(o=null!==(a=null==U?void 0:U.style)&&void 0!==a?a:K)&&void 0!==o?o:Z),this._markerData,this._markAttributeContext)):"symbol"===H?(tt=null!==(l=null==N?void 0:N.state)&&void 0!==l?l:J,it={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},et=pL(Eq(z(it,null!==(c=null!==(h=null==N?void 0:N.style)&&void 0!==h?h:X)&&void 0!==c?c:Z),this._markerData,this._markAttributeContext))):"image"===H?(tt=null!==(d=null==W?void 0:W.state)&&void 0!==d?d:J,it={width:80,height:80},et=Eq(z(it,null!==(p=null!==(u=null==W?void 0:W.style)&&void 0!==u?u:$)&&void 0!==p?p:Z),this._markerData,this._markAttributeContext)):"custom"===H&&(tt=null!==(g=null==G?void 0:G.state)&&void 0!==g?g:J,et=Eq(null!==(m=null!==(f=null==G?void 0:G.style)&&void 0!==f?f:q)&&void 0!==m?m:Z,this._markerData,this._markAttributeContext));const st={zIndex:this.layoutZIndex,interactive:null===(v=this._spec.interactive)||void 0===v||v,hover:null===(_=this._spec.interactive)||void 0===_||_,select:null===(y=this._spec.interactive)||void 0===y||y,position:{x:0,y:0},clipInRange:null!==(b=this._spec.clip)&&void 0!==b&&b,itemContent:Object.assign(Object.assign({type:H,offsetX:Pq(L.offsetX,this._relativeSeries.getRegion()),offsetY:Pq(L.offsetX,this._relativeSeries.getRegion())},Q),{style:Eq(et,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(x=F.offset)&&void 0!==x?x:0,visible:null!==(S=F.visible)&&void 0!==S&&S,size:null!==(k=F.size)&&void 0!==k?k:20,style:Eq(F.style,this._markerData,this._markAttributeContext)},state:{line:Bq(null!==(M=null===(A=this._spec.itemLine.line)||void 0===A?void 0:A.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),lineStartSymbol:Bq(null!==(T=null===(w=this._spec.itemLine.startSymbol)||void 0===w?void 0:w.state)&&void 0!==T?T:{},this._markerData,this._markAttributeContext),lineEndSymbol:Bq(null!==(B=null===(C=this._spec.itemLine.endSymbol)||void 0===C?void 0:C.state)&&void 0!==B?B:{},this._markerData,this._markAttributeContext),itemContent:Bq(tt,this._markerData,this._markAttributeContext),textBackground:Bq(null===(P=null===(E=this._spec.itemContent.text)||void 0===E?void 0:E.labelBackground)||void 0===P?void 0:P.state,this._markerData,this._markAttributeContext),targetItem:Bq(null!==(O=null===(R=this._spec.targetSymbol)||void 0===R?void 0:R.state)&&void 0!==O?O:{},this._markerData,this._markAttributeContext)},animation:null!==(I=this._spec.animation)&&void 0!==I&&I,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:nt,line:rt={}}=D,at=t(D,["visible","line"]);st.itemLine=!1!==nt?Object.assign(Object.assign({},at),{visible:!0,lineStyle:pL(rt.style)}):{visible:!1};return new sR(st)}_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}=Tq([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:Rq(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:Rq(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}=Dq(t);(u(t.coordinate)||e||i||s)&&this._initCommonDataView()}}gZ.specKey="markPoint";const fZ={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}};class mZ extends gZ{constructor(){super(...arguments),this.type=n.markPoint,this.name=n.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=u(s.x)&&u(s.y),o=u(s.coordinate),l=u(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=bq(n,r,r,r,h))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=kq(n,r,h,s.coordinatesOffset)[0]:l&&(c=wq(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=Dq(t),i=u(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}}}mZ.type=n.markPoint,mZ.coordinateType="cartesian",mZ.builtInTheme={markPoint:fZ};class vZ extends gZ{constructor(){super(...arguments),this.type=n.polarMarkPoint,this.name=n.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=Sq(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:le({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}])]}}}vZ.type=n.polarMarkPoint,vZ.coordinateType="polar",vZ.builtInTheme={polarMarkPoint:fZ};class _Z extends gZ{constructor(){super(...arguments),this.type=n.geoMarkPoint,this.name=n.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=>{u(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}])]}}}_Z.type=n.geoMarkPoint,_Z.coordinateType="geo",_Z.builtInTheme={geoMarkPoint:fZ};const yZ="inBrush",bZ="outOfBrush";class xZ extends fj{constructor(){super(...arguments),this.layoutType="none",this.type=n.brush,this.name=n.brush,this.specKey="brush",this.layoutZIndex=aD.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return bF(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const t=this._transformBrushedMarkAttr(this._spec.inBrush),e=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((i=>{i.getActiveMarks().forEach((s=>{s&&(i.setMarkStyle(s,Object.assign({},t),yZ,lD.Series),i.setMarkStyle(s,Object.assign({},e),bZ,lD.Series))}))}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&G(t).includes(n.userId.toString())||e&&G(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()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){u(this._spec.regionId)||u(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(G(this._spec.regionId),G(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(u(this._spec.brushLinkSeriesId)||u(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(G(this._spec.brushLinkSeriesId),G(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){u(this._spec.axisId)?G(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):u(this._spec.axisIndex)?G(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)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return N(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild()}_shouldEnableInteractive(){return!1!==this.getOption().getCompiler().getOption().interactive}_createBrushComponent(t,e){var i,s;const n=this._getBrushInteractiveAttr(t),r=new KR(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:pL(null===(i=this._spec)||void 0===i?void 0:i.style)},n),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));r.id=null!==(s=this._spec.id)&&void 0!==s?s:`brush-${this.id}`,this.getContainer().add(r),this._brushComponents.push(r),this._cacheInteractiveRangeAttrs.push(n),r.addEventListener(WR.brushActive,(i=>{this._initMarkBrushState(e,bZ),this._emitEvent(bL.brushActive,t,i)})),r.addEventListener(WR.drawStart,(e=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(t,!0),this._emitEvent(bL.brushStart,t,e)})),r.addEventListener(WR.moveStart,(e=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(t,!0),this._emitEvent(bL.brushStart,t,e)})),r.addEventListener(WR.drawing,(e=>{this._setRegionMarkPickable(t,!1),this._handleBrushChange(t,e),this._emitEvent(bL.brushChange,t,e)})),r.addEventListener(WR.moving,(e=>{this._setRegionMarkPickable(t,!1),this._handleBrushChange(t,e),this._emitEvent(bL.brushChange,t,e)})),r.addEventListener(WR.brushClear,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(t,!0),this._initMarkBrushState(e,""),this._emitEvent(bL.brushClear,t,i)})),r.addEventListener(WR.drawEnd,(i=>{var s;this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(t,!0);const{operateMask:n}=i.detail,{updateElementsState:r=!0}=this._spec;if(null===(s=this._spec)||void 0===s?void 0:s.onBrushEnd)!0===this._spec.onBrushEnd(i)?(this.clearGraphic(),this._initMarkBrushState(e,""),this._emitEvent(bL.brushClear,t,i)):(this._spec.onBrushEnd(i),this._emitEvent(bL.brushEnd,t,i));else{const e=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&e.length>0||!r)&&this._setAxisAndDataZoom(n,t),this._emitEvent(bL.brushEnd,t,i)}})),r.addEventListener(WR.moveEnd,(e=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(t,!0);const{operateMask:i}=e.detail,{updateElementsState:s=!0}=this._spec,n=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&n.length>0||s)&&this._setAxisAndDataZoom(i,t),this._emitEvent(bL.brushEnd,t,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],interactive:this._shouldEnableInteractive()}}_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({},pL(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail;this._operateMask=i;const{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e,i){var s;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},vchart:null===(s=this._option)||void 0===s?void 0:s.globalInstance,event:i})}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(i.addState(yZ,!0),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(i.removeState(yZ),i.addState(bZ,!0),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:_=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(_.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(i.addState(yZ,!0),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(i.removeState(yZ),i.addState(bZ,!0),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Be(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;s.removeState(yZ),s.removeState(bZ),i&&s.addState(i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_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?"width":"height",p=r?o:h,g=r?l:c;if(this._axisDataZoomMap[t.id]){const i=this._axisDataZoomMap[t.id],s=(p-e.getLayoutStartPoint()[d])/e.getLayoutRect()[u],n=(g-e.getLayoutStartPoint()[d])/e.getLayoutRect()[u],r=this._stateClamp(s-a),o=this._stateClamp(n+a);i.setStartAndEnd(Math.min(r,o),Math.max(r,o),["percent","percent"]),this._zoomRecord.push({operateComponent:i,start:r,end:o,startValue:XK(r,i.stateScale,KK(i.relatedAxisComponent,i.isHorizontal)),endValue:XK(o,i.stateScale,KK(i.relatedAxisComponent,i.isHorizontal))})}else{const i=t.getScale().range(),s=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],r=Y(i){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}clearBrushStateAndMask(){this._relativeRegions.forEach(((t,e)=>{this._initMarkBrushState(e,""),this._brushComponents[e].children[0].removeAllChild()}))}}xZ.type=n.brush,xZ.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},xZ.specKey="brush";class SZ extends fj{constructor(){super(...arguments),this.type=n.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=aD.CustomMark,this.layoutLevel=oD.CustomMark}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;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${MI}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:u(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(u(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=qF({},ZF(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(d(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)}))),u(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return N(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,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 je).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new je;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),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}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}SZ.type=n.customMark,SZ.specKey="customMark";class kZ{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}:c(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){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=>{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&&u(e.modelId)){if(u(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&u(e.modelKey)&&"modelIndex"in e&&u(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=>AZ(t))),a=n.filter((t=>!AZ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>AZ(t))),h=o.filter((t=>!AZ(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 AZ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}kZ.type="grid";const MZ="vchart-tooltip",wZ=`${MZ}-container`,TZ=`${MZ}-title`,CZ=`${MZ}-content-box`,BZ={offsetX:10,offsetY:10},EZ="99999999999999";function PZ(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const RZ=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,OZ=t=>v(t)&&""!==(null==t?void 0:t.trim())||x(t)?PZ(t):"",IZ=(t,e)=>{let i;if(u(t))if(x(t))i=t;else if(c(t)){const s=t(e);x(s)&&(i=s)}return i},LZ={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},DZ=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=LZ[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class FZ extends Wz{constructor(){super(...arguments),this._visible=!0,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._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,d,g;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const _=e.event,{activeType:y,data:b}=t,S="dimension"===y?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:M}=this._option,w=m[y],T=MF(null==w?void 0:w.position,b,e),C=null!==(r=MF(null==w?void 0:w.positionMode,b,e))&&void 0!==r?r:"mark"===y?"mark":"pointer",{width:B=0,height:E=0}=null!=i?i:{},P="canvas"===m.renderMode,R=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),O=null!==(o=null==R?void 0:R.width)&&void 0!==o?o:wI,I=null!==(l=null==R?void 0:R.height)&&void 0!==l?l:TI;let L=!1;const D={width:0,height:0};let F,z={x:0,y:0},j={x:0,y:0},H=1,V=1;const N=Uy(this._env);if(N&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=O,D.height=I),N&&!P){const t=this._getParentElement(m);j=null!==(d=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==d?d:v;const e=null!==(g=this._compiler.getCanvas())&&void 0!==g?g:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-j.x,y:F.y-j.y},H=RZ(e,F),V=RZ(t,j)}const W=V/H,U={},G={x:T,y:T},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?A:M;if("mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==S?void 0:S.series)||void 0===r?void 0:r.coordinate)&&S.datum&&S.datum.length){L=!0;const t=f(S,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(L){const e=Y[n][0],i="x"===n?B:E;switch(DZ(t,n)){case-2:U[e]=a-i*W-c;break;case-1.5:U[e]=a+c;break;case 0:U[e]=(a+o)/2-i*W/2;break;case-1:U[e]=(a+o)/2-i*W-c;break;case 1:U[e]=(a+o)/2+c;break;case 1.5:U[e]=o-i*W-c;break;case 2:U[e]=o+c}}},$=["x","y"];if(p(T))if(p(K=T)&&(u(K.left)||u(K.right)||u(K.top)||u(K.bottom))){const{left:t,right:e,top:i,bottom:s}=T;U.left=IZ(t,_),U.top=IZ(i,_),U.right=IZ(e,_),U.bottom=IZ(s,_)}else(t=>p(t)&&(u(t.x)||u(t.y)))(T)&&$.forEach((t=>{const e=T[t];x(e)||c(e)?U[Y[t][0]]=IZ(e,_):X(e,t)}));else u(T)&&(X({orient:T,mode:C},"x"),X({orient:T,mode:C},"y"));var K;const q={x:null,y:null};return $.forEach((t=>{var e;const i="x"===t?B:E,s="x"===t?O:I,n="x"===t?A:M,r=DZ(G[t],t);if(k(U[Y[t][0]]))q[t]=U[Y[t][0]];else if(k(U[Y[t][1]]))q[t]=s-i*W-U[Y[t][1]];else{const e="x"===t?_.canvasX:_.canvasY;q[t]=r>0?e+n:0===r?e-i*W/2:e-i*W-n}q[t]*=H,N&&(q[t]+=z[t]),q[t]/=V;const a="x"===t?D.width:D.height,o=m.confine?-(j[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/H)/V:-j[t]/V,l=a/V+o-i;2!==r&&q[t]l&&(q[t]=l)):-2!==r&&q[t]>l&&(L?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]u(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",jZ=(t={},e={})=>{var i,s;u(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return u(n)&&(e.color=n),u(t.fontWeight)&&(e.fontWeight=t.fontWeight),u(t.textAlign)&&(e.textAlign=t.textAlign),u(t.fontSize)&&(e.fontSize=zZ(t.fontSize)),u(t.maxWidth)&&(e.maxWidth=zZ(t.maxWidth)),t.multiLine||u(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},HZ=(t={})=>{const{lineHeight:e}=t;return t.fontSize?zO(e,t.fontSize):0},VZ=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return u(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),u(r)&&(o=ni(r),a.padding=zZ(o)),{panelStyle:a,panelPadding:o}};function NZ(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}const WZ=t=>{eI.registerComponentPlugin(t.type,t)};class UZ extends FZ{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(UZ.type),this.type=jH.dom,this._tooltipContainer=null==Wy?void 0:Wy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(Wy&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:u,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=VZ(l),_={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(_.marginBottom=`${g}px`);const y={width:zZ(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=jZ(h),x=jZ(u),S=jZ(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),d(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),d(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),d(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),y[A]=zZ(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=zZ(null!==(s=u.spacing)&&void 0!==s?s:26),S[A]=zZ(null!==(n=p.spacing)&&void 0!==n?n:0);const M=Math.max(HZ(p),HZ(u));return _.lineHeight=M>0?`${M}px`:"20px",{panelPadding:v,row:_,panel:m,title:b,shape:y,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(TZ))),l=a.find((t=>t.className.includes(CZ)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(TZ),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(NZ(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${MZ}-column`),e.classList.add(`${MZ}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(CZ),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];NZ(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));NZ(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${MZ}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=OZ(e.key),e.keyStyle&&jZ(e.keyStyle,l)):"value"===i?(o.innerHTML=OZ(e.value),e.valueStyle&&jZ(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,g=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?PZ(t.shapeLineWidth)+"px":"0px";let m="currentColor";const _=()=>c?PZ(c):m,y=g,b=t=>new wg({symbolType:t,size:y,fill:!0});let x=b(h);const S=x.getParsedPath();let k,A;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;A=t.toString(),k=t.bounds}else S.isSvg&&S.svgCache&&(A=S.svgCache.map((t=>t.path.toString())).join(),k=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new je));let M=`${k.x1} ${k.y1} ${k.width()} ${k.height()}`;if("0px"!==f){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const w=fh.IsGradientStr(u);if(!u||v(u)&&!w||d)return m=d?"none":u?PZ(u):"currentColor",`\n \n \n \n `;const T=w?fh.Parse(u):p(u)?u:null;if(T){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=T.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===T.gradient?t=`\n ${i}\n `:"linear"===T.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),NZ(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(CZ))),h=[...o.children].find((t=>t.className.includes(TZ)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(u(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(TZ)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=zO(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,NZ(l,c))}const p=l.children,g=[];if(p){for(let i=0;i{WZ(UZ)},YZ={fontFamily:XO.fontFamily,spacing:10,wordBreak:"break-word"},XZ=(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},pf||(pf=df.CreateGraphic("richtext",{})),pf.setAttributes(a),pf.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function $Z(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:YZ),{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:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:u(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const KZ=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 u(a)&&(r.cornerRadius=[a,a,a,a]),r};class qZ extends FZ{constructor(){super(qZ.type),this.type=jH.canvas,this._attributes=null}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 tO({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}_getTooltipBoxSize(t,e){var i,s;if(!e||d(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:p,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:_}=l,y=ni(d.padding),b=VO(d.padding),x=$Z(Object.assign({textAlign:"right"===_?"right":"left"},p),i),S=$Z(Object.assign({textAlign:"right"===_?"right":"left"},f),i),k=$Z(m,i),A={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:KZ(d),padding:y,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:A,key:S,value:k,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:_},{title:w={},content:T=[]}=t;let C=b.left+b.right,B=b.top+b.bottom,E=0;const P=!!T.length;let R=0,O=0,I=0,L=0;if(P){const t=[],e=[],i=[],s=[];let n=0;M.content=T.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:p,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:M}=r,w={height:0,spaceRow:null!=y?y:v};if(u(h)){const i=tI({},S,$Z(b,void 0,{})),{width:s,height:n,text:r}=XZ(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(u(m)){const t=tI({},k,$Z(x,void 0,{})),{width:e,height:s,text:n}=XZ(m,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};M?t.stroke=d:t.fill=d,t.stroke=null!=p?p:d,t.lineWidth=g,w.shape=t;const e=null!=f?f:A.size;o=Math.max(e,o),s.push(e)}else w.shape={visible:!1};return w.height=o,n+=o,aW.autoWidth&&!1!==W.multiLine;if(j){W=tI({},x,$Z(V,void 0,{})),U()&&(W.multiLine=null===(r=W.multiLine)||void 0===r||r,W.maxWidth=null!==(a=W.maxWidth)&&void 0!==a?a:P?Math.ceil(E):void 0);const{text:t,width:e,height:i}=XZ(H,W);M.title.value=Object.assign(Object.assign({width:U()?Math.min(e,null!==(o=W.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},W),{text:t}),D=M.title.value.width,F=M.title.value.height,z=F+(P?M.title.spaceRow:0)}return B+=z,M.title.width=D,M.title.height=F,U()?C+=E||D:C+=Math.max(D,E),P&&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-L-R-S.spacing-k.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),M.valueWidth=Math.max(M.valueWidth,i.width))})),M.panel.width=C,M.panel.height=B,M})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_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{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?u(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()}}qZ.type=jH.canvas;const ZZ=()=>{WZ(qZ)},JZ=(t="chart",e,i)=>{var s,r,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===(s=e.region)||void 0===s||s.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["region",e],type:"region"})}));else if("series"===t)f.modelType="series",f.specKey="series",null===(r=e.series)||void 0===r||r.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["series",e],type:t.type})}));else if(Object.values(mO).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(n).includes(t)){f.modelType="component",f.type=t,f.specKey=null===(o=eI.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:s}=f,n=G(null!==(h=null===(l=i.component)||void 0===l?void 0:l[s])&&void 0!==h?h:[]);null===(d=G(null!==(c=e[s])&&void 0!==c?c:[]))||void 0===d||d.forEach(((e,i)=>{const s=n[i];s&&s.type===t?f.modelInfo.push(Object.assign(Object.assign({},s),{spec:e})):e&&!1===e.visible&&f.modelInfo.push({type:t,spec:e})}))}else{const s=eI.getComponents().filter((({cmp:e})=>e.specKey===t)).map((({cmp:t})=>t.type));if(s.length>0){f.modelType="component";const n=t;f.specKey=n;const r=G(null!==(p=null===(u=i.component)||void 0===u?void 0:u[n])&&void 0!==p?p:[]);G(null!==(g=e[n])&&void 0!==g?g:[]).forEach(((t,e)=>{const i=r[e];i&&s.includes(i.type)&&f.modelInfo.push(Object.assign(Object.assign({},i),{spec:t}))}))}}return f},QZ=(t,e,i,s)=>{const{spec:n,filter:r,filterType:a,forceAppend:o}=t,{isChart:l,modelType:h,specKey:u,type:p,modelInfo:g}=((t="chart",e,i,s,n,r)=>{const a=JZ(t,n,r);return Object.assign(Object.assign({},a),{modelInfo:a.modelInfo.filter((t=>!!d(e)||G(e).some((e=>c(e)?e(t,i,s):qO(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const f=tI({},i),m=c(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:tI(f,m),hasChanged:!0};const i=tI({},t,m);ZO(f,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},m);_(f[u])?f[u].push(t):d(f[u])?f[u]="component"===h?t:[t]:f[u]=[f[u],t]}return{chartSpec:f,hasChanged:!0}},tJ=t=>{eI.registerChartPlugin(t.type,t)};class eJ extends Wz{constructor(){super(eJ.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[eJ.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[eJ.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)}onAfterModelSpecTransform(t,e,i,s){this._initialized&&"updateSpec"===s&&this.onBeforeInitChart(t,e,"setCurrentTheme")}onBeforeInitChart(t,e,i){if(!this._initialized)return;let s,n;switch(i){case"render":case"updateModelSpec":s=!1,n=!0;break;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=QO(this._option.globalInstance.getSpec(),["data",eJ.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=QO(this._baseChartSpec,["data",eJ.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(u(t.maxHeight)&&e.height>t.maxHeight)return!1;break;case"minHeight":if(u(t.minHeight)&&e.heightt.maxWidth)return!1;break;case"minWidth":if(u(t.minWidth)&&e.width{const n=QZ(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=QO(i,["data",eJ.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()}}eJ.pluginType="chart",eJ.specKey="media",eJ.type="MediaQueryPlugin";const iJ=()=>{tJ(eJ)},sJ=/\{([^}]+)\}/,nJ=/\{([^}]+)\}/g,rJ=/:/;class aJ extends Wz{constructor(){super(aJ.type),this.type="formatterPlugin",this._timeModeFormat={utc:gi.getInstance().timeUTCFormat,local:gi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Si.getInstance().format,this._numericSpecifier=Si.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[aJ.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;c(r)?this._formatter=r:(this._formatter=this._format.bind(this),c(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),eI.registerFormatter(this._formatter)}_format(t,e,i){return _(t)?t.map(((t,s)=>{const n=_(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):_(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=sJ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(nJ,((t,i)=>{if(!rJ.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(yi.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):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}aJ.pluginType="chart",aJ.specKey="formatter",aJ.type="formatterPlugin";const oJ=()=>{tJ(aJ)};class lJ extends Wz{constructor(){super(lJ.type),this.type="ChartResizeZoomPlugin",this._zoom=1,this._onWheel=t=>{t.preventDefault(),t.stopImmediatePropagation();const e=Math.pow(1.005,-t.deltaY*Math.pow(16,t.deltaMode)*.2*this._rate),i={x:t.offsetX,y:t.offsetY};this.zoom(e,i)}}onAfterInitChart(t,e){var i,s,n,r,a;const o=t.globalInstance,l=null!==(s=null===(i=o.getSpec())||void 0===i?void 0:i[lJ.specKey])&&void 0!==s?s:{enabled:!1};!0===l.enabled&&(this._minZoom=null!==(n=l.min)&&void 0!==n?n:.1,this._maxZoom=null!==(r=l.max)&&void 0!==r?r:10,this._rate=null!==(a=l.rate)&&void 0!==a?a:.1,this._container=o.getContainer(),this._triggerEvent=WV(t.globalInstance.getChart().getOption().mode).zoom,this._container&&this._triggerEvent&&this._container.addEventListener(this._triggerEvent,this._onWheel))}zoom(t,e){const i=this.service.globalInstance;if(!i)return;const s=this._zoom;let n=this._zoom*t;if(n<=this._minZoom&&t<1||n>=this._maxZoom&&t>1)if(n<=this._minZoom&&this._zoom>this._minZoom)n=this._minZoom;else{if(!(n>=this._maxZoom&&this._zoom{tJ(lJ)};pF.useRegisters([()=>{ST(),uT.registerBuiltInAnimate("scaleIn",wC),uT.registerBuiltInAnimate("scaleOut",TC),uT.registerBuiltInAnimate("fadeIn",JT),uT.registerBuiltInAnimate("fadeOut",QT),uT.registerBuiltInAnimate("moveIn",PC),uT.registerBuiltInAnimate("moveOut",RC),uT.registerBuiltInAnimate("rotateIn",IC),uT.registerBuiltInAnimate("rotateOut",LC),uT.registerBuiltInAnimate("update",BC),uT.registerBuiltInAnimate("state",CC),uT.registerBuiltInAnimate("fromTo",DC),uT.registerBuiltInAnimate(KL,KD)},()=>{UH(),YH(),$H(),xH(),bH(),rH(),qj(),Rz(),Iz(),iF(),QD(),Wj(),jj(),eI.registerSeries(aH.type,aH),eI.registerChart(KH.type,KH)},()=>{UH(),YH(),$H(),bH(),rH(),qj(),Rz(),JH(),Iz(),eV(),Wj(),jj(),eI.registerSeries(sV.type,sV),xH(),eI.registerChart(rV.type,rV)},()=>{UH(),YH(),$H(),bH(),yV(),xH(),eI.registerChart(xV.type,xV)},()=>{UH(),YH(),xH(),bH(),PV(),eI.registerChart(OV.type,OV)},()=>{YH(),CW(),eI.registerChart(S$.type,S$)},()=>{UH(),YH(),xH(),bH(),YW(),eI.registerChart(M$.type,M$)},()=>{UH(),YH(),$H(),xH(),bH(),eU(),eI.registerChart(T$.type,T$)},()=>{UH(),YH(),$H(),xH(),bH(),yV(),eI.registerTransform("bin",Xr),eI.registerChart(O$.type,O$)},()=>{YH(),$V(),zV(),eI.registerSeries(qV.type,qV),eI.registerImplement("registerMap",RL),eI.registerImplement("unregisterMap",OL),tF(),eI.registerChart(m$.type,m$)},()=>{YH(),IX(),eI.registerSeries(DX.type,DX),SW(),mU(),NW(),yU(),eI.registerChart(F$.type,F$)},()=>{YH(),oY(),eI.registerChart(H$.type,H$)},()=>{YH(),TY(),eI.registerChart(N$.type,N$)},()=>{UH(),YH(),$H(),xH(),bH(),MN(),eI.registerChart(tK.type,tK)},()=>{UH(),YH(),xH(),bH(),XN(),eI.registerTransform("boxplot",$r),eI.registerChart(iK.type,iK)},()=>{UH(),YH(),xH(),bH(),yU(),eI.registerChart(L$.type,L$)},()=>{UH(),YH(),xH(),bH(),wU(),eI.registerChart(U$.type,U$)},()=>{UH(),YH(),xH(),bH(),nW(),eI.registerChart(Y$.type,Y$)},()=>{UH(),YH(),$H(),xH(),bH(),JH(),Wj(),jj(),eI.registerSeries(hW.type,hW),eI.registerChart(aK.type,aK)},()=>{YH(),GY(),eI.registerChart($$.type,$$)},()=>{YH(),ZY(),eI.registerChart(q$.type,q$)},()=>{YH(),AX(),eI.registerChart(J$.type,J$)},()=>{YH(),yo.load(fM),mX(),eI.registerChart(nK.type,nK)},()=>{YH(),WX(),eI.registerChart(lK.type,lK)},()=>{YH(),i$(),eI.registerChart(cK.type,cK)},()=>{UH(),YH(),$H(),xH(),eI.registerChart(B$.type,B$),bH()},jj,Wj,()=>{eI.registerGraphicComponent(mj.lineAxis,((t,e)=>new NC(t,e))),eI.registerGraphicComponent(vj.lineAxisGrid,((t,e)=>new JE(t,e))),Sj(),eI.registerComponent(Uj.type,Uj)},()=>{eI.registerGraphicComponent(mj.lineAxis,((t,e)=>new NC(t,e))),eI.registerGraphicComponent(vj.lineAxisGrid,((t,e)=>new JE(t,e))),Sj(),eI.registerComponent(Gj.type,Gj)},()=>{eI.registerGraphicComponent(mj.lineAxis,((t,e)=>new NC(t,e))),eI.registerGraphicComponent(vj.lineAxisGrid,((t,e)=>new JE(t,e))),Sj(),eI.registerComponent(Yj.type,Yj)},UW,NW,()=>{eI.registerComponent(fK.type,fK)},()=>{eI.registerComponent(wK.type,wK)},()=>{eI.registerComponent(DK.type,DK)},()=>{eI.registerComponent(NK.type,NK)},()=>{eI.registerComponent(WK.type,WK)},()=>{eI.registerComponent(nq.type,nq)},()=>{eI.registerComponent(aq.type,aq)},()=>{eI.registerComponent(cq.type,cq)},$V,()=>{eI.registerComponent(Xq.type,Xq),qP()},()=>{eI.registerComponent(Jq.type,Jq),JP()},()=>{eI.registerComponent(mZ.type,mZ),iR()},()=>{eI.registerComponent($q.type,$q),tR._animate=PP,qP()},()=>{eI.registerComponent(Qq.type,Qq),eR._animate=OP,JP()},()=>{eI.registerComponent(vZ.type,vZ),iR()},()=>{eI.registerComponent(_Z.type,_Z),iR()},()=>{eI.registerComponent(Kq.type,Kq)},()=>{eI.registerComponent(aZ.type,aZ)},()=>{eI.registerGraphicComponent(dZ.type,(t=>new $E(t))),hZ(),yj(),eI.registerComponent(dZ.type,dZ,!0,1/0)},()=>{eI.registerGraphicComponent(uZ.type,(t=>new $E(t))),hZ(),yj(),eI.registerComponent(uZ.type,uZ,!0)},()=>{eI.registerComponent(xZ.type,xZ)},()=>{eI.registerComponent(SZ.type,SZ)},()=>{yo.load(nw)},()=>{eI.registerLayout(kZ.type,kZ)},ZZ,lF,dF]),pF.useRegisters([()=>{rk(yo)}]);export{lD as AttributeLevel,Uz as AxisSyncPlugin,qZ as CanvasTooltipHandler,bL as ChartEvent,lJ as ChartResizeZoomPlugin,TI as DEFAULT_CHART_HEIGHT,wI as DEFAULT_CHART_WIDTH,mF as DEFAULT_CLOSE_STROKE_JOIN,BI as DEFAULT_DATA_INDEX,EI as DEFAULT_DATA_KEY,PI as DEFAULT_DATA_SERIES_FIELD,qI as DEFAULT_KEY,nD as DEFAULT_LAYOUT_RECT_LEVEL,rD as DEFAULT_LAYOUT_RECT_LEVEL_MIN,fF as DEFAULT_LINEAR_INTERPOLATE,ZI as DEFAULT_MAP_LOOK_UP_KEY,CI as DEFAULT_MEASURE_CANVAS_ID,RI as DEFAULT_SERIES_STYLE_NAME,gF as DEFAULT_SMOOTH_INTERPOLATE,oT as DefaultTicker,vF as Direction,UZ as DomTooltipHandler,eI as Factory,aJ as FormatterPlugin,oD as LayoutLevel,aD as LayoutZIndex,XI as MOSAIC_CAT_END_PERCENT,YI as MOSAIC_CAT_START_PERCENT,GI as MOSAIC_VALUE_END_PERCENT,UI as MOSAIC_VALUE_START_PERCENT,hT as ManualTicker,eJ as MediaQuery,MI as PREFIX,s as RenderModeEnum,KI as SEGMENT_FIELD_END,$I as SEGMENT_FIELD_START,LI as STACK_FIELD_END,jI as STACK_FIELD_END_OffsetSilhouette,FI as STACK_FIELD_END_PERCENT,OI as STACK_FIELD_KEY,II as STACK_FIELD_START,zI as STACK_FIELD_START_OffsetSilhouette,DI as STACK_FIELD_START_PERCENT,HI as STACK_FIELD_TOTAL,WI as STACK_FIELD_TOTAL_BOTTOM,VI as STACK_FIELD_TOTAL_PERCENT,NI as STACK_FIELD_TOTAL_TOP,cD as STATE_VALUE_ENUM,FC as StreamLight,vI as ThemeManager,jL as TransformLevel,sD as USER_LAYOUT_RECT_LEVEL,pF as VChart,HO as boundsInRect,aI as builtinThemes,zO as calcLayoutNumber,jO as calcPadding,SO as computeActualDataScheme,NO as convertPoint,rf as createArc,ef as createArea,Pp as createGroup,Eg as createLine,Ig as createRect,Kg as createRichText,Tg as createSymbol,Ag as createText,KO as darkTheme,UO as dataScheme,pF as default,oI as defaultThemeName,AO as getActualColor,WO as getActualNumValue,CO as getColorSchemeBySeries,xO as getDataScheme,nI as getFunnelTheme,fI as getMergedTheme,bF as getSpecInfo,uI as getTheme,cI as hasThemeMerged,MO as isColorKey,DO as isPercent,FO as isPercentOffset,wO as isProgressiveDataColorScheme,YO as isTokenKey,LO as isValidOrient,$O as lightTheme,xF as lookup,AI as measureText,VO as normalizeLayoutPaddingSpec,kO as queryColorFromColorScheme,GO as queryToken,ZZ as registerCanvasTooltipHandler,tJ as registerChartPlugin,hJ as registerChartResizeZoomPlugin,CL as registerDataSetInstanceParser,TL as registerDataSetInstanceTransform,GZ as registerDomTooltipHandler,oJ as registerFormatPlugin,iJ as registerMediaQuery,dI as registerTheme,pI as removeTheme,gI as themeExist,lI as themes,XO as token,TO as transformColorSchemeToStandardStruct,pL as transformToGraphic,SF as version,S_ as vglobal,jy as warn}; +let nY=class t extends YG{constructor(e){super(z({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{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,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize: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=this.options.createCanvas({width:1,height:1}),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 f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),_=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*Math.abs(Math.sin(h)))/this.gridSize),k=S*this.gridSize,A=x*this.gridSize;d.setAttribute("width",""+k),d.setAttribute("height",""+A),u.scale(1,1),u.translate(k/2,A/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,k,A).data;if(this.exceedTime())return null;const w=[];let T,C=S;const B=[x/2,S/2,x/2,S/2],E=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*k+(t*this.gridSize+n))+3])return i.push([t,e]),tB[1]&&(B[1]=t),eB[2]&&(B[2]=e))}};for(;C--;)for(T=x;T--;)E(C,T,w);return{datum:t,occupied:w,bounds:B,gw:S,gh:x,fillTextOffsetX:y,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=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,e=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),q(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){this.grid=[];const e=this.options.shape;if(p(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?tY(t,o,l.width,l.height,h):"geometric"===t.type&&sY(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!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)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,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}=NG(this.options.shape,[e.width,e.height]);return 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),this.result=[],this.progressiveRun()}};nY.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class rY extends YG{constructor(t){super(z({},rY.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,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)}rY.defaultOptions={enlarge:!1};const oY={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},lY=(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?hY(t.fontFamily):"sans-serif",d=t.fontStyle?hY(t.fontStyle):"normal",u=t.fontWeight?hY(t.fontWeight):"normal",p=t.rotate?hY(t.rotate):0,g=hY(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?hY(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,S=t.minFontSize,k=t.randomVisible,A=t.as?Object.assign(Object.assign({},oY),t.as):oY,M=t.depth_3d,w=t.postProjection;let T=t.fontSize?hY(t.fontSize):14;const C=t.fontSizeRange;if(C&&!x(T)){const t=T,e=dY(uY(t,l),C);T=i=>e(t(i))}let B=$G;"fast"===t.layoutType?B=rY:"grid"===t.layoutType&&(B=nY);const E=new B(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:T,shrink:_,clip:b,enlarge:y,minFontSize:S,random:k,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:E}:E.output()},hY=t=>v(t)||x(t)||c(t)||_(t)?t:e=>e[t.field],cY=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),dY=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=cY(t[0]),n=cY(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(cY(t)-r)/(a-r)*(e[1]-e[0])+e[0]},uY=(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 pY(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{hI.registerGrammarTransform("wordcloud",{transform:lY}),sW(),hI.registerAnimation("wordCloud",((t,e)=>({appear:GU(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:nF.disappear.duration}}))),hI.registerSeries(gY.type,gY)},mY=(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:f=!1,isCone:m=!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===f?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?m?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},vY=(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},_Y=`${OI}_FUNNEL_TRANSFORM_RATIO`,yY=`${OI}_FUNNEL_REACH_RATIO`,bY=`${OI}_FUNNEL_HEIGHT_RATIO`,xY=`${OI}_FUNNEL_VALUE_RATIO`,SY=`${OI}_FUNNEL_LAST_VALUE_RATIO`,kY=`${OI}_FUNNEL_NEXT_VALUE_RATIO`,AY=`${OI}_FUNNEL_LAST_VALUE`,MY=`${OI}_FUNNEL_CURRENT_VALUE`,wY=`${OI}_FUNNEL_NEXT_VALUE`,TY=`${OI}_FUNNEL_TRANSFORM_LEVEL`;class CY extends zF{constructor(t){var e,i;super(t),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)?this._transformRatioText: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[yY])).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 this._transformRatioText;const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return u(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class BY extends $D{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class EY extends BY{constructor(){super(...arguments),this.type=EY.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}EY.type="polygon";const PY=()=>{hI.registerMark(EY.type,EY),qA(),UA(),uT.registerBuiltInAnimate("growPointsOut",uC),hI.registerGraphicComponent("polygon",lf)},RY=Object.assign(Object.assign({},qF),{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"}});class OY extends uz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class IY extends pz{constructor(){super(...arguments),this.type=AO.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=OY,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,i,s,n;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._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;LL(this._dataSet,"funnel",mY),LL(this._dataSet,"funnelTransform",vY);const t=new Ba(this._dataSet,{name:`${OI}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new WD(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}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:MY,asTransformRatio:_Y,asReachRatio:yY,asHeightRatio:bY,asValueRatio:xY,asNextValueRatio:kY,asLastValueRatio:SY,asLastValue:AY,asNextValue:wY,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:TY}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},IY.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:lz(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},IY.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),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(IY.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(IY.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new CY(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(){var t,e,i,s;const n=this._funnelMark;n&&this.setMarkStyle(n,{points:t=>this.getPoints(t),visible:t=>u(t[this._valueField]),fill:this.getColorAttribute()},"normal",mD.Series);const r=this._funnelTransformMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t)},"normal",mD.Series);const a=this._funnelOuterLabelMark.label;a&&(this.setMarkStyle(a,{text:t=>`${t[this.getCategoryField()]}`,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),width:0,height:0},"normal",mD.Series),c(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(a,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",mD.User_Mark));const o=this._funnelOuterLabelMark.line;if(o&&a){this.setMarkStyle(o,{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",mD.Series);const n=null!==(i=null===(e=null===(t=this._spec.outerLabel)||void 0===t?void 0:t.line)||void 0===e?void 0:e.visible)&&void 0!==i?i:null===(s=this._spec.outerLabel)||void 0===s?void 0:s.visible;u(n)&&o.setVisible(n)}}initLabelMarkStyle(t){var e;if(!t)return;const i=t.getTarget(),s=t.getComponent();if(i===this._funnelMark){this._labelMark=t,this.setMarkStyle(t,{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",mD.Series);const i=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&Fy(i,this._funnelOuterLabelMark.label,s),this._funnelOuterLabelMark.line&&Fy(i,this._funnelOuterLabelMark.line,null!==(e=this._funnelOuterLabelMark.label)&&void 0!==e?e:s)}else this._funnelTransformMark&&i===this._funnelTransformMark&&(this._transformLabelMark=t,this.setMarkStyle(t,{text:t=>`${(100*xO(yY).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",mD.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(nz(null===(s=hI.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.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),rz("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(nz(hI.getAnimationInKey("fadeInOut")(),rz(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(nz(hI.getAnimationInKey("funnel")({},o),rz(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(nz(null===(a=hI.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),rz("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[SY])/2:this._getSecondaryAxisLength(t[xY])/2,n=this._getSecondaryAxisLength(t[xY])/2):(s=this._getSecondaryAxisLength(t[xY])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[kY])/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[TY])}_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 u(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[zI]===t[zI]));if(!u(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(x(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,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,_,y;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h: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!==f.alignLabel?(null==u?void 0:u.y2)+e:_-e,m=this._getPolygonCenter(i).x,_-y{PY(),sW(),gN(),hI.registerSeries(IY.type,IY),hI.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},aF))),hI.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:YT,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),lF()},DY=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},FY=t=>{const e=t.filter((t=>t.context.diffState===vD.update)),i=$(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},zY=(t,e,i)=>{if(E(t))return[e,i];const s=$(t.map((t=>1*t.getFinalAttribute().startAngle))),n=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},jY=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=FY(i.parent.children),a=zY(r,s,n);return DY(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=FY(i.parent.children),a=zY(r,s,n);return DY(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),HY=t=>{const e=$(t.map((t=>1*t.getFinalAttribute().startAngle))),i=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},VY=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=FY(i.parent.children),a=HY(r);return DY(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=FY(i.parent.children),a=HY(r);return DY(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),NY=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},WY=(t,e={})=>{if(!t)return[];const i=[];return KU(t,i,e),i},UY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new kG(i).layout(t,{width:s,height:n})};class GY extends zF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var YY;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(YY||(YY={}));const XY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(d(n))return t;if(i.type===YY.DrillDown){return G(fL(t,n,s,"children"))}if(i.type===YY.DrillUp){const e=mL(t,n,s,"children");if(e)return G(e)}return t};class $Y{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=ZV(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(n.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;LL(t,"drillFilter",XY),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(d(t.datum)||d(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(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!_(t)||E(t))return t;const s=t[t.length-1];return this._drillInfo={key:s,path:t,type:YY.DrillDown},e().reRunAllTransform(),i.emit(CL.drill,{value:{path:t,type:YY.DrillDown},model:this}),t}drillUp(){var t,e;const{getRawData:i,event:s}=this._drillParams,n=null!==(e=null===(t=this._drillInfo)||void 0===t?void 0:t.path)&&void 0!==e?e:[];if(!_(n)||E(n))return n;const r=n.pop();return this._drillInfo={key:r,path:n,type:YY.DrillUp},i().reRunAllTransform(),s.emit(CL.drill,{value:{path:n,type:YY.DrillUp},model:this}),n}}const KY=Object.assign(Object.assign({},qF),{sunburst:{name:"sunburst",type:"arc"}}),qY=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:WF,operations:["max","min","values"]}),t.push({key:UF,operations:["values"]}),t),ZY={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,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"}}}};class JY extends _W{constructor(){super(...arguments),this.type=AO.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:UF),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:zI},getRawData:()=>this.getRawData()}),this._startAngle=re(this._spec.startAngle),this._endAngle=re(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),LL(this._dataSet,"sunburstLayout",UY),LL(this._dataSet,"flatten",WY),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:[u(this._centerX)?this._centerX:this.getLayoutRect().width/2,u(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 qY(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();d(null==t?void 0:t.dataSet)||(LL(t.dataSet,"addVChartProperty",PF),t.transform({type:"addVChartProperty",options:{beforeCall:$F.bind(this),call:KF}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(JY.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_initArcMarkStyle(){d(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(u(this._offsetX)?this._offsetX:0),y:t=>t.y+(u(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},_D.STATE_NORMAL,mD.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(JY.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){d(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return p(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)+(u(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(u(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},_D.STATE_NORMAL,mD.Series)}initTooltip(){this._tooltipHelper=new GY(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(G(this.__innerRadius))[0],outerRadius:this._computeRadius(G(this.__outerRadius))[0],startAngle:G(this._startAngle)[0],endAngle:G(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(nz(null===(e=hI.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),rz(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(nz(null===(e=hI.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),rz(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_computeRadius(t){return _(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]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}JY.type=AO.sunburst,JY.mark=KY,JY.builtInTheme={sunburst:ZY},U(JY,$Y);const QY=()=>{hI.registerSeries(JY.type,JY),EW(),sW(),lF(),hI.registerAnimation("sunburst",((t,e)=>({appear:NY(0,e),enter:jY(t),exit:VY(t),disappear:{duration:nF.disappear.duration}})))},tX=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new dG(i).layout(t,{width:s,height:n})};class eX extends zF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const iX=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},sX=Object.assign(Object.assign({},qF),{circlePacking:{name:"circlePacking",type:"arc"}});class nX extends mz{constructor(){super(...arguments),this.type=AO.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:UF),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:zI},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();d(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),LL(this._dataSet,"circlePackingLayout",tX),LL(this._dataSet,"flatten",WY),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,valueField:this._valueField,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();d(null==t?void 0:t.dataSet)||(LL(t.dataSet,"addVChartProperty",PF),t.transform({type:"addVChartProperty",options:{beforeCall:$F.bind(this),call:KF}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(nX.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_initCirclePackingMarkStyle(){d(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},_D.STATE_NORMAL,mD.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(nX.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){d(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},_D.STATE_NORMAL,mD.Series)}getStatisticFields(){return qY(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new eX(this),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(nz(null===(i=hI.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),rz(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(nz(null===(e=hI.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),rz(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}nX.type=AO.circlePacking,nX.mark=sX,nX.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,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"}}}}},U(nX,$Y);const rX=()=>{hI.registerSeries(nX.type,nX),EW(),sW(),oF(),hI.registerAnimation("circlePacking",((t,e)=>({appear:iX(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:nF.disappear.duration}})))},aX=(t,e,i)=>{e.forEach((e=>{d(e[i])||t.add(e[i]),e.children&&e.children.length>0&&aX(t,e.children,i)}))},oX=t=>{var e;if(!t||!_(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},lX=(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 bG(e),r=[];return r.push(n.layout(s,i)),r},hX=t=>{var e,i;return t&&_(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:[]},cX=t=>{var e,i;return t&&_(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 dX extends zF{constructor(){super(...arguments),this._getDimensionData=t=>{if(t.source){if(x(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},this.markTooltipValueCallback=t=>t.value}}const uX=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),pX=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:uX(t),gX=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class fX extends kT{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class mX extends kT{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const vX=(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,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=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}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},_X=(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,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=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}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class yX extends zN{constructor(){super(...arguments),this.type=yX.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?_X:vX,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}yX.type="linkPath";const bX=Object.assign(Object.assign({},qF),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class xX extends uz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const SX=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&t.removeState(e),t.addState(e,s,n)};class kX extends mz{constructor(){super(...arguments),this.type=AO.sankey,this.transformerConstructor=xX,this._nodeLayoutZIndex=gD.Node,this._labelLayoutZIndex=gD.Label,this._viewBox=new je,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(u(a))return a;if(u(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;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(u(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=x(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var t,e;if(!this._needClear)return;const i=null===(t=this._nodeMark)||void 0===t?void 0:t.getGraphics();if(!i||!i.length)return;const s=null===(e=this._linkMark)||void 0===e?void 0:e.getGraphics();s&&s.length&&(i.forEach((t=>{t.removeState(_D.STATE_SANKEY_EMPHASIS),t.removeState(_D.STATE_SANKEY_EMPHASIS_REVERSE)})),s.forEach((t=>{t.removeState(_D.STATE_SANKEY_EMPHASIS),t.removeState(_D.STATE_SANKEY_EMPHASIS_REVERSE)})),this._needClear=!1)},this._handleNodeAdjacencyClick=t=>{const e=kL(t),i=[e.key];if(this._linkMark){const t=this._linkMark.getGraphics();if(!t||!t.length)return;t.forEach(((t,s)=>{const n=kL(t);n.source===e.key?(i.includes(n.target)||i.push(n.target),t.removeState(_D.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(_D.STATE_SANKEY_EMPHASIS,!0)):n.target===e.key?(i.includes(n.source)||i.push(n.source),t.removeState(_D.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(_D.STATE_SANKEY_EMPHASIS,!0)):(t.removeState(_D.STATE_SANKEY_EMPHASIS),t.addState(_D.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),i),this._needClear=!0},this._handleLinkAdjacencyClick=t=>{const e=kL(t),i=[e.source,e.target];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach((e=>{e===t?(e.removeState(_D.STATE_SANKEY_EMPHASIS_REVERSE),SX(e,_D.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState(_D.STATE_SANKEY_EMPHASIS),e.addState(_D.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),i),this._needClear=!0},this._handleNodeRelatedClick=t=>{var e;const i=kL(t),s=this._nodeMark.getGraphics();if(!s||!s.length)return;const n=this._linkMark.getGraphics();if(!n||!n.length)return;const r=(null===(e=kL(n[0]))||void 0===e?void 0:e.parents)?"parents":"source";if("source"===r){const t=[i.key],e=[];if(n.forEach(((n,r)=>{var a,o,l,h;const c=kL(n),d=(null==c?void 0:c.parents)?"parents":"source";if(G(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.getGraphics();if(!t||!t.length)return;t.forEach(((t,i)=>{var s;const n=kL(t);e.includes(null!==(s=n.key)&&void 0!==s?s:n.index)?(t.removeState(_D.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(_D.STATE_SANKEY_EMPHASIS,!0)):(t.removeState(_D.STATE_SANKEY_EMPHASIS),t.addState(_D.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),t)}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(G(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 a=kL(s),o=a.datum,l=o?o.filter((t=>t[r].some((t=>t.key===i.key)))):null,h=e.find((t=>t.source===a.source&&t.target===a.target));if(l&&l.length){t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target);const e=l.reduce(((t,e)=>t+e.value),0),i=e/a.value;return s.removeState(_D.STATE_SANKEY_EMPHASIS_REVERSE),void SX(s,_D.STATE_SANKEY_EMPHASIS,{ratio:i})}if(h)return t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target),s.removeState(_D.STATE_SANKEY_EMPHASIS_REVERSE),void SX(s,_D.STATE_SANKEY_EMPHASIS,{ratio:h.value/a.value});s.removeState(_D.STATE_SANKEY_EMPHASIS),s.addState(_D.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),t)}this._needClear=!0},this._handleLinkRelatedClick=t=>{const e=this._nodeMark.getGraphics();if(!e||!e.length)return;const i=this._linkMark.getGraphics();if(!i||!i.length)return;if("source"===(kL(t)?"parents":"source"))this._linkMark&&i.forEach((t=>{t.removeState(_D.STATE_SANKEY_EMPHASIS),t.removeState(_D.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&e.forEach((t=>{t.removeState(_D.STATE_SANKEY_EMPHASIS),t.removeState(_D.STATE_SANKEY_EMPHASIS_REVERSE)}));else{const s=kL(t),n=[s.source,s.target],r=[];G(s.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})}})),i.forEach((t=>{const e=kL(t),i=e.datum;if(e.source===s.source&&e.target===s.target)return t.removeState(_D.STATE_SANKEY_EMPHASIS_REVERSE),void SX(t,_D.STATE_SANKEY_EMPHASIS,{ratio:1});const a=i?i.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(s.source)&&e.includes(s.target)})):null;if(a&&a.length){n.includes(e.source)||n.push(e.source),n.includes(e.target)||n.push(e.target);const i=a.filter((t=>t.parents.some(((e,i)=>{var n;return e.key===s.source&&(null===(n=t.parents[i+1])||void 0===n?void 0:n.key)===s.target})))).reduce(((t,e)=>t+e.value),0),r=i/e.value;return t.removeState(_D.STATE_SANKEY_EMPHASIS_REVERSE),void SX(t,_D.STATE_SANKEY_EMPHASIS,{ratio:r})}const o=r.find((t=>t.source===e.source&&t.target===e.target));if(o)return n.includes(e.source)||n.push(e.source),n.includes(e.target)||n.push(e.target),t.removeState(_D.STATE_SANKEY_EMPHASIS_REVERSE),void SX(t,_D.STATE_SANKEY_EMPHASIS,{ratio:o.value/e.value});t.removeState(_D.STATE_SANKEY_EMPHASIS),t.addState(_D.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(e,n)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}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:this._spec.categoryField)}initData(){var t,e,i,s;super.initData();const n=this.getViewData(),r=this.getRawData();if(r&&n){LL(this._dataSet,"sankeyLayout",lX),LL(this._dataSet,"sankeyFormat",oX),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.direction,crossNodeAlign:this._spec.crossNodeAlign,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,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,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,inverse:this._spec.inverse},level:XL.sankeyLayout});const{dataSet:a}=this._option;LL(a,"sankeyNodes",hX),LL(a,"flatten",WY);const o=new Ba(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:YF.bind(this),call:XF}},!1),this._nodesSeriesData=o,LL(a,"sankeyLinks",cX);const l=new Ba(a,{name:`sankey-link-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyLinks"}),l.transform({type:"addVChartProperty",options:{beforeCall:YF.bind(this),call:XF}},!1),this._linksSeriesData=l}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(kX.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(kX.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=G(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,i=G(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()}_initNodeMarkStyle(){var t,e;const i=this._nodeMark;i&&(this.setMarkStyle(i,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},_D.STATE_NORMAL,mD.Mark),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.node.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByNode},"normal",mD.User_Mark))}_initLinkMarkStyle(){var t,e;const i=this._linkMark;i&&(i.setGlyphConfig({direction:this.direction}),this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},_D.STATE_NORMAL,mD.Series),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.link.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByLink},"normal",mD.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(d(t)||d(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=TF(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={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;this._nodeMark&&this._nodeMark.setAnimationConfig(nz(null===(i=hI.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),rz("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(nz(null===(s=hI.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),rz("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:EL.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(t,e){t&&t.length&&t.forEach((t=>{t.removeState([_D.STATE_SANKEY_EMPHASIS_REVERSE,_D.STATE_SANKEY_EMPHASIS]),e.includes(kL(t).key)?t.addState(_D.STATE_SANKEY_EMPHASIS,!0):t.addState(_D.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new dX(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_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&&!d(a[0])||(a=this.getNodeList(),a&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new FO;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_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=>{u(t[i])&&e.add(t[i]),u(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 aX(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),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]}getMarkData(t){return t.datum?_(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}kX.type=AO.sankey,kX.transformerConstructor=xX,kX.mark=bX,kX.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const AX=()=>{xV(),jN(),NA(),hI.registerGraphicComponent("path",(t=>Jg(t))),hI.registerMark(yX.type,yX),sW(),hI.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:pX(t,e)},aF))),hI.registerAnimation("sankeyLinkPath",((t,e)=>({appear:gX(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:nF.disappear.duration}}))),uT.registerBuiltInAnimate("linkPathGrowOut",mX),uT.registerBuiltInAnimate("linkPathGrowIn",fX),lF(),hI.registerSeries(kX.type,kX)},MX=(t,e)=>{let i={},s=e.fields;if(c(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=WY(n);return i=HF([{latestData:r}],e),i};class wX extends zF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const TX=Object.assign(Object.assign({},qF),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),CX=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class BX extends uz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const EX=(t,e)=>{if(e.getViewBox()){const i=new TG(e).layout(t,e.getViewBox()),s=[];return KU(i,s,{maxDepth:null==e?void 0:e.maxDepth}),s.forEach(((t,i)=>{t&&[UF,"name"].forEach((i=>{t[i]=t.datum[t.depth][e.nameField]}))})),s}return[]};class PX extends mz{constructor(){super(...arguments),this.type=AO.treemap,this.transformerConstructor=BX,this._categoryField="name",this._valueField="value",this._viewBox=new je,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:UF),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ne),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:zI},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,s,n;super.initData(),LL(this._dataSet,"treemap",EX),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{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}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(LL(this._rawData.dataSet,"addVChartProperty",PF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:$F.bind(this),call:KF}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=MX([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=z(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){LL(this._dataSet,"hierarchyDimensionStatistics",MX),LL(this._dataSet,"flatten",WY);const i=new Ba(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 qY(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(PX.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(PX.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}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()},_D.STATE_NORMAL,mD.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()},_D.STATE_NORMAL,mD.Series)}_initRichStyleOfLabelMark(t){"rich"===t.getTextType()&&this.setMarkStyle(t,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},_D.STATE_NORMAL,mD.Series)}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{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},_D.STATE_NORMAL,mD.Series),this._initRichStyleOfLabelMark(t))}initNonLeafLabelMarkStyle(t){t&&(this._nonLeafLabelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{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},_D.STATE_NORMAL,mD.Series),this._initRichStyleOfLabelMark(t))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(nz(null===(e=hI.getAnimationInKey("treemap"))||void 0===e?void 0:e(),rz(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 wX(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(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(wL.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(wL.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}PX.type=AO.treemap,PX.mark=TX,PX.builtInTheme={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"}}}},PX.transformerConstructor=BX,U(PX,$Y),U(PX,QV);const RX=()=>{hI.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),hI.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),xV(),sW(),hI.registerAnimation("treemap",((t,e)=>({appear:CX(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:nF.disappear.duration}}))),lF(),hI.registerSeries(PX.type,PX)},OX=Object.assign(Object.assign({},yU),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),IX=Object.assign(Object.assign({},qF),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),LX={type:"fadeIn"};function DX(t,e){return"fadeIn"===e?LX:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class FX extends uz{constructor(){super(...arguments),this._supportStack=!1}}class zX extends zF{enableByType(t){return"dimension"!==t}}const jX="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",HX={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:jX,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:jX,fill:"#ddd"}}};class VX extends bU{constructor(){super(...arguments),this.type=AO.gaugePointer,this.transformerConstructor=FX,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(VX.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},VX.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(VX.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(){this._tooltipHelper=new zX(this),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 u(this.radiusAxisHelper)&&u(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=mt(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})}getInteractionTriggers(){return 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(nz(null===(i=hI.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),rz("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}VX.type=AO.gaugePointer,VX.mark=IX,VX.builtInTheme={gaugePointer:HX},VX.transformerConstructor=FX;const NX=()=>{hI.registerSeries(VX.type,VX),YV(),xV(),hI.registerAnimation("gaugePointer",((t,e)=>{const i=DX(t,e);return{appear:i,enter:i,disappear:{duration:nF.disappear.duration}}})),JW(),qW()};class WX extends uz{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class UX extends bU{constructor(){super(...arguments),this.type=AO.gauge,this.transformerConstructor=WX,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=re(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();LL(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[sL]=t[this._angleField[0]],t[iL]=e>0?i[e-1][sL]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(UX.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(UX.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})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(t,e){if(super.initMarkStyleWithSpec(t,e),t&&"segment"===t.name){const e=this.getSpec().segment;if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,mD.User_Mark)}}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),s=_t(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?HO(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=_t(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?HO(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return u(t[iL])?this.angleAxisHelper.dataToPosition([t[iL]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[sL]])}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(nz(null===(i=hI.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),rz("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}UX.type=AO.gauge,UX.mark=OX,UX.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},UX.transformerConstructor=WX;class GX extends $D{constructor(){super(...arguments),this.type=GX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Tg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="rect":a.symbolType=o,a}}GX.type="cell";function YX(t){return!1===t?{}:{type:"fadeIn"}}class XX extends zF{enableByType(t){return"dimension"!==t}}const $X=Object.assign(Object.assign({},qF),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class KX extends uz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class qX extends mz{constructor(){super(...arguments),this.type=AO.heatmap,this.transformerConstructor=KX}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=G(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(qX.mark.cell,{isSeriesMark:!0},{morph:lz(this._spec,qX.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(qX.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){var e,i,s;t&&this.setMarkStyle(t,{fill:null!==(s=null===(i=null===(e=this._spec.cell)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s: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",mD.Series)}initCellBackgroundMarkStyle(){var t,e,i;const s=ni(null!==(i=null===(e=null===(t=this._spec.cellBackground)||void 0===t?void 0:t.style)||void 0===e?void 0:e.padding)&&void 0!==i?i:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+s[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+s[0]},width:()=>this.getCellSize(this._xAxisHelper)-s[1]-s[3],height:()=>this.getCellSize(this._yAxisHelper)-s[0]-s[2]},"normal",mD.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue()[0]}}getInteractionTriggers(){return 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=fz(this);this._cellMark.setAnimationConfig(nz(null===(i=hI.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),rz("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 XX(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}qX.type=AO.heatmap,qX.mark=$X,qX.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1},label:{style:{lineWidth:2}}}},qX.transformerConstructor=KX;const ZX=()=>{sW(),hI.registerMark(GX.type,GX),hI.registerGraphicComponent("symbol",Tg),qA(),JA(),zE(),hI.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},aF),{appear:YX(e)}))),Zj(),Xj(),hI.registerSeries(qX.type,qX)},JX=Object.assign(Object.assign({},qF),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),QX=`${OI}_CORRELATION_X`,t$=`${OI}_CORRELATION_Y`,e$=`${OI}_CORRELATION_SIZE`,i$=(t,e)=>{var i,s,n,r,a,o,l,h,c,u,p,g,f,m,v;if(!t||!(null==e?void 0:e.view)||!_(t))return t;const y=e.view();if(y.x1-y.x0==0||y.y1-y.y0==0||y.x1-y.x0==-1/0||y.x1-y.x0==1/0||y.y1-y.y0==-1/0||y.y1-y.y0==1/0)return t;const b=re(null!==(i=e.startAngle)&&void 0!==i?i:-90),S=re(null!==(s=e.endAngle)&&void 0!==s?s:270),k=Math.max((y.x1-y.x0)/2,(y.y1-y.y0)/2),A=Et(null!==(n=e.innerRadius)&&void 0!==n?n:0,k),M=Et(e.outerRadius,k),w=[x(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:y.x0+Et(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",y.x1-y.x0),x(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:y.y0+Et(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",y.y1-y.y0)],T=Bt(e.field),C=t.map(T),[B,E]=Rt(C),P=B===E?t=>(A+M)/2:t=>A+(M-A)*(t-B)/(E-B),R=d(e.radiusField)?T:Bt(e.radiusField),O=null!==(p=null===(u=null==e?void 0:e.radiusRange)||void 0===u?void 0:u[1])&&void 0!==p?p:5;let I=t=>O;if(R){const[i,s]=R!==T?Rt(t.map(R)):[B,E],n=null!==(f=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==f?f:5,r=null!==(v=null===(m=e.radiusRange)||void 0===m?void 0:m[1])&&void 0!==v?v:5;i!==s&&(I=t=>n+(r-n)*(R(t)-i)/(s-i))}const L=Math.min(b,S),D=Math.max(b,S),F=s$(L,D,t.length),z=[],j=(D-L)/60;return t.forEach(((t,e)=>{const i=P(C[e]),s=I(t);let n,r,a=F[e];for(let t=0;t<60&&(n=w[0]+i*Math.cos(a),r=w[1]+i*Math.sin(a),n$({x:n,y:r,size:s},z)||n-sy.x1||r-sy.y1);t++)t<59&&(a+=j,a>D?a=L: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},n$=(t,e)=>!(!e||!e.length)&&e.some((e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2){if(!t||!_(t))return[];const{keyword:i,categoryField:s}=e,n=t[0].latestData[0];return{[s]:i,[FI]:null==n?void 0:n[FI],[jI]:null==n?void 0:n[jI]}};class a$ extends zN{constructor(){super(...arguments),this.type=a$.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=mt(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}a$.type="ripple";const o$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class l$ extends uz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class h$ extends _W{constructor(){super(...arguments),this.type=AO.correlation,this.transformerConstructor=l$,this._viewBox=new je}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){u(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){u(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){u(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;LL(this._dataSet,"correlation",i$);const s=new Ca;DL(s,"dataview",Ma),LL(s,"correlationCenter",r$);const n=new Ba(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 WD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_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(){const t=this._createMark(h$.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:FI});t&&(t.setMarkConfig({zIndex:gD.Node}),this._nodePointMark=t);const e=this._createMark(h$.mark.ripplePoint,{key:FI,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});e&&(this._ripplePointMark=e);const i=this._createMark(h$.mark.centerPoint,{key:FI,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(i.setMarkConfig({zIndex:gD.Node}),this._centerPointMark=i)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var t,e,i,s;const n=this._nodePointMark;if(!n)return;const r=null!==(e=null===(t=this._spec.nodePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(n,{x:t=>t[QX],y:t=>t[t$],size:t=>t[e$],fill:null!==(i=r.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(s=r.fillOpacity)&&void 0!==s?s:1,lineWidth:0},_D.STATE_NORMAL,mD.Series)}_initRipplePointMarkStyle(){var t,e,i,s,n;const r=this._ripplePointMark;if(!r)return;const a=null!==(e=null===(t=this._spec.ripplePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(r,{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!==(i=a.fill)&&void 0!==i?i:this.getColorAttribute(),opacity:null!==(s=a.fillOpacity)&&void 0!==s?s:.2,ripple:null!==(n=a.ripple)&&void 0!==n?n:0},_D.STATE_NORMAL,mD.Series)}_initCenterPointMarkStyle(){var t,e,i,s,n,r;const a=this._centerPointMark;a&&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:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(i=null===(e=null===(t=this._spec.centerPoint)||void 0===t?void 0:t.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(r=null===(n=null===(s=this._spec.centerPoint)||void 0===s?void 0:s.style)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1},_D.STATE_NORMAL,mD.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},_D.STATE_NORMAL,mD.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(nz(null===(e=hI.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),rz("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(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}h$.type=AO.correlation,h$.mark=JX,h$.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},h$.transformerConstructor=l$;const c$=()=>{Nz(),jN(),JA(),hI.registerMark(a$.type,a$),hI.registerGraphicComponent("symbol",(t=>Tg(t))),hI.registerSeries(h$.type,h$),hI.registerAnimation("correlation",((t,e)=>Object.assign({appear:o$(0,e)},rF)))},d$=Object.assign(Object.assign({},qF),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class u$ extends zN{constructor(){super(...arguments),this.type=u$.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}u$.type="liquid";const p$=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class g$ extends zF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class f$ extends pz{constructor(){super(...arguments),this.type=AO.liquid,this.transformerConstructor=Wz,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Ig({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Tg({x:s,y:n,size:r,symbolType:p$(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){u(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=KO(this._spec.outlineMargin),this._paddingSpec=KO(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Ut(...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(f$.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(f$.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(f$.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(f$.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const t=this._liquidOutlineMark;t.created(),this.setMarkStyle(t,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",mD.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const t=this._liquidBackgroundMark;t.created(),this.setMarkStyle(t,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",mD.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const t=this._liquidMark,e=this._liquidGroupMark;e&&this.setMarkStyle(e,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),t&&this.setMarkStyle(t,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",mD.Series)}initTooltip(){this._tooltipHelper=new g$(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(nz(null===(i=hI.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),rz("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(nz(null===(s=hI.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),rz("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(CL.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=SM(t.attribute.fill,n.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]}}f$.type=AO.liquid,f$.mark=d$,f$.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},f$.transformerConstructor=Wz;const m$=t=>G(t).join(",");class v$ extends zF{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>m$(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>m$(null==t?void 0:t[this.series.getDimensionField()[0]])}}const _$=Object.assign(Object.assign({},qF),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class y$ extends uz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const b$=(t,e)=>{const i=e.getViewBox();return i&&(null==t?void 0:t.length)?jG(Object.assign({setField:e.setField,valueField:e.valueField},i),t):[]};class x$ extends pz{constructor(){super(...arguments),this.type=AO.venn,this.transformerConstructor=y$,this._viewBox=new je}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:zI)}initData(){var t;super.initData(),LL(this._dataSet,"venn",b$),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:{getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField}})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(x$.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(x$.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()},_D.STATE_NORMAL,mD.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},_D.STATE_NORMAL,mD.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},_D.STATE_HOVER,mD.Series))}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>m$(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)}},_D.STATE_NORMAL,mD.Series))}initOverlapLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>m$(t.sets)},_D.STATE_NORMAL,mD.Series))}initTooltip(){this._tooltipHelper=new v$(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(){super.onLayoutEnd(),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:m$(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return m$(i)}legendSelectedFilter(t,e){if(t.type===n.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[m$(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>G(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(m$(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(nz(null===(e=hI.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),rz(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(nz(null===(e=hI.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),rz(t.name,this._spec,this._markAttributeContext)))}))}}x$.type=AO.venn,x$.mark=_$,x$.builtInTheme={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"}}}}},x$.transformerConstructor=y$;class S$ extends wV{constructor(){super(...arguments),this.type=AO.mosaic,this.transformerConstructor=MV}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(QI),this.setFieldX2(JI)),this.setFieldY(eL),this.setFieldY2(tL)):(t&&(this.setFieldY(QI),this.setFieldY2(JI)),this.setFieldX(eL),this.setFieldX2(tL)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&d(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];d(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}S$.type=AO.mosaic,S$.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},S$.transformerConstructor=MV;class k$ extends bH{_isValidSeries(t){return t===AO.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class A$ extends _H{constructor(){super(...arguments),this.transformerConstructor=k$,this.type="map",this.seriesType=AO.map}}A$.type="map",A$.seriesType=AO.map,A$.transformerConstructor=k$;class M$ extends bH{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=G(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 u(r)&&n.forEach((t=>{d(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],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),u(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class w$ extends M${needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_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)),d(l.type)&&(l.type="linear"),d(o.type)&&(o.type="band");const h=ej(l,{min:0,max:1});d(l.min)&&(l.min=h.min),d(l.max)&&(l.max=h.max),s&&Object.assign(l,lI({},s,l)),n&&Object.assign(o,lI({},n,o))}}class T$ extends M${needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}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 C$ extends M${needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class B$ extends _H{constructor(){super(...arguments),this.transformerConstructor=C$}}B$.transformerConstructor=C$;class E$ extends B${constructor(){super(...arguments),this.transformerConstructor=C$,this.type="pie",this.seriesType=AO.pie}}E$.type="pie",E$.seriesType=AO.pie,E$.transformerConstructor=C$;class P$ extends T${_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return n.radius=null!==(e=t.radius)&&void 0!==e?e:vj,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:vj,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}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&&d(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=G(t.crosshair||{}).map((t=>lI({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const R$=(t,e)=>{if(!t)return null;const i=Ez(t,(t=>"angle"===t.getOrient()),e),s=Ez(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&sB(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),u={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=fO({x:1,y:0},u);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=mO(u),f=null===(e=s[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(d(v))return;let _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=Cz(v,t,"polar",r);n.push({index:_,value:v,position:i.scale(v),axis:t,data:y})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&sB(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let u=fO({x:1,y:0},c);u<-Math.PI/2&&(u=2*Math.PI+u);const p=mO(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((u-(null==f?void 0:f[0]))*(u-(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=s.invert(p);if(d(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const _=Cz(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:_})}})),n.length?n:null};class O$ extends _H{constructor(){super(...arguments),this.transformerConstructor=P$,this.type="rose",this.seriesType=AO.rose}_setModelOption(){this._modelOption.getDimensionInfo=R$}}O$.type="rose",O$.seriesType=AO.rose,O$.transformerConstructor=P$,U(O$,MH);class I$ extends T${_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t);return i.line=t.line,i.point=t.point,i.stack=t.stack,i.percent=t.percent,i.area=lI({visible:!1},t.area),i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"area",i.activePoint=t.activePoint,i.pointDis=t.pointDis,i.pointDisMul=t.pointDisMul,i.markOverlap=t.markOverlap,i}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=G(t.crosshair||{}).map((t=>lI({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class L$ extends _H{constructor(){super(...arguments),this.transformerConstructor=I$,this.type="radar",this.seriesType=AO.radar}_setModelOption(){this._modelOption.getDimensionInfo=R$}}L$.type="radar",L$.seriesType=AO.radar,L$.transformerConstructor=I$,U(L$,MH);class D$ extends bH{_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=p(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=>{P(e,"trimPadding")&&lI(e,cD(this.type,t))})),this._transformAxisSpec(t)}}class F$ extends _H{constructor(){super(...arguments),this.transformerConstructor=D$,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=LH(t,e,i))&&void 0!==s?s:[],...null!==(n=R$(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=FH,this._modelOption.getRectByDimensionData=WH}}F$.type="common",F$.transformerConstructor=D$,U(F$,MH);class z$ extends xH{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class j$ extends _H{constructor(){super(...arguments),this.transformerConstructor=z$}}j$.transformerConstructor=z$,U(j$,MH);class H$ extends z${transformSpec(t){super.transformSpec(t),oD(t)}}class V$ extends j${constructor(){super(...arguments),this.transformerConstructor=H$,this.type="histogram",this.seriesType=AO.bar}_setModelOption(){this._modelOption.getDimensionInfo=LH,this._modelOption.getDimensionInfoByValue=FH,this._modelOption.getRectByDimensionData=WH}}V$.type="histogram",V$.seriesType=AO.bar,V$.transformerConstructor=H$;class N$ extends w${_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class W$ extends _H{constructor(){super(...arguments),this.transformerConstructor=N$,this.type="circularProgress",this.seriesType=AO.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=R$}}W$.type="circularProgress",W$.seriesType=AO.circularProgress,W$.transformerConstructor=N$,U(W$,MH);class U$ extends w${_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=AO.circularProgress,e}transformSpec(t){var e,i,s,n,r;super.transformSpec(t);let a=null===(e=t.series)||void 0===e?void 0:e.find((t=>t.type===AO.gauge||t.type===AO.circularProgress));d(a)&&(a=null!==(i=t.gauge)&&void 0!==i?i:this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===a.type&&(d(a.radiusField)&&d(a.categoryField)&&(a.radiusField=null!==(n=null!==(s=t.radiusField)&&void 0!==s?s:t.categoryField)&&void 0!==n?n:t.seriesField),d(a.valueField)&&d(a.angleField)&&(a.valueField=null!==(r=t.valueField)&&void 0!==r?r:t.angleField)),1===t.series.length?t.series.push(a):t.series.forEach((t=>{t.type===a.type&&Object.keys(a).forEach((e=>{e in t||(t[e]=a[e])}))}))),a.type===AO.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:gD.Region+50}):this._transformGaugeAxisSpec(t)}_transformGaugeAxisSpec(t){var e;t.axes||(t.axes=[]);const i={radius:null,angle:null};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=t),"angle"===e&&(i.angle=t)})),i.angle||(i.angle={orient:"angle",visible:!0},t.axes.push(i.angle)),i.radius||(i.radius={orient:"radius",visible:!1},t.axes.push(i.radius)),d(i.angle.type)&&(i.angle.type="linear"),d(i.radius.type)&&(i.radius.type="linear"),d(i.angle.zIndex)&&(i.angle.zIndex=gD.Region+50)}}class G$ extends _H{constructor(){super(...arguments),this.transformerConstructor=U$,this.type="gauge",this.seriesType=AO.gaugePointer}}G$.type="gauge",G$.seriesType=AO.gaugePointer,G$.transformerConstructor=U$;class Y$ extends bH{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class X$ extends _H{constructor(){super(...arguments),this.transformerConstructor=Y$,this.type="wordCloud",this.seriesType=AO.wordCloud}}X$.transformerConstructor=Y$;class $$ extends X${constructor(){super(...arguments),this.transformerConstructor=Y$,this.type="wordCloud",this.seriesType=AO.wordCloud}}$$.type="wordCloud",$$.seriesType=AO.wordCloud,$$.transformerConstructor=Y$;class K$ extends bH{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class q$ extends _H{constructor(){super(...arguments),this.transformerConstructor=K$,this.type="funnel",this.seriesType=AO.funnel}}q$.type="funnel",q$.seriesType=AO.funnel,q$.transformerConstructor=K$;class Z$ extends xH{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}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)),d(s.type)&&(s.type="band"),d(i.type)&&(i.type="linear");const n=ej(i,{min:0,max:1});d(i.min)&&(i.min=n.min),d(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)),d(s.type)&&(s.type="linear"),d(e.type)&&(e.type="band");const n=ej(s,{min:0,max:1});d(s.min)&&(s.min=n.min),d(s.max)&&(s.max=n.max)}}}class J$ extends _H{constructor(){super(...arguments),this.transformerConstructor=Z$,this.type="linearProgress",this.seriesType=AO.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=LH,this._modelOption.getDimensionInfoByValue=FH,this._modelOption.getRectByDimensionData=WH}}J$.type="linearProgress",J$.seriesType=AO.linearProgress,J$.transformerConstructor=Z$,U(J$,MH);class Q$ extends xH{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"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),oD(t)}}class tK extends _H{constructor(){super(...arguments),this.transformerConstructor=Q$,this.type="rangeColumn",this.seriesType=AO.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=LH,this._modelOption.getDimensionInfoByValue=FH,this._modelOption.getRectByDimensionData=WH}}tK.type="rangeColumn",tK.seriesType=AO.rangeColumn,tK.transformerConstructor=Q$;class eK extends bH{_getDefaultSeriesSpec(t){const e=u(t.startAngle)?t.startAngle:-90,i=u(t.endAngle)?t.endAngle:e+ae(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class iK extends _H{constructor(){super(...arguments),this.transformerConstructor=eK,this.type="sunburst",this.seriesType=AO.sunburst}}iK.type="sunburst",iK.seriesType=AO.sunburst,iK.transformerConstructor=eK;class sK extends bH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class nK extends _H{constructor(){super(...arguments),this.transformerConstructor=sK,this.type="circlePacking",this.seriesType=AO.circlePacking}}nK.type="circlePacking",nK.seriesType=AO.circlePacking,nK.transformerConstructor=sK;class rK extends bH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class aK extends _H{constructor(){super(...arguments),this.transformerConstructor=rK,this.type="treemap",this.seriesType=AO.treemap}}aK.type="treemap",aK.seriesType=AO.treemap,aK.transformerConstructor=rK;class oK extends CV{transformSpec(t){super.transformSpec(t),t.legends&&G(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),oD(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class lK extends BV{constructor(){super(...arguments),this.transformerConstructor=oK,this.type="waterfall",this.seriesType=AO.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=LH,this._modelOption.getDimensionInfoByValue=FH,this._modelOption.getRectByDimensionData=WH}}lK.type="waterfall",lK.seriesType=AO.waterfall,lK.transformerConstructor=oK;class hK extends xH{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),oD(t)}}class cK extends _H{constructor(){super(...arguments),this.transformerConstructor=hK,this.type="boxPlot",this.seriesType=AO.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=LH,this._modelOption.getDimensionInfoByValue=FH,this._modelOption.getRectByDimensionData=WH}}cK.type="boxPlot",cK.seriesType=AO.boxPlot,cK.transformerConstructor=hK;class dK extends bH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class uK extends _H{constructor(){super(...arguments),this.transformerConstructor=dK,this.type="sankey",this.seriesType=AO.sankey}_setStateInDatum(t,e,i,s){const n=_(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=kL(t))||void 0===e?void 0:e.datum;return _(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}uK.type="sankey",uK.seriesType=AO.sankey,uK.transformerConstructor=dK;class pK extends xH{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.area=t.area,s.point=t.point,s.line=t.line,"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),oD(t)}}class gK extends _H{constructor(){super(...arguments),this.transformerConstructor=pK,this.type="rangeArea",this.seriesType=AO.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=LH,this._modelOption.getDimensionInfoByValue=FH,this._modelOption.getRectByDimensionData=WH}}gK.type="rangeArea",gK.seriesType=AO.rangeArea,gK.transformerConstructor=pK;class fK extends xH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class mK extends _H{constructor(){super(...arguments),this.transformerConstructor=fK,this.type="heatmap",this.seriesType=AO.heatmap}}mK.type="heatmap",mK.seriesType=AO.heatmap,mK.transformerConstructor=fK;class vK extends bH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class _K extends _H{constructor(){super(...arguments),this.transformerConstructor=vK,this.type="correlation",this.seriesType=AO.correlation}}_K.type="correlation",_K.seriesType=AO.correlation,_K.transformerConstructor=vK;function yK(t){var e,i;const s=Object.assign({},t);return E(t.style)||(s.textStyle=xL(t.style)),E(t.textStyle)||lI(s.textStyle,xL(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&xL(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&xL(s.background.style),s}const bK=(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},xK=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const p={};c.forEach((t=>{p[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:jI;return h?h(t,c,g):(_(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===p[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===p[t.source]&&!0===p[t.target])))):u(g)&&(t=t.filter((t=>!0===p[r.getSeriesFieldValue(t,g)]))),t)};class SK extends kj{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=gD.Legend,this.layoutLevel=fD.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{_O(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),_O(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=WO(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;u(s)&&(this._seriesUserId=G(s)),u(e)&&(this._regionUserId=G(e)),u(n)&&(this._seriesIndex=G(n)),u(i)&&(this._regionUserIndex=G(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_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):(N(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const t=this._initLegendData();t.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new WD(this._option,t),this._initSelectedData(),_O(this._regions,(t=>{t.event.on(CL.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){var e,i,s;const n=this._selectedData;d(t)||JSON.stringify(n)===JSON.stringify(t)||(_O(this._regions,(e=>{e.legendSelectedFilter&&(t=e.legendSelectedFilter(this,t))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...t],null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(CL.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;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)N(s,this._cacheAttrs)||this._legendComponent.setAttributes(lI({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(lI({},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 t,e;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());N(t,this._cacheAttrs)||this._legendComponent.setAttributes(lI({},t,{defaultSelected:this._selectedData}))}null===(e=(t=this.effect).onSelectedDataChange)||void 0===e||e.call(t),this.event.emit(CL.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}SK.specKey="legends";class kK extends SK{constructor(){super(...arguments),this.type=n.discreteLegend,this.name=n.discreteLegend}static getSpecInfo(t){return CF(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(t){super.init(t),_O(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:XL.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){LL(this._option.dataSet,"discreteLegendFilter",xK),LL(this._option.dataSet,"discreteLegendDataMake",bK);const t=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return _O(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(d(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(!qy(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 c(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)&&d(t.title.text)&&d(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=lL(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(e){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(e,i){const s=t(e,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:n={},item:r={},pager:a={},background:o={}}=e;n=I(n),r=I(r),a=I(a),o=I(o);const l=s;return n.visible?l.title=yK(n):l.title={visible:!1},E(r.focusIconStyle)||xL(r.focusIconStyle),r.shape&&(r.shape=_L(r.shape)),r.label&&(r.label=_L(r.label)),r.value&&(r.value=_L(r.value)),r.background&&(r.background=_L(r.background)),UO(r.maxWidth)&&(r.maxWidth=Number(r.maxWidth.substring(0,r.maxWidth.length-1))*i.width/100),UO(r.width)&&(r.width=Number(r.width.substring(0,r.width.length-1))*i.width/100),UO(r.height)&&(r.height=Number(r.height.substring(0,r.height.length-1))*i.width/100),l.item=r,"scrollbar"===a.type?(E(a.railStyle)||xL(a.railStyle),E(a.sliderStyle)||xL(a.sliderStyle)):(E(a.textStyle)||xL(a.textStyle),a.handler&&_L(a.handler)),l.pager=a,o.visible&&!E(o.style)&&(lI(l,o.style),u(o.padding)&&(l.padding=o.padding)),l}(this._spec,e)),{maxWidth:e.width,maxHeight:e.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return wR}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(yR.legendItemClick,(e=>{const i=P(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(CL.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(yR.legendItemHover,(t=>{const e=P(t,"detail");this.event.emit(CL.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(yR.legendItemUnHover,(t=>{const e=P(t,"detail");this.event.emit(CL.legendItemUnHover,{model:this,value:e,event:t})}))}}_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 c(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}=TF(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=TF(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}kK.specKey="legends",kK.builtInTheme={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}},kK.type=n.discreteLegend;const AK=(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[]},MK=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!p(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(o===n())return t;if(l&&!E(o)){const[e,i]=o;return a?a(t,o,l):h(t)?vL(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};function wK(e){const i=lI({},e),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:d,background:p={},type:g,id:f,visible:m,orient:v,position:_,data:y,defaultSelected:b,field:x,filter:S,regionId:k,regionIndex:A,seriesIndex:M,seriesId:w,padding:T}=i,C=t(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?C.title=yK(s):C.title={visible:!1},C.showHandler=!1!==n.visible,E(n.style)||(C.handlerStyle=xL(n.style)),u(r.width)&&(C.railWidth=r.width),u(r.height)&&(C.railHeight=r.height),E(r.style)||(C.railStyle=xL(r.style)),E(a.style)||(C.trackStyle=xL(a.style)),C.startText=_L(o),C.endText=_L(l),C.handlerText=function(t){if(!t)return t;const e=Object.assign({},t),i=t.style;return c(i)?e.style=(t,e,s)=>xL(i(t,e,s)):E(i)||(e.style=xL(i)),e}(h),E(d)||(C.sizeBackground=xL(d)),p.visible&&!E(p.style)&&(lI(C,p.style),u(p.padding)&&(C.padding=p.padding)),C}const TK={color:PR,size:OR},CK={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}},BK=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},CK),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},EK={horizontal:BK(!0),vertical:BK(!1)},PK=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},CK),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},RK={horizontal:PK(!0),vertical:PK(!1)},OK=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],IK=[2,10];class LK extends SK{static getSpecInfo(t){const e=CF(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?n.colorLegend:n.sizeLegend})),e}constructor(t,e){super(t,e),this.type=n.colorLegend,this.name=n.colorLegend;const i="color"===this._spec.type?n.colorLegend:n.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),_O(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData,customFilter:this._spec.customFilter},level:XL.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(){LL(this._option.dataSet,"continuousLegendFilter",MK),LL(this._option.dataSet,"continuousLegendDataMake",AK);const t=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>yO(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)&&d(t.title.text)&&d(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=lL(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!qy(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=lL(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var e,i;const s="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",n="horizontal"===s?"bottom":this.layoutOrient;let r=[];const a=this._getScaleInGlobal();a&&"linear"===a.type&&(r=a.range()),E(r)&&(r="color"===this._legendType?OK:IK);let o=null!==(e=this._legendData.getLatestData()[0])&&void 0!==e?e:0,l=null!==(i=this._legendData.getLatestData()[1])&&void 0!==i?i:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(o=Math.min(0,this._legendData.getLatestData()[0]),l=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const h=Object.assign({layout:s,align:n,zIndex:this.layoutZIndex,min:o,max:l,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:r},wK(this._spec));return this._addDefaultTitleText(h),h}_getLegendConstructor(){return TK[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",bt((e=>{const i=P(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(CL.legendFilter,{model:this,value:i,event:e})}),30))}}}LK.specKey="legends",LK.builtInTheme={colorLegend:EK,sizeLegend:RK},LK.type=n.continuousLegend;const DK=(t,e)=>u(e)?t.map((t=>e[t])):void 0,FK=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),zK=t=>!d(t)&&(_(t)?t.length>0&&t.every(u):Object.keys(t).length>0);function jK(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),p=i.getOption(),g=p.getRegionsInUserIdOrIndex(u(c.regionId)?[c.regionId]:void 0,u(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=HK(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),_=g.getLayoutRect(),y=p.globalInstance.getContainer(),b=Object.assign({x:0,y:0},y?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(y):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>FK(i,s)(t)&&FK(n,r)(t)&&(d(a)||FK([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),k=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),_.width),y:Math.min(Math.max(t.y,0),_.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.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 l=[{value:t[e.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=>x(t))))&&void 0!==i?i:[]}}))}];u(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=p.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:BL.chart,event:k({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=p.globalInstance;return xF.globalConfig.uniqueTooltip&&xF.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=p.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:BL.chart,event:k(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=p.globalInstance;return xF.globalConfig.uniqueTooltip&&xF.hideTooltip(a.id),m}return"none"}const HK=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),p=e.getMeasureField(),g=e.getSeriesField(),f=u(g)?t[g]:void 0,m=u(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=DK(c,t);let _=DK(p,t);const y=zK(_),b=!y&&u(g)&&d(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(FK(c,v));if(!y&&(_=DK(p,i),!zK(_)))return;const n=e.type===AO.pie?e.dataToCentralPosition(i):e.dataToPosition(i);d(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:p,measureData:_,hasMeasureData:y,groupField:g,groupData:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=sB(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])=>d(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(FK(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=DK(p,o),!zK(_))return;const l=t.dataToPosition(o);d(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:p,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(FK(c,n));if(!y&&(_=DK(p,r),!zK(_)))return;const o=t.dataToPosition(r);if(d(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:p,measureData:_,hasMeasureData:y,groupField:g,groupData:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===AO.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(FK(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(_=DK(p,i),!zK(_))return;const r=t.dataToPosition(i);d(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:p,measureData:_,hasMeasureData:y,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&(()=>{var i,n,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(FK(c,v));const o=e.getNameMap(),l=null===(r=null===(n=e.getMapViewData)||void 0===n?void 0:n.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=_;if(l&&!a&&(a=Object.assign({},t)),!y){if(_=DK(p,a),h=_,!zK(_)&&!a)return;zK(_)||(_=[null])}const u=e.dataToPosition(a);d(u)||isNaN(u.x)||isNaN(u.y)||s.push({pos:u,data:{dimensionFields:c,dimensionData:v,measureFields:p,measureData:h,hasMeasureData:y,groupField:g,groupData:f,originDatum:a},series:e})})()})),s},VK=t=>u(t)&&!_(t),NK=t=>u(t)&&_(t);class WK extends Sj{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i,s,n;const{spec:r,theme:a}=super._initTheme(t,e);return r.style=lI({},this._theme,r.style),r.offset=lI({},a.offset,t.offset),r.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:a.transitionDuration,r.trigger=null!==(s=t.trigger)&&void 0!==s?s:a.trigger,r.triggerOff=null!==(n=t.triggerOff)&&void 0!==n?n:a.triggerOff,{spec:r,theme:a}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(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 u(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]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:Yy(this._option.mode)||!Uy(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.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,u(t.parentElement)?v(t.parentElement)&&(t.parentElement=S_.getElementById(t.parentElement)):Uy(this._option.mode)&&(t.parentElement=null==Wy?void 0:Wy.body)}}const UK={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}};class GK extends kj{constructor(){super(...arguments),this.layoutZIndex=1,this.type=n.tooltip,this.name=n.tooltip,this.transformerConstructor=WK,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=Uy(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||p(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return d(t.mark)&&d(t.model)&&d(t.datum)}(t)&&(n&&VK(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):u(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!d(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&xF.globalConfig.uniqueTooltip&&l&&xF.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=t=>{var e,i,s;if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return 0;this.event.emit(CL.tooltipHide,Object.assign(Object.assign({},t),{source:BL.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const n=null!==(s=this._spec.handler)&&void 0!==s?s:this.tooltipHandler;if(null==n?void 0:n.hideTooltip){const e=n.hideTooltip.call(n,t);return e||(this._isTooltipShown=!1),e}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:BL.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),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(CL.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(CL.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,this._enterable=!1;else{const t="canvas"===s?XH.canvas:XH.dom,n=hI.getComponentPluginInType(t);n||Hy("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,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=hI.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=G(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=G(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(Gy(s)||Yy(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):p(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>p(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=x(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,xt(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(p(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===s||s.call(i)}else 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=jK(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(d(this._cacheInfo)||d(t))return!1;if(NK(t)){if(VK(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>wz(t,e[i])))}if(NK(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!d(n)&&!d(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: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}getVisible(){return!1!==this._spec.visible}}GK.type=n.tooltip,GK.transformerConstructor=WK,GK.builtInTheme={tooltip:UK},GK.specKey="tooltip";var YK,XK;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(YK||(YK={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(XK||(XK={}));const $K={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class KK extends kj{get enableRemain(){return"none"===this.triggerOff}constructor(t,e){super(t,e),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=gD.CrossHair_Grid,this.labelZIndex=gD.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),x(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=xt((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(p(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.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{sB(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_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}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||N(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(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:EL.chart}:{source:BL.chart};_(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;_(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}onBeforeRender(){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:t=s["desktop-browser"]}=this._option,e=function(t){return t===s["desktop-browser"]||t===s["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:Gy(t)||Yy(t)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(t);if(e){const t=G(this.trigger||"hover"),i=t=>"click"===t?"none"===this.triggerOff?null:e.clickOut:e.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:e[t],out:i(t)})})),s}return null}_registerTooltipEvent(){this.event.on(CL.tooltipHide,{source:BL.chart},this._handleTooltipHideOrRelease),this.event.on(CL.tooltipShow,{source:BL.chart},this._handleTooltipShow),this.event.on(CL.tooltipRelease,{source:BL.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=P(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{$K[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=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const u=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+u.left),o=Math.min(o,i-d+u.top),l=Math.max(l,e+t.getLayoutRect().width-c-u.right),h=Math.max(h,i+t.getLayoutRect().height-d-u.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_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)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||x(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(e,i){var s,n,r;const a={},{line:o={},label:l={},visible:c}=e;if(a.visible=c,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=t(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(x(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=P(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==e?void 0:e.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=e.line.style.stroke);const t=P(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 e=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=e.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:c,outerBorder:d}=n,u=t(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:e.minWidth,maxWidth:e.maxWidth,padding:e.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:P(s,"stroke")}),panel:(h(e.visible)?e.visible:e)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:c,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{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||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}KK.specKey="crosshair";const qK={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}}}}};class ZK extends KK{static getSpecInfo(t){return CF(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=n.cartesianCrosshair,this.name=n.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_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)}}_getDatumAtPoint(t,e){const i=vz(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){vz(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(u(t.dimType)?"y"===t.dimType:_z(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();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 o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=bO(this._regions,"cartesian");e&&(zH(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=VH(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new aw(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new ow(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}ZK.specKey="crosshair",ZK.builtInTheme={crosshair:qK},ZK.type=n.cartesianCrosshair;class JK extends KK{static getSpecInfo(t){return CF(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=n.polarCrosshair,this.name=n.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_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)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_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}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=bO(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&u(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=tj(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=TF(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:le(d,a.getInnerRadius(),o),end:le(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=ce(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=le(t,o,r),d=le(t,o,h),m=me([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=mt(ne.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new aw(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new hw(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new cw(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new lw(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=de(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}}(u):function(t){let e="center",i="middle";return e=(t=de(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}}(g.startAngle),a="angle"===l?le(e,p[1]+m.offset,u):le(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}JK.specKey="crosshair",JK.builtInTheme={crosshair:qK},JK.type=n.polarCrosshair;const QK=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(d(o)||d(a))return t;const l=r(),h=_(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},tq=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(d(a)||d(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=>{let e=!1;return G(r).every((i=>{t[i]>=a[0]&&t[i]<=Y(a)&&(e=!0)})),e}:t=>{let e=!1;return G(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},eq=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],p=[],g=[];let f=!1,m=!1;n.forEach(((t,e)=>{var n;if(d(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);u(null==t?void 0:t.max)&&u(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{d(h[t])&&(g.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{G(i[e]).forEach((i=>{d(t[i])||(d(h[t[i]])&&(g.push(t[i]),h[t[i]]=0,c.push(t[i])),d(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const v=f?g:!1===r||m?g.sort(((t,e)=>t-e)):c;return v.forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),p.push(e)})),p},iq=(t,e,i)=>{const s=e.domain();if(eB(e.type))return i?s[0]+(Y(s)-s[0])*(1-t):s[0]+(Y(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+(Y(n)-n[0])*t;return e.invert(r)},sq=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&eB(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/(Y(n)-n[0])))},nq=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},rq=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}},aq=(t,e,i)=>"start"===t?"percent"===e&&u(i.start)||"value"===e&&u(i.startValue):"percent"===e&&u(i.end)||"value"===e&&u(i.endValue),oq=(t,e,i)=>{if(eB(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class lq{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})}constructor(t,e,i,s,n,r,a,o){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.initZoomEvent=()=>{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:u(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,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),d=Math.abs(this.getState().start-this.getState().end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=mt(this.getState().start+f,0,1),_=mt(this.getState().end-m,0,1);this._handleChange(Math.min(v,_),Math.max(v,_),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Vt(s/n)>=.5:Vt(n/s)>=.5;if(this._scrollAttr.reverse||(r=-r),a){const t=this._spec.scrollStep;if(k(t)){r=(r>0?1:-1)*(t*(this.getState().end-this.getState().start)/1)}this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1)}const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))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.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===xz(bz(e))}setEventAttrFromSpec(){!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,h(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&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.getEvent(),this._option.mode)}}U(lq,QV);class hq extends kj{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:sq(t,this._stateScale,this._isHorizontal),a="percent"===n?e:sq(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var t;this._dataFilterEvent.initZoomEvent(),null===(t=this._relatedAxisComponent)||void 0===t||t.event.on(CL.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_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)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=nq(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[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._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._currentDataCollection=[],this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=oq(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!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&&rq(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({value:"force"})}else _O(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),_O(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=bz(t),this._isHorizontal="horizontal"===xz(this._orient),this._dataFilterEvent=new lq(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){this._handleDataCollectionChangeBound=this._handleDataCollectionChange.bind(this),super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||N(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])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(eB(n.type)){const r=n.domain(),a=r[0],o=Y(r)-a,l=u(t)?a+o*t:+e,h=u(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=u(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=u(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}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}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_setAxisFromSpec(){if(u(this._spec.axisId)?this._relatedAxisComponent=this._option.getComponentByUserId(this._spec.axisId):u(this._spec.axisIndex)&&(this._relatedAxisComponent=this._option.getComponentByIndex("axes",this._spec.axisIndex)),d(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>xz(t._orient)===xz(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!eB(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(u(i)&&(u(i.userId)&&(this._seriesUserId=G(i.userId)),u(i.specIndex)&&(this._seriesIndex=G(i.specIndex))),u(this._spec.seriesId)){const t=G(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(u(this._spec.seriesIndex)){const t=G(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(u(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(G(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(u(this._spec.regionId)){const t=G(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}_collectDataInfo(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};_O(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l,u=eB(d.getScale(0).type),p=eB(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?G(g.xField):G(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?G(g.yField):G(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:d===l?f:m;u&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else _O(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});return{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}}_initData(){const{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}=this._collectDataInfo(),{dataSet:r}=this._option;DL(r,"dataview",Ma),LL(r,"dataFilterComputeDomain",eq);const a=new Ba(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new WD(this._option,a),a.reRunAllTransform(),this._currentDataCollection=t,r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChangeBound)}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(LL(this._option.dataSet,"dataFilterWithNewDomain",tq),LL(this._option.dataSet,"lockStatisticsFilter",QK),_O(this._regions,(t=>{t.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>t.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>eB(this._stateScale.type)},level:1},!1),t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>eB(this._stateScale.type)},level:XL.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r}=this._collectDataInfo();if(this._currentDataCollection.length!==e.length||this._currentDataCollection.some(((t,i)=>t!==e[i]))){this._currentDataCollection.forEach((t=>{var e;null===(e=null==t?void 0:t.target)||void 0===e||e.removeListener("change",this._handleDataCollectionChangeBound)})),this._currentDataCollection=e;const{dataSet:t}=this._option;t.multipleDataViewAddListener(this._currentDataCollection,"change",this._handleDataCollectionChangeBound)}this._data.getDataView().transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data.getDataView().reRunAllTransform();const a=this._computeDomainOfStateScale(eB(this._stateScale.type));this._stateScale.domain(a,!1),(u(this._spec.start)||u(this._spec.end))&&this._setStateFromSpec(),this._handleChange(this._start,this._end,!0),this._spec.auto&&!N(this._domainCache,a)&&(this._domainCache=a,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;aq("start",i,this._spec)&&aq("end",s,this._spec)&&(t="percent"===i?this._spec.start:sq(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:sq(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?sq(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?sq(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=iq(this._start,this._stateScale,nq(i,this._isHorizontal)),this._endValue=iq(this._end,this._stateScale,nq(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,eB(this._stateScale.type)&&this._stateScale.domain()[0]!==Y(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/(Y(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/(Y(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=oq(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&_O(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);k(null==i?void 0:i.min)&&k(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new GB:new AB,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_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}_autoVisible(t){if(!this._auto)return;t?this.show():this.hide();const e=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[e]:t?this[`_${e}`]:0},{[e]:mD.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_autoUpdate(t){var e,i,s,r,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(),u=rq(h);if(!this._dataUpdating&&sB(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==u?void 0:u.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===(r=this._cacheRect)||void 0===r?void 0:r.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==u?void 0:u.bandSize,sB(c.type)){u&&(this._start||this._end)&&(this.type===n.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!d(t)||!d(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),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}U(hq,QV);class cq extends Sj{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=lI({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=_(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}const dq=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),uq={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:dq(!1),startHandler:{style:{symbolType:"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;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"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;",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:dq(!0)};class pq extends hq{constructor(t,e){var i;super(t,e),this.type=n.dataZoom,this.name=n.dataZoom,this.transformerConstructor=cq,this.specKey="dataZoom",this.layoutZIndex=gD.DataZoom,this.layoutLevel=fD.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e=this._isHorizontal?0:this._middleHandlerSize,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=this._isHorizontal?0:this._middleHandlerSize,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._getPreviewStateScale(),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._getPreviewStateScale(),n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"filter"}_handleChange(t,e,i,s){if(super._handleChange(t,e,i),this._shouldChange)if(i&&this._component)this._component.setStartAndEnd(t,e);else{const i=this._relatedAxisComponent,n=iq(t,this._stateScale,nq(i,this._isHorizontal)),r=iq(e,this._stateScale,nq(i,this._isHorizontal));if(!u(n)||!u(r))return;this._start=t,this._end=e;(c(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,n,r):this._handleStateChange(n,r,s))&&this.event.emit(CL.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:t,end:e,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){this._data.getDataView().reRunAllTransform(),this._initAfterLayout();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new GB),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(nq(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=nq(t,this._isHorizontal),this.effect.onZoomChange())}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,d=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+d,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+d),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);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(),d(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=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize),d(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=isNaN(c)?this._backgroundSize:c-this._middleHandlerSize);const u=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=u?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new GB;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(nq(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[$(e),X(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!eB(t.type)||e[0]!==Y(e))&&(!sB(t.type)||1!==(i=e,i&&_(i)?Array.from(new Set(G(i))):i).length);var i}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_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:x(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:x(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_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._computeWidth(),height:this._computeHeight()},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:u(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,isReverse:nq(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=!1!==this._spec.showBackgroundChart,i=this._getAttrs(e),s=this._relatedAxisComponent;if(this._component)this._component.setAttributes(i),t&&(this._component.setPreviewData(this._data.getDataView().latestData),e&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>iq(t,this._stateScale,nq(s,this._isHorizontal))))));else{const t=this.getContainer();this._component=new bP(i),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?e&&this._component.setPreviewPointsY1(this._dataToPositionY2):e&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>iq(t,this._stateScale,nq(s,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:xL(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:xL(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:xL(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:xL(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:xL(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:xL(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:xL(g.style)},selectedBackgroundStyle:xL(this._spec.selectedBackground.style),dragMaskStyle:xL(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:lI(xL(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},xL(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:lI(xL(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},xL(null===(d=m.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}=TF(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(nq(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}}pq.type=n.dataZoom,pq.transformerConstructor=cq,pq.builtInTheme={dataZoom:uq},pq.specKey="dataZoom";const gq={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}};class fq extends hq{constructor(t,e){var i;super(t,e),this.type=n.scrollBar,this.name=n.scrollBar,this.specKey="scrollBar",this.layoutZIndex=gD.DataZoom,this.layoutLevel=fD.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"axis"}_handleChange(t,e,i){super._handleChange(t,e,i);const s=hO(this._start,t)&&hO(this._end,e);if(this._shouldChange&&(!s||!1===this._spec.realTime)){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;const s=this._relatedAxisComponent,n=nq(s,this._isHorizontal),r=iq(t,this._stateScale,n),a=iq(e,this._stateScale,n);(c(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,r,a):this._handleStateChange(r,a))&&this.event.emit(CL.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:x(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:x(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r,a;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:u(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,minSliderSize:null===(a=this._spec)||void 0===a?void 0:a.minSliderSize},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new dM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return d(i)||(s.padding=i),E(null==t?void 0:t.style)||(s.railStyle=xL(t.style)),E(null==e?void 0:e.style)||(s.sliderStyle=xL(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}fq.type=n.scrollBar,fq.builtInTheme={scrollBar:gq},fq.specKey="scrollBar";const mq=(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}),G(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r},vq=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),_q={title:{visible:!0,autoLimit:!1,autoFit:!1,style:vq("l1FontSize","primaryFontColor")},content:{visible:!0,style:vq("l2FontSize","tertiaryFontColor")}};class yq extends kj{constructor(){super(...arguments),this.type=n.indicator,this.name=n.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=gD.Indicator,this.layoutLevel=fD.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return CF(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=G(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(G(this._spec.regionId),G(this._spec.regionIndex))}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(kL(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(kL(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){LL(this._option.dataSet,"indicatorFilter",mq);const t=new Ba(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 WD(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const e=this._regions[0],{width:i,height:s}=e.getLayoutRect(),{x:n,y:r}=e.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,p=t(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return G(o).forEach((t=>{const e=lI({},this._theme.content,t);g.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({},bL(j(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?ZO(l,this._computeLayoutRadius()):0,dy:h?ZO(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!u(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},bL(j(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},p)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)N(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new DR(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":c(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.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}yq.type=n.indicator,yq.builtInTheme={indicator:_q},yq.specKey="indicator";const bq=["sum","average","min","max","variance","standardDeviation","median"];function xq(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=$(s),r=X(s);return er}function Sq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return x(t.x)&&xq(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=UO(t.x)?wq(t.x,n)+r.x:Tq(l.getXAxisHelper(),[t.x])+r.x,h}function kq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return x(t.y)&&xq(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=UO(t.y)?wq(t.y,n)+r.y:Tq(l.getYAxisHelper(),[t.y])+r.y,h}function Aq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return x(t.angle)&&xq(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)),Tq(a.angleAxisHelper,[t.angle])}function Mq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return x(t.radius)&&xq(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)),Tq(a.radiusAxisHelper,[t.radius])}function wq(t,e){return Number(t.substring(0,t.length-1))*e/100}function Tq(t,e){const i=t.getScale(0);return eB(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function Cq(t){return bq.includes(t)}function Bq(t,e,i,s,n,r=!1){const a=e.getRegion(),o=a.getLayoutStartPoint(),l=i.getRegion(),h=l.getLayoutStartPoint(),c=Math.abs(Math.min(o.x,h.x)-Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width)),d=Math.abs(Math.min(o.y,h.y)-Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height)),p={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},g=[],f=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper(),v=s.getYAxisHelper(),_=m.getScale(0).domain(),y=v.getScale(0).domain(),b=r&&!m.isContinuous&&!!m.getBandwidth,x=r&&!v.isContinuous&&!!v.getBandwidth,S={min:null,max:null},k={min:null,max:null};return f.forEach((t=>{const e=u(t.x),i=u(t.y);let s,r;if(e&&i)s=Sq(t,_,n,p,c,o),r=kq(t,y,n,p,d,o),Eq(s,b,S,g.length),Eq(r,x,k,g.length),g.push([{x:s,y:r}]);else if(e){s=Sq(t,_,n,p,c,o),r=Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height);const e=Math.min(o.y,h.y);Eq(s,b,S,g.length),g.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(o.x,h.x),r=kq(t,y,n,p,d,o);const e=Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width);Eq(r,x,k,g.length),g.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(g,m,v,S,k),g}function Eq(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=u(t.angle),i=u(t.radius);if(e&&i){const e=Aq(t,l,n,r),i=Mq(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=Aq(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=Mq(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function Rq(t,e,i,s){const n=[],r=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,a=_(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:f}=u.getLayoutRect();let m=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(m=UO(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=UO(i)?Number(i.substring(0,i.length-1))*f/100:i)}const _=d.getXAxisHelper().getScale(0).domain(),y=d.getYAxisHelper().getScale(0).domain(),b=G(t.x),S=G(t.y);1===b.length&&x(b[0])&&xq(_,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===S.length&&x(S[0])&&xq(y,S[0],i)&&(null===(c=null===(h=d.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",S[0])),n.push({x:Tq(d.getXAxisHelper(),b)+p.x+m,y:Tq(d.getYAxisHelper(),S)+p.y+v})})),n}function Oq(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=G(t.angle),u=G(t.radius);1===d.length&&x(d[0])&&xq(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&&x(u[0])&&xq(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:Tq(l.angleAxisHelper,d),radius:Tq(l.radiusAxisHelper,u)})})),s}function Iq(t,e,i){let{x:s,y:n}=t;return UO(s)&&(s=wq(s,e)),UO(n)&&(n=wq(n,i)),{x:s,y:n}}function Lq(t,e,i){let s;if(s=c(t)?G(t(e.getData().getLatestData(),e)):G(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=Iq(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>Iq(t,n,r)))}function Dq(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 Fq(e,i,s){const{labelBackground:n={},style:r,shape:a}=e,o=t(e,["labelBackground","style","shape"]);if(!1!==e.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},xL(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},jq(xL(n.style),i,s)),u(n.padding)&&(t.padding=ni(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=jq(xL(r),i,s)),t}return{visible:!1}}function zq(t,e,i){for(const s in t)c(t[s])&&(t[s]=t[s](e,i));return t}function jq(t,e,i){return c(t)?t(e,i):t}function Hq(t,e){return c(t)?t(e):t}function Vq(t,e,i){return u(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 Nq(t){return{isXProcess:u(t.x),isYProcess:u(t.y),isX1Process:u(t.x1),isY1Process:u(t.y1),isAngleProcess:u(t.angle),isRadiusProcess:u(t.radius),isAngle1Process:u(t.angle1),isRadius1Process:u(t.radius1),isCoordinatesProcess:u(t.coordinates),isValidProcess:u(t.process)}}function Wq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=Nq(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:h&&(!c||"process"in t&&"xy"in t.process)}}function Uq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=Nq(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function Gq(t){return{doXYProcess:u(t.x)&&u(t.y),doPolarProcess:u(t.angle)&&u(t.radius),doGeoProcess:u(t.areaName)}}function Yq(e,i){let s;if(i.coordinates){const e=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=e,o=t(e,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(c(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=G(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;u(r)&&(c=G(i)[r]),n&&G(i).includes(n)&&(c=n);let d=s;u(l)&&(d=G(s)[l]),a&&G(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),v(t[c])&&Cq(t[c])?h.x={field:c,aggrType:t[c]}:h.x=G(c).map((e=>t[e])),v(t[d])&&Cq(t[d])?h.y={field:d,aggrType:t[d]}:h.y=G(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;u(r)&&(a=G(s)[r]),n&&G(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),v(t[a])&&Cq(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=G(a).map((e=>t[e])),v(t[l])&&Cq(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=G(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((t=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(u(t.x)){const s=t.x;_(s)?i.x=s.map((i=>$q(i,e,t))):i.x=$q(s,e,t)}if(u(t.y)){const s=t.y;_(s)?i.y=s.map((i=>$q(i,e,t))):i.y=$q(s,e,t)}if(u(t.angle)){const s=t.angle;_(s)?i.angle=s.map((i=>$q(i,e,t))):i.angle=$q(s,e,t)}if(u(t.radius)){const s=t.radius;_(s)?i.radius=s.map((i=>$q(i,e,t))):i.radius=$q(s,e,t)}if(u(t.areaName)){const s=t.areaName;i.areaName=$q(s,e,t)}t.getRefRelativeSeries&&(i.getRefRelativeSeries=t.getRefRelativeSeries),n.push(i)})),n}const Xq={min:(t,e)=>cO(t[0].latestData,e.field),max:(t,e)=>dO(t[0].latestData,e.field),sum:function(t,e){return uO(t[0].latestData,e.field)},average:function(t,e){return pO(t[0].latestData,e.field)},variance:function(t,e){return gO(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(gO(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 $q(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(c(t))return t(a,o,l,s,n,r);if(f(t)){const{aggrType:i,field:s}=t;return Xq[i](e,{field:s})}return t}function Kq(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 qq extends kj{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){return CF(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_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 v(e)&&Cq(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){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];G(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Ca;return e.registerParser("array",i),new Ba(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(u(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)))}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=bO(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){d(this._spec.offsetX)||(this._layoutOffsetX=YO(this._spec.offsetX,e.width,e)),d(this._spec.offsetY)||(this._layoutOffsetY=YO(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return N(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();LL(this._option.dataSet,"markerAggregation",Yq),LL(this._option.dataSet,"markerFilter",Kq);const i=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),i.target.on("change",(()=>{this._markerLayout()})),this._markerData=i}}function Zq(t,e){return function(t,e,i){const{predict:s}=Lt(t,(t=>t[e]),(t=>t[i])),n=cO(t,e),r=dO(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class Jq extends qq{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=gD.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=Wq(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;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=G(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={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},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:jq(xL(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>Fq(t,this._markerData,this._markAttributeContext))),state:{line:zq(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:zq(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:zq(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return zq(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return zq(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:jq(xL(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:jq(xL(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||G(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=Dq([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=G((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=G(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,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}=Wq(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;LL(this._option.dataSet,"markerAggregation",Yq),LL(this._option.dataSet,"markerRegression",Zq),LL(this._option.dataSet,"markerFilter",Kq);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new Ba(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",(()=>{this._markerLayout()})),this._markerData=m}}Jq.specKey="markLine";const Qq=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),tZ={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"}}},refY:5},eZ={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:Qq(!1),endSymbol:Qq(!0),label:tZ};class iZ extends Jq{constructor(){super(...arguments),this.type=n.markLine,this.name=n.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new rR(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=u(e.coordinates),o=u(e.process),l=o&&u(e.process.x),h=o&&u(e.process.y),c=u(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:p,doYProcess:g,doXYY1Process:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:_}=Wq(e);let y=[];if(p||f||g||m||v||a&&l||a&&h){const t=Bq(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=Rq(i,r,d,e.coordinatesOffset):c&&(y=Lq(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n;const r=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const n=this._startRelativeSeries,a=this._endRelativeSeries,{multiSegment:o,mainSegmentIndex:l}=this._spec.line||{},{connectDirection:h,expandDistance:c=0}=this._spec;let d;if(UO(c)){const t=n.getRegion(),e=t.getLayoutStartPoint(),i=a.getRegion(),s=i.getLayoutStartPoint();if("bottom"===h||"top"===h){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));d=Number(c.substring(0,c.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));d=Number(c.substring(0,c.length-1))*n/100}}else d=c;const{points:p,limitRect:g}=r;if(!p||p.length<2)return void(null===(t=this._markerComponent)||void 0===t||t.setAttributes(r));const f=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}(p[0],p[1],h,d);let m;m=o&&u(l)?{position:"middle",autoRotate:!1}: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)}:{}}(p[0],p[1],h,d));const v=G((null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{}).label),_=G(r.label),y=G(this._spec.label);null===(s=this._markerComponent)||void 0===s||s.setAttributes({points:o?[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]]]:f,label:_.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=m.dx)&&void 0!==i?i:0,h=null!==(s=m.dy)&&void 0!==s?s:0;const c=null!==(n=y[e])&&void 0!==n?n:y[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),m),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=v[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:g,multiSegment:o,mainSegmentIndex:l,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(n=this._markerComponent)||void 0===n||n.setAttributes(r)}_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}=Wq(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 Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&u(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&u(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&u(n.process.xy)){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}}}iZ.type=n.markLine,iZ.coordinateType="cartesian",iZ.builtInTheme={markLine:eZ};class sZ extends Jq{constructor(){super(...arguments),this.type=n.polarMarkLine,this.name=n.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=Wq(this._spec);return e||i?new lR(t):new rR(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}=Wq(e);let p=[],g={};const f={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=Pq(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:f}:{points:p.map((t=>le(f,t.radius,t.angle)))}}else u&&(p=Oq(i,r,a),g={points:p.map((t=>le(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=Wq(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}}}sZ.type=n.polarMarkLine,sZ.coordinateType="polar",sZ.builtInTheme={polarMarkLine:eZ};class nZ extends kj{get orient(){return this._orient}constructor(t,e){super(t,e),this.type=n.title,this.specKey=n.title,this.layoutType="normal",this.layoutZIndex=gD.Title,this.layoutLevel=fD.Title,this._orient="top",this._orient=WO(t.orient)?t.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return CF(t,this.specKey,n.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}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;if(!1===this._spec.visible)return{visible:!1};const a=this.getLayoutRect(),o=YO(this._spec.width,a.width,null,a.width),l=YO(this._spec.maxWidth,a.width,null,a.width),h=Math.max(Math.min(o,l,a.width),0),c=u(this._spec.text)&&""!==this._spec.text,d=u(this._spec.subtext)&&""!==this._spec.subtext,p=Object.assign(Object.assign({},j(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:c?this._spec.text:void 0,subtextType:null!==(e=this._spec.subtextType)&&void 0!==e?e:"text",subtext:d?this._spec.subtext:void 0,x:null!==(i=this._spec.x)&&void 0!==i?i:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:h,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(n=this._spec.align)&&void 0!==n?n:"left",verticalAlign:null!==(r=this._spec.verticalAlign)&&void 0!==r?r:"top",textStyle:Object.assign({maxLineWidth:h},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:h},this._spec.subtextStyle)});if(c&&(p.textStyle.width=h),d&&(p.subtextStyle.width=h),u(this._spec.width)){const t=Math.max(Math.min(o,a.width),0);c?p.textStyle.width=t:delete p.textStyle.width,d&&(p.subtextStyle.width=t)}return p}_createOrUpdateTitleComponent(t){if(this._titleComponent)N(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new IR(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}}nZ.type=n.title,nZ.specKey=n.title,nZ.builtInTheme={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"}}}};class rZ extends qq{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=gD.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=Uq(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=G(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={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:jq(xL(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>Fq(t,this._markerData,this._markAttributeContext))),state:{area:zq(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>zq(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return zq(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||G(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=Dq([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=G(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=G(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,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}=Uq(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}rZ.specKey="markArea";const aZ={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"}}}}};class oZ extends rZ{constructor(){super(...arguments),this.type=n.markArea,this.name=n.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new oR(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=Uq(i),d=u(i.positions),p=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=Bq(s,n,r,a,p,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=Bq(s,n,r,a,p,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=Rq(s,a,p,i.coordinatesOffset):d&&(f=Lq(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=Uq(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}}}oZ.type=n.markArea,oZ.coordinateType="cartesian",oZ.builtInTheme={markArea:aZ};class lZ extends rZ{constructor(){super(...arguments),this.type=n.polarMarkArea,this.name=n.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=Uq(this._spec);return i||e||s?new hR(t):new oR(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}=Uq(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=Pq(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=Oq(i,r,c),u={points:d.map((t=>le(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=Uq(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}}}lZ.type=n.polarMarkArea,lZ.coordinateType="polar",lZ.builtInTheme={polarMarkArea:aZ};const hZ=t=>xL(Object.assign({},t)),cZ=t=>Object.assign(Object.assign({},t),{style:Object.assign({},xL(t.style))}),dZ=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=hZ(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=hZ(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:{},xL(Object.assign({},y)));var y;const b=cZ(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=cZ(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=cZ(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),k=cZ(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),A=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:k})});return t.visible||(A.controller.visible=!1,A.slider.visible=!1),A},uZ=t=>"left"===t||"right"===t,pZ=t=>"top"===t||"bottom"===t,gZ={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:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,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:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class fZ extends kj{constructor(){super(...arguments),this.layoutZIndex=gD.Player,this.layoutLevel=fD.Player,this.specKey="player",this.type=n.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({},dZ(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({},dZ(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?N(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new qR(t):this._playerComponent=new QR(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(...G(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...G(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...G(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...G(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=uZ(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=uZ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...G(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...G(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...G(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...G(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.autoPlayCallback=()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.off(CL.rendered,this.autoPlayCallback),this._option.globalInstance.on(CL.rendered,this.autoPlayCallback),this._playerComponent.addEventListener(UR.end,(()=>{var t;this.event.emit(CL.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===(t=this._spec)||void 0===t?void 0:t.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(UR.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(UR.backward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(CL.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(UR.forward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(CL.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(UR.play,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(CL.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(UR.pause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(CL.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}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=uZ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=pZ(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}_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 x(this._spec.width)?Math.min(t.width,Number(this._spec.width)):uZ(this._orient)?this._maxSize():t.width}_computeHeight(t){return x(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):pZ(this._orient)?this._maxSize():t.height}_computeDx(t){return uZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return pZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(t){const e=this._specs[t];this._option.globalInstance.updateFullData(e.data),this.event.emit(CL.playerChange,{model:this,value:{spec:e,index:t,specs:this._specs}})}release(){this._option.globalInstance.off(CL.rendered,this.autoPlayCallback)}}fZ.builtInTheme={player:gZ},fZ.specKey="player",fZ.type=n.player;class mZ extends kj{constructor(t,e){super(t,e),this.type=n.label,this.name=n.label,this.layoutType="none",this.layoutZIndex=gD.Label,this._regions=e.getRegionsInIndex(e.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,N(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=RO({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:G(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==vD.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}))})),f(a.overlap)&&d(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}mZ.type=n.label;class vZ extends iW{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}render(){}}vZ.type="text",vZ.constructorType="label";const _Z=()=>{sW(),hI.registerMark(vZ.constructorType,vZ)};class yZ extends Sj{_initTheme(t,e){return{spec:t,theme:this._theme}}}class bZ extends mZ{constructor(t,e){super(t,e),this.type=n.label,this.name=n.label,this.specKey="label",this.transformerConstructor=yZ,this.layoutZIndex=gD.Label,this._layoutRule=t.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,r)=>{(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:n.label,specInfoPath:["component",this.specKey,r],regionIndexes:[r]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&(this._labelInfoMap.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(CL.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(wL.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(wL.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),_O(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{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&u(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(u(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{G(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((t=>{t.forEach((t=>{var e,i;const{labelMark:s,labelSpec:n,series:r}=t;if(this.initMarkStyleWithSpec(s,n),c(null==n?void 0:n.getStyleHandler)){const t=n.getStyleHandler(r);null==t||t.call(r,s,n)}(null===(i=null===(e=s.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&s.setAttribute("stroke",r.getColorAttribute(),"normal",mD.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,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=lI({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},xN(h,r),Object.assign(Object.assign(Object.assign({},j(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[ZI])):t=>t.filter((t=>t.data[qI]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?SN(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=_(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=G(i())[t])}))}return e}}bZ.type=n.label,bZ.specKey="label",bZ.transformerConstructor=yZ;class xZ extends mZ{constructor(){super(...arguments),this.type=n.totalLabel,this.name=n.totalLabel,this.specKey="totalLabel",this.layoutZIndex=gD.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 r;null===(r=t.seriesIndexes)||void 0===r||r.forEach((t=>{const{spec:r}=e.series[t],a=r[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:n.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()}reInit(t){super.reInit(t),this._initTextMark()}_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 t;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[$I]},"normal",mD.Default);const e=this._getSeries();null===(t=e.initTotalLabelMarkStyle)||void 0===t||t.call(e,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return lI({textStyle:{pickable:!0===this._spec.interactive},position:SZ(t,this._baseMark.type,a),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=>"bottom"===a?t.data[ZI]:t.data[qI]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>SN({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function SZ(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}xZ.type=n.totalLabel,xZ.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},xZ.specKey="totalLabel";class kZ extends qq{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=gD.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=Gq(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,k,A,M,w,T,C,B,E,P,R,O,I;const{itemContent:L={},itemLine:D={},targetSymbol:F={}}=this._spec,j=L,{type:H="text",text:V,symbol:N,image:W,richText:U,customMark:G,textStyle:Y,symbolStyle:X,imageStyle:$,richTextStyle:K,customMarkStyle:q,style:Z={},state:J={}}=j,Q=t(j,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let tt=null,et=null,it={};"text"===H?(tt=null!==(e=null==V?void 0:V.state)&&void 0!==e?e:J,it={dx:0,dy:0},et=Fq(Object.assign(Object.assign({},V),{style:z(it,null!==(n=null!==(s=null!==(i=null==V?void 0:V.style)&&void 0!==i?i:null==V?void 0:V.textStyle)&&void 0!==s?s:Y)&&void 0!==n?n:Z)}),this._markerData,this._markAttributeContext)):"richText"===H?(tt=null!==(r=null==U?void 0:U.state)&&void 0!==r?r:J,it={width:100,height:100},et=jq(z(it,null!==(o=null!==(a=null==U?void 0:U.style)&&void 0!==a?a:K)&&void 0!==o?o:Z),this._markerData,this._markAttributeContext)):"symbol"===H?(tt=null!==(l=null==N?void 0:N.state)&&void 0!==l?l:J,it={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},et=xL(jq(z(it,null!==(c=null!==(h=null==N?void 0:N.style)&&void 0!==h?h:X)&&void 0!==c?c:Z),this._markerData,this._markAttributeContext))):"image"===H?(tt=null!==(d=null==W?void 0:W.state)&&void 0!==d?d:J,it={width:80,height:80},et=jq(z(it,null!==(p=null!==(u=null==W?void 0:W.style)&&void 0!==u?u:$)&&void 0!==p?p:Z),this._markerData,this._markAttributeContext)):"custom"===H&&(tt=null!==(g=null==G?void 0:G.state)&&void 0!==g?g:J,et=jq(null!==(m=null!==(f=null==G?void 0:G.style)&&void 0!==f?f:q)&&void 0!==m?m:Z,this._markerData,this._markAttributeContext));const st={zIndex:this.layoutZIndex,interactive:null===(v=this._spec.interactive)||void 0===v||v,hover:null===(_=this._spec.interactive)||void 0===_||_,select:null===(y=this._spec.interactive)||void 0===y||y,position:{x:0,y:0},clipInRange:null!==(b=this._spec.clip)&&void 0!==b&&b,itemContent:Object.assign(Object.assign({type:H,offsetX:Hq(L.offsetX,this._relativeSeries.getRegion()),offsetY:Hq(L.offsetX,this._relativeSeries.getRegion())},Q),{style:jq(et,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(x=F.offset)&&void 0!==x?x:0,visible:null!==(S=F.visible)&&void 0!==S&&S,size:null!==(k=F.size)&&void 0!==k?k:20,style:jq(F.style,this._markerData,this._markAttributeContext)},state:{line:zq(null!==(M=null===(A=this._spec.itemLine.line)||void 0===A?void 0:A.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),lineStartSymbol:zq(null!==(T=null===(w=this._spec.itemLine.startSymbol)||void 0===w?void 0:w.state)&&void 0!==T?T:{},this._markerData,this._markAttributeContext),lineEndSymbol:zq(null!==(B=null===(C=this._spec.itemLine.endSymbol)||void 0===C?void 0:C.state)&&void 0!==B?B:{},this._markerData,this._markAttributeContext),itemContent:zq(tt,this._markerData,this._markAttributeContext),textBackground:zq(null===(P=null===(E=this._spec.itemContent.text)||void 0===E?void 0:E.labelBackground)||void 0===P?void 0:P.state,this._markerData,this._markAttributeContext),targetItem:zq(null!==(O=null===(R=this._spec.targetSymbol)||void 0===R?void 0:R.state)&&void 0!==O?O:{},this._markerData,this._markAttributeContext)},animation:null!==(I=this._spec.animation)&&void 0!==I&&I,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:nt,line:rt={}}=D,at=t(D,["visible","line"]);st.itemLine=!1!==nt?Object.assign(Object.assign({},at),{visible:!0,lineStyle:xL(rt.style)}):{visible:!1};return new dR(st)}_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}=Dq([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:Vq(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:Vq(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}=Gq(t);(u(t.coordinate)||e||i||s)&&this._initCommonDataView()}}kZ.specKey="markPoint";const AZ={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}};class MZ extends kZ{constructor(){super(...arguments),this.type=n.markPoint,this.name=n.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=u(s.x)&&u(s.y),o=u(s.coordinate),l=u(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=Bq(n,r,r,r,h))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=Rq(n,r,h,s.coordinatesOffset)[0]:l&&(c=Lq(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=Gq(t),i=u(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}}}MZ.type=n.markPoint,MZ.coordinateType="cartesian",MZ.builtInTheme={markPoint:AZ};class wZ extends kZ{constructor(){super(...arguments),this.type=n.polarMarkPoint,this.name=n.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=Pq(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:le({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}])]}}}wZ.type=n.polarMarkPoint,wZ.coordinateType="polar",wZ.builtInTheme={polarMarkPoint:AZ};class TZ extends kZ{constructor(){super(...arguments),this.type=n.geoMarkPoint,this.name=n.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=>{u(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}])]}}}TZ.type=n.geoMarkPoint,TZ.coordinateType="geo",TZ.builtInTheme={geoMarkPoint:AZ};const CZ="inBrush",BZ="outOfBrush";class EZ extends kj{constructor(){super(...arguments),this.layoutType="none",this.type=n.brush,this.name=n.brush,this.specKey="brush",this.layoutZIndex=gD.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return CF(t,this.specKey,this.type,(t=>!1!==t.visible))}init(){const t=this._transformBrushedMarkAttr(this._spec.inBrush),e=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((i=>{i.getActiveMarks().forEach((s=>{s&&(i.setMarkStyle(s,Object.assign({},t),CZ,mD.Series),i.setMarkStyle(s,Object.assign({},e),BZ,mD.Series))}))}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&G(t).includes(n.userId.toString())||e&&G(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()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){u(this._spec.regionId)||u(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(G(this._spec.regionId),G(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_bindLinkedSeries(){(u(this._spec.brushLinkSeriesId)||u(this._spec.brushLinkSeriesIndex))&&(this._linkedSeries=this._option.getSeriesInUserIdOrIndex(G(this._spec.brushLinkSeriesId),G(this._spec.brushLinkSeriesIndex)))}_initRegionAxisMap(){u(this._spec.axisId)?G(this._spec.axisId).forEach((t=>{this._releatedAxes.push(this._option.getComponentByUserId(t))})):u(this._spec.axisIndex)?G(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)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return N(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild()}_shouldEnableInteractive(){return!1!==this.getOption().getCompiler().getOption().interactive}_createBrushComponent(t,e){var i,s;const n=this._getBrushInteractiveAttr(t),r=new sO(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:xL(null===(i=this._spec)||void 0===i?void 0:i.style)},n),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));r.id=null!==(s=this._spec.id)&&void 0!==s?s:`brush-${this.id}`,this.getContainer().add(r),this._brushComponents.push(r),this._cacheInteractiveRangeAttrs.push(n),r.addEventListener(ZR.brushActive,(i=>{this._initMarkBrushState(e,BZ),this._emitEvent(CL.brushActive,t,i)})),r.addEventListener(ZR.drawStart,(e=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(t,!0),this._emitEvent(CL.brushStart,t,e)})),r.addEventListener(ZR.moveStart,(e=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(t,!0),this._emitEvent(CL.brushStart,t,e)})),r.addEventListener(ZR.drawing,(e=>{this._setRegionMarkPickable(t,!1),this._handleBrushChange(t,e),this._emitEvent(CL.brushChange,t,e)})),r.addEventListener(ZR.moving,(e=>{this._setRegionMarkPickable(t,!1),this._handleBrushChange(t,e),this._emitEvent(CL.brushChange,t,e)})),r.addEventListener(ZR.brushClear,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(t,!0),this._initMarkBrushState(e,""),this._emitEvent(CL.brushClear,t,i)})),r.addEventListener(ZR.drawEnd,(i=>{var s;this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(t,!0);const{operateMask:n}=i.detail,{updateElementsState:r=!0}=this._spec;if(null===(s=this._spec)||void 0===s?void 0:s.onBrushEnd)!0===this._spec.onBrushEnd(i)?(this.clearGraphic(),this._initMarkBrushState(e,""),this._emitEvent(CL.brushClear,t,i)):(this._spec.onBrushEnd(i),this._emitEvent(CL.brushEnd,t,i));else{const e=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&e.length>0||!r)&&this._setAxisAndDataZoom(n,t),this._emitEvent(CL.brushEnd,t,i)}})),r.addEventListener(ZR.moveEnd,(e=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(t,!0);const{operateMask:i}=e.detail,{updateElementsState:s=!0}=this._spec,n=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&n.length>0||s)&&this._setAxisAndDataZoom(i,t),this._emitEvent(CL.brushEnd,t,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],interactive:this._shouldEnableInteractive()}}_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({},xL(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail;this._operateMask=i;const{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e,i){var s;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},vchart:null===(s=this._option)||void 0===s?void 0:s.globalInstance,event:i})}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(i.addState(CZ,!0),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(i.removeState(CZ),i.addState(BZ,!0),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:_=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(_.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(i.addState(CZ,!0),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(i.removeState(CZ),i.addState(BZ,!0),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Be(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;s.removeState(CZ),s.removeState(BZ),i&&s.addState(i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_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,g=t.getScale().range(),f=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],m=Y(g){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}clearBrushStateAndMask(){this._relativeRegions.forEach(((t,e)=>{this._initMarkBrushState(e,""),this._brushComponents[e].children[0].removeAllChild()}))}}EZ.type=n.brush,EZ.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},EZ.specKey="brush";class PZ extends kj{constructor(){super(...arguments),this.type=n.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=gD.CustomMark,this.layoutLevel=fD.CustomMark}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;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${OI}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:u(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(u(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=nz({},rz(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(d(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)}))),u(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return N(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,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 je).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new je;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),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}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}PZ.type=n.customMark,PZ.specKey="customMark";class RZ{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}:c(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){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=>{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&&u(e.modelId)){if(u(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&u(e.modelKey)&&"modelIndex"in e&&u(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=>OZ(t))),a=n.filter((t=>!OZ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>OZ(t))),h=o.filter((t=>!OZ(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 OZ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}RZ.type="grid";const IZ="vchart-tooltip",LZ=`${IZ}-container`,DZ=`${IZ}-title`,FZ=`${IZ}-content-box`,zZ={offsetX:10,offsetY:10},jZ="99999999999999";function HZ(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const VZ=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,NZ=t=>v(t)&&""!==(null==t?void 0:t.trim())||x(t)?HZ(t):"",WZ=(t,e)=>{let i;if(u(t))if(x(t))i=t;else if(c(t)){const s=t(e);x(s)&&(i=s)}return i},UZ={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},GZ=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=UZ[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class YZ extends Zz{constructor(){super(...arguments),this._visible=!0,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._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,d,g;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const _=e.event,{activeType:y,data:b}=t,S="dimension"===y?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:M}=this._option,w=m[y],T=OF(null==w?void 0:w.position,b,e),C=null!==(r=OF(null==w?void 0:w.positionMode,b,e))&&void 0!==r?r:"mark"===y?"mark":"pointer",{width:B=0,height:E=0}=null!=i?i:{},P="canvas"===m.renderMode,R=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),O=null!==(o=null==R?void 0:R.width)&&void 0!==o?o:II,I=null!==(l=null==R?void 0:R.height)&&void 0!==l?l:LI;let L=!1;const D={width:0,height:0};let F,z={x:0,y:0},j={x:0,y:0},H=1,V=1;const N=Uy(this._env);if(N&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=O,D.height=I),N&&!P){const t=this._getParentElement(m);j=null!==(d=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==d?d:v;const e=null!==(g=this._compiler.getCanvas())&&void 0!==g?g:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-j.x,y:F.y-j.y},H=VZ(e,F),V=VZ(t,j)}const W=V/H,U={},G={x:T,y:T},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?A:M;if("mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==S?void 0:S.series)||void 0===r?void 0:r.coordinate)&&S.datum&&S.datum.length){L=!0;const t=f(S,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(L){const e=Y[n][0],i="x"===n?B:E;switch(GZ(t,n)){case-2:U[e]=a-i*W-c;break;case-1.5:U[e]=a+c;break;case 0:U[e]=(a+o)/2-i*W/2;break;case-1:U[e]=(a+o)/2-i*W-c;break;case 1:U[e]=(a+o)/2+c;break;case 1.5:U[e]=o-i*W-c;break;case 2:U[e]=o+c}}},$=["x","y"];if(p(T))if(p(K=T)&&(u(K.left)||u(K.right)||u(K.top)||u(K.bottom))){const{left:t,right:e,top:i,bottom:s}=T;U.left=WZ(t,_),U.top=WZ(i,_),U.right=WZ(e,_),U.bottom=WZ(s,_)}else(t=>p(t)&&(u(t.x)||u(t.y)))(T)&&$.forEach((t=>{const e=T[t];x(e)||c(e)?U[Y[t][0]]=WZ(e,_):X(e,t)}));else u(T)&&(X({orient:T,mode:C},"x"),X({orient:T,mode:C},"y"));var K;const q={x:null,y:null};return $.forEach((t=>{var e;const i="x"===t?B:E,s="x"===t?O:I,n="x"===t?A:M,r=GZ(G[t],t);if(k(U[Y[t][0]]))q[t]=U[Y[t][0]];else if(k(U[Y[t][1]]))q[t]=s-i*W-U[Y[t][1]];else{const e="x"===t?_.canvasX:_.canvasY;q[t]=r>0?e+n:0===r?e-i*W/2:e-i*W-n}q[t]*=H,N&&(q[t]+=z[t]),q[t]/=V;const a="x"===t?D.width:D.height,o=m.confine?-(j[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/H)/V:-j[t]/V,l=a/V+o-i;2!==r&&q[t]l&&(q[t]=l)):-2!==r&&q[t]>l&&(L?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]u(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",$Z=(t={},e={})=>{var i,s;u(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return u(n)&&(e.color=n),u(t.fontWeight)&&(e.fontWeight=t.fontWeight),u(t.textAlign)&&(e.textAlign=t.textAlign),u(t.fontSize)&&(e.fontSize=XZ(t.fontSize)),u(t.maxWidth)&&(e.maxWidth=XZ(t.maxWidth)),t.multiLine||u(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},KZ=(t={})=>{const{lineHeight:e}=t;return t.fontSize?YO(e,t.fontSize):0},qZ=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return u(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),u(r)&&(o=ni(r),a.padding=XZ(o)),{panelStyle:a,panelPadding:o}};function ZZ(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}const JZ=t=>{hI.registerComponentPlugin(t.type,t)};class QZ extends YZ{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(QZ.type),this.type=XH.dom,this._tooltipContainer=null==Wy?void 0:Wy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(Wy&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:u,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=qZ(l),_={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(_.marginBottom=`${g}px`);const y={width:XZ(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=$Z(h),x=$Z(u),S=$Z(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),d(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),d(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),d(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),y[A]=XZ(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=XZ(null!==(s=u.spacing)&&void 0!==s?s:26),S[A]=XZ(null!==(n=p.spacing)&&void 0!==n?n:0);const M=Math.max(KZ(p),KZ(u));return _.lineHeight=M>0?`${M}px`:"20px",{panelPadding:v,row:_,panel:m,title:b,shape:y,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(DZ))),l=a.find((t=>t.className.includes(FZ)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(DZ),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(ZZ(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${IZ}-column`),e.classList.add(`${IZ}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(FZ),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];ZZ(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));ZZ(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${IZ}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=NZ(e.key),e.keyStyle&&$Z(e.keyStyle,l)):"value"===i?(o.innerHTML=NZ(e.value),e.valueStyle&&$Z(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,g=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?HZ(t.shapeLineWidth)+"px":"0px";let m="currentColor";const _=()=>c?HZ(c):m,y=g,b=t=>new wg({symbolType:t,size:y,fill:!0});let x=b(h);const S=x.getParsedPath();let k,A;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;A=t.toString(),k=t.bounds}else S.isSvg&&S.svgCache&&(A=S.svgCache.map((t=>t.path.toString())).join(),k=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new je));let M=`${k.x1} ${k.y1} ${k.width()} ${k.height()}`;if("0px"!==f){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const w=fh.IsGradientStr(u);if(!u||v(u)&&!w||d)return m=d?"none":u?HZ(u):"currentColor",`\n \n \n \n `;const T=w?fh.Parse(u):p(u)?u:null;if(T){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=T.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===T.gradient?t=`\n ${i}\n `:"linear"===T.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),ZZ(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(FZ))),h=[...o.children].find((t=>t.className.includes(DZ)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(u(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(DZ)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=YO(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,ZZ(l,c))}const p=l.children,g=[];if(p){for(let i=0;i{JZ(QZ)},eJ={fontFamily:eI.fontFamily,spacing:10,wordBreak:"break-word"},iJ=(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},pf||(pf=df.CreateGraphic("richtext",{})),pf.setAttributes(a),pf.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function sJ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:eJ),{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:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:u(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const nJ=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 u(a)&&(r.cornerRadius=[a,a,a,a]),r};class rJ extends YZ{constructor(){super(rJ.type),this.type=XH.canvas,this._attributes=null}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 lO({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}_getTooltipBoxSize(t,e){var i,s;if(!e||d(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:p,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:_}=l,y=ni(d.padding),b=KO(d.padding),x=sJ(Object.assign({textAlign:"right"===_?"right":"left"},p),i),S=sJ(Object.assign({textAlign:"right"===_?"right":"left"},f),i),k=sJ(m,i),A={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:nJ(d),padding:y,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:A,key:S,value:k,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:_},{title:w={},content:T=[]}=t;let C=b.left+b.right,B=b.top+b.bottom,E=0;const P=!!T.length;let R=0,O=0,I=0,L=0;if(P){const t=[],e=[],i=[],s=[];let n=0;M.content=T.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:p,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:M}=r,w={height:0,spaceRow:null!=y?y:v};if(u(h)){const i=lI({},S,sJ(b,void 0,{})),{width:s,height:n,text:r}=iJ(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(u(m)){const t=lI({},k,sJ(x,void 0,{})),{width:e,height:s,text:n}=iJ(m,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};M?t.stroke=d:t.fill=d,t.stroke=null!=p?p:d,t.lineWidth=g,w.shape=t;const e=null!=f?f:A.size;o=Math.max(e,o),s.push(e)}else w.shape={visible:!1};return w.height=o,n+=o,aW.autoWidth&&!1!==W.multiLine;if(j){W=lI({},x,sJ(V,void 0,{})),U()&&(W.multiLine=null===(r=W.multiLine)||void 0===r||r,W.maxWidth=null!==(a=W.maxWidth)&&void 0!==a?a:P?Math.ceil(E):void 0);const{text:t,width:e,height:i}=iJ(H,W);M.title.value=Object.assign(Object.assign({width:U()?Math.min(e,null!==(o=W.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},W),{text:t}),D=M.title.value.width,F=M.title.value.height,z=F+(P?M.title.spaceRow:0)}return B+=z,M.title.width=D,M.title.height=F,U()?C+=E||D:C+=Math.max(D,E),P&&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-L-R-S.spacing-k.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),M.valueWidth=Math.max(M.valueWidth,i.width))})),M.panel.width=C,M.panel.height=B,M})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_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{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?u(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()}}rJ.type=XH.canvas;const aJ=()=>{JZ(rJ)},oJ=(t="chart",e,i)=>{var s,r,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===(s=e.region)||void 0===s||s.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["region",e],type:"region"})}));else if("series"===t)f.modelType="series",f.specKey="series",null===(r=e.series)||void 0===r||r.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["series",e],type:t.type})}));else if(Object.values(AO).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(n).includes(t)){f.modelType="component",f.type=t,f.specKey=null===(o=hI.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:s}=f,n=G(null!==(h=null===(l=i.component)||void 0===l?void 0:l[s])&&void 0!==h?h:[]);null===(d=G(null!==(c=e[s])&&void 0!==c?c:[]))||void 0===d||d.forEach(((e,i)=>{const s=n[i];s&&s.type===t?f.modelInfo.push(Object.assign(Object.assign({},s),{spec:e})):e&&!1===e.visible&&f.modelInfo.push({type:t,spec:e})}))}else{const s=hI.getComponents().filter((({cmp:e})=>e.specKey===t)).map((({cmp:t})=>t.type));if(s.length>0){f.modelType="component";const n=t;f.specKey=n;const r=G(null!==(p=null===(u=i.component)||void 0===u?void 0:u[n])&&void 0!==p?p:[]);G(null!==(g=e[n])&&void 0!==g?g:[]).forEach(((t,e)=>{const i=r[e];i&&s.includes(i.type)&&f.modelInfo.push(Object.assign(Object.assign({},i),{spec:t}))}))}}return f},lJ=(t,e,i,s)=>{const{spec:n,filter:r,filterType:a,forceAppend:o}=t,{isChart:l,modelType:h,specKey:u,type:p,modelInfo:g}=((t="chart",e,i,s,n,r)=>{const a=oJ(t,n,r);return Object.assign(Object.assign({},a),{modelInfo:a.modelInfo.filter((t=>!!d(e)||G(e).some((e=>c(e)?e(t,i,s):nI(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const f=lI({},i),m=c(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:lI(f,m),hasChanged:!0};const i=lI({},t,m);rI(f,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},m);_(f[u])?f[u].push(t):d(f[u])?f[u]="component"===h?t:[t]:f[u]=[f[u],t]}return{chartSpec:f,hasChanged:!0}},hJ=t=>{hI.registerChartPlugin(t.type,t)};class cJ extends Zz{constructor(){super(cJ.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[cJ.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[cJ.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)}onAfterModelSpecTransform(t,e,i,s){this._initialized&&"updateSpec"===s&&this.onBeforeInitChart(t,e,"setCurrentTheme")}onBeforeInitChart(t,e,i){if(!this._initialized)return;let s,n;switch(i){case"render":case"updateModelSpec":s=!1,n=!0;break;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=oI(this._option.globalInstance.getSpec(),["data",cJ.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=oI(this._baseChartSpec,["data",cJ.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(u(t.maxHeight)&&e.height>t.maxHeight)return!1;break;case"minHeight":if(u(t.minHeight)&&e.heightt.maxWidth)return!1;break;case"minWidth":if(u(t.minWidth)&&e.width{const n=lJ(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=oI(i,["data",cJ.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()}}cJ.pluginType="chart",cJ.specKey="media",cJ.type="MediaQueryPlugin";const dJ=()=>{hJ(cJ)},uJ=/\{([^}]+)\}/,pJ=/\{([^}]+)\}/g,gJ=/:/;class fJ extends Zz{constructor(){super(fJ.type),this.type="formatterPlugin",this._timeModeFormat={utc:gi.getInstance().timeUTCFormat,local:gi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Si.getInstance().format,this._numericSpecifier=Si.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[fJ.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;c(r)?this._formatter=r:(this._formatter=this._format.bind(this),c(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),hI.registerFormatter(this._formatter)}_format(t,e,i){return _(t)?t.map(((t,s)=>{const n=_(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):_(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=uJ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(pJ,((t,i)=>{if(!gJ.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(yi.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):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}fJ.pluginType="chart",fJ.specKey="formatter",fJ.type="formatterPlugin";const mJ=()=>{hJ(fJ)};class vJ extends Zz{constructor(){super(vJ.type),this.type="ChartResizeZoomPlugin",this._zoom=1,this._onWheel=t=>{t.preventDefault(),t.stopImmediatePropagation();const e=Math.pow(1.005,-t.deltaY*Math.pow(16,t.deltaMode)*.2*this._rate),i={x:t.offsetX,y:t.offsetY};this.zoom(e,i)}}onAfterInitChart(t,e){var i,s,n,r,a;const o=t.globalInstance,l=null!==(s=null===(i=o.getSpec())||void 0===i?void 0:i[vJ.specKey])&&void 0!==s?s:{enabled:!1};!0===l.enabled&&(this._minZoom=null!==(n=l.min)&&void 0!==n?n:.1,this._maxZoom=null!==(r=l.max)&&void 0!==r?r:10,this._rate=null!==(a=l.rate)&&void 0!==a?a:.1,this._container=o.getContainer(),this._triggerEvent=ZV(t.globalInstance.getChart().getOption().mode).zoom,this._container&&this._triggerEvent&&this._container.addEventListener(this._triggerEvent,this._onWheel))}zoom(t,e){const i=this.service.globalInstance;if(!i)return;const s=this._zoom;let n=this._zoom*t;if(n<=this._minZoom&&t<1||n>=this._maxZoom&&t>1)if(n<=this._minZoom&&this._zoom>this._minZoom)n=this._minZoom;else{if(!(n>=this._maxZoom&&this._zoom{hJ(vJ)};xF.useRegisters([()=>{ST(),uT.registerBuiltInAnimate("scaleIn",wC),uT.registerBuiltInAnimate("scaleOut",TC),uT.registerBuiltInAnimate("fadeIn",JT),uT.registerBuiltInAnimate("fadeOut",QT),uT.registerBuiltInAnimate("moveIn",PC),uT.registerBuiltInAnimate("moveOut",RC),uT.registerBuiltInAnimate("rotateIn",IC),uT.registerBuiltInAnimate("rotateOut",LC),uT.registerBuiltInAnimate("update",BC),uT.registerBuiltInAnimate("state",CC),uT.registerBuiltInAnimate("fromTo",DC),uT.registerBuiltInAnimate(sD,sF)},()=>{JH(),tV(),iV(),BH(),CH(),pH(),nH(),Hz(),Nz(),cF(),oF(),Zj(),Xj(),hI.registerSeries(gH.type,gH),hI.registerChart(sV.type,sV)},()=>{JH(),tV(),iV(),CH(),pH(),nH(),Hz(),aV(),Nz(),hV(),Zj(),Xj(),hI.registerSeries(dV.type,dV),BH(),hI.registerChart(pV.type,pV)},()=>{JH(),tV(),iV(),CH(),TV(),BH(),hI.registerChart(BV.type,BV)},()=>{JH(),tV(),BH(),CH(),jV(),hI.registerChart(VV.type,VV)},()=>{tV(),DW(),hI.registerChart(E$.type,E$)},()=>{JH(),tV(),BH(),CH(),tU(),hI.registerChart(O$.type,O$)},()=>{JH(),tV(),iV(),BH(),CH(),hU(),hI.registerChart(L$.type,L$)},()=>{JH(),tV(),iV(),BH(),CH(),TV(),hI.registerTransform("bin",Xr),hI.registerChart(V$.type,V$)},()=>{tV(),iN(),YV(),hI.registerSeries(nN.type,nN),hI.registerImplement("registerMap",HL),hI.registerImplement("unregisterMap",VL),lF(),hI.registerChart(A$.type,A$)},()=>{tV(),NX(),hI.registerSeries(UX.type,UX),EW(),AU(),qW(),TU(),hI.registerChart(G$.type,G$)},()=>{tV(),fY(),hI.registerChart($$.type,$$)},()=>{tV(),LY(),hI.registerChart(q$.type,q$)},()=>{JH(),tV(),iV(),BH(),CH(),ON(),hI.registerChart(lK.type,lK)},()=>{JH(),tV(),BH(),CH(),eW(),hI.registerTransform("boxplot",$r),hI.registerChart(cK.type,cK)},()=>{JH(),tV(),BH(),CH(),TU(),hI.registerChart(W$.type,W$)},()=>{JH(),tV(),BH(),CH(),IU(),hI.registerChart(J$.type,J$)},()=>{JH(),tV(),BH(),CH(),uW(),hI.registerChart(tK.type,tK)},()=>{JH(),tV(),iV(),BH(),CH(),aV(),Zj(),Xj(),hI.registerSeries(vW.type,vW),hI.registerChart(gK.type,gK)},()=>{tV(),QY(),hI.registerChart(iK.type,iK)},()=>{tV(),rX(),hI.registerChart(nK.type,nK)},()=>{tV(),RX(),hI.registerChart(aK.type,aK)},()=>{tV(),yo.load(fM),AX(),hI.registerChart(uK.type,uK)},()=>{tV(),ZX(),hI.registerChart(mK.type,mK)},()=>{tV(),c$(),hI.registerChart(_K.type,_K)},()=>{JH(),tV(),iV(),BH(),hI.registerChart(F$.type,F$),CH()},Xj,Zj,()=>{hI.registerGraphicComponent(Aj.lineAxis,((t,e)=>new NC(t,e))),hI.registerGraphicComponent(Mj.lineAxisGrid,((t,e)=>new JE(t,e))),Ej(),hI.registerComponent(Jj.type,Jj)},()=>{hI.registerGraphicComponent(Aj.lineAxis,((t,e)=>new NC(t,e))),hI.registerGraphicComponent(Mj.lineAxisGrid,((t,e)=>new JE(t,e))),Ej(),hI.registerComponent(Qj.type,Qj)},()=>{hI.registerGraphicComponent(Aj.lineAxis,((t,e)=>new NC(t,e))),hI.registerGraphicComponent(Mj.lineAxisGrid,((t,e)=>new JE(t,e))),Ej(),hI.registerComponent(tH.type,tH)},JW,qW,()=>{hI.registerComponent(kK.type,kK)},()=>{hI.registerComponent(LK.type,LK)},()=>{hI.registerComponent(GK.type,GK)},()=>{hI.registerComponent(ZK.type,ZK)},()=>{hI.registerComponent(JK.type,JK)},()=>{hI.registerComponent(pq.type,pq)},()=>{hI.registerComponent(fq.type,fq)},()=>{hI.registerComponent(yq.type,yq)},iN,()=>{hI.registerComponent(iZ.type,iZ),nR()},()=>{hI.registerComponent(oZ.type,oZ),aR()},()=>{hI.registerComponent(MZ.type,MZ),cR()},()=>{hI.registerComponent(sZ.type,sZ),lR._animate=jP,nR()},()=>{hI.registerComponent(lZ.type,lZ),hR._animate=VP,aR()},()=>{hI.registerComponent(wZ.type,wZ),cR()},()=>{hI.registerComponent(TZ.type,TZ),cR()},()=>{hI.registerComponent(nZ.type,nZ)},()=>{hI.registerComponent(fZ.type,fZ)},()=>{hI.registerGraphicComponent(bZ.type,(t=>new $E(t))),_Z(),Tj(),hI.registerComponent(bZ.type,bZ,!0,1/0)},()=>{hI.registerGraphicComponent(xZ.type,(t=>new $E(t))),_Z(),Tj(),hI.registerComponent(xZ.type,xZ,!0)},()=>{hI.registerComponent(EZ.type,EZ)},()=>{hI.registerComponent(PZ.type,PZ)},()=>{yo.load(nw)},()=>{hI.registerLayout(RZ.type,RZ)},aJ,mF,yF]),xF.useRegisters([()=>{rk(yo)}]);export{mD as AttributeLevel,Jz as AxisSyncPlugin,rJ as CanvasTooltipHandler,CL as ChartEvent,vJ as ChartResizeZoomPlugin,LI as DEFAULT_CHART_HEIGHT,II as DEFAULT_CHART_WIDTH,AF as DEFAULT_CLOSE_STROKE_JOIN,FI as DEFAULT_DATA_INDEX,zI as DEFAULT_DATA_KEY,jI as DEFAULT_DATA_SERIES_FIELD,nL as DEFAULT_KEY,uD as DEFAULT_LAYOUT_RECT_LEVEL,pD as DEFAULT_LAYOUT_RECT_LEVEL_MIN,kF as DEFAULT_LINEAR_INTERPOLATE,rL as DEFAULT_MAP_LOOK_UP_KEY,DI as DEFAULT_MEASURE_CANVAS_ID,HI as DEFAULT_SERIES_STYLE_NAME,SF as DEFAULT_SMOOTH_INTERPOLATE,oT as DefaultTicker,MF as Direction,QZ as DomTooltipHandler,hI as Factory,fJ as FormatterPlugin,fD as LayoutLevel,gD as LayoutZIndex,eL as MOSAIC_CAT_END_PERCENT,tL as MOSAIC_CAT_START_PERCENT,QI as MOSAIC_VALUE_END_PERCENT,JI as MOSAIC_VALUE_START_PERCENT,hT as ManualTicker,cJ as MediaQuery,OI as PREFIX,s as RenderModeEnum,sL as SEGMENT_FIELD_END,iL as SEGMENT_FIELD_START,WI as STACK_FIELD_END,XI as STACK_FIELD_END_OffsetSilhouette,GI as STACK_FIELD_END_PERCENT,VI as STACK_FIELD_KEY,NI as STACK_FIELD_START,YI as STACK_FIELD_START_OffsetSilhouette,UI as STACK_FIELD_START_PERCENT,$I as STACK_FIELD_TOTAL,ZI as STACK_FIELD_TOTAL_BOTTOM,KI as STACK_FIELD_TOTAL_PERCENT,qI as STACK_FIELD_TOTAL_TOP,_D as STATE_VALUE_ENUM,FC as StreamLight,MI as ThemeManager,XL as TransformLevel,dD as USER_LAYOUT_RECT_LEVEL,xF as VChart,$O as boundsInRect,gI as builtinThemes,YO as calcLayoutNumber,XO as calcPadding,EO as computeActualDataScheme,qO as convertPoint,rf as createArc,ef as createArea,Pp as createGroup,Eg as createLine,Ig as createRect,Kg as createRichText,Tg as createSymbol,Ag as createText,sI as darkTheme,JO as dataScheme,xF as default,fI as defaultThemeName,RO as getActualColor,ZO as getActualNumValue,DO as getColorSchemeBySeries,BO as getDataScheme,uI as getFunnelTheme,kI as getMergedTheme,CF as getSpecInfo,bI as getTheme,_I as hasThemeMerged,OO as isColorKey,UO as isPercent,GO as isPercentOffset,IO as isProgressiveDataColorScheme,tI as isTokenKey,WO as isValidOrient,iI as lightTheme,BF as lookup,RI as measureText,KO as normalizeLayoutPaddingSpec,PO as queryColorFromColorScheme,QO as queryToken,aJ as registerCanvasTooltipHandler,hJ as registerChartPlugin,_J as registerChartResizeZoomPlugin,DL as registerDataSetInstanceParser,LL as registerDataSetInstanceTransform,tJ as registerDomTooltipHandler,mJ as registerFormatPlugin,dJ as registerMediaQuery,yI as registerTheme,xI as removeTheme,SI as themeExist,mI as themes,eI as token,LO as transformColorSchemeToStandardStruct,xL as transformToGraphic,EF as version,S_ as vglobal,jy as warn}; diff --git a/packages/lark-vchart/package.json b/packages/lark-vchart/package.json index 730004a22a..0d1144409a 100644 --- a/packages/lark-vchart/package.json +++ b/packages/lark-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/lark-vchart", - "version": "2.0.19", + "version": "2.0.20", "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 492024f1bf..5489fc0c3e 100644 --- a/packages/lark-vchart/src/vchart/index.js +++ b/packages/lark-vchart/src/vchart/index.js @@ -12,7 +12,7 @@ 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.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=(t,e=!1)=>e?"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 _=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||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=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||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 B=Object.prototype.hasOwnProperty;function P(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(B.call(t,e))return!1;return!0}var L=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&R.call(t,e);function I(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=y(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||_(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=I(r,e,i)}return s}function D(t,e,i=!1,s=!1){if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&y(t[a])?z(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(y(a)){if(s)o=[];else if(y(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(_(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function N(t){return Object.prototype.toString.call(t)}function V(t){return Object.keys(t)}function U(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(N(t)!==N(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(y(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!U(t[s],e[s],i))return!1;return!0}if(!m(t))return!1;const s=V(t),n=V(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!U(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;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},K=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;ne?1:t>=e?0:NaN}function it(t){return Number(t)}function st(t,e,i=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)}const nt="undefined"!=typeof console;function rt(t,e,i){const s=[e].concat([].slice.call(i));nt&&console[t].apply(console,s)}var at;!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"}(at||(at={}));class ot{static getInstance(t,e){return ot._instance&&S(t)?ot._instance.level(t):ot._instance||(ot._instance=new ot(t,e)),ot._instance}static setInstance(t){return ot._instance=t}static setInstanceLevel(t){ot._instance?ot._instance.level(t):ot._instance=new ot(t)}static clearInstance(){ot._instance=null}constructor(t=at.None,e){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(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=at.Info}canLogDebug(){return this._level>=at.Debug}canLogError(){return this._level>=at.Error}canLogWarn(){return this._level>=at.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=at.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):rt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=at.Warn&&rt(this._method||"warn","WARN",t),this}info(...t){return this._level>=at.Info&&rt(this._method||"log","INFO",t),this}debug(...t){return this._level>=at.Debug&&rt(this._method||"log","DEBUG",t),this}}function lt(t,e,i=0,s){for(u(s)&&(s=t.length);i>>1;et(t[n],e)>0?s=n:i=n+1}return i}ot._instance=null;const ht=(t,e)=>ct(0,t.length,(i=>e(t[i]))),ct=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},dt=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(et)),st(i,.5)},ut=1e-10,pt=1e-10;function gt(t,e,i=pt,s=ut){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function ft(t,e,i,s){return t>e&&!gt(t,e,i,s)}function mt(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var _t=function(t,e,i){return ti?i:t};var yt=(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 bt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let xt=!1;try{xt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){xt=!1}function St(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&xt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=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 _(){const t=Date.now();if(v(t))return y(t);o=m(_,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?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(_,e),c?f(t):a}(l);if(d)return o=m(_,e),f(l)}return void 0===o&&(o=m(_,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:y(Date.now())},b.pending=function(){return void 0!==o},b}function At(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),St(t,e,{leading:s,trailing:n,maxWait:e})}function kt(t,e){return i=>t*(1-i)+e*i}function Mt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Tt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function wt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}xt=!1;const Ct=4294967296;const Et=t=>e=>L(e,t),Bt=(t,e={})=>{if(d(t))return t;const i=[t];return(e&&e.get||Et)(i)},Pt=(t,e={})=>{if(y(t)){const i=t.map((t=>Bt(t,e)));return t=>i.map((e=>e(t)))}return Bt(t,e)},Lt=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t,Rt=t=>0,Ot=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function Dt(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Ft(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!u(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:d,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)d+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!u(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!u(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:d,b:p},predict:g,rSquared:Dt(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=It(f.min,f);for(let r=0;r=1?Ht:t<=-1?-Ht:Math.asin(t)}function Jt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Qt(t,e){return t[0]*e[1]-t[1]*e[0]}function te(t,e){let i=0;for(let s=0;s0?i:0}function se(t,e){return ee(t+e,10**Math.max(ie(t),ie(e)))}function ne(t,e){return ee(t-e,10**Math.max(ie(t),ie(e)))}class re{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new re(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 ae{static distancePP(t,e){return Kt(qt(t.x-e.x,2)+qt(t.y-e.y,2))}static distanceNN(t,e,i,s){return Kt(qt(t-i,2)+qt(e-s,2))}static distancePN(t,e,i){return Kt(qt(e-t.x,2)+qt(i-t.y,2))}static pointAtPP(t,e,i){return new re((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function oe(t){return t*(Math.PI/180)}function le(t){return 180*t/Math.PI}const he=(t=0)=>{if(t<0)for(;t<-Nt;)t+=Nt;else if(t>0)for(;t>Nt;)t-=Nt;return t};function ce(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 de(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function ue(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function pe(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ge(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=pe(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)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function fe(t){return(t=pe(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 me(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function ve(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function ye(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var be;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(be||(be={}));const xe=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function Se(t,e,i){if(!t||!e)return be.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function Me(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Te({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function we(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Ce(t,e){const i=e?oe(t.angle):t.angle,s=we(t);return[Te({x:t.x1,y:t.y1},i,s),Te({x:t.x2,y:t.y1},i,s),Te({x:t.x2,y:t.y2},i,s),Te({x:t.x1,y:t.y2},i,s)]}function Ee(t,e,i=!1){const s=Ce(t,i),n=Ce(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(we(t),we(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?oe(t.angle):t.angle;let u=i?oe(90-t.angle):t.angle+Ht;const p=i?oe(e.angle):e.angle;let g=i?oe(90-e.angle):e.angle+Ht;u>Vt&&(u-=Vt),g>Vt&&(g-=Vt);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Me(n,i)+Me(n,s))/2>Me(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Be=1e-8;function Pe(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Oe(t,e){return Math.abs(t-e){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"};function De(t,e={},i){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")}class Fe{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=De(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:f=o}=this._userSpec;if(_(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,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: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,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}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(Fe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Fe.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Fe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Fe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Fe.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}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)}}Fe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Fe.NUMBERS_CHAR_SET="0123456789",Fe.FULL_SIZE_CHAR="字";const ze=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),je=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=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(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=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(t=0,e=0,i=0,s=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(t=0,e=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(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return He(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 Ve extends Ne{}class Ue extends Ne{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Ee(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new Ue(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Te({x:this.x1,y:this.y1},this.angle,t),Te({x:this.x2,y:this.y1},this.angle,t),Te({x:this.x1,y:this.y2},this.angle,t),Te({x:this.x2,y:this.y2},this.angle,t)]}}class We{constructor(t=1,e=0,i=0,s=1,n=0,r=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 We,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,f=o*n+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 We;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:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new We(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=le(r.rotateDeg),r}}class Ge{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 Ye(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 $e(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 Xe=/^#([0-9a-f]{3,8})$/,Ke={transparent:4294967040},qe={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 Ze(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Je(t){return S(t)?new si(t>>16,t>>8&255,255&t,1):y(t)?new si(t[0],t[1],t[2]):new si(255,255,255)}function Qe(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ti(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ei=(t,e)=>{const i=Xe.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new si((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Je(t):8===e?new si(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class ii{static Brighter(t,e=1){return 1===e?t:new ii(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new ii(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof ii?t:new ii(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();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(Ke[t]))return function(t){return S(t)?new si(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new si(t[0],t[1],t[2],t[3]):new si(255,255,255,1)}(Ke[t]);if(p(qe[t]))return Je(qe[t]);const e=`${t}`.trim().toLowerCase(),i=ei(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new si(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=Ye(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new si(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ii.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new si(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=$e(this.color.r,this.color.g,this.color.b),r=Ye(u(t)?n.h:_t(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 si(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=ei(e,!0);return null!=i?i:this}setColorName(t){const e=qe[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(t=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}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new ii(this.color.toString())}copyGammaToLinear(t,e=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,e=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=Qe(t.color.r),this.color.g=Qe(t.color.g),this.color.b=Qe(t.color.b),this}copyLinearToSRGB(t){return this.color.r=ti(t.color.r),this.color.g=ti(t.color.g),this.color.b=ti(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class si{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`#${Ze(this.r)+Ze(this.g)+Ze(this.b)+(1===this.opacity?"":Ze(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}=$e(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ni(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 si(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:$e});function ai(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 oi(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=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:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}function li(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 hi(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}const ci=1e-10;function di(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+ci)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=fi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=ae.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=ui(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-ci,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function ui(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function pi(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return ui(t,t-(i*i-e*e+t*t)/(2*i))+ui(e,s)}function gi(t,e){const i=ae.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function fi(t){const e={x:0,y:0};for(let i=0;ithis.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 _i;function yi(t,e){const i=vi(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 bi{constructor(t={}){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 xi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Si(t){let e;if(e=xi.exec(t))return new bi({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]});ot.getInstance().error("invalid format: "+t)}const Ai=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class ki{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 ki.instance||(ki.instance=new ki),ki.instance}newFormat(t){const e=Si(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"):Mi[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=Mi[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:_,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)?m: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?Ai[8+_i/3]:"")+A+(t&&"("===n?")":""),f)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=Si(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=vi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=Ai[8+n/3];return function(t){return s(r*t)+a}}}const Mi={"%":(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)=>yi(100*t,e),r:yi,s:function(t,e){const i=vi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(_i=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")+vi(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 Ti(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(_.fx>e.fx?(Bi(y,1+c,v,-c,e),y.fx=t(y),y.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Bi(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=te(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Ri(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Ei(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},ts=Math.sqrt,es=Math.tan;function is(t){return t>1?0:t<-1?ji:Math.acos(t)}function ss(t){return t>1?Hi:t<-1?-Hi:Math.asin(t)}function ns(){}function rs(t,e){t&&os.hasOwnProperty(t.type)&&os[t.type](t,e)}var as={Feature:function(t,e){rs(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sji?t+Math.round(-t/Vi)*Vi:t,e]}function bs(t,e,i){return(t%=Vi)?e||i?_s(Ss(t),As(e,i)):Ss(t):e||i?As(e,i):ys}function xs(t){return function(e,i){return[(e+=t)>ji?e-Vi:e<-ji?e+Vi:e,i]}}function Ss(t){var e=xs(t);return e.invert=xs(-t),e}function As(t,e){var i=Xi(t),s=Ji(t),n=Xi(e),r=Ji(e);function a(t,e){var a=Xi(e),o=Xi(t)*a,l=Ji(t)*a,h=Ji(e),c=h*i+o*s;return[$i(l*n-c*r,o*i-h*s),ss(c*n+l*r)]}return a.invert=function(t,e){var a=Xi(e),o=Xi(t)*a,l=Ji(t)*a,h=Ji(e),c=h*n-l*r;return[$i(l*n+h*r,o*i+c*s),ss(c*i-o*s)]},a}function ks(t,e){(e=us(e))[0]-=t,vs(e);var i=is(-e[1]);return((-e[2]<0?-i:i)+Vi-zi)%Vi}function Ms(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:ns,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function Ts(t,e){return Gi(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 Es(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Is(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 Ds(t,e,i,s){return function(n){var r,a,o,l=e(n),h=Ms(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Is(a);var t=function(t,e){var i=Rs(e),s=e[1],n=Ji(s),r=[Ji(i),-Xi(i),0],a=0,o=0;Ls.reset(),1===n?s=Hi+zi:-1===n&&(s=-Hi-zi);for(var l=0,h=t.length;l=0?1:-1,M=k*A,T=M>ji,w=f*x;if(Ls.add($i(w*k*Ji(M),m*S+w*Xi(M))),a+=T?A+k*Vi:A,T^p>=i^y>=i){var C=gs(us(u),us(_));vs(C);var E=gs(r,C);vs(E);var B=(T^A>=0?-1:1)*ss(E[2]);(s>B||s===B&&(C[0]||C[1]))&&(o+=T^A>=0?1:-1)}}return(a<-zi||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(Fs))}return u}}function Fs(t){return t.length>1}function zs(t,e){return((t=t.x)[0]<0?t[1]-Hi-zi:Hi-t[1])-((e=e.x)[0]<0?e[1]-Hi-zi:Hi-e[1])}1===(Bs=Os).length&&(Ps=Bs,Bs=function(t,e){return Os(Ps(t),e)});var js=Ds((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?ji:-ji,l=Gi(r-i);Gi(l-ji)0?Hi:-Hi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=ji&&(Gi(i-n)zi?Yi((Ji(e)*(r=Xi(s))*Ji(i)-Ji(s)*(n=Xi(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*Hi,s.point(-ji,n),s.point(0,n),s.point(ji,n),s.point(ji,0),s.point(ji,-n),s.point(0,-n),s.point(-ji,-n),s.point(-ji,0),s.point(-ji,n);else if(Gi(t[0]-e[0])>zi){var r=t[0]0,n=Gi(e)>zi;function r(t,i){return Xi(t)*Xi(i)>e}function a(t,i,s){var n=[1,0,0],r=gs(us(t),us(i)),a=ps(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=gs(n,r),u=ms(n,h);fs(u,ms(r,c));var p=d,g=ps(u,p),f=ps(p,p),m=g*g-f*(ps(u,u)-1);if(!(m<0)){var v=ts(m),_=ms(p,(-g-v)/f);if(fs(_,u),_=ds(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],A=i[1];x0^_[1]<(Gi(_[0]-b)ji^(b<=_[0]&&_[0]<=x)){var T=ms(p,(-g+v)/f);return fs(T,u),[_,ds(T)]}}}function o(e,i){var n=s?t:ji-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Ds(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],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?ji:-ji),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||Ts(e,p)||Ts(g,p))&&(g[2]=1),f!==l)c=0,f?(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^f){var v;m&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)))}!f||e&&Ts(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},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=Xi(e),o=Ji(e),l=s*i;null==n?(n=e+s*Vi,r=e-l/2):(n=ks(a,n),r=ks(a,r),(s>0?nr)&&(n+=s*Vi));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 Gi(s[0]-t)0?0:3:Gi(s[0]-i)0?2:1:Gi(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,f,m,v,_,y=a,b=Ms(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(A(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&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=Is(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&Cs(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&&m)y.point(r,a);else{var l=[g=Math.max(Vs,Math.min(Ns,g)),f=Math.max(Vs,Math.min(Ns,f))],b=[r=Math.max(Vs,Math.min(Ns,r)),a=Math.max(Vs,Math.min(Ns,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):(m||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Ws(t){return t}var Gs,Ys,$s,Xs,Ks=Oi(),qs=Oi(),Zs={point:ns,lineStart:ns,lineEnd:ns,polygonStart:function(){Zs.lineStart=Js,Zs.lineEnd=en},polygonEnd:function(){Zs.lineStart=Zs.lineEnd=Zs.point=ns,Ks.add(Gi(qs)),qs.reset()},result:function(){var t=Ks/2;return Ks.reset(),t}};function Js(){Zs.point=Qs}function Qs(t,e){Zs.point=tn,Gs=$s=t,Ys=Xs=e}function tn(t,e){qs.add(Xs*t-$s*e),$s=t,Xs=e}function en(){tn(Gs,Ys)}var sn=Zs,nn=1/0,rn=nn,an=-nn,on=an;var ln,hn,cn,dn,un={point:function(t,e){tan&&(an=t);eon&&(on=e)},lineStart:ns,lineEnd:ns,polygonStart:ns,polygonEnd:ns,result:function(){var t=[[nn,rn],[an,on]];return an=on=-(rn=nn=1/0),t}},pn=0,gn=0,fn=0,mn=0,vn=0,_n=0,yn=0,bn=0,xn=0,Sn={point:An,lineStart:kn,lineEnd:wn,polygonStart:function(){Sn.lineStart=Cn,Sn.lineEnd=En},polygonEnd:function(){Sn.point=An,Sn.lineStart=kn,Sn.lineEnd=wn},result:function(){var t=xn?[yn/xn,bn/xn]:_n?[mn/_n,vn/_n]:fn?[pn/fn,gn/fn]:[NaN,NaN];return pn=gn=fn=mn=vn=_n=yn=bn=xn=0,t}};function An(t,e){pn+=t,gn+=e,++fn}function kn(){Sn.point=Mn}function Mn(t,e){Sn.point=Tn,An(cn=t,dn=e)}function Tn(t,e){var i=t-cn,s=e-dn,n=ts(i*i+s*s);mn+=n*(cn+t)/2,vn+=n*(dn+e)/2,_n+=n,An(cn=t,dn=e)}function wn(){Sn.point=An}function Cn(){Sn.point=Bn}function En(){Pn(ln,hn)}function Bn(t,e){Sn.point=Pn,An(ln=cn=t,hn=dn=e)}function Pn(t,e){var i=t-cn,s=e-dn,n=ts(i*i+s*s);mn+=n*(cn+t)/2,vn+=n*(dn+e)/2,_n+=n,yn+=(n=dn*t-cn*e)*(cn+t),bn+=n*(dn+e),xn+=3*n,An(cn=t,dn=e)}var Ln=Sn;function Rn(t){this._context=t}Rn.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,Vi)}},result:ns};var On,In,Dn,Fn,zn,jn=Oi(),Hn={point:ns,lineStart:function(){Hn.point=Nn},lineEnd:function(){On&&Vn(In,Dn),Hn.point=ns},polygonStart:function(){On=!0},polygonEnd:function(){On=null},result:function(){var t=+jn;return jn.reset(),t}};function Nn(t,e){Hn.point=Vn,In=Fn=t,Dn=zn=e}function Vn(t,e){Fn-=t,zn-=e,jn.add(ts(Fn*Fn+zn*zn)),Fn=t,zn=e}var Un=Hn;function Wn(){this._string=[]}function Gn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Yn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),cs(t,i(s))),s.result()}return r.area=function(t){return cs(t,i(sn)),sn.result()},r.measure=function(t){return cs(t,i(Un)),Un.result()},r.bounds=function(t){return cs(t,i(un)),un.result()},r.centroid=function(t){return cs(t,i(Ln)),Ln.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ws):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Wn):new Rn(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 $n(t){return function(e){var i=new Xn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Xn(){}function Kn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),cs(i,t.stream(un)),e(un.result()),null!=s&&t.clipExtent(s),t}function qn(t,e,i){return Kn(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 Zn(t,e,i){return qn(t,[[0,0],e],i)}function Jn(t,e,i){return Kn(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 Qn(t,e,i){return Kn(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)}Wn.prototype={_radius:4.5,_circle:Gn(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=Gn(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}},Xn.prototype={constructor:Xn,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 tr=16,er=Xi(30*Wi);function ir(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&f--){var b=a+u,x=o+p,S=l+g,A=ts(b*b+x*x+S*S),k=ss(S/=A),M=Gi(Gi(S)-1)e||Gi((v*E+_*B)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Wi:0,E()):[m*Ui,v*Ui,_*Ui]},w.angle=function(t){return arguments.length?(y=t%360*Wi,E()):y*Ui},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=ir(o,T=t*t),B()):ts(T)},w.fitExtent=function(t,e){return qn(w,t,e)},w.fitSize=function(t,e){return Zn(w,t,e)},w.fitWidth=function(t,e){return Jn(w,t,e)},w.fitHeight=function(t,e){return Qn(w,t,e)},function(){return e=t.apply(this,arguments),w.invert=e.invert&&C,E()}}function lr(t){var e=0,i=ji/3,s=or(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Wi,i=t[1]*Wi):[e*Ui,i*Ui]},n}function hr(t,e){var i=Ji(t),s=(i+Ji(e))/2;if(Gi(s)2?t[2]*Wi:0),e.invert=function(e){return(e=t.invert(e[0]*Wi,e[1]*Wi))[0]*=Ui,e[1]*=Ui,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===mr?[[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 _r(t){return es((Hi+t)/2)}function yr(t,e){var i=Xi(t),s=t===e?Ji(t):qi(i/Xi(e))/qi(_r(e)/_r(t)),n=i*Zi(_r(t),s)/s;if(!s)return mr;function r(t,e){n>0?e<-Hi+zi&&(e=-Hi+zi):e>Hi-zi&&(e=Hi-zi);var i=n/Zi(_r(e),s);return[i*Ji(s*t),n-i*Xi(s*t)]}return r.invert=function(t,e){var i=n-e,r=Qi(s)*ts(t*t+i*i),a=$i(t,Gi(i))*Qi(i);return i*s<0&&(a-=ji*Qi(t)*Qi(i)),[a/s,2*Yi(Zi(n/r,1/s))-Hi]},r}function br(t,e){return[t,e]}function xr(t,e){var i=Xi(t),s=t===e?Ji(t):(i-Xi(e))/(e-t),n=i/s+t;if(Gi(s)zi&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Br.invert=pr(ss),Pr.invert=pr((function(t){return 2*Yi(t)})),Lr.invert=function(t,e){return[-e,2*Yi(Ki(t))-Hi]};var Ir={exports:{}},Dr=function(t,e){this.p1=t,this.p2=e};Dr.prototype.rise=function(){return this.p2[1]-this.p1[1]},Dr.prototype.run=function(){return this.p2[0]-this.p1[0]},Dr.prototype.slope=function(){return this.rise()/this.run()},Dr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Dr.prototype.isVertical=function(){return!isFinite(this.slope())},Dr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Dr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Dr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Dr.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)},Dr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Fr=Dr,zr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Fr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=zr(t.slice(0,s),e),o=zr(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},jr=zr;!function(t){var e=jr;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;r{const i=Nr(Wr,e),{tolerance:s}=i;return Hr(t,s)};var Yr;!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"}(Yr||(Yr={}));const $r=(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.sort&&(k(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!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;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,_=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],A=new Set,k=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),A.has(i)||(A.add(i),S.push(i),y(m)?k.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):k.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else _[r][l]+=a;e&&e.includeValues&&!v&&_[r][c].push(t[n]);break}}}let M=0;const T=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=_.length;t0?_[t][l]/M:0,T.push(_[t])}return T},Kr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,_=-1/0;if(e.extent)v=e.extent[0],_=e.extent[1];else for(let e=0;e_&&(_=s))}if(!Number.isFinite(v)||!Number.isFinite(_)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=_;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(_-v>1){const e=Math.floor(v),i=Math.ceil((_-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>_){t=s,m.length=t+1;break}}else{const e=(_-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>_){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",A=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",k=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",M=null!==(d=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==d?d:"percentage",T=y(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],w=y(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],C=w.length?w:void 0,E=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:A,percentageName:M,valuesName:k,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:C});if(!T.length)return Xr(t,E);const B={};return t.forEach((t=>{const e=T.map((e=>null==t?void 0:t[e])).join("-&&-");B[e]?B[e].push(t):B[e]=[t]})),Object.values(B).map((t=>{const e=[...w,...T];return Xr(t,Object.assign(Object.assign({},E),{groupField:e.length?e:void 0,n:t.length}))})).flat()},qr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,_;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const A=!!(null==e?void 0:e.includeValues),k=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},M=null!==(n=k.key)&&void 0!==n?n:y(x)?null:null!==(r=x)&&void 0!==r?r:"key",T=null!==(a=k.count)&&void 0!==a?a:"count",w=null!==(o=k.mean)&&void 0!==o?o:"mean",C=null!==(l=k.q1)&&void 0!==l?l:"q1",E=null!==(h=k.median)&&void 0!==h?h:"median",B=null!==(c=k.q3)&&void 0!==c?c:"q3",P=null!==(d=k.iqr)&&void 0!==d?d:"iqr",L=null!==(p=k.min)&&void 0!==p?p:"min",R=null!==(g=k.max)&&void 0!==g?g:"max",O=null!==(f=k.lowerWhisker)&&void 0!==f?f:"lowerWhisker",I=null!==(m=k.upperWhisker)&&void 0!==m?m:"upperWhisker",D=null!==(v=k.outliers)&&void 0!==v?v:"outliers",F=null!==(_=k.values)&&void 0!==_?_:"values",z=new Map,j=new Map,H=new Map,N=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),A&&j.set(r,[]),y(x)?H.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):H.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),A){const t=j.get(r);t&&t.push(i)}}y(S)&&(S=[_t(Math.min.apply(null,S),0,1),_t(Math.max.apply(null,S),0,1)]);const V=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=H.get(t);if(null!==M)f[M]=m;else if(y(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[T]=s,f[w]=o,f[C]=l,f[E]=h,f[B]=c,f[P]=d,f[L]=n,f[R]=r,f[O]=u,f[I]=p,f[D]=g,A&&(f[F]=j.get(t)||[]),V.push(f)}return V};var Zr={},Jr={};function Qr(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function ta(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function ea(t,e){var i=t+"",s=i.length;return s9999?"+"+ea(e,6):ea(e,4))+"-"+ea(t.getUTCMonth()+1,2)+"-"+ea(t.getUTCDate(),2)+(r?"T"+ea(i,2)+":"+ea(s,2)+":"+ea(n,2)+"."+ea(r,3)+"Z":n?"T"+ea(i,2)+":"+ea(s,2)+":"+ea(n,2)+"Z":s||i?"T"+ea(i,2)+":"+ea(s,2)+"Z":"")}function sa(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 Jr;if(h)return h=!1,Zr;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(;a0}function ga(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=oa(t));var r=[];switch(t.type){case"GeometryCollection":return fa(t,(function(t){va(t,s)})),t;case"FeatureCollection":return ga(t,(function(t){ga(va(t,s),(function(t){r.push(t)}))})),hi(r)}return va(t,s)}function va(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return fa(t,(function(t){va(t,e)})),t;case"LineString":return _a(ua(t),e),t;case"Polygon":return ya(ua(t),e),t;case"MultiLineString":return ua(t).forEach((function(t){_a(t,e)})),t;case"MultiPolygon":return ua(t).forEach((function(t){ya(t,e)})),t;case"Point":case"MultiPoint":return t}}function _a(t,e){pa(t)===e&&t.reverse()}function ya(t,e){pa(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=ba(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},ka=(t,e={},i)=>{i.type=Yr.GEO;const s=Nr(Sa,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Aa(t))})):e.push(Aa(t))})),e})(t);let l=t.features;return o&&(l=ma(t,{reverse:!g(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=xa.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=xa.bounds(t);t.bbox=e}})),t.features=l,t},Ma={},Ta=(t,e,i)=>{i.type=Yr.GEO;const s=Nr(Sa,Ma,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 Or(a,t)}))}:Or(a,o));var a,o;return ka(r,s,i)},wa=(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 Ca=0;function Ea(t="dataset"){return Ca>1e8&&(Ca=0),t+"_"+Ca++}class Ba{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:Ea("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:ot.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()}}class Pa{constructor(t,e){let i;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=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&U(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Ea("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){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,e=!0){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)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}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,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&U(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof Pa||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!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",$r),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Yn();const La={},Ra={albers:dr,albersusa:function(){var t,e,i,s,n,r,a=dr(),o=cr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=cr().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)}},Oa=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Ia(t,e){return function i(){const s=e();return s.type=t,s.path=Yn().projection(s),s.copy=s.copy||function(){const t=i();return Oa.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Da{static GenAutoIncrementId(){return Da.auto_increment_id++}}Da.auto_increment_id=0;class Fa{constructor(t){this.id=Da.GenAutoIncrementId(),this.registry=t}}const za="named",ja="inject",Ha="multi_inject",Na="inversify:tagged",Va="inversify:paramtypes";class Ua{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===za?`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="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),s=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),n=new WeakMap;function r(t,e,i){let r=n.get(t);if(h(r)){if(!i)return;r=new s,n.set(t,r)}let a=r.get(e);if(h(a)){if(!i)return;a=new s,r.set(e,a)}return a}function a(t,e,i){if(o(t,e,i))return!0;const s=f(e);return!c(s)&&a(t,s,i)}function o(t,e,i){const s=r(e,i,!1);return!h(s)&&!!s.has(t)}function l(t,e,i){if(o(t,e,i))return function(t,e,i){const s=r(e,i,!1);if(!h(s))return s.get(t)}(t,e,i);const s=f(e);return c(s)?void 0:l(t,s,i)}function h(t){return void 0===t}function c(t){return null===t}function d(t){return"object"==typeof t?null!==t:"function"==typeof t}function u(t,i){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const s=3===i?"string":5===i?"number":"default",n=function(t,e){const i=t[e];if(null!=i){if(!g(i))throw new TypeError;return i}}(t,e);if(void 0!==n){const e=n.call(t,s);if(d(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.valueOf;if(g(i)){const e=i.call(t);if(!d(e))return e}}else{const e=t.valueOf;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.toString;if(g(i)){const e=i.call(t);if(!d(e))return e}}throw new TypeError}(t,"default"===s?"number":s)}function p(t){const e=u(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function g(t){return"function"==typeof t}function f(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const s=t.prototype,n=s&&Object.getPrototypeOf(s);if(null==n||n===Object.prototype)return e;const r=n.constructor;return"function"!=typeof r||r===t?e:r}t("defineMetadata",(function(t,e,i,s){if(!d(i))throw new TypeError;return n=t,a=e,void r(i,s,!0).set(n,a);var n,a})),t("hasMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),l(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function Ga(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};Wa.hasOwnMetadata(t,e)&&(r=Wa.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,Wa.defineMetadata(t,r,e)}(Na,t,i.toString(),s)}function Ya(t){return(e,i,s)=>{Ga(e,0,s,t)}}function $a(t){return e=>(i,s,n)=>Ya(new Ua(t,e))(i,s,n)}const Xa=$a(ja),Ka=$a(Ha);function qa(){return function(t){return Wa.defineMetadata(Va,null,t),t}}function Za(t){return Ya(new Ua(za,t))}const Ja="Singleton",Qa="Transient",to="ConstantValue",eo="DynamicValue",io="Factory",so="Function",no="Instance",ro="Invalid";class ao{constructor(t,e){this.id=Da.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=ro,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new ao(this.serviceIdentifier,this.scope);return t.activated=t.scope===Ja&&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 oo{getConstructorMetadata(t){return{compilerGeneratedMetadata:Wa.getMetadata(Va,t),userGeneratedMetadata:Wa.getMetadata(Na,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const lo=(ho=za,t=>{const e=e=>{if(null==e)return!1;if(e.key===ho&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const po=Symbol("ContributionProvider");class go{constructor(t,e){this.serviceIdentifier=t,this.container=e,mo.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function fo(t,e){t(po).toDynamicValue((({container:t})=>new go(e,t))).inSingletonScope().whenTargetNamed(e)}class mo{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}mo.store=new Map;class vo{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 _o extends vo{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const yo=Symbol.for("EnvContribution"),bo=Symbol.for("VGlobal"),xo=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Qa,this.options=e,this.id=Da.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new oo}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,za,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new ao(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new uo(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[ja],multiInject:s[Ha]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:a,metadata:e,bindings:l};n.push(t)}}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case to:case so:e=t.cache;break;case no: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===Ja&&(t.cache=e,t.activated=!0)}},So=Symbol.for("RenderService");const Ao=new class{get renderService(){return this._renderService||(this._renderService=xo.get(So)),this._renderService}};let ko=0;class Mo{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=Ao.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++ko,t),this.tryRunAnimationFrameNextFrame(),ko}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class To{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var wo=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Co=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Eo=function(t,e){return function(i,s){e(i,s,t)}},Bo=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 Po=class extends To{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}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){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Da.GenAutoIncrementId(),this.hooks={onSetEnv:new _o(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}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)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new Mo);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}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)}loadFont(t,e,i){return Bo(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}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,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var Lo,Ro,Oo,Io;Po=wo([qa(),Eo(0,Xa(po)),Eo(0,Za(yo)),Co("design:paramtypes",[Object])],Po),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(Lo||(Lo={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(Ro||(Ro={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(Oo||(Oo={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(Io||(Io={}));const Do=Nt-1e-8;class Fo{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>Do)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%=Nt)<0&&(s+=Nt),(n%=Nt)<0&&(n+=Nt),nn;++o,a-=Ht)g(a);else for(a=s-s%Ht+Ht,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const jo=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,Ho={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},No={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let Vo,Uo,Wo,Go,Yo,$o;var Xo,Ko,qo,Zo,Jo,Qo;function tl(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),f=Math.cos(n),m=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+f,A=i+m,k=S+y*m,M=A-y*f;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 el(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=oe(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 f=d/i,m=c/i,v=-c/s,_=d/s,y=f*o+m*l,b=v*o+_*l,x=f*t+m*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+=Nt:C>0&&0===r&&(C-=Nt);const E=Math.ceil(Math.abs(C/(Ht+.001))),B=[];for(let t=0;te.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 sl(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=cl(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=$t(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=$t(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function ul(t,e){const{p0:i,p1:s}=t,n=ae.pointAtPP(i,s,e);return[new pl(i,n),new pl(n,s)]}class pl extends nl{constructor(t,e){super(),this.type=Jo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return ae.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Wt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?ae.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Zo.ROW?Ut(this.p0.x-this.p1.x):t===Zo.COLUMN?Ut(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class gl{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new dl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new pl(new re(this._lastX,this._lastY),new re(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===Zo.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Ut(t.p0.y-s.y)}if(t===Zo.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Ut(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class fl extends gl{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 ml(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function vl(t,e,i){const s=null!=e?e:Ut(i[i.length-1].x-i[0].x)>Ut(i[i.length-1].y-i[0].y)?Zo.ROW:Zo.COLUMN;return"monotoneY"===t?new fl(t,s):new gl(t,s)}class _l{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 yl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=vl("linear",i,t);return function(t,e){ml(t,e,1)}(new _l(n,s),t),n}function bl(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 xl{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&&bl(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:bl(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 Sl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return yl(t,e);const n=vl("basis",i,t);return function(t,e){ml(t,e,2)}(new xl(n,s),t),n}function Al(t){return t<0?-1:1}function kl(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(Al(r)+Al(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Ml(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 wl{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,Ml(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,Ml(this,e=kl(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Tl(this,this._t0,e=kl(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 Cl extends wl{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function El(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return yl(t,e);const n=vl("monotoneX",i,t);return function(t,e){ml(t,e,2)}(new wl(n,s),t),n}function Bl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return yl(t,e);const n=vl("monotoneY",i,t);return function(t,e){ml(t,e,2)}(new Cl(n,s),t),n}let Pl=class{constructor(t,e=.5,i){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;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):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()}};class Ll extends Pl{lineEnd(){this.context.closePath()}}function Rl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new gl("step",null!=s?s:Ut(t[t.length-1].x-t[0].x)>Ut(t[t.length-1].y-t[0].y)?Zo.ROW:Zo.COLUMN);return Ol(new Pl(r,e,n),t),r}function Ol(t,e){return ml(t,e,1)}class Il extends _l{lineEnd(){this.context.closePath()}}function Dl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=vl("linear",i,t);return function(t,e){ml(t,e,1)}(new Il(n,s),t),n}function Fl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>zt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>zt){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function zl(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return yl(i,n);const o=vl(t,r,i);return ml(new e(o,s,a),i,2),o}}const jl=zl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:Fl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const Hl=zl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:Fl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class Nl extends nl{constructor(t,e,i){super(),this.type=Jo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return hl(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,rl([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===Zo.ROW?Ut(this.p0.x-this.p2.x):t===Zo.COLUMN?Ut(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Yt(t-.01,0),i=$t(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Wt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=hl(i,s,n,e),a=ae.pointAtPP(i,s,e),o=ae.pointAtPP(s,n,e);return[new Nl(i,a,r),new Nl(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Vl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new pl(new re(this._lastX,this._lastY),new re(t,e))}quadraticCurveTo(t,e,i,s){const n=new Nl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new dl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Ul(t,e,i){var s,n;switch(e){case"linear":default:return yl(t,i);case"basis":return Sl(t,i);case"monotoneX":return El(t,i);case"monotoneY":return Bl(t,i);case"step":return Rl(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new gl("step",null!=s?s:Ut(t[t.length-1].x-t[0].x)>Ut(t[t.length-1].y-t[0].y)?Zo.ROW:Zo.COLUMN);return Ol(new Ll(r,e,n),t),r}(t,.5,i);case"stepBefore":return Rl(t,0,i);case"stepAfter":return Rl(t,1,i);case"catmullRom":return jl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return Hl(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return Dl(t,i)}}class Wl extends zo{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Fo(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([No.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([No.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([No.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([No.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([No.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([No.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([No.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([No.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([No.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()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Vl(this);sl(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[No.M]=t=>`M${t[1]} ${t[2]}`,t[No.L]=t=>`L${t[1]} ${t[2]}`,t[No.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[No.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[No.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3];((t,e,i,s,n,r,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;e`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[No.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,e=Wo;for(let s=1,r=i.length;s{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,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),sl(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Zo.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Ut(t.p0.y-e.p1.y)}if(this.direction===Zo.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Ut(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{ot.getInstance().warn("空函数")}}),lh=Object.assign(Object.assign({},th),{points:[],cornerRadius:0,closePath:!0}),hh=Object.assign(Object.assign({},th),{width:100,height:100,spikes:5,thickness:.5}),ch=Object.assign(Object.assign({},th),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},th),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const dh=Object.assign(Object.assign({},th),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),uh=Object.assign(Object.assign(Object.assign({},th),Zl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),ph=Object.assign(Object.assign(Object.assign({},th),Zl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",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}),gh=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0,maxWidth:500,maxHeight:500},th),{fill:!0,cornerRadius:0,cornerType:"round"}),fh=Object.assign(Object.assign({},gh),{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}),mh=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 m("directional",t.sideOrCorner,1)||m("angular",t.angleValue,1)}function a(){return m("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=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 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=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 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 vh{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(vh.IsGradientStr(t))try{const e=mh(t)[0];if(e){if("linear"===e.type)return vh.ParseLinear(e);if("radial"===e.type)return vh.ParseRadial(e);if("conic"===e.type)return vh.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=jt/2,n=parseFloat(e.value)/180*jt-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Vt,stops:vh.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:vh.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=jt/2;let n="angular"===e.type?parseFloat(e.value)/180*jt:0;for(;n<0;)n+=Vt;for(;n>=Vt;)n-=Vt;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}const bh={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"}},xh=!0,Sh=!1,Ah=/\w|\(|\)|-/,kh=/[.?!,;:/,。?!、;:]/,Mh=/\S/,Th=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function wh(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=Ao.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=Ch(t,a)),a}function Ch(t,e,i=!1){let s=e;for(;Ah.test(t[s-1])&&Ah.test(t[s])||kh.test(t[s]);)if(s--,s<=0)return i?Eh(t,e):e;return s}function Eh(t,e){let i=e;for(;Ah.test(t[i+1])&&Ah.test(t[i])||kh.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Bh(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=Ao.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}var Ph=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Lh=class{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=uh.fontSize}){let i=0,s=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 a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=Ch(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_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){if(s===n){ot.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}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),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);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}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,a=!1){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=Ch(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}};Lh=Ph([qa()],Lh);var Rh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Oh=Symbol.for("TextMeasureContribution");let Ih=class extends Lh{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}};Ih=Rh([qa()],Ih);const Dh=Symbol.for("CanvasFactory"),Fh=Symbol.for("Context2dFactory");function zh(t){return xo.getNamed(Dh,Ao.global.env)(t)}const jh=1e-4,Hh=Math.sqrt(3),Nh=1/3;function Vh(t){return t>-ec&&tec||t<-ec}const Wh=[0,0],Gh=[0,0],Yh=[0,0];function $h(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Xh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function Kh(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 qh(t){return(t%=Vt)<0&&(t+=Vt),t}function Zh(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+=Vt);let d=Math.atan2(l,o);return d<0&&(d+=Vt),d>=s&&d<=n||d+Vt>=s&&d+Vt<=n}function tc(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(Vh(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 sc=[-1,-1,-1],nc=[-1,-1];function rc(){const t=nc[0];nc[0]=nc[1],nc[1]=t}function ac(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(Vh(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,Nh):Math.pow(i,Nh),s=s<0?-Math.pow(-s,Nh):Math.pow(s,Nh);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+Hh*Math.sin(e)))/(3*a),h=(-o+i*(s-Hh*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,sc);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&rc(),p=Kh(e,s,r,o,nc[0]),u>1&&(g=Kh(e,s,r,o,nc[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Vh(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,sc);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=Xh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);sc[0]=-l,sc[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Vt-1e-4){s=0,n=Vt;const e=r?1:-1;return a>=sc[0]+t&&a<=sc[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Vt,n+=Vt);let c=0;for(let e=0;e<2;e++){const i=sc[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Vt+t),(t>=s&&t<=n||t+Vt>=s&&t+Vt<=n)&&(t>jt/2&&t<1.5*jt&&(e=-e),c+=e)}}return c}function hc(t){return Math.round(t/jt*1e8)/1e8%2*jt}function cc(t,e){let i=hc(t[0]);i<0&&(i+=Vt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Vt?n=i+Vt:e&&i-n>=Vt?n=i-Vt:!e&&i>n?n=i+(Vt-hc(i-n)):e&&i1&&(i||(h+=Re(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],v=a[2],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,A=b;dc[0]=S,dc[1]=A,cc(dc,Boolean(a[6])),S=dc[0],A=dc[1];const k=S,M=A-S,T=!!(1-(a[6]?0:1)),w=(s-m)*_/_+m;switch(f){case No.M:u=m,p=v,c=u,d=p;break;case No.L:if(i){if(tc(c,d,m,v,e,s,n))return!0}else h+=Re(c,d,m,v,s,n)||0;c=m,d=v;break;case No.C:if(i){if(Jh(c,d,m,v,_,y,b,x,e,s,n))return!0}else h+=ac(c,d,m,v,_,y,b,x,s,n)||0;c=b,d=x;break;case No.Q:if(i){if(Zh(c,d,m,v,_,y,e,s,n))return!0}else h+=oc(c,d,m,v,_,y,s,n)||0;c=_,d=y;break;case No.A:if(o=Math.cos(k)*_+m,l=Math.sin(k)*_+v,g?(u=o,p=l):h+=Re(c,d,o,l,s,n),i){if(Qh(m,v,_,k,k+M,T,e,w,n))return!0}else h+=lc(m,v,_,k,k+M,T,w,n);c=Math.cos(k+M)*_+m,d=Math.sin(k+M)*_+v;break;case No.R:if(u=c=m,p=d=v,o=u+_,l=p+y,i){if(tc(u,p,o,p,e,s,n)||tc(o,p,o,l,e,s,n)||tc(o,l,u,l,e,s,n)||tc(u,l,u,p,e,s,n))return!0}else h+=Re(o,p,o,l,s,n),h+=Re(u,l,u,p,s,n);break;case No.Z:if(i){if(tc(c,d,u,p,e,s,n))return!0}else h+=Re(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},fc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const mc=Symbol.for("VWindow"),vc=Symbol.for("WindowHandlerContribution");let _c=class extends To{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(){super(),this.hooks={onChange:new _o(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(xo.getNamed(vc,t.env).configure(this,t),this.actived=!0)},this._uid=Da.GenAutoIncrementId(),this.global=Ao.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}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.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}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)}};_c=gc([qa(),fc("design:paramtypes",[])],_c);var yc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xc=function(t,e){return function(i,s){e(i,s,t)}};let Sc=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=Ao.global,this._textMeasureMap=new Map,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}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||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=pc.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="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:Zl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Fe(Object.assign({defaultFontParams:{fontFamily:Zl.fontFamily,fontSize:Zl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=xo.get(mc),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 Ac;Sc=yc([qa(),xc(0,Xa(po)),xc(0,Za(Oh)),bc("design:paramtypes",[Object])],Sc),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Ac||(Ac={}));const kc=new We;let Mc=class{constructor(){this.matrix=new We}init(t){return this.mode=Ac.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Ac.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(kc.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(kc.a,kc.b,kc.c,kc.d,kc.e,kc.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(kc.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(kc.a,kc.b,kc.c,kc.d,kc.e,kc.f),this}scale(t,e,i){return this.mode===Ac.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Ac.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return kc.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(kc.a,kc.b,kc.c,kc.d,kc.e,kc.f),this}translate(t,e){return this.mode===Ac.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Ac.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Mc=yc([qa(),bc("design:paramtypes",[])],Mc);const Tc={arc:eh,area:ih,circle:sh,line:ah,path:oh,symbol:dh,text:uh,rect:ch,polygon:lh,star:hh,richtext:ph,richtextIcon:fh,image:gh,group:nh,glyph:rh},wc=Object.keys(Tc);function Cc(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Ec={arc:Object.assign({},Tc.arc),area:Object.assign({},Tc.area),circle:Object.assign({},Tc.circle),line:Object.assign({},Tc.line),path:Object.assign({},Tc.path),symbol:Object.assign({},Tc.symbol),text:Object.assign({},Tc.text),rect:Object.assign({},Tc.rect),polygon:Object.assign({},Tc.polygon),star:Object.assign({},Tc.star),richtext:Object.assign({},Tc.richtext),richtextIcon:Object.assign({},Tc.richtextIcon),image:Object.assign({},Tc.image),group:Object.assign({},Tc.group),glyph:Object.assign({},Tc.glyph)};class Bc{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},wc.forEach((t=>{this._defaultTheme[t]=Object.create(Ec[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,i=!1){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,ot.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;wc.forEach((s=>{const n=Object.create(Ec[s]);t&&t[s]&&Cc(n,t[s]),i[s]&&Cc(n,i[s]),e[s]&&Cc(n,e[s]),this.combinedTheme[s]=n})),e.common&&wc.forEach((t=>{Cc(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 Pc=new Bc;function Lc(t,e){return t.glyphHost?Lc(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)):Pc.getTheme()}return null}(t)||t.attachedThemeGraphic&&Lc(t.attachedThemeGraphic)||Pc.getTheme()}var Rc=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 Oc 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=Da.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){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,e=!1){return Rc(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,e=!0){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,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)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===t||t===e)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&&ot.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)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,e=!1){let 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,e=!1){let 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,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Fc))return void ot.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(Nc(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 Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=Nc(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 Fc))return void ot.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=Nc(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 Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=Nc(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 Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=Hc.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Nc(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(Nc(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,Nc(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(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 Fc))return void ot.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"):Nc(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 zc))return void ot.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=Hc.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.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),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 Vc(s,{clickInterval:a,supportsTouchEvents:o}),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 Fc,this.rootWheelEvent=new zc,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.addEventListener("pointermove",this.onPointerMove,!0),t.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.addEventListener("mousemove",this.onPointerMove,!0),t.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.removeEventListener("pointermove",this.onPointerMove,!0),t.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.removeEventListener("mousemove",this.onPointerMove,!0),t.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 Yc{static GetImage(t,e){var i;const s=Yc.cache.get(t);s?"fail"===s.loadState?Ao.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):Yc.loadImage(t,e)}static GetSvg(t,e){var i;let s=Yc.cache.get(t);s?"fail"===s.loadState?Ao.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"},Yc.cache.set(t,s),s.dataPromise=Ao.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.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Yc.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Yc.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Ao.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Ao.global.loadBlob(t):"json"===e&&(i.dataPromise=Ao.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Yc.isLoading&&Yc.toLoadAueue.length){Yc.isLoading=!0;const t=Yc.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Yc.cache.set(i,n),n.dataPromise=Ao.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))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Yc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Yc.loading()})).catch((t=>{console.error(t),Yc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Yc.loading()}))}}),0)}static loadImage(t,e){const i=$c(t,Yc.toLoadAueue);if(-1!==i)return Yc.toLoadAueue[i].marks.push(e),void Yc.loading();Yc.toLoadAueue.push({url:t,marks:[e]}),Yc.loading()}static improveImageLoading(t){const e=$c(t,Yc.toLoadAueue);if(-1!==e){const t=Yc.toLoadAueue.splice(e,1);Yc.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function $c(t,e){for(let i=0;it?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(qc[0]=t[0],qc[2]=t[0],qc[1]=t[1],qc[3]=t[1],qc):t:t:0,Jc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Qc=[1,2,3,0,1,2,3,0];function td(t,e,i,s){for(;t>=Vt;)t-=Vt;for(;t<0;)t+=Vt;for(;t>e;)e+=Vt;Jc[0].x=i,Jc[1].y=i,Jc[2].x=-i,Jc[3].y=-i;const n=Math.ceil(t/Ht)%4,r=Math.ceil(e/Ht)%4;if(s.add(Gt(t)*i,Xt(t)*i),s.add(Gt(e)*i,Xt(e)*i),n!==r||e-t>jt){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{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)}}nd.TimeOut=1e3/60;const rd=new nd,ad=(t,e)=>{const i=((t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};class od{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}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function ld(t,e,i,s,n){return n?t.arc(i,s,e,0,Nt,!1,n):t.arc(i,s,e,0,Nt),!1}var hd=new class extends od{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 ld(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return ld(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(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 cd=new class extends od{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,this.parseSize(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,this.parseSize(e)/6,i,s,n,r)}};function dd(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 ud=new class extends od{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 dd(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return dd(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return dd(t,this.parseSize(e)/2+n,i,s,r)}};function pd(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var gd=new class extends od{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return pd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return pd(t,this.parseSize(e)/2+n,i,s)}};function fd(t,e,i,s,n=0){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}class md extends od{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 fd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return fd(t,this.parseSize(e)/2,i,s,n)}}var vd=new md;var _d=new class extends md{constructor(){super(...arguments),this.type="triangle"}};const yd=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),bd=Math.sin(Nt/10)*yd,xd=-Math.cos(Nt/10)*yd;function Sd(t,e,i,s){const n=bd*e,r=xd*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Nt*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 Ad=new class extends od{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 Sd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Sd(t,this.parseSize(e)/2+n,i,s)}};const kd=Kt(3);function Md(t,e,i,s){const n=e,r=n/kd,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 Td=new class extends od{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 Md(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Md(t,this.parseSize(e)/2+n,i,s)}};function wd(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 Cd=new class extends od{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return wd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return wd(t,this.parseSize(e)/2+n,i,s)}};function Ed(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Bd=new class extends od{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Ed(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ed(t,this.parseSize(e)/2+n,i,s)}};const Pd=-.5,Ld=Kt(3)/2,Rd=1/Kt(12);function Od(t,e,i,s){const n=e/2,r=e*Rd,a=n,o=e*Rd+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(Pd*n-Ld*r+i,Ld*n+Pd*r+s),t.lineTo(Pd*a-Ld*o+i,Ld*a+Pd*o+s),t.lineTo(Pd*l-Ld*h+i,Ld*l+Pd*h+s),t.lineTo(Pd*n+Ld*r+i,Pd*r-Ld*n+s),t.lineTo(Pd*a+Ld*o+i,Pd*o-Ld*a+s),t.lineTo(Pd*l+Ld*h+i,Pd*h-Ld*l+s),t.closePath(),!1}var Id=new class extends od{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 Od(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Od(t,this.parseSize(e)/2+n,i,s)}};function Dd(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}var Fd=new class extends od{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 Dd(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Dd(t,this.parseSize(e)/2,i,s,n)}};function zd(t,e,i,s,n=0){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}var jd=new class extends od{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 zd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return zd(t,this.parseSize(e)/2,i,s,n)}};function Hd(t,e,i,s,n=0){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}var Nd=new class extends od{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 Hd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Hd(t,this.parseSize(e)/2,i,s,n)}};const Vd=Kt(3);function Ud(t,e,i,s){const n=e*Vd;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var Wd=new class extends od{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Ud(t,this.parseSize(e)/2/Vd,i,s)}drawOffset(t,e,i,s,n){return Ud(t,this.parseSize(e)/2/Vd+n,i,s)}};function Gd(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 Yd=new class extends od{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 Gd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Gd(t,this.parseSize(e)/4+n,i,s)}};function $d(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 Xd=new class extends od{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 $d(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return $d(t,this.parseSize(e)/4+n,i,s)}};function Kd(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 qd=new class extends od{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 Kd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Kd(t,this.parseSize(e)/4+n,i,s)}};function Zd(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 Jd=new class extends od{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 Zd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Zd(t,this.parseSize(e)/4+n,i,s)}};function Qd(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var tu=new class extends od{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return Qd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Qd(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function eu(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var iu=new class extends od{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return eu(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return eu(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function su(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 nu=new class extends od{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 su(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return su(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function ru(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function au(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var ou=new class extends od{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)?au(t,e,i,s):ru(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?au(t,e+2*n,i,s):ru(t,[e[0]+2*n,e[1]+2*n],i,s)}};const lu=new Ve;class hu{constructor(t,e,i=!1){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 e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),sl(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(sl(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{lu.x1=i.bounds.x1*t,lu.y1=i.bounds.y1*t,lu.x2=i.bounds.x2*t,lu.y2=i.bounds.y2*t,e.union(lu)}))}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 cu={};[hd,cd,ud,gd,Wd,_d,Ad,Td,Cd,Bd,Id,Fd,jd,vd,Nd,Yd,Xd,qd,Jd,ou,tu,iu,nu].forEach((t=>{cu[t.type]=t}));const du={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"};class uu{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 pu(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function gu(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",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=gu(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=pu(t,"--\x3e",r+4,"Comment is not closed.");else{const a=gu(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 uu(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 uu(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 vu(t,e){return _u(t)}function _u(t,e){const i={};for(let e=0;ewu.set(t,!0)));const Cu=new Map;function Eu(t){if(wu.has(t))return!0;if(Cu.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>Cu.set(t,!0)));const Bu=Mu(),Pu=Mu(),Lu=Mu(),Ru=Mu(),Ou=Mu(),Iu=Mu(),Du=Mu(),Fu=Mu(),zu=Mu(),ju=Mu();Mu();const Hu=Mu();Mu();const Nu=Mu();Mu();const Vu=Mu(),Uu=Mu(),Wu=Symbol.for("GraphicService"),Gu=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"},$u=Object.keys(Yu),Xu={duration:200,easing:"cubicOut"};function Ku(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}function qu(t,e,i){const s=i[0],n=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]*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],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*s+c*n+g*r+e[12],t[13]=o*s+d*n+f*r+e[13],t[14]=l*s+u*n+m*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function Zu(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 Ju(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],f=e[12],m=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*f,t[1]=y*n+b*l+x*u+S*m,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*f,t[5]=y*n+b*l+x*u+S*m,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*f,t[9]=y*n+b*l+x*u+S*m,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*f,t[13]=y*n+b*l+x*u+S*m,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function Qu(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 tp{constructor(){this.pools=[]}static identity(t){return Ku(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 tp.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},np=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const rp=new We(1,0,0,1,0,0),ap={x:0,y:0};let op=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new We(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new We(1,0,0,1,0,0),this.path=new Wl,this._clearMatrix=new We(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return ep.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new We(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(ep.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(ep.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){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,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=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(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){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},ap),function(t,e,i){return uc(t,0,!1,e,i)}(this.path.commandList,ap.x,ap.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},ap);const i=_h(this,this.lineWidth,this.dpr);return function(t,e,i,s){return uc(t,e,!0,i,s)}(this.path.commandList,i,ap.x,ap.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(t=!0,e=this.dpr){this.setTransformFromMatrix(rp,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>ep.free(t))),this.stack.length=0}};op=sp([qa(),np("design:paramtypes",[Object,Number])],op);const lp={WIDTH:500,HEIGHT:500,DPR:1};class hp{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}set nativeCanvas(t){this._nativeCanvas=t}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=lp.WIDTH,height:n=lp.HEIGHT,dpr:r=lp.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(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var cp;hp.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(cp||(cp={}));class dp{static Get(t,e=cp.Color1,i=[0,0,0,1]){if(e===cp.Color1){const e=dp.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ii.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];dp.store1[t]=e,dp.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=dp.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ii.parseColorString(t);return n&&(dp.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],dp.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===cp.Color1){if(dp.store1[t])return;dp.store1[t]=i,dp.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(dp.store255[t])return;dp.store255[t]=i,dp.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function up(t,e=!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 pp(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)=>{var a,o;return gp(y(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,y(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):gp(t,e,i,s,n)}function gp(t,e,i,s,n){if(!t||!e)return t&&up(t)||e&&up(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=dp.Get(t,cp.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=dp.Get(e,cp.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:up(a)})))});return o?pp(r,l,i,s,n):pp(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:_p(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:_p(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:_p(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),up(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)}function fp(t,e,i){return`rgba(${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})`}dp.store255={},dp.store1={};const mp=[0,0,0,0],vp=[0,0,0,0];function _p(t,e,i){return dp.Get(t,cp.Color255,mp),dp.Get(e,cp.Color255,vp),`rgba(${Math.round(mp[0]+(vp[0]-mp[0])*i)},${Math.round(mp[1]+(vp[1]-mp[1])*i)},${Math.round(mp[2]+(vp[2]-mp[2])*i)},${mp[3]+(vp[3]-mp[3])*i})`}class yp{static GetCanvas(){try{return yp.canvas||(yp.canvas=Ao.global.createCanvas({})),yp.canvas}catch(t){return null}}static GetCtx(){if(!yp.ctx){const t=yp.GetCanvas();yp.ctx=t.getContext("2d")}return yp.ctx}}class bp extends Ge{static getInstance(){return bp._instance||(bp._instance=new bp),bp._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=yp.GetCanvas(),s=yp.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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new bp(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class xp{static GetSize(t){for(let e=0;e=t)return xp.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=xp.GenKey(t,e,i,s,n),l=xp.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=xp.GenKey(t,e,i,s,n);xp.cache[l]?xp.cache[l].push({width:a,height:o,pattern:r}):xp.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}xp.cache={},xp.ImageSize=[20,40,80,160,320,640,1280,2560];const Sp=new Ve,Ap=new We;new Ve;const kp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],Mp=["x","y"],Tp=["scaleX","scaleY"],wp=["angle"],Cp=new re,Ep={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Bp extends Oc{static mixin(t){const e=Object.keys(t);for(let i=0;i10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=cu[t];if(e)return e;if(e=Bp.userSymbolMap[t],e)return e;if(!0===((i=t=du[t]||t).startsWith("{const e=(new Wl).fromString(t.d),i={};$u.forEach((e=>{t[e]&&(i[Yu[e]]=t[e])})),n.push({path:e,attribute:i}),Sp.union(e.bounds)}));const r=Sp.width(),a=Sp.height(),o=1/Yt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new hu(t,n,!0);return Bp.userSymbolMap[t]=l,l}var i;const s=(new Wl).fromString(t),n=s.bounds.width(),r=s.bounds.height(),a=1/Yt(n,r);s.transform(0,0,a,a);const o=new hu(t,s);return Bp.userSymbolMap[t]=o,o}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,s=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:n=e.boundsPadding}=i,r=Zc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new Fo(t);return sl(e.commandList,i,0,0),!0}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(t=!0){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(t=!0){return this._transMatrix||(this._transMatrix=new We),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&Xo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&Xo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&Xo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&Xo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&Xo.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&Xo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=Xo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===Ko.GLOBAL){const i=new re(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){this.setAttributes(t,e,i),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||s)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,i){t&&((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,e=!1,i){const s=Object.keys(t);for(let e=0;e{i[e]?(o||(o={}),o[e]=t[e]):a[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(r=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==r?r:Xu;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:a,duration:l.duration,easing:l.easing}}]),o&&this.setAttributesAndPreventAnimate(o,!1,{type:qo.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t)}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:qo.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{type:qo.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(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,i;const s=this.attribute[t];return this.animates&&this.animates.size?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=s?s:null===(i=this.finalAttribute)||void 0===i?void 0:i[t]}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){const i=y(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);s.length!==this.currentStates.length&&this.useStates(s,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;this.stateSort&&(t=t.sort(this.stateSort));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|=Xo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=Xo.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=Xo.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&Xo.UPDATE_SHAPE_AND_BOUNDS)===Xo.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=Xo.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Xo.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Xo.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=Xo.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=Xo.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=Xo.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=Xo.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&Xo.UPDATE_LAYOUT)}getAnchor(t,e,i){const s=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=$l.x,y:e=$l.y,scaleX:i=$l.scaleX,scaleY:s=$l.scaleY,angle:n=$l.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(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=Gt(a),f=Xt(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const _=m-i,y=v-s,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,A=d*g-h*f;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*A,t.e=u+l*m+c*v-b*_-S*y,t.f=p+h*m+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,!0),Ao.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY($l);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Ap.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.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:qo.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Ao.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),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 Wl).fromString(t):this.pathProxy=new Wl,this.pathProxy}loadImage(t,e=!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(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",this.stopAnimates(),Ao.graphicService.onRelease(this),super.release()}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new jc(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)}}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||Ao.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new op(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}var Pp;Bp.userSymbolMap={},Bp.mixin(Uc),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Pp||(Pp={}));let Lp=class t extends Bp{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Iu,this._childUpdateTag=Xo.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 Bc),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Bc)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===Ko.GLOBAL){const i=new re(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&Xo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=$l.x,y:e=$l.y,dx:i=$l.dx,dy:s=$l.dy,scaleX:n=$l.scaleX,scaleY:r=$l.scaleY,angle:a=$l.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()}getGraphicTheme(){return Lc(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return Ao.graphicService.updateTempAABBBounds(i),Ao.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=Xo.CLEAR_BOUNDS,this._childUpdateTag&=Xo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=Xo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&Xo.UPDATE_BOUNDS||(this._childUpdateTag|=Xo.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(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().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),this.getGraphicService().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(t=!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&Xo.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=Ao.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}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}};function Rp(t){return new Lp(t)}Lp.NOWORK_ANIMATE_ATTR=Ep;class Op extends Lp{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 Bc,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!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=>{Ao.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=>{Ao.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 Ip=Symbol.for("TransformUtil"),Dp=Symbol.for("GraphicUtil"),Fp=Symbol.for("LayerService"),zp=Symbol.for("StaticLayerHandlerContribution"),jp=Symbol.for("DynamicLayerHandlerContribution"),Hp=Symbol.for("VirtualLayerHandlerContribution");var Np,Vp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)};let Wp=Np=class{static GenerateLayerId(){return`${Np.idprefix}_${Np.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Ao.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?xo.get(zp):"dynamic"===t?xo.get(jp):xo.get(Hp),e}createLayer(t,e={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 Op(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Np.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)}};Wp.idprefix="visactor_layer",Wp.prefix_count=0,Wp=Np=Vp([qa(),Up("design:paramtypes",[])],Wp);var Gp=new Fa((t=>{t(bo).to(Po).inSingletonScope(),t(mc).to(_c),t(Dp).to(Sc).inSingletonScope(),t(Ip).to(Mc).inSingletonScope(),t(Fp).to(Wp).inSingletonScope()}));function Yp(t,e){return!(!t&&!e)}function $p(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Xp(t,e,i){return i&&t*e>0}function Kp(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function qp(t,e){return t*e>0}function Zp(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Jp(t,e,i,s,n,r,a){const o=t-i,l=e-s,h=(a?r:-r)/Math.sqrt(o*o+l*l),c=h*l,d=-h*o,u=t+c,p=e+d,g=i+c,f=s+d,m=(u+g)/2,v=(p+f)/2,_=g-u,y=f-p,b=_*_+y*y,x=n-r,S=u*f-g*p,A=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let k=(S*y-_*A)/b,M=(-S*_-y*A)/b;const T=(S*y+_*A)/b,w=(-S*_+y*A)/b,C=k-m,E=M-v,B=T-m,P=w-v;return C*C+E*E>B*B+P*P&&(k=T,M=w),{cx:k,cy:M,x01:-c,y01:-d,x11:k*(n/x-1),y11:M*(n/x-1)}}function Qp(t,e,i,s,n){const r=Ut(i-e),a=t.getParsedCornerRadius(),o=y(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,_=Math.max(f,g),b=Math.max(m,v);let x=_,S=b;const A=n*Gt(c),k=n*Xt(c),M=s*Gt(u),T=s*Xt(u);let w,C,E,B;if((b>zt||_>zt)&&(w=n*Gt(d),C=n*Xt(d),E=s*Gt(p),B=s*Xt(p),r1?0:P<-1?jt:Math.acos(P))/2),l=Kt(t[0]*t[0]+t[1]*t[1]);S=$t(b,(s-l)/(o-1)),x=$t(_,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:E,yirs:B,xore:w,yore:C,xire:M,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:_,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function tg(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ut(l-o),c=l>o;let d=!1;if(n=Vt-zt)e.moveTo(i+n*Gt(o),s+n*Xt(o)),e.arc(i,s,n,o,l,!c),r>zt&&(e.moveTo(i+r*Gt(l),s+r*Xt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:M,limitedIcr:T,innerDeltaAngle:w,innerEndAngle:C,innerStartAngle:E,innerCornerRadiusStart:B,innerCornerRadiusEnd:P,maxInnerCornerRadius:L}=Qp(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>zt){const t=$t(v,m),r=$t(_,m),o=Jp(g,f,u,p,n,t,Number(c)),l=Jp(b,x,S,A,n,r,Number(c));m0&&e.arc(i+o.cx,s+o.cy,t,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,n,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Gt(Wt(l.y01,l.x01)),s+l.cy+r*Xt(Wt(l.y01,l.x01))):e.moveTo(i+b,s+n*Xt(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,M,!c)):e.moveTo(i+n*Gt(M),s+n*Xt(M));if(!(r>zt)||w<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(T>zt){const t=$t(B,T),n=$t(P,T),o=Jp(S,A,b,x,r,-n,Number(c)),l=Jp(u,p,g,f,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,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,r,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Gt(Wt(l.y01,l.x01)),s+l.cy+t*Xt(Wt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),!a||a[2]?e.arc(i,s,r,C,E,c):e.moveTo(i+r*Gt(E),s+r*Xt(E))}return a?a[3]&&e.lineTo(i+n*Gt(o),s+n*Xt(o)):e.closePath(),d}const eg=Symbol.for("ArcRenderContribution"),ig=Symbol.for("AreaRenderContribution"),sg=Symbol.for("CircleRenderContribution"),ng=Symbol.for("GroupRenderContribution"),rg=Symbol.for("ImageRenderContribution"),ag=Symbol.for("PathRenderContribution"),og=Symbol.for("PolygonRenderContribution"),lg=Symbol.for("RectRenderContribution"),hg=Symbol.for("SymbolRenderContribution"),cg=Symbol.for("TextRenderContribution"),dg=Symbol.for("InteractiveSubRenderContribution");function ug(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function pg(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}var gg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mg=function(t,e){return function(i,s){e(i,s,t)}};function vg(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:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:v}=e.attribute,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(s=m[2])&&void 0!==s?s:0}if(Ku(t),qu(t,t,[n+o,r+l,a+h]),qu(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),qu(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]),f){const i=ip.allocate(),s=[0,0];if(v){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=m[1]}qu(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,f),qu(i,i,[-s[0],-s[1],0]),Ju(t,t,i)}}let _g=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new _o(["graphic"]),onSetStage:new _o(["graphic","stage"]),onRemove:new _o(["graphic"]),onRelease:new _o(["graphic"]),onAddIncremental:new _o(["graphic","group","stage"]),onClearIncremental:new _o(["graphic","group","stage"]),beforeUpdateAABBBounds:new _o(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new _o(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new _o(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ve,this.tempAABBBounds2=new Ve}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)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new Fo(t);return sl(i.commandList,s,0,0),!0}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=pg(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=ug(n,e);i.set(s,i.y1,s+e,i.y2)}}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){Au(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;Au(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&&He(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};_g=gg([qa(),mg(0,Xa(Gu)),fg("design:paramtypes",[Object])],_g);const yg=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},bg=["radius","startAngle","endAngle",...kp];class xg extends Bp{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=Ru}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)}getGraphicTheme(){return Lc(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Ao.graphicService.updateTempAABBBounds(i);return yg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Vt-zt?i.set(-r,-r,r,r):td(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,bg)}needUpdateTag(t){return super.needUpdateTag(t,bg)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Wl,s.arc(0,0,r,a,o),s}clone(){return new xg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return xg.NOWORK_ANIMATE_ATTR}}function Sg(t){return new xg(t)}xg.NOWORK_ANIMATE_ATTR=Ep;class Ag{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Lo.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,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;a{t+=e.str})),(Array.isArray(r)?r.join(""):r).toString()!==t}return"vertical"===s.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==s.text.toString():null!=this.clipedText&&this.clipedText!==s.text.toString()}get multilineLayout(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=Uu,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}getGraphicTheme(){return Lc(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new Mg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Te(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=Ao.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Au(n,o/Math.abs(r+a),!0,l),i.union(n)}return Ao.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Ao.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,He(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:_=s.ignoreBuf,keepCenterInLine:y=s.keepCenterInLine}=n,b=_?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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(f/2),this._AABBBounds}const S=Ao.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new Ag(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:y}),{bbox:k}=A;return this.cache.layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{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,measureMode:v=r.measureMode,suffixPosition:_=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),k=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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 M=Ao.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),T={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:k},w=new Ag(a,T,M),C=y(t)?t.map((t=>t.toString())):[t.toString()],E=[],B=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/k),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),B[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const t=ug(_,a),e=this.cache.verticalList.length*v,i=pg(y,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>function(t){const e=[];let i=0,s="";for(let n=0;n{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===Tu.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))})),this.cache.verticalList=b,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const x=ug(_,a),S=this.cache.verticalList.length*v,A=pg(y,S,d);return this._AABBBounds.set(A,x,A+S,x+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=ad(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=kg){return super.needUpdateTags(t,e)}needUpdateTag(t,e=kg){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new Mg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Mg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return Mg.baselineMapAlign}getAlignMapBaseline(){return Mg.alignMapBaseline}}function Tg(t){return new Mg(t)}Mg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Ep),Mg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},Mg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const wg=["symbolType","size",...kp];let Cg=class t extends Bp{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=Vu}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}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{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return Lc(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Ao.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Au(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(y(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){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,wg)}needUpdateTag(t){return super.needUpdateTag(t,wg)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new Wl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Wl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Eg(t){return new Cg(t)}Cg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Ep);const Bg=["segments","points","curveType","curveTension",...kp];let Pg=class t extends Bp{constructor(t={}){super(t),this.type="line",this.numberType=Fu}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=id(i,s,e))}getGraphicTheme(){return Lc(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),Ao.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Bg)}needUpdateTag(t){return super.needUpdateTag(t,Bg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Wl;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Lg(t){return new Pg(t)}Pg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ep);const Rg=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}},Og=["width","x1","y1","height","cornerRadius",...kp];class Ig extends Bp{constructor(t){super(t),this.type="rect",this.numberType=Hu}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Lc(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=Ao.graphicService.updateTempAABBBounds(i);return yg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Og)}needUpdateTag(t){return super.needUpdateTag(t,Og)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=Rg(e);return t=new Wl,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new Ig(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ig.NOWORK_ANIMATE_ATTR}}function Dg(t){return new Ig(t)}Ig.NOWORK_ANIMATE_ATTR=Ep;class Fg extends Bp{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,e=!1,i){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}getGraphicTheme(){return Lc(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}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(),this.stateSort&&(t=t.sort(this.stateSort));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.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Fg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Fg.NOWORK_ANIMATE_ATTR}}function zg(t){return new Fg(t)}Fg.NOWORK_ANIMATE_ATTR=Ep;class jg{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=bh[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}}}function Hg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Ng{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=ad(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Bh(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||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,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r: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}=Bh(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=wh(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Bh(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=Hg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=wh(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Bh(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&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=wh(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Bh(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const Vg=["width","height","image",...kp];class Ug extends Bp{constructor(t){super(t),this.type="image",this.numberType=Du,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}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()})),this.addUpdateBoundTag()}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)}getGraphicTheme(){return Lc(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=Ao.graphicService.updateTempAABBBounds(i);return yg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return gh[t]}needUpdateTags(t){return super.needUpdateTags(t,Vg)}needUpdateTag(t){return super.needUpdateTag(t,Vg)}clone(){return new Ug(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ug.NOWORK_ANIMATE_ATTR}}function Wg(t){return new Ug(t)}Ug.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Ep);class Gg extends Ug{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=Zc(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=Zc(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=gh.width,height:e=gh.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 Yg{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 Gg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=bh[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Ng){const e=Mh.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,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Gg)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Bh(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Gg)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Gg)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||Sh;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,Th(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||xh;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?yh(t,s,{AABBBounds:i}):s,Th(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Gg)break;const{width:n}=Bh(t,s.character,s.ascentDescentMode),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.forEach(((t,e)=>{i+=t instanceof Gg?t.width:t.getWidthWithEllips(this.direction)})),i}}class $g{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=bh[this.direction]}store(t){if(t instanceof Gg){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 Yg(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,e=!1){t instanceof Gg?"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||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=wh(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Ng(i,t.newLine,t.character,t.ascentDescentMode),new Ng(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Xg=!1;try{Xg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Xg=!1}const Kg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...kp];class qg extends Bp{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Nu,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:ph.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:ph.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:ph.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:ph.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:ph.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:ph.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:ph.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:ph.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Lc(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&_(t.text)&&qg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&_(t.text)&&qg.splitText(t.text).length>1)))}static splitText(t){if(Xg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=qg.splitText(t.text.toString());if(_(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),Ao.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Ao.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Kg)}needUpdateTag(t){return super.needUpdateTag(t,Kg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!qg.AllSingleCharacter(_)&&(_=qg.TransformTextConfig2SingleCharacter(_),this.attribute.textConfig=_);const y=[],b=null!=t?t:_;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,y.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),M="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),T=new jg(0,0,(k?n:x?i:0)||0,(M?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&x,!M&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),w=new $g(T);if(w.newLine=v,p){let t=0,e=!1;for(let i=0;i{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new qg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(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())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return qg.NOWORK_ANIMATE_ATTR}}function Zg(t){return new qg(t)}qg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Ep);const Jg=["path","customPath",...kp];class Qg extends Bp{constructor(t){super(t),this.type="path",this.numberType=zu}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=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Wl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Wl?this.cache:t.path)}getGraphicTheme(){return Lc(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=Ao.graphicService.updateTempAABBBounds(i);yg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new Wl).fromString(t.path):t.customPath&&(this.cache=new Wl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,Jg)}needUpdateTag(t){return super.needUpdateTag(t,Jg)}toCustomPath(){return(new Wl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Qg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Qg.NOWORK_ANIMATE_ATTR}}function tf(t){return new Qg(t)}Qg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Ep);const ef=["segments","points","curveType","curveTension",...kp];class sf extends Bp{constructor(t){super(t),this.type="area",this.numberType=Lu}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}getGraphicTheme(){return Lc(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),Ao.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),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}_interpolate(t,e,i,s,n){"points"===t&&(n.points=id(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,ef)}needUpdateTag(t){return super.needUpdateTag(t,ef)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Wl;const 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 sf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return sf.NOWORK_ANIMATE_ATTR}}function nf(t){return new sf(t)}sf.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ep);const rf=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...kp];class af extends Bp{constructor(t){super(t),this.type="arc",this.numberType=Bu}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=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(y(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();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=he(e),i=e+r,s&&Ut(r)zt&&o>zt)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=this.getGraphicTheme(),{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=Kt(a*a+o*o)}=this.attribute,h=Ut(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>zt&&l>zt){const i=e>t?1:-1;let s=Zt(Number(l)/o*Xt(g)),n=Zt(Number(l)/a*Xt(g));return(f-=2*s)>zt?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>zt?(n*=i,c+=n,d-=n):(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}}getGraphicTheme(){return Lc(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Ao.graphicService.updateTempAABBBounds(i);yg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=zt?i.set(0,0,0,0):Math.abs(o-l)>Vt-zt?i.set(-s,-s,s,s):(td(l,o,s,i),td(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,rf)}needUpdateTag(t){return super.needUpdateTag(t,rf)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Ut(o-a),d=o>a;if(h=Vt-zt)n.moveTo(0+h*Gt(a),0+h*Xt(a)),n.arc(0,0,h,a,o,!d),l>zt&&(n.moveTo(0+l*Gt(o),0+l*Xt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Gt(a),e=h*Xt(a),i=l*Gt(o),s=l*Xt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new af(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return af.NOWORK_ANIMATE_ATTR}}function of(t){return new af(t)}af.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Ep);const lf=["points","cornerRadius",...kp];class hf extends Bp{constructor(t){super(t),this.type="polygon",this.numberType=ju}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Lc(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),Ao.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=id(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,lf)}needUpdateTag(t){return super.needUpdateTag(t,lf)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Wl,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new hf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return hf.NOWORK_ANIMATE_ATTR}}function cf(t){return new hf(t)}hf.NOWORK_ANIMATE_ATTR=Ep;class df extends Lp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!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 uf(t){return new df(t)}const pf=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 gf,ff;function mf(t){return gf||(gf=pf.CreateGraphic("text",{})),gf.initAttributes(t),gf.AABBBounds}var vf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},yf=function(t,e){return function(i,s){e(i,s,t)}};class bf{constructor(){this.time=Qo.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:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit,backgroundKeepAspectRatio:y=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip}=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=Lc(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:_,backgroundKeepAspectRatio:y,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s){const{backgroundMode:n,backgroundFit:r,backgroundKeepAspectRatio:a,backgroundScale:o=1,backgroundOffsetX:l=0,backgroundOffsetY:h=0}=s,c=i.width(),d=i.height();let u=c,p=d;if("no-repeat"===n)if(r)if(a){const s=Math.max(c/e.width,d/e.height);t.drawImage(e,i.x1+l,i.y1+h,e.width*s*o,e.height*s*o)}else t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const s=e.width*o,n=e.height*o;t.drawImage(e,i.x1+l,i.y1+h,s,n)}else{if(r&&"repeat"!==n&&(e.width||e.height)){const i=e.width,s=e.height;"repeat-x"===n?(u=i*(d/s),p=d):"repeat-y"===n&&(p=s*(c/i),u=c);const r=t.dpr,a=pc.allocate({width:u,height:p,dpr:r}),o=a.getContext("2d");o&&(o.inuse=!0,o.clearMatrix(),o.setTransformForCurrent(!0),o.clearRect(0,0,u,p),o.drawImage(e,0,0,u,p),e=a.nativeCanvas),pc.free(a)}const s=t.dpr,a=t.createPattern(e,n);a.setTransform&&a.setTransform(new DOMMatrix([1/s,0,0,1/s,0,0])),t.fillStyle=a,t.translate(i.x1,i.y1),t.fillRect(0,0,c,d),t.translate(-i.x1,-i.y1)}}}const xf=new bf;let Sf=class{constructor(t){this.subRenderContribitions=t,this.time=Qo.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)}))}};Sf=vf([qa(),yf(0,Xa(po)),yf(0,Za(dg)),_f("design:paramtypes",[Object])],Sf);const Af=new class{constructor(){this.time=Qo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),_=t.AABBBounds,y=null!==(p=t.attribute.width)&&void 0!==p?p:_.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:_.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[y,b],i+y/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const kf=new class{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}};class Mf{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=pc.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])),pc.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,Vt),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:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h;const{textureRatio:c=r.textureRatio,textureOptions:d=null}=e.attribute;let u=this.textureMap.get(t);if(!u)switch(t){case"circle":u=this.createCirclePattern(o,l,a,i);break;case"diamond":u=this.createDiamondPattern(o,l,a,i);break;case"rect":u=this.createRectPattern(o,l,a,i);break;case"vertical-line":u=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":u=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":u=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":u=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":u=this.createGridPattern(o,l,a,i)}if(d&&d.dynamicTexture){const{gridConfig:u={},useNewCanvas:p}=d,g=e.AABBBounds;s=g.x1,n=g.y1;const f=i;let m;if(p){m=pc.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=m.getContext("2d");t.clearRect(0,0,g.width(),g.height()),s=0,n=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,s,n,r),f.clip();const v=g.width(),_=g.height(),y=l,b=o,x=u.columns?u.columns:Math.ceil(v/b),S=u.rows?u.rows:Math.ceil(_/b),A=u.gutterColumn?u.gutterColumn:2*y,k=u.gutterRow?u.gutterRow:2*y;this._tempSymbolGraphic||(this._tempSymbolGraphic=Eg({}));const M=u.columns?v/u.columns:b,T=u.rows?_/u.rows:b;this._tempSymbolGraphic.setAttributes({size:[M-A,T-k],symbolType:t});const w=this._tempSymbolGraphic.getParsedPath();for(let t=0;t{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:_h(e,o,e.dpr),c=o/w,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:w+u*h,innerRadius:T-u*h,startAngle:_-u*c,endAngle:y+u*c}),e.beginPath(),tg(t,e,i,s,w+u*h,T-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/A,(S-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder"),t.setAttributes({outerRadius:w,innerRadius:T,startAngle:_,endAngle:y})}},Cf=Tf,Ef=xf;const Bf=new class{constructor(){this.time=Qo.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,f=p&&!1!==p.visible;if(!g&&!f)return;const{radius:m=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,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:_h(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),f&&M(p,"innerBorder")}},Pf=Tf,Lf=xf;const Rf=new class extends bf{constructor(){super(...arguments),this.time=Qo.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,backgroundKeepAspectRatio:f=l.backgroundKeepAspectRatio,backgroundScale:m=l.backgroundScale,backgroundOffsetX:v=l.backgroundOffsetX,backgroundOffsetY:_=l.backgroundOffsetY}=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,{backgroundMode:p,backgroundFit:g,backgroundKeepAspectRatio:f,backgroundScale:m,backgroundOffsetX:v,backgroundOffsetY:_}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Of=jt/2;function If(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=Ut(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Ut(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Ut(t[0]),i=Ut(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Ut(l[0]),l[1]=Ut(l[1]),l[2]=Ut(l[2]),l[3]=Ut(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],_=[c[0],c[1]+g[1]],y=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],x=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!q(v,_)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Of,0,!1)}if(o&&o[1]?o[1](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(y,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Of,!1)}if(o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),!q(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Of,jt,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],jt,jt+Of,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}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};class Ff{constructor(){this.time=Qo.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,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:M,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:w,height:C}=t.attribute;w=(null!=w?w:k-i)||0,C=(null!=C?C:M-s)||0;const E=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=T?h:_h(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||y(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,w-o*g,C-o*g)):(e.beginPath(),If(e,u,p,w-o*g,C-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&E(u,"outerBorder"),f&&E(p,"innerBorder")}}let zf=class{constructor(){this.time=Qo.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)}};zf=Df([qa()],zf);let jf=class{constructor(){this.time=Qo.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:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:_=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||y(v)&&v.every((t=>0===t)))){let n,r=0;return If(e,i,s,b,x,v,"bevel"!==_,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};jf=Df([qa()],jf);const Hf=new Ff,Nf=Tf,Vf=xf;const Uf=new class extends Ff{constructor(){super(...arguments),this.time=Qo.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)}},Wf=xf;const Gf=new class{constructor(){this.time=Qo.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,f=p&&!1!==p.visible,m=g&&!1!==g.visible;if(!f&&!m)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,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,k=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:_h(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(y-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}},Yf=new class{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:_=l.scaleX,scaleY:y=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/_,(f-s)/y,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/_,(f-s)/y,l),e.stroke())))}},$f=Tf,Xf=xf;const Kf={x:0,y:0,z:0,lastModelMatrix:null};class qf{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(Af),this.builtinContributions.push(kf),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===Qo.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Qo.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}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)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Lc(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,_=Xp(d,u,h),y=qp(d,g),b=Yp(h),x=$p(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(_||y||a||o))return!0;e.beginPath();return sl(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),!0}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=Xp(o,l,n),p=qp(o,c),g=Yp(n,r),f=$p(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){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;Kf.x=n,Kf.y=r,Kf.z=a,Kf.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=ip.allocate(),n=ip.allocate();vg(n,t,e),Ju(s,d||s,n),Kf.x=0,Kf.y=0,Kf.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),ip.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Kf.x+=s.x,Kf.y+=s.y,Kf.z=a,i.setTransformForCurrent()}else if(p)Kf.x=0,Kf.y=0,Kf.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Kf.x+=s.x,Kf.y+=s.y,this.transformWithoutTranslate(i,Kf.x,Kf.y,Kf.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Kf.x=0,Kf.y=0,Kf.z=0;return Kf}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,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,_=(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,f,m,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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&ip.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}var Zf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qf=function(t,e){return function(i,s){e(i,s,t)}};let tm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Bu,this.builtinContributions=[wf,Ef,Cf],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=d>c;let p=!1;if(nzt){const t=$t(b,y),r=$t(x,y),a=Jp(v,_,f,m,n,t,Number(u)),o=Jp(A,k,M,T,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,Wt(o.y11,o.x11),Wt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>zt)||C<.001)e.lineTo(i+M,s+T),p=!0;else if(w>zt){const t=$t(B,w),n=$t(P,w),a=Jp(M,T,A,k,r,-n,Number(u)),o=Jp(f,m,v,_,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),w0&&e.arc(i+a.cx,s+a.cy,n,Wt(a.y01,a.x01),Wt(a.y11,a.x11),!u);const t=Wt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Gt(E),s+r*Xt(E));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Lc(t,null==r?void 0:r.theme).arc;const{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:k=l.outerRadius,innerRadius:M=l.innerRadius}=t.attribute;k+=b,M-=x;let T=0;const w=(c(S)&&S||S[0])&&"conical"===h.gradient;if(w){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Ut(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((_||E)&&(e.beginPath(),tg(t,e,i,s,k,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),g?(this._runStroke(t,e,i,s,l,y,E,v,o),this._runFill(t,e,i,s,l,_,m,u,p,a)):(this._runFill(t,e,i,s,l,_,m,u,p,a),this._runStroke(t,e,i,s,l,y,E,v,o))),!E&&y&&(e.beginPath(),tg(t,e,i,s,k,M,B),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(c(S)&&S||S[1])&&A){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Ut(h-r)>=Vt-zt){e.beginPath();const r=Math.abs(k-M)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,M,d,d+r),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o);const u=()=>{if(_){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+=Vt;for(;i>Vt;)i-=Vt;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),pp(o.color,l.color,h,!1)}(0,0,h,n);a||Xp&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}},p=()=>{y&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};u(),p()}}this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),w&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}};tm=Zf([qa(),Qf(0,Xa(po)),Qf(0,Za(eg)),Jf("design:paramtypes",[Object])],tm);var em=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},im=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sm=function(t,e){return function(i,s){e(i,s,t)}};let nm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ru,this.builtinContributions=[Bf,Lf,Pf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Lc(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,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f;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,_,y,m,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{y&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o)}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function rm(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]=cl(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 am(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function om(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=am(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),rm(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=Zo.ROW:"y"===s?u=Zo.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.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 hm=class extends qf{constructor(){super(...arguments),this.numberType=Fu}draw(t,e,i,s){const n=Lc(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 f;if(!e)return;t.beginPath();om(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),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:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!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:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===_)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=Ul(x(t.points,v),_,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===_){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===y){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],y,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=y*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],$t(_,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,y,b,i,s,t,a,o)}};function cm(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),rm(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),rm(t,l,1,s),o=!1):o=!0}t.closePath()}hm=lm([qa()],hm);const dm=new class extends Mf{constructor(){super(...arguments),this.time=Qo.afterFillStroke}drawShape(t,e,i,s,n,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:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:sd(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:sd(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:sd(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:sd(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},um=xf;var pm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fm=function(t,e){return function(i,s){e(i,s,t)}};let mm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Lu,this.builtinContributions=[dm,um],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,_=m[0];e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const i=m[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,v)}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:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(y(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Lc(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:M=g.clipRange,closePath:T,points:w,segments:C}=t.attribute;let{curveType:E=g.curveType}=t.attribute;function B(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===E&&(E="linearClosed"),1===M&&!C&&!w.some((t=>!1===t.defined))&&"linear"===E)return this.drawLinearAreaHighPerformance(t,e,!!f,k,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(C&&C.length){let e,i;const s=C.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=Ul(B(t.points,x),E,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=C.length-1;t>=0;t--){const e=C[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=C[t-1].points,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=Ul(B(i,x),"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!w||!w.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=B(w,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Ul(e,E,{curveTension:b}),n=Ul(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===M){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,y,r[c],[g,t.attribute],M,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=M*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,A,v,k,y,r[u],[g,t.attribute],$t(f,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,y,t.attribute,g,M,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Lc(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,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let _,b,x=Zo.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],_=t.points[t.points.length-1]}else b=m[0],_=m[m.length-1];const S=Ut(_.x-b.x),A=Ut(_.y-b.y);x=null==_.x1?Zo.ROW:null==_.y1?Zo.COLUMN:Number.isFinite(S+A)?S>A?Zo.ROW:Zo.COLUMN:Zo.ROW,function(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?Zo.ROW:Zo.COLUMN,Number.isFinite(c)||(o=Zo.COLUMN),Number.isFinite(d)||(o=Zo.ROW);const u=i*(o===Zo.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;y(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),om(t,i[0]?e.top:e.bottom,l,x===Zo.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,M-c,o),t.stroke()}})(),!1}};mm=pm([qa(),fm(0,Xa(po)),fm(0,Za(ig)),gm("design:paramtypes",[Object])],mm);const vm=Tf,_m=xf;var ym=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xm=function(t,e){return function(i,s){e(i,s,t)}};let Sm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=zu,this.builtinContributions=[_m,vm],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:Lc(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:_,doFill:y,doStroke:b}=m;if(e.beginPath(),t.pathShape)sl(t.pathShape.commandList,e,i,s,1,1,f);else{sl((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,y,b,v,_,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):_&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{y&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,y,b,v,_,d,n,a,o)}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Sm=ym([qa(),xm(0,Xa(po)),xm(0,Za(ag)),bm("design:paramtypes",[Object])],Sm);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)}};let Tm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=Hu,this.builtinContributions=[Hf,Vf,Nf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Lc(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:_=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:M=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:w}=t.attribute;T=(null!=T?T:b-S)||0,w=(null!=w?w:x-A)||0;const C=Kp(g,f,T,w,h),E=Zp(g,v,T,w,M),B=Yp(h,c),P=$p(d,m);if(!t.valid||!_)return;if(!B&&!P)return;if(!(C||E||a||o||c))return;0===u||y(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,T,w)):(e.beginPath(),If(e,i,s,T,w,u,"bevel"!==p));const L={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,B,P,C,E,l,n,a,o,L),k?(this._runStroke(t,e,i,s,l,L,E,S,A,o),this._runFill(t,e,i,s,l,L,C,S,A,a)):(this._runFill(t,e,i,s,l,L,C,S,A,a),this._runStroke(t,e,i,s,l,L,E,S,A,o)),this.afterRenderStep(t,e,i,s,B,P,C,E,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}};Tm=Am([qa(),Mm(0,Xa(po)),Mm(0,Za(lg)),km("design:paramtypes",[Object])],Tm);var wm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Em=function(t,e){return function(i,s){e(i,s,t)}};let Bm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Vu,this.builtinContributions=[Gf,Xf,$f,Yf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:Lc(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,M=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,w=s,C=M;const E=e.camera;if(k&&E&&e.project){const t=e.project(i,s,M);e.camera=null,y(c)&&(c[0],c[1]),T=t.x,w=t.y,C=void 0}!1===A.draw(e,c,T,w,C,((n,r)=>{var h,c,v,_;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(_=r.lineWidth)&&void 0!==_?_:t.attribute.lineWidth,r=e}const y=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),y()):(y(),x())}))&&e.closePath(),e.camera=E,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,_,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,_,d,u,A,a)):(this._runFill(t,e,i,s,l,x,_,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,_,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Bm=wm([qa(),Em(0,Xa(po)),Em(0,Za(hg)),Cm("design:paramtypes",[Object])],Bm);const Pm=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ve)}allocate(t,e,i,s){if(!this.pools.length)return(new Ve).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 Ve(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(...t){this.pools=[]}};const Lm=new class extends bf{constructor(){super(...arguments),this.time=Qo.beforeFillStroke}drawShape(t,e,i,s,n,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,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio}=t.attribute;let T,{background:w}=t.attribute;if(!w)return;const C=()=>{"richtext"===t.type&&(e.restore(),e.save(),T&&e.setTransformFromMatrix(T,!0,1))};let E;"richtext"===t.type&&(T=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const B=g(w)&&w.background,P=t.transMatrix.onlyTranslate();if(B){const e=t.AABBBounds,i=(null!==(u=w.x)&&void 0!==u?u:e.x1)+(null!==(p=w.dx)&&void 0!==p?p:0),s=(null!==(f=w.y)&&void 0!==f?f:e.y1)+(null!==(m=w.dy)&&void 0!==m?m:0),n=null!==(v=w.width)&&void 0!==v?v:e.width(),r=null!==(_=w.height)&&void 0!==_?_:e.height();if(E=Pm.allocate(i,s,i+n,s+r),w=w.background,!P){const t=E.width(),e=E.height();E.set((null!==(y=w.x)&&void 0!==y?y:0)+(null!==(b=w.dx)&&void 0!==b?b:0),(null!==(x=w.y)&&void 0!==x?x:0)+(null!==(S=w.dy)&&void 0!==S?S:0),t,e)}}else E=t.AABBBounds,P||(E=mf(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(w);if("success"!==n.state||!n.data)return void C();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,E,{backgroundMode:A,backgroundFit:k,backgroundKeepAspectRatio:M}),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=w,n?(If(e,E.x1,E.y1,E.width(),E.height(),n,!0),e.fill()):e.fillRect(E.x1,E.y1,E.width(),E.height()),e.highPerformanceRestore()}B&&Pm.free(E),C()}};var Rm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Om=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Im=function(t,e){return function(i,s){e(i,s,t)}};let Dm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Uu,this.builtinContributions=[Lm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Lc(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,fontSize:v=d.fontSize,verticalMode:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute,x=null!==(l=ad(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:M,doStroke:T}=S,w=!f,C=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,M,T,A,k,d,n,a,o),w&&this.transformUseContext2d(t,d,C,e);const E=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=ep.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),ep.free(t)}T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,C))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,C))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,C),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,C)})))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,C),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,C,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!_){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Yt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;E(i,a-(e+1)*x+u,r,n),r+=s}))}))}w&&this.restoreTransformUseContext2d(t,d,C,e),this.afterRenderStep(t,e,i,s,M,T,A,k,d,n,a,o)}draw(t,e,i,s){const n=Lc(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,l,h,c){if(e+t<=0)return;const{textAlign:d=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,_=!u(c),y=_?c.width:i.clipedWidth,b=_?0:ug(d,y),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+y,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+y,t,o),h.stroke()}}};function Fm(t,e,i,s){if(e&&e.length){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},Um=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wm=function(t,e){return function(i,s){e(i,s,t)}};let Gm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ju,this.builtinContributions=[Nm,Hm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Lc(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,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:b}=f;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?Fm(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Fm(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,f=(Math.atan2(u,d)-Math.atan2(g,p))/2,m=Math.abs(Math.tan(f));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,_=v/m;const y=zm(d,u),b=zm(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*m);const S=jm(h,_,y,d,u),A=jm(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=zm(k,M),w=jm(h,zm(_,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 B=E-C;B<0&&(C=E,B=-B),B>Math.PI&&(B-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),B&&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,_,b,m,v,l,n,a,o);const x=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,_,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Gm=Vm([qa(),Wm(0,Xa(po)),Wm(0,Za(og)),Um("design:paramtypes",[Object])],Gm);var Ym=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Xm=function(t,e){return function(i,s){e(i,s,t)}};let Km=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Iu}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Rf)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:Lc(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:M=l.x,y:T=l.y}=t.attribute,w=Kp(p,m,g,f,c),C=Zp(p,v,g,f),E=Yp(c,u),B=$p(d,x);if(!t.valid||!S)return;if(!h){if(!E&&!B)return;if(!(w||C||a||o||u))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,g,f)):(e.beginPath(),If(e,i,s,g,f,_,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Rf));const P={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===Qo.beforeFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o,P)})),h&&e.clip();const L=()=>{P.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,M-i,T-s,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,M-i,T-s,l),e.stroke()))};A?(R(),L()):(L(),R()),this._groupRenderContribitions.forEach((r=>{r.time===Qo.afterFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=Ao.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=Lc(t,null==s?void 0:s.theme).group,i=ip.allocate(),n=ip.allocate();vg(n,t,e),Ju(i,p||i,n),a.modelMatrix=i,ip.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&ip.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}};Km=Ym([qa(),Xm(0,Xa(po)),Xm(0,Za(ng)),$m("design:paramtypes",[Object])],Km);var qm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jm=function(t,e){return function(i,s){e(i,s,t)}};const Qm=["","repeat-x","repeat-y","repeat"];let tv=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Du,this.builtinContributions=[Uf,Wf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Lc(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,image:m}=t.attribute,v=this.valid(t,l,a);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v;if(!m||!t.resources)return;const A=t.resources.get(m);if("success"!==A.state)return;const k=t.width,M=t.height;e.beginPath();let T=!1;0===p||y(p)&&p.every((t=>0===t))?e.rect(i,s,k,M):(If(e,i,s,k,M,p,"bevel"!==f),T=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const w=()=>{if(x)if(a)a(e,t.attribute,l);else if(_){e.setCommonStyle(t,t.attribute,i,s,l);let n=0;if("repeat"===h&&(n|=1),"repeat"===c&&(n|=2),n){const t=e.createPattern(A.data,Qm[n]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,k,M),e.translate(-i,-s,!0)}else e.drawImage(A.data,i,s,k,M)}},C=()=>{S&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(C(),T&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),w(),T&&e.restore()):(T&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),w(),T&&e.restore(),C()),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 Yc.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Lc(t).image;this._draw(t,a,!1,i)}};tv=qm([qa(),Jm(0,Xa(po)),Jm(0,Za(rg)),Zm("design:paramtypes",[Object])],tv);const ev=Symbol.for("IncrementalDrawContribution"),iv=Symbol.for("ArcRender"),sv=Symbol.for("AreaRender"),nv=Symbol.for("CircleRender"),rv=Symbol.for("GraphicRender"),av=Symbol.for("GroupRender"),ov=Symbol.for("LineRender"),lv=Symbol.for("PathRender"),hv=Symbol.for("PolygonRender"),cv=Symbol.for("RectRender"),dv=Symbol.for("SymbolRender"),uv=Symbol.for("TextRender"),pv=Symbol.for("RichTextRender"),gv=Symbol.for("GlyphRender"),fv=Symbol.for("ImageRender"),mv=Symbol.for("DrawContribution"),vv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Pu,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];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+=Vt;for(;o<0;)o+=Vt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};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},yv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const bv=Symbol.for("DrawItemInterceptor"),xv=new Ve,Sv=new Ve;class Av{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){xv.copy(s.dirtyBounds),Sv.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,ep.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(xv),s.backupDirtyBounds.copy(Sv)),!0}}class kv{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 Mv=class{constructor(){this.order=1,this.interceptors=[new Av,new wv,new Tv,new kv]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&ip.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Cv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},Bv=function(t,e){return function(i,s){e(i,s,t)}};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))}reInit(){this.drawContribution.reInit()}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=Cv([qa(),Bv(0,Xa(mv)),Ev("design:paramtypes",[Object])],Pv);var Lv=new Fa((t=>{t(So).to(Pv)}));const Rv=Symbol.for("PickerService"),Ov=Symbol.for("GlobalPickerService"),Iv=Symbol.for("PickItemInterceptor"),Dv=Symbol.for("PickServiceInterceptor");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};let zv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};zv=Fv([qa()],zv);let jv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Lc(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=ep.allocateByObj(a),u=new re(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};jv=Fv([qa()],jv);let Hv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new re(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}};Hv=Fv([qa()],Hv);let Nv=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){const a=vv(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};Nv=Fv([qa()],Nv);var Vv=new Fa(((t,e,i)=>{i(Rv)||(t(Ov).toSelf(),t(Rv).toService(Ov)),t(Nv).toSelf().inSingletonScope(),t(Iv).toService(Nv),t(jv).toSelf().inSingletonScope(),t(Iv).toService(jv),t(Hv).toSelf().inSingletonScope(),t(Iv).toService(Hv),fo(t,Iv),t(zv).toSelf().inSingletonScope(),t(Dv).toService(zv),fo(t,Dv)})),Uv=new Fa((t=>{t(Wu).to(_g),t(Gu).toConstantValue(pf)}));const Wv=Symbol.for("AutoEnablePlugins"),Gv=Symbol.for("PluginService");var Yv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$v=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Xv=function(t,e){return function(i,s){e(i,s,t)}};let Kv=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&&xo.isBound(Wv)&&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(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Kv=Yv([qa(),Xv(0,Xa(po)),Xv(0,Za(Wv)),$v("design:paramtypes",[Object])],Kv);var qv=new Fa((t=>{t(Gv).to(Kv),function(t,e){t(po).toDynamicValue((({container:t})=>new go(e,t))).whenTargetNamed(e)}(t,Wv)})),Zv=new Fa((t=>{fo(t,yo)})),Jv=new Fa((t=>{t(Oh).to(Ih).inSingletonScope(),fo(t,Oh)})),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.type="static",this.offscreen=!1,this.global=Ao.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=zh({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()}};e_=Qv([qa(),t_("design:paramtypes",[])],e_);var i_=new Fa((t=>{t(e_).toSelf(),t(zp).toService(e_)}));var s_=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 n_(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function r_(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=n_(t,e,s);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;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=n_(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var l_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},h_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},c_=function(t,e){return function(i,s){e(i,s,t)}};let d_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):r_(e,th.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Ne,this.backupDirtyBounds=new Ne,this.global=Ao.global,this.layerService=Ao.layerService,y(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}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){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=ye(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.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,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:th.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:th.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,ep.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=o_(e,i,th.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&&!Ae(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Pm.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=ep.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Pm.free(n),ep.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||xo.get(ev);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let p_=class extends hm{constructor(){super(...arguments),this.numberType=Fu}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=Lc(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=Xp(u,p,c),_=qp(u,g),y=Yp(c),b=$p(d,f);if(!t.valid||!m)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())}};p_=u_([qa()],p_);var g_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 f_=class extends mm{constructor(){super(...arguments),this.numberType=Lu}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=Lc(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Xp(u,d,c),f=Yp(c);if(!t.valid||!p)return;if(!f)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())}};f_=g_([qa()],f_);var m_,v_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},__=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},y_=function(t,e){return function(i,s){e(i,s,t)}},b_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(m_||(m_={}));let x_=class extends d_{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=m_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new _o([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return b_(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:th.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:th.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 b_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return b_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>b_(this,void 0,void 0,(function*(){if(2!==t.count)yield a_(t,th.zIndex,((i,s)=>{if(this.status===m_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return b_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return b_(this,void 0,void 0,(function*(){this.rendering&&(this.status=m_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=m_.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return b_(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:()=>b_(this,void 0,void 0,(function*(){yield a_(t,th.zIndex,(t=>b_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};x_=v_([qa(),y_(0,Ka(rv)),y_(1,Xa(p_)),y_(2,Xa(f_)),y_(3,Xa(po)),y_(3,Za(bv)),__("design:paramtypes",[Array,Object,Object,Object])],x_);var S_=new Fa((t=>{t(bf).toSelf().inSingletonScope(),t(Mf).toSelf().inSingletonScope(),t(mv).to(d_),t(ev).to(x_),t(av).to(Km).inSingletonScope(),t(rv).toService(av),fo(t,ng),t(Sf).toSelf().inSingletonScope(),fo(t,dg),fo(t,rv),t(Mv).toSelf().inSingletonScope(),t(bv).toService(Mv),fo(t,bv)}));function A_(){A_.__loaded||(A_.__loaded=!0,xo.load(Gp),xo.load(Uv),xo.load(Lv),xo.load(Vv),xo.load(qv),function(t){t.load(Zv),t.load(Jv),t.load(i_)}(xo),function(t){t.load(S_)}(xo))}A_.__loaded=!1,A_();const k_=xo.get(bo);Ao.global=k_;const M_=xo.get(Dp);Ao.graphicUtil=M_;const T_=xo.get(Ip);Ao.transformUtil=T_;const w_=xo.get(Wu);Ao.graphicService=w_;const C_=xo.get(Fp);Ao.layerService=C_;class E_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class B_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=Ao.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=Ao.global.getRequestAnimationFrame();this.rafId=t((()=>{Ao.global.devicePixelRatio!==this.dpr&&(this.dpr=Ao.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=Ao.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class P_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.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))})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Ao.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())}}const L_=new Ve;class R_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Da.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()}));const e=this.pluginService.stage;e&&(e.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&&(L_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(L_,t.parent&&t.parent.globalTransMatrix)))})),e.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))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let O_;function I_(){!function(){if(null==O_)try{const t=document.createElement("canvas"),e=t.getContext("2d");O_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),O_&&(O_=!!document.createElement)}catch(t){O_=!1}}();const t=Ao.global&&Ao.global.env;return t?"browser"===t:O_}let D_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};D_._pluginClasses={};const F_="white";class z_ extends Lp{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:F_}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={}){var e,i;super({}),this.tickedBeforeRender=!0,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._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Bc,this.hooks={beforeRender:new _o(["stage"]),afterRender:new _o(["stage"]),afterClearScreen:new _o(["stage"]),afterClearRect:new _o(["stage"])},this.global=Ao.global,!this.global.env&&I_()&&this.global.setEnv("browser"),this.window=xo.get(mc),this.renderService=xo.get(So),this.pluginService=xo.get(Gv),this.layerService=xo.get(Fp),this.graphicService=xo.get(Wu),this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],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:F_,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(),t.autoRefresh&&this.enableAutoRefresh(),!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),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&_(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(i=t.rafId)&&void 0!==i?i:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new Gc(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(t=!1){t&&(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:f=[1,1,-1],color:m="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);const k=D_.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const M={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]}};if(this.camera)this.camera.params=M;else{const t=D_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=D_.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}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 E_))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new B_))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new P_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Ne;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new R_,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=D_.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=D_.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=D_.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();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.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();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===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),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.dirtyBounds&&this.dirtyBounds.clear(),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,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new re(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;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.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=xo.get(mc),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=xo.get(Rv)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}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},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())}))};let N_=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ve}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}}loadFont(t,e,i){return H_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}};N_=j_([qa()],N_);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},U_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let W_=class{constructor(){this._uid=Da.GenAutoIncrementId(),this.viewBox=new Ve,this.modelMatrix=new We(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){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}};W_=V_([qa(),U_("design:paramtypes",[])],W_);var G_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Y_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$_=function(t,e){return function(i,s){e(i,s,t)}};let X_=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=Ao.global}reInit(){this._init()}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.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 Ve).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 We(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),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new re(e.x,e.y),a=Lc(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 re(e.x,e.y);l.transformPoint(a,a);const o=Lc(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&&ip.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),ep.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function K_(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 q_(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function iy(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;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}))),oy=(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]},ly=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new Ne;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 oy(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return oy(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);ly(n[0],s,i),ly(n[1],e-s,i)}};let hy=!1;const cy=new Fa((t=>{hy||(hy=!0,t(tm).toSelf().inSingletonScope(),t(iv).to(tm).inSingletonScope(),t(rv).toService(iv),t(eg).toService(Sf),fo(t,eg))}));let dy=!1;const uy=new Fa((t=>{dy||(dy=!0,t(Tm).toSelf().inSingletonScope(),t(cv).to(Tm).inSingletonScope(),t(rv).toService(cv),t(jf).toSelf(),t(zf).toSelf(),t(lg).toService(jf),t(lg).toService(zf),t(lg).toService(Sf),fo(t,lg))}));let py=!1;const gy=new Fa((t=>{py||(py=!0,t(hm).toSelf().inSingletonScope(),t(p_).toSelf().inSingletonScope(),t(ov).to(hm).inSingletonScope(),t(rv).toService(ov))}));let fy=!1;const my=new Fa((t=>{fy||(fy=!0,t(mm).toSelf().inSingletonScope(),t(sv).to(mm).inSingletonScope(),t(rv).toService(sv),t(ig).toService(Sf),fo(t,ig),t(f_).toSelf().inSingletonScope())}));let vy=!1;const _y=new Fa((t=>{vy||(vy=!0,t(Bm).toSelf().inSingletonScope(),t(dv).to(Bm).inSingletonScope(),t(rv).toService(dv),t(hg).toService(Sf),fo(t,hg))}));let yy=!1;const by=new Fa((t=>{yy||(yy=!0,t(nm).toSelf().inSingletonScope(),t(nv).to(nm).inSingletonScope(),t(rv).toService(nv),t(sg).toService(Sf),fo(t,sg))}));let xy=!1;const Sy=new Fa((t=>{xy||(xy=!0,t(uv).to(Dm).inSingletonScope(),t(rv).toService(uv),t(cg).toService(Sf),fo(t,cg))}));let Ay=!1;const ky=new Fa((t=>{Ay||(Ay=!0,t(Sm).toSelf().inSingletonScope(),t(lv).to(Sm).inSingletonScope(),t(rv).toService(lv),t(ag).toService(Sf),fo(t,ag))}));let My=!1;const Ty=new Fa((t=>{My||(My=!0,t(hv).to(Gm).inSingletonScope(),t(rv).toService(hv),t(og).toService(Sf),fo(t,og))}));var wy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Cy=class{constructor(){this.numberType=Ou}reInit(){}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=Lc(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};Cy=wy([qa()],Cy);let Ey=!1;const By=new Fa((t=>{Ey||(Ey=!0,t(gv).to(Cy).inSingletonScope(),t(rv).toService(gv))}));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},Ly=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ry=class extends qf{constructor(){super(),this.numberType=Nu,this.builtinContributions=[Lm],this.init()}drawShape(t,e,i,s,n){const r=Lc(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=Xp(o,l,!0),d=Xp(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),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=Lc(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:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),If(e,i-t,s-n,v,_,f,!0)),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=Lc(t).richtext;this._draw(t,s,!1,i)}};Ry=Py([qa(),Ly("design:paramtypes",[])],Ry);let Oy=!1;const Iy=new Fa((t=>{Oy||(Oy=!0,t(pv).to(Ry).inSingletonScope(),t(rv).toService(pv))}));let Dy=!1;const Fy=new Fa((t=>{Dy||(Dy=!0,t(fv).to(tv).inSingletonScope(),t(rv).toService(fv),t(rg).toService(Sf),fo(t,rg))}));function zy(t){const e=[];for(let i=0;i=0&&n>=0&&sot.getInstance().info(`[VChart log]: ${t}`,...e),Ny=(t,e)=>(d(Uy.warnHandler)&&Uy.warnHandler.call(null,t,e),e?ot.getInstance().warn(`[VChart warn]: ${t}`,e):ot.getInstance().warn(`[VChart warn]: ${t}`)),Vy=(t,e,i)=>{if(!d(Uy.errorHandler))throw new Error(t);Uy.errorHandler.call(null,t,e)},Uy={silent:!1,warnHandler:!1,errorHandler:!1},Wy=I_(),Gy=Wy&&globalThis?globalThis.document:void 0;function Yy(t){return("desktop-browser"===t||"mobile-browser"===t)&&Wy}function $y(t){return Xy(t)||"mobile-browser"===t}function Xy(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let Ky=0;function qy(){return Ky>=9999999&&(Ky=0),Ky++}function Zy(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function Jy(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const Qy=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class tb extends Lp{constructor(t,e){super(t),this._skipRenderAttributes=Qy,(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,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?j(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.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,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.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 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"},Cb=(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 Eb extends l{constructor(t,e={}){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.startTime=Hc.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.pressTimeout=null}),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=Hc.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||wb(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=Cb(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=Hc.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=Cb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=wb(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&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("pointerleave",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("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=Hc.now()-i>this.config.press.time&&Cb(s[0],t){Ao.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;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){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){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},Pb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Lb=[0,0,0];let Rb=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t: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(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},Xl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},ql),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Zl),{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 We(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new We(1,0,0,1,0,0),this._clearMatrix=new We(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&ot.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new We(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&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 ep.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&&(ep.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(ep.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){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,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=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(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){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-=Vt;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(f,-2*y),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&&xp.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&&(Qu(Lb,[t,e,i],this.modelMatrix),t=Lb[0],e=Lb[1],i=Lb[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&&(Qu(Lb,[t,e,i],this.modelMatrix),t=Lb[0],e=Lb[1],i=Lb[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Qu(Lb,[e,i,s],this.modelMatrix),e=Lb[0],i=Lb[1],s=Lb[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,e=Ao.global.measureTextMethod){var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Ao.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Zl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Zl.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&&(Qu(Lb,[e,i,s],this.modelMatrix),e=Lb[0],i=Lb[1],s=Lb[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=yh(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:_h(this,a,this.dpr),r.strokeStyle=yh(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=De(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?this.font=t.font:this.font=De(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(t=!0,e=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(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>ep.free(t))),this.stack.length=0}};Rb.env="browser",Rb=Bb([qa(),Pb("design:paramtypes",[Object,Number])],Rb);var Ob=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ib=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Db=class extends hp{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Ao.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new Rb(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 Fb(t,e){return new Fa((i=>{i(Dh).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Fh).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Db.env="browser",Db=Ob([qa(),Ib("design:paramtypes",[Object])],Db);const zb=Fb(Db,Rb);var jb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nb=function(t,e){return function(i,s){e(i,s,t)}};let Vb=class extends X_{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,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=pc.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 Wb=class{constructor(){this.type="group",this.numberType=Iu}contains(t,e,i){return!1}};Wb=Ub([qa()],Wb);const Gb=new Fa(((t,e,i,s)=>{Gb.__vloaded||(Gb.__vloaded=!0,t(Mb).to(Wb).inSingletonScope(),t(Tb).toService(Mb),fo(t,Tb))}));Gb.__vloaded=!1;var Yb=Gb;const $b=new Fa(((t,e,i,s)=>{i(Vb)||t(Vb).toSelf().inSingletonScope(),i(Rv)?s(Rv).toService(Vb):t(Rv).toService(Vb)}));var Xb,Kb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)};let Zb=Xb=class extends W_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Xb.idprefix}_${Xb.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Ao.global,this.viewBox=new Ve,this.modelMatrix=new We(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:Xb.GenerateCanvasId(),canvasControled:!0};this.canvas=new Db(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 Db({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)}};Zb.env="browser",Zb.idprefix="visactor_window",Zb.prefix_count=0,Zb=Xb=Kb([qa(),qb("design:paramtypes",[])],Zb);const Jb=new Fa((t=>{t(Zb).toSelf(),t(vc).toDynamicValue((t=>t.container.get(Zb))).whenTargetNamed(Zb.env)}));var Qb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},ex=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 ix{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 sx(t,e=!1){const i=document.createElement("img");if(Ao.global.isImageAnonymous&&(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 nx=class extends N_{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 ix(t)}return new Ve}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 sx(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return sx(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:Da.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(...t){}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}}loadFont(t,e,i){return ex(this,void 0,void 0,(function*(){return new FontFace(t,_(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}};nx=Qb([qa(),tx("design:paramtypes",[])],nx);const rx=new Fa((t=>{rx.isBrowserBound||(rx.isBrowserBound=!0,t(nx).toSelf().inSingletonScope(),t(yo).toService(nx))}));function ax(t,e=!0){ax.__loaded||(ax.__loaded=!0,t.load(rx),t.load(zb),t.load(Jb),e&&function(t){t.load(Yb),t.load($b)}(t))}rx.isBrowserBound=!1,ax.__loaded=!1;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};let lx=class extends Rb{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}};lx.env="feishu",lx=ox([qa()],lx);var hx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let dx=class extends hp{constructor(t){super(t)}init(){this._context=new lx(this,this._dpr)}release(...t){}};dx.env="feishu",dx=hx([qa(),cx("design:paramtypes",[Object])],dx);const ux=Fb(dx,lx);var px=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gx=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 mx{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 vx=class extends W_{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new mx}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:Da.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new dx(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 dx({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()}};vx.env="feishu",vx=px([qa(),fx(0,Xa(bo)),gx("design:paramtypes",[Object])],vx);const _x=new Fa((t=>{t(vx).toSelf(),t(vc).toDynamicValue((t=>t.container.get(vx))).whenTargetNamed(vx.env)}));var yx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xx=function(t,e){return function(i,s){e(i,s,t)}};let Sx=class extends X_{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,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 op(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}};Sx=yx([qa(),xx(0,Xa(po)),xx(0,Za(eb)),xx(1,Xa(po)),xx(1,Za(Iv)),xx(2,Xa(po)),xx(2,Za(Dv)),bx("design:paramtypes",[Object,Object,Object])],Sx);const Ax=new Fa((t=>{Ax.__vloaded||(Ax.__vloaded=!0,fo(t,eb))}));Ax.__vloaded=!1;var kx=Ax;class Mx{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();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,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:_h(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}var Tx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Cx=function(t,e){return function(i,s){e(i,s,t)}};let Ex=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Bu}};Ex=Tx([qa(),Cx(0,Xa(iv)),wx("design:paramtypes",[Object])],Ex);let Bx=!1;const Px=new Fa(((t,e,i,s)=>{Bx||(Bx=!0,t(ib).to(Ex).inSingletonScope(),t(eb).toService(ib))}));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},Rx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ox=function(t,e){return function(i,s){e(i,s,t)}};let Ix=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Lu}};Ix=Lx([qa(),Ox(0,Xa(sv)),Rx("design:paramtypes",[Object])],Ix);let Dx=!1;const Fx=new Fa(((t,e,i,s)=>{Dx||(Dx=!0,t(sb).to(Ix).inSingletonScope(),t(eb).toService(sb))}));var zx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hx=function(t,e){return function(i,s){e(i,s,t)}};let Nx=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Ru}};Nx=zx([qa(),Hx(0,Xa(nv)),jx("design:paramtypes",[Object])],Nx);let Vx=!1;const Ux=new Fa(((t,e,i,s)=>{Vx||(Vx=!0,t(nb).to(Nx).inSingletonScope(),t(eb).toService(nb))}));class Wx{constructor(){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}}var Gx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},$x=function(t,e){return function(i,s){e(i,s,t)}};let Xx=class extends Wx{constructor(t){super(),this.canvasRenderer=t}};Xx=Gx([qa(),$x(0,Xa(gv)),Yx("design:paramtypes",[Object])],Xx);let Kx=!1;const qx=new Fa(((t,e,i,s)=>{Kx||(Kx=!0,t(ub).to(Xx).inSingletonScope(),t(Xx).toService(ub))}));var Zx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Jx=class{constructor(){this.type="image",this.numberType=Du}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Jx=Zx([qa()],Jx);let Qx=!1;const tS=new Fa(((t,e,i,s)=>{Qx||(Qx=!0,t(rb).to(Jx).inSingletonScope(),t(Jx).toService(rb))}));var eS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sS=function(t,e){return function(i,s){e(i,s,t)}};let nS=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Fu}};nS=eS([qa(),sS(0,Xa(ov)),iS("design:paramtypes",[Object])],nS);let rS=!1;const aS=new Fa(((t,e,i,s)=>{rS||(rS=!0,t(ab).to(nS).inSingletonScope(),t(eb).toService(ab))}));var oS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hS=function(t,e){return function(i,s){e(i,s,t)}};let cS=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=ju}};cS=oS([qa(),hS(0,Xa(hv)),lS("design:paramtypes",[Object])],cS);let dS=!1;const uS=new Fa(((t,e,i,s)=>{dS||(dS=!0,t(db).to(cS).inSingletonScope(),t(eb).toService(db))}));var pS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fS=function(t,e){return function(i,s){e(i,s,t)}};let mS=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=zu}};mS=pS([qa(),fS(0,Xa(lv)),gS("design:paramtypes",[Object])],mS);let vS=!1;const _S=new Fa(((t,e,i,s)=>{vS||(vS=!0,t(ob).to(mS).inSingletonScope(),t(eb).toService(ob))})),yS=new Ve;class bS{constructor(){this.type="rect",this.numberType=Hu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{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,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:_h(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;yS.setValue(i.x1,i.y1,i.x2,i.y2),yS.expand(-r/2),h=!yS.containsPoint(e)}}return s.highPerformanceRestore(),h}}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 extends bS{constructor(t){super(),this.canvasRenderer=t}};kS=xS([qa(),AS(0,Xa(cv)),SS("design:paramtypes",[Object])],kS);let MS=!1;const TS=new Fa(((t,e,i,s)=>{MS||(MS=!0,t(lb).to(kS).inSingletonScope(),t(eb).toService(lb))}));let wS=!1;const CS=new Fa(((t,e,i,s)=>{wS||(wS=!0,t(rb).to(Jx).inSingletonScope(),t(Jx).toService(rb))}));var ES=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},BS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},PS=function(t,e){return function(i,s){e(i,s,t)}};let LS=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Vu}};LS=ES([qa(),PS(0,Xa(dv)),BS("design:paramtypes",[Object])],LS);let RS=!1;const OS=new Fa(((t,e,i,s)=>{RS||(RS=!0,t(hb).to(LS).inSingletonScope(),t(eb).toService(hb))}));var IS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 DS=class{constructor(){this.type="text",this.numberType=Uu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};DS=IS([qa()],DS);let FS=!1;const zS=new Fa(((t,e,i,s)=>{FS||(FS=!0,t(cb).to(DS).inSingletonScope(),t(eb).toService(cb))})),jS=new Fa(((t,e,i,s)=>{i(Sx)||t(Sx).toSelf().inSingletonScope(),i(Rv)?s(Rv).toService(Sx):t(Rv).toService(Sx)}));class HS{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 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},VS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let US=class extends N_{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 HS(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 rd.call(t)}}getCancelAnimationFrame(){return t=>{rd.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(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};US=NS([qa(),VS("design:paramtypes",[])],US);const WS=new Fa((t=>{WS.isFeishuBound||(WS.isFeishuBound=!0,t(US).toSelf().inSingletonScope(),t(yo).toService(US))}));function GS(t,e=!0){GS.__loaded||(GS.__loaded=!0,t.load(WS),t.load(ux),t.load(_x),e&&function(t){t.load(kx),t.load(jS),t.load(Px),t.load(Fx),t.load(Ux),t.load(qx),t.load(tS),t.load(aS),t.load(uS),t.load(_S),t.load(TS),t.load(CS),t.load(OS),t.load(zS)}(t))}WS.isFeishuBound=!1,GS.__loaded=!1;var YS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$S=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let XS=class extends Rb{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 We(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};XS.env="node",XS=YS([qa(),$S("design:paramtypes",[Object,Number])],XS);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},qS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ZS=class extends hp{constructor(t){super(t)}init(){this._context=new XS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};ZS.env="node",ZS=KS([qa(),qS("design:paramtypes",[Object])],ZS);const JS=Fb(ZS,XS);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},tA=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 iA=class extends W_{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:Da.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new ZS(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new ZS({width:n,height:r,dpr:s,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}getImageBuffer(t="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){}};iA.env="node",iA=QS([qa(),eA(0,Xa(bo)),tA("design:paramtypes",[Object])],iA);const sA=new Fa((t=>{t(iA).toSelf(),t(vc).toDynamicValue((t=>t.container.get(iA))).whenTargetNamed(iA.env)}));var nA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let rA=class extends N_{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 rd.call(t)}}getCancelAnimationFrame(){return t=>{rd.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};rA=nA([qa()],rA);const aA=new Fa((t=>{aA.isNodeBound||(aA.isNodeBound=!0,t(rA).toSelf().inSingletonScope(),t(yo).toService(rA))}));function oA(t,e=!0){oA.__loaded||(oA.__loaded=!0,t.load(aA),t.load(JS),t.load(sA))}aA.isNodeBound=!1,oA.__loaded=!1;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},hA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cA=function(t,e){return function(i,s){e(i,s,t)}};let dA=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Bu}};dA=lA([qa(),cA(0,Xa(iv)),hA("design:paramtypes",[Object])],dA);let uA=!1;const pA=new Fa(((t,e,i,s)=>{uA||(uA=!0,t(pb).to(dA).inSingletonScope(),t(Tb).toService(pb))}));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},fA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mA=function(t,e){return function(i,s){e(i,s,t)}};let vA=class extends bS{constructor(t){super(),this.canvasRenderer=t}};vA=gA([qa(),mA(0,Xa(cv)),fA("design:paramtypes",[Object])],vA);let _A=!1;const yA=new Fa(((t,e,i,s)=>{_A||(_A=!0,t(yb).to(vA).inSingletonScope(),t(Tb).toService(yb))}));class bA extends qf{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=t.getGraphicTheme(),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,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:_h(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&ip.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}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){return function(i,s){e(i,s,t)}};let kA=class extends bA{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Fu}};kA=xA([qa(),AA(0,Xa(ov)),SA("design:paramtypes",[Object])],kA);let MA=!1;const TA=new Fa(((t,e,i,s)=>{MA||(MA=!0,t(vb).to(kA).inSingletonScope(),t(Tb).toService(vb))}));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 BA=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Lu}};BA=wA([qa(),EA(0,Xa(sv)),CA("design:paramtypes",[Object])],BA);let PA=!1;const LA=new Fa(((t,e,i,s)=>{PA||(PA=!0,t(gb).to(BA).inSingletonScope(),t(Tb).toService(gb))}));class RA extends qf{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();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,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&ip.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var OA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},IA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},DA=function(t,e){return function(i,s){e(i,s,t)}};let FA=class extends RA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Vu}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=t.getGraphicTheme(),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,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:_h(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&ip.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};FA=OA([qa(),DA(0,Xa(dv)),IA("design:paramtypes",[Object])],FA);let zA=!1;const jA=new Fa(((t,e,i,s)=>{zA||(zA=!0,t(bb).to(FA).inSingletonScope(),t(Tb).toService(bb))}));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},NA=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)}};let UA=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Ru}};UA=HA([qa(),VA(0,Xa(nv)),NA("design:paramtypes",[Object])],UA);let WA=!1;const GA=new Fa(((t,e,i,s)=>{WA||(WA=!0,t(fb).to(UA).inSingletonScope(),t(Tb).toService(fb))}));var YA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$A=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XA=function(t,e){return function(i,s){e(i,s,t)}};let KA=class extends RA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=Uu}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=t.getGraphicTheme(),{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(),f=l.width(),m=pg(a,u,n),v=ug(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,s.modelMatrix!==u&&ip.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};KA=YA([qa(),XA(0,Xa(uv)),$A("design:paramtypes",[Object])],KA);let qA=!1;const ZA=new Fa(((t,e,i,s)=>{qA||(qA=!0,t(xb).to(KA).inSingletonScope(),t(Tb).toService(xb))}));var JA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},QA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tk=function(t,e){return function(i,s){e(i,s,t)}};let ek=class extends bA{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=zu}};ek=JA([qa(),tk(0,Xa(lv)),QA("design:paramtypes",[Object])],ek);let ik=!1;const sk=new Fa(((t,e,i,s)=>{ik||(ik=!0,t(_b).to(ek).inSingletonScope(),t(Tb).toService(_b))}));var nk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ak=function(t,e){return function(i,s){e(i,s,t)}};let ok=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=ju}};ok=nk([qa(),ak(0,Xa(hv)),rk("design:paramtypes",[Object])],ok);let lk=!1;const hk=new Fa(((t,e,i,s)=>{lk||(lk=!0,t(Sb).to(ok).inSingletonScope(),t(Tb).toService(Sb))}));var ck=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uk=function(t,e){return function(i,s){e(i,s,t)}};let pk=class extends Wx{constructor(t){super(),this.canvasRenderer=t}};pk=ck([qa(),uk(0,Xa(gv)),dk("design:paramtypes",[Object])],pk);let gk=!1;const fk=new Fa(((t,e,i,s)=>{gk||(gk=!0,t(kb).to(pk).inSingletonScope(),t(Tb).toService(kb))}));var mk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_k=function(t,e){return function(i,s){e(i,s,t)}};let yk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Nu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};yk=mk([qa(),_k(0,Xa(pv)),vk("design:paramtypes",[Object])],yk);let bk=!1;const xk=new Fa(((t,e,i,s)=>{bk||(bk=!0,t(Ab).to(yk).inSingletonScope(),t(Tb).toService(Ab))}));var Sk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ak=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kk=function(t,e){return function(i,s){e(i,s,t)}};let Mk=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=Du}};Mk=Sk([qa(),kk(0,Xa(fv)),Ak("design:paramtypes",[Object])],Mk);let Tk=!1;const wk=new Fa(((t,e,i,s)=>{Tk||(Tk=!0,t(mb).to(Mk).inSingletonScope(),t(Tb).toService(mb))})),Ck=I_();function Ek(){Ek.__loaded||(Ek.__loaded=!0,pf.RegisterGraphicCreator("arc",of),xo.load(cy),xo.load(Ck?pA:Px))}Ek.__loaded=!1;const Bk=Ek;function Pk(){Pk.__loaded||(Pk.__loaded=!0,pf.RegisterGraphicCreator("area",nf),xo.load(my),xo.load(Ck?LA:Fx))}Pk.__loaded=!1;const Lk=Pk;function Rk(){Rk.__loaded||(Rk.__loaded=!0,pf.RegisterGraphicCreator("circle",Sg),xo.load(by),xo.load(Ck?GA:Ux))}Rk.__loaded=!1;const Ok=Rk;function Ik(){Ik.__loaded||(Ik.__loaded=!0,pf.RegisterGraphicCreator("glyph",zg),xo.load(By),xo.load(Ck?fk:qx))}Ik.__loaded=!1;const Dk=Ik;function Fk(){Fk.__loaded||(Fk.__loaded=!0,pf.RegisterGraphicCreator("group",Rp))}Fk.__loaded=!1;const zk=Fk;function jk(){jk.__loaded||(jk.__loaded=!0,pf.RegisterGraphicCreator("image",Wg),xo.load(Fy),xo.load(Ck?wk:tS))}jk.__loaded=!1;const Hk=jk;function Nk(){Nk.__loaded||(Nk.__loaded=!0,pf.RegisterGraphicCreator("line",Lg),xo.load(gy),xo.load(Ck?TA:aS))}Nk.__loaded=!1;const Vk=Nk;function Uk(){Uk.__loaded||(Uk.__loaded=!0,pf.RegisterGraphicCreator("path",tf),xo.load(ky),xo.load(Ck?sk:_S))}Uk.__loaded=!1;const Wk=Uk;function Gk(){Gk.__loaded||(Gk.__loaded=!0,pf.RegisterGraphicCreator("polygon",cf),xo.load(Ty),xo.load(Ck?hk:uS))}Gk.__loaded=!1;const Yk=Gk;function $k(){$k.__loaded||($k.__loaded=!0,pf.RegisterGraphicCreator("rect",Dg),xo.load(uy),xo.load(Ck?yA:TS))}$k.__loaded=!1;const Xk=$k;function Kk(){Kk.__loaded||(Kk.__loaded=!0,pf.RegisterGraphicCreator("richtext",Zg),xo.load(Iy),xo.load(Ck?xk:CS))}Kk.__loaded=!1;const qk=Kk;function Zk(){Zk.__loaded||(Zk.__loaded=!0,pf.RegisterGraphicCreator("shadowRoot",uf))}Zk.__loaded=!1;const Jk=Zk;function Qk(){Qk.__loaded||(Qk.__loaded=!0,pf.RegisterGraphicCreator("symbol",Eg),xo.load(_y),xo.load(Ck?jA:OS))}Qk.__loaded=!1;const tM=Qk;function eM(){eM.__loaded||(eM.__loaded=!0,pf.RegisterGraphicCreator("text",Tg),xo.load(Sy),xo.load(Ck?ZA:zS))}eM.__loaded=!1;const iM=eM;function sM(){zk(),Xk()}const nM=-.5*Math.PI,rM=1.5*Math.PI,aM="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 oM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(oM||(oM={}));const lM={[oM.selectedReverse]:{},[oM.selected]:{},[oM.hover]:{},[oM.hoverReverse]:{}},hM={container:"",width:30,height:30,style:{}},cM="scrollDrag";function dM(){return"browser"===k_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const uM={debounce:St,throttle:At};sM();let pM=class t extends tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},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=_t(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=_t(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=>{this._clearDragEvents();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});const r=dM(),a="browser"===k_.env?k_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=_t(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},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:uM[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:yt(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=yt(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(cM,{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",uM[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===k_.env?k_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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(yt(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:ai(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,[s,n,r,a]=ai(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,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=_t(t[0],0,1),c=_t(t[1],0,1),d=_t(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=yt(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?yt([a+i*n,a+s*n],a,n-l):yt([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=dM(),e="browser"===k_.env?k_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===k_.env?k_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};pM.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,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};var gM,fM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 mM=gM=class{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new Ne).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Ut(t.deltaX)>Ut(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ve,e.addEventListener("wheel",this.scroll),this.params=gM.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(cM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new pM(v),h.name=a,e.add(h),h.isScrollBar=!0);const _=this.childrenBounds,{scrollX:y,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/_.width(),1),e=Math.max(Math.min(y/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/_.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=i{i(mM)||(t(mM).toSelf(),t(Wv).toService(mM))}));function _M(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&_M(t,e)}))}const yM=t=>!u(t)&&!1!==t.visible;function bM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function xM(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 AM=["#ffffff","#000000"];function kM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ii(t).toHex(),o=new ii(e).toHex();return MM(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(...AM);for(const n of a)if(t!==n&&MM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function MM(t,e,i,s,n){if("lightness"===n){const i=ii.getColorBrightness(new ii(e));return ii.getColorBrightness(new ii(t))<.5?i>=.5:i<.5}return s?TM(t,e)>s:"largeText"===i?TM(t,e)>3:TM(t,e)>4.5}function TM(t,e){const i=wM(t),s=wM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function wM(t){const e=ni(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 CM(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 EM(t,e){return[t[0]*e,t[1]*e]}function BM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function PM(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=Qt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const LM=(t,e,i,s)=>new Fe(Object.assign({defaultFontParams:Object.assign({fontFamily:aM,fontSize:14},s),getTextBounds:i?void 0:mf,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function RM(t,e,i={}){if(!t)return{width:0,height:0};const s=mf({text:t,fontFamily:e.fontFamily||i.fontFamily||aM,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 OM(t,e="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 IM(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function DM(t,e="type"){const i=OM(t,e);return"rich"===i?pf.richtext(IM(t)):("html"===i?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"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),pf.text(t))}function FM(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 zM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function jM(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 HM(t,e){const{dx:i,dy:s}=jM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function NM(){zk(),Xk(),tM(),qk(),iM()}var VM=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&&(T=h,R.setAttribute("maxLineWidth",h-b[1]-b[2]))),k=0,M=0;let H=0;"left"===z||"start"===z?H=1:"right"===z||"end"===z?H=-1:"center"===z&&(H=0),H?H<0?(k-=T,A&&A.setAttribute("x",(A.attribute.x||0)-O),x.setAttribute("x",-b[1]-E)):H>0&&x.setAttribute("x",b[3]):(k-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-O/2),x.setAttribute("x",-E/2));const N="right"===y||"end"===y,V="left"===y||"start"===y,U=(t,e)=>{"richtext"===R.type?R.setAttributes({x:t,textAlign:e,textConfig:Y(R.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):R.setAttributes({x:t,textAlign:e})};if((y?"center"===y:_)&&H){const t=T-b[1]-b[3],e=O+E,i=1===H?(t-e)/2+E+O/2:b[0]+E-(T/2+e/2-E)+O/2;if(U(i,"center"),A){const t=i-O/2-E+F/2;A.setAttributes({x:t})}}if(V&&1!==H){const t=T-b[1]-b[3],e=0===H?-t/2+E/2:-T+b[3]+b[1]+E;if(U(e+E,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(N&&-1!==H){const t=T-b[1]-b[3],e=0===H?t/2+E/2:t;if(U(e,"right"),A){const t=e-O-E+F/2;A.setAttributes({x:t})}}"middle"===j?(M-=w/2,A&&A.setAttribute("y",0)):"bottom"===j?(M-=w,A&&A.setAttribute("y",-I/2),x.setAttribute("y",-b[2])):"top"===j&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",I/2)),P(null==m?void 0:m.text)||(R.states=m.text);const{visible:W}=a,G=VM(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},G),{visible:W&&!!s,width:T,height:w,x:k,y:M}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),G.customShape){const e=G.customShape;t.pathProxy=t=>e(this,t,new Wl)}this._bgRect=t}this._textShape=R,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:j({},UM.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}UM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const WM={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}},GM={poptip:j({},WM)};var YM=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);nA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(y(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),I.setAttribute("x",I.attribute.x+e),o.setAttribute("dx",$t(Yt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),I.setAttribute("y",I.attribute.y+e),o.setAttribute("dy",$t(Yt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?jt/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:jt/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?jt/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?jt/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:jt/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?jt/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?jt:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:jt,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?jt:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}QM.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"},panel:{},maxWidthPercent:.8,space:8,padding:10};var tT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 eT=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};j(s,QM.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new QM(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};j(e,GM.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,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),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}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}};eT=tT([qa()],eT);var iT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 sT{constructor(){this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(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)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}let nT=class extends sT{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};nT=iT([qa()],nT);let rT=class extends sT{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}};rT=iT([qa()],rT);const aT=new Fa(((t,e,i,s)=>{i(eT)||(t(eT).toSelf().inSingletonScope(),t(dg).toService(eT)),i(nT)||(t(nT).toSelf(),t(Wv).toService(nT)),i(rT)||(t(rT).toSelf(),t(Wv).toService(rT))}));class oT extends tb{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}zk(),Vk();class lT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},lT.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})}}lT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},zk(),Xk();class hT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},hT.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})}}hT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},zk(),Bk();class cT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},cT.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=ae.distancePP(t,e);this.setAttribute("radius",i)}}cT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},zk(),Bk();class dT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},dT.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=nM,endAngle:s=rM}=this.attribute,n=s-i,r=le(ue(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}dT.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},zk(),Wk();class uT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},uT.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=ce(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=ae.distancePP(t,e);this.setAttribute("radius",i)}}function pT(){zk(),Vk(),Yk(),tM()}function gT(){zk(),Vk(),Bk(),tM()}uT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},pT();class fT extends tb{getStartAngle(){return pe(this._startAngle)}getEndAngle(){return pe(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},fT.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=pf.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),P(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=pf.line;Y(i)[0].cornerRadius&&(t=pf.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"),P(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:f=12}=t;let m,v;"start"===i?(m={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)):(m={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=pf.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(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}}fT.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}}},gT();class mT extends fT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},fT.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=pf.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"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var vT,_T;!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.labelHoverOnAxis="axis-label-hover-on-axis",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",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(vT||(vT={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(_T||(_T={}));const yT={[_T.selectedReverse]:{},[_T.selected]:{},[_T.hover]:{},[_T.hoverReverse]:{}},bT={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}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},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}}},xT={size:8,stroke:"#000",lineWidth:1,zIndex:1};const ST=Math.sin(Math.PI/10);function AT(t,e=ST){const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function kT(t,e=ST){const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function MT(t){const e={};return _M(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function TT(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function wT(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return EM(r,(s?-1:1)*(n?-1:1)*t/BM(r))}function CT(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function BT(t,e,i){var s;if(kT(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>ze(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>ze(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>je(n,r)}function PT(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(oM.hover,!0),_M(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(oM.hoverReverse,!0)})),s):i},RT=(t,e,i)=>i?(_M(e,(t=>{t.name&&!P(t.states)&&(t.removeState(oM.hoverReverse),t.removeState(oM.hover))})),null):i,OT=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(oM.selected)?(_M(e,(t=>{t.name&&!P(t.states)&&(t.removeState(oM.selectedReverse),t.removeState(oM.selected))})),null):s.name&&!P(s.states)?(s.addState(oM.selected,!0),_M(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(oM.selectedReverse,!0)})),s):i};class IT extends tb{_prepareAnimate(t){if(!1!==this.attribute.animation){const{animation:e,animationEnter:i,animationExit:s,animationUpdate:n}=this.attribute,r=g(e)?e:{};this._animationConfig={enter:!1!==i&&j({},t,r,null!=i?i:{}),exit:!1!==s&&j({},t,r,null!=s?s:{}),update:!1!==n&&(y(n)?n:j({},t,r,null!=n?n:{}))}}else this._animationConfig={enter:!1,exit:!1,update:!1}}}const DT={type:"default",duration:300,easing:"linear"};class FT extends IT{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=LT(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=RT(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=OT(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=pf.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._prepare(),this._prevInnerView=this._innerView&&MT(this._innerView),this.removeAllChild(!0),this._innerView=pf.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation()}_prepare(){this._prepareAnimate(DT)}_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=pf.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=vT.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=pf.group({x:0,y:0,pickable:!1});t.name=vT.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",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=pf.group({x:0,y:0,pickable:!1});i.name=vT.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=pf.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=vT.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=lM;else{const t=this.data[s],e=j({},lM,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=pf.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=vT.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=lM;else{const i=j({},lM,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=pf.group({x:0,y:0,pickable:!1});return r.name=`${vT.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=DM(this._getLabelAttribute(t,e,n,i));if(a.name=vT.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=lM;else{const s=j({},lM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new UM(Object.assign({},e));i.name=vT.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return TT(t,this.getVerticalVector(e,i,t))}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;Ut(s[0])>Ut(s[1])?o=jt/2*(l.x>e.x?1:-1):h=jt/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+L(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+L(this.attribute,"label.space",4))*s);const f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:_}=this.attribute.label;_=d(_)?j({},bT.label.style,_(t,e,i,s)):_;_=j(this.getLabelAlign(m,o,_.angle),_),d(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let y=_.react;return d(y)&&(y=y(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,_)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==_?void 0:_.fontSize,type:h}),_),{react:y})}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}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},_M(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(e.setFinalAttributes(e.attribute),r){r.release();const i=r.attribute,a=e.getFinalAttribute(),o=function(t,e,i){const s={};for(const i in e)i in t&&U(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}(i,a);let l=Object.keys(o).length>0;if("opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l){this._newElementAttrMap[e.id]={state:"update",node:e,attrs:e.attribute};const i=r.attribute;e.setAttributes(i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}])}}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const zT={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&&BT(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function jT(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function HT(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=d(n)?n:zT[n]||zT.parity;if(s.length>=3&&PT(s,r)){do{s=a(s,r)}while(s.length>=3&&PT(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=$(i);BT(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),HT(l,s,n,(t=>BT(t,l,r))),HT(h,s,o,(t=>BT(t,h,r)||!(!n||t===l)&&BT(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function VT(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},GT(t,e.attribute.angle)),{angle:WT(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({},YT(t,e.attribute.angle)),{angle:WT(e.attribute.angle)}))}))}(t,e),function(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=Te({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function WT(t=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 GT(t,e=0){let 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=WT(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 YT(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=WT(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 $T(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!u(h),d=c?Math.cos(h):1,p=c?Math.sin(h):0,f=kT(h),m=AT(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===_||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/d,l=Math.abs(i/p);if(y&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(d);r=Math.min(t,l)}else if(y&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(d);r=Math.min(t,l)}else r=l}else r=Math.abs(i/d);k(t.attribute.maxLineWidth)&&(r=k(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function XT(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class KT{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,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=BM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return EM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class qT{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-qT.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*qT.bounceIn(2*t):.5*qT.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Vt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Vt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Vt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Vt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Vt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Vt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Vt/e)*.5+1}}static registerFunc(t,e){qT[t]=e}}function ZT(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}qT.quadIn=qT.getPowIn(2),qT.quadOut=qT.getPowOut(2),qT.quadInOut=qT.getPowInOut(2),qT.cubicIn=qT.getPowIn(3),qT.cubicOut=qT.getPowOut(3),qT.cubicInOut=qT.getPowInOut(3),qT.quartIn=qT.getPowIn(4),qT.quartOut=qT.getPowOut(4),qT.quartInOut=qT.getPowInOut(4),qT.quintIn=qT.getPowIn(5),qT.quintOut=qT.getPowOut(5),qT.quintInOut=qT.getPowInOut(5),qT.backIn=qT.getBackIn(1.7),qT.backOut=qT.getBackOut(1.7),qT.backInOut=qT.getBackInOut(1.7),qT.elasticIn=qT.getElasticIn(1,.3),qT.elasticOut=qT.getElasticOut(1,.3),qT.elasticInOut=qT.getElasticInOut(1,.3*1.5),qT.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),qT.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},qT.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)qT[`flicker${t}`]=e=>ZT(e,t);for(let t=2;t<10;t++)qT[`aIn${t}`]=e=>t*e*e+(1-t)*e;function JT(t,e,i){return t+(e-t)*i}const QT=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=JT(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=JT(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=JT(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=JT(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=JT(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=JT(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=JT(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=JT(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=JT(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=pp(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?fp(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=pp(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?fp(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=JT(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=JT(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=JT(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=JT(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=JT(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=JT(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=JT(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=JT(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=JT(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=id(e,i,s),r.addUpdateBoundTag()}}};function tw(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.setAttributes(this.target.attribute)},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=qT[s])&&void 0!==n?n:qT.linear:qT.linear,"wait"===t&&(this.onUpdate=ew),this.id=Da.GenAutoIncrementId(),this.syncAttributeUpdate=ew}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(_(i)&&_(s)){const n=dp.Get(i,cp.Color255),r=dp.Get(s,cp.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(QT["fill"===e?"fillPure":"strokePure"])}else QT[e]?t.push(QT[e]):t.push(tw)}else QT[e]?t.push(QT[e]):t.push(tw)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate;this.target.animates.forEach((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const i=e.getStartProps();this.propKeys.forEach((t=>{null!=i[t]&&e.preventAttr(t)}))}))}deleteSelfAttr(t){var e;delete this.props[t],this.fromProps&&delete this.fromProps[t];const i=this.propKeys.indexOf(t);-1!==i&&(this.propKeys.splice(i,1),null===(e=this.interpolateUpdateFunctions)||void 0===e||e.splice(i,1))}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){this.target.setAttributes(this.props),t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class sw extends iw{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();this.target.setAttributes(t)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class nw extends l{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Da.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Io.END?this.removeAnimate(t,!0):t.status!==Io.RUNNING&&t.status!==Io.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const rw=new nw;rw.isGlobal=!0;class aw{constructor(t=Da.GenAutoIncrementId(),e=rw,i){this.id=t,this.status=Io.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){return this.target=t,this.target.animates||(this.target.animates=new Map),this.target.animates.set(this.id,this),this.onRemove((()=>{this.stop(),this.target.animates.delete(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new iw(Oo.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new sw(Oo.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new iw(Oo.from,t,e,i);return this._firstStep?(this._lastStep.append(s),this._lastStep=s):(this._firstStep=s,this._lastStep=s),this.updateDuration(),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Io.RUNNING&&(this.status=Io.PAUSED)}resume(){this.status===Io.PAUSED&&(this.status=Io.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this._preventAttrs.add(t),delete this._startProps[t],delete this._endProps[t];let e=this._firstStep;for(;e;)e.deleteSelfAttr(t),e=e.next}preventAttrs(t){t.forEach((t=>this._preventAttrs.add(t)))}validAttr(t){return!this._preventAttrs.has(t)}runCb(t){var e;return null===(e=this._lastStep)||void 0===e||e.onEnd(t),this}startAt(t){return this._startTime=t,this}customInterpolate(t,e,i,s,n,r){return!1}getFromValue(){return this._startProps}getToValue(){return this._endProps}stop(t){let e=this._firstStep;for(;e;)e.stop(),e=e.next;this.status!==Io.END&&this.onEnd(),this.status=Io.END,this.target&&("start"===t?this.target.setAttributes(this._startProps):"end"===t?this.target.setAttributes(this._endProps):t&&this.target.setAttributes(t))}release(){this.status=Io.END,this._onRemove&&this._onRemove.forEach((t=>t())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Io.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),void(this.status=Io.END);this.status=Io.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&this.target.setAttributes(this._startProps);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const ow=new Mo;class lw{constructor(){this.released=!1}tick(t,e){ow.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class hw extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Ro.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Ro.INITIAL,Ao.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),Ao.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new lw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Ro.INITIAL&&(this.status=Ro.PAUSE,!0)}resume(){return this.status!==Ro.INITIAL&&(this.status=Ro.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Ro.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Ro.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Ro.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Ro.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Ro.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Ro.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,Ao.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}function uw(t){if(!t||!d(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1}return 2}dw.getInstance();class pw{static registerBuiltInAnimate(t,e){pw.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;y(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:pw.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=uw(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:pw.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=uw(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=k(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){Array.isArray(t)?t.forEach((t=>this._execute(t))):this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,u;const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:_=0,duration:y=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:M,custom:T,customType:w,controlOptions:C}=t,E=e.animate();E.priority=k;const B=d(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],L=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&L&&(i=null!==(h=P[L])&&void 0!==h?h:i),E.startAt(b);const R=i*x+B;R>0&&E.wait(R);let O=null,I=t.to,D=t.from;I||(O||(O=this.createPropsFromChannel(g,e)),I=O.props),D||(O||(O=this.createPropsFromChannel(g,e)),D=O.from),O.attrOutChannel&&e.setAttributes(O.attrOutChannel),this._handleRunAnimate(E,T,w,D,I,y,m,f,C,M,p,e);let F=0;x&&(F=x*(s-i-1));const z=d(_)?_(null===(u=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===u?void 0:u[0],e,{}):_;return z>0&&(F+=z),F>0&&E.wait(F),S&&S>0&&E.loop(S),A&&E.bounce(!0),E}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,u){var p,g,f,m,v,_,y,b;if(e&&i){i=uw(e);let c=this.resolveValue(o,u);"function"==typeof c&&(c=c(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),c=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},c);const x=d(h)?h.call(null,null!==(_=c&&(null===(v=c.data)||void 0===v?void 0:v[0]))&&void 0!==_?_:null===(b=null===(y=u.context)||void 0===y?void 0:y.data)||void 0===b?void 0:b[0],u,c):h;c.options=x,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:u=0}=t,p=d(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=d(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;u||(d||(d=this.createPropsFromChannel(a,i)),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i)),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const g=null!==(n=t.custom)&&void 0!==n?n:pw.builtInAnimateMap[r],f=t.custom?t.customType:uw(g);this._handleRunAnimate(e,g,f,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e){var i;const s={};let n=null;if(!t)return{from:n,props:s,attrOutChannel:null};const r={};let a=!1;const o=null===(i=e.context)||void 0===i?void 0:i.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===o[e]||(t[e]={to:o[e]}),t)),{})),Object.keys(t).forEach((i=>{var r,a,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?s[i]=h.to(null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,{}):s[i]=h.to),void 0!==h.from&&(n||(n={}),"function"==typeof h.from?n[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):n[i]=h.from)})),o)for(const t in o){const e=o[t];void 0!==e&&(s.hasOwnProperty(t)||(r[t]=e,a=!0))}return{from:n,props:s,attrOutChannel:a?r:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}executeItem(t,e,i=0,s=1){return Array.isArray(t)?t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean):[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Io.END),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}pw.builtInAnimateMap={};const gw="appear",fw="disappear",mw="update",vw="highlight",_w="unhighlight";class yw{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class bw{constructor(t){this.stateList=null,this.graphic=t}applyState(t,e,i){const s=dw.getInstance(),n=[],r=[];if(this.stateList&&this.stateList.length?t.forEach(((t,i)=>{const a={allowTransition:!0,stopOriginalTransition:!0};this.stateList.forEach((e=>{const i=s.isTransitionAllowed(e.state,t,this.graphic);a.allowTransition=a.allowTransition&&i.allowTransition})),a.allowTransition&&(r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new pw(this.graphic)}),this.stateList.forEach((e=>{s.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&n.push(e)})))})):t.forEach(((t,i)=>{r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new pw(this.graphic)})})),n.forEach((t=>{t.executor.stop(null,!1)})),r.length){r[0].executor.execute(r[0].animationConfig);for(let t=0;t{e&&e.executor.execute(e.animationConfig),this.stateList=this.stateList.filter((t=>t!==s)),t===r.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!n.includes(t))):this.stateList=[],this.stateList.push(...r)}applyAppearState(t,e){this.applyState([gw],[{name:gw,animation:t}],e)}applyDisappearState(t,e){this.applyState([fw],[{name:fw,animation:t}],e)}applyUpdateState(t,e){this.applyState([mw],[{name:mw,animation:t}],e)}applyHighlightState(t,e){this.applyState([vw],[{name:vw,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([_w],[{name:_w,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class xw{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new bw(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new yw(t)),t._animationStateStore}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return(new xw)._getAnimationStateManager(t),t}}class Sw{getAttributes(t=!1){return t&&this.finalAttribute?this.finalAttribute:this.attribute}animate(t){var e,i,s;const n=new aw(null==t?void 0:t.id,null!==(i=null!==(e=null==t?void 0:t.timeline)&&void 0!==e?e:this.stage&&this.stage.getTimeline())&&void 0!==i?i:rw,null==t?void 0:t.slience);if(n.bind(this),t){const{onStart:e,onEnd:i,onRemove:s}=t;null!=e&&n.onStart(e),null!=i&&n.onEnd(i),null!=s&&n.onRemove(s)}return null===(s=this.stage)||void 0===s||s.ticker.start(),n}createTimeline(){return new nw}createTicker(t){return new hw(t)}setFinalAttributes(t){this.finalAttribute||(this.finalAttribute={}),Object.assign(this.finalAttribute,t)}initFinalAttributes(t){this.finalAttribute=t}initAnimateExecutor(){this._animateExecutor||(this._animateExecutor=new pw(this))}executeAnimation(t){return this.initAnimateExecutor(),this._animateExecutor.execute(t),this}executeAnimations(t){return this.initAnimateExecutor(),t.forEach((t=>{this._animateExecutor.execute(t)})),this}getFinalAttribute(){return this.finalAttribute}getGraphicAttribute(t,e=!1){return!e&&this.finalAttribute?this.finalAttribute[t]:this.attribute[t]}pauseAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function Aw(){G(Bp,xw),G(Bp,Sw)}class kw extends iw{constructor(t,e,i,s,n){super("customAnimate",e,i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class Mw extends kw{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class Tw{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new pw(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttr(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function ww(t){return new Tw(t)}class Cw extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,this.target.setAttribute("text",n)}}const Ew=1e3,Bw="quadInOut",Pw=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],Lw=(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=pp(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Rw=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?ey(t):[],n=ey(e);i&&s&&(i.fromTransform&&iy(s,i.fromTransform.clone().getInverse()),iy(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})))},Iw=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Dw=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Iw.includes(n))return;const r=e[n];if(!u(r)&&!u(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?dp.Get(t,cp.Color255):t;i.push({from:y(t[n])?t[n].map(e):e(t[n]),to:y(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class Fw extends kw{constructor(t,e,i){super({},{},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;Rw(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&Lw(this.otherAttrs,i,e),this.target.setAttributes(i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const zw=(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=Ow(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Dw(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new Fw({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Ew,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Bw);return c.play(d),c};class jw extends kw{constructor(t,e,i){super({},{},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;Rw(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&&Lw(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Hw=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Pw.includes(t))(i)||(e[i]=t[i])})),e},Nw=(t,e,i)=>{const s=Hw(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),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=Ao.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},Vw=(t,e,i)=>{const s=[],n=i?null:Hw(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:Hw(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=Rg(t.attribute),n=ny(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(Ao.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=ny(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(Ao.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=ny(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(Ao.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 ry(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 ry(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(Ao.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:ay(i)}];const s=[];return ly(i,e,s),s})(t,e).forEach((t=>{s.push(Ao.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 ly(l,e,h),h})(t,e).forEach((t=>{s.push(Ao.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=ey(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(Ao.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(Ao.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Nw(t,s,e),s};class Ww extends kw{constructor(t,e,i,s,n){super(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(){super.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:qo.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:qo.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:qo.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Gw extends Ww{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;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=Ao.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!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:y/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(_+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 Yw extends Ww{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:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=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=Ao.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:f,height:"in"===v&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===y?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class $w extends kw{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){super.onBind();const{points:t,segments:e}=this.target.attribute,{points:i,segments:s}=this.target.getFinalAttribute();this.from={points:t,segments:e},this.to={points:i,segments:s},this.props=this.to;const n=this.getPoints(this.from),r=this.getPoints(this.to,!0);this.fromPoints=n?Array.isArray(n)?n:[n]:[],this.toPoints=r?Array.isArray(r)?r:[r]:[];const a=new Map;this.fromPoints.forEach((t=>{t.context&&a.set(t.context,t)}));let o,l,h=1/0,c=-1/0;for(let t=0;t=0;t-=1)if(a.has(this.toPoints[t].context)){c=t,l=a.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(c)?(this.clipRange=this.toPoints[c][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[c][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=_t(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let d=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=a.get(t.context);return i?(d=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ec&&l?[l,t]:[d,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new re(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(t)return Object.keys(this.to).forEach((t=>{this.target.attribute[t]=this.to[t]})),this.target.addUpdatePositionTag(),void this.target.addUpdateShapeAndBoundsTag();if(this.points=this.points.map(((t,i)=>{const s=ed(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));this.target.setAttributes({clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.target.attribute.segments=e}else this.target.attribute.points=this.points;this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Xw extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0}));const o=this.target.getFinalAttribute();o&&this.target.setAttributes(o),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(a)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Kw extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Object.assign(this.target.attribute,i),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class qw extends Xw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class Zw extends Kw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}const Jw=(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.getFinalAttribute();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.getFinalAttribute();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)};class Qw extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this._updateFunction=null}updateStartAngle(t){this.target.attribute.startAngle=this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t}updateEndAngle(t){this.target.attribute.endAngle=this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class tC extends Qw{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=Jw(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r),this.determineUpdateFunction()}}class eC extends Qw{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class iC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/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:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class sC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const nC=(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,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:u(l)?void 0:c,height:u(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class rC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=nC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class aC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:u(o)?void 0:h,height:u(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const oC=(t,e,i)=>{const s=t.getFinalAttribute().points,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.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class lC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(this.target.attribute.points=r.map(((t,i)=>ed(r[i],a[i],e))),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class hC extends lC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:oC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class cC extends lC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:oC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const dC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class uC extends lC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:dC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class pC extends lC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:dC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const gC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class fC extends lC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:gC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class mC extends lC{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:gC(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const vC=(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.getFinalAttribute(),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.getFinalAttribute();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)};class _C extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class yC extends _C{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=vC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}}class bC extends _C{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const xC=(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.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:u(a)?void 0:l,width:u(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class SC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=xC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class AC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class kC extends Mw{onBind(){var t;const e=ww(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;this.target.setAttributes({x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class MC extends Mw{onBind(){const t=ww(this.target);this._animator=t;const e=this.duration,i=this.easing,{config:s,diffAttrs:n}=this.params;t.animate(this.target,{type:"to",to:Object.assign({},n),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},n)}}),this.completeBind(t)}deleteSelfAttr(t){super.deleteSelfAttr(t),this._animator.deleteSelfAttr(t)}tryPreventConflict(){}}function TC(){zk(),Vk(),qk(),iM(),pw.registerBuiltInAnimate("axisEnter",kC),pw.registerBuiltInAnimate("axisUpdate",MC)}var wC=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{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=pf.group({zIndex:999});e.name=vT.axisBreak,e.id=this._getNodeId(`${vT.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=j({},xT,s),a=null!==(e=r.size)&&void 0!==e?e:xT.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=pf.symbol(Object.assign({x:s.x,y:s.y},o));l.name=vT.axisBreakSymbol;const h=pf.symbol(Object.assign({x:n.x,y:n.y},o));h.name=vT.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=pf.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=vT.background,n.id=this._getNodeId("background"),n.states=j({},yT,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new UM(Object.assign({},t));e.name=vT.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=wC(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];P(l)||(c.state={line:j({},yT,l),symbol:j({},yT,l)});const d=new fT(c);d.name=vT.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return gt(t[0],0)?gt(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}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:d}=s,p=wC(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),_=this.getRelativeVector();let y=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+L(this.attribute,"label.space",4);y+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===_[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?y+=i+(e-1)*t:y=0}else if(0===_[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;y+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}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.getActualOffset(x),A=this.getVerticalCoord(v,S,!1),M=this.getVerticalVector(S,!1,{x:0,y:0});let T,w,{angle:C}=p;if(T="start"===n?"start":"end"===n?"end":"center",u(C)&&o){C=PM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;w=1==-1*t?"bottom":"top"}else T=this.getTextAlign(M),w=this.getTextBaseline(M,!1);let E=d;if(u(E)){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(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=s-S;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=s-S}const B=Object.assign(Object.assign(Object.assign({},A),p),{maxWidth:E,textStyle:Object.assign({textAlign:T,textBaseline:w},a),state:{text:j({},yT,c.text),shape:j({},yT,c.shape),panel:j({},yT,c.background)}});return B.angle=C,l&&l.visible&&(B.shape=Object.assign({visible:!0},l.style),l.space&&(B.space=l.space)),h&&h.visible&&(B.panel=Object.assign({visible:!0},h.style)),B}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:d}=s,p=wC(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),_=this.getVerticalVector(m,!1,{x:0,y:0});let y,{angle:b}=p,x="center";if(u(b)&&a){b=PM(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;y=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(_,!1,o.angle);x=t,y=e}const S=d,A=h?h(c):c,k=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:y},o),text:A});return k.angle=b,l&&l.visible&&(k.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),k}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return gt(t[1],0)?i=!gt(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 GT(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return YT(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=$(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(P(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(P(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,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=oe(e)})),UT(i,t),!VT(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=kT(a),l=AT(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=XT(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);k(i)&&(c=$t(c,i))}}else{if(l){const i=XT(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);k(i)&&(c=$t(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&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);$T(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&NT(t,{orient:o,method:m,separation:v,lastVisible:_,firstVisible: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=pf.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=vT.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-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(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 f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=RM(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=ai(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(){super.release(),this._breaks=null}}CC.defaultAttributes=bT,G(CC,KT);class EC{isInValidValue(t){const{startAngle:e=nM,endAngle:i=rM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=nM,endAngle:i=rM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return ce(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return wT(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function BC(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=BC(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var RC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),k(l)&&l>=3){const t=CT(n,l,c,e,i);h=pf.path(Object.assign(Object.assign({},a.style),{path:ET(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=pf.circle(t)}h.name=vT.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=j({},yT,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=RC(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=L(this.attribute.label,"style.fontSize",12)+L(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=n+m+f+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:j({},yT,d.text),shape:j({},yT,d.shape),panel:j({},yT,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;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(gt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=BC(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&PC(e,c,i)}else e.AABBBounds.width()>r&&PC(e,r,i)}else o>a.x&&h.x2>n.x2?(PC(e,n.x2-o,i),r&&LC(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return gt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}OC.defaultAttributes=bT,G(OC,EC);const IC=t=>t.map(((t,e)=>({index:e,value:t}))),DC=(t,e,i=0)=>{const s=new Ve(t).expand(i/2),n=new Ve(e).expand(i/2);return s.intersects(n)},FC=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=oe(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;u||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=LM(a),_=t.range();let y=[];for(let i=0;i{HC[t]=!0}));const GC=t=>-Math.log(-t),YC=t=>-Math.exp(-t),$C=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,XC=t=>10===t?$C:t===Math.E?Math.exp:e=>Math.pow(t,e),KC=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),qC=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),ZC=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function JC(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 QC(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function tE(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function eE(t,e,i,s){return 1===i&&(i=0),tE(t,i,s)*(e/(1-i))}function iE(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function sE(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=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 rE{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=iE(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=_t(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}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const aE=Symbol("implicit");class oE extends rE{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=jC.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=aE}clone(){const t=(new oE).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!==aE)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&&a>1;)a-=1,r=Math.floor((e-t)/a);return lE(t,e,r,n)}class cE extends oE{constructor(t){super(),this.type=jC.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=eE(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)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("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),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]}}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(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:hE(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=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(t=10){const e=this.calculateVisibleDomain(this._range);return hE(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=bt(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,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 cE(!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:dE}=ri;function uE(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return kt(t,e);if("string"===i){if(s=ii.parseColorString(e)){const e=dE(ii.parseColorString(t),s);return t=>e(t).formatRgb()}return kt(Number(t),Number(e))}return e instanceof si?dE(t,e):e instanceof ii?dE(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):kt(Number(t),Number(e))}class pE extends rE{constructor(t=WC,e=WC){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=WC,this._piecewise=QC,this._interpolate=uE}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),kt)),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=Mt,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=bt(i[0],i[r-1])),this._piecewise=r>2?sE:QC,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:WC),this.rescale(i)):this._clamp!==WC}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=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 gE=Math.sqrt(50),fE=Math.sqrt(10),mE=Math.sqrt(2),vE=[1,2,5,10],_E=(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=SE(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?bE(0,-(e-1)/s,s):bE((e-1)/s,0,s)},yE=vt(((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 _E(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return _E(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=bE(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=bE(t,e,l);return n&&r.reverse(),r})),SE=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=vE[0];return i>=gE?s=vE[3]:i>=fE?s=vE[2]:i>=mE&&(s=vE[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function AE(t,e,i){const s=(e-t)/Math.max(0,i);return SE(s)}function kE(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;e0;){if(s=AE(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function TE(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 wE=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),CE=vt(((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})),EE=vt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=xE(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?wE(t,e,n):wE(t,e,nE(n)),h=wE(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),BE=vt(((t,e,i,s,n)=>kE(s(t),s(e),i).map((t=>nE(n(t))))));class PE extends pE{constructor(){super(...arguments),this.type=jC.Linear}clone(){var t;const e=new PE;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return yE(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(d(null==e?void 0:e.customTicks))return e.customTicks(this,t);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=xE(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(t=10){const e=this.calculateVisibleDomain(this._range);return kE(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(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r: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}}function RE(t){return e=>-t(-e)}function OE(t=Number.EPSILON){return e=>Math.max(e,t)}class IE extends pE{constructor(){super(KC(10),XC(10)),this.type=jC.Log,this._limit=OE(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new IE).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=KC(this._base),s=XC(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=RE(i),this._pows=RE(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=GC,this.untransformer=YC):(this._logs=i,this._pows=s,this._limit=OE(),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 WC}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return CE(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return EE(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return BE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return BE(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{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))))}}}G(IE,LE);class DE extends PE{constructor(){super(qC(1),ZC(1)),this.type=jC.Symlog,this._const=1}clone(){return(new DE).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=qC(t),this.untransformer=ZC(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return CE(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return EE(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return BE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return BE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}G(DE,LE);class FE{constructor(){this.type=jC.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[lt(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 FE).domain(this._domain).range(this._range).unknown(this._unknown)}}function zE(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function jE(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!NC(t.type))return IC(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return IC([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:u=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),_=f&&f()?f().breakDomains:null,m=_&&_.length?v.filter((t=>_.every((e=>te[1])))):v;else if(p(h))m=zE(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=zE(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:u}):t.d3Ticks(e,{noDecimals:u})))}else{const i=null!==(s=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;m=zE(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:u,customTicks:n}):t.ticks(e,{noDecimals:u,customTicks:n})))}var v,_;const y=t.domain();if(e.labelFirstVisible&&y[0]!==m[0]&&!m.includes(y[0])&&m.unshift(y[0]),e.labelLastVisible&&y[y.length-1]!==m[m.length-1]&&!m.includes(y[y.length-1])&&m.push(y[y.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=zC(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=zC(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=$(l),r=f&&f()?NE.greedy:NE.parity;for(;l.length>=3&&PT(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;BT(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),jE(t,l,a,(e=>BT(e,t,i))),jE(n,l,o,(e=>BT(e,n,i)||!(!a||e===t)&&BT(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),$(h)!==$(m)&&h.push($(m))),m=h}}return IC(m)},NE={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&BT(i,t,e)||(i=t,0))))}},VE=(t,e,i,s)=>{const n=zC(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},UE=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,WE=(t,e)=>t[1]{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),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?IC([s[s.length-1]]):IC([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:f,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=K(g),a=X(g);if(s.length<=f/n){const i=VE(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=YE(s,i,o,e.labelLastVisible,Math.floor(n/l),!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=VE(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!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])){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&&!UE(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?WE(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{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=LM(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=ce({x:0,y:0},i,t),a=TT(r,wT(s,r,e,n));return o=a,l=wT(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return _.align||(gt(y,f.x)?_.baseline||(_.baseline=b>f.y?"top":"bottom"):y>f.x?_.align="left":y{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||h<=0)return IC(t.domain());let c;if(p(n))c=t.stepTicks(n);else if(p(s))c=t.forceTicks(s);else if(p(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=d(i)?i({axisLength:s,labelStyle:l}):i;c=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=$E(t,i,e),r=K(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=KE(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-p)}else c=t.domain();return IC(c)},KE=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&DC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},qE=new Uint32Array(33),ZE=new Uint32Array(33);ZE[0]=0,qE[0]=~ZE[0];for(let t=1;t<=32;++t)ZE[t]=ZE[t-1]<<1|1,qE[t]=~ZE[t];function JE(t,e,i={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:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&qE[31&o]&ZE[1+(31&l)])return!0}else{if(i[h]&qE[31&o])return!0;if(i[c]&ZE[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,qE[31&o]&ZE[1+(31&l)]);else for(s(h,qE[31&o]),s(c,ZE[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,ZE[31&a]|qE[1+(31&o)]);else for(n(l,ZE[31&a]),n(h,qE[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=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 QE(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=_t(i,-o,t.width+l),d=_t(s,-o,t.width+l),u=_t(n,-a,t.height+h),p=_t(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function tB(t,e,i=!1){return i?QE(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function eB(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=tB(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=QE(t,r)),e.getRange(r)))}function iB(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>p(t))),u=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return iB(t,e,n,o,h,c,l)}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 iB(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 iB(t,e,n,s,h,c)}return!1}const nB=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],rB=["top","inside-top","inside"];function aB(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let _=0,y=0;return u<0-h?_=-u:p>m&&(_=m-p),g<0-l?y=-g:f>v&&(y=v-f),{dx:_,dy:y}}const oB={mode:"same-time",duration:300,easing:"linear"};function lB(t){return 3===t||4===t}function hB(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 cB=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 dB(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)}}var uB=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{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const fB=(t,e)=>Math.ceil(t)>Math.floor(e),mB=([t,e],[i,s])=>s>t&&e>i;function vB(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}var _B=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{const e=t.target;e===this._lastHover||P(e.states)||(e.addState(oM.hover,!0),_M(this,(t=>{t===e||P(t.states)||t.addState(oM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(_M(this,(t=>{P(t.states)||(t.removeState(oM.hoverReverse),t.removeState(oM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void _M(this,(t=>{P(t.states)||(t.removeState(oM.selectedReverse),t.removeState(oM.selected))}));P(e.states)||(e.addState(oM.selected,!0),_M(this,(t=>{t===e||P(t.states)||t.addState(oM.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)===qo.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===qo.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(Ae(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,f=p-d;return[dB(g,f,c,d,a,o),dB(-g,-f,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds)}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=pf.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Wl)}return e&&e.getAttributes(!0).fill&&s.setAttribute("stroke",e.getAttributes(!0).fill),this.attribute.line&&!P(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;const t=[];!1!==this._enableAnimation&&this._baseMarks.forEach((e=>{t.push(e.attribute),e.initAttributes(e.getAttributes(!0))}));const{overlap:e,smartInvert:i,dataFilter:s,customLayoutFunc:n,customOverlapFunc:r}=this.attribute;let a=this.attribute.data;if(d(s)&&(a=s(a)),a&&a.length){const t=new Set;a=a.filter((e=>!t.has(e.id)&&t.add(e.id)))}let o=this._initText(a);o=d(n)?n(a,o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(o);const l=[],h=o;if(!c(e)&&d(null==e?void 0:e.filterBeforeOverlap)){const t=this.getRelatedGraphic.bind(this);o.forEach((i=>{e.filterBeforeOverlap(i,t,this)?h.push(i):l.push(i)}))}d(r)?o=r(h,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(l):!1!==e&&(o=this._overlapping(h).concat(l)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),o&&o.length&&o.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==i&&this._smartInvert(o),this._renderLabels(o),!1!==this._enableAnimation&&this._baseMarks.forEach(((e,i)=>{e.initAttributes(t[i])}))}_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&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(e)&&(t.states=e)}_createLabelText(t){var e,i;return DM(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;const i=[];let s;if(s=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),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&fB(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&fB(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(gt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(vB([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!mB([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let y=0,b=t.length-1;for(;y<=b;)y===b?_.push(t[y]):(_.push(t[y]),_.push(t[b])),y++,b--;return _}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&s.setRange(tB(i,t.AABBBounds,!0))}))),h.length>0&&h.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&&s.setRange(tB(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(tB(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){var s;if(t){if(!1!==t.attribute.visible){if(null===(s=t.context)||void 0===s?void 0:s.animationState){const e=t.clone();return Object.assign(e.attribute,t.getAttributes(!0)),e.AABBBounds}return t.AABBBounds}const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:n,y:r}=e;return{x1:n,x2:n,y1:r,y2:r}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:p}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{bB[t]=e};var SB=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{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,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*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}AB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const kB=()=>{xB("symbol",AB),xB("line-data",AB)};var MB=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{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}})(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}}}TB.tag="rect-label",TB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var wB=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{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=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}}(t,e,i,s)}};CB.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const EB=()=>{xB("line",CB),xB("area",CB)};var BB=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);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=d(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=d(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}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),h=l.getAttributes(!0),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.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=(h.startAngle+h.endAngle)/2,u=h.endAngle-h.startAngle,p=fe(h.endAngle-u/2),g=ce(c,h.outerRadius,o),f=ce(c,a+e.line.line1MinLength,o),m=new PB(t,g,f,p,u,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=ce(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(d=m.quadrant)||2===d?this._arcRight.set(m.refDatum,m):lB(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var d}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":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 f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,_=0;if("inside"===o&&(_="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=ce(t.circleCenter,v,t.middleAngle),t.labelLimit=f,ft(f,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.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=lB(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=lB(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.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 c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(mt(t.pointB.x,this._line2MinLength+h)||ft(t.pointB.x,c-this._line2MinLength-h))&&(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(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;k(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=lB(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-y-c:0+y+c;break;default:m=p.x+f*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+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?lB(t.quadrant)?"left":"right":lB(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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*(lB(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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,f,m;if(gt(l/2,u))g=0,f=1,m=-p;else if(gt(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,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,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?gt(v[0].y,v[1].y)?ft(t.middleAngle,-Math.PI)&&mt(t.middleAngle,0)||ft(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.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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;e{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 IB(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=ae.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 DB(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=ET(t,!!n),o=ET(r,!!n);const h=ae.distancePP(s,l),c=ae.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=IB(e,t,!1,!!n),o=IB(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=ET(t,!!n),o=ET(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}OB.defaultAttributes={pickable:!1};class FB extends tb{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&MT(this._innerView),this.removeAllChild(!0),this._innerView=pf.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 TT(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:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${vT.grid}-sub`:`${vT.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=ET(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=IB(t,o,!1,!!a)}const u=pf.path(Object.assign({path:c,z:l},d(r)?j({},this.skipDefault?null:FB.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 f=ET(o,!!a),m=Ut(o[0].x-o[1].x),v=Ut(o[0].y-o[1].y),_=pf.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*jt/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?j({},this.skipDefault?null:FB.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],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!gt(a.value,0)&&!gt(l.value,0),d=!gt(a.value,1)&&!gt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}FB.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},zk(),Wk();class zB extends FB{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},FB.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=nM,endAngle:r=rM}=this.attribute;i=CT(t,s,ae.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=j({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);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})}}G(zB,KT);var jB,HB,NB,VB=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){const e=this._getPointsOfSubGrid(p,d);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"})}}G(UB,EC),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(jB||(jB={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(HB||(HB={})),function(t){t.dataZoomChange="dataZoomChange"}(NB||(NB={}));const WB="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",GB={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:WB,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:WB,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},YB={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}},$B=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var XB=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;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto"},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,k,M,T;const{orient:w,middleHandlerStyle:C={},startHandlerStyle:E={},endHandlerStyle:B={},zoomLock:P}=this.attribute,{start:L,end:R}=this._getState(),{position:O,width:I,height:D}=this._getLayoutAttrFromConfig(),F=null!==(t=E.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=B.triggerMinSize)&&void 0!==e?e:40,j=this._getContainer();if(this._isHorizontal){if(C.visible){const t=(null===(i=C.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:O.x+L*I,y:O.y-t,width:(R-L)*I,height:t},null===(s=C.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=C.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:O.x+(L+R)/2*I,y:O.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=C.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square"},C.icon),{pickable:!P&&(null===(h=C.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:O.x+L*I,y:O.y+D/2,size:D,symbolType:null!==(c=E.symbolType)&&void 0!==c?c:"square"},YB.horizontal),E),{pickable:!P&&(null===(d=E.pickable)||void 0===d||d)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:O.x+R*I,y:O.y+D/2,size:D,symbolType:null!==(u=B.symbolType)&&void 0!==u?u:"square"},YB.horizontal),B),{pickable:!P&&(null===(p=B.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:O.x+L*I-t/2,y:O.y+D/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:999},YB.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:O.x+R*I-g/2,y:O.y+D/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:999},YB.horizontal),{pickable:!P}),"rect")}else{if(C.visible){const t=(null===(g=C.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===w?O.x-t:O.x+I,y:O.y+L*D,width:t,height:(R-L)*D},null===(f=C.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(_=null===(v=null===(m=C.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===_||_)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===w?O.x-t/2:O.x+I+t/2,y:O.y+(L+R)/2*D,angle:Math.PI/180*90,symbolType:null!==(b=null===(y=C.icon)||void 0===y?void 0:y.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0},C.icon),{pickable:!P&&(null===(S=null===(x=C.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:O.x+I/2,y:O.y+L*D,size:I,symbolType:null!==(A=E.symbolType)&&void 0!==A?A:"square"},YB.vertical),E),{pickable:!P&&(null===(k=E.pickable)||void 0===k||k)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:O.x+I/2,y:O.y+R*D,size:I,symbolType:null!==(M=B.symbolType)&&void 0!==M?M:"square"},YB.vertical),B),{pickable:!P&&(null===(T=B.pickable)||void 0===T||T)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:O.x+I/2+t/2,y:O.y+L*D-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},YB.vertical),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:O.x+I/2+i/2,y:O.y+R*D-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},YB.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move"},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move"},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_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))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){return t.length<=10||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,void 0!==e?e*e:1)}(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(t);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(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){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 Ne).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)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=XB(c,["formatMethod"]),{formatMethod:g}=d,f=XB(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:_,width:y,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,A={x1:_.x,y1:_.y,x2:_.x+y,y2:_.y+b};let k,M,T,w;this._isHorizontal?(k={x:_.x+m*y,y:_.y+b/2},M={x:_.x+v*y,y:_.y+b/2},T={textAlign:$B(A,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},w={textAlign:$B(A,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:_.x+y/2,y:_.y+m*b},M={x:_.x+y/2,y:_.y+v*b},T={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:$B(A,t,"start",this._isHorizontal)?"top":"bottom"},w={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:$B(A,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),j({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),j({},f,{text:S,x:M.x,y:M.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new UM(e),s.name=i,t.add(s)),s}}const qB={debounce:St,throttle:At};class ZB extends l{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=jB.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=jB.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=jB.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=jB.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=jB.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===k_.env?k_:this.stage,s=dM();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===jB.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===jB.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===jB.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===jB.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(HB.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(HB.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(HB.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===jB.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(HB.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(HB.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:qB[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===k_.env?k_:this.stage,e=dM();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===k_.env?k_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===k_.env?k_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:_t(e+t,0,1),end:_t(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=jB.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}NM(),Xk(),tM(),Lk(),Vk();let JB=class t extends tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,_;h.visible?this._isHorizontal?(m=p,v=g-f,_={x:a.x,y:a.y+f}):(m=p-f,v=g,_={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(y+b)/2,_={x:_.x+y/2,y:_.y}):(v-=(y+b)/2,_={x:_.x,y:_.y+y/2})),v+=(null!==(n=u.lineWidth)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:_,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new KB(this._getRendererAttrs()),this._interaction=new ZB(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(HB.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(HB.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(NB.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(HB.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;p(t)&&p(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(NB.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.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._renderer.previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._renderer.statePointToData=t)}};var QB,tP,eP,iP;function sP(){zk(),NM(),Aw()}JB.defaultAttributes=GB,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"}(QB||(QB={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(tP||(tP={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(eP||(eP={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(iP||(iP={}));class nP extends tb{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=LT(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=RT(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=OT(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:j({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:j({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:j({},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=pf.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=pf.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=pf.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 rP(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 aP(t,e,i,s){t&&(rP(t.startSymbol,e,i,s),t.lines.forEach((t=>rP(t,e,i,s))),rP(t.line,e,i,s),rP(t.endSymbol,e,i,s))}function oP(t,e,i,s){t&&(rP(t.getTextShape(),e,i,s),rP(t.getBgRect(),e,i,s))}function lP(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 hP(t,e,i,s){t&&(lP(t.startSymbol,e,i,s),t.lines.forEach((t=>lP(t,e,i,s))),lP(t.line,e,i,s),lP(t.endSymbol,e,i,s))}function cP(t,e,i,s){t&&(lP(t.getTextShape(),e,i,s),lP(t.getBgRect(),e,i,s))}function dP(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;rP(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)})),rP(t.endSymbol,s+r+a,o,n),Y(e).forEach((t=>{const e=s+r+a+o;rP(t.getTextShape(),e,l,n),rP(t.getBgRect(),e,l,n)}))}function uP(t,e,i,s,n){aP(t,s,i,n),Y(e).forEach((t=>{oP(t,s,i,n)}))}function pP(t,e,i,s,n){rP(t,s,i,n),Y(e).forEach((t=>{oP(t,s,i,n)}))}function gP(t,e,i,s,n){rP(t,s,i,n),Y(e).forEach((t=>{oP(t,s,i,n)}))}function fP(t,e,i,s,n,r){var a;aP(t,n,s,r),rP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?oP(i,n,s,r):rP(i,n,s,r)}function mP(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;rP(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)})),rP(e,n+o+l,h,r),rP(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(rP(i.getTextShape(),n+o+l+h+c,d,r),rP(i.getBgRect(),n+o+l+c,d,r)):rP(i,n+o+l+c,d,r)}function vP(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?dP(t,e,s,r,a):"fadeIn"===i&&uP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?dP(t,e,s,n,a):"fadeIn"===i&&uP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){hP(t,s,i,n),Y(e).forEach((t=>{cP(t,s,i,n)}))}(t,e,i,s,n)}}function _P(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&&pP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&pP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){lP(t,s,i,n),Y(e).forEach((t=>{cP(t,s,i,n)}))}(t,e,i,s,n)}}function yP(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&&gP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&gP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){lP(t,s,i,n),Y(e).forEach((t=>{cP(t,s,i,n)}))}(t,e,i,s,n)}}function bP(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?fP(n,r,e,i,s,o):"callIn"===t&&mP(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?fP(n,r,e,i,s,a):"callIn"===t&&mP(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;hP(t,n,s,r),lP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?cP(i,n,s,r):lP(i,n,s,r)}(n,r,e,t,i,s)}}const xP={type:"clipIn",duration:500,easing:"linear",delay:0},SP={type:"fadeIn",duration:500,easing:"linear",delay:0},AP={type:"callIn",duration:500,easing:"linear",delay:0},kP={type:"fadeOut",duration:500,easing:"linear",delay:0};class MP{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=Y(null==n?void 0:n.label),a=Y(null==n?void 0:n.labelBackground),o=Y(s).map(((s,n)=>{var o,l;const h=j({},i,s),c=new UM(Object.assign(Object.assign({},h),{state:{panel:j({},lM,null!==(o=a[n])&&void 0!==o?o:$(a)),text:j({},lM,null!==(l=r[n])&&void 0!==l?l:$(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===Y(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=Y(this._label),n=Y(null==i?void 0:i.label),r=Y(null==i?void 0:i.labelBackground);if(s.length){const i=Y(e);s.forEach(((e,s)=>{var a,o;const l=j({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:j({},lM,null!==(a=r[s])&&void 0!==a?a:$(r)),text:j({},lM,null!==(o=n[s])&&void 0!==o?o:$(n))}})),this.setLabelPos(e,l)}))}}}class TP extends nP{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=xP,this.defaultExitAnimation=kP}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;HM(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}G(TP,MP);const wP=.001,CP={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:QB.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]}},EP={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"}}},BP={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:{autoRotate:!0,position:eP.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]}},PP={interactive:!0,label:{position:tP.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}},LP={interactive:!0,label:{autoRotate:!0,position:eP.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}},RP={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"}},OP={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"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},IP={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 DP(){FP._animate=vP}sP(),pT(),Aw();class FP extends TP{markerAnimate(t){FP._animate&&this._animationConfig&&FP._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},FP.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i: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,e){var i;return(bM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return xM(Math.abs(e),Math.PI/2,wP)||xM(Math.abs(e),3*Math.PI/2,wP)?SM(i,e,t):bM(e)?EP.postiveXAxis[t]:EP.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new fT({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:j({},lM,null==a?void 0:a.line),startSymbol:j({},lM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},lM,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:j({},lM,null==a?void 0:a.line),startSymbol:j({},lM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},lM,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}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",FP.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(FP.defaultAttributes.label)}}function zP(){jP._animate=_P}FP.defaultAttributes=CP,sP(),Yk(),Aw();class jP extends nP{markerAnimate(t){jP._animate&&this._animationConfig&&jP._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},jP.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=SP,this.defaultExitAnimation=kP}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},OP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;HM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=pf.polygon(Object.assign({points:e},i));n.states=j({},lM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",jP.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=j({},lM,null==i?void 0:i.area)),this._updateMarkLabels(jP.defaultAttributes.label)}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}}jP.defaultAttributes=PP,G(jP,MP),sP(),gT(),Aw();class HP extends TP{markerAnimate(t){HP._animate&&this._animationConfig&&HP._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},HP.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case eP.arcInnerStart:l=n;case eP.arcOuterStart:l=n;break;case eP.arcInnerEnd:l=r;case eP.arcOuterEnd:l=r;break;case eP.center:case eP.arcInnerMiddle:case eP.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return RP[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new mT({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:j({},lM,null==o?void 0:o.line),startSymbol:j({},lM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},lM,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:j({},lM,null==o?void 0:o.line),startSymbol:j({},lM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},lM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",HP.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(HP.defaultAttributes.label)}}HP.defaultAttributes=BP,sP(),Bk(),Aw();class NP extends nP{markerAnimate(t){NP._animate&&this._animationConfig&&NP._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},NP.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=SP,this.defaultExitAnimation=kP}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case eP.center:h=(s+n)/2,c=(r+a)/2;break;case eP.arcInnerStart:h=s,c=r;break;case eP.arcOuterStart:h=n,c=r;break;case eP.arcInnerEnd:h=s,c=a;break;case eP.arcOuterEnd:h=n,c=a;break;case eP.arcInnerMiddle:h=s,c=(r+a)/2;break;case eP.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},RP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;HM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=pf.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=j({},lM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",NP.defaultAttributes.label)}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=j({},lM,null==o?void 0:o.area)),this._updateMarkLabels(NP.defaultAttributes.label)}isValidPoints(){return!0}}function VP(){UP._animate=bP}NP.defaultAttributes=LP,G(NP,MP),sP(),pT(),gT(),tM(),Hk(),Vk(),Aw();class UP extends nP{markerAnimate(t){UP._animate&&this._animationConfig&&UP._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},UP.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=AP,this.defaultExitAnimation=kP,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return xM(Math.abs(s),Math.PI/2,wP)||xM(Math.abs(s),3*Math.PI/2,wP)?SM(t,s,n):bM(s)?IP.postiveXAxis[n]:IP.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,style:d,position:u=iP.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-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,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:j({},lM,null==p?void 0:p.textBackground),text:j({},lM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=j({},lM,null==p?void 0:p.itemContent));const v=bM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+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",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=pf.symbol(Object.assign(Object.assign({},i),r)),o.states=j({},lM,null==s?void 0:s.itemContent)):"text"===n?o=new UM(Object.assign(Object.assign({},i),{state:{panel:j({},lM,null==s?void 0:s.textBackground),text:j({},lM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=pf.richtext(Object.assign(Object.assign({},i),r)),o.states=j({},lM,null==s?void 0:s.itemContent)):"image"===n?(o=pf.image(Object.assign(Object.assign({},i),r)),o.states=j({},lM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=j({},lM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}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=xM(c,0,wP)||xM(d,0,wP),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=zM(e-u,t-d),o=zM(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*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(JP.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(JP.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===JP.focus||"focus"===o){const s=a.hasState(qP.focus);a.toggleState(qP.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[qP.unSelected,qP.unSelectedHover,qP.focus],t),this._setLegendItemState(e,qP.selected,t)})):(this._setLegendItemState(a,qP.selected,t),this._removeLegendItemState(a,[qP.unSelected,qP.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[qP.selected,qP.selectedHover,qP.focus],t),this._setLegendItemState(e,qP.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(qP.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(qP.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(ZP.legendItemClick,a,t);i?(this._removeLegendItemState(a,[qP.selected,qP.selectedHover],t),this._setLegendItemState(a,qP.unSelected,t)):(this._setLegendItemState(a,qP.selected,t),this._removeLegendItemState(a,[qP.unSelected,qP.unSelectedHover],t))}else this._setLegendItemState(a,qP.selected,t),this._removeLegendItemState(a,[qP.unSelected,qP.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[qP.selected,qP.selectedHover],t),this._setLegendItemState(e,qP.unSelected,t))}))}this._dispatchLegendEvent(ZP.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,qP.selected),this._removeLegendItemState(e,[qP.unSelected,qP.unSelectedHover])):(this._removeLegendItemState(e,[qP.selected,qP.selectedHover]),this._setLegendItemState(e,qP.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=$P,spaceRow:l=XP,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:u?i:e,v=this._contentMaxHeight;let _,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,M=0,T=0;const w=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),_=d[t],_.id||(_.id=_.label),_.index=t;let e=!0;y(n)&&(e=n.includes(_.label));const i=this._renderEachItem(_,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||w.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=T+l,T=0,w.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),w.push(i)):(p(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=M+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=pf.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:u}=t,g=[];p(c)&&g.push(c),p(d)&&g.push(d),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=K(g)),p(u)&&(this._itemHeightByUser=u);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,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:f,autoEllipsisStrategy:m}=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=ai(c);let w;!1===x.visible?(w=pf.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,JP.item,t,w)):(w=pf.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,JP.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?qP.selected:qP.unSelected);const C=pf.group({x:0,y:0,pickable:!1});w.add(C);let E,B=0,P=0,R=0;if(v&&!1!==v.visible){const i=L(S,"style.size",10);P=y(i)?i[0]||0:i,R=L(v,"space",8);const s=pf.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,JP.itemShape,t,w,S.state),s.addState(e?qP.selected:qP.unSelected),C.add(s)}let O=0;if(d){const e=L(g,"size",10);E=pf.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,JP.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=DM(Object.assign(Object.assign({x:P/2+R,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,JP.itemLabel,t,w,A.state),D.addState(e?qP.selected:qP.unSelected),C.add(D);const F=L(_,"space",8);if(p(l)){const s=L(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=DM(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,JP.itemValue,t,w,k.state),r.addState(e?qP.selected:qP.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-P-R-F-O-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-P/2-T[1]-T[3]-O-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));B=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-P-R-O),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",B),C.add(E));const z=C.AABBBounds,j=z.width();if("right"===f){const t=z.x2,e=z.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=z.height(),N=p(this.attribute.item.width)?this.attribute.item.width:j+T[1]+T[3],V=this._itemHeightByUser||H+T[0]+T[2];return w.attribute.width=N,w.attribute.height=V,E&&E.setAttribute("visible",!1),C.translateTo(-z.x1+T[3],-z.y1+T[0]),w}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new YP(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},j({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new YP(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new pM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new pM(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?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 i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",At(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=$P,spaceRow:o=XP}=n,l=this._itemsContainer,{space:h=KP,defaultCurrent:c=1}=r,d=iL(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,_=0,y=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v0&&(y=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:y,y:b}),y+=a+i})),this._itemContext.startX=y,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),_=p-g.AABBBounds.height()-h-t,_<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;_0&&(b=0,y+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:y,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=pf.group({x:0,y:t,width:u?v:f,height:u?m:_,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=$P,spaceRow:a=XP}=s,o=this._itemsContainer,{space:l=KP,defaultCurrent:h=1}=n,c=iL(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const _=pf.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=pf.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];gt(_t(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),gt(_t(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(qP.selected)?this._setLegendItemState(t,qP.selectedHover,e):this._setLegendItemState(t,qP.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===JP.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(ZP.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(qP.unSelectedHover)||t.hasState(qP.selectedHover))&&(i=!0),t.removeState(qP.unSelectedHover),t.removeState(qP.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(qP.unSelectedHover)&&!t.hasState(qP.selectedHover)||(i=!0),t.removeState(qP.unSelectedHover),t.removeState(qP.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===JP.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(ZP.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(ZP.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!==JP.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(ZP.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!==JP.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(ZP.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(qP.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=j({},sL,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(qP.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}release(){super.release(),this.removeAllEventListeners()}};var rL;function aL(t){return y(t)?t:[t,t]}function oL(t){return t?"ew-resize":"ns-resize"}nL.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:$P,spaceRow:XP,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:KP,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"}(rL||(rL={})),tL();class lL extends tb{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},lL.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=_t(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=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=dM(),n="browser"===k_.env?k_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;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=_t(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=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=dM(),n="browser"===k_.env?k_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{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?_t(t+p,h,c):_t(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?_t(t+p,0,c-h):_t(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=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),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:aL(d)[0],endValue:aL(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=pf.group({x:0,y:0});f.name=rL.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=pf.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)),m.name=rL.startText,f.add(m);const e=p(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const _=pf.group({x:g?v:0,y:g?0:v});f.add(_);const y=pf.group({x:0,y:0});let b;if(y.name=rL.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=pf.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=rL.endText,f.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=pf.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=rL.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,f]=aL(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":oL(p)},r));if(v.name=rL.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=rL.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":oL(p)},r));if(i.name=rL.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f,"end");e.name=rL.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=yt(h,i,s);c=t[0],d=t[1]}else c=i,d=_t(h,i,s);const p=this._isHorizontal;e||(c=i);const f=pf.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=rL.trackContainer;const m=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":oL(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=pf.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=rL.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return pf.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":oL(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),pf.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=pf.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=pf.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),("browser"===k_.env?k_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=dM(),e="browser"===k_.env?k_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_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===rL.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===rL.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===rL.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===rL.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}}release(t){super.release(t),("browser"===k_.env?k_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}lL.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}}},eL(),tL();class hL extends QP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},hL.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:f,handlerText:m,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:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function cL(t="bottom"){let 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`}hL.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"}}},eL(),tL(),Wk();class dL extends QP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},dL.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:f,showTooltip:m,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=pf.group({x:0,y:0});this._innerView.add(x);const S=new lL({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:cL(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,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=pf.path(Object.assign(Object.assign({x:0,y:k,path:A},_),{zIndex:0}));x.add(M);const T=this._title?this._title.AABBBounds.height()+L(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))}}dL.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)"}},zk(),iM(),qk();let uL=class t extends tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,b,x;const{textType:S,text:A,subtextType:k,textStyle:M={},subtext:T,subtextStyle:w={},width:C,height:E,minWidth:B,maxWidth:P,minHeight:L,maxHeight:R,align:O,verticalAlign:I,padding:D=0}=this.attribute,F=ai(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),j=null!==(t=M.height)&&void 0!==t?t:E;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:u="break-word",maxWidth:g,lineClamp:f}=M;if("rich"===S||p(M.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:C)&&void 0!==e?e:0,height:null!=j?j:0,ellipsis:null==d||d,wordBreak:null!=u?u:"break-word",maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:null!==(i=M.character)&&void 0!==i?i:A},M);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},hM),M),x:h,y:c,width:null!==(s=null!=t?t:C)&&void 0!==s?s:0,height:null!=j?j:0,ellipsis:d,wordBreak:u,maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:[]},M);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else p(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(A)?A:[A],whiteSpace:"normal"},M),{maxLineWidth:null!==(r=null!==(n=M.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:C,heightLimit:null!==(a=M.height)&&void 0!==a?a:R,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const H=this._mainTitle?this._mainTitle.AABBBounds.height():0,N=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==w.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=w,v=Math.max(Number.MIN_VALUE,R-H);if("rich"===k||p(w.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:C)&&void 0!==o?o:0,height:null!==(l=null!=e?e:E)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=w.character)&&void 0!==h?h:T},w);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:T},hM),w),x:n,y:r,width:null!==(c=null!=t?t:C)&&void 0!==c?c:0,height:null!==(d=null!=e?e:E)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},w);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else p(T)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(T)?T:[T],whiteSpace:"normal"},w),{maxLineWidth:null!==(u=w.maxLineWidth)&&void 0!==u?u:C,heightLimit:null!==(g=w.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:H}),"text"))}const V=this._subTitle?this._subTitle.AABBBounds.height():0,U=this._subTitle?this._subTitle.AABBBounds.width():0;let W=Math.max(N,U),G=H+(null!==(f=w.height)&&void 0!==f?f:V);if(p(C)&&(W=C),p(E)&&(G=E),p(B)&&WP&&(W=P),p(L)&&GR&&(G=R),z.attribute.width=W,z.attribute.height=G,z.attribute.boundsPadding=F,this._mainTitle){if(p(O)||p(M.align)){const t=M.align?M.align:O,e=null!==(m=M.width)&&void 0!==m?m:W;"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")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:I,e=null!=j?j:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"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")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(p(O)||p(w.align)){const t=w.align?w.align:O,e=null!==(_=null!==(v=w.width)&&void 0!==v?v:M.width)&&void 0!==_?_:W;"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")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=w.verticalAlign?w.verticalAlign:I,e=this._mainTitle?p(j)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),j):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=w.height)&&void 0!==b?b:E)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"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")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};uL.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 pL={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"}}};zk(),iM(),qk();let gL=class extends tb{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=j({},L(pL,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=DM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{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,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(p(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),p(s)){const t=Y(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e: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=RM(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,f=c/2,m=g**2+1,v=2*f*g,_=f**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*m*_))/(2*m))+f),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 fL extends Cg{constructor(t){super(t)}}var mL,vL;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(mL||(mL={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(vL||(vL={}));class _L extends tb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},_L.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"},_L.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"},_L.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},_L.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},_L.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 fL(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new fL(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new fL(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(mL.OnPlay)},this.pause=()=>{this._dispatchEvent(mL.OnPause)},this.forward=()=>{this._dispatchEvent(mL.OnForward)},this.backward=()=>{this._dispatchEvent(mL.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()}}_L.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},_L.defaultAttributes={[vL.Start]:{},[vL.Pause]:{},[vL.Backward]:{},[vL.Forward]:{}};const yL={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},bL=[200,10];var xL,SL;!function(t){t.Default="default",t.Reverse="reverse"}(xL||(xL={})),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"}(SL||(SL={}));const AL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===xL.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===xL.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),kL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===xL.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===xL.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),ML=t=>"top"===t||"bottom"===t;class TL extends tb{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},TL.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=Yt(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(ML(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:bL[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:bL[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 lL(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 t.layout=ML(this._orient)?"horizontal":"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 _L(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=ML(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:bL[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Yt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(ML(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:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:ML(this._orient)?t+s:(this._size.width-r)/2,y:ML(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:ML(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:ML(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:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:ML(this._orient)?t+s:(this._size.width-r)/2,y:ML(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]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function wL(){tL(),zk(),tM()}TL.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({},yL),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},yL),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},yL),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},yL),{key:"backward",position:"start"})}},wL();class CL extends TL{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},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:xL.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(mL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(mL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(mL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(mL.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(SL.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(AL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||kL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===xL.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(SL.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=k_.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(SL.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(SL.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=k_.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(),k_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(SL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,k_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(SL.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(SL.change),this.dispatchCustomEvent(SL.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var EL,BL=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())}))};wL();class PL extends TL{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(mL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(mL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(mL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(mL.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(SL.change))},this.play=()=>BL(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(SL.play),this._rafId=k_.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=k_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,k_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(SL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,k_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(SL.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(SL.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(SL.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.brushActive="brushActive",t.brushClear="brushClear"}(EL||(EL={}));const LL={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],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:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},RL=5;const OL={debounce:St,throttle:At};zk(),Yk();let IL=class t extends tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=LL.updateTrigger,endTrigger:i=LL.endTrigger,brushMoved:s=!0}=this.attribute;Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushingWithDelay))),Y(i).forEach((t=>this.stage.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos]},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:OL[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(EL.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const{trigger:t=LL.trigger,resetTrigger:e=LL.resetTrigger}=this.attribute;Y(t).forEach((t=>this.stage.addEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(EL.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;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,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(EL.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=RL}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(EL.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(EL.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;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._dispatchBrushEvent(EL.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=RL}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(EL.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(EL.brushClear,t)):Math.abs(r-s)this.stage.removeEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents()}_releaseBrushUpdateEvents(){const{updateTrigger:t=LL.updateTrigger,endTrigger:e=LL.endTrigger}=this.attribute;Y(t).forEach((t=>this.stage.removeEventListener(t,this._onBrushingWithDelay))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushEnd)))}_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=pf.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}_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(Le(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_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.ythis._brushMaskAABBBoundsDict[t].empty()))}};IL.defaultAttributes=LL;const DL=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return j(t,...e,{shape:i.every(u)?void 0:j({},...i),key:s.every(u)?void 0:j({},...s),value:n.every(u)?void 0:j({},...n)})},FL=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}},zL={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:aM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:aM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:aM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ve).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},jL=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];zk(),Xk(),tM(),iM(),qk();let HL=class t extends tb{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: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=ai(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",j({symbolType:"circle"},u.shape,{visible:yM(u)&&yM(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:yM(u)&&yM(u.value)},FL(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:yM(u)&&yM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:yM(u)&&yM(u.value)},FL(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},hM),u.value),visible:yM(u)&&yM(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=yM(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:f,textBaseline:m}=u.value,v=n.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 _=yM(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(!yM(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)+(yM(n.key)?r+n.key.spacing:0)+(yM(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&&(FM(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";p(n.value.textAlign)?t=n.value.textAlign:yM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),FM(c,f,t,u,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(yM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=ad(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(yM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},FL(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},FL(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},hM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(yM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},FL(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},FL(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=>jL.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)&&yM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=yM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=LM(d),_=LM(u);let y=0;if(yM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),y=Math.max(y,e)}if(yM(u)){const{width:t,height:e}=_.quickMeasure(u.text);h.push(t),y=Math.max(y,e)}f&&cu[m]&&(t=!0,r.push(p.size),y=Math.max(p.size,y)),e.height=y,o+=y,a{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 DL({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return DL({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};HL.defaultAttributes=zL;const NL=gt;function VL(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:K(i)}function UL(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function WL(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function GL(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 YL(t,e){const i=GL(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 $L(t,e){const i=XL(t),s=XL(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 XL(t,e={x:0,y:0}){return ae.distancePP(t,e)}function KL(t){return k(t.x)&&k(t.y)}function qL(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 ZL(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const JL=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function tR(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&tR(t[i],e)}}var eR,iR,sR;function nR(t){var e,i;const{type:s}=t;return s===iR.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!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.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_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"}(eR||(eR={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",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",t.mosaic="mosaic",t.pictogram="pictogram"}(iR||(iR={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",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.transform="transform",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.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.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(sR||(sR={}));const rR={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},aR={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function oR(t,e){var i;if(!t)return[];const s=gR(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?uR(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>dR(i)?hR(t,i,e):i)).filter(p)}))):i.map((i=>dR(i)?hR(t,i,e):i)).filter(p):[]}return[]}function lR(t,e){var i,s;return uR(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 hR(t,e,i){var s;const n=gR(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=rR[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=aR[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 ii(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=$e(t,i,s),a=Ye(n,r,e.l),l=new ii(`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 cR=(t,e)=>{if(e&&dR(t)){const i=hR(e,t);if(i)return i}return t};function dR(t){return t&&"palette"===t.type&&!!t.key}function uR(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function pR(t){return y(t)?{dataScheme:t}:t}function gR(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=nR(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 fR extends oE{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(!uR(this._range))return void super.range(this._range);const t=lR(this._range,this._domain);super.range(t)}}const mR={linear:PE,band:cE,point:class extends cE{constructor(t){super(!1),this.type=jC.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:oE,threshold:FE,colorOrdinal:fR};function vR(t){const e=mR[t];return e?new e:null}function _R(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function yR(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function bR(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function xR(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function SR(t){return!!_(t)&&(!!t.endsWith("%")&&Zy(t.substring(0,t.length-1)))}function AR(t){return!!g(t)&&("percent"in t||"offset"in t)}function kR(t,e,i,s=0){var n,r;return S(t)?t:SR(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 MR(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]=kR(t[s],e.size,i)}))})),o}function TR(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}}function wR(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)||SR(t)||d(t)||AR(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function CR(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const ER=(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},BR=[{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"]}];function PR(t,e){return t&&e.key in t?t[e.key]:e.default}function LR(t){return t&&"token"===t.type&&!!t.key}const RR={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%"},OR={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:BR,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)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:RR,component:{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}}},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:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},IR={name:"dark",colorScheme:{default:{dataScheme:BR,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",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},DR=(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]={}),DR(t[s],e.slice(1),i))};function FR(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=pR(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}zR._charts={},zR._series={},zR._components={},zR._graphicComponents={},zR._marks={},zR._regions={},zR._animations={},zR._implements={},zR._chartPlugin={},zR._vChartPlugin={},zR._componentPlugin={},zR.transforms={fields:$r,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}},zR.dataParser={csv:(t,e={},i)=>(i.type=Yr.DSV,na(t)),dsv:(t,e={},i)=>{i.type=Yr.DSV;const s=Nr(aa,e),{delimiter:n}=s;if(!_(n))throw new TypeError("Invalid delimiter: must be a string!");return sa(n).parse(t)},tsv:(t,e={},i)=>(i.type=Yr.DSV,ra(t))},zR._layout={},zR._grammarTransforms={},zR._stageEventPlugins={},zR.registerStageEventPlugin=(t,e)=>{zR._stageEventPlugins[t]=e},zR.getStageEventPlugin=t=>zR._stageEventPlugins[t],zR._interactionTriggers={},zR.registerInteractionTrigger=(t,e)=>{zR._interactionTriggers[t]=e},zR._composedEventMap={},zR.registerComposedEvent=(t,e)=>{zR._composedEventMap[t]=e},zR._tooltipProcessors={},zR.registerTooltipProcessor=(t,e)=>{zR._tooltipProcessors[t]=e},zR.createTooltipProcessor=(t,e)=>{const i=zR._tooltipProcessors[t];return i?new i(e):null};const NR=t=>{const e={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"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},VR=NR(),UR={[OR.name]:OR},WR=OR.name,GR=new Map(Object.keys(UR).map((t=>[t,UR[t]]))),YR=new Map,$R=new Map(Object.keys(UR).map((t=>[t,t===WR]))),XR=(t,e)=>{if(!t)return;const i=JR(e);GR.set(t,i),$R.set(t,!0)},KR=(t=WR)=>($R.has(t)&&!$R.get(t)&&XR(t,GR.get(t)),GR.get(t)),qR=t=>GR.delete(t)&&YR.delete(t)&&$R.delete(t),ZR=t=>!!_(t)&&GR.has(t),JR=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:WR;return jR({},KR(i),t)};class QR{static registerInstance(t){QR.instances.set(t.id,t)}static unregisterInstance(t){QR.instances.delete(t.id)}static getInstance(t){return QR.instances.get(t)}static instanceExist(t){return QR.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return QR.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}QR.instances=new Map;class tO{static registerTheme(t,e){XR(t,e)}static getTheme(t,e=!1){return KR(t)}static removeTheme(t){return qR(t)}static themeExist(t){return ZR(t)}static getDefaultTheme(){return tO.themes.get(WR)}static setCurrentTheme(t){tO.themeExist(t)&&(tO._currentThemeName=t,QR.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return tO.getTheme(tO._currentThemeName,t)}static getCurrentThemeName(){return tO._currentThemeName}}function eO(t){return _(t)?tO.themeExist(t)?tO.getTheme(t):{}:g(t)?t:{}}tO.themes=GR,tO._currentThemeName=WR;const iO=["animationThreshold","colorScheme","name","padding"];function sO(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];iO.includes(n)?s[n]=r:m(r)?dR(r)?s[n]=cR(r,e):LR(r)?s[n]=PR(i,r):s[n]=sO(r,e,i):s[n]=r})),s}function nO(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]=nO(t[s],e)}return i}return y(t)?t.map((t=>nO(t,e))):t}function rO(t,e){if(!t)return t;if(m(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]=rO(t[s],e)}return i}return y(t)?t.map((t=>rO(t,e))):t}function aO(t,...e){return d(t)?t(...e):t}const oO=(t,e,i,s)=>((t,e,i)=>LM(t,e,i,{fontFamily:RR.fontFamily,fontSize:RR.fontSize}))(e,i,s).measure(t),lO="__VCHART",hO=500,cO=500,dO=`${lO}_MEASURE_CANVAS_ID`,uO=`${lO}_DEFAULT_DATA_INDEX`,pO=`${lO}_DEFAULT_DATA_KEY`,gO=`${lO}_DEFAULT_DATA_SERIES_FIELD`,fO=`${lO}_DEFAULT_SERIES_STYLE_NAME`,mO=`${lO}_STACK_KEY`,vO=`${lO}_STACK_START`,_O=`${lO}_STACK_END`,yO=`${lO}_STACK_START_PERCENT`,bO=`${lO}_STACK_END_PERCENT`,xO=`${lO}_STACK_START_OffsetSilhouette`,SO=`${lO}_STACK_END_OffsetSilhouette`,AO=`${lO}_STACK_TOTAL`,kO=`${lO}_STACK_TOTAL_PERCENT`,MO=`${lO}_STACK_TOTAL_TOP`,TO=`${lO}_STACK_TOTAL_BOTTOM`,wO=`${lO}_MOSAIC_VALUE_START_PERCENT`,CO=`${lO}_MOSAIC_VALUE_END_PERCENT`,EO=`${lO}_MOSAIC_CAT_START_PERCENT`,BO=`${lO}_MOSAIC_CAT_END_PERCENT`,PO=`${lO}_SEGMENT_START`,LO=`${lO}_SEGMENT_END`,RO=`${lO}_KEY`,OO=`${lO}_MAP_LOOK_UP_KEY`;function IO(t,e){for(let i=0;it.key===e))}function FO(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 zO(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:{groupField:a.groupField,nodes:{}},UO(t,a,n[o],l,e,r))})),s?jO(n):n}function jO(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))):jO(t[e].nodes);return t}function HO(t,e){if("values"in t&&t.values.length){const i=WL(t.values,e),s=UL(t.values,bO);t.values.forEach((t=>{t[AO]=i,t[kO]=s}))}else for(const i in t.nodes)HO(t.nodes[i],e)}function NO(t){if(!t.values.length)return;const e=t.values[t.values.length-1][_O]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)VO(t.nodes[r],e,i,s,n)}function UO(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[_O]=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 l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),UO(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const WO=(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]=YO(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function $O(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>qO(t.style(e,i,s,n)):P(t.style)||(e.style=qO(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>qO(t.state[e](i,s,n,r)):P(t.state[e])||(i[e]=qO(t.state[e]))})),e.state=i}return e}function XO(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>qO(t[i](e,s,n,r)):P(t[i])||(e[i]=qO(t[i]))})),e}function KO(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),qO(i)}function qO(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:oe(t.angle)}):t}const ZO=t=>"line"===t||"area"===t,JO=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return ZO(i)?e:null==e?void 0:e[0]},QO=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let tI=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},n=zR.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{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(zR.getComposedEvent(t))if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};var eI;!function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(eI||(eI={}));const iI=["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 sI,nI,rI;t.ChartEvent=void 0,(sI=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",sI.rendered="rendered",sI.renderFinished="renderFinished",sI.animationFinished="animationFinished",sI.regionSeriesDataFilterOver="regionSeriesDataFilterOver",sI.afterInitData="afterInitData",sI.afterInitEvent="afterInitEvent",sI.afterInitMark="afterInitMark",sI.rawDataUpdate="rawDataUpdate",sI.viewDataFilterOver="viewDataFilterOver",sI.viewDataUpdate="viewDataUpdate",sI.viewDataStatisticsUpdate="viewDataStatisticsUpdate",sI.markDeltaYUpdate="markDeltaYUpdate",sI.viewDataLabelUpdate="viewDataLabelUpdate",sI.scaleDomainUpdate="scaleDomainUpdate",sI.scaleRawDomainUpdate="scaleRawDomainUpdate",sI.scaleUpdate="scaleUpdate",sI.dataZoomChange="dataZoomChange",sI.drill="drill",sI.layoutStart="layoutStart",sI.layoutEnd="layoutEnd",sI.layoutRectUpdate="layoutRectUpdate",sI.playerPlay="playerPlay",sI.playerPause="playerPause",sI.playerEnd="playerEnd",sI.playerChange="playerChange",sI.playerForward="playerForward",sI.playerBackward="playerBackward",sI.scrollBarChange="scrollBarChange",sI.brushStart="brushStart",sI.brushChange="brushChange",sI.brushEnd="brushEnd",sI.brushClear="brushClear",sI.brushActive="brushActive",sI.legendSelectedDataChange="legendSelectedDataChange",sI.legendFilter="legendFilter",sI.legendItemClick="legendItemClick",sI.legendItemHover="legendItemHover",sI.legendItemUnHover="legendItemUnHover",sI.tooltipShow="tooltipShow",sI.tooltipHide="tooltipHide",sI.tooltipRelease="tooltipRelease",sI.afterResize="afterResize",sI.afterRender="afterRender",sI.afterLayout="afterLayout",sI.afterMarkLayoutEnd="afterMarkLayoutEnd",sI.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(nI||(nI={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(rI||(rI={}));const aI=[rI.mark,rI.model,rI.chart,rI.vchart];class oI{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(rI.vchart,[]),this._levelNodes.set(rI.chart,[]),this._levelNodes.set(rI.model,[]),this._levelNodes.set(rI.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const lI={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"};class hI{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=L(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>JO(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||nI.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||nI.chart);o.get(t)||o.set(t,new oI);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||nI.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||nI.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||nI.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||nI.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?aI.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[nI.chart,nI.window,nI.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.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&&L(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 lI[a]&&(a=lI[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)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?rI.model:rI.vchart:rI.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=At(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=St(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=nI.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==rI.model&&s!==rI.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=rI.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case nI.chart:return this._viewBubbles;case nI.window:return this._windowBubbles;case nI.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case nI.chart:return this._viewListeners;case nI.window:return this._windowListeners;case nI.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return iI.includes(t)||Object.values(eI).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&zR.hasInteractionTrigger(e)}}function cI(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function dI(t,e,i){t.getParser(e)||t.registerParser(e,i)}const uI=new Map;let pI;function gI(){pI||(pI=new Ba,dI(pI,"geojson",ka),dI(pI,"topojson",Ta),cI(pI,"simplify",Gr))}function fI(t,e,i={type:"geojson",centroid:!0}){uI.has(t)&&Ny(`map type of '${t}' already exists, will be overwritten.`),gI();const s=new Pa(pI),n=j({},{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}),uI.set(t,s)}function mI(t){uI.has(t)?uI.delete(t):Ny(`map type of '${t}' does not exists.`)}function vI(t,e=!1){let i=e;return t.latestData instanceof Pa&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const _I=(t,e)=>0===t.length?[]:1===t.length?vI(t[0],null==e?void 0:e.deep):t.map((t=>vI(t,null==e?void 0:e.deep)));function yI(e,i,s){cI(i=i instanceof Ba?i:e.dataSet,"copyDataView",_I);const n=new Pa(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function bI(t,e,i=[]){var s;if(t instanceof Pa)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new Pa(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return Ny(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return Ny(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!_(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),Ny("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function xI(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var SI,AI,kI,MI;t.TransformLevel=void 0,(SI=t.TransformLevel||(t.TransformLevel={}))[SI.copyDataView=-10]="copyDataView",SI[SI.treemapFilter=-8]="treemapFilter",SI[SI.treemapFlatten=-7]="treemapFlatten",SI[SI.dotObjFlat=-7]="dotObjFlat",SI[SI.linkDotInfo=-7]="linkDotInfo",SI[SI.sankeyLayout=-7]="sankeyLayout",SI[SI.dataZoomFilter=-6]="dataZoomFilter",SI[SI.legendFilter=-5]="legendFilter",function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(AI||(AI={})),function(t){t.data="data",t.mark="mark"}(kI||(kI={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(MI||(MI={}));const TI=["line","area","trail"];function wI(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(RO,i?t.slice().sort(i):t.slice()),{keys:[RO],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const CI=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function EI(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{EI(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function PI(t,e,i,s){const n=wI(t,(t=>i(t))),r=wI(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!u(t)){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}}const LI=`${lO}_BuiltIn_CallBack_Disappear`;var RI;!function(t){t.render="render",t.disappear="disappear"}(RI||(RI={}));class OI{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(e,i){this._count=0,this._rootMarks=[],this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{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._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var e,i,s,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:u,background:f}=this._option;k_.setEnv(function(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}(o),null!=l?l:{}),this._stage=null!==(e=this._option.stage)&&void 0!==e?e:new z_(Object.assign({background:f,width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,canvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:u},ReactDOM:this._option.ReactDOM,autoRefresh:p(r)?r:!p(a)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{})),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const m=Rp({x:0,y:0,width:this._width,height:this._height});m.name="root",this._stage.defaultLayer.appendChild(m),this._rootGroup=m;const v=(p(h)?h:$y(o))&&!1!==c&&zR.getStageEventPlugin("gesture");v&&(this._gestureController=new v(this._stage,g(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=MI.before}_setCanvasStyle(){if(this._stage&&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")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(k_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=k_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>EI(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>EI(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{EI(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;this._hasCommitedMark()&&(Hy(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),this._rootMarks.forEach((t=>{t.render()})),this._layoutState===MI.before&&(this._layoutState=MI.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=MI.reevaluate,this._hasCommitedMark()&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),this.findProgressiveMarks(),this.updateStateAnimation(),this._doRender(!0),this.doPreProgressive(),Hy(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=BI(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=PI(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=PI(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=wI(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=wI(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}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];y(s)?e[i]="disappear"===i?s.map((t=>{return"function"==typeof(e=t.callBack)&&/^class\s/.test(e.toString())?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:LI,customParameters:{callBack:t.callBack}});var e})):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{EI(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===AI.appear))?AI.appear:e.every((t=>t===AI.disappear))?AI.disappear:AI.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===nI.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=e;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=i.parent,i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:JO(o),markId:h,modelId:c,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===nI.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===nI.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===nI.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===nI.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===nI.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this.releaseGrammar(!0),this._stage!==(null===(t=this._option)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{EI(t,(t=>{t.removeProduct()}),null,!0)})):this._cachedMarks=BI(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return Yy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&function(t){return Su(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Ao.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()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{EI(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=k_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){k_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function II(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:Vy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function DI(t){t.crosshair=Y(t.crosshair||{}).map((e=>FR({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function FI(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}=oi(l,i.width,i.height);a=t,o=e}else if(h&&Yy(e.mode)){let t;t=_(h)?k_.getElementById(h):h;const{width:e,height:s}=oi(t,i.width,i.height);a=e,o=s}else if(Xy(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 zI(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function jI(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}}var HI,NI,VI,UI,WI,GI;t.LayoutZIndex=void 0,(HI=t.LayoutZIndex||(t.LayoutZIndex={}))[HI.SeriesGroup=0]="SeriesGroup",HI[HI.Axis_Grid=50]="Axis_Grid",HI[HI.CrossHair_Grid=100]="CrossHair_Grid",HI[HI.Region=450]="Region",HI[HI.Mark=300]="Mark",HI[HI.Node=400]="Node",HI[HI.Axis=100]="Axis",HI[HI.MarkLine=500]="MarkLine",HI[HI.MarkArea=100]="MarkArea",HI[HI.MarkPoint=500]="MarkPoint",HI[HI.DataZoom=500]="DataZoom",HI[HI.ScrollBar=500]="ScrollBar",HI[HI.Player=500]="Player",HI[HI.Legend=500]="Legend",HI[HI.CrossHair=500]="CrossHair",HI[HI.Indicator=500]="Indicator",HI[HI.Title=500]="Title",HI[HI.Label=500]="Label",HI[HI.Brush=500]="Brush",HI[HI.CustomMark=500]="CustomMark",HI[HI.Interaction=700]="Interaction",t.LayoutLevel=void 0,(NI=t.LayoutLevel||(t.LayoutLevel={}))[NI.Indicator=10]="Indicator",NI[NI.Region=20]="Region",NI[NI.Axis=30]="Axis",NI[NI.DataZoom=40]="DataZoom",NI[NI.Player=40]="Player",NI[NI.ScrollBar=40]="ScrollBar",NI[NI.Legend=50]="Legend",NI[NI.Title=70]="Title",NI[NI.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(VI=t.AttributeLevel||(t.AttributeLevel={}))[VI.Default=0]="Default",VI[VI.Theme=1]="Theme",VI[VI.Chart=2]="Chart",VI[VI.Base_Series=3]="Base_Series",VI[VI.Series=4]="Series",VI[VI.Mark=5]="Mark",VI[VI.User_Chart=6]="User_Chart",VI[VI.User_Series=7]="User_Series",VI[VI.User_Mark=8]="User_Mark",VI[VI.User_SeriesStyle=9]="User_SeriesStyle",VI[VI.Built_In=99]="Built_In";class YI{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({},YI.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]))))}}YI.defaultMarkInfo={};class $I{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class XI{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=>FR({},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 KI extends $I{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}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=XI,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new YI,this._lastLayoutRect=null,this.id=qy(),this.userId=t.id,this._spec=t,this.effect={},this.event=new tI(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){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}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){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_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){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${lO}_${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,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=zR.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_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 L(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}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class qI{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}get lastComputeRect(){return this._lastComputeRect}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}get willLayoutTag(){return this._willLayoutTag}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._willLayoutTag=!0,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){let a=MR(wR(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),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:kR(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:kR(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:kR(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:kR(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:kR(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:kR(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=kR(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=kR(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){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_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]=kR(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(TR(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class ZI extends KI{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,this._transformLayoutPadding=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 qI(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&U(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.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,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 JI extends XI{_initTheme(t,e){return{spec:t,theme:this._theme}}}class QI extends ZI{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=JI,this.modelType="region",this.specKey="region",this.type=QI.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,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"}_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,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[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.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex: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()}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,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(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})}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=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function tD(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 eD(t,e,i){e?t.forEach((t=>{const e=$(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=$(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 iD(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 sD(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=oD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),iD(d,!0,p,l),s&&eD(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function nD(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=oD(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=oD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),iD(d,!1,p,o),s&&eD(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function aD(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=oD(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_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){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_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,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=oD(t,this,e);"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,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=tD(t);n.length&&sD(n,e,i,!1,"left",s),r.length&&sD(r,e,i,!0,"left",s),a.length&&nD(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=tD(t);n.length&&rD(n,e,i,!1,"top",s),r.length&&rD(r,e,i,!0,"top",s),a.length&&aD(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=tD(t);n.length&&sD(n,e,i,!1,"right",s),r.length&&sD(r,e,i,!0,"right",s),a.length&&nD(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=tD(t);n.length&&rD(n,e,i,!1,"bottom",s),r.length&&rD(r,e,i,!0,"bottom",s),a.length&&aD(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=oD(t,this,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=>{U(i.getLayoutRect(),e.rect)||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{rect:i}=oD(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);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+c-l})}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+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&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:Vy)("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}}}lD.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(UI||(UI={})),t.STATE_VALUE_ENUM=void 0,(WI=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",WI.STATE_HOVER="hover",WI.STATE_HOVER_REVERSE="hover_reverse",WI.STATE_DIMENSION_HOVER="dimension_hover",WI.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",WI.STATE_SELECTED="selected",WI.STATE_SELECTED_REVERSE="selected_reverse",WI.STATE_SANKEY_EMPHASIS="selected",WI.STATE_SANKEY_EMPHASIS_REVERSE="blur",WI.STATE_HIGHLIGHT="highlight",WI.STATE_BLUR="blur",WI.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(GI||(GI={}));const hD=["linear","radial","conical"],cD={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const dD={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{dD[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class uD extends $I{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(j(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class pD extends uD{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:{}})}))}_isMultiMark(){return!this._mark||(t=this._mark.type,TI.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!dD[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(y(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(lO)));i=t.datums.some((t=>e&&y(null==t?void 0:t.items)?n.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])})):n.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(lO))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(NC(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class gD extends $I{constructor(){super(...arguments),this.id=qy(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=zR.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class fD extends gD{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}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._data=null,this._data=e}removeProduct(){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const mD=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,vD=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=mD(l.delay,n,a,o),d=mD(l.duration,n,a,o),u=mD(l.oneByOne,n,a,o),p=mD(l.splitPath,n,a,o),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)?Vw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Uw)(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);zw(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{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)?Vw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Uw)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Ow(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Dw(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:qo.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 Fw({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Ew,null!==(l=i.easing)&&void 0!==l?l:Bw))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:qo.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new jw({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Ew,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Bw))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):zw(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},_D=(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))))},yD=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}};class bD extends gD{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}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){u(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];y(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new fD(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}u(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=Rp("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){u(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(){this._product&&this._product.parent&&this._product.parent.removeChild(this._product),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Wl)),i&&(d(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==UI.enter&&t.context.diffState!==UI.update||(t.stateProxy=(e,i)=>{var s;return this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)},t.context.states&&t.useStates(t.context.states,e))},this.name=e,this.model=i.model,this.key=i.key,this.state=new pD(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_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,oe)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];u(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}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){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[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"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&FR(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(VC(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=vR(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),e.clamp&&t.clamp&&t.clamp(e.clamp))}(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=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):hD.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):VC(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=d(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_computeGradientAttr(t){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=t,c=e(t,["gradient","scale","field"]);let u=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(u=t),g||(g=e)}const f=lR(oR(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},cD[o]),c);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==u?void 0:u.scale(t[g]);return d(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=ii.SetOpacity(a,s)),{offset:d(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):d(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];d(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)hD.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=lR(oR(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return wI(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._graphics=t.getGraphics(),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear)}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return zR.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=d(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[pO],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=wI(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===AI.appear))?AI.appear:t.every((t=>t===AI.disappear))?AI.disappear:t[0];return null!=e?e:AI.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{yD(t),s.push(...t.getGraphics())})),e.forEach((t=>{yD(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);vD([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=_D(e,n),r=_D(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===AI.exit?AI.exit:i===AI.update?AI.update:AI.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===UI.exit&&(t.context.reusing=!0,t.animates&&t.animates.forEach((t=>t.stop())))}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===UI.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,d,p,g;let f,m;return u(e)?(f=this._graphicMap.get(t),f&&(m=UI.exit)):u(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=UI.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=UI.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(d=f.context)||void 0===d?void 0:d.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=AI.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=AI.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return CI(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=CI(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(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))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach(((t,e)=>{var i,n;let r=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i.update,t);null===(n=t.currentStates)||void 0===n||n.forEach((e=>{var i;const s=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i[e],t);r=Object.assign(Object.assign({},r),s)})),u(this._markConfig.interactive)||(r.pickable=this._markConfig.interactive);const a=this._transformGraphicAttributes(t,r,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=a}))}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r,a;const o=i.context.finalAttrs,l=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=QO(i,o);i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes({}),i.context.reusing=!1):l||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),!(null===(a=this.renderContext)||void 0===a?void 0:a.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i),e&&i.setFinalAttributes(o)}else{const a=i;i=this._createGraphic(o),e&&(null===(n=i.setFinalAttributes)||void 0===n||n.call(i,o)),i.context=a.context,i.context.diffAttrs=o,i.stateSort=this._stateSort;const l=this._graphics===t?s:s+this._graphics.length-t.length;if(l>=0&&(this._graphics[l]=i),null===(r=this.renderContext)||void 0===r?void 0:r.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,l),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(u(e)||(t.zIndex=e),u(i)||(t.clip=i),!u(s)){const e=y(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return u(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=zR.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=zR.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=Y(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===MI.before||(Hy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{"in"===this.state.checkOneState(i,i.context.data,e)?i.addState(t,!0,this.hasAnimationByState("state")):i.removeState(t,this.hasAnimationByState("state"))}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===UI.exit&&!e.isExiting)if(e.context.animationState===UI.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:UI.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=Rp({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}}var xD;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(xD||(xD={}));class SD extends bD{constructor(){super(...arguments),this.type=SD.type,this._marks=[],this._diffState=UI.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(Ny("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?(Ny("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))}getMarkInUserId(t){let e;return EI(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.diffState===UI.update){const t=this.hasAnimation(),e=QO(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e)),t&&this._product.setFinalAttributes(i)}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=UI.update}render(){this._isCommited&&(Hy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct()}}SD.type="group";const AD={measureText:oO};class kD{static instance(){return kD.instance_||(kD.instance_=new kD),kD.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 MD{constructor(){this.id=qy(),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))?Ny("不要重复添加相同的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 TD extends MD{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)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const wD={type:"fadeIn"};function CD(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 wD;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const ED={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"},state:{duration:300,easing:"linear"}},BD={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},PD={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},LD=()=>{zR.registerAnimation("scaleInOut",(()=>BD))},RD=()=>{zR.registerAnimation("fadeInOut",(()=>PD))},OD=(t,e)=>({appear:CD(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:$w,duration:ED.update.duration,easing:ED.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),ID=()=>{zR.registerAnimation("line",OD)},DD=()=>{pw.registerBuiltInAnimate("growPointsIn",hC),pw.registerBuiltInAnimate("growPointsOut",cC),pw.registerBuiltInAnimate("growPointsXIn",uC),pw.registerBuiltInAnimate("growPointsXOut",pC),pw.registerBuiltInAnimate("growPointsYIn",fC),pw.registerBuiltInAnimate("growPointsYOut",mC),pw.registerBuiltInAnimate("clipIn",qw),pw.registerBuiltInAnimate("clipOut",Zw)},FD=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class zD{constructor(t){this._markSet=new YI,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){y(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.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 jD={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class HD extends zD{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},jD,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}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}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll(e)}}HD.type="element-highlight",HD.defaultOptions=jD;const ND=()=>{zR.registerInteractionTrigger(HD.type,HD)},VD={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class UD extends zD{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},VD,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}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,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),t.addState(i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll(e)}}UD.type="element-select",UD.defaultOptions=VD;const WD=()=>{zR.registerInteractionTrigger(UD.type,UD)};class GD extends MD{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class YD{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>zR.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>zR.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>zR.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return zR.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>zR.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){zR.registerTransform(t,e)}static registerFunction(t,e){t&&e&&kD.instance().registerFunction(t,e)}static unregisterFunction(t){t&&kD.instance().unregisterFunction(t)}static getFunction(t){return t?kD.instance().getFunction(t):null}static getFunctionList(){return kD.instance().getFunctionNameList()}static registerMap(t,e,i){const s=zR.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=zR.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,uI.get(e);var e}static registerSVG(t,e,i){const s=zR.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=zR.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){QR.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 ot.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d,u;this.id=qy(),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._renderState=RI.render,this._disableDimensionHoverEvent=!1,this._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))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;U(n.theme,this._spec.theme)?U(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=zI(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?zR.getSeriesBuiltInTheme(e):zR.getComponentBuiltInTheme(e);i=i?FR({},s,i[e]):s}s===t.length-1&&p(i)&&(i=sO({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},tR(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:y,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=Yy(v);if(S?ax(xo):"node"===v&&oA(xo),S&&f&&(this._container=_(f)?k_.getElementById(f):f),m&&(this._canvas=m),y&&(this._stage=y),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=tO.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[];!1!==b&&A.push("poptipForText"),"sankey"===i.type&&A.push("scrollbar");const k=new ot(null!==(a=this._option.logLevel)&&void 0!==a?a:at.Error);ot.setInstance(k),(null===(o=this._option)||void 0===o?void 0:o.onError)&&k.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._compiler=new OI({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:y,pluginList:A},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new hI(this,this._compiler),this._event=new tI(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),QR.registerInstance(this),null===(u=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===u||u.call(d,this)}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=FR({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=nO(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;YD.getFunctionList()&&YD.getFunctionList().length&&(t=rO(t,YD)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=zR.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=zR.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=zR.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._chartSpecTransformer),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)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=At(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.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 FI(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:hO,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:cO})}_initDataSet(t){this._dataSet=t instanceof Ba?t:new Ba,dI(this._dataSet,"dataview",wa),dI(this._dataSet,"array",s),cI(this._dataSet,"copyDataView",_I);for(const t in zR.transforms)cI(this._dataSet,t,zR.transforms[t]);for(const t in zR.dataParser)dI(this._dataSet,t,zR.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake?(null===(n=this._compiler)||void 0===n||n.releaseGrammar(),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.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.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),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),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(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"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?AI.none:AI.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}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._cachedProcessedTheme=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,QR.unregisterInstance(this)}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):y(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._reSetRenderState(),u(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof Pa?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=bI(t,this._dataSet,s);y(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?FR({},t[n][e.index],i):i):t[n]=s?FR({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?FR({},t[n][r],i):i)}else t.id===e&&(t[n]=s?FR({},t[n],i):i)}))}(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=FR({},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),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,this),!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)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=jR({},e,e.chart[t])),e};let l;if(P(n)&&P(r))l=eO(this._currentThemeName),this._currentTheme=o(a,l);else if(_(n)&&(!r||_(r))||_(r)&&(!n||_(n))){const t=jR({},eO(this._currentThemeName),eO(n),eO(r));this._currentTheme=o(a,t)}else{const t=jR({},eO(this._currentThemeName),eO(n),eO(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),j(GM.poptip,WM,h),null===(s=this._compiler)||void 0===s||s.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=!!Yy(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return eO(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!tO.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),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}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield II(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(!Yy(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;this._chart.resetLayoutItemTag(),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)?k_.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)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(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?CR(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||P(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 Ny("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?CR(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Ny("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return kD.instance().getFunction(t)}registerFunction(t,e){t&&e&&kD.instance().registerFunction(t,e)}unregisterFunction(t){t&&kD.instance().unregisterFunction(t)}getFunctionList(){return kD.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=zR.getChartPlugins();t.length>0&&(this._chartPlugin=new TD(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=zR.getVChartPlugins();e.length>0&&(this._vChartPlugin=new GD(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_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,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=RI.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){this._renderState=RI.render,this.getStage().eventSystem.resumeTriggerEvent()}}YD.InstanceManager=QR,YD.ThemeManager=tO,YD.globalConfig={uniqueTooltip:!0},YD.Utils=AD,YD.vglobal=k_;zR.registerRegion("region",QI),zR.registerLayout("base",lD),Jk(),zk(),zR.registerMark(SD.type,SD),zR.registerStageEventPlugin("gesture",Eb),ND(),WD(),XR(IR.name,IR);const $D="monotone",XD="linear",KD="bevel";function qD(t,e){return e("component",t)}function ZD(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=zR.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));const JD=(t,e,i,s)=>{if(u(t[e]))return;const n=y(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},QD=(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)))},tF=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},eF=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):m(t)&&p(t.field)?L(e,t.field):t,s){const{formatFunc:i,args:r}=ZD(void 0,s,t,e);i&&r&&(n=i(...r))}return n},iF=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const sF=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(y(e.activeType)?e.activeType.includes(t):e.activeType===t)));function nF(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=u(i.key)&&u(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:d,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:_}=l,y=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=aF(eF(h,r,a,c),d,g),o.value=aF(eF(f,r,a,m),v,_),Object.keys(y).forEach((t=>{o[t]=eF(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};y(i)?i.forEach((t=>{o(t)})):o(i)}function rF(t,e,i,s,n,r,a){if(d(e)){nF(t,e(n,a),i,s,r,a)}else e&&nF(t,e,i,s,r,a)}const aF=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=mi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class oF{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},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.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{y(t)?t.forEach((t=>{rF(a,t,e,i,s,n,r)})):d(t)?rF(a,t,e,i,s,n,r):t&&nF(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=d(e)?e(s,n):e;if(r?u(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){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}(s),e={visible:eF(r.visible,t,n),value:aF(eF(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:eF(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=eF(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&sF(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const lF={min:t=>t.length?K(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?K(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}},hF=(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=IO([],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 cF(a,n,o)},cF=(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&&t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{Zy(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=>{Zy(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&&!0===o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=lF[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},dF=(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=>{Zy(t[e])||(t[e]=0)}))})),t},uF=`${lO}_HIERARCHY_DEPTH`,pF=`${lO}_HIERARCHY_ROOT`,gF=`${lO}_HIERARCHY_ROOT_INDEX`;function fF(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function mF(t,e,i){t&&(i.needDefaultSeriesField&&(t[gO]=i.defaultSeriesField),t[uO]=e,t[pO]=i.getKey(t,e,i))}function vF(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function _F(t,e,i,s=0,n,r){void 0===r&&(r=e),mF(t,e,i),t[uF]=s,t[pF]=n||t[i.categoryField],t[gF]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>_F(e,s,i,t[uF]+1,t[pF],r)))}const yF={label:{name:"label",type:"text"}},bF=`${lO}_rect_x`,xF=`${lO}_rect_x1`,SF=`${lO}_rect_y`,AF=`${lO}_rect_y1`,kF={data:!0},MF={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},TF=[...Object.keys(ED),"normal"];function wF(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 LF(n)&&delete n.type,n.oneByOne&&(n=EF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:BF,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=FR({},o[e],a);return LF(n)&&delete n.type,n.oneByOne&&(n=EF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:BF,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function CF(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=I(t,null,i),RF(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}),i),t}(h,i)}function EF(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.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function BF(t,e){var i;return null!==(i=null==t?void 0:t[uO])&&void 0!==i?i:e.context.graphicIndex}function PF(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 LF(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function RF(t,e,i=[]){if(y(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),RF(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),RF(t[s],e,i))}function OF(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class IF extends XI{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=nR(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=zR.getSeriesMarkMap(o)?function(t,e,i){const s=zR.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=FR({},i("mark",Y(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return FR({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;Y(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(d(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,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=FR({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>FR({},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 DF extends KI{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)}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:`${lO}_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(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=IF,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=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.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=OF(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),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)&&(cI(this._rawData.dataSet,"invalidTravel",dF),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;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=bI(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=yI(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=yI(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new fD(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=K(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=cF(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=j(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){cI(this._dataSet,"dimensionStatistics",hF);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new Pa(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&&IO(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){cI(this._dataSet,"dimensionStatistics",hF);const s=new Pa(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=IO(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&IO(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new Pa(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)&&(cI(this._rawData.dataSet,"addVChartProperty",tF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:fF.bind(this),call:mF}},!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,i;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.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(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:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=wF({},CF(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)}))),!u(t.dataId)||!u(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(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:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_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"}}:$y(s)||Xy(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=FR(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=FR(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=FD(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=FD(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=FD(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:gO;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:fO,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,fO,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.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()}initTooltip(){this._tooltipHelper=new oF(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||e.visible!==t[i].visible))?i.reMake=!0:!i.reCompile&&e.some(((e,i)=>!U(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!U(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},kF),MF),i),{extensionMark:!0,label:!0,totalLabel:!0});return this._compareExtensionMarksSpec(Y(t.extensionMark),Y(e.extensionMark),s),!s.reMake&&this._compareLabelSpec(Y(t.label),Y(e.label),s),!s.reMake&&this._compareLabelSpec(Y(t.totalLabel),Y(e.totalLabel),s),s.reMake?s:(!s.reCompile&&this._marks.getMarks().some((i=>{var s,n;return r[i.name]=!0,(null===(s=e[i.name])||void 0===s?void 0:s.visible)!==(null===(n=t[i.name])||void 0===n?void 0:n.visible)}))&&(s.reCompile=!0),!s.reCompile&&n.some((i=>MF[i]&&!U(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!U(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Pa||xI(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.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();OF(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),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:gO,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new fR).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return oR(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:gO}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:d={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:_=!1}=e,y=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:_,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(y)){const e=this.getSpec()||{};this._marks.addMark(y,{name:t.name}),v&&(this._seriesMark=y),u(f)?y.setData(this._data):!1!==f&&y.setDataView(f),y.setSkipBeforeLayouted(!1!==c),u(h)||y.setGroupKey(h);const l=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:null!==(s=i.morph)&&void 0!==s&&s,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(n=i.support3d)&&void 0!==n?n:e.support3d||!!e.zField,morphKey:(null===(r=e.morph)||void 0===r?void 0:r.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});y.setMarkConfig(l),this.initMarkStyleWithSpec(y,FR({},d,g||e[y.name]))}return y}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:pO}_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!==_O&&t!==bO&&t!==vO&&t!==yO||(t=this.getStackValueField()),null!==(e=FO(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>Zy(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:gO]}}function FF(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();NC(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 zF(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}}}DF.mark=yF,DF.transformerConstructor=IF;class jF extends DF{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);NC(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:`${lO}_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(_O),this.setFieldX2(vO)):(this.setFieldY(_O),this.setFieldY2(vO))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(bO),this.setFieldX2(yO)):(this.setFieldY(bO),this.setFieldY2(yO))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(SO),this.setFieldX2(xO)):(this.setFieldY(SO),this.setFieldY2(xO))}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)&&(FF("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)}}function HF(t){return"bottom"===t||"top"===t}function NF(t){return"left"===t||"right"===t}function VF(t){return"z"===t}function UF(t,e){return xR(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function WF(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function GF(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?HF(t)?"linear":"band":HF(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const YF=(t,e,i)=>{var s;const n=null!==(s="band"===e?qD("axisBand",i):["linear","log","symlog"].includes(e)?qD("axisLinear",i):{})&&void 0!==s?s:{},r=HF(t)?qD("axisX",i):NF(t)?qD("axisY",i):qD("axisZ",i);return FR({},qD("axis",i),n,r)};class $F{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:Vy)("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:Vy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;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)))),r=n.filter((t=>UC(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return HF(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class XF extends $F{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(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:nI.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const KF=(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))},qF=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},ZF=(t,e,i,s)=>{var n;const r=e.getScale(),a=UC(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=Y(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.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))})),o.push({series:h,datum:e,key:JF(h,s)})}else if(p(i[1])){const e=[],s=[];l.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 r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{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("_")}`,QF=(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};class tz extends $F{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!KF(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:nI.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:nI.canvas}),callback:this.onMouseOut}),$y(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:nI.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),$y(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var ez;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(ez||(ez={}));const iz={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class sz{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",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.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(iz.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),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:KD,curveType:XD,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===$D?"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){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(iz.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:PF(this._spec,iz.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new Pa(this._option.dataSet,{name:`${lO}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),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(ez.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[iz.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(ez.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,FR({},this._spec[iz.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.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=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},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.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const nz=Object.assign(Object.assign({},yF),iz),rz=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(y(t))return t.length===e.length&&t.every(((t,i)=>rz(t,e[i])));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]))},az=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class oz extends bD{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return az}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(u(o)||s.includes(a))return;r&&n.includes(a)&&(VC(null==o?void 0:o.type)||(null==o?void 0:o.scale)||d(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((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?rz(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n,r;const a=e.context.data,o=[],l=[],h={},c=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,d=c&&0===c.currentIndex;if(a.forEach(((e,i)=>{var s;l[i]={},o[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?l[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!c?o[i][s]=t[s](e):0!==i||c&&!d||(h[s]=t[s](e))})),l[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),c){const t=null!==(r=null===(n=e.attribute)||void 0===n?void 0:n.segments)&&void 0!==r?r:[];return t.push({points:l}),d?Object.assign(Object.assign({},h),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(o,l);if(t)return Object.assign(Object.assign(Object.assign({},h),o[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},h),o[0]),{points:l,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:UI.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[pO]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}class lz extends oz{constructor(){super(...arguments),this.type=lz.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)===iR.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}lz.type="line";const hz=()=>{zR.registerMark(lz.type,lz),Jk(),Vk(),EB(),kB(),DD(),zR.registerGraphicComponent("line",Lg)};class cz extends bD{constructor(){super(...arguments),this.type=cz.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="circle":a.symbolType=o,a}}cz.type="symbol";const dz=()=>{zR.registerMark(cz.type,cz),Jk(),tM(),kB(),zR.registerGraphicComponent("symbol",Eg)};class uz extends IF{_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)}}function pz(t){return t.length>=2&&k(t[0])&&k($(t))&&$(t)>=t[0]}function gz(t,e){var i;const s=$(e)-e[0],n=$(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=$(e)>0?$(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!k(o.min),extendable_max:!k(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):$(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function fz(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 mz(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 vz(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 _z(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 yz=(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=>t.type.includes("ticks"))))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)-p[0];if(0===g)return t;const f=c.domain(),m=$(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=ne(t,e),a=Math.max(ie(i),ie(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return IC(v)};class bz{constructor(t){this.id=qy(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class xz extends bz{constructor(){super(xz.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!NC(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&&pz(c)&&pz(d)))return;const u=gz(t,c),p=gz(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!mz(u,p))return}else if(0===y&&0===b){if(!mz(p,u))return}else if(_||A)if(_&&!A){if(!fz(u,p))return}else if(A&&!_){if(!fz(p,u))return}else{if(f===b)return;if(f>b){if(!vz(u,p))return}else if(!vz(p,u))return}else{if(0===f&&0===y){if(!_z(u,p))return}else if(0===b&&0===g&&!_z(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===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){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){cI(e.getOption().dataSet,"tickAlign",yz);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}xz.pluginType="component",xz.type="AxisSyncPlugin";const Sz={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function Az(t){let e=0;return L(t,"tick.visible")&&(e+=L(t,"tick.tickSize")),L(t,"label.visible")&&(e+=L(t,"label.space")),e}function kz(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 Mz(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const Tz=t=>"band"===t||"ordinal"===t||"point"===t;function wz(t,e){return{id:t,label:t,value:e,rawValue:t}}function Cz(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class Ez extends MD{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const Bz=`${lO}_ARC_TRANSFORM_VALUE`,Pz=`${lO}_ARC_RATIO`,Lz=`${lO}_ARC_START_ANGLE`,Rz=`${lO}_ARC_END_ANGLE`,Oz=`${lO}_ARC_K`,Iz=`${lO}_ARC_MIDDLE_ANGLE`,Dz=`${lO}_ARC_QUADRANT`,Fz=`${lO}_ARC_RADIAN`,zz=-Math.PI/2,jz=3*Math.PI/2,Hz=.6,Nz=(t,e,i,s)=>{const n=t();if(S(n))return n;if(d(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return ge(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},Vz=(t,e,i)=>{var s;const n=null!==(s="band"===e?qD("axisBand",i):"linear"===e?qD("axisLinear",i):{})&&void 0!==s?s:{},r=qD("angle"===t?"axisAngle":"axisRadius",i);return FR({},qD("axis",i),n,r)};function Uz(t,e,i,s){switch(t){case r.cartesianBandAxis:return YF(UF(i,["z"]),"band",e);case r.cartesianLinearAxis:return YF(UF(i,["z"]),"linear",e);case r.cartesianLogAxis:return YF(UF(i,["z"]),"log",e);case r.cartesianSymlogAxis:return YF(UF(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return YF(UF(i),void 0,e);case r.polarBandAxis:return Vz(i.orient,"band",e);case r.polarLinearAxis:return Vz(i.orient,"linear",e);case r.polarAxis:return Vz(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,trigger:c,triggerOff:d}=null!==(s=qD(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>HF(t.orient)));let g;g=p(u)?FR({},Tz(u.type)?a:o,l):l;const f=n.find((t=>NF(t.orient)));let m;return m=p(f)?FR({},UC(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(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,trigger:c,triggerOff:d}=null!==(s=qD(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>"angle"===t.orient));let g;g=p(u)?FR({},Tz(u.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?FR({},UC(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return Wz(i,qD(t,e));default:return qD(t,e)}}const Wz=(t,e)=>{var i;const s=FR({},e,e[WF(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class Gz extends XI{getTheme(t,e){return Uz(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({},wR(e)),{[s]:0}))}}class Yz extends ZI{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=Gz,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof jc||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:nI.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}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 Ez(this)}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)))}_getNeedClearVRenderComponents(){return[]}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=>!U(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&&(t.release(!0),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=>{e.compile({group:t,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}}getDatum(t){}}var $z,Xz;Yz.transformerConstructor=Gz,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}($z||($z={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(Xz||(Xz={}));class Kz extends bD{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}clearComponent(){this._component&&(this._component.parent&&this._component.parent.removeChild(this._component),this._component=null)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=zR.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(eI.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){super.release(),this.removeProduct()}}Kz.type="component";const qz=()=>{zR.registerMark(Kz.type,Kz)},Zz=t=>t;class Jz extends Yz{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._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,y,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?$z.circleAxis:$z.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?Xz.circleAxisGrid:Xz.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if((null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==L(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=wF(null===(h=zR.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(d=null!==(c=this._spec.animationAppear)&&void 0!==c?c:L(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==d?d:L(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(u=this._spec.animationDisappear)&&void 0!==u?u:L(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:L(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:L(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:L(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(_=null!==(v=this._spec.animationExit)&&void 0!==v?v:L(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==_?_:L(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(y=this._spec.animationUpdate)&&void 0!==y?y:L(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b:L(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()),e=new fD(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return qL(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=y(a)?NC(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!NC(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return qL(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=ZL(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()})),qL(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(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&U(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):qL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(qL(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_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=$O(s=t.domainLine)).startSymbol=$O(s.startSymbol),s.endSymbol=$O(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 qO(FR({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:qO(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>qO(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=qO(t[i]))})),e}(t.label.state)),d(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}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:d(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},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 qO(FR({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:qO(t.tick.style)),t.tick.state&&(i.tick.state=XO(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 qO(FR({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:qO(t.subTick.style)),t.subTick.state&&(i.subTick.state=XO(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=Sz[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?oe(p):null,textStyle:FR({},d,qO(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:qO(h.style)}),h.state&&(i.title.state.shape=XO(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:qO(o.style)}),o.state&&(i.title.state.background=XO(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=XO(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=qO(t.background.style)),t.background.state&&(i.panel.state=XO(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:aO(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 qO(FR({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:qO(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:aO(t.subGrid.alternateColor),style:qO(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=ZD(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){dI(this._option.dataSet,"scale",Zz);const i=this.registerTicksTransform();return new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,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)}getDatum(t){var e;return t&&t.name===vT.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}Jz.specKey="axes";const Qz=()=>{qz(),zR.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},tj=[xz];class ej extends Jz{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}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),qL(this._regions,(t=>{const e=this.getOrient();HF(e)?Cz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):NF(e)?Cz(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):VF(e)&&Cz(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&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._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=FR({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(FR({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=HF(this.getOrient()),n=t=>{var e;return(s?!HF(t.getOrient()):HF(t.getOrient()))&&NC(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())>=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,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=UF(i,["z"]),VF(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(!Mz(e))return null;const{axisType:t,componentName:s}=GF(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=>NF(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(!Mz(t))return;const{axisType:s,componentName:n}=GF(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=zR.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}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return HF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):VF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(tj.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){HF(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&&!HF(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!VF(this.getOrient())&&this._spec.innerOffset){const t=this._spec;NF(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=kR(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=kR(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=HF(this.getOrient())?t.fieldX:VF(this.getOrient())?t.fieldZ:t.fieldY,NC(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;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,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:NC(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 t;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(eI.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(HF(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._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=HF(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:K(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return qL(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]:HF(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:VF(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();qL(this._regions,(e=>{HF(t)?Cz(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):NF(t)?Cz(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):VF(t)&&Cz(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(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=HF(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=HF(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)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=FR(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new Ne).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=HF(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?_t(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):_t(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-$(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&u(null===(e=a.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=a.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 o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return wz(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:NC(this._scale.type)?i>=s[0]&&i<=$(s):s.includes(i)}))]:[]}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 i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}ej.type=r.cartesianAxis,ej.specKey="axes";const ij=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function sj(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,rj=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function aj(t,e,i="count"){const s=rj(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const oj=Math.sqrt(50),lj=Math.sqrt(10),hj=Math.sqrt(2);class cj{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){p(this._spec.nice)&&(this._nice=this._spec.nice),p(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=kz(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(i.forceTickCount))e=i.forceTickCount;else if(d(i.tickCount)){const t=this._scale.range();let s=Math.abs($(t)-t[0]);if(1===s&&this._option){s=HF(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=k(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return u(s)&&u(n)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&u(n)&&u(this._softMaxValue)?this._scale.niceMax(e):!(!u(s)||!u(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return u(e)&&u(i)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&u(i)&&u(this._softMaxValue)?this._scale.niceMax():!(!u(e)||!u(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=u(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(nj),e.sort(nj),{domain:sj(t,e),scope:aj(t,e,i)}}(r,zy(t),this._spec.breaks[0].scopeType);e=zy(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return 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);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}=kz(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs(K(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[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=oj?10:n>=lj?5:n>=hj?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max($(t),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)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}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)-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}_updateRawDomain(){const e=this.collectData(0,!0),i=this.computeLinearDomain(e);this._rawDomain=i,this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}const dj={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},uj={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}}},pj={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}}},gj={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}}};class fj extends ej{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new PE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}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)}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!VF(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=HF(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=SR(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=zy(this._break.scope).map((t=>i[0]+($(i)-i[0])*t))),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}registerTicksTransform(){const t=`${this.type}-ticks`;return cI(this._option.dataSet,t,HE),t}}fj.type=r.cartesianLinearAxis,fj.specKey="axes",fj.builtInTheme={axis:gj,axisLinear:dj,axisX:uj,axisY:pj},G(fj,cj);const mj=()=>{zR.registerGraphicComponent($z.lineAxis,((t,e)=>new CC(t,e))),zR.registerGraphicComponent(Xz.lineAxisGrid,((t,e)=>new zB(t,e))),Qz(),zR.registerComponent(fj.type,fj)};class vj{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new fD(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{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._spec.showAllGroupLayers?this._scales:[this._scales[0]]).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=wz(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=>wz(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const e=this._spec.domain;for(let t=0;tthis._rawDomainIndex[t][e]=i))}this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const _j={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}};class yj extends ej{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new cE}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}}registerTicksTransform(){const t=`${this.type}-ticks`;return cI(this._option.dataSet,t,GE),t}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=eE(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{zR.registerGraphicComponent($z.lineAxis,((t,e)=>new CC(t,e))),zR.registerGraphicComponent(Xz.lineAxisGrid,((t,e)=>new zB(t,e))),Qz(),zR.registerComponent(yj.type,yj,!1)};class xj extends fj{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),qL(this._regions,(t=>{HF(this.getOrient())?Cz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):Cz(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=FR({},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 Pa(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.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 fD(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=mi.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=>wz(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=>wz(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return cI(this._option.dataSet,t,HE),t}transformScaleDomain(){}}xj.type=r.cartesianTimeAxis,xj.specKey="axes",xj.builtInTheme={axis:gj,axisX:uj,axisY:pj};class Sj extends fj{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new IE}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return cI(this._option.dataSet,t,HE),t}transformScaleDomain(){}}Sj.type=r.cartesianLogAxis,Sj.specKey="axes",Sj.builtInTheme={axis:gj,axisLinear:dj,axisX:uj,axisY:pj},G(Sj,cj);class Aj extends fj{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new DE}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return cI(this._option.dataSet,t,HE),t}transformScaleDomain(){}}Aj.type=r.cartesianSymlogAxis,Aj.specKey="axes",Aj.builtInTheme={axis:gj,axisLinear:dj,axisX:uj,axisY:pj},G(Aj,cj);const kj=`${lO}_hide_`;function Mj(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const Tj=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[kj]&&(Mj(t,!0),t[kj]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=u(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[kj]=!0,Mj(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},wj=()=>{zR.registerGrammarTransform("symbolOverlap",{transform:Tj,runType:"afterEncode"})},Cj={min:K,max:X,average:GL,sum:WL};function Ej(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}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function Bj(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 Pj(t,e,i,s){return Bj(t,e,i,"min",s)}function Lj(t,e,i,s){return Bj(t,e,i,"max",s)}function Rj(t,e,i,s){return Bj(t,e,i,"average",s)}function Oj(t,e,i,s){return Bj(t,e,i,"sum",s)}const Ij=(t,e)=>{let i=d(t.size)?t.size():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=Ej;if("min"===n?l=Pj:"max"===n?l=Lj:"average"===n?l=Rj:"sum"===n&&(l=Oj),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[]},Dj=()=>{zR.registerGrammarTransform("dataSampling",{transform:Ij})};class Fj extends jF{constructor(){super(...arguments),this.type=iR.line,this.transformerConstructor=uz,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.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(wF(null===(i=zR.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),CF("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=zF(this);this._symbolMark.setAnimationConfig(wF(null===(s=zR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),CF("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),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]}}Fj.type=iR.line,Fj.mark=nz,Fj.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},Fj.transformerConstructor=uz,G(Fj,sz);class zj{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{xI(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof Pa)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];Ny(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];Ny(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class jj{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)=>{Jy(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{IO(e,[{key:t,operations:NC(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&&IO(e,[{key:i.field,operations:NC(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?vR("colorOrdinal"):vR(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(Jy(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),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(U(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;if(!U(r.specified,s.specified))return e.reMake=!0,e;s.range&&!U(s.range,n.range())&&(n.range(s.range),e.reRender=!0),Jy(s.domain)?e.reRender=!0:U(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(!Jy(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=NC(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=NC(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;NC(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(NC(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=NC(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(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)));NC(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 Hj{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&t.addState(i,!0,l):a&&t.addState(s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&t.addState(i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{t.removeState(i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&t.removeState(e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}class Nj extends $I{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){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=qy(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:hO,height:cO},this._viewRect={width:hO,height:cO},this._viewBox={x1:0,y1:0,x2:hO,y2:cO},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=wR(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new tI(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new zj(this._dataSet),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===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new Hj;const t=this.getAllSeries(),e=[],i={};t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=`${n}-${t.type}`;i[r]?s.forEach((t=>{i[r].marks.push(t)})):(i[r]=Object.assign(Object.assign({},t),{marks:s}),e.push(i[r]))}))}})),e.forEach((t=>{const e=zR.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(wF({},CF("stage",this._spec,{}),null))}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.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=H(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=zR.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({},i),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_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){const s=zR.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"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(){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e,this._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof KI)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 bD))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof bD)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}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&&xI(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=FI(this._spec,this._option,{width:hO,height:cO})),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),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=oR(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new jj(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){zI(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=oR(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0};return Object.keys(t).filter((t=>!e[t])).sort()}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=this._getSpecKeys(this._spec);if(!U(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{zI(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[r.title]:!0,[r.brush]:!0,[r.indicator]:!0};this._components.forEach((s=>{var n,a;if(s.type===r.label||s.type===r.totalLabel)return;i[s.type]&&(i[s.type]=!1);const o=s.specKey||s.type,l=null!==(n=this._spec[o])&&void 0!==n?n:{};y(l)?(e[o]=e[o]||{specCount:l.length,componentCount:0},e[o].componentCount++,zI(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):zI(t,s.updateSpec(l))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}const s=t=>t&&!1!==t.visible;Object.keys(i).forEach((e=>{if(i[e]){const i=this._spec[e];(y(i)?i.some(s):s(i))&&(t.reMake=!0)}}))}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];zI(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=MR(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.resetLayoutItemTag(),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(){this._backgroundMark&&this._backgroundMark.compile()}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._option.globalInstance),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,this._option.globalInstance)}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._option.globalInstance),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,this._option.globalInstance)}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._option.globalInstance),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,this._option.globalInstance)}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(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(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(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(eI.AFTER_MARK_RENDER_END,e)};this._event.on(eI.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?Y(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:JO;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||d(e.filter)&&e.filter(o,l))){if(ZO(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===ez.dimensionHover||s===ez.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=u(t)||!n||n.every((t=>UC(t.axis.getScale().type)&&u(t.index))),o=a||n.every((t=>UC(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(n))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(r.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(r.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),n=[];s.forEach((e=>{const i=t(e);!1!==i&&n.push({axis:e,value:i})})),i.showCrosshair(n)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const Vj=(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 Uj{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)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):DR(t,a,c.spec),DR(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));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=Vj(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=Vj(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,e,i){var s,n,r,a,o;const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,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},h=this.seriesType;return h&&(l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(zR.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(zR.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=zR.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=zR.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=zR.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.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):JD(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=JD(t,u.specKey,u.type))||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"];return 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}))}_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 Wj extends Uj{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_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;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{u(i[t])&&(i[t]=n[t])})),L(i,"trimPadding")&&FR(i,jI(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class Gj extends Wj{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),DI(t)}}const Yj=(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&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=zO(t,!0);for(const e in o)for(const i in o[e].nodes)VO(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)NO(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&HO(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}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 Xj{_beforeInit(){this._dataSet&&cI(this._dataSet,"stackSplit",Yj)}_initStack(){this._stack=new $j(this),this._stack.init()}}const Kj={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:ez.dimensionHover};class qj extends zD{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},Kj,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=JO(i);let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}qj.type="dimension-hover",qj.defaultOptions=Kj;const Zj=()=>{zR.registerInteractionTrigger(qj.type,qj)},Jj=()=>{zR.registerComposedEvent(ez.dimensionHover,tz),zR.registerComposedEvent(ez.dimensionClick,XF)},Qj=t=>t.fieldX[0],tH=t=>t.fieldY[0],eH=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},iH=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},sH=(t,e)=>t?e?Qj:eH:e?tH:iH,nH=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=QF(t,(t=>HF(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=QF(t,(t=>NF(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{UC(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((t=>{if(d.size>0){if(d.has(t)){const s=rH(t,i,sH(e,UC(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=rH(t,i,sH(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},rH=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:aH(t,s,i)},aH=(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=ZF(e,t,"cartesian",null!=i?i:HF(t.getOrient())?Qj:tH);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},oH=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:u,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,_=0,y=null;if(d.size){const t=Array.from(d.values())[0];_=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,y=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(_)&&!Number.isNaN(_),x=s&&!b&&p(u),S=x?u:{coordRange:[0,0],sizeRange:[0,0],coord:_,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:y};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(UC(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(NC(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,_=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=Az(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(a=y.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&y&&null!==(o=y.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(l=y.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&y&&null!==(h=y.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(c=y.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&y&&null!==(d=y.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(u=y.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&y&&null!==(p=y.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};hH(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=_+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=_+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&lH(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),lH=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=ZD(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},hH=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},cH=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=dH(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},dH=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},uH=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return oH(c,r,e),c.xField.cacheInfo?cH(c.xField):c.yField.cacheInfo?cH(c.yField):void 0},pH=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],gH=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&pH.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(fH(s).every((t=>{var e;return!sF("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},fH=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},mH={dom:`${lO}_TOOLTIP_HANDLER_DOM`,canvas:`${lO}_TOOLTIP_HANDLER_CANVAS`},vH={key:"其他",value:"..."};var _H;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(_H||(_H={}));class yH{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(u(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,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:h,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}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:d,model:g}=e;if(!d||!this._cacheActiveSpec){const d=this.component.getSpec();if(this._cacheActiveSpec=gH(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){u(this._cacheActiveSpec.handler)&&p(d.handler)&&(this._cacheActiveSpec.handler=d.handler);const g=null!==(i=d[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},vH),t):vH;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!u(e)&&sF(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class bH extends yH{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)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],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(!UC(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(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}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const xH=()=>{zR.registerTooltipProcessor("dimension",bH)};class SH extends yH{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,Ko.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(JO(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const AH=()=>{zR.registerTooltipProcessor("mark",SH)};class kH extends yH{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:Y(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?Y(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_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 MH=()=>{zR.registerTooltipProcessor("group",kH)};class TH extends Nj{constructor(){super(...arguments),this.transformerConstructor=Gj,this.type="line",this.seriesType=iR.line}_setModelOption(){this._modelOption.getDimensionInfo=nH,this._modelOption.getDimensionInfoByValue=aH,this._modelOption.getRectByDimensionData=uH}}TH.type="line",TH.seriesType=iR.line,TH.transformerConstructor=Gj,G(TH,Xj);const wH=[...az,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class CH extends oz{constructor(){super(...arguments),this.type=CH.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return wH}_getIgnoreAttributes(){return[]}}CH.type="area";const EH=()=>{zR.registerMark(CH.type,CH),Jk(),Lk(),EB(),kB(),DD(),zR.registerGraphicComponent("area",nf)};class BH extends oF{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 PH=Object.assign(Object.assign(Object.assign({},yF),iz),{area:{name:"area",type:"area"}}),LH=()=>{zR.registerAnimation("area",OD),ID(),LD()};class RH extends uz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!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,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_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,f=h;("line"===c||u&&!d)&&(g=h,f=l),l.style=FR({},f.style,g.style),l.state=FR({},f.state,g.state),!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),t.area=l,t.line=h}}class OH extends jF{constructor(){super(...arguments),this.type=iR.area,this.transformerConstructor=RH,this._sortDataByAxis=!1}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(OH.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}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===$D?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return _R(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),y1: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),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return _R(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:!!e&&this.getColorAttribute(),stroke:!!i&&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.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[_O]},"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(wF(null===(e=zR.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),CF("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(wF(null===(i=zR.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),CF("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=zF(this);this._symbolMark.setAnimationConfig(wF(null===(s=zR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),CF("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new BH(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.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(){super.onLayoutEnd(),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}}}OH.type=iR.area,OH.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},OH.mark=PH,OH.transformerConstructor=RH,G(OH,sz);class IH extends Wj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),DI(t)}}class DH extends Nj{constructor(){super(...arguments),this.transformerConstructor=IH,this.type="area",this.seriesType=iR.area}_setModelOption(){this._modelOption.getDimensionInfo=nH,this._modelOption.getDimensionInfoByValue=aH,this._modelOption.getRectByDimensionData=uH}}DH.type="area",DH.seriesType=iR.area,DH.transformerConstructor=IH,G(DH,Xj);function FH(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 zH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:FH(t,e)}),jH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:FH(t,e)}),HH={type:"fadeIn"},NH={type:"growCenterIn"};function VH(t,e){if(!1===e)return{};switch(e){case"fadeIn":return HH;case"scaleIn":return NH;default:return zH(t)}}class UH extends bD{constructor(){super(...arguments),this.type=UH.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}UH.type="rect";const WH=()=>{Jk(),Xk(),xB("rect",TB),zR.registerMark(UH.type,UH),pw.registerBuiltInAnimate("growHeightIn",rC),pw.registerBuiltInAnimate("growHeightOut",aC),pw.registerBuiltInAnimate("growWidthIn",SC),pw.registerBuiltInAnimate("growWidthOut",AC),pw.registerBuiltInAnimate("growCenterIn",iC),pw.registerBuiltInAnimate("growCenterOut",sC),zR.registerGraphicComponent("rect",Dg)},GH=Object.assign(Object.assign({},yF),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function YH(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;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=ER(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[bF]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):_R(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[xF]):_R(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=_R(this._dataToPosX(t),e,i),n=_R(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[SF]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):_R(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[AF]):_R(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=_R(this._dataToPosY(t),e,i),n=_R(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},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(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},KH.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:PF(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(KH.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}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(cI(this._option.dataSet,"addVChartProperty",tF),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};cI(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new Pa(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:fF.bind(this),call:mF}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new fD(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=AF,s=SF,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=xF,s=bF,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=zO(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)YH(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=_R(this[r](t),l,i),u=_R(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!yR(t[this.getStackValueField()],l)?p=0:pthis._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.setMarkConfig({clip:!0,clipPath:()=>{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[vO],n=t[_O],r=t[yO],h=t[bO];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]),{[vO]:i,[_O]:s}),a?{[yO]:o,[bO]:l}:void 0),c="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)};t.push(Dg(Object.assign(Object.assign({},c),{cornerRadius:d(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(c,h,this._markAttributeContext):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=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>_R(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},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=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>_R(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),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;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=K(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=zF(this);this._barMark.setAnimationConfig(wF(null===(e=zR.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),CF(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=p(this._spec.barWidth)&&r===n,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=a;return o&&(c=ER(this._spec.barWidth,a)),l&&(c=Math.max(c,ER(this._spec.barMinWidth,a))),h&&(c=Math.min(c,ER(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=u(i)?f:Math.min(f,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,m-1))&&void 0!==r?r:6,_=m===f?this._barMark.getAttribute(c,e):v;if(m>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=ER(null!==(l=i[r-1])&&void 0!==l?l:$(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=NC(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(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}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}}KH.type=iR.bar,KH.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},KH.mark=GH,KH.transformerConstructor=XH;const qH=()=>{Dj(),WH(),zR.registerAnimation("bar",((t,e)=>({appear:VH(t,e),enter:zH(t,!1),exit:jH(t,!1),disappear:{duration:ED.disappear.duration}}))),bj(),mj(),zR.registerSeries(KH.type,KH)};class ZH extends Wj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),DI(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 JH extends Nj{constructor(){super(...arguments),this.transformerConstructor=ZH,this.type="bar",this.seriesType=iR.bar}_setModelOption(){this._modelOption.getDimensionInfo=nH,this._modelOption.getDimensionInfoByValue=aH,this._modelOption.getRectByDimensionData=uH}}JH.type="bar",JH.seriesType=iR.bar,JH.transformerConstructor=ZH,G(JH,Xj);const QH=[10,20],tN=jC.Linear,eN="circle",iN=jC.Ordinal,sN=["circle","square","triangle","diamond","star"],nN=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},rN=Object.assign(Object.assign({},yF),{point:{name:"point",type:"symbol"}});class aN extends IF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class oN extends jF{constructor(){super(...arguments),this.type=iR.scatter,this.transformerConstructor=aN,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=`${lO}_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=`${lO}_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:tN,defaultRange:QH},"size")}getShapeAttribute(t,e){return u(e)?eN:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:iN,defaultRange:sN},"shape")}initMark(){this._symbolMark=this._createMark(oN.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:PF(this._spec,oN.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=zF(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(wF(null===(i=zR.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),CF("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:eN},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{if(!t)return;const e=t.getGraphics();e&&e.length&&e.forEach(((t,e)=>{var i,s;const n=null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],r=this.dataToPosition(n);r&&t&&t.translateTo(r.x,r.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){this.handleZoom(t)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}oN.type=iR.scatter,oN.mark=rN,oN.builtInTheme={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"}}}}},oN.transformerConstructor=aN;const lN=()=>{dz(),zR.registerAnimation("scatter",((t,e)=>Object.assign({appear:nN(0,e)},BD))),bj(),mj(),zR.registerSeries(oN.type,oN)};class hN extends Wj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class cN extends Nj{constructor(){super(...arguments),this.transformerConstructor=hN,this.type="scatter",this.seriesType=iR.scatter}_setModelOption(){this._modelOption.getDimensionInfo=nH,this._modelOption.getDimensionInfoByValue=aH,this._modelOption.getRectByDimensionData=uH}}cN.type="scatter",cN.seriesType=iR.scatter,cN.transformerConstructor=hN,G(cN,Xj);class dN extends DF{constructor(){super(...arguments),this.type=iR.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=`${lO}_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 uN=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[uO]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[OO]=e.nameMap[n]:t[OO]=n})),t.features);class pN extends oF{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 gN extends bD{constructor(){super(...arguments),this.type=gN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}gN.type="path";const fN=()=>{zR.registerMark(gN.type,gN),Jk(),Wk(),zR.registerGraphicComponent("path",tf)},mN=Object.assign(Object.assign({},yF),{area:{name:"area",type:"path"}});class vN{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Ia(i,e):Ra[i]?(La[i]||(La[i]=Ia(i,Ra[i])),La[i]):null}(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 _N{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(){}}class yN{constructor(){this._lastScale=0}clearZoom(){this._lastScale=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 bN(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:_N}:$y(e)||Xy(e)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:yN}:null}const xN={debounce:St,throttle:At};class SN{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=$y(this._renderMode)||Xy(this._renderMode),bN(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return bN(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(u(r))return;if(!ke({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{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(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:rI.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:rI.chart,consume:!1}];l.on(...c,xN[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,xN[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||bN(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||bN(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:ke({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:rI.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:rI.chart,consume:!1}];l.on(...c,xN[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,xN[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){bN(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||bN(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(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:rI.chart},(t=>{if(!t.event)return;const{event:n}=t;ke({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:rI.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||bN(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:rI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||bN(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:rI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:rI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:rI.chart,source:nI.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:rI.chart,source:nI.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=xN[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=xN[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:rI.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:rI.chart,source:nI.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:rI.chart,source:nI.chart},this._handleDragMouseUp)}))}}function AN(t,e){return`${lO}_${e}_${t}`}class kN extends Yz{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:AN(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;const l=p(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,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,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):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,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=FR(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var e,i,s;this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:n}=this._spec;if(n){let t=!0,r=!0,a=!1;!0!==n&&(t=null===(e=n.zoom)||void 0===e||e,r=null===(i=n.drag)||void 0===i||i,a=null!==(s=n.blank)&&void 0!==s&&s),t&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!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 vN(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===iR.map||e.type===iR.pictogram?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(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),qL(this._regions,(t=>{var e;if(t.type===iR.map||t.type===iR.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new We})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==iR.map&&e.type!==iR.pictogram||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[OO],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!U(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}kN.type=r.geoCoordinate,G(kN,SN);const MN=()=>{zR.registerComponent(kN.type,kN)};class TN extends IF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class wN extends dN{constructor(){super(...arguments),this.type=iR.map,this.transformerConstructor=TN,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 !`),uI.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var e,i;super.initData(),cI(this._dataSet,"copyDataView",_I),cI(this._dataSet,"map",uN),cI(this._dataSet,"lookup",QD);const s=uI.get(this.map);s||null===(e=this._option)||void 0===e||e.onError("no valid map data found!");const n=new Pa(this._dataSet,{name:`map_${this.id}_data`});n.parse([s],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:t.TransformLevel.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:OO,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",n.reRunAllTransform),this._mapViewData=new fD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(wN.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:PF(this._spec,wN.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}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:gO])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:gO]):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(wF(null===(t=zR.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),CF("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new pN(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[uO]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[uO],{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;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new We}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new We}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}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 uO}getActiveMarks(){return[this._pathMark]}}wN.type=iR.map,wN.mark=mN,wN.builtInTheme={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"}}}}},wN.transformerConstructor=TN;const CN=`${lO}_waterfall_default_seriesField`,EN=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n,calculationMode:r}=e,a=[],{dimensionValues:o,dimensionData:l}=n().latestData;let h=Array.from(o[i]);"decrease"===r&&(h=h.reverse());let c={start:0,end:0,positive:0,negative:0,lastIndex:null};return h.forEach(((t,i)=>{const n={start:c.end,end:c.end,lastIndex:c.lastIndex,lastEnd:c.end,index:t,isTotal:!1,positive:c.end,negative:c.end},r=!0===e.stackInverse?l[t].reverse():l[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[MO]=!0:delete t[MO]})),r.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===h.length-1)return!0;return!1};if(r.some((t=>o(t))))return c=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,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=BN([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 f=g[0];let{start:m,end:v}=PN(f,i,s,n,u);i.start=m,i.end=v;let _=m,y=m,b=v-m;const x=p.reduce(((t,e)=>ne(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=se(_,e)):(t[c]=+y,y=se(y,e)),t[d]=se(t[c],e),m=se(m,e),b=ne(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,n,a,c,h,i,e,o),void a.push(n)}c=BN(r,t,n,a,c,h,i,e),a.push(n)})),a};function BN(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}=PN(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=se(i.positive,e)):(t[h]=+i.negative,i.negative=se(i.negative,e)),t[c]=se(t[h],e),i.end=se(i.end,e)}i.isTotal=e,(u(p)||p===CN)&&(t[CN]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function PN(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?Ny("total.collectCountField error"):n=e[a].start;o<0?Ny("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=se(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 LN=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>se(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?t.unshift(o):t.push(o),t},RN={type:"fadeIn"},ON={type:"growCenterIn"};function IN(t,e){switch(e){case"fadeIn":return RN;case"scaleIn":return ON;default:return zH(t,!1)}}class DN extends bD{constructor(){super(...arguments),this.type=DN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(t,i,s){const n=super._transformGraphicAttributes(t,i,s),{x:r,x1:a,y:o,y1:l}=n,h=e(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return Lg(t)}}DN.type="rule";const FN=()=>{zR.registerMark(DN.type,DN),Jk(),Vk(),zR.registerGraphicComponent("line",Lg)},zN=Object.assign(Object.assign({},GH),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),jN=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:HN(t.map((t=>t.latestData)).flat(),e.fields,i)}};function HN(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)=>HN(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class NN{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 Pa(e instanceof Ba?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),cI(e,"dimensionTree",jN),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 VN extends XH{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const UN={rect:KN,symbol:$N,arc:ZN,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=$N(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:JN,line:QN,area:QN,rect3d:KN,arc3d:ZN,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function WN(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=UN[t])&&void 0!==i?i:UN.point;return e.series.type===iR.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=YN(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;_(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!_(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:tV(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function GN(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==iR.sankey){const{formatFunc:t,args:n}=ZD(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function YN(t){return d(t)?e=>t(e.data):t}function $N(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=YN(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:XN(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function XN(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function KN(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=YN(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;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:qN(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function qN(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 ZN(t){var e;const{labelSpec:i}=t,s=null!==(e=YN(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 JN(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=GN(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),Tg(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 QN(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}))):[{index:0,[gO]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function tV(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class eV extends KH{constructor(){super(...arguments),this.type=iR.waterfall,this.transformerConstructor=VN,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&HO(t,e)}}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 NN(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=CN)}getSeriesKeys(){return this._seriesField===CN?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t,e,i;super.initData(),cI(this._dataSet,"waterfallFillTotal",LN),cI(this._dataSet,"waterfall",EN),(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,calculationMode:null!==(e=this._spec.calculationMode)&&void 0!==e?e:"increase",stackInverse:this.getRegion().getStackInverse()}},!1));const s=yI(this.getViewData(),this._dataSet,{name:`${lO}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",s.reRunAllTransform),this._totalData=new fD(this._option,s),s.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:vO,endAs:_O,total:this._spec.total,calculationMode:null!==(i=this._spec.calculationMode)&&void 0!==i?i:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}},!1),s.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}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=zF(this);this._barMark.setAnimationConfig(wF(null===(i=zR.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),CF("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(wF(null===(s=zR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),CF("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(){super.initMark();const t=this._createMark(eV.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:ne(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:ne(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return JN(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?_R(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):_R(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle();const e="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),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",e?0:1):0,y1:t=>this.totalPositionY(t,"index",e?1:0)},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",e?0:1):0,x1:t=>this.totalPositionX(t,"index",e?1:0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}isVisibleLeaderLine(t){return!u(t.lastIndex)&&yR([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}eV.type=iR.waterfall,eV.mark=zN,eV.builtInTheme={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}}}},eV.transformerConstructor=VN;const iV=()=>{FN(),WH(),zR.registerAnimation("waterfall",((t,e)=>({appear:IN(t,e),enter:zH(t,!1),exit:jH(t,!1),disappear:{duration:ED.disappear.duration}}))),RD(),bj(),mj(),zR.registerSeries(eV.type,eV)},sV=`${lO}_BOX_PLOT_OUTLIER_VALUE`;var nV;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(nV||(nV={}));const rV=(t,e)=>{const i=[],{outliersField:s,dimensionField:n,seriesField:r}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];y(e)||(e=[e]),i.push(...e.map((e=>{const i={[sV]:e};return n.forEach((e=>{i[e]=t[e]})),p(r)&&(i[r]=t[r]),i})))})),i};class aV extends oF{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===nV.OUTLIER)return this.series.getOutliersField();if(t===nV.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case nV.MIN:return this.series.getMinField();case nV.MAX:return this.series.getMaxField();case nV.MEDIAN:return this.series.getMedianField();case nV.Q1:return this.series.getQ1Field();case nV.Q3:return this.series.getQ3Field();case nV.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===nV.OUTLIER)return e[sV];if(t===nV.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case nV.MIN:return e[this.series.getMinField()];case nV.MAX:return e[this.series.getMaxField()];case nV.MEDIAN:return e[this.series.getMedianField()];case nV.Q1:return e[this.series.getQ1Field()];case nV.Q3:return e[this.series.getQ3Field()];case nV.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,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>p(t[sV])}getDefaultContentList(t){return[{key:this.getContentKey(nV.OUTLIER),value:this.getContentValue(nV.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(nV.MAX),value:this.getContentValue(nV.MAX)},{key:this.getContentKey(nV.Q3),value:this.getContentValue(nV.Q3)},{key:this.getContentKey(nV.MEDIAN),value:this.getContentValue(nV.MEDIAN)},{key:this.getContentKey(nV.Q1),value:this.getContentValue(nV.Q1)},{key:this.getContentKey(nV.MIN),value:this.getContentValue(nV.MIN)},{key:this.getContentKey(nV.SERIES_FIELD),value:this.getContentValue(nV.SERIES_FIELD)}]}}class oV extends bD{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==UI.enter&&t.context.diffState!==UI.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;return this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?j(r,i):i}})),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=zg(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=zR.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const lV=()=>{zR.registerGraphicComponent("glyph",zg),Jk(),Dk()},hV=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],cV=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class dV extends oV{constructor(){super(...arguments),this.type=dV.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=hV,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=cV,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}dV.type="boxPlot";const uV=Object.assign(Object.assign({},yF),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),pV=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},gV=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},fV=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),mV=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,M;if(i&&k(i.center))return i.center;let T,w,C,E,B;if("horizontal"===e){T=null===(r=null===(n=(null===(s=fV(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,w=null===(h=null===(l=null===(o=null===(a=fV(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,C=null===(p=null===(u=null===(d=null===(c=fV(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=fV(t,"box").attribute.width,i=fV(t,"box").attribute.x;E=i,B=i+e}else{T=null===(m=null===(f=(null===(g=fV(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,w=null===(b=null===(y=null===(_=null===(v=fV(t,"max"))||void 0===v?void 0:v.attribute)||void 0===_?void 0:_.points)||void 0===y?void 0:y[0])||void 0===b?void 0:b.y,C=null===(M=null===(A=null===(S=null===(x=fV(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===M?void 0:M.y;const e=fV(t,"box").attribute.height,i=fV(t,"box").attribute.y;E=i,B=i+e}return k(T)?T:k(E)&&k(B)?(E+B)/2:k(w)&&k(C)?(w+C)/2:k(C)?C:k(w)?w:NaN},vV=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,_,y,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=fV(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=fV(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=fV(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;y=i,_=i+e;const c=(null===(l=fV(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=fV(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=fV(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=fV(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=fV(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;y=i,_=i+e;const s=(null===(f=fV(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=fV(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(_)&&k(y)?(_+y)/2:k(y)?y:k(_)?_:NaN};class _V extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return pV(mV)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class yV extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return gV(mV)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class bV extends _V{computeAttribute(){return pV(vV)(this.target,this.params,this.params.options)}}class xV extends yV{computeAttribute(){return gV(vV)(this.target,this.params,this.params.options)}}class SV extends IF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}class AV extends jF{constructor(){super(...arguments),this.type=iR.boxPlot,this.transformerConstructor=SV,this._bandPosition=0}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,r,a;super.setAttrFromSpec();const o=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=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(AV.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(AV.mark.outlier,{key:uO,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var e,i,s,n,r,a;const o=this._boxPlotMark;if(o){const s={lineWidth:this._lineWidth,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"!==this._shaftShape?"#000":this.getColorAttribute()};o.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const n="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return ER(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return ER(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return ER(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return ER(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return ER(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return ER(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return ER(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return ER(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(o,s,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(o,n,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Built_In)}const l=this._outlierMark;l&&this.setMarkStyle(l,{fill:null!==(r=null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this._boxFillColor)&&void 0!==r?r:this.getColorAttribute(),stroke:this.getColorAttribute(),size:S(null===(a=this._outliersStyle)||void 0===a?void 0:a.size)?this._outliersStyle.size:10},t.STATE_VALUE_ENUM.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=>_R(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>_R(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>_R(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>_R(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>_R(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},t.STATE_VALUE_ENUM.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:t=>this._getPosition(this.direction,t),x:t=>_R(e(this.getDatumPositionValues(t,sV),{bandPosition:this._bandPosition}),s)}:{x:t=>this._getPosition(this.direction,t),y:t=>_R(e(this.getDatumPositionValues(t,sV),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;cI(this._dataSet,"foldOutlierData",rV),cI(this._dataSet,"addVChartProperty",tF);const t=new Pa(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${lO}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField}}),t.transform({type:"addVChartProperty",options:{beforeCall:fF.bind(this),call:mF}},!1),this._outlierData=new fD(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t;if(this._autoBoxWidth)return this._autoBoxWidth;const e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,i=this._groups?this._groups.fields.length:1,s=null===(t=e.getBandwidth)||void 0===t?void 0:t.call(e,i-1);let n=s;return p(this._spec.boxWidth)&&(n=ER(this._spec.boxWidth,s)),p(this._spec.boxMinWidth)&&(n=Math.max(n,ER(this._spec.boxMinWidth,s))),p(this._spec.boxMaxWidth)&&(n=Math.min(n,ER(this._spec.boxMaxWidth,s))),this._autoBoxWidth=n,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r;let a,o,l;"horizontal"===t?(a=this.getYAxisHelper(),o="boxHeight",l=this.dataToPositionY.bind(this)):(a=this.getXAxisHelper(),o="boxWidth",l=this.dataToPositionX.bind(this));const h=a.getScale(0),c=this._groups?this._groups.fields.length:1,d=null===(i=a.getBandwidth)||void 0===i?void 0:i.call(a,c-1),u=this._boxPlotMark.getAttribute(o,e);if(c>1&&p(this._spec.boxGapInGroup)){const t=this._groups.fields,i=Y(this._spec.boxGapInGroup);let o=0,l=0;for(let h=t.length-1;h>=1;h--){const c=t[h],p=null!==(n=null===(s=a.getScale(h))||void 0===s?void 0:s.domain())&&void 0!==n?n:[],g=p.length,f=ER(null!==(r=i[h-1])&&void 0!==r?r:$(i),d),m=p.indexOf(e[c]);h===t.length-1?(o+=g*u+(g-1)*f,l+=m*(u+f)):(l+=m*(o+f),o+=o+(g-1)*f)}return h.scale(e[t[0]])+a.getBandwidth(0)/2-o/2+l+u/2}const g=NC(h.type||"band");return l(e)+.5*d+(g?-d/2:0)}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=j({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=zF(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=zR.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(CF("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(wF(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(wF(null===(a=zR.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new aV(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}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}AV.type=iR.boxPlot,AV.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},AV.mark=uV,AV.transformerConstructor=SV;const kV=()=>{lV(),Vk(),Xk(),zR.registerGraphicComponent("line",(t=>Lg(t))),zR.registerGraphicComponent("rect",(t=>Dg(t))),zR.registerMark(dV.type,dV),dz(),LD(),bj(),mj(),pw.registerBuiltInAnimate("boxplotScaleIn",_V),pw.registerBuiltInAnimate("boxplotScaleOut",yV),pw.registerBuiltInAnimate("barBoxplotScaleIn",bV),pw.registerBuiltInAnimate("barBoxplotScaleOut",xV),zR.registerSeries(AV.type,AV)};class MV extends bD{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=MV.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?Zg(t):Tg(t)}}MV.type="text";const TV=()=>{zR.registerMark(MV.type,MV),Jk(),iM(),qk(),zR.registerGraphicComponent("text",Tg),zR.registerGraphicComponent("richtext",Zg)};class wV extends oF{constructor(){super(...arguments),this._getMeasureData=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]]}}const CV=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),EV={type:"fadeIn"},BV=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function PV(t,e){return"fadeIn"===e?EV:CV(t)}const LV=Object.assign(Object.assign({},GH),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class RV extends XH{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 OV extends KH{constructor(){super(...arguments),this.type=iR.rangeColumn,this._barMarkType="rect",this._barName=iR.bar,this.transformerConstructor=RV}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(OV.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:PF(this._spec,OV.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(OV.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(OV.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(e,i,s,n){var r,a,o,l;if(e){this.setMarkStyle(e,{fill:null!==(a=null===(r=null==i?void 0:i.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[s]]:t[this._spec.yField[s]];return(null==i?void 0:i.formatMethod)?i.formatMethod(e,t):e}});!function(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)}(this,e,null!==(o=null==i?void 0:i.position)&&void 0!==o?o:n,null!==(l=null==i?void 0:i.offset)&&void 0!==l?l:"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=zF(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(wF(null===(i=zR.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),CF("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(wF(null===(s=zR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),CF("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(wF(null===(n=zR.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),CF("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new wV(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)}}OV.type=iR.rangeColumn,OV.mark=LV,OV.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},OV.transformerConstructor=RV;const IV=()=>{WH(),TV(),zR.registerAnimation("rangeColumn",((t,e)=>({appear:PV(t,e),enter:CV(t),exit:BV(t),disappear:{duration:ED.disappear.duration}}))),RD(),bj(),mj(),zR.registerSeries(OV.type,OV)};var DV,FV;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(DV||(DV={})),function(t){t.middle="middle",t.start="start",t.end="end"}(FV||(FV={}));class zV extends oF{constructor(){super(...arguments),this._getMeasureData=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]]}}const jV=Object.assign({},PH);class HV extends OH{constructor(){super(...arguments),this.type=iR.rangeArea}initMark(){this._areaMark=this._createMark(HV.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}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 zV(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}HV.type=iR.rangeArea,HV.mark=jV;class NV extends DF{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=Hz,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.radiusAxisHelper.dataToPosition(Y(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(Y(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}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:[]};NC(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:[]};NC(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)&&FF(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}}function VV(t){return Zy(t)?Number.parseFloat(t):0}const UV=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&WV(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=fe(e+a/2)};let _=0,y=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,M=0;const T=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))}(x);if(m.forEach(((t,e)=>{const i=t[Bz],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/M;A=p,m.forEach((e=>{const i=e[r]===f?f:e[Bz]*t;v(e,A,i),A+=i}))}if(0!==_&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},WV=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===VV(t[e])))||!i&&0===t.reduce(((t,i)=>t+VV(i[e])),0)));function GV(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const YV=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:GV(t,!0,AI.appear)}),$V={type:"fadeIn"},XV=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:GV(t,!0,AI.enter)}),KV=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:GV(t,!0,AI.exit)});function qV(t,e){if(!1===e)return{};switch(e){case"fadeIn":return $V;case"growRadius":return YV(Object.assign(Object.assign({},t),{growField:"radius"}));default:return YV(Object.assign(Object.assign({},t),{growField:"angle"}))}}class ZV extends bD{constructor(t,e){super(t,e),this.type=JV.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>ce({x:0,y:0},this.getAttribute("centerOffset",e,i),e[Iz])[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 JV extends ZV{constructor(){super(...arguments),this.type=JV.type}}JV.type="arc";const QV=()=>{Jk(),Bk(),xB("arc",LB),pw.registerBuiltInAnimate("growRadiusIn",yC),pw.registerBuiltInAnimate("growRadiusOut",bC),pw.registerBuiltInAnimate("growAngleIn",tC),pw.registerBuiltInAnimate("growAngleOut",eC),zR.registerGraphicComponent("arc",of),zR.registerMark(JV.type,JV)},tU=Object.assign(Object.assign({},yF),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class eU extends IF{_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=FR({},this._theme,i,t);const n=(t,e)=>FR({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);y(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const iU=`${lO}_LABEL_VISIBLE`;class sU extends NV{constructor(){super(...arguments),this.transformerConstructor=eU,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:kR(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:kR(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=zz,this._endAngle=jz,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[Iz];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return ce(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;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 a=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)?oe(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?oe(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?oe(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=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;cI(this._dataSet,"pie",UV),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?oe(this._spec.minAngle):0,asStartAngle:Lz,asEndAngle:Rz,asRatio:Pz,asMiddleAngle:Iz,asRadian:Fz,asQuadrant:Dz,asK:Oz,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new Pa(this._dataSet,{name:`${lO}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new fD(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},sU.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:pO,groupKey:this._seriesField,isSeriesMark:!0},{morph:PF(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return QL(Lz)(t)}endAngleScale(t){return QL(Rz)(t)}_computeLayoutRadius(){return Nz((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:bR(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:bR(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},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),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)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:QL(iU).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(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[Iz];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return ce(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===AI.appear)return this._startAngle;if(i===AI.disappear)return this._endAngle;const r=[AI.disappear,AI.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[uO];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[uO]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[uO])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[uO])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[Iz]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[Iz]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[Iz]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[Iz]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=wF(null===(i=zR.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}sU.transformerConstructor=eU,sU.mark=tU,sU.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class nU extends sU{constructor(){super(...arguments),this.type=iR.pie}}nU.type=iR.pie;const rU=()=>{QV(),zR.registerAnimation("pie",((t,e)=>({appear:qV(t,e),enter:XV(t),exit:KV(t),disappear:{duration:ED.disappear.duration}}))),zR.registerAnimation("emptyCircle",((t,e)=>({appear:qV(t,e)}))),zR.registerSeries(nU.type,nU)};function aU(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const oU=t=>({type:aU(t.growField),options:{overall:!0}}),lU={type:"fadeIn"},hU=t=>({type:aU(t.growField)}),cU=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function dU(t,e){if(!1===e)return{};switch(e){case"fadeIn":return lU;case"growAngle":return oU(Object.assign(Object.assign({},t),{growField:"angle"}));default:return oU(Object.assign(Object.assign({},t),{growField:"radius"}))}}class uU extends NV{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(_O),this.setInnerRadiusField(vO)}setValueFieldToPercent(){this.setRadiusField(bO),this.setInnerRadiusField(yO)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const pU=Object.assign(Object.assign({},yF),{rose:{name:"rose",type:"arc"}});class gU extends IF{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class fU extends Jz{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=y(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let n,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:u,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((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:-90,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.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=u,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const _={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(_),"radius"===i.orient?(o.push(_),a=h):(l.push(_),n=h)})),o.forEach((t=>{t.angleAxisIndex=n})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=zR.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=zz,this._endAngle=jz,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),qL(this._regions,(t=>{"radius"===this.getOrient()?Cz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):Cz(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(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.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:kR(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:kR(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this.visible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(this._spec.endAngle),this._inverse=this._spec.inverse}_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:Az(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}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(){qL(this._regions,(t=>{"radius"===this.getOrient()?Cz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):Cz(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(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 NC(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:NC(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 ce(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return de(t,this.getCenter(),this._startAngle,this._endAngle)}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=>wz(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_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=ae.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",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return Nz((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=Hz,e=0;const i=this.getChart().getSpec();return qL(this.getRegions(),(s=>{const n=s;if(r=n.type,[iR.rose,iR.radar,iR.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.getComponent().setAttributes(FR({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(FR({},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)}}fU.type=r.polarAxis,fU.specKey="axes";const mU={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},vU={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class _U extends fU{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new PE}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}registerTicksTransform(){const t=`${this.type}-ticks`;return cI(this._option.dataSet,t,HE),t}}_U.type=r.polarLinearAxis,_U.specKey="axes",_U.builtInTheme={axis:gj,axisLinear:dj,axisAngle:vU,axisRadius:mU},G(_U,cj);const yU=()=>{zR.registerGraphicComponent($z.lineAxis,((t,e)=>new CC(t,e))),zR.registerGraphicComponent(Xz.lineAxisGrid,((t,e)=>new zB(t,e))),zR.registerGraphicComponent($z.circleAxis,((t,e)=>new OC(t,e))),zR.registerGraphicComponent(Xz.circleAxisGrid,((t,e)=>new UB(t,e))),Qz(),zR.registerComponent(_U.type,_U)};class bU extends fU{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new cE}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)}registerTicksTransform(){const t=`${this.type}-ticks`;return cI(this._option.dataSet,t,XE),t}transformScaleDomain(){}}bU.type=r.polarBandAxis,bU.specKey="axes",bU.builtInTheme={axis:gj,axisBand:_j,axisAngle:vU,axisRadius:mU},G(bU,vj);const xU=()=>{zR.registerGraphicComponent($z.lineAxis,((t,e)=>new CC(t,e))),zR.registerGraphicComponent(Xz.lineAxisGrid,((t,e)=>new zB(t,e))),zR.registerGraphicComponent($z.circleAxis,((t,e)=>new OC(t,e))),zR.registerGraphicComponent(Xz.circleAxisGrid,((t,e)=>new UB(t,e))),Qz(),zR.registerComponent(bU.type,bU)};class SU extends uU{constructor(){super(...arguments),this.type=iR.rose,this.transformerConstructor=gU,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(){this._roseMark=this._createMark(SU.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:PF(this._spec,SU.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}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=>_R(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=_R(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(wF(null===(i=zR.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),CF("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}SU.type=iR.rose,SU.mark=pU,SU.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},SU.transformerConstructor=gU;const AU=()=>{zR.registerSeries(SU.type,SU),QV(),zR.registerAnimation("rose",((t,e)=>({appear:dU(t,e),enter:hU(t),exit:cU(t),disappear:{duration:ED.disappear.duration}}))),xU(),yU()};class kU extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:ce(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=de(this.from,this._prevCenter),{angle:i,radius:s}=de(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,NL(this._fromAngle,this._toAngle)&&NL(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class MU extends $w{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!KL(t)&&!KL(e))return e;const s=de(t,this._prevCenter),n=de(e,this._center);let r=pe(s.angle),a=pe(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new re(s,n,r,a);return o.defined=e.defined,o}}const TU=t=>({type:"in"===t?"fadeIn":"fadeOut"});function wU(t,e,i){return"fadeIn"===e?TU(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function CU(t,e,i){return"fadeIn"===e?TU(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 EU=(t,e)=>({custom:Gw,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),BU=Object.assign(Object.assign(Object.assign({},yF),iz),{area:{name:"area",type:"area"}});class PU extends uU{constructor(){super(...arguments),this.type=iR.radar,this.transformerConstructor=uz,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!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),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(PU.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}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:XD,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{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.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)?oe(this._spec.startAngle):zz},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(wF(null===(s=zR.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),CF("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=zR.getAnimationInKey(e);t.setAnimationConfig(wF(null==i?void 0:i(n,r),CF(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}}}PU.type=iR.radar,PU.mark=BU,PU.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},PU.transformerConstructor=uz,G(PU,sz);const LU=()=>{zR.registerSeries(PU.type,PU),EH(),hz(),dz(),zR.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:wU(t,e,"in"),enter:wU(t,e,"in"),exit:wU(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:ED.disappear.duration},update:[{channel:["points","center"],custom:MU,customParameters:t,duration:ED.update.duration,easing:ED.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),zR.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:CU(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:ED.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:kU,customParameters:t,duration:ED.update.duration,easing:ED.update.easing}]}))),zR.registerAnimation("radarGroup",((t,e)=>({appear:EU(t,"in"),disappear:{duration:ED.disappear.duration}}))),Bk(),xU(),yU()};class RU extends oF{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>mi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const OU=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(lO)||(i[n]=t[n],s=p(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[uO]:r,[pO]:`${s}_${e}`})),r++}))})),n},IU={fill:"#bbb",fillOpacity:.2},DU=Object.assign(Object.assign({},yF),{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"}});class FU extends jF{constructor(){super(...arguments),this.type=iR.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 e;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),cI(this._option.dataSet,"objFlat",OU),cI(this._option.dataSet,"copyDataView",_I),dI(this._option.dataSet,"dataview",wa),null===(e=this.getViewData())||void 0===e||e.transform({type:"objFlat",options:"dots",level:t.TransformLevel.dotObjFlat},!1)}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(FR(IU,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(FU.mark.group),this._containerMark=this._createMark(FU.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(FU.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(FU.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(FU.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(FU.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(FU.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(FU.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var e;const i=this._clipMark;i&&(this.setMarkStyle(i,{x:-(null!==(e=this._spec.leftAppendPadding)&&void 0!==e?e:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",t.AttributeLevel.Series),i.setMarkConfig({interactive:!1,clip:!0}));const s=this._containerMark;s&&(this.setMarkStyle(s,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),s.setMarkConfig({interactive:!1}));const n=this._gridBackgroundMark;n&&this.setMarkStyle(n,{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 r=this._gridMark;r&&this.setMarkStyle(r,{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 a=this._dotMark;a&&this.setMarkStyle(a,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const o=this._titleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._subTitleMark;l&&this.setMarkStyle(l,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const h=this._symbolMark;h&&this.setMarkStyle(h,{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(){var e,i;super.onLayoutEnd();const s=null!==(i=null===(e=this._spec)||void 0===e?void 0:e.leftAppendPadding)&&void 0!==i?i:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+s},"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:gO}}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 fR).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:gO}}initTooltip(){this._tooltipHelper=new RU(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}FU.type=iR.dot,FU.mark=DU,FU.builtInTheme={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"}}}}};class zU extends oF{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>mi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const jU=Object.assign(Object.assign({},yF),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),HU=(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 NU extends jF{constructor(){super(...arguments),this.type=iR.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 e;super.initData(),cI(this._option.dataSet,"linkDotInfo",HU),null===(e=this.getViewData())||void 0===e||e.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:t.TransformLevel.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(NU.mark.group),this._containerMark=this._createMark(NU.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(NU.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(NU.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},"normal",t.AttributeLevel.Series),r.setMarkConfig({interactive:!1,clip:!0}));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setMarkConfig({interactive:!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:gO}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new zU(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}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]}}NU.type=iR.link,NU.mark=jU,NU.builtInTheme={link:{arrow:{style:{size:10}}}};const VU=Object.assign(Object.assign({},yF),{group:{name:"group",type:"group"}});class UU extends NV{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()?vO:PO],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle);let o;if(p(s)){const t=ht(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()?_O:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle),o=ht(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)?oe(n):zz;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?oe(r):jz,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=_R(this.angleAxisHelper.dataToPosition([t[vO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=_R(this.angleAxisHelper.dataToPosition([t[_O]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?_R(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(UU.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+oe(a),o=oe(r)/2;return of(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[Dg({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_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 $U=()=>{zR.registerAnimation("circularProgress",((t,e)=>({appear:YU(t,e),enter:{type:"growAngleIn"},disappear:{duration:ED.disappear.duration}})))};class XU extends IF{constructor(){super(...arguments),this._supportStack=!0}}class KU extends UU{constructor(){super(...arguments),this.type=iR.circularProgress,this.transformerConstructor=XU,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(){return this._progressMark=this._createMark(KU.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:PF(this._spec,"progress")}),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)}getInteractionTriggers(){const t=[];return 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(){return this._trackMark=this._createMark(KU.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),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()?vO:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?_O: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(wF(null===(i=zR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),CF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(wF(null===(s=zR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),CF("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}KU.type=iR.circularProgress,KU.mark=WU,KU.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},KU.transformerConstructor=XU;const qU=()=>{zR.registerSeries(KU.type,KU),QV(),$U(),RD(),xU(),yU()};function ZU(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const JU={type:"fadeIn"};function QU(t,e="grow"){return!1===e?{}:"fadeIn"===e?JU:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:ZU(t)}))(t)}class tW extends oF{enableByType(t){return"dimension"!==t}}const eW=Object.assign(Object.assign({},yF),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class iW extends jF{constructor(){super(...arguments),this.type=iR.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=p(e.width)?e.width:e.x1-e.x,o=p(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(iW.mark.progress,{isSeriesMark:!0}),u(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n;const r=this._progressMark;if(r)if("vertical"===this._spec.direction){const s=this._spec.progress||{},n=null!==(e=s.leftPadding)&&void 0!==e?e:0,a=null!==(i=s.rightPadding)&&void 0!==i?i:0;this.setMarkStyle(r,{x:t=>{var e,i;return _R(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),!0)-this._spec.bandWidth/2+n},y1:t=>{var e,i;return _R(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))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?_R(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-n-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=this._spec.progress||{},i=null!==(s=e.topPadding)&&void 0!==s?s:0,a=null!==(n=e.bottomPadding)&&void 0!==n?n:0;this.setMarkStyle(r,{x1:t=>{var e,i;return _R(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))},y:t=>{var e,s;return _R(this.dataToPositionY(t),null===(s=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===s?void 0:s.call(e,0),!0)-this._spec.bandWidth/2+i},height:this._spec.bandWidth-i-a,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?_R(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){return this._trackMark=this._createMark(iW.mark.track),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return _R(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),!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 _R(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),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series))}getInteractionTriggers(){const t=[];return 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(wF(null===(i=zR.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),CF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(wF(null===(s=zR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),CF("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new tW(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}iW.type=iR.linearProgress,iW.mark=eW,iW.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const sW=()=>{WH(),zR.registerAnimation("linearProgress",((t,e)=>({appear:QU(t,e),enter:QU(t),disappear:{duration:ED.disappear.duration}}))),RD(),zR.registerSeries(iW.type,iW)},nW=[0],rW=[20,40],aW=[200,500],oW={shrink:!1,enlarge:!1,fontSizeLimitMin:0},lW=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class hW{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const cW=`${lO}_WORD_CLOUD_TEXT`,dW=Object.assign(Object.assign({},yF),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),uW={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic",scaleX:1,scaleY:1}}};class pW extends DF{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},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._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=rW}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,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:aW,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:nW,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?cW:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:oW},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||Yy(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:nW,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!lW.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new hW(1e3))}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",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var e;this._wordMark=this._createMark(pW.mark.word,{key:pO,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(e=this._spec.wordMask)||void 0===e?void 0:e.visible)&&(this._maskMark=this._createMark(pW.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",t.AttributeLevel.Series)}initMarkStyleOfWord(e,i,s,n,r){var a,o;e&&(this.setMarkStyle(e,{text:(null==i?void 0:i.formatMethod)?t=>i.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{fill:null!==(o=null===(a=null==i?void 0:i.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(wF(zR.getAnimationInKey("wordCloud")(n,s),CF("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 fR).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:gO])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new PE).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new PE).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[uO])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(e=this._spec.word)&&void 0!==e?e:{},h=null!==(i=l.style)&&void 0!==i?i:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const e=()=>{var i,s,n,r;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((t=>t.fn!==e)),null===(s=(i=this._option).dispatchEvent)||void 0===s||s.call(i,t.ChartEvent.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(r=null===(n=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===n?void 0:n.afterWordcloudShapeDraw)||void 0===r||r.call(n,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:e})},dataIndexKey:pO,text:l.formatMethod?t=>l.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(n=null===(s=this._spec.word)||void 0===s?void 0:s.padding)&&void 0!==n?n:1,fontFamily:p(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(r=h.fontFamily)&&void 0!==r?r:this._defaultFontFamily,fontWeight:p(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:p(h.fontWeight)?h.fontWeight:p(this._valueField)?this._calculateFontWeight:"normal",fontStyle:p(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:h.fontStyle,createCanvas:k_.createCanvas.bind(k_),getTextBounds:mf}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,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,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:Wg,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:p(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:p(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:p(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}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(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}pW.mark=dW,pW.builtInTheme={wordCloud:uW};function gW(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||ED.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,d;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(d=t.children)||void 0===d?void 0:d.length){p.children=[],p.isLeaf=!1;const e=fW(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Tt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Tt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},mW=(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=mW(t.children,e,t,n))})),s},vW=(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=vW(t.children,e,t,n)),n=e(t,s,i,n)})),n},_W=(t,e=[],i)=>{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):_W(t.children,e,i)))})),e};function yW(t,e){let i,s;if(SW(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function SW(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 TW(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 wW(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 CW(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 EW(t){return{_:t,next:null,prev:null}}function BW(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];TW(n,s,r);let a,o,l,h,c,d,u,p=EW(s),g=EW(n),f=EW(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.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=fW(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%Ct)/Ct}(),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:OW.defaultOpionts.nodeSort;mW([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)mW([o],PW(h)),vW([o],LW(this._getPadding,.5,a)),mW([o],RW(1,this._maxDepth));else{const t=Math.min(s.width,s.height);mW([o],PW(OW.defaultOpionts.setRadius)),vW([o],LW(Rt,1,a)),c&&vW([o],LW(this._getPadding,o.radius/t,a)),mW([o],RW(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}OW.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const IW=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=IW(t.children):t.value=0),e+=Math.abs(t.value)})),e};function DW(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){IW(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=u(t.value)?0:Tt(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=H(t,["parents"]);if(a.parents=t.parents.map((t=>H(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=Tt(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function FW(t){return t.depth}function zW(t,e){return e-1-t.endDepth}const jW=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),HW=(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},NW={left:FW,right:zW,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?K(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:FW,end:zW},VW=bt(0,1);class UW{constructor(t){this._ascendingSourceBreadth=(t,e)=>jW(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>jW(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},UW.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._logger=ot.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):NW[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)};"vertical"===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<=0)return null;const a=this.computeNodeBreadths(n);if(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))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;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}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return 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){return DW(t,this._getNodeKey)}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=[HW(s[t.source]),HW(s[t.target],!0)].filter((t=>!u(t)));e.length&&(t.value=K(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){return function(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))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=d(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}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=_t(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;ea)&&(o=a);let l=0,h=null,c=null;if(d(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)c=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:c>0?t=>c:t=>Math.max(t.value*l,0),m=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*VW(t.value/e.value):0,n,0),o);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;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,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(jW),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(jW),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{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];WW(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),GW);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({},YW.defaultOpionts,t):Object.assign({},YW.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Lt(this.options.center[0],t.width),s=t.y0+Lt(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=>Lt(t,n))):Lt(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>Lt(t,n))):Lt(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=Lt(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=fW(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=ce({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)}}}function $W(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(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,f,m,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,_=Math.max(v/x,x/m),_>y){f-=h;break}y=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{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*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:WW,slice:$W,sliceDice:function(t,e,i,s,n){(t.depth%2==1?$W:WW)(t,e,i,s,n)}};class qW{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({},qW.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?Pt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?XW(this.options.aspectRatio):null!==(e=KW[this.options.splitType])&&void 0!==e?e:KW.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=fW(t,n,0,-1,null,this._getNodeKey,this.options.valueField);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)}))}}function ZW(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+ci?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return ot.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=ZW(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=Ci(o.map(Ci))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rwt(e)));u=Ri(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=JW(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&ot.getInstance().error("Area "+r+" not represented on screen")}return i}function rG(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Pi((function(i){return-1*aG({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},lG=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=Y(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!P(Y(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:Y(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||tG,s=e.lossFunction||QW,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=Y(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];di(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rae.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:oG(f),arcs:f})}))},hG={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:cG,triangle:cG,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.955)%(2*Math.PI/5)-2*Math.PI/10>=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 cG(){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 dG(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*.4),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"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const uG=t=>hG[t]?hG[t]():hG.circle(),pG=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function gG(t){return d(t)?t:function(){return t}}class fG{constructor(t){var e,i;switch(this.options=j({},fG.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=uG(this.options.shape),this.getText=null!==(e=gG(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=gG(this.options.fontWeight),this.getTextFontSize=gG(this.options.fontSize),this.getTextFontStyle=gG(this.options.fontStyle),this.getTextFontFamily=gG(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>pG(10,50);break;case"random-light":this.getTextColor=()=>pG(50,90);break;default:this.getTextColor=gG(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 oe(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():wt(e);return oe(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+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:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1: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 vG extends fG{constructor(t){var e;super(j({},vG.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<=vG.defaultOptions.minFontSize&&(this.options.minFontSize=vG.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=mG[this.options.spiral])&&void 0!==e?e:mG.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=gG(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}=dG(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,f,m;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,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,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._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=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(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=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}));if(this.originalData=s,this.data=s,this.progressiveRun(),!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._originSize[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],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});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 f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);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*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(xG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(bG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}xG(p,this._size)&&(p=SG(p,this._size))}else if(xG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||yG(p,i))&&(!i||!_G(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 _G(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 yG(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,xG=(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 SG(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{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const u=n.measureText(h),g="normal"!==o?1.1:1,f=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(u.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},kG=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>ce(t,e,i+r*n)))},MG=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},TG=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=dG(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=uG("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return ce(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)MG(n,kG({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)MG(n,kG({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)MG(n,kG({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)MG(n,kG({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)MG(n,kG({x:l,y:h},o,0,3));else if("star"===t.shape){const t=kG({x:l,y:h},o,-Math.PI/2,5),e=kG({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);MG(n,i)}else n.fillRect(0,0,i,s)}; + ***************************************************************************** */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.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=(t,e=!1)=>e?"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 _=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||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=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||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 B=Object.prototype.hasOwnProperty;function P(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(B.call(t,e))return!1;return!0}var L=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&R.call(t,e);function I(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=y(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||_(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=I(r,e,i)}return s}function D(t,e,i=!1,s=!1){if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&y(t[a])?z(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(y(a)){if(s)o=[];else if(y(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.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 U(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(!U(t[s],e[s],i))return!1;return!0}if(!m(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(!U(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;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},K=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;ne?1:t>=e?0:NaN}function it(t){return Number(t)}function st(t,e,i=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)}const nt="undefined"!=typeof console;function rt(t,e,i){const s=[e].concat([].slice.call(i));nt&&console[t].apply(console,s)}var at;!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"}(at||(at={}));class ot{static getInstance(t,e){return ot._instance&&S(t)?ot._instance.level(t):ot._instance||(ot._instance=new ot(t,e)),ot._instance}static setInstance(t){return ot._instance=t}static setInstanceLevel(t){ot._instance?ot._instance.level(t):ot._instance=new ot(t)}static clearInstance(){ot._instance=null}constructor(t=at.None,e){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(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=at.Info}canLogDebug(){return this._level>=at.Debug}canLogError(){return this._level>=at.Error}canLogWarn(){return this._level>=at.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=at.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):rt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=at.Warn&&rt(this._method||"warn","WARN",t),this}info(...t){return this._level>=at.Info&&rt(this._method||"log","INFO",t),this}debug(...t){return this._level>=at.Debug&&rt(this._method||"log","DEBUG",t),this}}function lt(t,e,i=0,s){for(u(s)&&(s=t.length);i>>1;et(t[n],e)>0?s=n:i=n+1}return i}ot._instance=null;const ht=(t,e)=>ct(0,t.length,(i=>e(t[i]))),ct=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},dt=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(et)),st(i,.5)},ut=1e-10,pt=1e-10;function gt(t,e,i=pt,s=ut){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function ft(t,e,i,s){return t>e&&!gt(t,e,i,s)}function mt(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var _t=function(t,e,i){return ti?i:t};var yt=(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 bt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let xt=!1;try{xt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){xt=!1}function St(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&xt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=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 _(){const t=Date.now();if(v(t))return y(t);o=m(_,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?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(_,e),c?f(t):a}(l);if(d)return o=m(_,e),f(l)}return void 0===o&&(o=m(_,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:y(Date.now())},b.pending=function(){return void 0!==o},b}function At(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),St(t,e,{leading:s,trailing:n,maxWait:e})}function kt(t,e){return i=>t*(1-i)+e*i}function Mt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Tt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function wt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}xt=!1;const Ct=4294967296;const Et=t=>e=>L(e,t),Bt=(t,e={})=>{if(d(t))return t;const i=[t];return(e&&e.get||Et)(i)},Pt=(t,e={})=>{if(y(t)){const i=t.map((t=>Bt(t,e)));return t=>i.map((e=>e(t)))}return Bt(t,e)},Lt=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t,Rt=t=>0,Ot=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function Dt(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Ft(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!u(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:d,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)d+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!u(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!u(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:d,b:p},predict:g,rSquared:Dt(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=It(f.min,f);for(let r=0;r=1?Ht:t<=-1?-Ht:Math.asin(t)}function Jt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Qt(t,e){return t[0]*e[1]-t[1]*e[0]}function te(t,e){let i=0;for(let s=0;s0?i:0}function se(t,e){return ee(t+e,10**Math.max(ie(t),ie(e)))}function ne(t,e){return ee(t-e,10**Math.max(ie(t),ie(e)))}class re{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new re(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 ae{static distancePP(t,e){return Kt(qt(t.x-e.x,2)+qt(t.y-e.y,2))}static distanceNN(t,e,i,s){return Kt(qt(t-i,2)+qt(e-s,2))}static distancePN(t,e,i){return Kt(qt(e-t.x,2)+qt(i-t.y,2))}static pointAtPP(t,e,i){return new re((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function oe(t){return t*(Math.PI/180)}function le(t){return 180*t/Math.PI}const he=(t=0)=>{if(t<0)for(;t<-Vt;)t+=Vt;else if(t>0)for(;t>Vt;)t-=Vt;return t};function ce(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 de(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function ue(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function pe(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ge(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=pe(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)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function fe(t){return(t=pe(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 me(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function ve(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function ye(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var be;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(be||(be={}));const xe=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function Se(t,e,i){if(!t||!e)return be.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function Me(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Te({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function we(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Ce(t,e){const i=e?oe(t.angle):t.angle,s=we(t);return[Te({x:t.x1,y:t.y1},i,s),Te({x:t.x2,y:t.y1},i,s),Te({x:t.x2,y:t.y2},i,s),Te({x:t.x1,y:t.y2},i,s)]}function Ee(t,e,i=!1){const s=Ce(t,i),n=Ce(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(we(t),we(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?oe(t.angle):t.angle;let u=i?oe(90-t.angle):t.angle+Ht;const p=i?oe(e.angle):e.angle;let g=i?oe(90-e.angle):e.angle+Ht;u>Nt&&(u-=Nt),g>Nt&&(g-=Nt);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Me(n,i)+Me(n,s))/2>Me(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Be=1e-8;function Pe(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Oe(t,e){return Math.abs(t-e){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"};function De(t,e={},i){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")}class Fe{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=De(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:f=o}=this._userSpec;if(_(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,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: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,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}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(Fe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Fe.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Fe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Fe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Fe.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}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)}}Fe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Fe.NUMBERS_CHAR_SET="0123456789",Fe.FULL_SIZE_CHAR="字";const ze=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),je=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=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(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=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(t=0,e=0,i=0,s=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(t=0,e=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(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return He(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 Ne extends Ve{}class Ue extends Ve{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Ee(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new Ue(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Te({x:this.x1,y:this.y1},this.angle,t),Te({x:this.x2,y:this.y1},this.angle,t),Te({x:this.x1,y:this.y2},this.angle,t),Te({x:this.x2,y:this.y2},this.angle,t)]}}class We{constructor(t=1,e=0,i=0,s=1,n=0,r=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 We,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,f=o*n+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 We;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:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new We(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=le(r.rotateDeg),r}}class Ge{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 Ye(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 $e(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 Xe=/^#([0-9a-f]{3,8})$/,Ke={transparent:4294967040},qe={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 Ze(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Je(t){return S(t)?new si(t>>16,t>>8&255,255&t,1):y(t)?new si(t[0],t[1],t[2]):new si(255,255,255)}function Qe(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ti(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ei=(t,e)=>{const i=Xe.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new si((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Je(t):8===e?new si(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class ii{static Brighter(t,e=1){return 1===e?t:new ii(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new ii(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof ii?t:new ii(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();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(Ke[t]))return function(t){return S(t)?new si(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new si(t[0],t[1],t[2],t[3]):new si(255,255,255,1)}(Ke[t]);if(p(qe[t]))return Je(qe[t]);const e=`${t}`.trim().toLowerCase(),i=ei(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new si(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=Ye(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new si(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ii.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new si(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=$e(this.color.r,this.color.g,this.color.b),r=Ye(u(t)?n.h:_t(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 si(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=ei(e,!0);return null!=i?i:this}setColorName(t){const e=qe[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(t=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}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new ii(this.color.toString())}copyGammaToLinear(t,e=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,e=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=Qe(t.color.r),this.color.g=Qe(t.color.g),this.color.b=Qe(t.color.b),this}copyLinearToSRGB(t){return this.color.r=ti(t.color.r),this.color.g=ti(t.color.g),this.color.b=ti(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class si{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`#${Ze(this.r)+Ze(this.g)+Ze(this.b)+(1===this.opacity?"":Ze(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}=$e(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ni(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 si(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:$e});function ai(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 oi(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=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:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}function li(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 hi(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}const ci=1e-10;function di(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+ci)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=fi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=ae.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=ui(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-ci,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function ui(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function pi(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return ui(t,t-(i*i-e*e+t*t)/(2*i))+ui(e,s)}function gi(t,e){const i=ae.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function fi(t){const e={x:0,y:0};for(let i=0;ithis.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 _i;function yi(t,e){const i=vi(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 bi{constructor(t={}){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 xi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Si(t){let e;if(e=xi.exec(t))return new bi({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]});ot.getInstance().error("invalid format: "+t)}const Ai=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class ki{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 ki.instance||(ki.instance=new ki),ki.instance}newFormat(t){const e=Si(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"):Mi[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=Mi[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:_,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)?m: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?Ai[8+_i/3]:"")+A+(t&&"("===n?")":""),f)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=Si(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=vi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=Ai[8+n/3];return function(t){return s(r*t)+a}}}const Mi={"%":(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)=>yi(100*t,e),r:yi,s:function(t,e){const i=vi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(_i=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")+vi(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 Ti(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(_.fx>e.fx?(Bi(y,1+c,v,-c,e),y.fx=t(y),y.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Bi(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=te(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Ri(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Ei(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},ts=Math.sqrt,es=Math.tan;function is(t){return t>1?0:t<-1?ji:Math.acos(t)}function ss(t){return t>1?Hi:t<-1?-Hi:Math.asin(t)}function ns(){}function rs(t,e){t&&os.hasOwnProperty(t.type)&&os[t.type](t,e)}var as={Feature:function(t,e){rs(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sji?t+Math.round(-t/Ni)*Ni:t,e]}function bs(t,e,i){return(t%=Ni)?e||i?_s(Ss(t),As(e,i)):Ss(t):e||i?As(e,i):ys}function xs(t){return function(e,i){return[(e+=t)>ji?e-Ni:e<-ji?e+Ni:e,i]}}function Ss(t){var e=xs(t);return e.invert=xs(-t),e}function As(t,e){var i=Xi(t),s=Ji(t),n=Xi(e),r=Ji(e);function a(t,e){var a=Xi(e),o=Xi(t)*a,l=Ji(t)*a,h=Ji(e),c=h*i+o*s;return[$i(l*n-c*r,o*i-h*s),ss(c*n+l*r)]}return a.invert=function(t,e){var a=Xi(e),o=Xi(t)*a,l=Ji(t)*a,h=Ji(e),c=h*n-l*r;return[$i(l*n+h*r,o*i+c*s),ss(c*i-o*s)]},a}function ks(t,e){(e=us(e))[0]-=t,vs(e);var i=is(-e[1]);return((-e[2]<0?-i:i)+Ni-zi)%Ni}function Ms(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:ns,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function Ts(t,e){return Gi(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 Es(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Is(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 Ds(t,e,i,s){return function(n){var r,a,o,l=e(n),h=Ms(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Is(a);var t=function(t,e){var i=Rs(e),s=e[1],n=Ji(s),r=[Ji(i),-Xi(i),0],a=0,o=0;Ls.reset(),1===n?s=Hi+zi:-1===n&&(s=-Hi-zi);for(var l=0,h=t.length;l=0?1:-1,M=k*A,T=M>ji,w=f*x;if(Ls.add($i(w*k*Ji(M),m*S+w*Xi(M))),a+=T?A+k*Ni:A,T^p>=i^y>=i){var C=gs(us(u),us(_));vs(C);var E=gs(r,C);vs(E);var B=(T^A>=0?-1:1)*ss(E[2]);(s>B||s===B&&(C[0]||C[1]))&&(o+=T^A>=0?1:-1)}}return(a<-zi||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(Fs))}return u}}function Fs(t){return t.length>1}function zs(t,e){return((t=t.x)[0]<0?t[1]-Hi-zi:Hi-t[1])-((e=e.x)[0]<0?e[1]-Hi-zi:Hi-e[1])}1===(Bs=Os).length&&(Ps=Bs,Bs=function(t,e){return Os(Ps(t),e)});var js=Ds((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?ji:-ji,l=Gi(r-i);Gi(l-ji)0?Hi:-Hi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=ji&&(Gi(i-n)zi?Yi((Ji(e)*(r=Xi(s))*Ji(i)-Ji(s)*(n=Xi(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*Hi,s.point(-ji,n),s.point(0,n),s.point(ji,n),s.point(ji,0),s.point(ji,-n),s.point(0,-n),s.point(-ji,-n),s.point(-ji,0),s.point(-ji,n);else if(Gi(t[0]-e[0])>zi){var r=t[0]0,n=Gi(e)>zi;function r(t,i){return Xi(t)*Xi(i)>e}function a(t,i,s){var n=[1,0,0],r=gs(us(t),us(i)),a=ps(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=gs(n,r),u=ms(n,h);fs(u,ms(r,c));var p=d,g=ps(u,p),f=ps(p,p),m=g*g-f*(ps(u,u)-1);if(!(m<0)){var v=ts(m),_=ms(p,(-g-v)/f);if(fs(_,u),_=ds(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],A=i[1];x0^_[1]<(Gi(_[0]-b)ji^(b<=_[0]&&_[0]<=x)){var T=ms(p,(-g+v)/f);return fs(T,u),[_,ds(T)]}}}function o(e,i){var n=s?t:ji-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Ds(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],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?ji:-ji),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||Ts(e,p)||Ts(g,p))&&(g[2]=1),f!==l)c=0,f?(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^f){var v;m&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)))}!f||e&&Ts(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},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=Xi(e),o=Ji(e),l=s*i;null==n?(n=e+s*Ni,r=e-l/2):(n=ks(a,n),r=ks(a,r),(s>0?nr)&&(n+=s*Ni));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 Gi(s[0]-t)0?0:3:Gi(s[0]-i)0?2:1:Gi(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,f,m,v,_,y=a,b=Ms(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(A(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&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=Is(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&Cs(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&&m)y.point(r,a);else{var l=[g=Math.max(Ns,Math.min(Vs,g)),f=Math.max(Ns,Math.min(Vs,f))],b=[r=Math.max(Ns,Math.min(Vs,r)),a=Math.max(Ns,Math.min(Vs,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):(m||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Ws(t){return t}var Gs,Ys,$s,Xs,Ks=Oi(),qs=Oi(),Zs={point:ns,lineStart:ns,lineEnd:ns,polygonStart:function(){Zs.lineStart=Js,Zs.lineEnd=en},polygonEnd:function(){Zs.lineStart=Zs.lineEnd=Zs.point=ns,Ks.add(Gi(qs)),qs.reset()},result:function(){var t=Ks/2;return Ks.reset(),t}};function Js(){Zs.point=Qs}function Qs(t,e){Zs.point=tn,Gs=$s=t,Ys=Xs=e}function tn(t,e){qs.add(Xs*t-$s*e),$s=t,Xs=e}function en(){tn(Gs,Ys)}var sn=Zs,nn=1/0,rn=nn,an=-nn,on=an;var ln,hn,cn,dn,un={point:function(t,e){tan&&(an=t);eon&&(on=e)},lineStart:ns,lineEnd:ns,polygonStart:ns,polygonEnd:ns,result:function(){var t=[[nn,rn],[an,on]];return an=on=-(rn=nn=1/0),t}},pn=0,gn=0,fn=0,mn=0,vn=0,_n=0,yn=0,bn=0,xn=0,Sn={point:An,lineStart:kn,lineEnd:wn,polygonStart:function(){Sn.lineStart=Cn,Sn.lineEnd=En},polygonEnd:function(){Sn.point=An,Sn.lineStart=kn,Sn.lineEnd=wn},result:function(){var t=xn?[yn/xn,bn/xn]:_n?[mn/_n,vn/_n]:fn?[pn/fn,gn/fn]:[NaN,NaN];return pn=gn=fn=mn=vn=_n=yn=bn=xn=0,t}};function An(t,e){pn+=t,gn+=e,++fn}function kn(){Sn.point=Mn}function Mn(t,e){Sn.point=Tn,An(cn=t,dn=e)}function Tn(t,e){var i=t-cn,s=e-dn,n=ts(i*i+s*s);mn+=n*(cn+t)/2,vn+=n*(dn+e)/2,_n+=n,An(cn=t,dn=e)}function wn(){Sn.point=An}function Cn(){Sn.point=Bn}function En(){Pn(ln,hn)}function Bn(t,e){Sn.point=Pn,An(ln=cn=t,hn=dn=e)}function Pn(t,e){var i=t-cn,s=e-dn,n=ts(i*i+s*s);mn+=n*(cn+t)/2,vn+=n*(dn+e)/2,_n+=n,yn+=(n=dn*t-cn*e)*(cn+t),bn+=n*(dn+e),xn+=3*n,An(cn=t,dn=e)}var Ln=Sn;function Rn(t){this._context=t}Rn.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,Ni)}},result:ns};var On,In,Dn,Fn,zn,jn=Oi(),Hn={point:ns,lineStart:function(){Hn.point=Vn},lineEnd:function(){On&&Nn(In,Dn),Hn.point=ns},polygonStart:function(){On=!0},polygonEnd:function(){On=null},result:function(){var t=+jn;return jn.reset(),t}};function Vn(t,e){Hn.point=Nn,In=Fn=t,Dn=zn=e}function Nn(t,e){Fn-=t,zn-=e,jn.add(ts(Fn*Fn+zn*zn)),Fn=t,zn=e}var Un=Hn;function Wn(){this._string=[]}function Gn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Yn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),cs(t,i(s))),s.result()}return r.area=function(t){return cs(t,i(sn)),sn.result()},r.measure=function(t){return cs(t,i(Un)),Un.result()},r.bounds=function(t){return cs(t,i(un)),un.result()},r.centroid=function(t){return cs(t,i(Ln)),Ln.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ws):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Wn):new Rn(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 $n(t){return function(e){var i=new Xn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Xn(){}function Kn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),cs(i,t.stream(un)),e(un.result()),null!=s&&t.clipExtent(s),t}function qn(t,e,i){return Kn(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 Zn(t,e,i){return qn(t,[[0,0],e],i)}function Jn(t,e,i){return Kn(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 Qn(t,e,i){return Kn(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)}Wn.prototype={_radius:4.5,_circle:Gn(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=Gn(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}},Xn.prototype={constructor:Xn,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 tr=16,er=Xi(30*Wi);function ir(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&f--){var b=a+u,x=o+p,S=l+g,A=ts(b*b+x*x+S*S),k=ss(S/=A),M=Gi(Gi(S)-1)e||Gi((v*E+_*B)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Wi:0,E()):[m*Ui,v*Ui,_*Ui]},w.angle=function(t){return arguments.length?(y=t%360*Wi,E()):y*Ui},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=ir(o,T=t*t),B()):ts(T)},w.fitExtent=function(t,e){return qn(w,t,e)},w.fitSize=function(t,e){return Zn(w,t,e)},w.fitWidth=function(t,e){return Jn(w,t,e)},w.fitHeight=function(t,e){return Qn(w,t,e)},function(){return e=t.apply(this,arguments),w.invert=e.invert&&C,E()}}function lr(t){var e=0,i=ji/3,s=or(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Wi,i=t[1]*Wi):[e*Ui,i*Ui]},n}function hr(t,e){var i=Ji(t),s=(i+Ji(e))/2;if(Gi(s)2?t[2]*Wi:0),e.invert=function(e){return(e=t.invert(e[0]*Wi,e[1]*Wi))[0]*=Ui,e[1]*=Ui,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===mr?[[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 _r(t){return es((Hi+t)/2)}function yr(t,e){var i=Xi(t),s=t===e?Ji(t):qi(i/Xi(e))/qi(_r(e)/_r(t)),n=i*Zi(_r(t),s)/s;if(!s)return mr;function r(t,e){n>0?e<-Hi+zi&&(e=-Hi+zi):e>Hi-zi&&(e=Hi-zi);var i=n/Zi(_r(e),s);return[i*Ji(s*t),n-i*Xi(s*t)]}return r.invert=function(t,e){var i=n-e,r=Qi(s)*ts(t*t+i*i),a=$i(t,Gi(i))*Qi(i);return i*s<0&&(a-=ji*Qi(t)*Qi(i)),[a/s,2*Yi(Zi(n/r,1/s))-Hi]},r}function br(t,e){return[t,e]}function xr(t,e){var i=Xi(t),s=t===e?Ji(t):(i-Xi(e))/(e-t),n=i/s+t;if(Gi(s)zi&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Br.invert=pr(ss),Pr.invert=pr((function(t){return 2*Yi(t)})),Lr.invert=function(t,e){return[-e,2*Yi(Ki(t))-Hi]};var Ir={exports:{}},Dr=function(t,e){this.p1=t,this.p2=e};Dr.prototype.rise=function(){return this.p2[1]-this.p1[1]},Dr.prototype.run=function(){return this.p2[0]-this.p1[0]},Dr.prototype.slope=function(){return this.rise()/this.run()},Dr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Dr.prototype.isVertical=function(){return!isFinite(this.slope())},Dr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Dr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Dr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Dr.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)},Dr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Fr=Dr,zr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Fr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=zr(t.slice(0,s),e),o=zr(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},jr=zr;!function(t){var e=jr;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;r{const i=Vr(Wr,e),{tolerance:s}=i;return Hr(t,s)};var Yr;!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"}(Yr||(Yr={}));const $r=(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.sort&&(k(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!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;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,_=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],A=new Set,k=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),A.has(i)||(A.add(i),S.push(i),y(m)?k.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):k.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else _[r][l]+=a;e&&e.includeValues&&!v&&_[r][c].push(t[n]);break}}}let M=0;const T=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=_.length;t0?_[t][l]/M:0,T.push(_[t])}return T},Kr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,_=-1/0;if(e.extent)v=e.extent[0],_=e.extent[1];else for(let e=0;e_&&(_=s))}if(!Number.isFinite(v)||!Number.isFinite(_)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=_;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(_-v>1){const e=Math.floor(v),i=Math.ceil((_-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>_){t=s,m.length=t+1;break}}else{const e=(_-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>_){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",A=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",k=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",M=null!==(d=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==d?d:"percentage",T=y(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],w=y(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],C=w.length?w:void 0,E=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:A,percentageName:M,valuesName:k,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:C});if(!T.length)return Xr(t,E);const B={};return t.forEach((t=>{const e=T.map((e=>null==t?void 0:t[e])).join("-&&-");B[e]?B[e].push(t):B[e]=[t]})),Object.values(B).map((t=>{const e=[...w,...T];return Xr(t,Object.assign(Object.assign({},E),{groupField:e.length?e:void 0,n:t.length}))})).flat()},qr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,_;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const A=!!(null==e?void 0:e.includeValues),k=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},M=null!==(n=k.key)&&void 0!==n?n:y(x)?null:null!==(r=x)&&void 0!==r?r:"key",T=null!==(a=k.count)&&void 0!==a?a:"count",w=null!==(o=k.mean)&&void 0!==o?o:"mean",C=null!==(l=k.q1)&&void 0!==l?l:"q1",E=null!==(h=k.median)&&void 0!==h?h:"median",B=null!==(c=k.q3)&&void 0!==c?c:"q3",P=null!==(d=k.iqr)&&void 0!==d?d:"iqr",L=null!==(p=k.min)&&void 0!==p?p:"min",R=null!==(g=k.max)&&void 0!==g?g:"max",O=null!==(f=k.lowerWhisker)&&void 0!==f?f:"lowerWhisker",I=null!==(m=k.upperWhisker)&&void 0!==m?m:"upperWhisker",D=null!==(v=k.outliers)&&void 0!==v?v:"outliers",F=null!==(_=k.values)&&void 0!==_?_:"values",z=new Map,j=new Map,H=new Map,V=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),A&&j.set(r,[]),y(x)?H.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):H.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),A){const t=j.get(r);t&&t.push(i)}}y(S)&&(S=[_t(Math.min.apply(null,S),0,1),_t(Math.max.apply(null,S),0,1)]);const N=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=H.get(t);if(null!==M)f[M]=m;else if(y(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[T]=s,f[w]=o,f[C]=l,f[E]=h,f[B]=c,f[P]=d,f[L]=n,f[R]=r,f[O]=u,f[I]=p,f[D]=g,A&&(f[F]=j.get(t)||[]),N.push(f)}return N};var Zr={},Jr={};function Qr(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function ta(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function ea(t,e){var i=t+"",s=i.length;return s9999?"+"+ea(e,6):ea(e,4))+"-"+ea(t.getUTCMonth()+1,2)+"-"+ea(t.getUTCDate(),2)+(r?"T"+ea(i,2)+":"+ea(s,2)+":"+ea(n,2)+"."+ea(r,3)+"Z":n?"T"+ea(i,2)+":"+ea(s,2)+":"+ea(n,2)+"Z":s||i?"T"+ea(i,2)+":"+ea(s,2)+"Z":"")}function sa(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 Jr;if(h)return h=!1,Zr;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(;a0}function ga(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=oa(t));var r=[];switch(t.type){case"GeometryCollection":return fa(t,(function(t){va(t,s)})),t;case"FeatureCollection":return ga(t,(function(t){ga(va(t,s),(function(t){r.push(t)}))})),hi(r)}return va(t,s)}function va(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return fa(t,(function(t){va(t,e)})),t;case"LineString":return _a(ua(t),e),t;case"Polygon":return ya(ua(t),e),t;case"MultiLineString":return ua(t).forEach((function(t){_a(t,e)})),t;case"MultiPolygon":return ua(t).forEach((function(t){ya(t,e)})),t;case"Point":case"MultiPoint":return t}}function _a(t,e){pa(t)===e&&t.reverse()}function ya(t,e){pa(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=ba(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},ka=(t,e={},i)=>{i.type=Yr.GEO;const s=Vr(Sa,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Aa(t))})):e.push(Aa(t))})),e})(t);let l=t.features;return o&&(l=ma(t,{reverse:!g(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=xa.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=xa.bounds(t);t.bbox=e}})),t.features=l,t},Ma={},Ta=(t,e,i)=>{i.type=Yr.GEO;const s=Vr(Sa,Ma,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 Or(a,t)}))}:Or(a,o));var a,o;return ka(r,s,i)},wa=(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 Ca=0;function Ea(t="dataset"){return Ca>1e8&&(Ca=0),t+"_"+Ca++}class Ba{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:Ea("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:ot.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()}}class Pa{constructor(t,e){let i;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=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&U(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Ea("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){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,e=!0){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)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}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,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&U(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof Pa||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!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",$r),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Yn();const La={},Ra={albers:dr,albersusa:function(){var t,e,i,s,n,r,a=dr(),o=cr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=cr().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)}},Oa=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Ia(t,e){return function i(){const s=e();return s.type=t,s.path=Yn().projection(s),s.copy=s.copy||function(){const t=i();return Oa.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Da{static GenAutoIncrementId(){return Da.auto_increment_id++}}Da.auto_increment_id=0;class Fa{constructor(t){this.id=Da.GenAutoIncrementId(),this.registry=t}}const za="named",ja="inject",Ha="multi_inject",Va="inversify:tagged",Na="inversify:paramtypes";class Ua{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===za?`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="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),s=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),n=new WeakMap;function r(t,e,i){let r=n.get(t);if(h(r)){if(!i)return;r=new s,n.set(t,r)}let a=r.get(e);if(h(a)){if(!i)return;a=new s,r.set(e,a)}return a}function a(t,e,i){if(o(t,e,i))return!0;const s=f(e);return!c(s)&&a(t,s,i)}function o(t,e,i){const s=r(e,i,!1);return!h(s)&&!!s.has(t)}function l(t,e,i){if(o(t,e,i))return function(t,e,i){const s=r(e,i,!1);if(!h(s))return s.get(t)}(t,e,i);const s=f(e);return c(s)?void 0:l(t,s,i)}function h(t){return void 0===t}function c(t){return null===t}function d(t){return"object"==typeof t?null!==t:"function"==typeof t}function u(t,i){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const s=3===i?"string":5===i?"number":"default",n=function(t,e){const i=t[e];if(null!=i){if(!g(i))throw new TypeError;return i}}(t,e);if(void 0!==n){const e=n.call(t,s);if(d(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.valueOf;if(g(i)){const e=i.call(t);if(!d(e))return e}}else{const e=t.valueOf;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.toString;if(g(i)){const e=i.call(t);if(!d(e))return e}}throw new TypeError}(t,"default"===s?"number":s)}function p(t){const e=u(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function g(t){return"function"==typeof t}function f(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const s=t.prototype,n=s&&Object.getPrototypeOf(s);if(null==n||n===Object.prototype)return e;const r=n.constructor;return"function"!=typeof r||r===t?e:r}t("defineMetadata",(function(t,e,i,s){if(!d(i))throw new TypeError;return n=t,a=e,void r(i,s,!0).set(n,a);var n,a})),t("hasMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),l(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function Ga(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};Wa.hasOwnMetadata(t,e)&&(r=Wa.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,Wa.defineMetadata(t,r,e)}(Va,t,i.toString(),s)}function Ya(t){return(e,i,s)=>{Ga(e,0,s,t)}}function $a(t){return e=>(i,s,n)=>Ya(new Ua(t,e))(i,s,n)}const Xa=$a(ja),Ka=$a(Ha);function qa(){return function(t){return Wa.defineMetadata(Na,null,t),t}}function Za(t){return Ya(new Ua(za,t))}const Ja="Singleton",Qa="Transient",to="ConstantValue",eo="DynamicValue",io="Factory",so="Function",no="Instance",ro="Invalid";class ao{constructor(t,e){this.id=Da.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=ro,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new ao(this.serviceIdentifier,this.scope);return t.activated=t.scope===Ja&&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 oo{getConstructorMetadata(t){return{compilerGeneratedMetadata:Wa.getMetadata(Na,t),userGeneratedMetadata:Wa.getMetadata(Va,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const lo=(ho=za,t=>{const e=e=>{if(null==e)return!1;if(e.key===ho&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const po=Symbol("ContributionProvider");class go{constructor(t,e){this.serviceIdentifier=t,this.container=e,mo.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function fo(t,e){t(po).toDynamicValue((({container:t})=>new go(e,t))).inSingletonScope().whenTargetNamed(e)}class mo{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}mo.store=new Map;class vo{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 _o extends vo{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const yo=Symbol.for("EnvContribution"),bo=Symbol.for("VGlobal"),xo=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Qa,this.options=e,this.id=Da.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new oo}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,za,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new ao(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new uo(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[ja],multiInject:s[Ha]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:a,metadata:e,bindings:l};n.push(t)}}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case to:case so:e=t.cache;break;case no: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===Ja&&(t.cache=e,t.activated=!0)}},So=Symbol.for("RenderService");const Ao=new class{get renderService(){return this._renderService||(this._renderService=xo.get(So)),this._renderService}};let ko=0;class Mo{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=Ao.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++ko,t),this.tryRunAnimationFrameNextFrame(),ko}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class To{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var wo=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Co=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Eo=function(t,e){return function(i,s){e(i,s,t)}},Bo=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 Po=class extends To{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}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){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Da.GenAutoIncrementId(),this.hooks={onSetEnv:new _o(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}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)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new Mo);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}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)}loadFont(t,e,i){return Bo(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}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,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var Lo,Ro,Oo,Io;Po=wo([qa(),Eo(0,Xa(po)),Eo(0,Za(yo)),Co("design:paramtypes",[Object])],Po),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(Lo||(Lo={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(Ro||(Ro={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(Oo||(Oo={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(Io||(Io={}));const Do=Vt-1e-8;class Fo{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>Do)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%=Vt)<0&&(s+=Vt),(n%=Vt)<0&&(n+=Vt),nn;++o,a-=Ht)g(a);else for(a=s-s%Ht+Ht,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const jo=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,Ho={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},Vo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let No,Uo,Wo,Go,Yo,$o;var Xo,Ko,qo,Zo,Jo,Qo;function tl(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),f=Math.cos(n),m=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+f,A=i+m,k=S+y*m,M=A-y*f;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 el(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=oe(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 f=d/i,m=c/i,v=-c/s,_=d/s,y=f*o+m*l,b=v*o+_*l,x=f*t+m*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+=Vt:C>0&&0===r&&(C-=Vt);const E=Math.ceil(Math.abs(C/(Ht+.001))),B=[];for(let t=0;te.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 sl(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=cl(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=$t(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=$t(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function ul(t,e){const{p0:i,p1:s}=t,n=ae.pointAtPP(i,s,e);return[new pl(i,n),new pl(n,s)]}class pl extends nl{constructor(t,e){super(),this.type=Jo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return ae.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Wt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?ae.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Zo.ROW?Ut(this.p0.x-this.p1.x):t===Zo.COLUMN?Ut(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class gl{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new dl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new pl(new re(this._lastX,this._lastY),new re(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===Zo.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Ut(t.p0.y-s.y)}if(t===Zo.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Ut(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class fl extends gl{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 ml(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function vl(t,e,i){const s=null!=e?e:Ut(i[i.length-1].x-i[0].x)>Ut(i[i.length-1].y-i[0].y)?Zo.ROW:Zo.COLUMN;return"monotoneY"===t?new fl(t,s):new gl(t,s)}class _l{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 yl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=vl("linear",i,t);return function(t,e){ml(t,e,1)}(new _l(n,s),t),n}function bl(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 xl{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&&bl(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:bl(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 Sl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return yl(t,e);const n=vl("basis",i,t);return function(t,e){ml(t,e,2)}(new xl(n,s),t),n}function Al(t){return t<0?-1:1}function kl(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(Al(r)+Al(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Ml(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 wl{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,Ml(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,Ml(this,e=kl(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Tl(this,this._t0,e=kl(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 Cl extends wl{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function El(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return yl(t,e);const n=vl("monotoneX",i,t);return function(t,e){ml(t,e,2)}(new wl(n,s),t),n}function Bl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return yl(t,e);const n=vl("monotoneY",i,t);return function(t,e){ml(t,e,2)}(new Cl(n,s),t),n}let Pl=class{constructor(t,e=.5,i){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;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):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()}};class Ll extends Pl{lineEnd(){this.context.closePath()}}function Rl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new gl("step",null!=s?s:Ut(t[t.length-1].x-t[0].x)>Ut(t[t.length-1].y-t[0].y)?Zo.ROW:Zo.COLUMN);return Ol(new Pl(r,e,n),t),r}function Ol(t,e){return ml(t,e,1)}class Il extends _l{lineEnd(){this.context.closePath()}}function Dl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=vl("linear",i,t);return function(t,e){ml(t,e,1)}(new Il(n,s),t),n}function Fl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>zt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>zt){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function zl(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return yl(i,n);const o=vl(t,r,i);return ml(new e(o,s,a),i,2),o}}const jl=zl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:Fl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const Hl=zl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:Fl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class Vl extends nl{constructor(t,e,i){super(),this.type=Jo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return hl(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,rl([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===Zo.ROW?Ut(this.p0.x-this.p2.x):t===Zo.COLUMN?Ut(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Yt(t-.01,0),i=$t(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Wt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=hl(i,s,n,e),a=ae.pointAtPP(i,s,e),o=ae.pointAtPP(s,n,e);return[new Vl(i,a,r),new Vl(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Nl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new pl(new re(this._lastX,this._lastY),new re(t,e))}quadraticCurveTo(t,e,i,s){const n=new Vl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new dl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Ul(t,e,i){var s,n;switch(e){case"linear":default:return yl(t,i);case"basis":return Sl(t,i);case"monotoneX":return El(t,i);case"monotoneY":return Bl(t,i);case"step":return Rl(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new gl("step",null!=s?s:Ut(t[t.length-1].x-t[0].x)>Ut(t[t.length-1].y-t[0].y)?Zo.ROW:Zo.COLUMN);return Ol(new Ll(r,e,n),t),r}(t,.5,i);case"stepBefore":return Rl(t,0,i);case"stepAfter":return Rl(t,1,i);case"catmullRom":return jl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return Hl(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return Dl(t,i)}}class Wl extends zo{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Fo(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([Vo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([Vo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([Vo.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([Vo.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([Vo.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([Vo.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([Vo.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([Vo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([Vo.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()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Nl(this);sl(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[Vo.M]=t=>`M${t[1]} ${t[2]}`,t[Vo.L]=t=>`L${t[1]} ${t[2]}`,t[Vo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[Vo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[Vo.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3];((t,e,i,s,n,r,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;e`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[Vo.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,e=Wo;for(let s=1,r=i.length;s{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,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),sl(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Zo.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Ut(t.p0.y-e.p1.y)}if(this.direction===Zo.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Ut(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{ot.getInstance().warn("空函数")}}),lh=Object.assign(Object.assign({},th),{points:[],cornerRadius:0,closePath:!0}),hh=Object.assign(Object.assign({},th),{width:100,height:100,spikes:5,thickness:.5}),ch=Object.assign(Object.assign({},th),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},th),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const dh=Object.assign(Object.assign({},th),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),uh=Object.assign(Object.assign(Object.assign({},th),Zl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),ph=Object.assign(Object.assign(Object.assign({},th),Zl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",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}),gh=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0,maxWidth:500,maxHeight:500},th),{fill:!0,cornerRadius:0,cornerType:"round"}),fh=Object.assign(Object.assign({},gh),{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}),mh=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 m("directional",t.sideOrCorner,1)||m("angular",t.angleValue,1)}function a(){return m("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=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 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=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 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 vh{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(vh.IsGradientStr(t))try{const e=mh(t)[0];if(e){if("linear"===e.type)return vh.ParseLinear(e);if("radial"===e.type)return vh.ParseRadial(e);if("conic"===e.type)return vh.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=jt/2,n=parseFloat(e.value)/180*jt-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Nt,stops:vh.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:vh.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=jt/2;let n="angular"===e.type?parseFloat(e.value)/180*jt:0;for(;n<0;)n+=Nt;for(;n>=Nt;)n-=Nt;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}const bh={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"}},xh=!0,Sh=!1,Ah=/\w|\(|\)|-/,kh=/[.?!,;:/,。?!、;:]/,Mh=/\S/,Th=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function wh(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=Ao.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=Ch(t,a)),a}function Ch(t,e,i=!1){let s=e;for(;Ah.test(t[s-1])&&Ah.test(t[s])||kh.test(t[s]);)if(s--,s<=0)return i?Eh(t,e):e;return s}function Eh(t,e){let i=e;for(;Ah.test(t[i+1])&&Ah.test(t[i])||kh.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Bh(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=Ao.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}var Ph=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Lh=class{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=uh.fontSize}){let i=0,s=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 a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=Ch(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_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){if(s===n){ot.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}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),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);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}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,a=!1){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=Ch(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}};Lh=Ph([qa()],Lh);var Rh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Oh=Symbol.for("TextMeasureContribution");let Ih=class extends Lh{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}};Ih=Rh([qa()],Ih);const Dh=Symbol.for("CanvasFactory"),Fh=Symbol.for("Context2dFactory");function zh(t){return xo.getNamed(Dh,Ao.global.env)(t)}const jh=1e-4,Hh=Math.sqrt(3),Vh=1/3;function Nh(t){return t>-ec&&tec||t<-ec}const Wh=[0,0],Gh=[0,0],Yh=[0,0];function $h(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Xh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function Kh(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 qh(t){return(t%=Nt)<0&&(t+=Nt),t}function Zh(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+=Nt);let d=Math.atan2(l,o);return d<0&&(d+=Nt),d>=s&&d<=n||d+Nt>=s&&d+Nt<=n}function tc(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(Nh(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 sc=[-1,-1,-1],nc=[-1,-1];function rc(){const t=nc[0];nc[0]=nc[1],nc[1]=t}function ac(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(Nh(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,Vh):Math.pow(i,Vh),s=s<0?-Math.pow(-s,Vh):Math.pow(s,Vh);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+Hh*Math.sin(e)))/(3*a),h=(-o+i*(s-Hh*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,sc);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&rc(),p=Kh(e,s,r,o,nc[0]),u>1&&(g=Kh(e,s,r,o,nc[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Nh(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,sc);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=Xh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);sc[0]=-l,sc[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Nt-1e-4){s=0,n=Nt;const e=r?1:-1;return a>=sc[0]+t&&a<=sc[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Nt,n+=Nt);let c=0;for(let e=0;e<2;e++){const i=sc[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Nt+t),(t>=s&&t<=n||t+Nt>=s&&t+Nt<=n)&&(t>jt/2&&t<1.5*jt&&(e=-e),c+=e)}}return c}function hc(t){return Math.round(t/jt*1e8)/1e8%2*jt}function cc(t,e){let i=hc(t[0]);i<0&&(i+=Nt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Nt?n=i+Nt:e&&i-n>=Nt?n=i-Nt:!e&&i>n?n=i+(Nt-hc(i-n)):e&&i1&&(i||(h+=Re(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],v=a[2],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,A=b;dc[0]=S,dc[1]=A,cc(dc,Boolean(a[6])),S=dc[0],A=dc[1];const k=S,M=A-S,T=!!(1-(a[6]?0:1)),w=(s-m)*_/_+m;switch(f){case Vo.M:u=m,p=v,c=u,d=p;break;case Vo.L:if(i){if(tc(c,d,m,v,e,s,n))return!0}else h+=Re(c,d,m,v,s,n)||0;c=m,d=v;break;case Vo.C:if(i){if(Jh(c,d,m,v,_,y,b,x,e,s,n))return!0}else h+=ac(c,d,m,v,_,y,b,x,s,n)||0;c=b,d=x;break;case Vo.Q:if(i){if(Zh(c,d,m,v,_,y,e,s,n))return!0}else h+=oc(c,d,m,v,_,y,s,n)||0;c=_,d=y;break;case Vo.A:if(o=Math.cos(k)*_+m,l=Math.sin(k)*_+v,g?(u=o,p=l):h+=Re(c,d,o,l,s,n),i){if(Qh(m,v,_,k,k+M,T,e,w,n))return!0}else h+=lc(m,v,_,k,k+M,T,w,n);c=Math.cos(k+M)*_+m,d=Math.sin(k+M)*_+v;break;case Vo.R:if(u=c=m,p=d=v,o=u+_,l=p+y,i){if(tc(u,p,o,p,e,s,n)||tc(o,p,o,l,e,s,n)||tc(o,l,u,l,e,s,n)||tc(u,l,u,p,e,s,n))return!0}else h+=Re(o,p,o,l,s,n),h+=Re(u,l,u,p,s,n);break;case Vo.Z:if(i){if(tc(c,d,u,p,e,s,n))return!0}else h+=Re(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},fc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const mc=Symbol.for("VWindow"),vc=Symbol.for("WindowHandlerContribution");let _c=class extends To{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(){super(),this.hooks={onChange:new _o(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(xo.getNamed(vc,t.env).configure(this,t),this.actived=!0)},this._uid=Da.GenAutoIncrementId(),this.global=Ao.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}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.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}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)}};_c=gc([qa(),fc("design:paramtypes",[])],_c);var yc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xc=function(t,e){return function(i,s){e(i,s,t)}};let Sc=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=Ao.global,this._textMeasureMap=new Map,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}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||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=pc.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="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:Zl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Fe(Object.assign({defaultFontParams:{fontFamily:Zl.fontFamily,fontSize:Zl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=xo.get(mc),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 Ac;Sc=yc([qa(),xc(0,Xa(po)),xc(0,Za(Oh)),bc("design:paramtypes",[Object])],Sc),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Ac||(Ac={}));const kc=new We;let Mc=class{constructor(){this.matrix=new We}init(t){return this.mode=Ac.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Ac.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(kc.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(kc.a,kc.b,kc.c,kc.d,kc.e,kc.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(kc.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(kc.a,kc.b,kc.c,kc.d,kc.e,kc.f),this}scale(t,e,i){return this.mode===Ac.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Ac.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return kc.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(kc.a,kc.b,kc.c,kc.d,kc.e,kc.f),this}translate(t,e){return this.mode===Ac.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Ac.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Mc=yc([qa(),bc("design:paramtypes",[])],Mc);const Tc={arc:eh,area:ih,circle:sh,line:ah,path:oh,symbol:dh,text:uh,rect:ch,polygon:lh,star:hh,richtext:ph,richtextIcon:fh,image:gh,group:nh,glyph:rh},wc=Object.keys(Tc);function Cc(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Ec={arc:Object.assign({},Tc.arc),area:Object.assign({},Tc.area),circle:Object.assign({},Tc.circle),line:Object.assign({},Tc.line),path:Object.assign({},Tc.path),symbol:Object.assign({},Tc.symbol),text:Object.assign({},Tc.text),rect:Object.assign({},Tc.rect),polygon:Object.assign({},Tc.polygon),star:Object.assign({},Tc.star),richtext:Object.assign({},Tc.richtext),richtextIcon:Object.assign({},Tc.richtextIcon),image:Object.assign({},Tc.image),group:Object.assign({},Tc.group),glyph:Object.assign({},Tc.glyph)};class Bc{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},wc.forEach((t=>{this._defaultTheme[t]=Object.create(Ec[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,i=!1){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,ot.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;wc.forEach((s=>{const n=Object.create(Ec[s]);t&&t[s]&&Cc(n,t[s]),i[s]&&Cc(n,i[s]),e[s]&&Cc(n,e[s]),this.combinedTheme[s]=n})),e.common&&wc.forEach((t=>{Cc(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 Pc=new Bc;function Lc(t,e){return t.glyphHost?Lc(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)):Pc.getTheme()}return null}(t)||t.attachedThemeGraphic&&Lc(t.attachedThemeGraphic)||Pc.getTheme()}var Rc=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 Oc 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=Da.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){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,e=!1){return Rc(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,e=!0){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,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)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===t||t===e)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&&ot.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)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,e=!1){let 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,e=!1){let 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,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Fc))return void ot.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(Vc(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 Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=Vc(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 Fc))return void ot.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=Vc(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 Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=Vc(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 Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=Hc.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Vc(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(Vc(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,Vc(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(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 Fc))return void ot.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"):Vc(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 zc))return void ot.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=Hc.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.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),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,supportsTouchEvents:o}),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 Fc,this.rootWheelEvent=new zc,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.addEventListener("pointermove",this.onPointerMove,!0),t.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.addEventListener("mousemove",this.onPointerMove,!0),t.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.removeEventListener("pointermove",this.onPointerMove,!0),t.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.removeEventListener("mousemove",this.onPointerMove,!0),t.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 Yc{static GetImage(t,e){var i;const s=Yc.cache.get(t);s?"fail"===s.loadState?Ao.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):Yc.loadImage(t,e)}static GetSvg(t,e){var i;let s=Yc.cache.get(t);s?"fail"===s.loadState?Ao.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"},Yc.cache.set(t,s),s.dataPromise=Ao.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.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Yc.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Yc.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Ao.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Ao.global.loadBlob(t):"json"===e&&(i.dataPromise=Ao.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Yc.isLoading&&Yc.toLoadAueue.length){Yc.isLoading=!0;const t=Yc.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Yc.cache.set(i,n),n.dataPromise=Ao.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))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Yc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Yc.loading()})).catch((t=>{console.error(t),Yc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Yc.loading()}))}}),0)}static loadImage(t,e){const i=$c(t,Yc.toLoadAueue);if(-1!==i)return Yc.toLoadAueue[i].marks.push(e),void Yc.loading();Yc.toLoadAueue.push({url:t,marks:[e]}),Yc.loading()}static improveImageLoading(t){const e=$c(t,Yc.toLoadAueue);if(-1!==e){const t=Yc.toLoadAueue.splice(e,1);Yc.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function $c(t,e){for(let i=0;it?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(qc[0]=t[0],qc[2]=t[0],qc[1]=t[1],qc[3]=t[1],qc):t:t:0,Jc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Qc=[1,2,3,0,1,2,3,0];function td(t,e,i,s){for(;t>=Nt;)t-=Nt;for(;t<0;)t+=Nt;for(;t>e;)e+=Nt;Jc[0].x=i,Jc[1].y=i,Jc[2].x=-i,Jc[3].y=-i;const n=Math.ceil(t/Ht)%4,r=Math.ceil(e/Ht)%4;if(s.add(Gt(t)*i,Xt(t)*i),s.add(Gt(e)*i,Xt(e)*i),n!==r||e-t>jt){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{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)}}nd.TimeOut=1e3/60;const rd=new nd,ad=(t,e)=>{const i=((t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};class od{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}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function ld(t,e,i,s,n){return n?t.arc(i,s,e,0,Vt,!1,n):t.arc(i,s,e,0,Vt),!1}var hd=new class extends od{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 ld(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return ld(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(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 cd=new class extends od{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,this.parseSize(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,this.parseSize(e)/6,i,s,n,r)}};function dd(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 ud=new class extends od{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 dd(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return dd(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return dd(t,this.parseSize(e)/2+n,i,s,r)}};function pd(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var gd=new class extends od{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return pd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return pd(t,this.parseSize(e)/2+n,i,s)}};function fd(t,e,i,s,n=0){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}class md extends od{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 fd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return fd(t,this.parseSize(e)/2,i,s,n)}}var vd=new md;var _d=new class extends md{constructor(){super(...arguments),this.type="triangle"}};const yd=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),bd=Math.sin(Vt/10)*yd,xd=-Math.cos(Vt/10)*yd;function Sd(t,e,i,s){const n=bd*e,r=xd*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Vt*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 Ad=new class extends od{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 Sd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Sd(t,this.parseSize(e)/2+n,i,s)}};const kd=Kt(3);function Md(t,e,i,s){const n=e,r=n/kd,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 Td=new class extends od{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 Md(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Md(t,this.parseSize(e)/2+n,i,s)}};function wd(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 Cd=new class extends od{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return wd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return wd(t,this.parseSize(e)/2+n,i,s)}};function Ed(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Bd=new class extends od{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Ed(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ed(t,this.parseSize(e)/2+n,i,s)}};const Pd=-.5,Ld=Kt(3)/2,Rd=1/Kt(12);function Od(t,e,i,s){const n=e/2,r=e*Rd,a=n,o=e*Rd+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(Pd*n-Ld*r+i,Ld*n+Pd*r+s),t.lineTo(Pd*a-Ld*o+i,Ld*a+Pd*o+s),t.lineTo(Pd*l-Ld*h+i,Ld*l+Pd*h+s),t.lineTo(Pd*n+Ld*r+i,Pd*r-Ld*n+s),t.lineTo(Pd*a+Ld*o+i,Pd*o-Ld*a+s),t.lineTo(Pd*l+Ld*h+i,Pd*h-Ld*l+s),t.closePath(),!1}var Id=new class extends od{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 Od(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Od(t,this.parseSize(e)/2+n,i,s)}};function Dd(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}var Fd=new class extends od{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 Dd(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Dd(t,this.parseSize(e)/2,i,s,n)}};function zd(t,e,i,s,n=0){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}var jd=new class extends od{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 zd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return zd(t,this.parseSize(e)/2,i,s,n)}};function Hd(t,e,i,s,n=0){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}var Vd=new class extends od{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 Hd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Hd(t,this.parseSize(e)/2,i,s,n)}};const Nd=Kt(3);function Ud(t,e,i,s){const n=e*Nd;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var Wd=new class extends od{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Ud(t,this.parseSize(e)/2/Nd,i,s)}drawOffset(t,e,i,s,n){return Ud(t,this.parseSize(e)/2/Nd+n,i,s)}};function Gd(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 Yd=new class extends od{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 Gd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Gd(t,this.parseSize(e)/4+n,i,s)}};function $d(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 Xd=new class extends od{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 $d(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return $d(t,this.parseSize(e)/4+n,i,s)}};function Kd(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 qd=new class extends od{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 Kd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Kd(t,this.parseSize(e)/4+n,i,s)}};function Zd(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 Jd=new class extends od{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 Zd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Zd(t,this.parseSize(e)/4+n,i,s)}};function Qd(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var tu=new class extends od{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return Qd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Qd(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function eu(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var iu=new class extends od{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return eu(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return eu(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function su(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 nu=new class extends od{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 su(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return su(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function ru(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function au(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var ou=new class extends od{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)?au(t,e,i,s):ru(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?au(t,e+2*n,i,s):ru(t,[e[0]+2*n,e[1]+2*n],i,s)}};const lu=new Ne;class hu{constructor(t,e,i=!1){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 e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),sl(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(sl(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{lu.x1=i.bounds.x1*t,lu.y1=i.bounds.y1*t,lu.x2=i.bounds.x2*t,lu.y2=i.bounds.y2*t,e.union(lu)}))}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 cu={};[hd,cd,ud,gd,Wd,_d,Ad,Td,Cd,Bd,Id,Fd,jd,vd,Vd,Yd,Xd,qd,Jd,ou,tu,iu,nu].forEach((t=>{cu[t.type]=t}));const du={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"};class uu{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 pu(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function gu(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",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=gu(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=pu(t,"--\x3e",r+4,"Comment is not closed.");else{const a=gu(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 uu(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 uu(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 vu(t,e){return _u(t)}function _u(t,e){const i={};for(let e=0;ewu.set(t,!0)));const Cu=new Map;function Eu(t){if(wu.has(t))return!0;if(Cu.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>Cu.set(t,!0)));const Bu=Mu(),Pu=Mu(),Lu=Mu(),Ru=Mu(),Ou=Mu(),Iu=Mu(),Du=Mu(),Fu=Mu(),zu=Mu(),ju=Mu();Mu();const Hu=Mu();Mu();const Vu=Mu();Mu();const Nu=Mu(),Uu=Mu(),Wu=Symbol.for("GraphicService"),Gu=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"},$u=Object.keys(Yu),Xu={duration:200,easing:"cubicOut"};function Ku(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}function qu(t,e,i){const s=i[0],n=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]*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],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*s+c*n+g*r+e[12],t[13]=o*s+d*n+f*r+e[13],t[14]=l*s+u*n+m*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function Zu(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 Ju(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],f=e[12],m=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*f,t[1]=y*n+b*l+x*u+S*m,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*f,t[5]=y*n+b*l+x*u+S*m,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*f,t[9]=y*n+b*l+x*u+S*m,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*f,t[13]=y*n+b*l+x*u+S*m,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function Qu(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 tp{constructor(){this.pools=[]}static identity(t){return Ku(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 tp.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},np=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const rp=new We(1,0,0,1,0,0),ap={x:0,y:0};let op=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new We(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new We(1,0,0,1,0,0),this.path=new Wl,this._clearMatrix=new We(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return ep.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new We(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(ep.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(ep.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){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,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=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(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){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},ap),function(t,e,i){return uc(t,0,!1,e,i)}(this.path.commandList,ap.x,ap.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},ap);const i=_h(this,this.lineWidth,this.dpr);return function(t,e,i,s){return uc(t,e,!0,i,s)}(this.path.commandList,i,ap.x,ap.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(t=!0,e=this.dpr){this.setTransformFromMatrix(rp,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>ep.free(t))),this.stack.length=0}};op=sp([qa(),np("design:paramtypes",[Object,Number])],op);const lp={WIDTH:500,HEIGHT:500,DPR:1};class hp{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}set nativeCanvas(t){this._nativeCanvas=t}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=lp.WIDTH,height:n=lp.HEIGHT,dpr:r=lp.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(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var cp;hp.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(cp||(cp={}));class dp{static Get(t,e=cp.Color1,i=[0,0,0,1]){if(e===cp.Color1){const e=dp.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ii.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];dp.store1[t]=e,dp.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=dp.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ii.parseColorString(t);return n&&(dp.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],dp.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===cp.Color1){if(dp.store1[t])return;dp.store1[t]=i,dp.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(dp.store255[t])return;dp.store255[t]=i,dp.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function up(t,e=!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 pp(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)=>{var a,o;return gp(y(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,y(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):gp(t,e,i,s,n)}function gp(t,e,i,s,n){if(!t||!e)return t&&up(t)||e&&up(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=dp.Get(t,cp.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=dp.Get(e,cp.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:up(a)})))});return o?pp(r,l,i,s,n):pp(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:_p(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:_p(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:_p(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),up(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)}function fp(t,e,i){return`rgba(${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})`}dp.store255={},dp.store1={};const mp=[0,0,0,0],vp=[0,0,0,0];function _p(t,e,i){return dp.Get(t,cp.Color255,mp),dp.Get(e,cp.Color255,vp),`rgba(${Math.round(mp[0]+(vp[0]-mp[0])*i)},${Math.round(mp[1]+(vp[1]-mp[1])*i)},${Math.round(mp[2]+(vp[2]-mp[2])*i)},${mp[3]+(vp[3]-mp[3])*i})`}class yp{static GetCanvas(){try{return yp.canvas||(yp.canvas=Ao.global.createCanvas({})),yp.canvas}catch(t){return null}}static GetCtx(){if(!yp.ctx){const t=yp.GetCanvas();yp.ctx=t.getContext("2d")}return yp.ctx}}class bp extends Ge{static getInstance(){return bp._instance||(bp._instance=new bp),bp._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=yp.GetCanvas(),s=yp.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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new bp(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class xp{static GetSize(t){for(let e=0;e=t)return xp.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=xp.GenKey(t,e,i,s,n),l=xp.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=xp.GenKey(t,e,i,s,n);xp.cache[l]?xp.cache[l].push({width:a,height:o,pattern:r}):xp.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}xp.cache={},xp.ImageSize=[20,40,80,160,320,640,1280,2560];const Sp=new Ne,Ap=new We;new Ne;const kp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],Mp=["x","y"],Tp=["scaleX","scaleY"],wp=["angle"],Cp=new re,Ep={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Bp extends Oc{static mixin(t){const e=Object.keys(t);for(let i=0;i10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=cu[t];if(e)return e;if(e=Bp.userSymbolMap[t],e)return e;if(!0===((i=t=du[t]||t).startsWith("{const e=(new Wl).fromString(t.d),i={};$u.forEach((e=>{t[e]&&(i[Yu[e]]=t[e])})),n.push({path:e,attribute:i}),Sp.union(e.bounds)}));const r=Sp.width(),a=Sp.height(),o=1/Yt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new hu(t,n,!0);return Bp.userSymbolMap[t]=l,l}var i;const s=(new Wl).fromString(t),n=s.bounds.width(),r=s.bounds.height(),a=1/Yt(n,r);s.transform(0,0,a,a);const o=new hu(t,s);return Bp.userSymbolMap[t]=o,o}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,s=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:n=e.boundsPadding}=i,r=Zc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new Fo(t);return sl(e.commandList,i,0,0),!0}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(t=!0){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(t=!0){return this._transMatrix||(this._transMatrix=new We),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&Xo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&Xo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&Xo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&Xo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&Xo.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&Xo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=Xo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===Ko.GLOBAL){const i=new re(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){this.setAttributes(t,e,i),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||s)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,i){t&&((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,e=!1,i){const s=Object.keys(t);for(let e=0;e{i[e]?(o||(o={}),o[e]=t[e]):a[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(r=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==r?r:Xu;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:a,duration:l.duration,easing:l.easing}}]),o&&this.setAttributesAndPreventAnimate(o,!1,{type:qo.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t)}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:qo.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{type:qo.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(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,i;const s=this.attribute[t];return this.animates&&this.animates.size?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=s?s:null===(i=this.finalAttribute)||void 0===i?void 0:i[t]}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){const i=y(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);s.length!==this.currentStates.length&&this.useStates(s,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;this.stateSort&&(t=t.sort(this.stateSort));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|=Xo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=Xo.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=Xo.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&Xo.UPDATE_SHAPE_AND_BOUNDS)===Xo.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=Xo.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Xo.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Xo.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=Xo.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=Xo.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=Xo.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=Xo.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&Xo.UPDATE_LAYOUT)}getAnchor(t,e,i){const s=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=$l.x,y:e=$l.y,scaleX:i=$l.scaleX,scaleY:s=$l.scaleY,angle:n=$l.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(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=Gt(a),f=Xt(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const _=m-i,y=v-s,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,A=d*g-h*f;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*A,t.e=u+l*m+c*v-b*_-S*y,t.f=p+h*m+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,!0),Ao.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY($l);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Ap.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.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:qo.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Ao.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),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 Wl).fromString(t):this.pathProxy=new Wl,this.pathProxy}loadImage(t,e=!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(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",this.stopAnimates(),Ao.graphicService.onRelease(this),super.release()}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new jc(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)}}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||Ao.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new op(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}var Pp;Bp.userSymbolMap={},Bp.mixin(Uc),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Pp||(Pp={}));let Lp=class t extends Bp{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Iu,this._childUpdateTag=Xo.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 Bc),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Bc)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===Ko.GLOBAL){const i=new re(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&Xo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=$l.x,y:e=$l.y,dx:i=$l.dx,dy:s=$l.dy,scaleX:n=$l.scaleX,scaleY:r=$l.scaleY,angle:a=$l.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()}getGraphicTheme(){return Lc(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return Ao.graphicService.updateTempAABBBounds(i),Ao.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=Xo.CLEAR_BOUNDS,this._childUpdateTag&=Xo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=Xo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&Xo.UPDATE_BOUNDS||(this._childUpdateTag|=Xo.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(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().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),this.getGraphicService().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(t=!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&Xo.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=Ao.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}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}};function Rp(t){return new Lp(t)}Lp.NOWORK_ANIMATE_ATTR=Ep;class Op extends Lp{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 Bc,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!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=>{Ao.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=>{Ao.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 Ip=Symbol.for("TransformUtil"),Dp=Symbol.for("GraphicUtil"),Fp=Symbol.for("LayerService"),zp=Symbol.for("StaticLayerHandlerContribution"),jp=Symbol.for("DynamicLayerHandlerContribution"),Hp=Symbol.for("VirtualLayerHandlerContribution");var Vp,Np=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)};let Wp=Vp=class{static GenerateLayerId(){return`${Vp.idprefix}_${Vp.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Ao.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?xo.get(zp):"dynamic"===t?xo.get(jp):xo.get(Hp),e}createLayer(t,e={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 Op(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Vp.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)}};Wp.idprefix="visactor_layer",Wp.prefix_count=0,Wp=Vp=Np([qa(),Up("design:paramtypes",[])],Wp);var Gp=new Fa((t=>{t(bo).to(Po).inSingletonScope(),t(mc).to(_c),t(Dp).to(Sc).inSingletonScope(),t(Ip).to(Mc).inSingletonScope(),t(Fp).to(Wp).inSingletonScope()}));function Yp(t,e){return!(!t&&!e)}function $p(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Xp(t,e,i){return i&&t*e>0}function Kp(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function qp(t,e){return t*e>0}function Zp(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Jp(t,e,i,s,n,r,a){const o=t-i,l=e-s,h=(a?r:-r)/Math.sqrt(o*o+l*l),c=h*l,d=-h*o,u=t+c,p=e+d,g=i+c,f=s+d,m=(u+g)/2,v=(p+f)/2,_=g-u,y=f-p,b=_*_+y*y,x=n-r,S=u*f-g*p,A=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let k=(S*y-_*A)/b,M=(-S*_-y*A)/b;const T=(S*y+_*A)/b,w=(-S*_+y*A)/b,C=k-m,E=M-v,B=T-m,P=w-v;return C*C+E*E>B*B+P*P&&(k=T,M=w),{cx:k,cy:M,x01:-c,y01:-d,x11:k*(n/x-1),y11:M*(n/x-1)}}function Qp(t,e,i,s,n){const r=Ut(i-e),a=t.getParsedCornerRadius(),o=y(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,_=Math.max(f,g),b=Math.max(m,v);let x=_,S=b;const A=n*Gt(c),k=n*Xt(c),M=s*Gt(u),T=s*Xt(u);let w,C,E,B;if((b>zt||_>zt)&&(w=n*Gt(d),C=n*Xt(d),E=s*Gt(p),B=s*Xt(p),r1?0:P<-1?jt:Math.acos(P))/2),l=Kt(t[0]*t[0]+t[1]*t[1]);S=$t(b,(s-l)/(o-1)),x=$t(_,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:E,yirs:B,xore:w,yore:C,xire:M,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:_,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function tg(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ut(l-o),c=l>o;let d=!1;if(n=Nt-zt)e.moveTo(i+n*Gt(o),s+n*Xt(o)),e.arc(i,s,n,o,l,!c),r>zt&&(e.moveTo(i+r*Gt(l),s+r*Xt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:M,limitedIcr:T,innerDeltaAngle:w,innerEndAngle:C,innerStartAngle:E,innerCornerRadiusStart:B,innerCornerRadiusEnd:P,maxInnerCornerRadius:L}=Qp(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>zt){const t=$t(v,m),r=$t(_,m),o=Jp(g,f,u,p,n,t,Number(c)),l=Jp(b,x,S,A,n,r,Number(c));m0&&e.arc(i+o.cx,s+o.cy,t,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,n,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Gt(Wt(l.y01,l.x01)),s+l.cy+r*Xt(Wt(l.y01,l.x01))):e.moveTo(i+b,s+n*Xt(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,M,!c)):e.moveTo(i+n*Gt(M),s+n*Xt(M));if(!(r>zt)||w<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(T>zt){const t=$t(B,T),n=$t(P,T),o=Jp(S,A,b,x,r,-n,Number(c)),l=Jp(u,p,g,f,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,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,r,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Gt(Wt(l.y01,l.x01)),s+l.cy+t*Xt(Wt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),!a||a[2]?e.arc(i,s,r,C,E,c):e.moveTo(i+r*Gt(E),s+r*Xt(E))}return a?a[3]&&e.lineTo(i+n*Gt(o),s+n*Xt(o)):e.closePath(),d}const eg=Symbol.for("ArcRenderContribution"),ig=Symbol.for("AreaRenderContribution"),sg=Symbol.for("CircleRenderContribution"),ng=Symbol.for("GroupRenderContribution"),rg=Symbol.for("ImageRenderContribution"),ag=Symbol.for("PathRenderContribution"),og=Symbol.for("PolygonRenderContribution"),lg=Symbol.for("RectRenderContribution"),hg=Symbol.for("SymbolRenderContribution"),cg=Symbol.for("TextRenderContribution"),dg=Symbol.for("InteractiveSubRenderContribution");function ug(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function pg(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}var gg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mg=function(t,e){return function(i,s){e(i,s,t)}};function vg(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:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:v}=e.attribute,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(s=m[2])&&void 0!==s?s:0}if(Ku(t),qu(t,t,[n+o,r+l,a+h]),qu(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),qu(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]),f){const i=ip.allocate(),s=[0,0];if(v){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=m[1]}qu(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,f),qu(i,i,[-s[0],-s[1],0]),Ju(t,t,i)}}let _g=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new _o(["graphic"]),onSetStage:new _o(["graphic","stage"]),onRemove:new _o(["graphic"]),onRelease:new _o(["graphic"]),onAddIncremental:new _o(["graphic","group","stage"]),onClearIncremental:new _o(["graphic","group","stage"]),beforeUpdateAABBBounds:new _o(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new _o(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new _o(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ne,this.tempAABBBounds2=new Ne}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)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new Fo(t);return sl(i.commandList,s,0,0),!0}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=pg(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=ug(n,e);i.set(s,i.y1,s+e,i.y2)}}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){Au(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;Au(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&&He(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};_g=gg([qa(),mg(0,Xa(Gu)),fg("design:paramtypes",[Object])],_g);const yg=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},bg=["radius","startAngle","endAngle",...kp];class xg extends Bp{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=Ru}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)}getGraphicTheme(){return Lc(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Ao.graphicService.updateTempAABBBounds(i);return yg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Nt-zt?i.set(-r,-r,r,r):td(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,bg)}needUpdateTag(t){return super.needUpdateTag(t,bg)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Wl,s.arc(0,0,r,a,o),s}clone(){return new xg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return xg.NOWORK_ANIMATE_ATTR}}function Sg(t){return new xg(t)}xg.NOWORK_ANIMATE_ATTR=Ep;class Ag{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Lo.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,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;a{t+=e.str})),(Array.isArray(r)?r.join(""):r).toString()!==t}return"vertical"===s.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==s.text.toString():null!=this.clipedText&&this.clipedText!==s.text.toString()}get multilineLayout(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=Uu,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}getGraphicTheme(){return Lc(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new Mg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Te(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=Ao.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Au(n,o/Math.abs(r+a),!0,l),i.union(n)}return Ao.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Ao.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,He(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:_=s.ignoreBuf,keepCenterInLine:y=s.keepCenterInLine}=n,b=_?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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(f/2),this._AABBBounds}const S=Ao.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new Ag(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:y}),{bbox:k}=A;return this.cache.layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{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,measureMode:v=r.measureMode,suffixPosition:_=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),k=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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 M=Ao.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),T={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:k},w=new Ag(a,T,M),C=y(t)?t.map((t=>t.toString())):[t.toString()],E=[],B=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/k),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),B[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const t=ug(_,a),e=this.cache.verticalList.length*v,i=pg(y,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>function(t){const e=[];let i=0,s="";for(let n=0;n{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===Tu.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))})),this.cache.verticalList=b,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const x=ug(_,a),S=this.cache.verticalList.length*v,A=pg(y,S,d);return this._AABBBounds.set(A,x,A+S,x+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=ad(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=kg){return super.needUpdateTags(t,e)}needUpdateTag(t,e=kg){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new Mg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Mg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return Mg.baselineMapAlign}getAlignMapBaseline(){return Mg.alignMapBaseline}}function Tg(t){return new Mg(t)}Mg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Ep),Mg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},Mg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const wg=["symbolType","size",...kp];let Cg=class t extends Bp{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=Nu}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}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{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return Lc(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Ao.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Au(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(y(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){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,wg)}needUpdateTag(t){return super.needUpdateTag(t,wg)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new Wl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Wl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Eg(t){return new Cg(t)}Cg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Ep);const Bg=["segments","points","curveType","curveTension",...kp];let Pg=class t extends Bp{constructor(t={}){super(t),this.type="line",this.numberType=Fu}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=id(i,s,e))}getGraphicTheme(){return Lc(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),Ao.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Bg)}needUpdateTag(t){return super.needUpdateTag(t,Bg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Wl;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Lg(t){return new Pg(t)}Pg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ep);const Rg=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}},Og=["width","x1","y1","height","cornerRadius",...kp];class Ig extends Bp{constructor(t){super(t),this.type="rect",this.numberType=Hu}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Lc(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=Ao.graphicService.updateTempAABBBounds(i);return yg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Og)}needUpdateTag(t){return super.needUpdateTag(t,Og)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=Rg(e);return t=new Wl,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new Ig(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ig.NOWORK_ANIMATE_ATTR}}function Dg(t){return new Ig(t)}Ig.NOWORK_ANIMATE_ATTR=Ep;class Fg extends Bp{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,e=!1,i){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}getGraphicTheme(){return Lc(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}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(),this.stateSort&&(t=t.sort(this.stateSort));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.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Fg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Fg.NOWORK_ANIMATE_ATTR}}function zg(t){return new Fg(t)}Fg.NOWORK_ANIMATE_ATTR=Ep;class jg{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=bh[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}}}function Hg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Vg{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=ad(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Bh(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||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,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r: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}=Bh(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=wh(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Bh(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=Hg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=wh(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Bh(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&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=wh(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Bh(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const Ng=["width","height","image",...kp];class Ug extends Bp{constructor(t){super(t),this.type="image",this.numberType=Du,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}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()})),this.addUpdateBoundTag()}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)}getGraphicTheme(){return Lc(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=Ao.graphicService.updateTempAABBBounds(i);return yg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return gh[t]}needUpdateTags(t){return super.needUpdateTags(t,Ng)}needUpdateTag(t){return super.needUpdateTag(t,Ng)}clone(){return new Ug(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ug.NOWORK_ANIMATE_ATTR}}function Wg(t){return new Ug(t)}Ug.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Ep);class Gg extends Ug{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=Zc(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=Zc(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=gh.width,height:e=gh.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 Yg{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 Gg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=bh[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Vg){const e=Mh.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,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Gg)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Bh(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Gg)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Gg)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||Sh;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,Th(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||xh;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?yh(t,s,{AABBBounds:i}):s,Th(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Gg)break;const{width:n}=Bh(t,s.character,s.ascentDescentMode),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.forEach(((t,e)=>{i+=t instanceof Gg?t.width:t.getWidthWithEllips(this.direction)})),i}}class $g{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=bh[this.direction]}store(t){if(t instanceof Gg){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 Yg(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,e=!1){t instanceof Gg?"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||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=wh(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Vg(i,t.newLine,t.character,t.ascentDescentMode),new Vg(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Xg=!1;try{Xg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Xg=!1}const Kg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...kp];class qg extends Bp{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Vu,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:ph.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:ph.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:ph.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:ph.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:ph.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:ph.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:ph.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:ph.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Lc(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&_(t.text)&&qg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&_(t.text)&&qg.splitText(t.text).length>1)))}static splitText(t){if(Xg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=qg.splitText(t.text.toString());if(_(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),Ao.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Ao.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Kg)}needUpdateTag(t){return super.needUpdateTag(t,Kg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!qg.AllSingleCharacter(_)&&(_=qg.TransformTextConfig2SingleCharacter(_),this.attribute.textConfig=_);const y=[],b=null!=t?t:_;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,y.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),M="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),T=new jg(0,0,(k?n:x?i:0)||0,(M?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&x,!M&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),w=new $g(T);if(w.newLine=v,p){let t=0,e=!1;for(let i=0;i{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new qg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(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())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return qg.NOWORK_ANIMATE_ATTR}}function Zg(t){return new qg(t)}qg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Ep);const Jg=["path","customPath",...kp];class Qg extends Bp{constructor(t){super(t),this.type="path",this.numberType=zu}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=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Wl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Wl?this.cache:t.path)}getGraphicTheme(){return Lc(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=Ao.graphicService.updateTempAABBBounds(i);yg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new Wl).fromString(t.path):t.customPath&&(this.cache=new Wl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,Jg)}needUpdateTag(t){return super.needUpdateTag(t,Jg)}toCustomPath(){return(new Wl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Qg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Qg.NOWORK_ANIMATE_ATTR}}function tf(t){return new Qg(t)}Qg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Ep);const ef=["segments","points","curveType","curveTension",...kp];class sf extends Bp{constructor(t){super(t),this.type="area",this.numberType=Lu}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}getGraphicTheme(){return Lc(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),Ao.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),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}_interpolate(t,e,i,s,n){"points"===t&&(n.points=id(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,ef)}needUpdateTag(t){return super.needUpdateTag(t,ef)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Wl;const 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 sf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return sf.NOWORK_ANIMATE_ATTR}}function nf(t){return new sf(t)}sf.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ep);const rf=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...kp];class af extends Bp{constructor(t){super(t),this.type="arc",this.numberType=Bu}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=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(y(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();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=he(e),i=e+r,s&&Ut(r)zt&&o>zt)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=this.getGraphicTheme(),{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=Kt(a*a+o*o)}=this.attribute,h=Ut(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>zt&&l>zt){const i=e>t?1:-1;let s=Zt(Number(l)/o*Xt(g)),n=Zt(Number(l)/a*Xt(g));return(f-=2*s)>zt?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>zt?(n*=i,c+=n,d-=n):(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}}getGraphicTheme(){return Lc(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Ao.graphicService.updateTempAABBBounds(i);yg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=zt?i.set(0,0,0,0):Math.abs(o-l)>Nt-zt?i.set(-s,-s,s,s):(td(l,o,s,i),td(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,rf)}needUpdateTag(t){return super.needUpdateTag(t,rf)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Ut(o-a),d=o>a;if(h=Nt-zt)n.moveTo(0+h*Gt(a),0+h*Xt(a)),n.arc(0,0,h,a,o,!d),l>zt&&(n.moveTo(0+l*Gt(o),0+l*Xt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Gt(a),e=h*Xt(a),i=l*Gt(o),s=l*Xt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new af(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return af.NOWORK_ANIMATE_ATTR}}function of(t){return new af(t)}af.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Ep);const lf=["points","cornerRadius",...kp];class hf extends Bp{constructor(t){super(t),this.type="polygon",this.numberType=ju}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Lc(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),Ao.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=id(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,lf)}needUpdateTag(t){return super.needUpdateTag(t,lf)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Wl,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new hf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return hf.NOWORK_ANIMATE_ATTR}}function cf(t){return new hf(t)}hf.NOWORK_ANIMATE_ATTR=Ep;class df extends Lp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!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 uf(t){return new df(t)}const pf=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 gf,ff;function mf(t){return gf||(gf=pf.CreateGraphic("text",{})),gf.initAttributes(t),gf.AABBBounds}var vf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},yf=function(t,e){return function(i,s){e(i,s,t)}};class bf{constructor(){this.time=Qo.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:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit,backgroundKeepAspectRatio:y=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip}=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=Lc(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:_,backgroundKeepAspectRatio:y,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s){const{backgroundMode:n,backgroundFit:r,backgroundKeepAspectRatio:a,backgroundScale:o=1,backgroundOffsetX:l=0,backgroundOffsetY:h=0}=s,c=i.width(),d=i.height();let u=c,p=d;if("no-repeat"===n)if(r)if(a){const s=Math.max(c/e.width,d/e.height);t.drawImage(e,i.x1+l,i.y1+h,e.width*s*o,e.height*s*o)}else t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const s=e.width*o,n=e.height*o;t.drawImage(e,i.x1+l,i.y1+h,s,n)}else{if(r&&"repeat"!==n&&(e.width||e.height)){const i=e.width,s=e.height;"repeat-x"===n?(u=i*(d/s),p=d):"repeat-y"===n&&(p=s*(c/i),u=c);const r=t.dpr,a=pc.allocate({width:u,height:p,dpr:r}),o=a.getContext("2d");o&&(o.inuse=!0,o.clearMatrix(),o.setTransformForCurrent(!0),o.clearRect(0,0,u,p),o.drawImage(e,0,0,u,p),e=a.nativeCanvas),pc.free(a)}const s=t.dpr,a=t.createPattern(e,n);a.setTransform&&a.setTransform(new DOMMatrix([1/s,0,0,1/s,0,0])),t.fillStyle=a,t.translate(i.x1,i.y1),t.fillRect(0,0,c,d),t.translate(-i.x1,-i.y1)}}}const xf=new bf;let Sf=class{constructor(t){this.subRenderContribitions=t,this.time=Qo.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)}))}};Sf=vf([qa(),yf(0,Xa(po)),yf(0,Za(dg)),_f("design:paramtypes",[Object])],Sf);const Af=new class{constructor(){this.time=Qo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),_=t.AABBBounds,y=null!==(p=t.attribute.width)&&void 0!==p?p:_.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:_.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[y,b],i+y/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const kf=new class{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}};class Mf{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=pc.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])),pc.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,Nt),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:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h;const{textureRatio:c=r.textureRatio,textureOptions:d=null}=e.attribute;let u=this.textureMap.get(t);if(!u)switch(t){case"circle":u=this.createCirclePattern(o,l,a,i);break;case"diamond":u=this.createDiamondPattern(o,l,a,i);break;case"rect":u=this.createRectPattern(o,l,a,i);break;case"vertical-line":u=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":u=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":u=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":u=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":u=this.createGridPattern(o,l,a,i)}if(d&&d.dynamicTexture){const{gridConfig:u={},useNewCanvas:p}=d,g=e.AABBBounds;s=g.x1,n=g.y1;const f=i;let m;if(p){m=pc.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=m.getContext("2d");t.clearRect(0,0,g.width(),g.height()),s=0,n=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,s,n,r),f.clip();const v=g.width(),_=g.height(),y=l,b=o,x=u.columns?u.columns:Math.ceil(v/b),S=u.rows?u.rows:Math.ceil(_/b),A=u.gutterColumn?u.gutterColumn:2*y,k=u.gutterRow?u.gutterRow:2*y;this._tempSymbolGraphic||(this._tempSymbolGraphic=Eg({}));const M=u.columns?v/u.columns:b,T=u.rows?_/u.rows:b;this._tempSymbolGraphic.setAttributes({size:[M-A,T-k],symbolType:t});const w=this._tempSymbolGraphic.getParsedPath();for(let t=0;t{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:_h(e,o,e.dpr),c=o/w,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:w+u*h,innerRadius:T-u*h,startAngle:_-u*c,endAngle:y+u*c}),e.beginPath(),tg(t,e,i,s,w+u*h,T-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/A,(S-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder"),t.setAttributes({outerRadius:w,innerRadius:T,startAngle:_,endAngle:y})}},Cf=Tf,Ef=xf;const Bf=new class{constructor(){this.time=Qo.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,f=p&&!1!==p.visible;if(!g&&!f)return;const{radius:m=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,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:_h(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),f&&M(p,"innerBorder")}},Pf=Tf,Lf=xf;const Rf=new class extends bf{constructor(){super(...arguments),this.time=Qo.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,backgroundKeepAspectRatio:f=l.backgroundKeepAspectRatio,backgroundScale:m=l.backgroundScale,backgroundOffsetX:v=l.backgroundOffsetX,backgroundOffsetY:_=l.backgroundOffsetY}=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,{backgroundMode:p,backgroundFit:g,backgroundKeepAspectRatio:f,backgroundScale:m,backgroundOffsetX:v,backgroundOffsetY:_}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Of=jt/2;function If(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=Ut(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Ut(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Ut(t[0]),i=Ut(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Ut(l[0]),l[1]=Ut(l[1]),l[2]=Ut(l[2]),l[3]=Ut(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],_=[c[0],c[1]+g[1]],y=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],x=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!q(v,_)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Of,0,!1)}if(o&&o[1]?o[1](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(y,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Of,!1)}if(o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),!q(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Of,jt,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],jt,jt+Of,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}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};class Ff{constructor(){this.time=Qo.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,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:M,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:w,height:C}=t.attribute;w=(null!=w?w:k-i)||0,C=(null!=C?C:M-s)||0;const E=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=T?h:_h(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||y(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,w-o*g,C-o*g)):(e.beginPath(),If(e,u,p,w-o*g,C-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&E(u,"outerBorder"),f&&E(p,"innerBorder")}}let zf=class{constructor(){this.time=Qo.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)}};zf=Df([qa()],zf);let jf=class{constructor(){this.time=Qo.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:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:_=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||y(v)&&v.every((t=>0===t)))){let n,r=0;return If(e,i,s,b,x,v,"bevel"!==_,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};jf=Df([qa()],jf);const Hf=new Ff,Vf=Tf,Nf=xf;const Uf=new class extends Ff{constructor(){super(...arguments),this.time=Qo.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)}},Wf=xf;const Gf=new class{constructor(){this.time=Qo.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,f=p&&!1!==p.visible,m=g&&!1!==g.visible;if(!f&&!m)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,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,k=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:_h(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(y-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}},Yf=new class{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:_=l.scaleX,scaleY:y=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/_,(f-s)/y,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/_,(f-s)/y,l),e.stroke())))}},$f=Tf,Xf=xf;const Kf={x:0,y:0,z:0,lastModelMatrix:null};class qf{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(Af),this.builtinContributions.push(kf),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===Qo.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Qo.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}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)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Lc(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,_=Xp(d,u,h),y=qp(d,g),b=Yp(h),x=$p(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(_||y||a||o))return!0;e.beginPath();return sl(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),!0}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=Xp(o,l,n),p=qp(o,c),g=Yp(n,r),f=$p(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){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;Kf.x=n,Kf.y=r,Kf.z=a,Kf.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=ip.allocate(),n=ip.allocate();vg(n,t,e),Ju(s,d||s,n),Kf.x=0,Kf.y=0,Kf.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),ip.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Kf.x+=s.x,Kf.y+=s.y,Kf.z=a,i.setTransformForCurrent()}else if(p)Kf.x=0,Kf.y=0,Kf.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Kf.x+=s.x,Kf.y+=s.y,this.transformWithoutTranslate(i,Kf.x,Kf.y,Kf.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Kf.x=0,Kf.y=0,Kf.z=0;return Kf}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,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,_=(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,f,m,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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&ip.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}var Zf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qf=function(t,e){return function(i,s){e(i,s,t)}};let tm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Bu,this.builtinContributions=[wf,Ef,Cf],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=d>c;let p=!1;if(nzt){const t=$t(b,y),r=$t(x,y),a=Jp(v,_,f,m,n,t,Number(u)),o=Jp(A,k,M,T,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,Wt(o.y11,o.x11),Wt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>zt)||C<.001)e.lineTo(i+M,s+T),p=!0;else if(w>zt){const t=$t(B,w),n=$t(P,w),a=Jp(M,T,A,k,r,-n,Number(u)),o=Jp(f,m,v,_,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),w0&&e.arc(i+a.cx,s+a.cy,n,Wt(a.y01,a.x01),Wt(a.y11,a.x11),!u);const t=Wt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Gt(E),s+r*Xt(E));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Lc(t,null==r?void 0:r.theme).arc;const{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:k=l.outerRadius,innerRadius:M=l.innerRadius}=t.attribute;k+=b,M-=x;let T=0;const w=(c(S)&&S||S[0])&&"conical"===h.gradient;if(w){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Ut(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((_||E)&&(e.beginPath(),tg(t,e,i,s,k,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),g?(this._runStroke(t,e,i,s,l,y,E,v,o),this._runFill(t,e,i,s,l,_,m,u,p,a)):(this._runFill(t,e,i,s,l,_,m,u,p,a),this._runStroke(t,e,i,s,l,y,E,v,o))),!E&&y&&(e.beginPath(),tg(t,e,i,s,k,M,B),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(c(S)&&S||S[1])&&A){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Ut(h-r)>=Nt-zt){e.beginPath();const r=Math.abs(k-M)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,M,d,d+r),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o);const u=()=>{if(_){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+=Nt;for(;i>Nt;)i-=Nt;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),pp(o.color,l.color,h,!1)}(0,0,h,n);a||Xp&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}},p=()=>{y&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};u(),p()}}this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),w&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}};tm=Zf([qa(),Qf(0,Xa(po)),Qf(0,Za(eg)),Jf("design:paramtypes",[Object])],tm);var em=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},im=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sm=function(t,e){return function(i,s){e(i,s,t)}};let nm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ru,this.builtinContributions=[Bf,Lf,Pf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Lc(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,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f;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,_,y,m,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{y&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o)}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function rm(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]=cl(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 am(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function om(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=am(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),rm(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=Zo.ROW:"y"===s?u=Zo.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.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 hm=class extends qf{constructor(){super(...arguments),this.numberType=Fu}draw(t,e,i,s){const n=Lc(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 f;if(!e)return;t.beginPath();om(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),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:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!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:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===_)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=Ul(x(t.points,v),_,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===_){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===y){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],y,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=y*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],$t(_,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,y,b,i,s,t,a,o)}};function cm(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),rm(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),rm(t,l,1,s),o=!1):o=!0}t.closePath()}hm=lm([qa()],hm);const dm=new class extends Mf{constructor(){super(...arguments),this.time=Qo.afterFillStroke}drawShape(t,e,i,s,n,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:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:sd(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:sd(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:sd(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:sd(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},um=xf;var pm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fm=function(t,e){return function(i,s){e(i,s,t)}};let mm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Lu,this.builtinContributions=[dm,um],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,_=m[0];e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const i=m[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,v)}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:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(y(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Lc(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:M=g.clipRange,closePath:T,points:w,segments:C}=t.attribute;let{curveType:E=g.curveType}=t.attribute;function B(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===E&&(E="linearClosed"),1===M&&!C&&!w.some((t=>!1===t.defined))&&"linear"===E)return this.drawLinearAreaHighPerformance(t,e,!!f,k,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(C&&C.length){let e,i;const s=C.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=Ul(B(t.points,x),E,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=C.length-1;t>=0;t--){const e=C[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=C[t-1].points,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=Ul(B(i,x),"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!w||!w.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=B(w,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Ul(e,E,{curveTension:b}),n=Ul(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===M){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,y,r[c],[g,t.attribute],M,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=M*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,A,v,k,y,r[u],[g,t.attribute],$t(f,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,y,t.attribute,g,M,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Lc(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,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let _,b,x=Zo.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],_=t.points[t.points.length-1]}else b=m[0],_=m[m.length-1];const S=Ut(_.x-b.x),A=Ut(_.y-b.y);x=null==_.x1?Zo.ROW:null==_.y1?Zo.COLUMN:Number.isFinite(S+A)?S>A?Zo.ROW:Zo.COLUMN:Zo.ROW,function(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?Zo.ROW:Zo.COLUMN,Number.isFinite(c)||(o=Zo.COLUMN),Number.isFinite(d)||(o=Zo.ROW);const u=i*(o===Zo.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;y(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),om(t,i[0]?e.top:e.bottom,l,x===Zo.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,M-c,o),t.stroke()}})(),!1}};mm=pm([qa(),fm(0,Xa(po)),fm(0,Za(ig)),gm("design:paramtypes",[Object])],mm);const vm=Tf,_m=xf;var ym=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xm=function(t,e){return function(i,s){e(i,s,t)}};let Sm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=zu,this.builtinContributions=[_m,vm],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:Lc(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:_,doFill:y,doStroke:b}=m;if(e.beginPath(),t.pathShape)sl(t.pathShape.commandList,e,i,s,1,1,f);else{sl((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,y,b,v,_,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):_&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{y&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,y,b,v,_,d,n,a,o)}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Sm=ym([qa(),xm(0,Xa(po)),xm(0,Za(ag)),bm("design:paramtypes",[Object])],Sm);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)}};let Tm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=Hu,this.builtinContributions=[Hf,Nf,Vf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Lc(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:_=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:M=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:w}=t.attribute;T=(null!=T?T:b-S)||0,w=(null!=w?w:x-A)||0;const C=Kp(g,f,T,w,h),E=Zp(g,v,T,w,M),B=Yp(h,c),P=$p(d,m);if(!t.valid||!_)return;if(!B&&!P)return;if(!(C||E||a||o||c))return;0===u||y(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,T,w)):(e.beginPath(),If(e,i,s,T,w,u,"bevel"!==p));const L={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,B,P,C,E,l,n,a,o,L),k?(this._runStroke(t,e,i,s,l,L,E,S,A,o),this._runFill(t,e,i,s,l,L,C,S,A,a)):(this._runFill(t,e,i,s,l,L,C,S,A,a),this._runStroke(t,e,i,s,l,L,E,S,A,o)),this.afterRenderStep(t,e,i,s,B,P,C,E,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}};Tm=Am([qa(),Mm(0,Xa(po)),Mm(0,Za(lg)),km("design:paramtypes",[Object])],Tm);var wm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Em=function(t,e){return function(i,s){e(i,s,t)}};let Bm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Nu,this.builtinContributions=[Gf,Xf,$f,Yf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:Lc(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,M=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,w=s,C=M;const E=e.camera;if(k&&E&&e.project){const t=e.project(i,s,M);e.camera=null,y(c)&&(c[0],c[1]),T=t.x,w=t.y,C=void 0}!1===A.draw(e,c,T,w,C,((n,r)=>{var h,c,v,_;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(_=r.lineWidth)&&void 0!==_?_:t.attribute.lineWidth,r=e}const y=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),y()):(y(),x())}))&&e.closePath(),e.camera=E,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,_,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,_,d,u,A,a)):(this._runFill(t,e,i,s,l,x,_,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,_,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Bm=wm([qa(),Em(0,Xa(po)),Em(0,Za(hg)),Cm("design:paramtypes",[Object])],Bm);const Pm=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ne)}allocate(t,e,i,s){if(!this.pools.length)return(new Ne).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 Ne(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(...t){this.pools=[]}};const Lm=new class extends bf{constructor(){super(...arguments),this.time=Qo.beforeFillStroke}drawShape(t,e,i,s,n,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,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio}=t.attribute;let T,{background:w}=t.attribute;if(!w)return;const C=()=>{"richtext"===t.type&&(e.restore(),e.save(),T&&e.setTransformFromMatrix(T,!0,1))};let E;"richtext"===t.type&&(T=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const B=g(w)&&w.background,P=t.transMatrix.onlyTranslate();if(B){const e=t.AABBBounds,i=(null!==(u=w.x)&&void 0!==u?u:e.x1)+(null!==(p=w.dx)&&void 0!==p?p:0),s=(null!==(f=w.y)&&void 0!==f?f:e.y1)+(null!==(m=w.dy)&&void 0!==m?m:0),n=null!==(v=w.width)&&void 0!==v?v:e.width(),r=null!==(_=w.height)&&void 0!==_?_:e.height();if(E=Pm.allocate(i,s,i+n,s+r),w=w.background,!P){const t=E.width(),e=E.height();E.set((null!==(y=w.x)&&void 0!==y?y:0)+(null!==(b=w.dx)&&void 0!==b?b:0),(null!==(x=w.y)&&void 0!==x?x:0)+(null!==(S=w.dy)&&void 0!==S?S:0),t,e)}}else E=t.AABBBounds,P||(E=mf(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(w);if("success"!==n.state||!n.data)return void C();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,E,{backgroundMode:A,backgroundFit:k,backgroundKeepAspectRatio:M}),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n,backgroundOpacity:r=1}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=r,e.fillStyle=w,n?(If(e,E.x1,E.y1,E.width(),E.height(),n,!0),e.fill()):e.fillRect(E.x1,E.y1,E.width(),E.height()),e.highPerformanceRestore()}B&&Pm.free(E),C()}};var Rm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Om=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Im=function(t,e){return function(i,s){e(i,s,t)}};let Dm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Uu,this.builtinContributions=[Lm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Lc(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,fontSize:v=d.fontSize,verticalMode:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute,x=null!==(l=ad(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:M,doStroke:T}=S,w=!f,C=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,M,T,A,k,d,n,a,o),w&&this.transformUseContext2d(t,d,C,e);const E=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=ep.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),ep.free(t)}T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,C))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,C))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,C),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,C)})))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,C),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,C,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!_){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Yt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;E(i,a-(e+1)*x+u,r,n),r+=s}))}))}w&&this.restoreTransformUseContext2d(t,d,C,e),this.afterRenderStep(t,e,i,s,M,T,A,k,d,n,a,o)}draw(t,e,i,s){const n=Lc(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,l,h,c){if(e+t<=0)return;const{textAlign:d=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,_=!u(c),y=_?c.width:i.clipedWidth,b=_?0:ug(d,y),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+y,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+y,t,o),h.stroke()}}};function Fm(t,e,i,s){if(e&&e.length){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},Um=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wm=function(t,e){return function(i,s){e(i,s,t)}};let Gm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ju,this.builtinContributions=[Vm,Hm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Lc(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,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:b}=f;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?Fm(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Fm(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,f=(Math.atan2(u,d)-Math.atan2(g,p))/2,m=Math.abs(Math.tan(f));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,_=v/m;const y=zm(d,u),b=zm(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*m);const S=jm(h,_,y,d,u),A=jm(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=zm(k,M),w=jm(h,zm(_,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 B=E-C;B<0&&(C=E,B=-B),B>Math.PI&&(B-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),B&&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,_,b,m,v,l,n,a,o);const x=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,_,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Gm=Nm([qa(),Wm(0,Xa(po)),Wm(0,Za(og)),Um("design:paramtypes",[Object])],Gm);var Ym=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Xm=function(t,e){return function(i,s){e(i,s,t)}};let Km=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Iu}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Rf)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:Lc(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:M=l.x,y:T=l.y}=t.attribute,w=Kp(p,m,g,f,c),C=Zp(p,v,g,f),E=Yp(c,u),B=$p(d,x);if(!t.valid||!S)return;if(!h){if(!E&&!B)return;if(!(w||C||a||o||u))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,g,f)):(e.beginPath(),If(e,i,s,g,f,_,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Rf));const P={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===Qo.beforeFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o,P)})),h&&e.clip();const L=()=>{P.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,M-i,T-s,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,M-i,T-s,l),e.stroke()))};A?(R(),L()):(L(),R()),this._groupRenderContribitions.forEach((r=>{r.time===Qo.afterFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=Ao.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=Lc(t,null==s?void 0:s.theme).group,i=ip.allocate(),n=ip.allocate();vg(n,t,e),Ju(i,p||i,n),a.modelMatrix=i,ip.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&ip.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}};Km=Ym([qa(),Xm(0,Xa(po)),Xm(0,Za(ng)),$m("design:paramtypes",[Object])],Km);var qm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jm=function(t,e){return function(i,s){e(i,s,t)}};const Qm=["","repeat-x","repeat-y","repeat"];let tv=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Du,this.builtinContributions=[Uf,Wf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Lc(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,image:m}=t.attribute,v=this.valid(t,l,a);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v;if(!m||!t.resources)return;const A=t.resources.get(m);if("success"!==A.state)return;const k=t.width,M=t.height;e.beginPath();let T=!1;0===p||y(p)&&p.every((t=>0===t))?e.rect(i,s,k,M):(If(e,i,s,k,M,p,"bevel"!==f),T=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const w=()=>{if(x)if(a)a(e,t.attribute,l);else if(_){e.setCommonStyle(t,t.attribute,i,s,l);let n=0;if("repeat"===h&&(n|=1),"repeat"===c&&(n|=2),n){const t=e.createPattern(A.data,Qm[n]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,k,M),e.translate(-i,-s,!0)}else e.drawImage(A.data,i,s,k,M)}},C=()=>{S&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(C(),T&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),w(),T&&e.restore()):(T&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),w(),T&&e.restore(),C()),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 Yc.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Lc(t).image;this._draw(t,a,!1,i)}};tv=qm([qa(),Jm(0,Xa(po)),Jm(0,Za(rg)),Zm("design:paramtypes",[Object])],tv);const ev=Symbol.for("IncrementalDrawContribution"),iv=Symbol.for("ArcRender"),sv=Symbol.for("AreaRender"),nv=Symbol.for("CircleRender"),rv=Symbol.for("GraphicRender"),av=Symbol.for("GroupRender"),ov=Symbol.for("LineRender"),lv=Symbol.for("PathRender"),hv=Symbol.for("PolygonRender"),cv=Symbol.for("RectRender"),dv=Symbol.for("SymbolRender"),uv=Symbol.for("TextRender"),pv=Symbol.for("RichTextRender"),gv=Symbol.for("GlyphRender"),fv=Symbol.for("ImageRender"),mv=Symbol.for("DrawContribution"),vv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Pu,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];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+=Nt;for(;o<0;)o+=Nt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};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},yv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const bv=Symbol.for("DrawItemInterceptor"),xv=new Ne,Sv=new Ne;class Av{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){xv.copy(s.dirtyBounds),Sv.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,ep.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(xv),s.backupDirtyBounds.copy(Sv)),!0}}class kv{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 Mv=class{constructor(){this.order=1,this.interceptors=[new Av,new wv,new Tv,new kv]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&ip.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Cv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},Bv=function(t,e){return function(i,s){e(i,s,t)}};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))}reInit(){this.drawContribution.reInit()}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=Cv([qa(),Bv(0,Xa(mv)),Ev("design:paramtypes",[Object])],Pv);var Lv=new Fa((t=>{t(So).to(Pv)}));const Rv=Symbol.for("PickerService"),Ov=Symbol.for("GlobalPickerService"),Iv=Symbol.for("PickItemInterceptor"),Dv=Symbol.for("PickServiceInterceptor");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};let zv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};zv=Fv([qa()],zv);let jv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Lc(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=ep.allocateByObj(a),u=new re(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};jv=Fv([qa()],jv);let Hv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new re(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}};Hv=Fv([qa()],Hv);let Vv=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){const a=vv(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};Vv=Fv([qa()],Vv);var Nv=new Fa(((t,e,i)=>{i(Rv)||(t(Ov).toSelf(),t(Rv).toService(Ov)),t(Vv).toSelf().inSingletonScope(),t(Iv).toService(Vv),t(jv).toSelf().inSingletonScope(),t(Iv).toService(jv),t(Hv).toSelf().inSingletonScope(),t(Iv).toService(Hv),fo(t,Iv),t(zv).toSelf().inSingletonScope(),t(Dv).toService(zv),fo(t,Dv)})),Uv=new Fa((t=>{t(Wu).to(_g),t(Gu).toConstantValue(pf)}));const Wv=Symbol.for("AutoEnablePlugins"),Gv=Symbol.for("PluginService");var Yv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$v=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Xv=function(t,e){return function(i,s){e(i,s,t)}};let Kv=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&&xo.isBound(Wv)&&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(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Kv=Yv([qa(),Xv(0,Xa(po)),Xv(0,Za(Wv)),$v("design:paramtypes",[Object])],Kv);var qv=new Fa((t=>{t(Gv).to(Kv),function(t,e){t(po).toDynamicValue((({container:t})=>new go(e,t))).whenTargetNamed(e)}(t,Wv)})),Zv=new Fa((t=>{fo(t,yo)})),Jv=new Fa((t=>{t(Oh).to(Ih).inSingletonScope(),fo(t,Oh)})),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.type="static",this.offscreen=!1,this.global=Ao.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=zh({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()}};e_=Qv([qa(),t_("design:paramtypes",[])],e_);var i_=new Fa((t=>{t(e_).toSelf(),t(zp).toService(e_)}));var s_=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 n_(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function r_(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=n_(t,e,s);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;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=n_(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var l_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},h_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},c_=function(t,e){return function(i,s){e(i,s,t)}};let d_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):r_(e,th.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Ve,this.backupDirtyBounds=new Ve,this.global=Ao.global,this.layerService=Ao.layerService,y(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}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){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=ye(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.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,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:th.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:th.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,ep.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=o_(e,i,th.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&&!Ae(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Pm.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=ep.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Pm.free(n),ep.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||xo.get(ev);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let p_=class extends hm{constructor(){super(...arguments),this.numberType=Fu}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=Lc(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=Xp(u,p,c),_=qp(u,g),y=Yp(c),b=$p(d,f);if(!t.valid||!m)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())}};p_=u_([qa()],p_);var g_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 f_=class extends mm{constructor(){super(...arguments),this.numberType=Lu}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=Lc(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Xp(u,d,c),f=Yp(c);if(!t.valid||!p)return;if(!f)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())}};f_=g_([qa()],f_);var m_,v_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},__=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},y_=function(t,e){return function(i,s){e(i,s,t)}},b_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(m_||(m_={}));let x_=class extends d_{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=m_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new _o([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return b_(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:th.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:th.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 b_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return b_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>b_(this,void 0,void 0,(function*(){if(2!==t.count)yield a_(t,th.zIndex,((i,s)=>{if(this.status===m_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return b_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return b_(this,void 0,void 0,(function*(){this.rendering&&(this.status=m_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=m_.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return b_(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:()=>b_(this,void 0,void 0,(function*(){yield a_(t,th.zIndex,(t=>b_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};x_=v_([qa(),y_(0,Ka(rv)),y_(1,Xa(p_)),y_(2,Xa(f_)),y_(3,Xa(po)),y_(3,Za(bv)),__("design:paramtypes",[Array,Object,Object,Object])],x_);var S_=new Fa((t=>{t(bf).toSelf().inSingletonScope(),t(Mf).toSelf().inSingletonScope(),t(mv).to(d_),t(ev).to(x_),t(av).to(Km).inSingletonScope(),t(rv).toService(av),fo(t,ng),t(Sf).toSelf().inSingletonScope(),fo(t,dg),fo(t,rv),t(Mv).toSelf().inSingletonScope(),t(bv).toService(Mv),fo(t,bv)}));function A_(){A_.__loaded||(A_.__loaded=!0,xo.load(Gp),xo.load(Uv),xo.load(Lv),xo.load(Nv),xo.load(qv),function(t){t.load(Zv),t.load(Jv),t.load(i_)}(xo),function(t){t.load(S_)}(xo))}A_.__loaded=!1,A_();const k_=xo.get(bo);Ao.global=k_;const M_=xo.get(Dp);Ao.graphicUtil=M_;const T_=xo.get(Ip);Ao.transformUtil=T_;const w_=xo.get(Wu);Ao.graphicService=w_;const C_=xo.get(Fp);Ao.layerService=C_;class E_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class B_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=Ao.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=Ao.global.getRequestAnimationFrame();this.rafId=t((()=>{Ao.global.devicePixelRatio!==this.dpr&&(this.dpr=Ao.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=Ao.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class P_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.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))})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Ao.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())}}const L_=new Ne;class R_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Da.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()}));const e=this.pluginService.stage;e&&(e.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&&(L_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(L_,t.parent&&t.parent.globalTransMatrix)))})),e.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))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let O_;function I_(){!function(){if(null==O_)try{const t=document.createElement("canvas"),e=t.getContext("2d");O_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),O_&&(O_=!!document.createElement)}catch(t){O_=!1}}();const t=Ao.global&&Ao.global.env;return t?"browser"===t:O_}let D_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};D_._pluginClasses={};const F_="white";class z_ extends Lp{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:F_}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={}){var e,i;super({}),this.tickedBeforeRender=!0,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._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Bc,this.hooks={beforeRender:new _o(["stage"]),afterRender:new _o(["stage"]),afterClearScreen:new _o(["stage"]),afterClearRect:new _o(["stage"])},this.global=Ao.global,!this.global.env&&I_()&&this.global.setEnv("browser"),this.window=xo.get(mc),this.renderService=xo.get(So),this.pluginService=xo.get(Gv),this.layerService=xo.get(Fp),this.graphicService=xo.get(Wu),this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],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:F_,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(),t.autoRefresh&&this.enableAutoRefresh(),!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),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&_(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(i=t.rafId)&&void 0!==i?i:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new Gc(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(t=!1){t&&(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:f=[1,1,-1],color:m="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);const k=D_.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const M={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]}};if(this.camera)this.camera.params=M;else{const t=D_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=D_.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}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 E_))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new B_))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new P_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Ve;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new R_,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=D_.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=D_.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=D_.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();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.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();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===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),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.dirtyBounds&&this.dirtyBounds.clear(),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,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new re(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;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.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=xo.get(mc),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=xo.get(Rv)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}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},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())}))};let V_=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ne}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}}loadFont(t,e,i){return H_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}};V_=j_([qa()],V_);var N_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},U_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let W_=class{constructor(){this._uid=Da.GenAutoIncrementId(),this.viewBox=new Ne,this.modelMatrix=new We(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){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}};W_=N_([qa(),U_("design:paramtypes",[])],W_);var G_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Y_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$_=function(t,e){return function(i,s){e(i,s,t)}};let X_=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=Ao.global}reInit(){this._init()}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.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 Ne).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 We(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),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new re(e.x,e.y),a=Lc(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 re(e.x,e.y);l.transformPoint(a,a);const o=Lc(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&&ip.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),ep.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function K_(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 q_(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function iy(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;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}))),oy=(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]},ly=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new Ve;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 oy(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return oy(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);ly(n[0],s,i),ly(n[1],e-s,i)}};let hy=!1;const cy=new Fa((t=>{hy||(hy=!0,t(tm).toSelf().inSingletonScope(),t(iv).to(tm).inSingletonScope(),t(rv).toService(iv),t(eg).toService(Sf),fo(t,eg))}));let dy=!1;const uy=new Fa((t=>{dy||(dy=!0,t(Tm).toSelf().inSingletonScope(),t(cv).to(Tm).inSingletonScope(),t(rv).toService(cv),t(jf).toSelf(),t(zf).toSelf(),t(lg).toService(jf),t(lg).toService(zf),t(lg).toService(Sf),fo(t,lg))}));let py=!1;const gy=new Fa((t=>{py||(py=!0,t(hm).toSelf().inSingletonScope(),t(p_).toSelf().inSingletonScope(),t(ov).to(hm).inSingletonScope(),t(rv).toService(ov))}));let fy=!1;const my=new Fa((t=>{fy||(fy=!0,t(mm).toSelf().inSingletonScope(),t(sv).to(mm).inSingletonScope(),t(rv).toService(sv),t(ig).toService(Sf),fo(t,ig),t(f_).toSelf().inSingletonScope())}));let vy=!1;const _y=new Fa((t=>{vy||(vy=!0,t(Bm).toSelf().inSingletonScope(),t(dv).to(Bm).inSingletonScope(),t(rv).toService(dv),t(hg).toService(Sf),fo(t,hg))}));let yy=!1;const by=new Fa((t=>{yy||(yy=!0,t(nm).toSelf().inSingletonScope(),t(nv).to(nm).inSingletonScope(),t(rv).toService(nv),t(sg).toService(Sf),fo(t,sg))}));let xy=!1;const Sy=new Fa((t=>{xy||(xy=!0,t(uv).to(Dm).inSingletonScope(),t(rv).toService(uv),t(cg).toService(Sf),fo(t,cg))}));let Ay=!1;const ky=new Fa((t=>{Ay||(Ay=!0,t(Sm).toSelf().inSingletonScope(),t(lv).to(Sm).inSingletonScope(),t(rv).toService(lv),t(ag).toService(Sf),fo(t,ag))}));let My=!1;const Ty=new Fa((t=>{My||(My=!0,t(hv).to(Gm).inSingletonScope(),t(rv).toService(hv),t(og).toService(Sf),fo(t,og))}));var wy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Cy=class{constructor(){this.numberType=Ou}reInit(){}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=Lc(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};Cy=wy([qa()],Cy);let Ey=!1;const By=new Fa((t=>{Ey||(Ey=!0,t(gv).to(Cy).inSingletonScope(),t(rv).toService(gv))}));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},Ly=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ry=class extends qf{constructor(){super(),this.numberType=Vu,this.builtinContributions=[Lm],this.init()}drawShape(t,e,i,s,n){const r=Lc(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=Xp(o,l,!0),d=Xp(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),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=Lc(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:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),If(e,i-t,s-n,v,_,f,!0)),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=Lc(t).richtext;this._draw(t,s,!1,i)}};Ry=Py([qa(),Ly("design:paramtypes",[])],Ry);let Oy=!1;const Iy=new Fa((t=>{Oy||(Oy=!0,t(pv).to(Ry).inSingletonScope(),t(rv).toService(pv))}));let Dy=!1;const Fy=new Fa((t=>{Dy||(Dy=!0,t(fv).to(tv).inSingletonScope(),t(rv).toService(fv),t(rg).toService(Sf),fo(t,rg))}));function zy(t){const e=[];for(let i=0;i=0&&n>=0&&sot.getInstance().info(`[VChart log]: ${t}`,...e),Vy=(t,e)=>(d(Uy.warnHandler)&&Uy.warnHandler.call(null,t,e),e?ot.getInstance().warn(`[VChart warn]: ${t}`,e):ot.getInstance().warn(`[VChart warn]: ${t}`)),Ny=(t,e,i)=>{if(!d(Uy.errorHandler))throw new Error(t);Uy.errorHandler.call(null,t,e)},Uy={silent:!1,warnHandler:!1,errorHandler:!1},Wy=I_(),Gy=Wy&&globalThis?globalThis.document:void 0;function Yy(t){return("desktop-browser"===t||"mobile-browser"===t)&&Wy}function $y(t){return Xy(t)||"mobile-browser"===t}function Xy(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let Ky=0;function qy(){return Ky>=9999999&&(Ky=0),Ky++}function Zy(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function Jy(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const Qy=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class tb extends Lp{constructor(t,e){super(t),this._skipRenderAttributes=Qy,(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,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?j(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.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,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.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 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"},Cb=(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 Eb extends l{constructor(t,e={}){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.startTime=Hc.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.pressTimeout=null}),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=Hc.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||wb(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=Cb(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=Hc.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=Cb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=wb(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&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("pointerleave",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("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=Hc.now()-i>this.config.press.time&&Cb(s[0],t){Ao.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;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){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){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},Pb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Lb=[0,0,0];let Rb=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t: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(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},Xl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},ql),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Zl),{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 We(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new We(1,0,0,1,0,0),this._clearMatrix=new We(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&ot.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new We(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&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 ep.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&&(ep.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(ep.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){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,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=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(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){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-=Nt;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(f,-2*y),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&&xp.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&&(Qu(Lb,[t,e,i],this.modelMatrix),t=Lb[0],e=Lb[1],i=Lb[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&&(Qu(Lb,[t,e,i],this.modelMatrix),t=Lb[0],e=Lb[1],i=Lb[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Qu(Lb,[e,i,s],this.modelMatrix),e=Lb[0],i=Lb[1],s=Lb[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,e=Ao.global.measureTextMethod){var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Ao.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Zl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Zl.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&&(Qu(Lb,[e,i,s],this.modelMatrix),e=Lb[0],i=Lb[1],s=Lb[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=yh(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:_h(this,a,this.dpr),r.strokeStyle=yh(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=De(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?this.font=t.font:this.font=De(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(t=!0,e=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(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>ep.free(t))),this.stack.length=0}};Rb.env="browser",Rb=Bb([qa(),Pb("design:paramtypes",[Object,Number])],Rb);var Ob=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ib=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Db=class extends hp{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Ao.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new Rb(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 Fb(t,e){return new Fa((i=>{i(Dh).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Fh).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Db.env="browser",Db=Ob([qa(),Ib("design:paramtypes",[Object])],Db);const zb=Fb(Db,Rb);var jb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vb=function(t,e){return function(i,s){e(i,s,t)}};let Nb=class extends X_{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,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=pc.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 Wb=class{constructor(){this.type="group",this.numberType=Iu}contains(t,e,i){return!1}};Wb=Ub([qa()],Wb);const Gb=new Fa(((t,e,i,s)=>{Gb.__vloaded||(Gb.__vloaded=!0,t(Mb).to(Wb).inSingletonScope(),t(Tb).toService(Mb),fo(t,Tb))}));Gb.__vloaded=!1;var Yb=Gb;const $b=new Fa(((t,e,i,s)=>{i(Nb)||t(Nb).toSelf().inSingletonScope(),i(Rv)?s(Rv).toService(Nb):t(Rv).toService(Nb)}));var Xb,Kb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)};let Zb=Xb=class extends W_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Xb.idprefix}_${Xb.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Ao.global,this.viewBox=new Ne,this.modelMatrix=new We(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:Xb.GenerateCanvasId(),canvasControled:!0};this.canvas=new Db(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 Db({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)}};Zb.env="browser",Zb.idprefix="visactor_window",Zb.prefix_count=0,Zb=Xb=Kb([qa(),qb("design:paramtypes",[])],Zb);const Jb=new Fa((t=>{t(Zb).toSelf(),t(vc).toDynamicValue((t=>t.container.get(Zb))).whenTargetNamed(Zb.env)}));var Qb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},ex=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 ix{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 sx(t,e=!1){const i=document.createElement("img");if(Ao.global.isImageAnonymous&&(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 nx=class extends V_{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 ix(t)}return new Ne}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 sx(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return sx(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:Da.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(...t){}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}}loadFont(t,e,i){return ex(this,void 0,void 0,(function*(){return new FontFace(t,_(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}};nx=Qb([qa(),tx("design:paramtypes",[])],nx);const rx=new Fa((t=>{rx.isBrowserBound||(rx.isBrowserBound=!0,t(nx).toSelf().inSingletonScope(),t(yo).toService(nx))}));function ax(t,e=!0){ax.__loaded||(ax.__loaded=!0,t.load(rx),t.load(zb),t.load(Jb),e&&function(t){t.load(Yb),t.load($b)}(t))}rx.isBrowserBound=!1,ax.__loaded=!1;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};let lx=class extends Rb{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}};lx.env="feishu",lx=ox([qa()],lx);var hx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let dx=class extends hp{constructor(t){super(t)}init(){this._context=new lx(this,this._dpr)}release(...t){}};dx.env="feishu",dx=hx([qa(),cx("design:paramtypes",[Object])],dx);const ux=Fb(dx,lx);var px=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gx=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 mx{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 vx=class extends W_{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new mx}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:Da.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new dx(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 dx({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()}};vx.env="feishu",vx=px([qa(),fx(0,Xa(bo)),gx("design:paramtypes",[Object])],vx);const _x=new Fa((t=>{t(vx).toSelf(),t(vc).toDynamicValue((t=>t.container.get(vx))).whenTargetNamed(vx.env)}));var yx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xx=function(t,e){return function(i,s){e(i,s,t)}};let Sx=class extends X_{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,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 op(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}};Sx=yx([qa(),xx(0,Xa(po)),xx(0,Za(eb)),xx(1,Xa(po)),xx(1,Za(Iv)),xx(2,Xa(po)),xx(2,Za(Dv)),bx("design:paramtypes",[Object,Object,Object])],Sx);const Ax=new Fa((t=>{Ax.__vloaded||(Ax.__vloaded=!0,fo(t,eb))}));Ax.__vloaded=!1;var kx=Ax;class Mx{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();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,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:_h(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}var Tx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Cx=function(t,e){return function(i,s){e(i,s,t)}};let Ex=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Bu}};Ex=Tx([qa(),Cx(0,Xa(iv)),wx("design:paramtypes",[Object])],Ex);let Bx=!1;const Px=new Fa(((t,e,i,s)=>{Bx||(Bx=!0,t(ib).to(Ex).inSingletonScope(),t(eb).toService(ib))}));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},Rx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ox=function(t,e){return function(i,s){e(i,s,t)}};let Ix=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Lu}};Ix=Lx([qa(),Ox(0,Xa(sv)),Rx("design:paramtypes",[Object])],Ix);let Dx=!1;const Fx=new Fa(((t,e,i,s)=>{Dx||(Dx=!0,t(sb).to(Ix).inSingletonScope(),t(eb).toService(sb))}));var zx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hx=function(t,e){return function(i,s){e(i,s,t)}};let Vx=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Ru}};Vx=zx([qa(),Hx(0,Xa(nv)),jx("design:paramtypes",[Object])],Vx);let Nx=!1;const Ux=new Fa(((t,e,i,s)=>{Nx||(Nx=!0,t(nb).to(Vx).inSingletonScope(),t(eb).toService(nb))}));class Wx{constructor(){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}}var Gx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},$x=function(t,e){return function(i,s){e(i,s,t)}};let Xx=class extends Wx{constructor(t){super(),this.canvasRenderer=t}};Xx=Gx([qa(),$x(0,Xa(gv)),Yx("design:paramtypes",[Object])],Xx);let Kx=!1;const qx=new Fa(((t,e,i,s)=>{Kx||(Kx=!0,t(ub).to(Xx).inSingletonScope(),t(Xx).toService(ub))}));var Zx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Jx=class{constructor(){this.type="image",this.numberType=Du}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Jx=Zx([qa()],Jx);let Qx=!1;const tS=new Fa(((t,e,i,s)=>{Qx||(Qx=!0,t(rb).to(Jx).inSingletonScope(),t(Jx).toService(rb))}));var eS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sS=function(t,e){return function(i,s){e(i,s,t)}};let nS=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Fu}};nS=eS([qa(),sS(0,Xa(ov)),iS("design:paramtypes",[Object])],nS);let rS=!1;const aS=new Fa(((t,e,i,s)=>{rS||(rS=!0,t(ab).to(nS).inSingletonScope(),t(eb).toService(ab))}));var oS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hS=function(t,e){return function(i,s){e(i,s,t)}};let cS=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=ju}};cS=oS([qa(),hS(0,Xa(hv)),lS("design:paramtypes",[Object])],cS);let dS=!1;const uS=new Fa(((t,e,i,s)=>{dS||(dS=!0,t(db).to(cS).inSingletonScope(),t(eb).toService(db))}));var pS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fS=function(t,e){return function(i,s){e(i,s,t)}};let mS=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=zu}};mS=pS([qa(),fS(0,Xa(lv)),gS("design:paramtypes",[Object])],mS);let vS=!1;const _S=new Fa(((t,e,i,s)=>{vS||(vS=!0,t(ob).to(mS).inSingletonScope(),t(eb).toService(ob))})),yS=new Ne;class bS{constructor(){this.type="rect",this.numberType=Hu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{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,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:_h(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;yS.setValue(i.x1,i.y1,i.x2,i.y2),yS.expand(-r/2),h=!yS.containsPoint(e)}}return s.highPerformanceRestore(),h}}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 extends bS{constructor(t){super(),this.canvasRenderer=t}};kS=xS([qa(),AS(0,Xa(cv)),SS("design:paramtypes",[Object])],kS);let MS=!1;const TS=new Fa(((t,e,i,s)=>{MS||(MS=!0,t(lb).to(kS).inSingletonScope(),t(eb).toService(lb))}));let wS=!1;const CS=new Fa(((t,e,i,s)=>{wS||(wS=!0,t(rb).to(Jx).inSingletonScope(),t(Jx).toService(rb))}));var ES=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},BS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},PS=function(t,e){return function(i,s){e(i,s,t)}};let LS=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Nu}};LS=ES([qa(),PS(0,Xa(dv)),BS("design:paramtypes",[Object])],LS);let RS=!1;const OS=new Fa(((t,e,i,s)=>{RS||(RS=!0,t(hb).to(LS).inSingletonScope(),t(eb).toService(hb))}));var IS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 DS=class{constructor(){this.type="text",this.numberType=Uu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};DS=IS([qa()],DS);let FS=!1;const zS=new Fa(((t,e,i,s)=>{FS||(FS=!0,t(cb).to(DS).inSingletonScope(),t(eb).toService(cb))})),jS=new Fa(((t,e,i,s)=>{i(Sx)||t(Sx).toSelf().inSingletonScope(),i(Rv)?s(Rv).toService(Sx):t(Rv).toService(Sx)}));class HS{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 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},NS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let US=class extends V_{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 HS(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 rd.call(t)}}getCancelAnimationFrame(){return t=>{rd.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(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};US=VS([qa(),NS("design:paramtypes",[])],US);const WS=new Fa((t=>{WS.isFeishuBound||(WS.isFeishuBound=!0,t(US).toSelf().inSingletonScope(),t(yo).toService(US))}));function GS(t,e=!0){GS.__loaded||(GS.__loaded=!0,t.load(WS),t.load(ux),t.load(_x),e&&function(t){t.load(kx),t.load(jS),t.load(Px),t.load(Fx),t.load(Ux),t.load(qx),t.load(tS),t.load(aS),t.load(uS),t.load(_S),t.load(TS),t.load(CS),t.load(OS),t.load(zS)}(t))}WS.isFeishuBound=!1,GS.__loaded=!1;var YS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$S=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let XS=class extends Rb{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 We(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};XS.env="node",XS=YS([qa(),$S("design:paramtypes",[Object,Number])],XS);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},qS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ZS=class extends hp{constructor(t){super(t)}init(){this._context=new XS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};ZS.env="node",ZS=KS([qa(),qS("design:paramtypes",[Object])],ZS);const JS=Fb(ZS,XS);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},tA=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 iA=class extends W_{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:Da.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new ZS(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new ZS({width:n,height:r,dpr:s,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}getImageBuffer(t="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){}};iA.env="node",iA=QS([qa(),eA(0,Xa(bo)),tA("design:paramtypes",[Object])],iA);const sA=new Fa((t=>{t(iA).toSelf(),t(vc).toDynamicValue((t=>t.container.get(iA))).whenTargetNamed(iA.env)}));var nA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let rA=class extends V_{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 rd.call(t)}}getCancelAnimationFrame(){return t=>{rd.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};rA=nA([qa()],rA);const aA=new Fa((t=>{aA.isNodeBound||(aA.isNodeBound=!0,t(rA).toSelf().inSingletonScope(),t(yo).toService(rA))}));function oA(t,e=!0){oA.__loaded||(oA.__loaded=!0,t.load(aA),t.load(JS),t.load(sA))}aA.isNodeBound=!1,oA.__loaded=!1;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},hA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cA=function(t,e){return function(i,s){e(i,s,t)}};let dA=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Bu}};dA=lA([qa(),cA(0,Xa(iv)),hA("design:paramtypes",[Object])],dA);let uA=!1;const pA=new Fa(((t,e,i,s)=>{uA||(uA=!0,t(pb).to(dA).inSingletonScope(),t(Tb).toService(pb))}));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},fA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mA=function(t,e){return function(i,s){e(i,s,t)}};let vA=class extends bS{constructor(t){super(),this.canvasRenderer=t}};vA=gA([qa(),mA(0,Xa(cv)),fA("design:paramtypes",[Object])],vA);let _A=!1;const yA=new Fa(((t,e,i,s)=>{_A||(_A=!0,t(yb).to(vA).inSingletonScope(),t(Tb).toService(yb))}));class bA extends qf{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=t.getGraphicTheme(),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,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:_h(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&ip.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}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){return function(i,s){e(i,s,t)}};let kA=class extends bA{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Fu}};kA=xA([qa(),AA(0,Xa(ov)),SA("design:paramtypes",[Object])],kA);let MA=!1;const TA=new Fa(((t,e,i,s)=>{MA||(MA=!0,t(vb).to(kA).inSingletonScope(),t(Tb).toService(vb))}));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 BA=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Lu}};BA=wA([qa(),EA(0,Xa(sv)),CA("design:paramtypes",[Object])],BA);let PA=!1;const LA=new Fa(((t,e,i,s)=>{PA||(PA=!0,t(gb).to(BA).inSingletonScope(),t(Tb).toService(gb))}));class RA extends qf{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();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,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&ip.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var OA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},IA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},DA=function(t,e){return function(i,s){e(i,s,t)}};let FA=class extends RA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Nu}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=t.getGraphicTheme(),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,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:_h(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&ip.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};FA=OA([qa(),DA(0,Xa(dv)),IA("design:paramtypes",[Object])],FA);let zA=!1;const jA=new Fa(((t,e,i,s)=>{zA||(zA=!0,t(bb).to(FA).inSingletonScope(),t(Tb).toService(bb))}));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},VA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},NA=function(t,e){return function(i,s){e(i,s,t)}};let UA=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Ru}};UA=HA([qa(),NA(0,Xa(nv)),VA("design:paramtypes",[Object])],UA);let WA=!1;const GA=new Fa(((t,e,i,s)=>{WA||(WA=!0,t(fb).to(UA).inSingletonScope(),t(Tb).toService(fb))}));var YA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$A=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XA=function(t,e){return function(i,s){e(i,s,t)}};let KA=class extends RA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=Uu}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=t.getGraphicTheme(),{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(),f=l.width(),m=pg(a,u,n),v=ug(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,s.modelMatrix!==u&&ip.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};KA=YA([qa(),XA(0,Xa(uv)),$A("design:paramtypes",[Object])],KA);let qA=!1;const ZA=new Fa(((t,e,i,s)=>{qA||(qA=!0,t(xb).to(KA).inSingletonScope(),t(Tb).toService(xb))}));var JA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},QA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tk=function(t,e){return function(i,s){e(i,s,t)}};let ek=class extends bA{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=zu}};ek=JA([qa(),tk(0,Xa(lv)),QA("design:paramtypes",[Object])],ek);let ik=!1;const sk=new Fa(((t,e,i,s)=>{ik||(ik=!0,t(_b).to(ek).inSingletonScope(),t(Tb).toService(_b))}));var nk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ak=function(t,e){return function(i,s){e(i,s,t)}};let ok=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=ju}};ok=nk([qa(),ak(0,Xa(hv)),rk("design:paramtypes",[Object])],ok);let lk=!1;const hk=new Fa(((t,e,i,s)=>{lk||(lk=!0,t(Sb).to(ok).inSingletonScope(),t(Tb).toService(Sb))}));var ck=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uk=function(t,e){return function(i,s){e(i,s,t)}};let pk=class extends Wx{constructor(t){super(),this.canvasRenderer=t}};pk=ck([qa(),uk(0,Xa(gv)),dk("design:paramtypes",[Object])],pk);let gk=!1;const fk=new Fa(((t,e,i,s)=>{gk||(gk=!0,t(kb).to(pk).inSingletonScope(),t(Tb).toService(kb))}));var mk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_k=function(t,e){return function(i,s){e(i,s,t)}};let yk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Vu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};yk=mk([qa(),_k(0,Xa(pv)),vk("design:paramtypes",[Object])],yk);let bk=!1;const xk=new Fa(((t,e,i,s)=>{bk||(bk=!0,t(Ab).to(yk).inSingletonScope(),t(Tb).toService(Ab))}));var Sk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ak=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kk=function(t,e){return function(i,s){e(i,s,t)}};let Mk=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=Du}};Mk=Sk([qa(),kk(0,Xa(fv)),Ak("design:paramtypes",[Object])],Mk);let Tk=!1;const wk=new Fa(((t,e,i,s)=>{Tk||(Tk=!0,t(mb).to(Mk).inSingletonScope(),t(Tb).toService(mb))})),Ck=I_();function Ek(){Ek.__loaded||(Ek.__loaded=!0,pf.RegisterGraphicCreator("arc",of),xo.load(cy),xo.load(Ck?pA:Px))}Ek.__loaded=!1;const Bk=Ek;function Pk(){Pk.__loaded||(Pk.__loaded=!0,pf.RegisterGraphicCreator("area",nf),xo.load(my),xo.load(Ck?LA:Fx))}Pk.__loaded=!1;const Lk=Pk;function Rk(){Rk.__loaded||(Rk.__loaded=!0,pf.RegisterGraphicCreator("circle",Sg),xo.load(by),xo.load(Ck?GA:Ux))}Rk.__loaded=!1;const Ok=Rk;function Ik(){Ik.__loaded||(Ik.__loaded=!0,pf.RegisterGraphicCreator("glyph",zg),xo.load(By),xo.load(Ck?fk:qx))}Ik.__loaded=!1;const Dk=Ik;function Fk(){Fk.__loaded||(Fk.__loaded=!0,pf.RegisterGraphicCreator("group",Rp))}Fk.__loaded=!1;const zk=Fk;function jk(){jk.__loaded||(jk.__loaded=!0,pf.RegisterGraphicCreator("image",Wg),xo.load(Fy),xo.load(Ck?wk:tS))}jk.__loaded=!1;const Hk=jk;function Vk(){Vk.__loaded||(Vk.__loaded=!0,pf.RegisterGraphicCreator("line",Lg),xo.load(gy),xo.load(Ck?TA:aS))}Vk.__loaded=!1;const Nk=Vk;function Uk(){Uk.__loaded||(Uk.__loaded=!0,pf.RegisterGraphicCreator("path",tf),xo.load(ky),xo.load(Ck?sk:_S))}Uk.__loaded=!1;const Wk=Uk;function Gk(){Gk.__loaded||(Gk.__loaded=!0,pf.RegisterGraphicCreator("polygon",cf),xo.load(Ty),xo.load(Ck?hk:uS))}Gk.__loaded=!1;const Yk=Gk;function $k(){$k.__loaded||($k.__loaded=!0,pf.RegisterGraphicCreator("rect",Dg),xo.load(uy),xo.load(Ck?yA:TS))}$k.__loaded=!1;const Xk=$k;function Kk(){Kk.__loaded||(Kk.__loaded=!0,pf.RegisterGraphicCreator("richtext",Zg),xo.load(Iy),xo.load(Ck?xk:CS))}Kk.__loaded=!1;const qk=Kk;function Zk(){Zk.__loaded||(Zk.__loaded=!0,pf.RegisterGraphicCreator("shadowRoot",uf))}Zk.__loaded=!1;const Jk=Zk;function Qk(){Qk.__loaded||(Qk.__loaded=!0,pf.RegisterGraphicCreator("symbol",Eg),xo.load(_y),xo.load(Ck?jA:OS))}Qk.__loaded=!1;const tM=Qk;function eM(){eM.__loaded||(eM.__loaded=!0,pf.RegisterGraphicCreator("text",Tg),xo.load(Sy),xo.load(Ck?ZA:zS))}eM.__loaded=!1;const iM=eM;function sM(){zk(),Xk()}const nM=-.5*Math.PI,rM=1.5*Math.PI,aM="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 oM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(oM||(oM={}));const lM={[oM.selectedReverse]:{},[oM.selected]:{},[oM.hover]:{},[oM.hoverReverse]:{}},hM={container:"",width:30,height:30,style:{}},cM="scrollDrag";function dM(){return"browser"===k_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const uM={debounce:St,throttle:At};sM();let pM=class t extends tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},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=_t(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=_t(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=>{this._clearDragEvents();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});const r=dM(),a="browser"===k_.env?k_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=_t(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},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:uM[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:yt(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=yt(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(cM,{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",uM[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===k_.env?k_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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(yt(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:ai(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,[s,n,r,a]=ai(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,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=_t(t[0],0,1),c=_t(t[1],0,1),d=_t(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=yt(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?yt([a+i*n,a+s*n],a,n-l):yt([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=dM(),e="browser"===k_.env?k_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===k_.env?k_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};pM.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,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};var gM,fM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 mM=gM=class{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new Ve).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Ut(t.deltaX)>Ut(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ne,e.addEventListener("wheel",this.scroll),this.params=gM.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(cM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new pM(v),h.name=a,e.add(h),h.isScrollBar=!0);const _=this.childrenBounds,{scrollX:y,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/_.width(),1),e=Math.max(Math.min(y/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/_.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=i{i(mM)||(t(mM).toSelf(),t(Wv).toService(mM))}));function _M(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&_M(t,e)}))}const yM=t=>!u(t)&&!1!==t.visible;function bM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function xM(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 AM=["#ffffff","#000000"];function kM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ii(t).toHex(),o=new ii(e).toHex();return MM(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(...AM);for(const n of a)if(t!==n&&MM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function MM(t,e,i,s,n){if("lightness"===n){const i=ii.getColorBrightness(new ii(e));return ii.getColorBrightness(new ii(t))<.5?i>=.5:i<.5}return s?TM(t,e)>s:"largeText"===i?TM(t,e)>3:TM(t,e)>4.5}function TM(t,e){const i=wM(t),s=wM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function wM(t){const e=ni(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 CM(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 EM(t,e){return[t[0]*e,t[1]*e]}function BM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function PM(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=Qt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const LM=(t,e,i,s)=>new Fe(Object.assign({defaultFontParams:Object.assign({fontFamily:aM,fontSize:14},s),getTextBounds:i?void 0:mf,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function RM(t,e,i={}){if(!t)return{width:0,height:0};const s=mf({text:t,fontFamily:e.fontFamily||i.fontFamily||aM,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 OM(t,e="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 IM(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function DM(t,e="type"){const i=OM(t,e);return"rich"===i?pf.richtext(IM(t)):("html"===i?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"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),pf.text(t))}function FM(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 zM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function jM(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 HM(t,e){const{dx:i,dy:s}=jM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function VM(){zk(),Xk(),tM(),qk(),iM()}var NM=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&&(T=h,R.setAttribute("maxLineWidth",h-b[1]-b[2]))),k=0,M=0;let H=0;"left"===z||"start"===z?H=1:"right"===z||"end"===z?H=-1:"center"===z&&(H=0),H?H<0?(k-=T,A&&A.setAttribute("x",(A.attribute.x||0)-O),x.setAttribute("x",-b[1]-E)):H>0&&x.setAttribute("x",b[3]):(k-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-O/2),x.setAttribute("x",-E/2));const V="right"===y||"end"===y,N="left"===y||"start"===y,U=(t,e)=>{"richtext"===R.type?R.setAttributes({x:t,textAlign:e,textConfig:Y(R.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):R.setAttributes({x:t,textAlign:e})};if((y?"center"===y:_)&&H){const t=T-b[1]-b[3],e=O+E,i=1===H?(t-e)/2+E+O/2:b[0]+E-(T/2+e/2-E)+O/2;if(U(i,"center"),A){const t=i-O/2-E+F/2;A.setAttributes({x:t})}}if(N&&1!==H){const t=T-b[1]-b[3],e=0===H?-t/2+E/2:-T+b[3]+b[1]+E;if(U(e+E,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(V&&-1!==H){const t=T-b[1]-b[3],e=0===H?t/2+E/2:t;if(U(e,"right"),A){const t=e-O-E+F/2;A.setAttributes({x:t})}}"middle"===j?(M-=w/2,A&&A.setAttribute("y",0)):"bottom"===j?(M-=w,A&&A.setAttribute("y",-I/2),x.setAttribute("y",-b[2])):"top"===j&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",I/2)),P(null==m?void 0:m.text)||(R.states=m.text);const{visible:W}=a,G=NM(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},G),{visible:W&&!!s,width:T,height:w,x:k,y:M}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),G.customShape){const e=G.customShape;t.pathProxy=t=>e(this,t,new Wl)}this._bgRect=t}this._textShape=R,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:j({},UM.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}UM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const WM={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}},GM={poptip:j({},WM)};var YM=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);nA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(y(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),I.setAttribute("x",I.attribute.x+e),o.setAttribute("dx",$t(Yt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),I.setAttribute("y",I.attribute.y+e),o.setAttribute("dy",$t(Yt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?jt/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:jt/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?jt/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?jt/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:jt/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?jt/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?jt:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:jt,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?jt:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}QM.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"},panel:{},maxWidthPercent:.8,space:8,padding:10};var tT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 eT=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};j(s,QM.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new QM(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};j(e,GM.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,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),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}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}};eT=tT([qa()],eT);var iT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 sT{constructor(){this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(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)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}let nT=class extends sT{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};nT=iT([qa()],nT);let rT=class extends sT{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}};rT=iT([qa()],rT);const aT=new Fa(((t,e,i,s)=>{i(eT)||(t(eT).toSelf().inSingletonScope(),t(dg).toService(eT)),i(nT)||(t(nT).toSelf(),t(Wv).toService(nT)),i(rT)||(t(rT).toSelf(),t(Wv).toService(rT))}));class oT extends tb{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}zk(),Nk();class lT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},lT.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})}}lT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},zk(),Xk();class hT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},hT.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})}}hT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},zk(),Bk();class cT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},cT.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=ae.distancePP(t,e);this.setAttribute("radius",i)}}cT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},zk(),Bk();class dT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},dT.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=nM,endAngle:s=rM}=this.attribute,n=s-i,r=le(ue(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}dT.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},zk(),Wk();class uT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},uT.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=ce(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=ae.distancePP(t,e);this.setAttribute("radius",i)}}function pT(){zk(),Nk(),Yk(),tM()}function gT(){zk(),Nk(),Bk(),tM()}uT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},pT();class fT extends tb{getStartAngle(){return pe(this._startAngle)}getEndAngle(){return pe(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},fT.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=pf.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),P(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=pf.line;Y(i)[0].cornerRadius&&(t=pf.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"),P(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:f=12}=t;let m,v;"start"===i?(m={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)):(m={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=pf.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(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}}fT.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}}},gT();class mT extends fT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},fT.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=pf.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"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var vT,_T;!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.labelHoverOnAxis="axis-label-hover-on-axis",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",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(vT||(vT={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(_T||(_T={}));const yT={[_T.selectedReverse]:{},[_T.selected]:{},[_T.hover]:{},[_T.hoverReverse]:{}},bT={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}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},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}}},xT={size:8,stroke:"#000",lineWidth:1,zIndex:1};const ST=Math.sin(Math.PI/10);function AT(t,e=ST){const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function kT(t,e=ST){const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function MT(t){const e={};return _M(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function TT(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function wT(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return EM(r,(s?-1:1)*(n?-1:1)*t/BM(r))}function CT(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function BT(t,e,i){var s;if(kT(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>ze(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>ze(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>je(n,r)}function PT(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(oM.hover,!0),_M(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(oM.hoverReverse,!0)})),s):i},RT=(t,e,i)=>i?(_M(e,(t=>{t.name&&!P(t.states)&&(t.removeState(oM.hoverReverse),t.removeState(oM.hover))})),null):i,OT=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(oM.selected)?(_M(e,(t=>{t.name&&!P(t.states)&&(t.removeState(oM.selectedReverse),t.removeState(oM.selected))})),null):s.name&&!P(s.states)?(s.addState(oM.selected,!0),_M(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(oM.selectedReverse,!0)})),s):i};class IT extends tb{_prepareAnimate(t){if(!1!==this.attribute.animation){const{animation:e,animationEnter:i,animationExit:s,animationUpdate:n}=this.attribute,r=g(e)?e:{};this._animationConfig={enter:!1!==i&&j({},t,r,null!=i?i:{}),exit:!1!==s&&j({},t,r,null!=s?s:{}),update:!1!==n&&(y(n)?n:j({},t,r,null!=n?n:{}))}}else this._animationConfig={enter:!1,exit:!1,update:!1}}}const DT={type:"default",duration:300,easing:"linear"};class FT extends IT{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=LT(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=RT(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=OT(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=pf.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._prepare(),this._prevInnerView=this._innerView&&MT(this._innerView),this.removeAllChild(!0),this._innerView=pf.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation()}_prepare(){this._prepareAnimate(DT)}_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=pf.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=vT.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=pf.group({x:0,y:0,pickable:!1});t.name=vT.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",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=pf.group({x:0,y:0,pickable:!1});i.name=vT.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=pf.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=vT.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=lM;else{const t=this.data[s],e=j({},lM,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=pf.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=vT.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=lM;else{const i=j({},lM,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=pf.group({x:0,y:0,pickable:!1});return r.name=`${vT.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=DM(this._getLabelAttribute(t,e,n,i));if(a.name=vT.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=lM;else{const s=j({},lM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new UM(Object.assign({},e));i.name=vT.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return TT(t,this.getVerticalVector(e,i,t))}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;Ut(s[0])>Ut(s[1])?o=jt/2*(l.x>e.x?1:-1):h=jt/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+L(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+L(this.attribute,"label.space",4))*s);const f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:_}=this.attribute.label;_=d(_)?j({},bT.label.style,_(t,e,i,s)):_;_=j(this.getLabelAlign(m,o,_.angle),_),d(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let y=_.react;return d(y)&&(y=y(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,_)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==_?void 0:_.fontSize,type:h}),_),{react:y})}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}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},_M(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(e.setFinalAttributes(e.attribute),r){r.release();const i=r.attribute,a=e.getFinalAttribute(),o=function(t,e,i){const s={};for(const i in e)i in t&&U(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}(i,a);let l=Object.keys(o).length>0;if("opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l){this._newElementAttrMap[e.id]={state:"update",node:e,attrs:e.attribute};const i=r.attribute;e.setAttributes(i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}])}}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const zT={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&&BT(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function jT(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function HT(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=d(n)?n:zT[n]||zT.parity;if(s.length>=3&&PT(s,r)){do{s=a(s,r)}while(s.length>=3&&PT(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=$(i);BT(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),HT(l,s,n,(t=>BT(t,l,r))),HT(h,s,o,(t=>BT(t,h,r)||!(!n||t===l)&&BT(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function NT(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},GT(t,e.attribute.angle)),{angle:WT(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({},YT(t,e.attribute.angle)),{angle:WT(e.attribute.angle)}))}))}(t,e),function(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=Te({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function WT(t=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 GT(t,e=0){let 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=WT(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 YT(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=WT(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 $T(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!u(h),d=c?Math.cos(h):1,p=c?Math.sin(h):0,f=kT(h),m=AT(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===_||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/d,l=Math.abs(i/p);if(y&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(d);r=Math.min(t,l)}else if(y&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(d);r=Math.min(t,l)}else r=l}else r=Math.abs(i/d);k(t.attribute.maxLineWidth)&&(r=k(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function XT(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class KT{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,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=BM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return EM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class qT{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-qT.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*qT.bounceIn(2*t):.5*qT.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Nt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Nt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Nt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Nt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Nt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Nt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Nt/e)*.5+1}}static registerFunc(t,e){qT[t]=e}}function ZT(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}qT.quadIn=qT.getPowIn(2),qT.quadOut=qT.getPowOut(2),qT.quadInOut=qT.getPowInOut(2),qT.cubicIn=qT.getPowIn(3),qT.cubicOut=qT.getPowOut(3),qT.cubicInOut=qT.getPowInOut(3),qT.quartIn=qT.getPowIn(4),qT.quartOut=qT.getPowOut(4),qT.quartInOut=qT.getPowInOut(4),qT.quintIn=qT.getPowIn(5),qT.quintOut=qT.getPowOut(5),qT.quintInOut=qT.getPowInOut(5),qT.backIn=qT.getBackIn(1.7),qT.backOut=qT.getBackOut(1.7),qT.backInOut=qT.getBackInOut(1.7),qT.elasticIn=qT.getElasticIn(1,.3),qT.elasticOut=qT.getElasticOut(1,.3),qT.elasticInOut=qT.getElasticInOut(1,.3*1.5),qT.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),qT.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},qT.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)qT[`flicker${t}`]=e=>ZT(e,t);for(let t=2;t<10;t++)qT[`aIn${t}`]=e=>t*e*e+(1-t)*e;function JT(t,e,i){return t+(e-t)*i}const QT=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=JT(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=JT(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=JT(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=JT(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=JT(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=JT(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=JT(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=JT(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=JT(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=pp(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?fp(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=pp(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?fp(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=JT(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=JT(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=JT(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=JT(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=JT(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=JT(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=JT(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=JT(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=JT(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=id(e,i,s),r.addUpdateBoundTag()}}};function tw(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.setAttributes(this.target.attribute)},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=qT[s])&&void 0!==n?n:qT.linear:qT.linear,"wait"===t&&(this.onUpdate=ew),this.id=Da.GenAutoIncrementId(),this.syncAttributeUpdate=ew}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(_(i)&&_(s)){const n=dp.Get(i,cp.Color255),r=dp.Get(s,cp.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(QT["fill"===e?"fillPure":"strokePure"])}else QT[e]?t.push(QT[e]):t.push(tw)}else QT[e]?t.push(QT[e]):t.push(tw)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate;this.target.animates.forEach((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const i=e.getStartProps();this.propKeys.forEach((t=>{null!=i[t]&&e.preventAttr(t)}))}))}deleteSelfAttr(t){var e;delete this.props[t],this.fromProps&&delete this.fromProps[t];const i=this.propKeys.indexOf(t);-1!==i&&(this.propKeys.splice(i,1),null===(e=this.interpolateUpdateFunctions)||void 0===e||e.splice(i,1))}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){this.target.setAttributes(this.props),t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class sw extends iw{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();this.target.setAttributes(t)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class nw extends l{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Da.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Io.END?this.removeAnimate(t,!0):t.status!==Io.RUNNING&&t.status!==Io.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const rw=new nw;rw.isGlobal=!0;class aw{constructor(t=Da.GenAutoIncrementId(),e=rw,i){this.id=t,this.status=Io.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){return this.target=t,this.target.animates||(this.target.animates=new Map),this.target.animates.set(this.id,this),this.onRemove((()=>{this.stop(),this.target.animates.delete(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new iw(Oo.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new sw(Oo.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new iw(Oo.from,t,e,i);return this._firstStep?(this._lastStep.append(s),this._lastStep=s):(this._firstStep=s,this._lastStep=s),this.updateDuration(),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Io.RUNNING&&(this.status=Io.PAUSED)}resume(){this.status===Io.PAUSED&&(this.status=Io.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this._preventAttrs.add(t),delete this._startProps[t],delete this._endProps[t];let e=this._firstStep;for(;e;)e.deleteSelfAttr(t),e=e.next}preventAttrs(t){t.forEach((t=>this._preventAttrs.add(t)))}validAttr(t){return!this._preventAttrs.has(t)}runCb(t){var e;return null===(e=this._lastStep)||void 0===e||e.onEnd(t),this}startAt(t){return this._startTime=t,this}customInterpolate(t,e,i,s,n,r){return!1}getFromValue(){return this._startProps}getToValue(){return this._endProps}stop(t){let e=this._firstStep;for(;e;)e.stop(),e=e.next;this.status!==Io.END&&this.onEnd(),this.status=Io.END,this.target&&("start"===t?this.target.setAttributes(this._startProps):"end"===t?this.target.setAttributes(this._endProps):t&&this.target.setAttributes(t))}release(){this.status=Io.END,this._onRemove&&this._onRemove.forEach((t=>t())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Io.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),void(this.status=Io.END);this.status=Io.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&this.target.setAttributes(this._startProps);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const ow=new Mo;class lw{constructor(){this.released=!1}tick(t,e){ow.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class hw extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Ro.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Ro.INITIAL,Ao.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),Ao.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new lw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Ro.INITIAL&&(this.status=Ro.PAUSE,!0)}resume(){return this.status!==Ro.INITIAL&&(this.status=Ro.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Ro.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Ro.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Ro.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Ro.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Ro.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Ro.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,Ao.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}function uw(t){if(!t||!d(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1}return 2}dw.getInstance();class pw{static registerBuiltInAnimate(t,e){pw.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;y(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:pw.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=uw(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:pw.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=uw(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=k(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){Array.isArray(t)?t.forEach((t=>this._execute(t))):this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,u;const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:_=0,duration:y=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:M,custom:T,customType:w,controlOptions:C}=t,E=e.animate();E.priority=k;const B=d(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],L=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&L&&(i=null!==(h=P[L])&&void 0!==h?h:i),E.startAt(b);const R=i*x+B;R>0&&E.wait(R);let O=null,I=t.to,D=t.from;I||(O||(O=this.createPropsFromChannel(g,e)),I=O.props),D||(O||(O=this.createPropsFromChannel(g,e)),D=O.from),O.attrOutChannel&&e.setAttributes(O.attrOutChannel),this._handleRunAnimate(E,T,w,D,I,y,m,f,C,M,p,e);let F=0;x&&(F=x*(s-i-1));const z=d(_)?_(null===(u=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===u?void 0:u[0],e,{}):_;return z>0&&(F+=z),F>0&&E.wait(F),S&&S>0&&E.loop(S),A&&E.bounce(!0),E}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,u){var p,g,f,m,v,_,y,b;if(e&&i){i=uw(e);let c=this.resolveValue(o,u);"function"==typeof c&&(c=c(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),c=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},c);const x=d(h)?h.call(null,null!==(_=c&&(null===(v=c.data)||void 0===v?void 0:v[0]))&&void 0!==_?_:null===(b=null===(y=u.context)||void 0===y?void 0:y.data)||void 0===b?void 0:b[0],u,c):h;c.options=x,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:u=0}=t,p=d(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=d(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;u||(d||(d=this.createPropsFromChannel(a,i)),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i)),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const g=null!==(n=t.custom)&&void 0!==n?n:pw.builtInAnimateMap[r],f=t.custom?t.customType:uw(g);this._handleRunAnimate(e,g,f,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e){var i;const s={};let n=null;if(!t)return{from:n,props:s,attrOutChannel:null};const r={};let a=!1;const o=null===(i=e.context)||void 0===i?void 0:i.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===o[e]||(t[e]={to:o[e]}),t)),{})),Object.keys(t).forEach((i=>{var r,a,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?s[i]=h.to(null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,{}):s[i]=h.to),void 0!==h.from&&(n||(n={}),"function"==typeof h.from?n[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):n[i]=h.from)})),o)for(const t in o){const e=o[t];void 0!==e&&(s.hasOwnProperty(t)||(r[t]=e,a=!0))}return{from:n,props:s,attrOutChannel:a?r:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}executeItem(t,e,i=0,s=1){return Array.isArray(t)?t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean):[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Io.END),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}pw.builtInAnimateMap={};const gw="appear",fw="disappear",mw="update",vw="highlight",_w="unhighlight";class yw{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class bw{constructor(t){this.stateList=null,this.graphic=t}applyState(t,e,i){const s=dw.getInstance(),n=[],r=[];if(this.stateList&&this.stateList.length?t.forEach(((t,i)=>{const a={allowTransition:!0,stopOriginalTransition:!0};this.stateList.forEach((e=>{const i=s.isTransitionAllowed(e.state,t,this.graphic);a.allowTransition=a.allowTransition&&i.allowTransition})),a.allowTransition&&(r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new pw(this.graphic)}),this.stateList.forEach((e=>{s.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&n.push(e)})))})):t.forEach(((t,i)=>{r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new pw(this.graphic)})})),n.forEach((t=>{t.executor.stop(null,!1)})),r.length){r[0].executor.execute(r[0].animationConfig);for(let t=0;t{e&&e.executor.execute(e.animationConfig),this.stateList=this.stateList.filter((t=>t!==s)),t===r.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!n.includes(t))):this.stateList=[],this.stateList.push(...r)}applyAppearState(t,e){this.applyState([gw],[{name:gw,animation:t}],e)}applyDisappearState(t,e){this.applyState([fw],[{name:fw,animation:t}],e)}applyUpdateState(t,e){this.applyState([mw],[{name:mw,animation:t}],e)}applyHighlightState(t,e){this.applyState([vw],[{name:vw,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([_w],[{name:_w,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class xw{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new bw(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new yw(t)),t._animationStateStore}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return(new xw)._getAnimationStateManager(t),t}}class Sw{getAttributes(t=!1){return t&&this.finalAttribute?this.finalAttribute:this.attribute}animate(t){var e,i,s;const n=new aw(null==t?void 0:t.id,null!==(i=null!==(e=null==t?void 0:t.timeline)&&void 0!==e?e:this.stage&&this.stage.getTimeline())&&void 0!==i?i:rw,null==t?void 0:t.slience);if(n.bind(this),t){const{onStart:e,onEnd:i,onRemove:s}=t;null!=e&&n.onStart(e),null!=i&&n.onEnd(i),null!=s&&n.onRemove(s)}return null===(s=this.stage)||void 0===s||s.ticker.start(),n}createTimeline(){return new nw}createTicker(t){return new hw(t)}setFinalAttributes(t){this.finalAttribute||(this.finalAttribute={}),Object.assign(this.finalAttribute,t)}initFinalAttributes(t){this.finalAttribute=t}initAnimateExecutor(){this._animateExecutor||(this._animateExecutor=new pw(this))}executeAnimation(t){return this.initAnimateExecutor(),this._animateExecutor.execute(t),this}executeAnimations(t){return this.initAnimateExecutor(),t.forEach((t=>{this._animateExecutor.execute(t)})),this}getFinalAttribute(){return this.finalAttribute}getGraphicAttribute(t,e=!1){return!e&&this.finalAttribute?this.finalAttribute[t]:this.attribute[t]}pauseAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function Aw(){G(Bp,xw),G(Bp,Sw)}class kw extends iw{constructor(t,e,i,s,n){super("customAnimate",e,i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class Mw extends kw{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class Tw{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new pw(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttr(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function ww(t){return new Tw(t)}class Cw extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,this.target.setAttribute("text",n)}}const Ew=1e3,Bw="quadInOut",Pw=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],Lw=(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=pp(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Rw=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?ey(t):[],n=ey(e);i&&s&&(i.fromTransform&&iy(s,i.fromTransform.clone().getInverse()),iy(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})))},Iw=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Dw=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Iw.includes(n))return;const r=e[n];if(!u(r)&&!u(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?dp.Get(t,cp.Color255):t;i.push({from:y(t[n])?t[n].map(e):e(t[n]),to:y(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class Fw extends kw{constructor(t,e,i){super({},{},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;Rw(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&Lw(this.otherAttrs,i,e),this.target.setAttributes(i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const zw=(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=Ow(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Dw(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new Fw({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Ew,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Bw);return c.play(d),c};class jw extends kw{constructor(t,e,i){super({},{},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;Rw(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&&Lw(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Hw=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Pw.includes(t))(i)||(e[i]=t[i])})),e},Vw=(t,e,i)=>{const s=Hw(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),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=Ao.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},Nw=(t,e,i)=>{const s=[],n=i?null:Hw(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:Hw(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=Rg(t.attribute),n=ny(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(Ao.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=ny(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(Ao.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=ny(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(Ao.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 ry(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 ry(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(Ao.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:ay(i)}];const s=[];return ly(i,e,s),s})(t,e).forEach((t=>{s.push(Ao.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 ly(l,e,h),h})(t,e).forEach((t=>{s.push(Ao.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=ey(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(Ao.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(Ao.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Vw(t,s,e),s};class Ww extends kw{constructor(t,e,i,s,n){super(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(){super.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:qo.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:qo.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:qo.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Gw extends Ww{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;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=Ao.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!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:y/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(_+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 Yw extends Ww{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:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=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=Ao.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:f,height:"in"===v&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===y?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class $w extends kw{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){super.onBind();const{points:t,segments:e}=this.target.attribute,{points:i,segments:s}=this.target.getFinalAttribute();this.from={points:t,segments:e},this.to={points:i,segments:s},this.props=this.to;const n=this.getPoints(this.from),r=this.getPoints(this.to,!0);this.fromPoints=n?Array.isArray(n)?n:[n]:[],this.toPoints=r?Array.isArray(r)?r:[r]:[];const a=new Map;this.fromPoints.forEach((t=>{t.context&&a.set(t.context,t)}));let o,l,h=1/0,c=-1/0;for(let t=0;t=0;t-=1)if(a.has(this.toPoints[t].context)){c=t,l=a.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(c)?(this.clipRange=this.toPoints[c][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[c][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=_t(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let d=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=a.get(t.context);return i?(d=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ec&&l?[l,t]:[d,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new re(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(t)return Object.keys(this.to).forEach((t=>{this.target.attribute[t]=this.to[t]})),this.target.addUpdatePositionTag(),void this.target.addUpdateShapeAndBoundsTag();if(this.points=this.points.map(((t,i)=>{const s=ed(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));this.target.setAttributes({clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.target.attribute.segments=e}else this.target.attribute.points=this.points;this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Xw extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0}));const o=this.target.getFinalAttribute();o&&this.target.setAttributes(o),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(a)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Kw extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Object.assign(this.target.attribute,i),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class qw extends Xw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class Zw extends Kw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}const Jw=(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.getFinalAttribute();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.getFinalAttribute();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)};class Qw extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this._updateFunction=null}updateStartAngle(t){this.target.attribute.startAngle=this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t}updateEndAngle(t){this.target.attribute.endAngle=this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class tC extends Qw{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=Jw(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r),this.determineUpdateFunction()}}class eC extends Qw{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class iC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/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:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class sC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const nC=(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,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:u(l)?void 0:c,height:u(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class rC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=nC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class aC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:u(o)?void 0:h,height:u(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const oC=(t,e,i)=>{const s=t.getFinalAttribute().points,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.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class lC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(this.target.attribute.points=r.map(((t,i)=>ed(r[i],a[i],e))),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class hC extends lC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:oC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class cC extends lC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:oC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const dC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class uC extends lC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:dC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class pC extends lC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:dC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const gC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class fC extends lC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:gC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class mC extends lC{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:gC(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const vC=(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.getFinalAttribute(),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.getFinalAttribute();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)};class _C extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class yC extends _C{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=vC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}}class bC extends _C{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const xC=(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.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:u(a)?void 0:l,width:u(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class SC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=xC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class AC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class kC extends Mw{onBind(){var t;const e=ww(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;this.target.setAttributes({x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class MC extends Mw{onBind(){const t=ww(this.target);this._animator=t;const e=this.duration,i=this.easing,{config:s,diffAttrs:n}=this.params;t.animate(this.target,{type:"to",to:Object.assign({},n),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},n)}}),this.completeBind(t)}deleteSelfAttr(t){super.deleteSelfAttr(t),this._animator.deleteSelfAttr(t)}tryPreventConflict(){}}function TC(){zk(),Nk(),qk(),iM(),pw.registerBuiltInAnimate("axisEnter",kC),pw.registerBuiltInAnimate("axisUpdate",MC)}var wC=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{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=pf.group({zIndex:999});e.name=vT.axisBreak,e.id=this._getNodeId(`${vT.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=j({},xT,s),a=null!==(e=r.size)&&void 0!==e?e:xT.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=pf.symbol(Object.assign({x:s.x,y:s.y},o));l.name=vT.axisBreakSymbol;const h=pf.symbol(Object.assign({x:n.x,y:n.y},o));h.name=vT.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=pf.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=vT.background,n.id=this._getNodeId("background"),n.states=j({},yT,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new UM(Object.assign({},t));e.name=vT.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=wC(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];P(l)||(c.state={line:j({},yT,l),symbol:j({},yT,l)});const d=new fT(c);d.name=vT.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return gt(t[0],0)?gt(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}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:d}=s,p=wC(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),_=this.getRelativeVector();let y=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+L(this.attribute,"label.space",4);y+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===_[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?y+=i+(e-1)*t:y=0}else if(0===_[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;y+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}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.getActualOffset(x),A=this.getVerticalCoord(v,S,!1),M=this.getVerticalVector(S,!1,{x:0,y:0});let T,w,{angle:C}=p;if(T="start"===n?"start":"end"===n?"end":"center",u(C)&&o){C=PM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;w=1==-1*t?"bottom":"top"}else T=this.getTextAlign(M),w=this.getTextBaseline(M,!1);let E=d;if(u(E)){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(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=s-S;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=s-S}const B=Object.assign(Object.assign(Object.assign({},A),p),{maxWidth:E,textStyle:Object.assign({textAlign:T,textBaseline:w},a),state:{text:j({},yT,c.text),shape:j({},yT,c.shape),panel:j({},yT,c.background)}});return B.angle=C,l&&l.visible&&(B.shape=Object.assign({visible:!0},l.style),l.space&&(B.space=l.space)),h&&h.visible&&(B.panel=Object.assign({visible:!0},h.style)),B}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:d}=s,p=wC(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),_=this.getVerticalVector(m,!1,{x:0,y:0});let y,{angle:b}=p,x="center";if(u(b)&&a){b=PM(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;y=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(_,!1,o.angle);x=t,y=e}const S=d,A=h?h(c):c,k=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:y},o),text:A});return k.angle=b,l&&l.visible&&(k.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),k}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return gt(t[1],0)?i=!gt(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 GT(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return YT(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=$(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(P(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(P(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,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=oe(e)})),UT(i,t),!NT(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=kT(a),l=AT(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=XT(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);k(i)&&(c=$t(c,i))}}else{if(l){const i=XT(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);k(i)&&(c=$t(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&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);$T(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&VT(t,{orient:o,method:m,separation:v,lastVisible:_,firstVisible: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=pf.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=vT.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-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(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 f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=RM(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=ai(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(){super.release(),this._breaks=null}}CC.defaultAttributes=bT,G(CC,KT);class EC{isInValidValue(t){const{startAngle:e=nM,endAngle:i=rM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=nM,endAngle:i=rM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return ce(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return wT(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function BC(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=BC(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var RC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),k(l)&&l>=3){const t=CT(n,l,c,e,i);h=pf.path(Object.assign(Object.assign({},a.style),{path:ET(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=pf.circle(t)}h.name=vT.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=j({},yT,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=RC(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=L(this.attribute.label,"style.fontSize",12)+L(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=n+m+f+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:j({},yT,d.text),shape:j({},yT,d.shape),panel:j({},yT,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;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(gt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=BC(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&PC(e,c,i)}else e.AABBBounds.width()>r&&PC(e,r,i)}else o>a.x&&h.x2>n.x2?(PC(e,n.x2-o,i),r&&LC(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return gt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}OC.defaultAttributes=bT,G(OC,EC);const IC=t=>t.map(((t,e)=>({index:e,value:t}))),DC=(t,e,i=0)=>{const s=new Ne(t).expand(i/2),n=new Ne(e).expand(i/2);return s.intersects(n)},FC=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=oe(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;u||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=LM(a),_=t.range();let y=[];for(let i=0;i{HC[t]=!0}));const GC=t=>-Math.log(-t),YC=t=>-Math.exp(-t),$C=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,XC=t=>10===t?$C:t===Math.E?Math.exp:e=>Math.pow(t,e),KC=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),qC=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),ZC=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function JC(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 QC(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function tE(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function eE(t,e,i,s){return 1===i&&(i=0),tE(t,i,s)*(e/(1-i))}function iE(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function sE(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=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 rE{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=iE(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=_t(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}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const aE=Symbol("implicit");class oE extends rE{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=jC.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=aE}clone(){const t=(new oE).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!==aE)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&&a>1;)a-=1,r=Math.floor((e-t)/a);return lE(t,e,r,n)}class cE extends oE{constructor(t){super(),this.type=jC.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=eE(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)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("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),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]}}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(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:hE(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=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(t=10){const e=this.calculateVisibleDomain(this._range);return hE(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=bt(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,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 cE(!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:dE}=ri;function uE(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return kt(t,e);if("string"===i){if(s=ii.parseColorString(e)){const e=dE(ii.parseColorString(t),s);return t=>e(t).formatRgb()}return kt(Number(t),Number(e))}return e instanceof si?dE(t,e):e instanceof ii?dE(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):kt(Number(t),Number(e))}class pE extends rE{constructor(t=WC,e=WC){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=WC,this._piecewise=QC,this._interpolate=uE}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),kt)),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=Mt,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=bt(i[0],i[r-1])),this._piecewise=r>2?sE:QC,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:WC),this.rescale(i)):this._clamp!==WC}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=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 gE=Math.sqrt(50),fE=Math.sqrt(10),mE=Math.sqrt(2),vE=[1,2,5,10],_E=(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=SE(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?bE(0,-(e-1)/s,s):bE((e-1)/s,0,s)},yE=vt(((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 _E(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return _E(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=bE(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=bE(t,e,l);return n&&r.reverse(),r})),SE=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=vE[0];return i>=gE?s=vE[3]:i>=fE?s=vE[2]:i>=mE&&(s=vE[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function AE(t,e,i){const s=(e-t)/Math.max(0,i);return SE(s)}function kE(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;e0;){if(s=AE(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function TE(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 wE=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),CE=vt(((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})),EE=vt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=xE(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?wE(t,e,n):wE(t,e,nE(n)),h=wE(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),BE=vt(((t,e,i,s,n)=>kE(s(t),s(e),i).map((t=>nE(n(t))))));class PE extends pE{constructor(){super(...arguments),this.type=jC.Linear}clone(){var t;const e=new PE;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return yE(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(d(null==e?void 0:e.customTicks))return e.customTicks(this,t);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=xE(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(t=10){const e=this.calculateVisibleDomain(this._range);return kE(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(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r: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}}function RE(t){return e=>-t(-e)}function OE(t=Number.EPSILON){return e=>Math.max(e,t)}class IE extends pE{constructor(){super(KC(10),XC(10)),this.type=jC.Log,this._limit=OE(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new IE).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=KC(this._base),s=XC(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=RE(i),this._pows=RE(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=GC,this.untransformer=YC):(this._logs=i,this._pows=s,this._limit=OE(),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 WC}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return CE(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return EE(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return BE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return BE(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{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))))}}}G(IE,LE);class DE extends PE{constructor(){super(qC(1),ZC(1)),this.type=jC.Symlog,this._const=1}clone(){return(new DE).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=qC(t),this.untransformer=ZC(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return CE(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return EE(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return BE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return BE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}G(DE,LE);class FE{constructor(){this.type=jC.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[lt(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 FE).domain(this._domain).range(this._range).unknown(this._unknown)}}function zE(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function jE(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!VC(t.type))return IC(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return IC([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:u=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),_=f&&f()?f().breakDomains:null,m=_&&_.length?v.filter((t=>_.every((e=>te[1])))):v;else if(p(h))m=zE(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=zE(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:u}):t.d3Ticks(e,{noDecimals:u})))}else{const i=null!==(s=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;m=zE(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:u,customTicks:n}):t.ticks(e,{noDecimals:u,customTicks:n})))}var v,_;const y=t.domain();if(e.labelFirstVisible&&y[0]!==m[0]&&!m.includes(y[0])&&m.unshift(y[0]),e.labelLastVisible&&y[y.length-1]!==m[m.length-1]&&!m.includes(y[y.length-1])&&m.push(y[y.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=zC(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=zC(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=$(l),r=f&&f()?VE.greedy:VE.parity;for(;l.length>=3&&PT(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;BT(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),jE(t,l,a,(e=>BT(e,t,i))),jE(n,l,o,(e=>BT(e,n,i)||!(!a||e===t)&&BT(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),$(h)!==$(m)&&h.push($(m))),m=h}}return IC(m)},VE={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&BT(i,t,e)||(i=t,0))))}},NE=(t,e,i,s)=>{const n=zC(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},UE=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,WE=(t,e)=>t[1]{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),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?IC([s[s.length-1]]):IC([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:f,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=K(g),a=X(g);if(s.length<=f/n){const i=NE(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=YE(s,i,o,e.labelLastVisible,Math.floor(n/l),!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=NE(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!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])){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&&!UE(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?WE(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{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=LM(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=ce({x:0,y:0},i,t),a=TT(r,wT(s,r,e,n));return o=a,l=wT(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return _.align||(gt(y,f.x)?_.baseline||(_.baseline=b>f.y?"top":"bottom"):y>f.x?_.align="left":y{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||h<=0)return IC(t.domain());let c;if(p(n))c=t.stepTicks(n);else if(p(s))c=t.forceTicks(s);else if(p(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=d(i)?i({axisLength:s,labelStyle:l}):i;c=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=$E(t,i,e),r=K(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=KE(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-p)}else c=t.domain();return IC(c)},KE=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&DC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},qE=new Uint32Array(33),ZE=new Uint32Array(33);ZE[0]=0,qE[0]=~ZE[0];for(let t=1;t<=32;++t)ZE[t]=ZE[t-1]<<1|1,qE[t]=~ZE[t];function JE(t,e,i={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:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&qE[31&o]&ZE[1+(31&l)])return!0}else{if(i[h]&qE[31&o])return!0;if(i[c]&ZE[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,qE[31&o]&ZE[1+(31&l)]);else for(s(h,qE[31&o]),s(c,ZE[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,ZE[31&a]|qE[1+(31&o)]);else for(n(l,ZE[31&a]),n(h,qE[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=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 QE(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=_t(i,-o,t.width+l),d=_t(s,-o,t.width+l),u=_t(n,-a,t.height+h),p=_t(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function tB(t,e,i=!1){return i?QE(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function eB(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=tB(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=QE(t,r)),e.getRange(r)))}function iB(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>p(t))),u=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return iB(t,e,n,o,h,c,l)}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 iB(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 iB(t,e,n,s,h,c)}return!1}const nB=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],rB=["top","inside-top","inside"];function aB(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let _=0,y=0;return u<0-h?_=-u:p>m&&(_=m-p),g<0-l?y=-g:f>v&&(y=v-f),{dx:_,dy:y}}const oB={mode:"same-time",duration:300,easing:"linear"};function lB(t){return 3===t||4===t}function hB(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 cB=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 dB(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)}}var uB=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{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const fB=(t,e)=>Math.ceil(t)>Math.floor(e),mB=([t,e],[i,s])=>s>t&&e>i;function vB(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}var _B=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{const e=t.target;e===this._lastHover||P(e.states)||(e.addState(oM.hover,!0),_M(this,(t=>{t===e||P(t.states)||t.addState(oM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(_M(this,(t=>{P(t.states)||(t.removeState(oM.hoverReverse),t.removeState(oM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void _M(this,(t=>{P(t.states)||(t.removeState(oM.selectedReverse),t.removeState(oM.selected))}));P(e.states)||(e.addState(oM.selected,!0),_M(this,(t=>{t===e||P(t.states)||t.addState(oM.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)===qo.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===qo.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(Ae(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,f=p-d;return[dB(g,f,c,d,a,o),dB(-g,-f,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds)}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=pf.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Wl)}return e&&e.getAttributes(!0).fill&&s.setAttribute("stroke",e.getAttributes(!0).fill),this.attribute.line&&!P(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;const t=[];!1!==this._enableAnimation&&this._baseMarks.forEach((e=>{t.push(e.attribute),e.initAttributes(e.getAttributes(!0))}));const{overlap:e,smartInvert:i,dataFilter:s,customLayoutFunc:n,customOverlapFunc:r}=this.attribute;let a=this.attribute.data;if(d(s)&&(a=s(a)),a&&a.length){const t=new Set;a=a.filter((e=>!t.has(e.id)&&t.add(e.id)))}let o=this._initText(a);o=d(n)?n(a,o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(o);const l=[],h=o;if(!c(e)&&d(null==e?void 0:e.filterBeforeOverlap)){const t=this.getRelatedGraphic.bind(this);o.forEach((i=>{e.filterBeforeOverlap(i,t,this)?h.push(i):l.push(i)}))}d(r)?o=r(h,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(l):!1!==e&&(o=this._overlapping(h).concat(l)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),o&&o.length&&o.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==i&&this._smartInvert(o),this._renderLabels(o),!1!==this._enableAnimation&&this._baseMarks.forEach(((e,i)=>{e.initAttributes(t[i])}))}_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&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(e)&&(t.states=e)}_createLabelText(t){var e,i;return DM(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;const i=[];let s;if(s=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),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&fB(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&fB(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(gt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(vB([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!mB([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let y=0,b=t.length-1;for(;y<=b;)y===b?_.push(t[y]):(_.push(t[y]),_.push(t[b])),y++,b--;return _}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&s.setRange(tB(i,t.AABBBounds,!0))}))),h.length>0&&h.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&&s.setRange(tB(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(tB(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){var s;if(t){if(!1!==t.attribute.visible){if(null===(s=t.context)||void 0===s?void 0:s.animationState){const e=t.clone();return Object.assign(e.attribute,t.getAttributes(!0)),e.AABBBounds}return t.AABBBounds}const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:n,y:r}=e;return{x1:n,x2:n,y1:r,y2:r}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:p}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{bB[t]=e};var SB=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{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,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*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}AB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const kB=()=>{xB("symbol",AB),xB("line-data",AB)};var MB=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{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}})(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}}}TB.tag="rect-label",TB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var wB=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{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=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}}(t,e,i,s)}};CB.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const EB=()=>{xB("line",CB),xB("area",CB)};var BB=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);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=d(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=d(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}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),h=l.getAttributes(!0),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.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=(h.startAngle+h.endAngle)/2,u=h.endAngle-h.startAngle,p=fe(h.endAngle-u/2),g=ce(c,h.outerRadius,o),f=ce(c,a+e.line.line1MinLength,o),m=new PB(t,g,f,p,u,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=ce(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(d=m.quadrant)||2===d?this._arcRight.set(m.refDatum,m):lB(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var d}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":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 f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,_=0;if("inside"===o&&(_="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=ce(t.circleCenter,v,t.middleAngle),t.labelLimit=f,ft(f,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.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=lB(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=lB(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.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 c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(mt(t.pointB.x,this._line2MinLength+h)||ft(t.pointB.x,c-this._line2MinLength-h))&&(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(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;k(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=lB(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-y-c:0+y+c;break;default:m=p.x+f*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+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?lB(t.quadrant)?"left":"right":lB(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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*(lB(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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,f,m;if(gt(l/2,u))g=0,f=1,m=-p;else if(gt(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,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,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?gt(v[0].y,v[1].y)?ft(t.middleAngle,-Math.PI)&&mt(t.middleAngle,0)||ft(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.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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;e{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 IB(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=ae.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 DB(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=ET(t,!!n),o=ET(r,!!n);const h=ae.distancePP(s,l),c=ae.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=IB(e,t,!1,!!n),o=IB(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=ET(t,!!n),o=ET(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}OB.defaultAttributes={pickable:!1};class FB extends tb{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&MT(this._innerView),this.removeAllChild(!0),this._innerView=pf.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 TT(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:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${vT.grid}-sub`:`${vT.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=ET(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=IB(t,o,!1,!!a)}const u=pf.path(Object.assign({path:c,z:l},d(r)?j({},this.skipDefault?null:FB.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 f=ET(o,!!a),m=Ut(o[0].x-o[1].x),v=Ut(o[0].y-o[1].y),_=pf.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*jt/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?j({},this.skipDefault?null:FB.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],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!gt(a.value,0)&&!gt(l.value,0),d=!gt(a.value,1)&&!gt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}FB.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},zk(),Wk();class zB extends FB{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},FB.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=nM,endAngle:r=rM}=this.attribute;i=CT(t,s,ae.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=j({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);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})}}G(zB,KT);var jB,HB,VB,NB=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){const e=this._getPointsOfSubGrid(p,d);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"})}}G(UB,EC),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(jB||(jB={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(HB||(HB={})),function(t){t.dataZoomChange="dataZoomChange"}(VB||(VB={}));const WB="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",GB={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:WB,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:WB,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},YB={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}},$B=0,XB=1,KB=2,qB=3,ZB=4,JB=5,QB=5,tP=999,eP=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var iP=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;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s,zIndex:KB},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s,zIndex:KB},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto",zIndex:$B},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,k,M,T;const{orient:w,middleHandlerStyle:C={},startHandlerStyle:E={},endHandlerStyle:B={},zoomLock:P}=this.attribute,{start:L,end:R}=this._getState(),{position:O,width:I,height:D}=this._getLayoutAttrFromConfig(),F=null!==(t=E.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=B.triggerMinSize)&&void 0!==e?e:40,j=this._getContainer();if(this._isHorizontal){if(C.visible){const t=(null===(i=C.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:O.x+L*I,y:O.y-t,width:(R-L)*I,height:t,zIndex:JB},null===(s=C.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=C.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:O.x+(L+R)/2*I,y:O.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=C.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square",zIndex:JB},C.icon),{pickable:!P&&(null===(h=C.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:O.x+L*I,y:O.y+D/2,size:D,symbolType:null!==(c=E.symbolType)&&void 0!==c?c:"square"},YB.horizontal),{zIndex:JB}),E),{pickable:!P&&(null===(d=E.pickable)||void 0===d||d)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:O.x+R*I,y:O.y+D/2,size:D,symbolType:null!==(u=B.symbolType)&&void 0!==u?u:"square"},YB.horizontal),{zIndex:JB}),B),{pickable:!P&&(null===(p=B.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:O.x+L*I-t/2,y:O.y+D/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:tP},YB.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:O.x+R*I-g/2,y:O.y+D/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:tP},YB.horizontal),{pickable:!P}),"rect")}else{if(C.visible){const t=(null===(g=C.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===w?O.x-t:O.x+I,y:O.y+L*D,width:t,height:(R-L)*D,zIndex:JB},null===(f=C.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(_=null===(v=null===(m=C.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===_||_)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===w?O.x-t/2:O.x+I+t/2,y:O.y+(L+R)/2*D,angle:Math.PI/180*90,symbolType:null!==(b=null===(y=C.icon)||void 0===y?void 0:y.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0,zIndex:JB},C.icon),{pickable:!P&&(null===(S=null===(x=C.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:O.x+I/2,y:O.y+L*D,size:I,symbolType:null!==(A=E.symbolType)&&void 0!==A?A:"square"},YB.vertical),{zIndex:JB}),E),{pickable:!P&&(null===(k=E.pickable)||void 0===k||k)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:O.x+I/2,y:O.y+R*D,size:I,symbolType:null!==(M=B.symbolType)&&void 0!==M?M:"square",zIndex:JB},YB.vertical),B),{pickable:!P&&(null===(T=B.pickable)||void 0===T||T)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:O.x+I/2+t/2,y:O.y+L*D-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:tP},YB.vertical),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:O.x+I/2+i/2,y:O.y+R*D-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:tP},YB.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move",zIndex:qB},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move",zIndex:qB},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1,zIndex:XB},"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))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1,zIndex:ZB},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){return t.length<=10||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,void 0!==e?e*e:1)}(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(t);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(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){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 Ve).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)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=iP(c,["formatMethod"]),{formatMethod:g}=d,f=iP(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:_,width:y,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,A={x1:_.x,y1:_.y,x2:_.x+y,y2:_.y+b};let k,M,T,w;this._isHorizontal?(k={x:_.x+m*y,y:_.y+b/2},M={x:_.x+v*y,y:_.y+b/2},T={textAlign:eP(A,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},w={textAlign:eP(A,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:_.x+y/2,y:_.y+m*b},M={x:_.x+y/2,y:_.y+v*b},T={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:eP(A,t,"start",this._isHorizontal)?"top":"bottom"},w={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:eP(A,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),j({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T,zIndex:QB}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),j({},f,{text:S,x:M.x,y:M.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w,zIndex:QB}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new UM(e),s.name=i,t.add(s)),s}}const nP={debounce:St,throttle:At};class rP extends l{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=jB.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=jB.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=jB.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=jB.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=jB.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===k_.env?k_:this.stage,s=dM();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===jB.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===jB.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===jB.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===jB.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(HB.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(HB.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(HB.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===jB.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(HB.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(HB.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:nP[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===k_.env?k_:this.stage,e=dM();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===k_.env?k_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===k_.env?k_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:_t(e+t,0,1),end:_t(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=jB.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}VM(),Xk(),tM(),Lk(),Nk();let aP=class t extends tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,_;h.visible?this._isHorizontal?(m=p,v=g-f,_={x:a.x,y:a.y+f}):(m=p-f,v=g,_={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(y+b)/2,_={x:_.x+y/2,y:_.y}):(v-=(y+b)/2,_={x:_.x,y:_.y+y/2})),v+=(null!==(n=u.lineWidth)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:_,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new sP(this._getRendererAttrs()),this._interaction=new rP(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(HB.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(HB.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(VB.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(HB.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;p(t)&&p(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(VB.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.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._renderer.previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._renderer.statePointToData=t)}};var oP,lP,hP,cP;function dP(){zk(),VM(),Aw()}aP.defaultAttributes=GB,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"}(oP||(oP={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(lP||(lP={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(hP||(hP={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(cP||(cP={}));class uP extends tb{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=LT(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=RT(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=OT(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:j({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:j({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:j({},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=pf.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=pf.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=pf.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 pP(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 gP(t,e,i,s){t&&(pP(t.startSymbol,e,i,s),t.lines.forEach((t=>pP(t,e,i,s))),pP(t.line,e,i,s),pP(t.endSymbol,e,i,s))}function fP(t,e,i,s){t&&(pP(t.getTextShape(),e,i,s),pP(t.getBgRect(),e,i,s))}function mP(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 vP(t,e,i,s){t&&(mP(t.startSymbol,e,i,s),t.lines.forEach((t=>mP(t,e,i,s))),mP(t.line,e,i,s),mP(t.endSymbol,e,i,s))}function _P(t,e,i,s){t&&(mP(t.getTextShape(),e,i,s),mP(t.getBgRect(),e,i,s))}function yP(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;pP(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)})),pP(t.endSymbol,s+r+a,o,n),Y(e).forEach((t=>{const e=s+r+a+o;pP(t.getTextShape(),e,l,n),pP(t.getBgRect(),e,l,n)}))}function bP(t,e,i,s,n){gP(t,s,i,n),Y(e).forEach((t=>{fP(t,s,i,n)}))}function xP(t,e,i,s,n){pP(t,s,i,n),Y(e).forEach((t=>{fP(t,s,i,n)}))}function SP(t,e,i,s,n){pP(t,s,i,n),Y(e).forEach((t=>{fP(t,s,i,n)}))}function AP(t,e,i,s,n,r){var a;gP(t,n,s,r),pP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?fP(i,n,s,r):pP(i,n,s,r)}function kP(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;pP(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)})),pP(e,n+o+l,h,r),pP(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(pP(i.getTextShape(),n+o+l+h+c,d,r),pP(i.getBgRect(),n+o+l+c,d,r)):pP(i,n+o+l+c,d,r)}function MP(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?yP(t,e,s,r,a):"fadeIn"===i&&bP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?yP(t,e,s,n,a):"fadeIn"===i&&bP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){vP(t,s,i,n),Y(e).forEach((t=>{_P(t,s,i,n)}))}(t,e,i,s,n)}}function TP(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&&xP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&xP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){mP(t,s,i,n),Y(e).forEach((t=>{_P(t,s,i,n)}))}(t,e,i,s,n)}}function wP(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&&SP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&SP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){mP(t,s,i,n),Y(e).forEach((t=>{_P(t,s,i,n)}))}(t,e,i,s,n)}}function CP(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?AP(n,r,e,i,s,o):"callIn"===t&&kP(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?AP(n,r,e,i,s,a):"callIn"===t&&kP(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;vP(t,n,s,r),mP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?_P(i,n,s,r):mP(i,n,s,r)}(n,r,e,t,i,s)}}const EP={type:"clipIn",duration:500,easing:"linear",delay:0},BP={type:"fadeIn",duration:500,easing:"linear",delay:0},PP={type:"callIn",duration:500,easing:"linear",delay:0},LP={type:"fadeOut",duration:500,easing:"linear",delay:0};class RP{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=Y(null==n?void 0:n.label),a=Y(null==n?void 0:n.labelBackground),o=Y(s).map(((s,n)=>{var o,l;const h=j({},i,s),c=new UM(Object.assign(Object.assign({},h),{state:{panel:j({},lM,null!==(o=a[n])&&void 0!==o?o:$(a)),text:j({},lM,null!==(l=r[n])&&void 0!==l?l:$(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===Y(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=Y(this._label),n=Y(null==i?void 0:i.label),r=Y(null==i?void 0:i.labelBackground);if(s.length){const i=Y(e);s.forEach(((e,s)=>{var a,o;const l=j({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:j({},lM,null!==(a=r[s])&&void 0!==a?a:$(r)),text:j({},lM,null!==(o=n[s])&&void 0!==o?o:$(n))}})),this.setLabelPos(e,l)}))}}}class OP extends uP{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=EP,this.defaultExitAnimation=LP}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;HM(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}G(OP,RP);const IP=.001,DP={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:oP.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]}},FP={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"}}},zP={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:{autoRotate:!0,position:hP.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]}},jP={interactive:!0,label:{position:lP.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}},HP={interactive:!0,label:{autoRotate:!0,position:hP.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}},VP={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"}},NP={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"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},UP={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 WP(){GP._animate=MP}dP(),pT(),Aw();class GP extends OP{markerAnimate(t){GP._animate&&this._animationConfig&&GP._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},GP.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i: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,e){var i;return(bM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return xM(Math.abs(e),Math.PI/2,IP)||xM(Math.abs(e),3*Math.PI/2,IP)?SM(i,e,t):bM(e)?FP.postiveXAxis[t]:FP.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new fT({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:j({},lM,null==a?void 0:a.line),startSymbol:j({},lM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},lM,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:j({},lM,null==a?void 0:a.line),startSymbol:j({},lM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},lM,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}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",GP.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(GP.defaultAttributes.label)}}function YP(){$P._animate=TP}GP.defaultAttributes=DP,dP(),Yk(),Aw();class $P extends uP{markerAnimate(t){$P._animate&&this._animationConfig&&$P._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},$P.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=BP,this.defaultExitAnimation=LP}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},NP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;HM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=pf.polygon(Object.assign({points:e},i));n.states=j({},lM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",$P.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=j({},lM,null==i?void 0:i.area)),this._updateMarkLabels($P.defaultAttributes.label)}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}}$P.defaultAttributes=jP,G($P,RP),dP(),gT(),Aw();class XP extends OP{markerAnimate(t){XP._animate&&this._animationConfig&&XP._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},XP.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case hP.arcInnerStart:l=n;case hP.arcOuterStart:l=n;break;case hP.arcInnerEnd:l=r;case hP.arcOuterEnd:l=r;break;case hP.center:case hP.arcInnerMiddle:case hP.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return VP[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new mT({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:j({},lM,null==o?void 0:o.line),startSymbol:j({},lM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},lM,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:j({},lM,null==o?void 0:o.line),startSymbol:j({},lM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},lM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",XP.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(XP.defaultAttributes.label)}}XP.defaultAttributes=zP,dP(),Bk(),Aw();class KP extends uP{markerAnimate(t){KP._animate&&this._animationConfig&&KP._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},KP.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=BP,this.defaultExitAnimation=LP}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case hP.center:h=(s+n)/2,c=(r+a)/2;break;case hP.arcInnerStart:h=s,c=r;break;case hP.arcOuterStart:h=n,c=r;break;case hP.arcInnerEnd:h=s,c=a;break;case hP.arcOuterEnd:h=n,c=a;break;case hP.arcInnerMiddle:h=s,c=(r+a)/2;break;case hP.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},VP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;HM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=pf.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=j({},lM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",KP.defaultAttributes.label)}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=j({},lM,null==o?void 0:o.area)),this._updateMarkLabels(KP.defaultAttributes.label)}isValidPoints(){return!0}}function qP(){ZP._animate=CP}KP.defaultAttributes=HP,G(KP,RP),dP(),pT(),gT(),tM(),Hk(),Nk(),Aw();class ZP extends uP{markerAnimate(t){ZP._animate&&this._animationConfig&&ZP._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},ZP.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=PP,this.defaultExitAnimation=LP,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return xM(Math.abs(s),Math.PI/2,IP)||xM(Math.abs(s),3*Math.PI/2,IP)?SM(t,s,n):bM(s)?UP.postiveXAxis[n]:UP.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,style:d,position:u=cP.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-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,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:j({},lM,null==p?void 0:p.textBackground),text:j({},lM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=j({},lM,null==p?void 0:p.itemContent));const v=bM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+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",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=pf.symbol(Object.assign(Object.assign({},i),r)),o.states=j({},lM,null==s?void 0:s.itemContent)):"text"===n?o=new UM(Object.assign(Object.assign({},i),{state:{panel:j({},lM,null==s?void 0:s.textBackground),text:j({},lM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=pf.richtext(Object.assign(Object.assign({},i),r)),o.states=j({},lM,null==s?void 0:s.itemContent)):"image"===n?(o=pf.image(Object.assign(Object.assign({},i),r)),o.states=j({},lM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=j({},lM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}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=xM(c,0,IP)||xM(d,0,IP),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=zM(e-u,t-d),o=zM(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*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(aL.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(aL.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===aL.focus||"focus"===o){const s=a.hasState(nL.focus);a.toggleState(nL.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[nL.unSelected,nL.unSelectedHover,nL.focus],t),this._setLegendItemState(e,nL.selected,t)})):(this._setLegendItemState(a,nL.selected,t),this._removeLegendItemState(a,[nL.unSelected,nL.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[nL.selected,nL.selectedHover,nL.focus],t),this._setLegendItemState(e,nL.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(nL.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(nL.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(rL.legendItemClick,a,t);i?(this._removeLegendItemState(a,[nL.selected,nL.selectedHover],t),this._setLegendItemState(a,nL.unSelected,t)):(this._setLegendItemState(a,nL.selected,t),this._removeLegendItemState(a,[nL.unSelected,nL.unSelectedHover],t))}else this._setLegendItemState(a,nL.selected,t),this._removeLegendItemState(a,[nL.unSelected,nL.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[nL.selected,nL.selectedHover],t),this._setLegendItemState(e,nL.unSelected,t))}))}this._dispatchLegendEvent(rL.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,nL.selected),this._removeLegendItemState(e,[nL.unSelected,nL.unSelectedHover])):(this._removeLegendItemState(e,[nL.selected,nL.selectedHover]),this._setLegendItemState(e,nL.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=eL,spaceRow:l=iL,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:u?i:e,v=this._contentMaxHeight;let _,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,M=0,T=0;const w=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),_=d[t],_.id||(_.id=_.label),_.index=t;let e=!0;y(n)&&(e=n.includes(_.label));const i=this._renderEachItem(_,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||w.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=T+l,T=0,w.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),w.push(i)):(p(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=M+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=pf.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:u}=t,g=[];p(c)&&g.push(c),p(d)&&g.push(d),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=K(g)),p(u)&&(this._itemHeightByUser=u);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,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:f,autoEllipsisStrategy:m}=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=ai(c);let w;!1===x.visible?(w=pf.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,aL.item,t,w)):(w=pf.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,aL.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?nL.selected:nL.unSelected);const C=pf.group({x:0,y:0,pickable:!1});w.add(C);let E,B=0,P=0,R=0;if(v&&!1!==v.visible){const i=L(S,"style.size",10);P=y(i)?i[0]||0:i,R=L(v,"space",8);const s=pf.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,aL.itemShape,t,w,S.state),s.addState(e?nL.selected:nL.unSelected),C.add(s)}let O=0;if(d){const e=L(g,"size",10);E=pf.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,aL.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=DM(Object.assign(Object.assign({x:P/2+R,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,aL.itemLabel,t,w,A.state),D.addState(e?nL.selected:nL.unSelected),C.add(D);const F=L(_,"space",8);if(p(l)){const s=L(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=DM(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,aL.itemValue,t,w,k.state),r.addState(e?nL.selected:nL.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-P-R-F-O-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-P/2-T[1]-T[3]-O-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));B=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-P-R-O),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",B),C.add(E));const z=C.AABBBounds,j=z.width();if("right"===f){const t=z.x2,e=z.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=z.height(),V=p(this.attribute.item.width)?this.attribute.item.width:j+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(-z.x1+T[3],-z.y1+T[0]),w}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new tL(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},j({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new tL(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new pM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new pM(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?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 i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",At(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=eL,spaceRow:o=iL}=n,l=this._itemsContainer,{space:h=sL,defaultCurrent:c=1}=r,d=cL(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,_=0,y=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v0&&(y=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:y,y:b}),y+=a+i})),this._itemContext.startX=y,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),_=p-g.AABBBounds.height()-h-t,_<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;_0&&(b=0,y+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:y,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=pf.group({x:0,y:t,width:u?v:f,height:u?m:_,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=eL,spaceRow:a=iL}=s,o=this._itemsContainer,{space:l=sL,defaultCurrent:h=1}=n,c=cL(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const _=pf.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=pf.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];gt(_t(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),gt(_t(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(nL.selected)?this._setLegendItemState(t,nL.selectedHover,e):this._setLegendItemState(t,nL.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===aL.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(rL.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(nL.unSelectedHover)||t.hasState(nL.selectedHover))&&(i=!0),t.removeState(nL.unSelectedHover),t.removeState(nL.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(nL.unSelectedHover)&&!t.hasState(nL.selectedHover)||(i=!0),t.removeState(nL.unSelectedHover),t.removeState(nL.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===aL.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(rL.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(rL.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!==aL.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(rL.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!==aL.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(rL.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(nL.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=j({},dL,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(nL.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}release(){super.release(),this.removeAllEventListeners()}};var pL;function gL(t){return y(t)?t:[t,t]}function fL(t){return t?"ew-resize":"ns-resize"}uL.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:eL,spaceRow:iL,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:sL,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"}(pL||(pL={})),lL();class mL extends tb{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},mL.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=_t(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=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=dM(),n="browser"===k_.env?k_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;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=_t(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=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=dM(),n="browser"===k_.env?k_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{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?_t(t+p,h,c):_t(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?_t(t+p,0,c-h):_t(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=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),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:gL(d)[0],endValue:gL(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=pf.group({x:0,y:0});f.name=pL.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=pf.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)),m.name=pL.startText,f.add(m);const e=p(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const _=pf.group({x:g?v:0,y:g?0:v});f.add(_);const y=pf.group({x:0,y:0});let b;if(y.name=pL.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=pf.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=pL.endText,f.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=pf.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=pL.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,f]=gL(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":fL(p)},r));if(v.name=pL.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=pL.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":fL(p)},r));if(i.name=pL.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f,"end");e.name=pL.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=yt(h,i,s);c=t[0],d=t[1]}else c=i,d=_t(h,i,s);const p=this._isHorizontal;e||(c=i);const f=pf.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=pL.trackContainer;const m=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":fL(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=pf.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=pL.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return pf.symbol(t)}_renderHandlerText(t,e){return pf.text(this._getHandlerTextAttributes(t,e))}_getHandlerPosition(t){return this.attribute.range&&t?"start":"end"}_getHandlerTextStyle(t,e){const{align:i,handlerSize:s=14,handlerText:n={},railHeight:r,railWidth:a,slidable:o}=this.attribute;return d(n.style)?n.style(t,e,{layout:this.attribute.layout,align:i,railWidth:a,railHeight:r,handlerSize:s,slidable:o}):n.style}_getHandlerTextAttributes(t,e){var i,s;const{align:n,handlerSize:r=14,handlerText:a={},railHeight:o,railWidth:l,slidable:h}=this.attribute,c=this._isHorizontal,d=this.calculatePosByValue(t,e),u=null!==(i=a.space)&&void 0!==i?i:4,p=this._getHandlerTextStyle(t,e),g={text:a.formatter?a.formatter(t):t.toFixed(null!==(s=a.precision)&&void 0!==s?s:0),lineHeight:null==p?void 0:p.lineHeight,cursor:!1===h?"default":fL(c)};return c?"top"===n?(g.textBaseline="bottom",g.textAlign="center",g.x=d,g.y=(o-r)/2-u):(g.textBaseline="top",g.textAlign="center",g.x=d,g.y=(o+r)/2+u):"left"===n?(g.textBaseline="middle",g.textAlign="end",g.x=(l-r)/2-u,g.y=d):(g.textBaseline="middle",g.textAlign="start",g.x=(l+r)/2+u,g.y=d),Object.assign(Object.assign({},g),p)}_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=pf.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=pf.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),("browser"===k_.env?k_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=dM(),e="browser"===k_.env?k_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_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){const s=this._isHorizontal;t.setAttribute(s?"x":"y",e);const n=t.name===pL.startHandler?this._startHandlerText:this._endHandlerText;if(n){const e=this._getHandlerPosition(t.name===pL.startHandler);n.setAttributes(this._getHandlerTextAttributes(i,e))}t.name===pL.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){const s=this._isHorizontal,n=this._getHandlerPosition(t.name===pL.startHandlerText);t.setAttributes(this._getHandlerTextAttributes(i,n));const r=t.name===pL.startHandlerText?this._startHandler:this._endHandler;r&&r.setAttributes({[s?"x":"y"]:e}),t.name===pL.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}}release(t){super.release(t),("browser"===k_.env?k_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}mL.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}}},hL(),lL();class vL extends oL{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},vL.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:f,handlerText:m,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:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function _L(t="bottom"){let 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`}vL.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"}}},hL(),lL(),Wk();class yL extends oL{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},yL.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:f,showTooltip:m,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=pf.group({x:0,y:0});this._innerView.add(x);const S=new mL({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:_L(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,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=pf.path(Object.assign(Object.assign({x:0,y:k,path:A},_),{zIndex:0}));x.add(M);const T=this._title?this._title.AABBBounds.height()+L(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))}}yL.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)"}},zk(),iM(),qk();let bL=class t extends tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,b,x;const{textType:S,text:A,subtextType:k,textStyle:M={},subtext:T,subtextStyle:w={},width:C,height:E,minWidth:B,maxWidth:P,minHeight:L,maxHeight:R,align:O,verticalAlign:I,padding:D=0}=this.attribute,F=ai(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),j=null!==(t=M.height)&&void 0!==t?t:E;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:u="break-word",maxWidth:g,lineClamp:f}=M;if("rich"===S||p(M.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:C)&&void 0!==e?e:0,height:null!=j?j:0,ellipsis:null==d||d,wordBreak:null!=u?u:"break-word",maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:null!==(i=M.character)&&void 0!==i?i:A},M);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},hM),M),x:h,y:c,width:null!==(s=null!=t?t:C)&&void 0!==s?s:0,height:null!=j?j:0,ellipsis:d,wordBreak:u,maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:[]},M);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else p(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(A)?A:[A],whiteSpace:"normal"},M),{maxLineWidth:null!==(r=null!==(n=M.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:C,heightLimit:null!==(a=M.height)&&void 0!==a?a:R,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const H=this._mainTitle?this._mainTitle.AABBBounds.height():0,V=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==w.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=w,v=Math.max(Number.MIN_VALUE,R-H);if("rich"===k||p(w.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:C)&&void 0!==o?o:0,height:null!==(l=null!=e?e:E)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=w.character)&&void 0!==h?h:T},w);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:T},hM),w),x:n,y:r,width:null!==(c=null!=t?t:C)&&void 0!==c?c:0,height:null!==(d=null!=e?e:E)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},w);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else p(T)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(T)?T:[T],whiteSpace:"normal"},w),{maxLineWidth:null!==(u=w.maxLineWidth)&&void 0!==u?u:C,heightLimit:null!==(g=w.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:H}),"text"))}const N=this._subTitle?this._subTitle.AABBBounds.height():0,U=this._subTitle?this._subTitle.AABBBounds.width():0;let W=Math.max(V,U),G=H+(null!==(f=w.height)&&void 0!==f?f:N);if(p(C)&&(W=C),p(E)&&(G=E),p(B)&&WP&&(W=P),p(L)&&GR&&(G=R),z.attribute.width=W,z.attribute.height=G,z.attribute.boundsPadding=F,this._mainTitle){if(p(O)||p(M.align)){const t=M.align?M.align:O,e=null!==(m=M.width)&&void 0!==m?m:W;"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")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:I,e=null!=j?j:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"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")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(p(O)||p(w.align)){const t=w.align?w.align:O,e=null!==(_=null!==(v=w.width)&&void 0!==v?v:M.width)&&void 0!==_?_:W;"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")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=w.verticalAlign?w.verticalAlign:I,e=this._mainTitle?p(j)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),j):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=w.height)&&void 0!==b?b:E)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"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")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};bL.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 xL={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"}}};zk(),iM(),qk();let SL=class extends tb{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=j({},L(xL,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=DM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{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,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(p(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),p(s)){const t=Y(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e: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=RM(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,f=c/2,m=g**2+1,v=2*f*g,_=f**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*m*_))/(2*m))+f),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 AL extends Cg{constructor(t){super(t)}}var kL,ML;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(kL||(kL={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(ML||(ML={}));class TL extends tb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},TL.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"},TL.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"},TL.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},TL.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},TL.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 AL(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new AL(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new AL(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(kL.OnPlay)},this.pause=()=>{this._dispatchEvent(kL.OnPause)},this.forward=()=>{this._dispatchEvent(kL.OnForward)},this.backward=()=>{this._dispatchEvent(kL.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()}}TL.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},TL.defaultAttributes={[ML.Start]:{},[ML.Pause]:{},[ML.Backward]:{},[ML.Forward]:{}};const wL={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},CL=[200,10];var EL,BL;!function(t){t.Default="default",t.Reverse="reverse"}(EL||(EL={})),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"}(BL||(BL={}));const PL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===EL.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===EL.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),LL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===EL.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===EL.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),RL=t=>"top"===t||"bottom"===t;class OL extends tb{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},OL.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=Yt(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(RL(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:CL[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:CL[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 mL(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 t.layout=RL(this._orient)?"horizontal":"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 TL(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=RL(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:CL[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Yt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(RL(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:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:RL(this._orient)?t+s:(this._size.width-r)/2,y:RL(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:RL(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:RL(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:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:RL(this._orient)?t+s:(this._size.width-r)/2,y:RL(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]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function IL(){lL(),zk(),tM()}OL.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({},wL),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},wL),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},wL),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},wL),{key:"backward",position:"start"})}},IL();class DL extends OL{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},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:EL.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(kL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(kL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(kL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(kL.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(BL.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(PL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||LL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===EL.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(BL.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=k_.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(BL.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(BL.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=k_.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(),k_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(BL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,k_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(BL.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(BL.change),this.dispatchCustomEvent(BL.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var FL,zL=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())}))};IL();class jL extends OL{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(kL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(kL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(kL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(kL.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(BL.change))},this.play=()=>zL(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(BL.play),this._rafId=k_.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=k_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,k_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(BL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,k_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(BL.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(BL.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(BL.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.brushActive="brushActive",t.brushClear="brushClear"}(FL||(FL={}));const HL={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],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:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},VL=5;const NL={debounce:St,throttle:At};zk(),Yk();let UL=class t extends tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=HL.updateTrigger,endTrigger:i=HL.endTrigger,brushMoved:s=!0}=this.attribute;Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushingWithDelay))),Y(i).forEach((t=>this.stage.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos]},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:NL[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(FL.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const{trigger:t=HL.trigger,resetTrigger:e=HL.resetTrigger}=this.attribute;Y(t).forEach((t=>this.stage.addEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(FL.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;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,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(FL.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=VL}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(FL.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(FL.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;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._dispatchBrushEvent(FL.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=VL}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(FL.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(FL.brushClear,t)):Math.abs(r-s)this.stage.removeEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents()}_releaseBrushUpdateEvents(){const{updateTrigger:t=HL.updateTrigger,endTrigger:e=HL.endTrigger}=this.attribute;Y(t).forEach((t=>this.stage.removeEventListener(t,this._onBrushingWithDelay))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushEnd)))}_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=pf.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}_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(Le(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_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.ythis._brushMaskAABBBoundsDict[t].empty()))}};UL.defaultAttributes=HL;const WL=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return j(t,...e,{shape:i.every(u)?void 0:j({},...i),key:s.every(u)?void 0:j({},...s),value:n.every(u)?void 0:j({},...n)})},GL=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}},YL={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:aM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:aM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:aM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ne).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},$L=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];zk(),Xk(),tM(),iM(),qk();let XL=class t extends tb{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: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=ai(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",j({symbolType:"circle"},u.shape,{visible:yM(u)&&yM(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:yM(u)&&yM(u.value)},GL(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:yM(u)&&yM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:yM(u)&&yM(u.value)},GL(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},hM),u.value),visible:yM(u)&&yM(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=yM(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:f,textBaseline:m}=u.value,v=n.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 _=yM(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(!yM(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)+(yM(n.key)?r+n.key.spacing:0)+(yM(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&&(FM(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";p(n.value.textAlign)?t=n.value.textAlign:yM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),FM(c,f,t,u,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(yM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=ad(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(yM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},GL(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},GL(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},hM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(yM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},GL(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},GL(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=>$L.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)&&yM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=yM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=LM(d),_=LM(u);let y=0;if(yM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),y=Math.max(y,e)}if(yM(u)){const{width:t,height:e}=_.quickMeasure(u.text);h.push(t),y=Math.max(y,e)}f&&cu[m]&&(t=!0,r.push(p.size),y=Math.max(p.size,y)),e.height=y,o+=y,a{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 WL({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return WL({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};XL.defaultAttributes=YL;const KL=gt;function qL(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:K(i)}function ZL(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function JL(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function QL(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 tR(t,e){const i=QL(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 eR(t,e){const i=iR(t),s=iR(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 iR(t,e={x:0,y:0}){return ae.distancePP(t,e)}function sR(t){return k(t.x)&&k(t.y)}function nR(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 rR(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const aR=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function lR(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&lR(t[i],e)}}var hR,cR,dR;function uR(t){var e,i;const{type:s}=t;return s===cR.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!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.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_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"}(hR||(hR={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",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",t.mosaic="mosaic",t.pictogram="pictogram"}(cR||(cR={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",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.transform="transform",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.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.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(dR||(dR={}));const pR={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},gR={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function fR(t,e){var i;if(!t)return[];const s=SR(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?bR(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>yR(i)?vR(t,i,e):i)).filter(p)}))):i.map((i=>yR(i)?vR(t,i,e):i)).filter(p):[]}return[]}function mR(t,e){var i,s;return bR(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 vR(t,e,i){var s;const n=SR(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=pR[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=gR[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 ii(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=$e(t,i,s),a=Ye(n,r,e.l),l=new ii(`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 _R=(t,e)=>{if(e&&yR(t)){const i=vR(e,t);if(i)return i}return t};function yR(t){return t&&"palette"===t.type&&!!t.key}function bR(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function xR(t){return y(t)?{dataScheme:t}:t}function SR(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=uR(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 AR extends oE{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(!bR(this._range))return void super.range(this._range);const t=mR(this._range,this._domain);super.range(t)}}const kR={linear:PE,band:cE,point:class extends cE{constructor(t){super(!1),this.type=jC.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:oE,threshold:FE,colorOrdinal:AR};function MR(t){const e=kR[t];return e?new e:null}function TR(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function wR(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function CR(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function ER(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function BR(t){return!!_(t)&&(!!t.endsWith("%")&&Zy(t.substring(0,t.length-1)))}function PR(t){return!!g(t)&&("percent"in t||"offset"in t)}function LR(t,e,i,s=0){var n,r;return S(t)?t:BR(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 RR(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]=LR(t[s],e.size,i)}))})),o}function OR(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}}function IR(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)||BR(t)||d(t)||PR(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function DR(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const FR=(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},zR=[{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"]}];function jR(t,e){return t&&e.key in t?t[e.key]:e.default}function HR(t){return t&&"token"===t.type&&!!t.key}const VR={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%"},NR={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:zR,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)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:VR,component:{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}}},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:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},UR={name:"dark",colorScheme:{default:{dataScheme:zR,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",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},WR=(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]={}),WR(t[s],e.slice(1),i))};function GR(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=xR(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}YR._charts={},YR._series={},YR._components={},YR._graphicComponents={},YR._marks={},YR._regions={},YR._animations={},YR._implements={},YR._chartPlugin={},YR._vChartPlugin={},YR._componentPlugin={},YR.transforms={fields:$r,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}},YR.dataParser={csv:(t,e={},i)=>(i.type=Yr.DSV,na(t)),dsv:(t,e={},i)=>{i.type=Yr.DSV;const s=Vr(aa,e),{delimiter:n}=s;if(!_(n))throw new TypeError("Invalid delimiter: must be a string!");return sa(n).parse(t)},tsv:(t,e={},i)=>(i.type=Yr.DSV,ra(t))},YR._layout={},YR._grammarTransforms={},YR._stageEventPlugins={},YR.registerStageEventPlugin=(t,e)=>{YR._stageEventPlugins[t]=e},YR.getStageEventPlugin=t=>YR._stageEventPlugins[t],YR._interactionTriggers={},YR.registerInteractionTrigger=(t,e)=>{YR._interactionTriggers[t]=e},YR._composedEventMap={},YR.registerComposedEvent=(t,e)=>{YR._composedEventMap[t]=e},YR._tooltipProcessors={},YR.registerTooltipProcessor=(t,e)=>{YR._tooltipProcessors[t]=e},YR.createTooltipProcessor=(t,e)=>{const i=YR._tooltipProcessors[t];return i?new i(e):null};const KR=t=>{const e={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"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},qR=KR(),ZR={[NR.name]:NR},JR=NR.name,QR=new Map(Object.keys(ZR).map((t=>[t,ZR[t]]))),tO=new Map,eO=new Map(Object.keys(ZR).map((t=>[t,t===JR]))),iO=(t,e)=>{if(!t)return;const i=aO(e);QR.set(t,i),eO.set(t,!0)},sO=(t=JR)=>(eO.has(t)&&!eO.get(t)&&iO(t,QR.get(t)),QR.get(t)),nO=t=>QR.delete(t)&&tO.delete(t)&&eO.delete(t),rO=t=>!!_(t)&&QR.has(t),aO=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:JR;return $R({},sO(i),t)};class oO{static registerInstance(t){oO.instances.set(t.id,t)}static unregisterInstance(t){oO.instances.delete(t.id)}static getInstance(t){return oO.instances.get(t)}static instanceExist(t){return oO.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return oO.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}oO.instances=new Map;class lO{static registerTheme(t,e){iO(t,e)}static getTheme(t,e=!1){return sO(t)}static removeTheme(t){return nO(t)}static themeExist(t){return rO(t)}static getDefaultTheme(){return lO.themes.get(JR)}static setCurrentTheme(t){lO.themeExist(t)&&(lO._currentThemeName=t,oO.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return lO.getTheme(lO._currentThemeName,t)}static getCurrentThemeName(){return lO._currentThemeName}}function hO(t){return _(t)?lO.themeExist(t)?lO.getTheme(t):{}:g(t)?t:{}}lO.themes=QR,lO._currentThemeName=JR;const cO=["animationThreshold","colorScheme","name","padding"];function dO(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];cO.includes(n)?s[n]=r:m(r)?yR(r)?s[n]=_R(r,e):HR(r)?s[n]=jR(i,r):s[n]=dO(r,e,i):s[n]=r})),s}function uO(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]=uO(t[s],e)}return i}return y(t)?t.map((t=>uO(t,e))):t}function pO(t,e){if(!t)return t;if(m(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]=pO(t[s],e)}return i}return y(t)?t.map((t=>pO(t,e))):t}function gO(t,...e){return d(t)?t(...e):t}const fO=(t,e,i,s)=>((t,e,i)=>LM(t,e,i,{fontFamily:VR.fontFamily,fontSize:VR.fontSize}))(e,i,s).measure(t),mO="__VCHART",vO=500,_O=500,yO=`${mO}_MEASURE_CANVAS_ID`,bO=`${mO}_DEFAULT_DATA_INDEX`,xO=`${mO}_DEFAULT_DATA_KEY`,SO=`${mO}_DEFAULT_DATA_SERIES_FIELD`,AO=`${mO}_DEFAULT_SERIES_STYLE_NAME`,kO=`${mO}_STACK_KEY`,MO=`${mO}_STACK_START`,TO=`${mO}_STACK_END`,wO=`${mO}_STACK_START_PERCENT`,CO=`${mO}_STACK_END_PERCENT`,EO=`${mO}_STACK_START_OffsetSilhouette`,BO=`${mO}_STACK_END_OffsetSilhouette`,PO=`${mO}_STACK_TOTAL`,LO=`${mO}_STACK_TOTAL_PERCENT`,RO=`${mO}_STACK_TOTAL_TOP`,OO=`${mO}_STACK_TOTAL_BOTTOM`,IO=`${mO}_MOSAIC_VALUE_START_PERCENT`,DO=`${mO}_MOSAIC_VALUE_END_PERCENT`,FO=`${mO}_MOSAIC_CAT_START_PERCENT`,zO=`${mO}_MOSAIC_CAT_END_PERCENT`,jO=`${mO}_SEGMENT_START`,HO=`${mO}_SEGMENT_END`,VO=`${mO}_KEY`,NO=`${mO}_MAP_LOOK_UP_KEY`;function UO(t,e){for(let i=0;it.key===e))}function GO(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 YO(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:{groupField:a.groupField,nodes:{}},ZO(t,a,n[o],l,e,r))})),s?$O(n):n}function $O(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))):$O(t[e].nodes);return t}function XO(t,e){if("values"in t&&t.values.length){const i=JL(t.values,e),s=ZL(t.values,CO);t.values.forEach((t=>{t[PO]=i,t[LO]=s}))}else for(const i in t.nodes)XO(t.nodes[i],e)}function KO(t){if(!t.values.length)return;const e=t.values[t.values.length-1][TO]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)qO(t.nodes[r],e,i,s,n)}function ZO(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[TO]=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 l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),ZO(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const JO=(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]=tI(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function eI(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>nI(t.style(e,i,s,n)):P(t.style)||(e.style=nI(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>nI(t.state[e](i,s,n,r)):P(t.state[e])||(i[e]=nI(t.state[e]))})),e.state=i}return e}function iI(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>nI(t[i](e,s,n,r)):P(t[i])||(e[i]=nI(t[i]))})),e}function sI(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),nI(i)}function nI(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:oe(t.angle)}):t}const rI=t=>"line"===t||"area"===t,aI=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return rI(i)?e:null==e?void 0:e[0]},oI=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let lI=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},n=YR.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{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(YR.getComposedEvent(t))if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};var hI;!function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(hI||(hI={}));const cI=["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 dI,uI,pI;t.ChartEvent=void 0,(dI=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",dI.rendered="rendered",dI.renderFinished="renderFinished",dI.animationFinished="animationFinished",dI.regionSeriesDataFilterOver="regionSeriesDataFilterOver",dI.afterInitData="afterInitData",dI.afterInitEvent="afterInitEvent",dI.afterInitMark="afterInitMark",dI.rawDataUpdate="rawDataUpdate",dI.viewDataFilterOver="viewDataFilterOver",dI.viewDataUpdate="viewDataUpdate",dI.viewDataStatisticsUpdate="viewDataStatisticsUpdate",dI.markDeltaYUpdate="markDeltaYUpdate",dI.viewDataLabelUpdate="viewDataLabelUpdate",dI.scaleDomainUpdate="scaleDomainUpdate",dI.scaleRawDomainUpdate="scaleRawDomainUpdate",dI.scaleUpdate="scaleUpdate",dI.dataZoomChange="dataZoomChange",dI.drill="drill",dI.layoutStart="layoutStart",dI.layoutEnd="layoutEnd",dI.layoutRectUpdate="layoutRectUpdate",dI.playerPlay="playerPlay",dI.playerPause="playerPause",dI.playerEnd="playerEnd",dI.playerChange="playerChange",dI.playerForward="playerForward",dI.playerBackward="playerBackward",dI.scrollBarChange="scrollBarChange",dI.brushStart="brushStart",dI.brushChange="brushChange",dI.brushEnd="brushEnd",dI.brushClear="brushClear",dI.brushActive="brushActive",dI.legendSelectedDataChange="legendSelectedDataChange",dI.legendFilter="legendFilter",dI.legendItemClick="legendItemClick",dI.legendItemHover="legendItemHover",dI.legendItemUnHover="legendItemUnHover",dI.tooltipShow="tooltipShow",dI.tooltipHide="tooltipHide",dI.tooltipRelease="tooltipRelease",dI.afterResize="afterResize",dI.afterRender="afterRender",dI.afterLayout="afterLayout",dI.afterMarkLayoutEnd="afterMarkLayoutEnd",dI.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(uI||(uI={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(pI||(pI={}));const gI=[pI.mark,pI.model,pI.chart,pI.vchart];class fI{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(pI.vchart,[]),this._levelNodes.set(pI.chart,[]),this._levelNodes.set(pI.model,[]),this._levelNodes.set(pI.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const mI={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"};class vI{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=L(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>aI(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||uI.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||uI.chart);o.get(t)||o.set(t,new fI);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||uI.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||uI.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||uI.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||uI.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?gI.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[uI.chart,uI.window,uI.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.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&&L(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 mI[a]&&(a=mI[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)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?pI.model:pI.vchart:pI.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=At(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=St(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=uI.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==pI.model&&s!==pI.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=pI.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case uI.chart:return this._viewBubbles;case uI.window:return this._windowBubbles;case uI.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case uI.chart:return this._viewListeners;case uI.window:return this._windowListeners;case uI.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return cI.includes(t)||Object.values(hI).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&YR.hasInteractionTrigger(e)}}function _I(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function yI(t,e,i){t.getParser(e)||t.registerParser(e,i)}const bI=new Map;let xI;function SI(){xI||(xI=new Ba,yI(xI,"geojson",ka),yI(xI,"topojson",Ta),_I(xI,"simplify",Gr))}function AI(t,e,i={type:"geojson",centroid:!0}){bI.has(t)&&Vy(`map type of '${t}' already exists, will be overwritten.`),SI();const s=new Pa(xI),n=j({},{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}),bI.set(t,s)}function kI(t){bI.has(t)?bI.delete(t):Vy(`map type of '${t}' does not exists.`)}function MI(t,e=!1){let i=e;return t.latestData instanceof Pa&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const TI=(t,e)=>0===t.length?[]:1===t.length?MI(t[0],null==e?void 0:e.deep):t.map((t=>MI(t,null==e?void 0:e.deep)));function wI(e,i,s){_I(i=i instanceof Ba?i:e.dataSet,"copyDataView",TI);const n=new Pa(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function CI(t,e,i=[]){var s;if(t instanceof Pa)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new Pa(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return Vy(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return Vy(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!_(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),Vy("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function EI(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var BI,PI,LI,RI;t.TransformLevel=void 0,(BI=t.TransformLevel||(t.TransformLevel={}))[BI.copyDataView=-10]="copyDataView",BI[BI.treemapFilter=-8]="treemapFilter",BI[BI.treemapFlatten=-7]="treemapFlatten",BI[BI.dotObjFlat=-7]="dotObjFlat",BI[BI.linkDotInfo=-7]="linkDotInfo",BI[BI.sankeyLayout=-7]="sankeyLayout",BI[BI.dataZoomFilter=-6]="dataZoomFilter",BI[BI.legendFilter=-5]="legendFilter",function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(PI||(PI={})),function(t){t.data="data",t.mark="mark"}(LI||(LI={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(RI||(RI={}));const OI=["line","area","trail"];function II(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(VO,i?t.slice().sort(i):t.slice()),{keys:[VO],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const DI=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function FI(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{FI(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function jI(t,e,i,s){const n=II(t,(t=>i(t))),r=II(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!u(t)){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}}const HI=`${mO}_BuiltIn_CallBack_Disappear`;var VI;!function(t){t.render="render",t.disappear="disappear"}(VI||(VI={}));class NI{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(e,i){this._count=0,this._rootMarks=[],this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{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._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var e,i,s,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:u,background:f}=this._option;k_.setEnv(function(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}(o),null!=l?l:{}),this._stage=null!==(e=this._option.stage)&&void 0!==e?e:new z_(Object.assign({background:f,width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,canvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:u},ReactDOM:this._option.ReactDOM,autoRefresh:p(r)?r:!p(a)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{})),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const m=Rp({x:0,y:0,width:this._width,height:this._height});m.name="root",this._stage.defaultLayer.appendChild(m),this._rootGroup=m;const v=(p(h)?h:$y(o))&&!1!==c&&YR.getStageEventPlugin("gesture");v&&(this._gestureController=new v(this._stage,g(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=RI.before}_setCanvasStyle(){if(this._stage&&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")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(k_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=k_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>FI(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>FI(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{FI(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;this._hasCommitedMark()&&(Hy(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),this._rootMarks.forEach((t=>{t.render()})),this._layoutState===RI.before&&(this._layoutState=RI.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=RI.reevaluate,this._hasCommitedMark()&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),this.findProgressiveMarks(),this.updateStateAnimation(),this._doRender(!0),this.doPreProgressive(),Hy(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=zI(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=jI(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=jI(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=II(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=II(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}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];y(s)?e[i]="disappear"===i?s.map((t=>{return"function"==typeof(e=t.callBack)&&/^class\s/.test(e.toString())?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:HI,customParameters:{callBack:t.callBack}});var e})):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{FI(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===PI.appear))?PI.appear:e.every((t=>t===PI.disappear))?PI.disappear:PI.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===uI.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=e;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=i.parent,i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:aI(o),markId:h,modelId:c,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===uI.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===uI.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===uI.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===uI.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===uI.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this.releaseGrammar(!0),this._stage!==(null===(t=this._option)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{FI(t,(t=>{t.removeProduct()}),null,!0)})):this._cachedMarks=zI(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return Yy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&function(t){return Su(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Ao.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()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{FI(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=k_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){k_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function UI(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:Ny)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function WI(t){t.crosshair=Y(t.crosshair||{}).map((e=>GR({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function GI(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}=oi(l,i.width,i.height);a=t,o=e}else if(h&&Yy(e.mode)){let t;t=_(h)?k_.getElementById(h):h;const{width:e,height:s}=oi(t,i.width,i.height);a=e,o=s}else if(Xy(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 YI(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function $I(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}}var XI,KI,qI,ZI,JI,QI;t.LayoutZIndex=void 0,(XI=t.LayoutZIndex||(t.LayoutZIndex={}))[XI.SeriesGroup=0]="SeriesGroup",XI[XI.Axis_Grid=50]="Axis_Grid",XI[XI.CrossHair_Grid=100]="CrossHair_Grid",XI[XI.Region=450]="Region",XI[XI.Mark=300]="Mark",XI[XI.Node=400]="Node",XI[XI.Axis=100]="Axis",XI[XI.MarkLine=500]="MarkLine",XI[XI.MarkArea=100]="MarkArea",XI[XI.MarkPoint=500]="MarkPoint",XI[XI.DataZoom=500]="DataZoom",XI[XI.ScrollBar=500]="ScrollBar",XI[XI.Player=500]="Player",XI[XI.Legend=500]="Legend",XI[XI.CrossHair=500]="CrossHair",XI[XI.Indicator=500]="Indicator",XI[XI.Title=500]="Title",XI[XI.Label=500]="Label",XI[XI.Brush=500]="Brush",XI[XI.CustomMark=500]="CustomMark",XI[XI.Interaction=700]="Interaction",t.LayoutLevel=void 0,(KI=t.LayoutLevel||(t.LayoutLevel={}))[KI.Indicator=10]="Indicator",KI[KI.Region=20]="Region",KI[KI.Axis=30]="Axis",KI[KI.DataZoom=40]="DataZoom",KI[KI.Player=40]="Player",KI[KI.ScrollBar=40]="ScrollBar",KI[KI.Legend=50]="Legend",KI[KI.Title=70]="Title",KI[KI.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(qI=t.AttributeLevel||(t.AttributeLevel={}))[qI.Default=0]="Default",qI[qI.Theme=1]="Theme",qI[qI.Chart=2]="Chart",qI[qI.Base_Series=3]="Base_Series",qI[qI.Series=4]="Series",qI[qI.Mark=5]="Mark",qI[qI.User_Chart=6]="User_Chart",qI[qI.User_Series=7]="User_Series",qI[qI.User_Mark=8]="User_Mark",qI[qI.User_SeriesStyle=9]="User_SeriesStyle",qI[qI.Built_In=99]="Built_In";class tD{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({},tD.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]))))}}tD.defaultMarkInfo={};class eD{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class iD{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=>GR({},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 sD extends eD{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}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=iD,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new tD,this._lastLayoutRect=null,this.id=qy(),this.userId=t.id,this._spec=t,this.effect={},this.event=new lI(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){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}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){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_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){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${mO}_${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,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=YR.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_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 L(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}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class nD{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}get lastComputeRect(){return this._lastComputeRect}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}get willLayoutTag(){return this._willLayoutTag}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._willLayoutTag=!0,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){let a=RR(IR(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),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:LR(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:LR(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:LR(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:LR(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:LR(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:LR(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=LR(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=LR(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){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_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]=LR(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(OR(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class rD extends sD{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,this._transformLayoutPadding=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 nD(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&U(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.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,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 aD extends iD{_initTheme(t,e){return{spec:t,theme:this._theme}}}class oD extends rD{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=aD,this.modelType="region",this.specKey="region",this.type=oD.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,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"}_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,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[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.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex: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()}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,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(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})}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=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function lD(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 hD(t,e,i){e?t.forEach((t=>{const e=$(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=$(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 cD(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 dD(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=fD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),cD(d,!0,p,l),s&&hD(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function uD(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=fD(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=fD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),cD(d,!1,p,o),s&&hD(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function gD(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=fD(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_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){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_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,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=fD(t,this,e);"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,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=lD(t);n.length&&dD(n,e,i,!1,"left",s),r.length&&dD(r,e,i,!0,"left",s),a.length&&uD(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=lD(t);n.length&&pD(n,e,i,!1,"top",s),r.length&&pD(r,e,i,!0,"top",s),a.length&&gD(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=lD(t);n.length&&dD(n,e,i,!1,"right",s),r.length&&dD(r,e,i,!0,"right",s),a.length&&uD(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=lD(t);n.length&&pD(n,e,i,!1,"bottom",s),r.length&&pD(r,e,i,!0,"bottom",s),a.length&&gD(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=fD(t,this,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=>{U(i.getLayoutRect(),e.rect)||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{rect:i}=fD(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);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+c-l})}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+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&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:Ny)("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}}}mD.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(ZI||(ZI={})),t.STATE_VALUE_ENUM=void 0,(JI=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",JI.STATE_HOVER="hover",JI.STATE_HOVER_REVERSE="hover_reverse",JI.STATE_DIMENSION_HOVER="dimension_hover",JI.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",JI.STATE_SELECTED="selected",JI.STATE_SELECTED_REVERSE="selected_reverse",JI.STATE_SANKEY_EMPHASIS="selected",JI.STATE_SANKEY_EMPHASIS_REVERSE="blur",JI.STATE_HIGHLIGHT="highlight",JI.STATE_BLUR="blur",JI.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(QI||(QI={}));const vD=["linear","radial","conical"],_D={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const yD={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{yD[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class bD extends eD{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(j(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class xD extends bD{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:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||(t=this._mark.type,OI.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!yD[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(y(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(mO)));i=t.datums.some((t=>e&&y(null==t?void 0:t.items)?n.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])})):n.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(mO))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(VC(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class SD extends eD{constructor(){super(...arguments),this.id=qy(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=YR.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class AD extends SD{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}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._data=null,this._data=e}removeProduct(){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const kD=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,MD=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=kD(l.delay,n,a,o),d=kD(l.duration,n,a,o),u=kD(l.oneByOne,n,a,o),p=kD(l.splitPath,n,a,o),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)?Nw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Uw)(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);zw(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{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)?Nw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Uw)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Ow(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Dw(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:qo.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 Fw({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Ew,null!==(l=i.easing)&&void 0!==l?l:Bw))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:qo.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new jw({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Ew,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Bw))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):zw(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},TD=(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))))},wD=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}};class CD extends SD{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}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){u(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];y(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new AD(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}u(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=Rp("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){u(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(){this._product&&this._product.parent&&this._product.parent.removeChild(this._product),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Wl)),i&&(d(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==ZI.enter&&t.context.diffState!==ZI.update||(t.stateProxy=(e,i)=>{var s;return this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)},t.context.states&&t.useStates(t.context.states,e))},this.name=e,this.model=i.model,this.key=i.key,this.state=new xD(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_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,oe)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];u(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}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){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[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"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&GR(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(NC(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=MR(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),e.clamp&&t.clamp&&t.clamp(e.clamp))}(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=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):vD.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):NC(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=d(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_computeGradientAttr(t){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=t,c=e(t,["gradient","scale","field"]);let u=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(u=t),g||(g=e)}const f=mR(fR(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},_D[o]),c);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==u?void 0:u.scale(t[g]);return d(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=ii.SetOpacity(a,s)),{offset:d(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):d(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];d(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)vD.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=mR(fR(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return II(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return YR.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=d(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[xO],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=II(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===PI.appear))?PI.appear:t.every((t=>t===PI.disappear))?PI.disappear:t[0];return null!=e?e:PI.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{wD(t),s.push(...t.getGraphics())})),e.forEach((t=>{wD(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);MD([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=TD(e,n),r=TD(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===PI.exit?PI.exit:i===PI.update?PI.update:PI.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===ZI.exit&&(t.context.reusing=!0,t.animates&&t.animates.forEach((t=>t.stop())))}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===ZI.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,d,p,g;let f,m;return u(e)?(f=this._graphicMap.get(t),f&&(m=ZI.exit)):u(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=ZI.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=ZI.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(d=f.context)||void 0===d?void 0:d.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=PI.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=PI.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return DI(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=DI(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(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))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach(((t,e)=>{var i,n;let r=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i.update,t);null===(n=t.currentStates)||void 0===n||n.forEach((e=>{var i;const s=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i[e],t);r=Object.assign(Object.assign({},r),s)})),u(this._markConfig.interactive)||(r.pickable=this._markConfig.interactive);const a=this._transformGraphicAttributes(t,r,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=a}))}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r,a;const o=i.context.finalAttrs,l=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=oI(i,o);i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes({}),i.context.reusing=!1):l||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),!(null===(a=this.renderContext)||void 0===a?void 0:a.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i),e&&i.setFinalAttributes(o)}else{const a=i;i=this._createGraphic(o),e&&(null===(n=i.setFinalAttributes)||void 0===n||n.call(i,o)),i.context=a.context,i.context.diffAttrs=o,i.stateSort=this._stateSort;const l=this._graphics===t?s:s+this._graphics.length-t.length;if(l>=0&&(this._graphics[l]=i),null===(r=this.renderContext)||void 0===r?void 0:r.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,l),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(u(e)||(t.zIndex=e),u(i)||(t.clip=i),!u(s)){const e=y(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return u(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=YR.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=YR.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=Y(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===RI.before||(this._product||this._initProduct(),Hy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{"in"===this.state.checkOneState(i,i.context.data,e)?i.addState(t,!0,this.hasAnimationByState("state")):i.removeState(t,this.hasAnimationByState("state"))}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===ZI.exit&&!e.isExiting)if(e.context.animationState===ZI.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:ZI.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=Rp({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{t.clearStates()}))}}var ED;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(ED||(ED={}));class BD extends CD{constructor(){super(...arguments),this.type=BD.type,this._marks=[],this._diffState=ZI.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(Vy("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?(Vy("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))}getMarkInUserId(t){let e;return FI(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.diffState===ZI.update){const t=this.hasAnimation(),e=oI(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e)),t&&this._product.setFinalAttributes(i)}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=ZI.update}render(){this._isCommited&&(Hy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct()}}BD.type="group";const PD={measureText:fO};class LD{static instance(){return LD.instance_||(LD.instance_=new LD),LD.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 RD{constructor(){this.id=qy(),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))?Vy("不要重复添加相同的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 OD extends RD{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)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const ID={type:"fadeIn"};function DD(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 ID;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const FD={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"},state:{duration:300,easing:"linear"}},zD={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},jD={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},HD=()=>{YR.registerAnimation("scaleInOut",(()=>zD))},VD=()=>{YR.registerAnimation("fadeInOut",(()=>jD))},ND=(t,e)=>({appear:DD(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:$w,duration:FD.update.duration,easing:FD.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),UD=()=>{YR.registerAnimation("line",ND)},WD=()=>{pw.registerBuiltInAnimate("growPointsIn",hC),pw.registerBuiltInAnimate("growPointsOut",cC),pw.registerBuiltInAnimate("growPointsXIn",uC),pw.registerBuiltInAnimate("growPointsXOut",pC),pw.registerBuiltInAnimate("growPointsYIn",fC),pw.registerBuiltInAnimate("growPointsYOut",mC),pw.registerBuiltInAnimate("clipIn",qw),pw.registerBuiltInAnimate("clipOut",Zw)},GD=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class YD{constructor(t){this._markSet=new tD,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){y(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.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 $D={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class XD extends YD{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},$D,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}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}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll(e)}}XD.type="element-highlight",XD.defaultOptions=$D;const KD=()=>{YR.registerInteractionTrigger(XD.type,XD)},qD={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class ZD extends YD{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},qD,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}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,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),t.addState(i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll(e)}}ZD.type="element-select",ZD.defaultOptions=qD;const JD=()=>{YR.registerInteractionTrigger(ZD.type,ZD)};class QD extends RD{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class tF{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>YR.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>YR.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>YR.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return YR.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>YR.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){YR.registerTransform(t,e)}static registerFunction(t,e){t&&e&&LD.instance().registerFunction(t,e)}static unregisterFunction(t){t&&LD.instance().unregisterFunction(t)}static getFunction(t){return t?LD.instance().getFunction(t):null}static getFunctionList(){return LD.instance().getFunctionNameList()}static registerMap(t,e,i){const s=YR.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=YR.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,bI.get(e);var e}static registerSVG(t,e,i){const s=YR.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=YR.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){oO.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 ot.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d,u;this.id=qy(),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._renderState=VI.render,this._disableDimensionHoverEvent=!1,this._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))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;U(n.theme,this._spec.theme)?U(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=YI(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?YR.getSeriesBuiltInTheme(e):YR.getComponentBuiltInTheme(e);i=i?GR({},s,i[e]):s}s===t.length-1&&p(i)&&(i=dO({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},lR(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:y,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=Yy(v);if(S?ax(xo):"node"===v&&oA(xo),S&&f&&(this._container=_(f)?k_.getElementById(f):f),m&&(this._canvas=m),y&&(this._stage=y),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=lO.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[];!1!==b&&A.push("poptipForText"),"sankey"===i.type&&A.push("scrollbar");const k=new ot(null!==(a=this._option.logLevel)&&void 0!==a?a:at.Error);ot.setInstance(k),(null===(o=this._option)||void 0===o?void 0:o.onError)&&k.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._compiler=new NI({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:y,pluginList:A},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new vI(this,this._compiler),this._event=new lI(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),oO.registerInstance(this),null===(u=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===u||u.call(d,this)}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=GR({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=uO(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;tF.getFunctionList()&&tF.getFunctionList().length&&(t=pO(t,tF)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=YR.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=YR.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=YR.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._chartSpecTransformer),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)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=At(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.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 GI(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:vO,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:_O})}_initDataSet(t){this._dataSet=t instanceof Ba?t:new Ba,yI(this._dataSet,"dataview",wa),yI(this._dataSet,"array",s),_I(this._dataSet,"copyDataView",TI);for(const t in YR.transforms)_I(this._dataSet,t,YR.transforms[t]);for(const t in YR.dataParser)yI(this._dataSet,t,YR.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake?(null===(n=this._compiler)||void 0===n||n.releaseGrammar(),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.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.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),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),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(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"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?PI.none:PI.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}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._cachedProcessedTheme=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,oO.unregisterInstance(this)}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):y(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._reSetRenderState(),u(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof Pa?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=CI(t,this._dataSet,s);y(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?GR({},t[n][e.index],i):i):t[n]=s?GR({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?GR({},t[n][r],i):i)}else t.id===e&&(t[n]=s?GR({},t[n],i):i)}))}(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=GR({},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),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,this),!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)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=$R({},e,e.chart[t])),e};let l;if(P(n)&&P(r))l=hO(this._currentThemeName),this._currentTheme=o(a,l);else{const t=$R({},hO(g(r)&&r.type?r.type:g(n)&&n.type?n.type:this._currentThemeName),hO(n),hO(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),j(GM.poptip,WM,h),null===(s=this._compiler)||void 0===s||s.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=!!Yy(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return hO(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!lO.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),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}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield UI(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(!Yy(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;this._chart.resetLayoutItemTag(),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)?k_.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)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(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?DR(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||P(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 Vy("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?DR(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Vy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return LD.instance().getFunction(t)}registerFunction(t,e){t&&e&&LD.instance().registerFunction(t,e)}unregisterFunction(t){t&&LD.instance().unregisterFunction(t)}getFunctionList(){return LD.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=YR.getChartPlugins();t.length>0&&(this._chartPlugin=new OD(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=YR.getVChartPlugins();e.length>0&&(this._vChartPlugin=new QD(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_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,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=VI.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){this._renderState=VI.render,this.getStage().eventSystem.resumeTriggerEvent()}}tF.InstanceManager=oO,tF.ThemeManager=lO,tF.globalConfig={uniqueTooltip:!0},tF.Utils=PD,tF.vglobal=k_;YR.registerRegion("region",oD),YR.registerLayout("base",mD),Jk(),zk(),YR.registerMark(BD.type,BD),YR.registerStageEventPlugin("gesture",Eb),KD(),JD(),iO(UR.name,UR);const eF="monotone",iF="linear",sF="bevel";function nF(t,e){return e("component",t)}function rF(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=YR.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));const aF=(t,e,i,s)=>{if(u(t[e]))return;const n=y(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},oF=(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)))},lF=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},hF=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):m(t)&&p(t.field)?L(e,t.field):t,s){const{formatFunc:i,args:r}=rF(void 0,s,t,e);i&&r&&(n=i(...r))}return n},cF=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const dF=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(y(e.activeType)?e.activeType.includes(t):e.activeType===t)));function uF(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=u(i.key)&&u(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:d,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:_}=l,y=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=gF(hF(h,r,a,c),d,g),o.value=gF(hF(f,r,a,m),v,_),Object.keys(y).forEach((t=>{o[t]=hF(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};y(i)?i.forEach((t=>{o(t)})):o(i)}function pF(t,e,i,s,n,r,a){if(d(e)){uF(t,e(n,a),i,s,r,a)}else e&&uF(t,e,i,s,r,a)}const gF=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=mi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class fF{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},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.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{y(t)?t.forEach((t=>{pF(a,t,e,i,s,n,r)})):d(t)?pF(a,t,e,i,s,n,r):t&&uF(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=d(e)?e(s,n):e;if(r?u(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){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}(s),e={visible:hF(r.visible,t,n),value:gF(hF(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:hF(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=hF(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&dF(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const mF={min:t=>t.length?K(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?K(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}},vF=(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=UO([],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 _F(a,n,o)},_F=(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&&t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{Zy(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=>{Zy(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&&!0===o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=mF[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},yF=(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=>{Zy(t[e])||(t[e]=0)}))})),t},bF=`${mO}_HIERARCHY_DEPTH`,xF=`${mO}_HIERARCHY_ROOT`,SF=`${mO}_HIERARCHY_ROOT_INDEX`;function AF(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function kF(t,e,i){t&&(i.needDefaultSeriesField&&(t[SO]=i.defaultSeriesField),t[bO]=e,t[xO]=i.getKey(t,e,i))}function MF(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function TF(t,e,i,s=0,n,r){void 0===r&&(r=e),kF(t,e,i),t[bF]=s,t[xF]=n||t[i.categoryField],t[SF]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>TF(e,s,i,t[bF]+1,t[xF],r)))}const wF={label:{name:"label",type:"text"}},CF=`${mO}_rect_x`,EF=`${mO}_rect_x1`,BF=`${mO}_rect_y`,PF=`${mO}_rect_y1`,LF={data:!0},RF={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},OF=[...Object.keys(FD),"normal"];function IF(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 HF(n)&&delete n.type,n.oneByOne&&(n=FF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:zF,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=GR({},o[e],a);return HF(n)&&delete n.type,n.oneByOne&&(n=FF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:zF,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function DF(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=I(t,null,i),VF(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}),i),t}(h,i)}function FF(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.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function zF(t,e){var i;return null!==(i=null==t?void 0:t[bO])&&void 0!==i?i:e.context.graphicIndex}function jF(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 HF(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function VF(t,e,i=[]){if(y(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),VF(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),VF(t[s],e,i))}function NF(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class UF extends iD{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=uR(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=YR.getSeriesMarkMap(o)?function(t,e,i){const s=YR.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=GR({},i("mark",Y(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return GR({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;Y(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(d(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,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=GR({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>GR({},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 WF extends sD{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)}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:`${mO}_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(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=UF,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=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.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=NF(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),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)&&(_I(this._rawData.dataSet,"invalidTravel",yF),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;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=CI(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=wI(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=wI(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new AD(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=K(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=_F(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=j(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){_I(this._dataSet,"dimensionStatistics",vF);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new Pa(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&&UO(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){_I(this._dataSet,"dimensionStatistics",vF);const s=new Pa(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=UO(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&UO(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new Pa(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)&&(_I(this._rawData.dataSet,"addVChartProperty",lF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:AF.bind(this),call:kF}},!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,i;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.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(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:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=IF({},DF(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)}))),!u(t.dataId)||!u(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(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:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_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"}}:$y(s)||Xy(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=GR(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=GR(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=GD(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=GD(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=GD(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:SO;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:AO,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,AO,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.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()}initTooltip(){this._tooltipHelper=new fF(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||e.visible!==t[i].visible))?i.reMake=!0:!i.reCompile&&e.some(((e,i)=>!U(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!U(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},LF),RF),i),{extensionMark:!0,label:!0,totalLabel:!0});return this._compareExtensionMarksSpec(Y(t.extensionMark),Y(e.extensionMark),s),!s.reMake&&this._compareLabelSpec(Y(t.label),Y(e.label),s),!s.reMake&&this._compareLabelSpec(Y(t.totalLabel),Y(e.totalLabel),s),s.reMake?s:(!s.reCompile&&this._marks.getMarks().some((i=>{var s,n;return r[i.name]=!0,(null===(s=e[i.name])||void 0===s?void 0:s.visible)!==(null===(n=t[i.name])||void 0===n?void 0:n.visible)}))&&(s.reCompile=!0),!s.reCompile&&n.some((i=>RF[i]&&!U(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!U(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Pa||EI(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();NF(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),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:SO,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new AR).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return fR(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:SO}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:d={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:_=!1}=e,y=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:_,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(y)){const e=this.getSpec()||{};this._marks.addMark(y,{name:t.name}),v&&(this._seriesMark=y),u(f)?y.setData(this._data):!1!==f&&y.setDataView(f),y.setSkipBeforeLayouted(!1!==c),u(h)||y.setGroupKey(h);const l=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:null!==(s=i.morph)&&void 0!==s&&s,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(n=i.support3d)&&void 0!==n?n:e.support3d||!!e.zField,morphKey:(null===(r=e.morph)||void 0===r?void 0:r.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});y.setMarkConfig(l),this.initMarkStyleWithSpec(y,GR({},d,g||e[y.name]))}return y}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:xO}_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!==TO&&t!==CO&&t!==MO&&t!==wO||(t=this.getStackValueField()),null!==(e=GO(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>Zy(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:SO]}}function GF(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();VC(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 YF(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}}}WF.mark=wF,WF.transformerConstructor=UF;class $F extends WF{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);VC(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:`${mO}_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(TO),this.setFieldX2(MO)):(this.setFieldY(TO),this.setFieldY2(MO))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(CO),this.setFieldX2(wO)):(this.setFieldY(CO),this.setFieldY2(wO))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(BO),this.setFieldX2(EO)):(this.setFieldY(BO),this.setFieldY2(EO))}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)&&(GF("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)}}function XF(t){return"bottom"===t||"top"===t}function KF(t){return"left"===t||"right"===t}function qF(t){return"z"===t}function ZF(t,e){return ER(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function JF(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function QF(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?XF(t)?"linear":"band":XF(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const tz=(t,e,i)=>{var s;const n=null!==(s="band"===e?nF("axisBand",i):["linear","log","symlog"].includes(e)?nF("axisLinear",i):{})&&void 0!==s?s:{},r=XF(t)?nF("axisX",i):KF(t)?nF("axisY",i):nF("axisZ",i);return GR({},nF("axis",i),n,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:Ny)("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:Ny)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;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)))),r=n.filter((t=>UC(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return XF(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class iz 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(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:uI.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const sz=(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))},nz=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},rz=(t,e,i,s)=>{var n;const r=e.getScale(),a=UC(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=Y(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.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))})),o.push({series:h,datum:e,key:az(h,s)})}else if(p(i[1])){const e=[],s=[];l.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 r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{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("_")}`,oz=(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};class lz extends ez{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!sz(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:uI.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:uI.canvas}),callback:this.onMouseOut}),$y(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:uI.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),$y(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var hz;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(hz||(hz={}));const cz={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class dz{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",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.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(cz.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),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:sF,curveType:iF,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===eF?"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){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(cz.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:jF(this._spec,cz.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new Pa(this._option.dataSet,{name:`${mO}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),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(hz.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[cz.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(hz.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,GR({},this._spec[cz.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.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=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},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.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const uz=Object.assign(Object.assign({},wF),cz),pz=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(y(t))return t.length===e.length&&t.every(((t,i)=>pz(t,e[i])));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]))},gz=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class fz extends CD{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return gz}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(u(o)||s.includes(a))return;r&&n.includes(a)&&(NC(null==o?void 0:o.type)||(null==o?void 0:o.scale)||d(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((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?pz(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n,r;const a=e.context.data,o=[],l=[],h={},c=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,d=c&&0===c.currentIndex;if(a.forEach(((e,i)=>{var s;l[i]={},o[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?l[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!c?o[i][s]=t[s](e):0!==i||c&&!d||(h[s]=t[s](e))})),l[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),c){const t=null!==(r=null===(n=e.attribute)||void 0===n?void 0:n.segments)&&void 0!==r?r:[];return t.push({points:l}),d?Object.assign(Object.assign({},h),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(o,l);if(t)return Object.assign(Object.assign(Object.assign({},h),o[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},h),o[0]),{points:l,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:ZI.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[xO]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}class mz extends fz{constructor(){super(...arguments),this.type=mz.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)===cR.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}mz.type="line";const vz=()=>{YR.registerMark(mz.type,mz),Jk(),Nk(),EB(),kB(),WD(),YR.registerGraphicComponent("line",Lg)};class _z extends CD{constructor(){super(...arguments),this.type=_z.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="circle":a.symbolType=o,a}}_z.type="symbol";const yz=()=>{YR.registerMark(_z.type,_z),Jk(),tM(),kB(),YR.registerGraphicComponent("symbol",Eg)};class bz extends UF{_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)}}function xz(t){return t.length>=2&&k(t[0])&&k($(t))&&$(t)>=t[0]}function Sz(t,e){var i;const s=$(e)-e[0],n=$(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=$(e)>0?$(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!k(o.min),extendable_max:!k(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):$(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function Az(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 kz(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 Mz(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 Tz(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 wz=(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=>t.type.includes("ticks"))))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)-p[0];if(0===g)return t;const f=c.domain(),m=$(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=ne(t,e),a=Math.max(ie(i),ie(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return IC(v)};class Cz{constructor(t){this.id=qy(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class Ez extends Cz{constructor(){super(Ez.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!VC(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&&xz(c)&&xz(d)))return;const u=Sz(t,c),p=Sz(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!kz(u,p))return}else if(0===y&&0===b){if(!kz(p,u))return}else if(_||A)if(_&&!A){if(!Az(u,p))return}else if(A&&!_){if(!Az(p,u))return}else{if(f===b)return;if(f>b){if(!Mz(u,p))return}else if(!Mz(p,u))return}else{if(0===f&&0===y){if(!Tz(u,p))return}else if(0===b&&0===g&&!Tz(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===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){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){_I(e.getOption().dataSet,"tickAlign",wz);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}Ez.pluginType="component",Ez.type="AxisSyncPlugin";const Bz={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function Pz(t){let e=0;return L(t,"tick.visible")&&(e+=L(t,"tick.tickSize")),L(t,"label.visible")&&(e+=L(t,"label.space")),e}function Lz(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 Rz(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const Oz=t=>"band"===t||"ordinal"===t||"point"===t;function Iz(t,e){return{id:t,label:t,value:e,rawValue:t}}function Dz(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class Fz extends RD{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const zz=`${mO}_ARC_TRANSFORM_VALUE`,jz=`${mO}_ARC_RATIO`,Hz=`${mO}_ARC_START_ANGLE`,Vz=`${mO}_ARC_END_ANGLE`,Nz=`${mO}_ARC_K`,Uz=`${mO}_ARC_MIDDLE_ANGLE`,Wz=`${mO}_ARC_QUADRANT`,Gz=`${mO}_ARC_RADIAN`,Yz=-Math.PI/2,$z=3*Math.PI/2,Xz=.6,Kz=(t,e,i,s)=>{const n=t();if(S(n))return n;if(d(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return ge(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},qz=(t,e,i)=>{var s;const n=null!==(s="band"===e?nF("axisBand",i):"linear"===e?nF("axisLinear",i):{})&&void 0!==s?s:{},r=nF("angle"===t?"axisAngle":"axisRadius",i);return GR({},nF("axis",i),n,r)};function Zz(t,e,i,s){switch(t){case r.cartesianBandAxis:return tz(ZF(i,["z"]),"band",e);case r.cartesianLinearAxis:return tz(ZF(i,["z"]),"linear",e);case r.cartesianLogAxis:return tz(ZF(i,["z"]),"log",e);case r.cartesianSymlogAxis:return tz(ZF(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return tz(ZF(i),void 0,e);case r.polarBandAxis:return qz(i.orient,"band",e);case r.polarLinearAxis:return qz(i.orient,"linear",e);case r.polarAxis:return qz(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,trigger:c,triggerOff:d}=null!==(s=nF(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>XF(t.orient)));let g;g=p(u)?GR({},Oz(u.type)?a:o,l):l;const f=n.find((t=>KF(t.orient)));let m;return m=p(f)?GR({},UC(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(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,trigger:c,triggerOff:d}=null!==(s=nF(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>"angle"===t.orient));let g;g=p(u)?GR({},Oz(u.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?GR({},UC(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return Jz(i,nF(t,e));default:return nF(t,e)}}const Jz=(t,e)=>{var i;const s=GR({},e,e[JF(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class Qz extends iD{getTheme(t,e){return Zz(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({},IR(e)),{[s]:0}))}}class tj extends rD{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=Qz,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof jc||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:uI.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}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 Fz(this)}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)))}_getNeedClearVRenderComponents(){return[]}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=>!U(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&&(t.release(!0),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=>{e.compile({group:t,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}}getDatum(t){}}var ej,ij;tj.transformerConstructor=Qz,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(ej||(ej={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(ij||(ij={}));class sj extends CD{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}clearComponent(){this._component&&(this._component.parent&&this._component.parent.removeChild(this._component),this._component=null)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=YR.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(hI.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){super.release(),this.removeProduct()}}sj.type="component";const nj=()=>{YR.registerMark(sj.type,sj)},rj=t=>t;class aj extends tj{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}getVisible(){return this._visible}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i,s;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._specVisible=!0,this._hideWhenEmpty=!1,this._tick=void 0,this._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._specVisible=null===(i=t.visible)||void 0===i||i,this._hideWhenEmpty=null!==(s=t.hideWhenEmpty)&&void 0!==s&&s,this._visible=this._specVisible,this._coordinateType="none"}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._specVisible=null===(t=this._spec.visible)||void 0===t||t,this._hideWhenEmpty=null!==(e=this._spec.hideWhenEmpty)&&void 0!==e&&e,this._visible=this._specVisible,this._scale&&this._refreshVisibilityByData()}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,y,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._refreshVisibilityByData(),this._shouldComputeTickData()&&this._initData(),this._specVisible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?ej.circleAxis:ej.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?ij.circleAxisGrid:ij.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if(this._syncComponentVisibility(),(null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==L(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=IF(null===(h=YR.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(d=null!==(c=this._spec.animationAppear)&&void 0!==c?c:L(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==d?d:L(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(u=this._spec.animationDisappear)&&void 0!==u?u:L(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:L(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:L(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:L(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(_=null!==(v=this._spec.animationExit)&&void 0!==v?v:L(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==_?_:L(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(y=this._spec.animationUpdate)&&void 0!==y?y:L(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b:L(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._specVisible&&(this.getVisible()||this._spec.forceInitTick||this._hideWhenEmpty)}_initData(){const t=this._initTickDataSet(this._tickTransformOption()),e=new AD(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return this._regions&&nR(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=y(a)?VC(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!VC(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return nR(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=rR(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()})),nR(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(){}_hasCollectedSeriesData(){return this.collectData(0).length>0}_refreshVisibilityByData(){const t=this._specVisible&&(!this._hideWhenEmpty||this._hasCollectedSeriesData()),e=this._visible!==t;return this._visible=t,(this._axisMark||this._gridMark)&&this._syncComponentVisibility(),e&&this._forceLayout(),e}_syncComponentVisibility(){var t,e,i,s,n,r,a,o,l,h,c,d;null===(t=this._axisMark)||void 0===t||t.setVisible(this._visible),null===(e=this._gridMark)||void 0===e||e.setVisible(this._visible&&!1!==(null===(i=this._spec.grid)||void 0===i?void 0:i.visible)),null===(a=null===(r=null===(n=null===(s=this._axisMark)||void 0===s?void 0:s.getComponent)||void 0===n?void 0:n.call(s))||void 0===r?void 0:r.setAttributes)||void 0===a||a.call(r,{visibleAll:this._visible}),null===(c=null===(h=null===(l=null===(o=this._gridMark)||void 0===o?void 0:o.getComponent)||void 0===l?void 0:l.call(o))||void 0===h?void 0:h.setAttributes)||void 0===c||c.call(h,{visibleAll:this._visible&&!1!==(null===(d=this._spec.grid)||void 0===d?void 0:d.visible)})}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&U(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):nR(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(nR(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_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=eI(s=t.domainLine)).startSymbol=eI(s.startSymbol),s.endSymbol=eI(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 nI(GR({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:nI(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>nI(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=nI(t[i]))})),e}(t.label.state)),d(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}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:d(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},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 nI(GR({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:nI(t.tick.style)),t.tick.state&&(i.tick.state=iI(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 nI(GR({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:nI(t.subTick.style)),t.subTick.state&&(i.subTick.state=iI(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=Bz[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?oe(p):null,textStyle:GR({},d,nI(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:nI(h.style)}),h.state&&(i.title.state.shape=iI(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:nI(o.style)}),o.state&&(i.title.state.background=iI(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=iI(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=nI(t.background.style)),t.background.state&&(i.panel.state=iI(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:gO(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 nI(GR({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:nI(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:gO(t.subGrid.alternateColor),style:nI(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=rF(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){yI(this._option.dataSet,"scale",rj);const i=this.registerTicksTransform();return new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,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)}getDatum(t){var e;return t&&t.name===vT.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}aj.specKey="axes";const oj=()=>{nj(),YR.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},lj=[Ez];class hj extends aj{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}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),nR(this._regions,(t=>{const e=this.getOrient();XF(e)?Dz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):KF(e)?Dz(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):qF(e)&&Dz(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&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._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{if(!this._visible)return void this._syncComponentVisibility();const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=GR({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(GR({x:t.x,y:t.y},this._getGridAttributes(),s)),this._syncComponentVisibility()},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=XF(this.getOrient()),n=t=>{var e;return(s?!XF(t.getOrient()):XF(t.getOrient()))&&VC(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())>=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,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=ZF(i,["z"]),qF(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(!Rz(e))return null;const{axisType:t,componentName:s}=QF(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=>KF(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(!Rz(t))return;const{axisType:s,componentName:n}=QF(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=YR.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}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return XF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):qF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(lj.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this._specVisible){XF(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&&!XF(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!qF(this.getOrient())&&this._spec.innerOffset){const t=this._spec;KF(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=LR(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=LR(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=XF(this.getOrient())?t.fieldX:qF(this.getOrient())?t.fieldZ:t.fieldY,VC(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;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,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:VC(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 t;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(hI.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(XF(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._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=XF(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:K(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return nR(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]:XF(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:qF(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();nR(this._regions,(e=>{XF(t)?Dz(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):KF(t)?Dz(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):qF(t)&&Dz(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(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=XF(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=XF(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)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=GR(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new Ve).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=XF(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?_t(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):_t(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-$(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&u(null===(e=a.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=a.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 o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return Iz(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:VC(this._scale.type)?i>=s[0]&&i<=$(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this._specVisible&&(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 i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}hj.type=r.cartesianAxis,hj.specKey="axes";const cj=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function dj(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,pj=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function gj(t,e,i="count"){const s=pj(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const fj=Math.sqrt(50),mj=Math.sqrt(10),vj=Math.sqrt(2);class _j{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){p(this._spec.nice)&&(this._nice=this._spec.nice),p(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=Lz(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(i.forceTickCount))e=i.forceTickCount;else if(d(i.tickCount)){const t=this._scale.range();let s=Math.abs($(t)-t[0]);if(1===s&&this._option){s=XF(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=k(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return u(s)&&u(n)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&u(n)&&u(this._softMaxValue)?this._scale.niceMax(e):!(!u(s)||!u(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return u(e)&&u(i)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&u(i)&&u(this._softMaxValue)?this._scale.niceMax():!(!u(e)||!u(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=u(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(uj),e.sort(uj),{domain:dj(t,e),scope:gj(t,e,i)}}(r,zy(t),this._spec.breaks[0].scopeType);e=zy(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return 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);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}=Lz(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs(K(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[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=fj?10:n>=mj?5:n>=vj?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max($(t),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)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}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._refreshVisibilityByData(),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)-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}_updateRawDomain(){const e=this.collectData(0,!0),i=this.computeLinearDomain(e);this._rawDomain=i,this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}const yj={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},bj={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}}},xj={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}}},Sj={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}}};class Aj extends hj{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new PE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}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)}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!qF(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=XF(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=BR(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=zy(this._break.scope).map((t=>i[0]+($(i)-i[0])*t))),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}registerTicksTransform(){const t=`${this.type}-ticks`;return _I(this._option.dataSet,t,HE),t}}Aj.type=r.cartesianLinearAxis,Aj.specKey="axes",Aj.builtInTheme={axis:Sj,axisLinear:yj,axisX:bj,axisY:xj},G(Aj,_j);const kj=()=>{YR.registerGraphicComponent(ej.lineAxis,((t,e)=>new CC(t,e))),YR.registerGraphicComponent(ij.lineAxisGrid,((t,e)=>new zB(t,e))),oj(),YR.registerComponent(Aj.type,Aj)};class Mj{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new AD(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{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._refreshVisibilityByData(),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._spec.showAllGroupLayers?this._scales:[this._scales[0]]).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=Iz(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=>Iz(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const e=this._spec.domain;for(let t=0;tthis._rawDomainIndex[t][e]=i))}this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const Tj={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}};class wj extends hj{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new cE}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}}registerTicksTransform(){const t=`${this.type}-ticks`;return _I(this._option.dataSet,t,GE),t}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=eE(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{YR.registerGraphicComponent(ej.lineAxis,((t,e)=>new CC(t,e))),YR.registerGraphicComponent(ij.lineAxisGrid,((t,e)=>new zB(t,e))),oj(),YR.registerComponent(wj.type,wj,!1)};class Ej extends Aj{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),nR(this._regions,(t=>{XF(this.getOrient())?Dz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):Dz(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=GR({},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 Pa(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.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 AD(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=mi.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=>Iz(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=>Iz(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return _I(this._option.dataSet,t,HE),t}transformScaleDomain(){}}Ej.type=r.cartesianTimeAxis,Ej.specKey="axes",Ej.builtInTheme={axis:Sj,axisX:bj,axisY:xj};class Bj extends Aj{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new IE}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return _I(this._option.dataSet,t,HE),t}transformScaleDomain(){}}Bj.type=r.cartesianLogAxis,Bj.specKey="axes",Bj.builtInTheme={axis:Sj,axisLinear:yj,axisX:bj,axisY:xj},G(Bj,_j);class Pj extends Aj{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new DE}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return _I(this._option.dataSet,t,HE),t}transformScaleDomain(){}}Pj.type=r.cartesianSymlogAxis,Pj.specKey="axes",Pj.builtInTheme={axis:Sj,axisLinear:yj,axisX:bj,axisY:xj},G(Pj,_j);const Lj=`${mO}_hide_`;function Rj(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const Oj=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[Lj]&&(Rj(t,!0),t[Lj]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=u(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[Lj]=!0,Rj(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},Ij=()=>{YR.registerGrammarTransform("symbolOverlap",{transform:Oj,runType:"afterEncode"})},Dj={min:K,max:X,average:QL,sum:JL};function Fj(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}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function zj(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 jj(t,e,i,s){return zj(t,e,i,"min",s)}function Hj(t,e,i,s){return zj(t,e,i,"max",s)}function Vj(t,e,i,s){return zj(t,e,i,"average",s)}function Nj(t,e,i,s){return zj(t,e,i,"sum",s)}const Uj=(t,e)=>{let i=d(t.size)?t.size():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=Fj;if("min"===n?l=jj:"max"===n?l=Hj:"average"===n?l=Vj:"sum"===n&&(l=Nj),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[]},Wj=()=>{YR.registerGrammarTransform("dataSampling",{transform:Uj})};class Gj extends $F{constructor(){super(...arguments),this.type=cR.line,this.transformerConstructor=bz,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.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(IF(null===(i=YR.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),DF("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=YF(this);this._symbolMark.setAnimationConfig(IF(null===(s=YR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),DF("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),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]}}Gj.type=cR.line,Gj.mark=uz,Gj.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},Gj.transformerConstructor=bz,G(Gj,dz);class Yj{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{EI(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof Pa)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];Vy(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];Vy(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class $j{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)=>{Jy(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{UO(e,[{key:t,operations:VC(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&&UO(e,[{key:i.field,operations:VC(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?MR("colorOrdinal"):MR(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(Jy(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),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(U(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;if(!U(r.specified,s.specified))return e.reMake=!0,e;s.range&&!U(s.range,n.range())&&(n.range(s.range),e.reRender=!0),Jy(s.domain)?e.reRender=!0:U(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(!Jy(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=VC(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=VC(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;VC(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(VC(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=VC(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(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)));VC(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 Xj{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&t.addState(i,!0,l):a&&t.addState(s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&t.addState(i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{t.removeState(i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&t.removeState(e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}class Kj extends eD{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){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=qy(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:vO,height:_O},this._viewRect={width:vO,height:_O},this._viewBox={x1:0,y1:0,x2:vO,y2:_O},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=IR(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new lI(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new Yj(this._dataSet),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===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new Xj;const t=this.getAllSeries(),e=[],i={};t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=`${n}-${t.type}`;i[r]?s.forEach((t=>{i[r].marks.push(t)})):(i[r]=Object.assign(Object.assign({},t),{marks:s}),e.push(i[r]))}))}})),e.forEach((t=>{const e=YR.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(IF({},DF("stage",this._spec,{}),null))}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.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=H(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=YR.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({},i),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_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){const s=YR.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"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(){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e,this._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof sD)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 CD))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof CD)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}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&&EI(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=GI(this._spec,this._option,{width:vO,height:_O})),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),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=fR(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new $j(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){YI(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=fR(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0};return Object.keys(t).filter((t=>!e[t])).sort()}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=this._getSpecKeys(this._spec);if(!U(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{YI(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[r.title]:!0,[r.brush]:!0,[r.indicator]:!0};this._components.forEach((s=>{var n,a;if(s.type===r.label||s.type===r.totalLabel)return;i[s.type]&&(i[s.type]=!1);const o=s.specKey||s.type,l=null!==(n=this._spec[o])&&void 0!==n?n:{};y(l)?(e[o]=e[o]||{specCount:l.length,componentCount:0},e[o].componentCount++,YI(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):YI(t,s.updateSpec(l))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}const s=t=>t&&!1!==t.visible;Object.keys(i).forEach((e=>{if(i[e]){const i=this._spec[e];(y(i)?i.some(s):s(i))&&(t.reMake=!0)}}))}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];YI(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=RR(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.resetLayoutItemTag(),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(){this._backgroundMark&&this._backgroundMark.compile()}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._option.globalInstance),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,this._option.globalInstance)}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._option.globalInstance),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,this._option.globalInstance)}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._option.globalInstance),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,this._option.globalInstance)}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(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(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(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(hI.AFTER_MARK_RENDER_END,e)};this._event.on(hI.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?Y(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:aI;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||d(e.filter)&&e.filter(o,l))){if(rI(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===hz.dimensionHover||s===hz.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=u(t)||!n||n.every((t=>UC(t.axis.getScale().type)&&u(t.index))),o=a||n.every((t=>UC(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(n))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(r.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(r.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),n=[];s.forEach((e=>{const i=t(e);!1!==i&&n.push({axis:e,value:i})})),i.showCrosshair(n)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const qj=(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 Zj{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)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):WR(t,a,c.spec),WR(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));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=qj(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=qj(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,e,i){var s,n,r,a,o;const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,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},h=this.seriesType;return h&&(l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(YR.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(YR.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=YR.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=YR.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=YR.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.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):aF(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=aF(t,u.specKey,u.type))||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"];return 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}))}_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 Jj extends Zj{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_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;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{u(i[t])&&(i[t]=n[t])})),L(i,"trimPadding")&&GR(i,$I(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class Qj extends Jj{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),WI(t)}}const tH=(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&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=YO(t,!0);for(const e in o)for(const i in o[e].nodes)qO(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)KO(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&XO(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}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 iH{_beforeInit(){this._dataSet&&_I(this._dataSet,"stackSplit",tH)}_initStack(){this._stack=new eH(this),this._stack.init()}}const sH={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:hz.dimensionHover};class nH extends YD{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},sH,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=aI(i);let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}nH.type="dimension-hover",nH.defaultOptions=sH;const rH=()=>{YR.registerInteractionTrigger(nH.type,nH)},aH=()=>{YR.registerComposedEvent(hz.dimensionHover,lz),YR.registerComposedEvent(hz.dimensionClick,iz)},oH=t=>t.fieldX[0],lH=t=>t.fieldY[0],hH=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},cH=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},dH=(t,e)=>t?e?oH:hH:e?lH:cH,uH=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=oz(t,(t=>XF(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=oz(t,(t=>KF(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{UC(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((t=>{if(d.size>0){if(d.has(t)){const s=pH(t,i,dH(e,UC(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=pH(t,i,dH(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},pH=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:gH(t,s,i)},gH=(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=rz(e,t,"cartesian",null!=i?i:XF(t.getOrient())?oH:lH);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},fH=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:u,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,_=0,y=null;if(d.size){const t=Array.from(d.values())[0];_=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,y=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(_)&&!Number.isNaN(_),x=s&&!b&&p(u),S=x?u:{coordRange:[0,0],sizeRange:[0,0],coord:_,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:y};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(UC(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(VC(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,_=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=Pz(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(a=y.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&y&&null!==(o=y.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(l=y.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&y&&null!==(h=y.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(c=y.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&y&&null!==(d=y.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(u=y.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&y&&null!==(p=y.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};vH(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=_+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=_+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&mH(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),mH=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=rF(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},vH=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},_H=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=yH(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},yH=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},bH=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return fH(c,r,e),c.xField.cacheInfo?_H(c.xField):c.yField.cacheInfo?_H(c.yField):void 0},xH=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],SH=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&xH.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(AH(s).every((t=>{var e;return!dF("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},AH=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},kH={dom:`${mO}_TOOLTIP_HANDLER_DOM`,canvas:`${mO}_TOOLTIP_HANDLER_CANVAS`},MH={key:"其他",value:"..."};var TH;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(TH||(TH={}));class wH{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(u(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,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:h,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}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:d,model:g}=e;if(!d||!this._cacheActiveSpec){const d=this.component.getSpec();if(this._cacheActiveSpec=SH(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){u(this._cacheActiveSpec.handler)&&p(d.handler)&&(this._cacheActiveSpec.handler=d.handler);const g=null!==(i=d[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},MH),t):MH;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!u(e)&&dF(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class CH extends wH{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)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],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(!UC(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(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}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const EH=()=>{YR.registerTooltipProcessor("dimension",CH)};class BH extends wH{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,Ko.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(aI(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const PH=()=>{YR.registerTooltipProcessor("mark",BH)};class LH extends wH{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:Y(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?Y(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_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 RH=()=>{YR.registerTooltipProcessor("group",LH)};class OH extends Kj{constructor(){super(...arguments),this.transformerConstructor=Qj,this.type="line",this.seriesType=cR.line}_setModelOption(){this._modelOption.getDimensionInfo=uH,this._modelOption.getDimensionInfoByValue=gH,this._modelOption.getRectByDimensionData=bH}}OH.type="line",OH.seriesType=cR.line,OH.transformerConstructor=Qj,G(OH,iH);const IH=[...gz,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class DH extends fz{constructor(){super(...arguments),this.type=DH.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return IH}_getIgnoreAttributes(){return[]}}DH.type="area";const FH=()=>{YR.registerMark(DH.type,DH),Jk(),Lk(),EB(),kB(),WD(),YR.registerGraphicComponent("area",nf)};class zH extends fF{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 jH=Object.assign(Object.assign(Object.assign({},wF),cz),{area:{name:"area",type:"area"}}),HH=()=>{YR.registerAnimation("area",ND),UD(),HD()};class VH extends bz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!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,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_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,f=h;("line"===c||u&&!d)&&(g=h,f=l),l.style=GR({},f.style,g.style),l.state=GR({},f.state,g.state),!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),t.area=l,t.line=h}}class NH extends $F{constructor(){super(...arguments),this.type=cR.area,this.transformerConstructor=VH,this._sortDataByAxis=!1}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(NH.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}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===eF?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return TR(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),y1: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),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return TR(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:!!e&&this.getColorAttribute(),stroke:!!i&&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.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[TO]},"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(IF(null===(e=YR.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),DF("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(IF(null===(i=YR.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),DF("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=YF(this);this._symbolMark.setAnimationConfig(IF(null===(s=YR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),DF("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new zH(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.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(){super.onLayoutEnd(),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}}}NH.type=cR.area,NH.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},NH.mark=jH,NH.transformerConstructor=VH,G(NH,dz);class UH extends Jj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),WI(t)}}class WH extends Kj{constructor(){super(...arguments),this.transformerConstructor=UH,this.type="area",this.seriesType=cR.area}_setModelOption(){this._modelOption.getDimensionInfo=uH,this._modelOption.getDimensionInfoByValue=gH,this._modelOption.getRectByDimensionData=bH}}WH.type="area",WH.seriesType=cR.area,WH.transformerConstructor=UH,G(WH,iH);function GH(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 YH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:GH(t,e)}),$H=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:GH(t,e)}),XH={type:"fadeIn"},KH={type:"growCenterIn"};function qH(t,e){if(!1===e)return{};switch(e){case"fadeIn":return XH;case"scaleIn":return KH;default:return YH(t)}}class ZH extends CD{constructor(){super(...arguments),this.type=ZH.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}ZH.type="rect";const JH=()=>{Jk(),Xk(),xB("rect",TB),YR.registerMark(ZH.type,ZH),pw.registerBuiltInAnimate("growHeightIn",rC),pw.registerBuiltInAnimate("growHeightOut",aC),pw.registerBuiltInAnimate("growWidthIn",SC),pw.registerBuiltInAnimate("growWidthOut",AC),pw.registerBuiltInAnimate("growCenterIn",iC),pw.registerBuiltInAnimate("growCenterOut",sC),YR.registerGraphicComponent("rect",Dg)},QH=Object.assign(Object.assign({},wF),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function tV(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;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=FR(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[CF]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):TR(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[EF]):TR(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=TR(this._dataToPosX(t),e,i),n=TR(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[BF]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):TR(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[PF]):TR(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=TR(this._dataToPosY(t),e,i),n=TR(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},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(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},sV.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:jF(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(sV.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}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(_I(this._option.dataSet,"addVChartProperty",lF),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};_I(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new Pa(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:AF.bind(this),call:kF}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new AD(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=PF,s=BF,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=EF,s=CF,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=YO(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)tV(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=TR(this[r](t),l,i),u=TR(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!wR(t[this.getStackValueField()],l)?p=0:pthis._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.setMarkConfig({clip:!0,clipPath:()=>{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[MO],n=t[TO],r=t[wO],h=t[CO];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]),{[MO]:i,[TO]:s}),a?{[wO]:o,[CO]:l}:void 0),c="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)};t.push(Dg(Object.assign(Object.assign({},c),{cornerRadius:d(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(c,h,this._markAttributeContext):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=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>TR(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},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=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>TR(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),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;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=K(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=YF(this);this._barMark.setAnimationConfig(IF(null===(e=YR.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),DF(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=p(this._spec.barWidth)&&r===n,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=a;return o&&(c=FR(this._spec.barWidth,a)),l&&(c=Math.max(c,FR(this._spec.barMinWidth,a))),h&&(c=Math.min(c,FR(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=u(i)?f:Math.min(f,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,m-1))&&void 0!==r?r:6,_=m===f?this._barMark.getAttribute(c,e):v;if(m>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=FR(null!==(l=i[r-1])&&void 0!==l?l:$(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=VC(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(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}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}}sV.type=cR.bar,sV.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},sV.mark=QH,sV.transformerConstructor=iV;const nV=()=>{Wj(),JH(),YR.registerAnimation("bar",((t,e)=>({appear:qH(t,e),enter:YH(t,!1),exit:$H(t,!1),disappear:{duration:FD.disappear.duration}}))),Cj(),kj(),YR.registerSeries(sV.type,sV)};class rV extends Jj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),WI(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 aV extends Kj{constructor(){super(...arguments),this.transformerConstructor=rV,this.type="bar",this.seriesType=cR.bar}_setModelOption(){this._modelOption.getDimensionInfo=uH,this._modelOption.getDimensionInfoByValue=gH,this._modelOption.getRectByDimensionData=bH}}aV.type="bar",aV.seriesType=cR.bar,aV.transformerConstructor=rV,G(aV,iH);const oV=[10,20],lV=jC.Linear,hV="circle",cV=jC.Ordinal,dV=["circle","square","triangle","diamond","star"],uV=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},pV=Object.assign(Object.assign({},wF),{point:{name:"point",type:"symbol"}});class gV extends UF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class fV extends $F{constructor(){super(...arguments),this.type=cR.scatter,this.transformerConstructor=gV,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=`${mO}_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=`${mO}_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:lV,defaultRange:oV},"size")}getShapeAttribute(t,e){return u(e)?hV:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:cV,defaultRange:dV},"shape")}initMark(){this._symbolMark=this._createMark(fV.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:jF(this._spec,fV.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=YF(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(IF(null===(i=YR.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),DF("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:hV},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{if(!t)return;const e=t.getGraphics();e&&e.length&&e.forEach(((t,e)=>{var i,s;const n=null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],r=this.dataToPosition(n);r&&t&&t.translateTo(r.x,r.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){this.handleZoom(t)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}fV.type=cR.scatter,fV.mark=pV,fV.builtInTheme={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"}}}}},fV.transformerConstructor=gV;const mV=()=>{yz(),YR.registerAnimation("scatter",((t,e)=>Object.assign({appear:uV(0,e)},zD))),Cj(),kj(),YR.registerSeries(fV.type,fV)};class vV extends Jj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class _V extends Kj{constructor(){super(...arguments),this.transformerConstructor=vV,this.type="scatter",this.seriesType=cR.scatter}_setModelOption(){this._modelOption.getDimensionInfo=uH,this._modelOption.getDimensionInfoByValue=gH,this._modelOption.getRectByDimensionData=bH}}_V.type="scatter",_V.seriesType=cR.scatter,_V.transformerConstructor=vV,G(_V,iH);class yV extends WF{constructor(){super(...arguments),this.type=cR.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=`${mO}_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 bV=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[bO]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[NO]=e.nameMap[n]:t[NO]=n})),t.features);class xV extends fF{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 SV extends CD{constructor(){super(...arguments),this.type=SV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}SV.type="path";const AV=()=>{YR.registerMark(SV.type,SV),Jk(),Wk(),YR.registerGraphicComponent("path",tf)},kV=Object.assign(Object.assign({},wF),{area:{name:"area",type:"path"}});class MV{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Ia(i,e):Ra[i]?(La[i]||(La[i]=Ia(i,Ra[i])),La[i]):null}(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 TV{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(){}}class wV{constructor(){this._lastScale=0}clearZoom(){this._lastScale=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 CV(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:TV}:$y(e)||Xy(e)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:wV}:null}const EV={debounce:St,throttle:At};class BV{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=$y(this._renderMode)||Xy(this._renderMode),CV(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return CV(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(u(r))return;if(!ke({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{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(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:pI.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:pI.chart,consume:!1}];l.on(...c,EV[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,EV[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||CV(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||CV(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:ke({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:pI.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:pI.chart,consume:!1}];l.on(...c,EV[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,EV[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){CV(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||CV(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(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:pI.chart},(t=>{if(!t.event)return;const{event:n}=t;ke({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:pI.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||CV(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:pI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||CV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:pI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:pI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:pI.chart,source:uI.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:pI.chart,source:uI.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=EV[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=EV[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:pI.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:pI.chart,source:uI.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:pI.chart,source:uI.chart},this._handleDragMouseUp)}))}}function PV(t,e){return`${mO}_${e}_${t}`}class LV extends tj{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:PV(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;const l=p(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,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,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):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,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=GR(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var e,i,s;this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:n}=this._spec;if(n){let t=!0,r=!0,a=!1;!0!==n&&(t=null===(e=n.zoom)||void 0===e||e,r=null===(i=n.drag)||void 0===i||i,a=null!==(s=n.blank)&&void 0!==s&&s),t&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!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 MV(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===cR.map||e.type===cR.pictogram?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(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),nR(this._regions,(t=>{var e;if(t.type===cR.map||t.type===cR.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new We})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==cR.map&&e.type!==cR.pictogram||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[NO],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!U(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}LV.type=r.geoCoordinate,G(LV,BV);const RV=()=>{YR.registerComponent(LV.type,LV)};class OV extends UF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class IV extends yV{constructor(){super(...arguments),this.type=cR.map,this.transformerConstructor=OV,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 !`),bI.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var e,i;super.initData(),_I(this._dataSet,"copyDataView",TI),_I(this._dataSet,"map",bV),_I(this._dataSet,"lookup",oF);const s=bI.get(this.map);s||null===(e=this._option)||void 0===e||e.onError("no valid map data found!");const n=new Pa(this._dataSet,{name:`map_${this.id}_data`});n.parse([s],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:t.TransformLevel.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:NO,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",n.reRunAllTransform),this._mapViewData=new AD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(IV.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:jF(this._spec,IV.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}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:SO])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:SO]):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(IF(null===(t=YR.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),DF("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new xV(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[bO]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[bO],{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;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new We}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new We}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}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 bO}getActiveMarks(){return[this._pathMark]}}IV.type=cR.map,IV.mark=kV,IV.builtInTheme={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"}}}}},IV.transformerConstructor=OV;const DV=`${mO}_waterfall_default_seriesField`,FV=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n,calculationMode:r}=e,a=[],{dimensionValues:o,dimensionData:l}=n().latestData;let h=Array.from(o[i]);"decrease"===r&&(h=h.reverse());let c={start:0,end:0,positive:0,negative:0,lastIndex:null};return h.forEach(((t,i)=>{const n={start:c.end,end:c.end,lastIndex:c.lastIndex,lastEnd:c.end,index:t,isTotal:!1,positive:c.end,negative:c.end},r=!0===e.stackInverse?l[t].reverse():l[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[RO]=!0:delete t[RO]})),r.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===h.length-1)return!0;return!1};if(r.some((t=>o(t))))return c=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,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=zV([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 f=g[0];let{start:m,end:v}=jV(f,i,s,n,u);i.start=m,i.end=v;let _=m,y=m,b=v-m;const x=p.reduce(((t,e)=>ne(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=se(_,e)):(t[c]=+y,y=se(y,e)),t[d]=se(t[c],e),m=se(m,e),b=ne(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,n,a,c,h,i,e,o),void a.push(n)}c=zV(r,t,n,a,c,h,i,e),a.push(n)})),a};function zV(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}=jV(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=se(i.positive,e)):(t[h]=+i.negative,i.negative=se(i.negative,e)),t[c]=se(t[h],e),i.end=se(i.end,e)}i.isTotal=e,(u(p)||p===DV)&&(t[DV]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function jV(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?Vy("total.collectCountField error"):n=e[a].start;o<0?Vy("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=se(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 HV=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>se(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?t.unshift(o):t.push(o),t},VV={type:"fadeIn"},NV={type:"growCenterIn"};function UV(t,e){switch(e){case"fadeIn":return VV;case"scaleIn":return NV;default:return YH(t,!1)}}class WV extends CD{constructor(){super(...arguments),this.type=WV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(t,i,s){const n=super._transformGraphicAttributes(t,i,s),{x:r,x1:a,y:o,y1:l}=n,h=e(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return Lg(t)}}WV.type="rule";const GV=()=>{YR.registerMark(WV.type,WV),Jk(),Nk(),YR.registerGraphicComponent("line",Lg)},YV=Object.assign(Object.assign({},QH),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),$V=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:XV(t.map((t=>t.latestData)).flat(),e.fields,i)}};function XV(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)=>XV(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class KV{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 Pa(e instanceof Ba?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),_I(e,"dimensionTree",$V),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 qV extends iV{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const ZV={rect:sN,symbol:eN,arc:rN,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=eN(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:aN,line:oN,area:oN,rect3d:sN,arc3d:rN,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function JV(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=ZV[t])&&void 0!==i?i:ZV.point;return e.series.type===cR.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=tN(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;_(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!_(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:lN(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function QV(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==cR.sankey){const{formatFunc:t,args:n}=rF(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function tN(t){return d(t)?e=>t(e.data):t}function eN(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=tN(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:iN(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function iN(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function sN(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=tN(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;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:nN(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function nN(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 rN(t){var e;const{labelSpec:i}=t,s=null!==(e=tN(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 aN(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=QV(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),Tg(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 oN(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}))):[{index:0,[SO]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function lN(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class hN extends sV{constructor(){super(...arguments),this.type=cR.waterfall,this.transformerConstructor=qV,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&XO(t,e)}}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 KV(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=DV)}getSeriesKeys(){return this._seriesField===DV?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t,e,i;super.initData(),_I(this._dataSet,"waterfallFillTotal",HV),_I(this._dataSet,"waterfall",FV),(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,calculationMode:null!==(e=this._spec.calculationMode)&&void 0!==e?e:"increase",stackInverse:this.getRegion().getStackInverse()}},!1));const s=wI(this.getViewData(),this._dataSet,{name:`${mO}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",s.reRunAllTransform),this._totalData=new AD(this._option,s),s.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:MO,endAs:TO,total:this._spec.total,calculationMode:null!==(i=this._spec.calculationMode)&&void 0!==i?i:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}},!1),s.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}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=YF(this);this._barMark.setAnimationConfig(IF(null===(i=YR.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),DF("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(IF(null===(s=YR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),DF("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(){super.initMark();const t=this._createMark(hN.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:ne(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:ne(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return aN(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?TR(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):TR(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle();const e="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),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",e?0:1):0,y1:t=>this.totalPositionY(t,"index",e?1:0)},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",e?0:1):0,x1:t=>this.totalPositionX(t,"index",e?1:0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}isVisibleLeaderLine(t){return!u(t.lastIndex)&&wR([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}hN.type=cR.waterfall,hN.mark=YV,hN.builtInTheme={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}}}},hN.transformerConstructor=qV;const cN=()=>{GV(),JH(),YR.registerAnimation("waterfall",((t,e)=>({appear:UV(t,e),enter:YH(t,!1),exit:$H(t,!1),disappear:{duration:FD.disappear.duration}}))),VD(),Cj(),kj(),YR.registerSeries(hN.type,hN)},dN=`${mO}_BOX_PLOT_OUTLIER_VALUE`;var uN;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(uN||(uN={}));const pN=(t,e)=>{const i=[],{outliersField:s,dimensionField:n,seriesField:r}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];y(e)||(e=[e]),i.push(...e.map((e=>{const i={[dN]:e};return n.forEach((e=>{i[e]=t[e]})),p(r)&&(i[r]=t[r]),i})))})),i};class gN extends fF{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===uN.OUTLIER)return this.series.getOutliersField();if(t===uN.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case uN.MIN:return this.series.getMinField();case uN.MAX:return this.series.getMaxField();case uN.MEDIAN:return this.series.getMedianField();case uN.Q1:return this.series.getQ1Field();case uN.Q3:return this.series.getQ3Field();case uN.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===uN.OUTLIER)return e[dN];if(t===uN.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case uN.MIN:return e[this.series.getMinField()];case uN.MAX:return e[this.series.getMaxField()];case uN.MEDIAN:return e[this.series.getMedianField()];case uN.Q1:return e[this.series.getQ1Field()];case uN.Q3:return e[this.series.getQ3Field()];case uN.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,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>p(t[dN])}getDefaultContentList(t){return[{key:this.getContentKey(uN.OUTLIER),value:this.getContentValue(uN.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(uN.MAX),value:this.getContentValue(uN.MAX)},{key:this.getContentKey(uN.Q3),value:this.getContentValue(uN.Q3)},{key:this.getContentKey(uN.MEDIAN),value:this.getContentValue(uN.MEDIAN)},{key:this.getContentKey(uN.Q1),value:this.getContentValue(uN.Q1)},{key:this.getContentKey(uN.MIN),value:this.getContentValue(uN.MIN)},{key:this.getContentKey(uN.SERIES_FIELD),value:this.getContentValue(uN.SERIES_FIELD)}]}}class fN extends CD{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==ZI.enter&&t.context.diffState!==ZI.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;return this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?j(r,i):i}})),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=zg(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=YR.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const mN=()=>{YR.registerGraphicComponent("glyph",zg),Jk(),Dk()},vN=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],_N=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class yN extends fN{constructor(){super(...arguments),this.type=yN.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=vN,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=_N,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}yN.type="boxPlot";const bN=Object.assign(Object.assign({},wF),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),xN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},SN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},AN=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),kN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,M;if(i&&k(i.center))return i.center;let T,w,C,E,B;if("horizontal"===e){T=null===(r=null===(n=(null===(s=AN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,w=null===(h=null===(l=null===(o=null===(a=AN(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,C=null===(p=null===(u=null===(d=null===(c=AN(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=AN(t,"box").attribute.width,i=AN(t,"box").attribute.x;E=i,B=i+e}else{T=null===(m=null===(f=(null===(g=AN(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,w=null===(b=null===(y=null===(_=null===(v=AN(t,"max"))||void 0===v?void 0:v.attribute)||void 0===_?void 0:_.points)||void 0===y?void 0:y[0])||void 0===b?void 0:b.y,C=null===(M=null===(A=null===(S=null===(x=AN(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===M?void 0:M.y;const e=AN(t,"box").attribute.height,i=AN(t,"box").attribute.y;E=i,B=i+e}return k(T)?T:k(E)&&k(B)?(E+B)/2:k(w)&&k(C)?(w+C)/2:k(C)?C:k(w)?w:NaN},MN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,_,y,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=AN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=AN(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=AN(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;y=i,_=i+e;const c=(null===(l=AN(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=AN(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=AN(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=AN(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=AN(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;y=i,_=i+e;const s=(null===(f=AN(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=AN(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(_)&&k(y)?(_+y)/2:k(y)?y:k(_)?_:NaN};class TN extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return xN(kN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class wN extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return SN(kN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class CN extends TN{computeAttribute(){return xN(MN)(this.target,this.params,this.params.options)}}class EN extends wN{computeAttribute(){return SN(MN)(this.target,this.params,this.params.options)}}class BN extends UF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}class PN extends $F{constructor(){super(...arguments),this.type=cR.boxPlot,this.transformerConstructor=BN,this._bandPosition=0}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,r,a;super.setAttrFromSpec();const o=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=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(PN.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(PN.mark.outlier,{key:bO,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var e,i,s,n,r,a;const o=this._boxPlotMark;if(o){const s={lineWidth:this._lineWidth,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"!==this._shaftShape?"#000":this.getColorAttribute()};o.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const n="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return FR(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return FR(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return FR(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return FR(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return FR(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return FR(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return FR(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return FR(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(o,s,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(o,n,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Built_In)}const l=this._outlierMark;l&&this.setMarkStyle(l,{fill:null!==(r=null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this._boxFillColor)&&void 0!==r?r:this.getColorAttribute(),stroke:this.getColorAttribute(),size:S(null===(a=this._outliersStyle)||void 0===a?void 0:a.size)?this._outliersStyle.size:10},t.STATE_VALUE_ENUM.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=>TR(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>TR(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>TR(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>TR(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>TR(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},t.STATE_VALUE_ENUM.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:t=>this._getPosition(this.direction,t),x:t=>TR(e(this.getDatumPositionValues(t,dN),{bandPosition:this._bandPosition}),s)}:{x:t=>this._getPosition(this.direction,t),y:t=>TR(e(this.getDatumPositionValues(t,dN),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;_I(this._dataSet,"foldOutlierData",pN),_I(this._dataSet,"addVChartProperty",lF);const t=new Pa(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${mO}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField}}),t.transform({type:"addVChartProperty",options:{beforeCall:AF.bind(this),call:kF}},!1),this._outlierData=new AD(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t;if(this._autoBoxWidth)return this._autoBoxWidth;const e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,i=this._groups?this._groups.fields.length:1,s=null===(t=e.getBandwidth)||void 0===t?void 0:t.call(e,i-1);let n=s;return p(this._spec.boxWidth)&&(n=FR(this._spec.boxWidth,s)),p(this._spec.boxMinWidth)&&(n=Math.max(n,FR(this._spec.boxMinWidth,s))),p(this._spec.boxMaxWidth)&&(n=Math.min(n,FR(this._spec.boxMaxWidth,s))),this._autoBoxWidth=n,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r;let a,o,l;"horizontal"===t?(a=this.getYAxisHelper(),o="boxHeight",l=this.dataToPositionY.bind(this)):(a=this.getXAxisHelper(),o="boxWidth",l=this.dataToPositionX.bind(this));const h=a.getScale(0),c=this._groups?this._groups.fields.length:1,d=null===(i=a.getBandwidth)||void 0===i?void 0:i.call(a,c-1),u=this._boxPlotMark.getAttribute(o,e);if(c>1&&p(this._spec.boxGapInGroup)){const t=this._groups.fields,i=Y(this._spec.boxGapInGroup);let o=0,l=0;for(let h=t.length-1;h>=1;h--){const c=t[h],p=null!==(n=null===(s=a.getScale(h))||void 0===s?void 0:s.domain())&&void 0!==n?n:[],g=p.length,f=FR(null!==(r=i[h-1])&&void 0!==r?r:$(i),d),m=p.indexOf(e[c]);h===t.length-1?(o+=g*u+(g-1)*f,l+=m*(u+f)):(l+=m*(o+f),o+=o+(g-1)*f)}return h.scale(e[t[0]])+a.getBandwidth(0)/2-o/2+l+u/2}const g=VC(h.type||"band");return l(e)+.5*d+(g?-d/2:0)}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=j({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=YF(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=YR.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(DF("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(IF(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(IF(null===(a=YR.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new gN(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}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}PN.type=cR.boxPlot,PN.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},PN.mark=bN,PN.transformerConstructor=BN;const LN=()=>{mN(),Nk(),Xk(),YR.registerGraphicComponent("line",(t=>Lg(t))),YR.registerGraphicComponent("rect",(t=>Dg(t))),YR.registerMark(yN.type,yN),yz(),HD(),Cj(),kj(),pw.registerBuiltInAnimate("boxplotScaleIn",TN),pw.registerBuiltInAnimate("boxplotScaleOut",wN),pw.registerBuiltInAnimate("barBoxplotScaleIn",CN),pw.registerBuiltInAnimate("barBoxplotScaleOut",EN),YR.registerSeries(PN.type,PN)};class RN extends CD{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=RN.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?Zg(t):Tg(t)}}RN.type="text";const ON=()=>{YR.registerMark(RN.type,RN),Jk(),iM(),qk(),YR.registerGraphicComponent("text",Tg),YR.registerGraphicComponent("richtext",Zg)};class IN extends fF{constructor(){super(...arguments),this._getMeasureData=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]]}}const DN=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),FN={type:"fadeIn"},zN=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function jN(t,e){return"fadeIn"===e?FN:DN(t)}const HN=Object.assign(Object.assign({},QH),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class VN extends iV{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 NN extends sV{constructor(){super(...arguments),this.type=cR.rangeColumn,this._barMarkType="rect",this._barName=cR.bar,this.transformerConstructor=VN}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(NN.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:jF(this._spec,NN.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(NN.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(NN.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(e,i,s,n){var r,a,o,l;if(e){this.setMarkStyle(e,{fill:null!==(a=null===(r=null==i?void 0:i.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[s]]:t[this._spec.yField[s]];return(null==i?void 0:i.formatMethod)?i.formatMethod(e,t):e}});!function(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)}(this,e,null!==(o=null==i?void 0:i.position)&&void 0!==o?o:n,null!==(l=null==i?void 0:i.offset)&&void 0!==l?l:"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=YF(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(IF(null===(i=YR.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),DF("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(IF(null===(s=YR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),DF("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(IF(null===(n=YR.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),DF("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new IN(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)}}NN.type=cR.rangeColumn,NN.mark=HN,NN.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},NN.transformerConstructor=VN;const UN=()=>{JH(),ON(),YR.registerAnimation("rangeColumn",((t,e)=>({appear:jN(t,e),enter:DN(t),exit:zN(t),disappear:{duration:FD.disappear.duration}}))),VD(),Cj(),kj(),YR.registerSeries(NN.type,NN)};var WN,GN;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(WN||(WN={})),function(t){t.middle="middle",t.start="start",t.end="end"}(GN||(GN={}));class YN extends fF{constructor(){super(...arguments),this._getMeasureData=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]]}}const $N=Object.assign({},jH);class XN extends NH{constructor(){super(...arguments),this.type=cR.rangeArea}initMark(){this._areaMark=this._createMark(XN.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}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 YN(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}XN.type=cR.rangeArea,XN.mark=$N;class KN extends WF{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=Xz,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.radiusAxisHelper.dataToPosition(Y(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(Y(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}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:[]};VC(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:[]};VC(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)&&GF(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}}function qN(t){return Zy(t)?Number.parseFloat(t):0}const ZN=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&JN(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=fe(e+a/2)};let _=0,y=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,M=0;const T=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))}(x);if(m.forEach(((t,e)=>{const i=t[zz],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/M;A=p,m.forEach((e=>{const i=e[r]===f?f:e[zz]*t;v(e,A,i),A+=i}))}if(0!==_&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},JN=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===qN(t[e])))||!i&&0===t.reduce(((t,i)=>t+qN(i[e])),0)));function QN(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const tU=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:QN(t,!0,PI.appear)}),eU={type:"fadeIn"},iU=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:QN(t,!0,PI.enter)}),sU=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:QN(t,!0,PI.exit)});function nU(t,e){if(!1===e)return{};switch(e){case"fadeIn":return eU;case"growRadius":return tU(Object.assign(Object.assign({},t),{growField:"radius"}));default:return tU(Object.assign(Object.assign({},t),{growField:"angle"}))}}class rU extends CD{constructor(t,e){super(t,e),this.type=aU.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>ce({x:0,y:0},this.getAttribute("centerOffset",e,i),e[Uz])[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 aU extends rU{constructor(){super(...arguments),this.type=aU.type}}aU.type="arc";const oU=()=>{Jk(),Bk(),xB("arc",LB),pw.registerBuiltInAnimate("growRadiusIn",yC),pw.registerBuiltInAnimate("growRadiusOut",bC),pw.registerBuiltInAnimate("growAngleIn",tC),pw.registerBuiltInAnimate("growAngleOut",eC),YR.registerGraphicComponent("arc",of),YR.registerMark(aU.type,aU)},lU=Object.assign(Object.assign({},wF),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class hU extends UF{_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=GR({},this._theme,i,t);const n=(t,e)=>GR({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);y(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const cU=`${mO}_LABEL_VISIBLE`;class dU extends KN{constructor(){super(...arguments),this.transformerConstructor=hU,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:LR(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:LR(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=Yz,this._endAngle=$z,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[Uz];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return ce(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;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 a=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)?oe(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?oe(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?oe(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=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;_I(this._dataSet,"pie",ZN),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?oe(this._spec.minAngle):0,asStartAngle:Hz,asEndAngle:Vz,asRatio:jz,asMiddleAngle:Uz,asRadian:Gz,asQuadrant:Wz,asK:Nz,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new Pa(this._dataSet,{name:`${mO}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new AD(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},dU.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:xO,groupKey:this._seriesField,isSeriesMark:!0},{morph:jF(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return oR(Hz)(t)}endAngleScale(t){return oR(Vz)(t)}_computeLayoutRadius(){return Kz((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:CR(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:CR(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},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),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)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:oR(cU).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(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[Uz];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return ce(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===PI.appear)return this._startAngle;if(i===PI.disappear)return this._endAngle;const r=[PI.disappear,PI.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[bO];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[bO]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[bO])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[bO])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[Uz]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[Uz]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[Uz]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[Uz]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=IF(null===(i=YR.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}dU.transformerConstructor=hU,dU.mark=lU,dU.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class uU extends dU{constructor(){super(...arguments),this.type=cR.pie}}uU.type=cR.pie;const pU=()=>{oU(),YR.registerAnimation("pie",((t,e)=>({appear:nU(t,e),enter:iU(t),exit:sU(t),disappear:{duration:FD.disappear.duration}}))),YR.registerAnimation("emptyCircle",((t,e)=>({appear:nU(t,e)}))),YR.registerSeries(uU.type,uU)};function gU(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const fU=t=>({type:gU(t.growField),options:{overall:!0}}),mU={type:"fadeIn"},vU=t=>({type:gU(t.growField)}),_U=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function yU(t,e){if(!1===e)return{};switch(e){case"fadeIn":return mU;case"growAngle":return fU(Object.assign(Object.assign({},t),{growField:"angle"}));default:return fU(Object.assign(Object.assign({},t),{growField:"radius"}))}}class bU extends KN{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(TO),this.setInnerRadiusField(MO)}setValueFieldToPercent(){this.setRadiusField(CO),this.setInnerRadiusField(wO)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const xU=Object.assign(Object.assign({},wF),{rose:{name:"rose",type:"arc"}});class SU extends UF{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class AU extends aj{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=y(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let n,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:u,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((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:-90,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.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=u,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const _={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(_),"radius"===i.orient?(o.push(_),a=h):(l.push(_),n=h)})),o.forEach((t=>{t.angleAxisIndex=n})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=YR.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=Yz,this._endAngle=$z,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),nR(this._regions,(t=>{"radius"===this.getOrient()?Dz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):Dz(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(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.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:LR(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:LR(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this._specVisible&&(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=oe(this._spec.startAngle),this._endAngle=oe(this._spec.endAngle),this._inverse=this._spec.inverse}_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:Pz(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}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(){nR(this._regions,(t=>{"radius"===this.getOrient()?Dz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):Dz(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(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 VC(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:VC(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 ce(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return de(t,this.getCenter(),this._startAngle,this._endAngle)}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=>Iz(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_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=ae.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",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return Kz((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=Xz,e=0;const i=this.getChart().getSpec();return nR(this.getRegions(),(s=>{const n=s;if(r=n.type,[cR.rose,cR.radar,cR.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.getComponent().setAttributes(GR({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(GR({},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)}}AU.type=r.polarAxis,AU.specKey="axes";const kU={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},MU={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class TU extends AU{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new PE}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}registerTicksTransform(){const t=`${this.type}-ticks`;return _I(this._option.dataSet,t,HE),t}}TU.type=r.polarLinearAxis,TU.specKey="axes",TU.builtInTheme={axis:Sj,axisLinear:yj,axisAngle:MU,axisRadius:kU},G(TU,_j);const wU=()=>{YR.registerGraphicComponent(ej.lineAxis,((t,e)=>new CC(t,e))),YR.registerGraphicComponent(ij.lineAxisGrid,((t,e)=>new zB(t,e))),YR.registerGraphicComponent(ej.circleAxis,((t,e)=>new OC(t,e))),YR.registerGraphicComponent(ij.circleAxisGrid,((t,e)=>new UB(t,e))),oj(),YR.registerComponent(TU.type,TU)};class CU extends AU{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new cE}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)}registerTicksTransform(){const t=`${this.type}-ticks`;return _I(this._option.dataSet,t,XE),t}transformScaleDomain(){}}CU.type=r.polarBandAxis,CU.specKey="axes",CU.builtInTheme={axis:Sj,axisBand:Tj,axisAngle:MU,axisRadius:kU},G(CU,Mj);const EU=()=>{YR.registerGraphicComponent(ej.lineAxis,((t,e)=>new CC(t,e))),YR.registerGraphicComponent(ij.lineAxisGrid,((t,e)=>new zB(t,e))),YR.registerGraphicComponent(ej.circleAxis,((t,e)=>new OC(t,e))),YR.registerGraphicComponent(ij.circleAxisGrid,((t,e)=>new UB(t,e))),oj(),YR.registerComponent(CU.type,CU)};class BU extends bU{constructor(){super(...arguments),this.type=cR.rose,this.transformerConstructor=SU,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(){this._roseMark=this._createMark(BU.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:jF(this._spec,BU.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}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=>TR(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=TR(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(IF(null===(i=YR.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),DF("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}BU.type=cR.rose,BU.mark=xU,BU.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},BU.transformerConstructor=SU;const PU=()=>{YR.registerSeries(BU.type,BU),oU(),YR.registerAnimation("rose",((t,e)=>({appear:yU(t,e),enter:vU(t),exit:_U(t),disappear:{duration:FD.disappear.duration}}))),EU(),wU()};class LU extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:ce(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=de(this.from,this._prevCenter),{angle:i,radius:s}=de(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,KL(this._fromAngle,this._toAngle)&&KL(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class RU extends $w{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!sR(t)&&!sR(e))return e;const s=de(t,this._prevCenter),n=de(e,this._center);let r=pe(s.angle),a=pe(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new re(s,n,r,a);return o.defined=e.defined,o}}const OU=t=>({type:"in"===t?"fadeIn":"fadeOut"});function IU(t,e,i){return"fadeIn"===e?OU(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function DU(t,e,i){return"fadeIn"===e?OU(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 FU=(t,e)=>({custom:Gw,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),zU=Object.assign(Object.assign(Object.assign({},wF),cz),{area:{name:"area",type:"area"}});class jU extends bU{constructor(){super(...arguments),this.type=cR.radar,this.transformerConstructor=bz,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!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),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(jU.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}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:iF,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{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.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)?oe(this._spec.startAngle):Yz},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(IF(null===(s=YR.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),DF("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=YR.getAnimationInKey(e);t.setAnimationConfig(IF(null==i?void 0:i(n,r),DF(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}}}jU.type=cR.radar,jU.mark=zU,jU.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},jU.transformerConstructor=bz,G(jU,dz);const HU=()=>{YR.registerSeries(jU.type,jU),FH(),vz(),yz(),YR.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:IU(t,e,"in"),enter:IU(t,e,"in"),exit:IU(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:FD.disappear.duration},update:[{channel:["points","center"],custom:RU,customParameters:t,duration:FD.update.duration,easing:FD.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),YR.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:DU(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:FD.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:LU,customParameters:t,duration:FD.update.duration,easing:FD.update.easing}]}))),YR.registerAnimation("radarGroup",((t,e)=>({appear:FU(t,"in"),disappear:{duration:FD.disappear.duration}}))),Bk(),EU(),wU()};class VU extends fF{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>mi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const NU=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(mO)||(i[n]=t[n],s=p(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[bO]:r,[xO]:`${s}_${e}`})),r++}))})),n},UU={fill:"#bbb",fillOpacity:.2},WU=Object.assign(Object.assign({},wF),{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"}});class GU extends $F{constructor(){super(...arguments),this.type=cR.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 e;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),_I(this._option.dataSet,"objFlat",NU),_I(this._option.dataSet,"copyDataView",TI),yI(this._option.dataSet,"dataview",wa),null===(e=this.getViewData())||void 0===e||e.transform({type:"objFlat",options:"dots",level:t.TransformLevel.dotObjFlat},!1)}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(GR(UU,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(GU.mark.group),this._containerMark=this._createMark(GU.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(GU.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(GU.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(GU.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(GU.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(GU.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(GU.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var e;const i=this._clipMark;i&&(this.setMarkStyle(i,{x:-(null!==(e=this._spec.leftAppendPadding)&&void 0!==e?e:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",t.AttributeLevel.Series),i.setMarkConfig({interactive:!1,clip:!0}));const s=this._containerMark;s&&(this.setMarkStyle(s,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),s.setMarkConfig({interactive:!1}));const n=this._gridBackgroundMark;n&&this.setMarkStyle(n,{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 r=this._gridMark;r&&this.setMarkStyle(r,{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 a=this._dotMark;a&&this.setMarkStyle(a,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const o=this._titleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._subTitleMark;l&&this.setMarkStyle(l,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const h=this._symbolMark;h&&this.setMarkStyle(h,{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(){var e,i;super.onLayoutEnd();const s=null!==(i=null===(e=this._spec)||void 0===e?void 0:e.leftAppendPadding)&&void 0!==i?i:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+s},"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:SO}}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 AR).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:SO}}initTooltip(){this._tooltipHelper=new VU(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}GU.type=cR.dot,GU.mark=WU,GU.builtInTheme={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"}}}}};class YU extends fF{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>mi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const $U=Object.assign(Object.assign({},wF),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),XU=(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 KU extends $F{constructor(){super(...arguments),this.type=cR.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 e;super.initData(),_I(this._option.dataSet,"linkDotInfo",XU),null===(e=this.getViewData())||void 0===e||e.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:t.TransformLevel.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(KU.mark.group),this._containerMark=this._createMark(KU.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(KU.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(KU.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},"normal",t.AttributeLevel.Series),r.setMarkConfig({interactive:!1,clip:!0}));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setMarkConfig({interactive:!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:SO}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new YU(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}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]}}KU.type=cR.link,KU.mark=$U,KU.builtInTheme={link:{arrow:{style:{size:10}}}};const qU=Object.assign(Object.assign({},wF),{group:{name:"group",type:"group"}});class ZU extends KN{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()?MO:jO],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle);let o;if(p(s)){const t=ht(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()?TO:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle),o=ht(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)?oe(n):Yz;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?oe(r):$z,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=TR(this.angleAxisHelper.dataToPosition([t[MO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=TR(this.angleAxisHelper.dataToPosition([t[TO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?TR(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(ZU.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+oe(a),o=oe(r)/2;return of(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[Dg({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_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 eW=()=>{YR.registerAnimation("circularProgress",((t,e)=>({appear:tW(t,e),enter:{type:"growAngleIn"},disappear:{duration:FD.disappear.duration}})))};class iW extends UF{constructor(){super(...arguments),this._supportStack=!0}}class sW extends ZU{constructor(){super(...arguments),this.type=cR.circularProgress,this.transformerConstructor=iW,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(){return this._progressMark=this._createMark(sW.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:jF(this._spec,"progress")}),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)}getInteractionTriggers(){const t=[];return 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(){return this._trackMark=this._createMark(sW.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),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()?MO:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?TO: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(IF(null===(i=YR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),DF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(IF(null===(s=YR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),DF("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}sW.type=cR.circularProgress,sW.mark=JU,sW.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},sW.transformerConstructor=iW;const nW=()=>{YR.registerSeries(sW.type,sW),oU(),eW(),VD(),EU(),wU()};function rW(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const aW={type:"fadeIn"};function oW(t,e="grow"){return!1===e?{}:"fadeIn"===e?aW:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:rW(t)}))(t)}class lW extends fF{enableByType(t){return"dimension"!==t}}const hW=Object.assign(Object.assign({},wF),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class cW extends $F{constructor(){super(...arguments),this.type=cR.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=p(e.width)?e.width:e.x1-e.x,o=p(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(cW.mark.progress,{isSeriesMark:!0}),u(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n;const r=this._progressMark;if(r)if("vertical"===this._spec.direction){const s=this._spec.progress||{},n=null!==(e=s.leftPadding)&&void 0!==e?e:0,a=null!==(i=s.rightPadding)&&void 0!==i?i:0;this.setMarkStyle(r,{x:t=>{var e,i;return TR(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),!0)-this._spec.bandWidth/2+n},y1:t=>{var e,i;return TR(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))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?TR(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-n-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=this._spec.progress||{},i=null!==(s=e.topPadding)&&void 0!==s?s:0,a=null!==(n=e.bottomPadding)&&void 0!==n?n:0;this.setMarkStyle(r,{x1:t=>{var e,i;return TR(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))},y:t=>{var e,s;return TR(this.dataToPositionY(t),null===(s=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===s?void 0:s.call(e,0),!0)-this._spec.bandWidth/2+i},height:this._spec.bandWidth-i-a,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?TR(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){return this._trackMark=this._createMark(cW.mark.track),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return TR(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),!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 TR(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),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series))}getInteractionTriggers(){const t=[];return 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(IF(null===(i=YR.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),DF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(IF(null===(s=YR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),DF("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new lW(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}cW.type=cR.linearProgress,cW.mark=hW,cW.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const dW=()=>{JH(),YR.registerAnimation("linearProgress",((t,e)=>({appear:oW(t,e),enter:oW(t),disappear:{duration:FD.disappear.duration}}))),VD(),YR.registerSeries(cW.type,cW)},uW=[0],pW=[20,40],gW=[200,500],fW={shrink:!1,enlarge:!1,fontSizeLimitMin:0},mW=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class vW{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const _W=`${mO}_WORD_CLOUD_TEXT`,yW=Object.assign(Object.assign({},wF),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),bW={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic",scaleX:1,scaleY:1}}};class xW extends WF{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},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._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=pW}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,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:gW,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:uW,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?_W:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:fW},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||Yy(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:uW,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!mW.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new vW(1e3))}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",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var e;this._wordMark=this._createMark(xW.mark.word,{key:xO,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(e=this._spec.wordMask)||void 0===e?void 0:e.visible)&&(this._maskMark=this._createMark(xW.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",t.AttributeLevel.Series)}initMarkStyleOfWord(e,i,s,n,r){var a,o;e&&(this.setMarkStyle(e,{text:(null==i?void 0:i.formatMethod)?t=>i.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{fill:null!==(o=null===(a=null==i?void 0:i.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(IF(YR.getAnimationInKey("wordCloud")(n,s),DF("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 AR).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:SO])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new PE).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new PE).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[bO])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(e=this._spec.word)&&void 0!==e?e:{},h=null!==(i=l.style)&&void 0!==i?i:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const e=()=>{var i,s,n,r;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((t=>t.fn!==e)),null===(s=(i=this._option).dispatchEvent)||void 0===s||s.call(i,t.ChartEvent.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(r=null===(n=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===n?void 0:n.afterWordcloudShapeDraw)||void 0===r||r.call(n,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:e})},dataIndexKey:xO,text:l.formatMethod?t=>l.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(n=null===(s=this._spec.word)||void 0===s?void 0:s.padding)&&void 0!==n?n:1,fontFamily:p(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(r=h.fontFamily)&&void 0!==r?r:this._defaultFontFamily,fontWeight:p(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:p(h.fontWeight)?h.fontWeight:p(this._valueField)?this._calculateFontWeight:"normal",fontStyle:p(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:h.fontStyle,createCanvas:k_.createCanvas.bind(k_),getTextBounds:mf}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,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,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:Wg,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:p(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:p(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:p(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}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(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}xW.mark=yW,xW.builtInTheme={wordCloud:bW};function SW(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||FD.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,d;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(d=t.children)||void 0===d?void 0:d.length){p.children=[],p.isLeaf=!1;const e=AW(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Tt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Tt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},kW=(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=kW(t.children,e,t,n))})),s},MW=(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=MW(t.children,e,t,n)),n=e(t,s,i,n)})),n},TW=(t,e=[],i)=>{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):TW(t.children,e,i)))})),e};function wW(t,e){let i,s;if(BW(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function BW(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 OW(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 IW(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 DW(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 FW(t){return{_:t,next:null,prev:null}}function zW(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];OW(n,s,r);let a,o,l,h,c,d,u,p=FW(s),g=FW(n),f=FW(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.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,this._valueField=null!==(e=null==t?void 0:t.valueField)&&void 0!==e?e:"value"}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=AW(t,n,0,-1,null,this._getNodeKey,this._valueField);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%Ct)/Ct}(),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:NW.defaultOpionts.nodeSort;kW([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)kW([o],jW(h)),MW([o],HW(this._getPadding,.5,a)),kW([o],VW(1,this._maxDepth));else{const t=Math.min(s.width,s.height);kW([o],jW(NW.defaultOpionts.setRadius)),MW([o],HW(Rt,1,a)),c&&MW([o],HW(this._getPadding,o.radius/t,a)),kW([o],VW(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}NW.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const UW=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=UW(t.children):t.value=0),e+=Math.abs(t.value)})),e};function WW(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){UW(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=u(t.value)?0:Tt(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=H(t,["parents"]);if(a.parents=t.parents.map((t=>H(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=Tt(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function GW(t){return t.depth}function YW(t,e){return e-1-t.endDepth}const $W=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),XW=(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},KW={left:GW,right:YW,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?K(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:GW,end:YW},qW=bt(0,1);class ZW{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({},ZW.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._logger=ot.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):KW[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)};"vertical"===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<=0)return null;const a=this.computeNodeBreadths(n);if(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))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;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}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return 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){return WW(t,this._getNodeKey)}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=[XW(s[t.source]),XW(s[t.target],!0)].filter((t=>!u(t)));e.length&&(t.value=K(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){return function(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))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=d(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}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=_t(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;ea)&&(o=a);let l=0,h=null,c=null;if(d(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)c=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:c>0?t=>c:t=>Math.max(t.value*l,0),m=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*qW(t.value/e.value):0,n,0),o);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;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,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{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];JW(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),QW);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({},tG.defaultOpionts,t):Object.assign({},tG.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Lt(this.options.center[0],t.width),s=t.y0+Lt(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=>Lt(t,n))):Lt(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>Lt(t,n))):Lt(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=Lt(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=AW(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=ce({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)}}}function eG(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(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,f,m,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,_=Math.max(v/x,x/m),_>y){f-=h;break}y=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{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*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:JW,slice:eG,sliceDice:function(t,e,i,s,n){(t.depth%2==1?eG:JW)(t,e,i,s,n)}};class nG{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({},nG.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?Pt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?iG(this.options.aspectRatio):null!==(e=sG[this.options.splitType])&&void 0!==e?e:sG.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=AW(t,n,0,-1,null,this._getNodeKey,this.options.valueField);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)}))}}function rG(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+ci?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return ot.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=rG(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=Ci(o.map(Ci))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rwt(e)));u=Ri(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=aG(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&ot.getInstance().error("Area "+r+" not represented on screen")}return i}function pG(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Pi((function(i){return-1*gG({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},mG=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=Y(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!P(Y(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:Y(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||lG,s=e.lossFunction||oG,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=Y(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];di(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rae.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:fG(f),arcs:f})}))},vG={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:_G,triangle:_G,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.955)%(2*Math.PI/5)-2*Math.PI/10>=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 _G(){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 yG(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*.4),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"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const bG=t=>vG[t]?vG[t]():vG.circle(),xG=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function SG(t){return d(t)?t:function(){return t}}class AG{constructor(t){var e,i;switch(this.options=j({},AG.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=bG(this.options.shape),this.getText=null!==(e=SG(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=SG(this.options.fontWeight),this.getTextFontSize=SG(this.options.fontSize),this.getTextFontStyle=SG(this.options.fontStyle),this.getTextFontFamily=SG(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>xG(10,50);break;case"random-light":this.getTextColor=()=>xG(50,90);break;default:this.getTextColor=SG(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 oe(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():wt(e);return oe(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+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:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1: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 MG extends AG{constructor(t){var e;super(j({},MG.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<=MG.defaultOptions.minFontSize&&(this.options.minFontSize=MG.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=kG[this.options.spiral])&&void 0!==e?e:kG.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=SG(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}=yG(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,f,m;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,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,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._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=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(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=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}));if(this.originalData=s,this.data=s,this.progressiveRun(),!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._originSize[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],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});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 f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);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*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(EG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(CG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}EG(p,this._size)&&(p=BG(p,this._size))}else if(EG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||wG(p,i))&&(!i||!TG(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 TG(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 wG(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,EG=(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 BG(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{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const u=n.measureText(h),g="normal"!==o?1.1:1,f=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(u.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},LG=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>ce(t,e,i+r*n)))},RG=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},OG=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=yG(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=bG("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return ce(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)RG(n,LG({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)RG(n,LG({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)RG(n,LG({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)RG(n,LG({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)RG(n,LG({x:l,y:h},o,0,3));else if("star"===t.shape){const t=LG({x:l,y:h},o,-Math.PI/2,5),e=LG({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);RG(n,i)}else n.fillRect(0,0,i,s)}; /*! * wordcloud2.js * http://timdream.org/wordcloud2.js/ @@ -20,4 +20,4 @@ * Copyright 2011 - 2019 Tim Guan-tin Chien and contributors. * Released under the MIT license */ -let wG=class t extends fG{constructor(e){super(j({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{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,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize: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=this.options.createCanvas({width:1,height:1}),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 f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),_=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*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],B=(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--;)B(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}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=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,e=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){this.grid=[];const e=this.options.shape;if(g(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?AG(t,o,l.width,l.height,h):"geometric"===t.type&&TG(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!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)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,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}=dG(this.options.shape,[e.width,e.height]);return 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),this.result=[],this.progressiveRun()}};wG.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class CG extends fG{constructor(t){super(j({},CG.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,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)}CG.defaultOptions={enlarge:!1};const BG={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},PG=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return ot.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?LG(t.fontFamily):"sans-serif",d=t.fontStyle?LG(t.fontStyle):"normal",u=t.fontWeight?LG(t.fontWeight):"normal",p=t.rotate?LG(t.rotate):0,g=LG(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?LG(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?Object.assign(Object.assign({},BG),t.as):BG,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?LG(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=OG(IG(t,l),C);w=i=>e(t(i))}let E=vG;"fast"===t.layoutType?E=CG:"grid"===t.layoutType&&(E=wG);const B=new E(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:w,shrink:_,clip:b,enlarge:y,minFontSize:x,random:A,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:B}:B.output()},LG=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],RG=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),OG=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=RG(t[0]),n=RG(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(RG(t)-r)/(a-r)*(e[1]-e[0])+e[0]},IG=(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 DG(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{zR.registerGrammarTransform("wordcloud",{transform:PG}),TV(),zR.registerAnimation("wordCloud",((t,e)=>({appear:gW(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:ED.disappear.duration}}))),zR.registerSeries(FG.type,FG)},jG=(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:f=!1,isCone:m=!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===f?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?m?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},HG=(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},NG=`${lO}_FUNNEL_TRANSFORM_RATIO`,VG=`${lO}_FUNNEL_REACH_RATIO`,UG=`${lO}_FUNNEL_HEIGHT_RATIO`,WG=`${lO}_FUNNEL_VALUE_RATIO`,GG=`${lO}_FUNNEL_LAST_VALUE_RATIO`,YG=`${lO}_FUNNEL_NEXT_VALUE_RATIO`,$G=`${lO}_FUNNEL_LAST_VALUE`,XG=`${lO}_FUNNEL_CURRENT_VALUE`,KG=`${lO}_FUNNEL_NEXT_VALUE`,qG=`${lO}_FUNNEL_TRANSFORM_LEVEL`;class ZG extends oF{constructor(t){var e,i;super(t),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)?this._transformRatioText: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[VG])).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 this._transformRatioText;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]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class JG extends bD{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class QG extends JG{constructor(){super(...arguments),this.type=QG.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}QG.type="polygon";const tY=()=>{zR.registerMark(QG.type,QG),Jk(),Yk(),pw.registerBuiltInAnimate("growPointsOut",cC),zR.registerGraphicComponent("polygon",cf)},eY=Object.assign(Object.assign({},yF),{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"}});class iY extends IF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class sY extends DF{constructor(){super(...arguments),this.type=iR.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=iY,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,i,s,n;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._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;cI(this._dataSet,"funnel",jG),cI(this._dataSet,"funnelTransform",HG);const t=new Pa(this._dataSet,{name:`${lO}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new fD(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}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:XG,asTransformRatio:NG,asReachRatio:VG,asHeightRatio:UG,asValueRatio:WG,asNextValueRatio:YG,asLastValueRatio:GG,asLastValue:$G,asNextValue:KG,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:qG}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},sY.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:PF(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},sY.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),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(sY.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(sY.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new ZG(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(){var e,i,s,n;const r=this._funnelMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const a=this._funnelTransformMark;a&&this.setMarkStyle(a,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const o=this._funnelOuterLabelMark.label;o&&(this.setMarkStyle(o,{text:t=>`${t[this.getCategoryField()]}`,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),width:0,height:0},"normal",t.AttributeLevel.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(o,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",t.AttributeLevel.User_Mark));const l=this._funnelOuterLabelMark.line;if(l&&o){this.setMarkStyle(l,{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);const r=null!==(s=null===(i=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.line)||void 0===i?void 0:i.visible)&&void 0!==s?s:null===(n=this._spec.outerLabel)||void 0===n?void 0:n.visible;p(r)&&l.setVisible(r)}}initLabelMarkStyle(e){var i;if(!e)return;const s=e.getTarget(),n=e.getComponent();if(s===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);const s=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&jy(s,this._funnelOuterLabelMark.label,n),this._funnelOuterLabelMark.line&&jy(s,this._funnelOuterLabelMark.line,null!==(i=this._funnelOuterLabelMark.label)&&void 0!==i?i:n)}else this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*QL(VG).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(wF(null===(s=zR.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.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),CF("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(wF(zR.getAnimationInKey("fadeInOut")(),CF(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(wF(zR.getAnimationInKey("funnel")({},o),CF(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(wF(null===(a=zR.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),CF("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[GG])/2:this._getSecondaryAxisLength(t[WG])/2,n=this._getSecondaryAxisLength(t[WG])/2):(s=this._getSecondaryAxisLength(t[WG])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[YG])/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[qG])}_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[pO]===t[pO]));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,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,_,y;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h: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!==f.alignLabel?(null==u?void 0:u.y2)+e:_-e,m=this._getPolygonCenter(i).x,_-y{tY(),TV(),FN(),zR.registerSeries(sY.type,sY),zR.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},PD))),zR.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Yw,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),RD()},rY=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},aY=t=>{const e=t.filter((t=>t.context.diffState===UI.update)),i=K(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},oY=(t,e,i)=>{if(P(t))return[e,i];const s=K(t.map((t=>1*t.getFinalAttribute().startAngle))),n=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},lY=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=aY(i.parent.children),a=oY(r,s,n);return rY(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=aY(i.parent.children),a=oY(r,s,n);return rY(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),hY=t=>{const e=K(t.map((t=>1*t.getFinalAttribute().startAngle))),i=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},cY=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=aY(i.parent.children),a=hY(r);return rY(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=aY(i.parent.children),a=hY(r);return rY(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),dY=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},uY=(t,e={})=>{if(!t)return[];const i=[];return _W(t,i,e),i},pY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new YW(i).layout(t,{width:s,height:n})};class gY extends oF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var fY;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(fY||(fY={}));const mY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===fY.DrillDown){return Y(WO(t,n,s,"children"))}if(i.type===fY.DrillUp){const e=GO(t,n,s,"children");if(e)return Y(e)}return t};class vY{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=bN(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;cI(t,"drillFilter",mY),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)||P(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:fY.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:fY.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)||P(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:fY.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:fY.DrillUp},model:this}),r}}const _Y=Object.assign(Object.assign({},yF),{sunburst:{name:"sunburst",type:"arc"}}),yY=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:uF,operations:["max","min","values"]}),t.push({key:pF,operations:["values"]}),t),bY={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,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"}}}};class xY extends NV{constructor(){super(...arguments),this.type=iR.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:pF),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:pO},getRawData:()=>this.getRawData()}),this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(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),cI(this._dataSet,"sunburstLayout",pY),cI(this._dataSet,"flatten",uY),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 yY(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(cI(t.dataSet,"addVChartProperty",tF),t.transform({type:"addVChartProperty",options:{beforeCall:vF.bind(this),call:_F}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(xY.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_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()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(xY.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new gY(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(wF(null===(e=zR.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),CF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(wF(null===(e=zR.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),CF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),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]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}xY.type=iR.sunburst,xY.mark=_Y,xY.builtInTheme={sunburst:bY},G(xY,vY);const SY=()=>{zR.registerSeries(xY.type,xY),QV(),TV(),RD(),zR.registerAnimation("sunburst",((t,e)=>({appear:dY(0,e),enter:lY(t),exit:cY(t),disappear:{duration:ED.disappear.duration}})))},AY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new OW(i).layout(t,{width:s,height:n})};class kY extends oF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const MY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},TY=Object.assign(Object.assign({},yF),{circlePacking:{name:"circlePacking",type:"arc"}});class wY extends jF{constructor(){super(...arguments),this.type=iR.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:pF),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:pO},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),cI(this._dataSet,"circlePackingLayout",AY),cI(this._dataSet,"flatten",uY),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)||(cI(t.dataSet,"addVChartProperty",tF),t.transform({type:"addVChartProperty",options:{beforeCall:vF.bind(this),call:_F}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(wY.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_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},t.STATE_VALUE_ENUM.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(wY.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"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return yY(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new kY(this),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(wF(null===(i=zR.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),CF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(wF(null===(e=zR.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),CF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}wY.type=iR.circlePacking,wY.mark=TY,wY.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,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"}}}}},G(wY,vY);const CY=()=>{zR.registerSeries(wY.type,wY),QV(),TV(),LD(),zR.registerAnimation("circlePacking",((t,e)=>({appear:MY(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:ED.disappear.duration}})))},EY=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&EY(t,e.children,i)}))},BY=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},PY=(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 UW(e),r=[];return r.push(n.layout(s,i)),r},LY=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:[]},RY=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 OY extends oF{constructor(){super(...arguments),this._getDimensionData=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},this.markTooltipValueCallback=t=>t.value}}const IY=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),DY=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:IY(t),FY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class zY extends kw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class jY extends kw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const HY=(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,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=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}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},NY=(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,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=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}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class VY extends oV{constructor(){super(...arguments),this.type=VY.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?NY:HY,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}VY.type="linkPath";const UY=Object.assign(Object.assign({},yF),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class WY extends IF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const GY=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&t.removeState(e),t.addState(e,s,n)};class YY extends jF{constructor(){super(...arguments),this.type=iR.sankey,this.transformerConstructor=WY,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new Ne,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;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(p(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var e,i;if(!this._needClear)return;const s=null===(e=this._nodeMark)||void 0===e?void 0:e.getGraphics();if(!s||!s.length)return;const n=null===(i=this._linkMark)||void 0===i?void 0:i.getGraphics();n&&n.length&&(s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),n.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._needClear=!1)},this._handleNodeAdjacencyClick=e=>{const i=JO(e),s=[i.key];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,n)=>{const r=JO(e);r.source===i.key?(s.includes(r.target)||s.push(r.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):r.target===i.key?(s.includes(r.source)||s.push(r.source),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleLinkAdjacencyClick=e=>{const i=JO(e),s=[i.source,i.target];if(this._linkMark){const i=this._linkMark.getGraphics();if(!i||!i.length)return;i.forEach((i=>{i===e?(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),GY(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1})):(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),i.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleNodeRelatedClick=e=>{var i;const s=JO(e),n=this._nodeMark.getGraphics();if(!n||!n.length)return;const r=this._linkMark.getGraphics();if(!r||!r.length)return;const a=(null===(i=JO(r[0]))||void 0===i?void 0:i.parents)?"parents":"source";if("source"===a){const e=[s.key],i=[];if(r.forEach(((t,r)=>{var a,o,l,h;const c=JO(t),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(s.key)){if(i.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||i.push(null!==(o=c.key)&&void 0!==o?o:c.index),e.includes(c.source)||e.push(c.source),!e.includes(c.target)){e.push(c.target);let t=n.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.target))){e.push(t.target);const i=n.find((e=>e.data[0].key===t.target));s.push(i.data[0].targetLinks)}})),void(t=s)}}}else if(c.target===s.key&&(i.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||i.push(null!==(h=c.key)&&void 0!==h?h:c.index),!e.includes(c.source))){e.push(c.source);let t=n.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.source))){e.push(t.source);const i=n.find((e=>e.data[0].key===t.source));s.push(i.data[0].targetLinks)}})),void(t=s)}}})),this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,s)=>{var n;const r=JO(e);i.includes(null!==(n=r.key)&&void 0!==n?n:r.index)?(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}else{const e=[s.key],i=s.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const i=e.parents,n=i.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);r.forEach(((n,r)=>{const o=JO(n),l=o.datum,h=l?l.filter((t=>t[a].some((t=>t.key===s.key)))):null,c=i.find((t=>t.source===o.source&&t.target===o.target));if(h&&h.length){e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target);const i=h.reduce(((t,e)=>t+e.value),0),s=i/o.value;return n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void GY(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:s})}if(c)return e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target),n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void GY(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:c.value/o.value});n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),n.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}this._needClear=!0},this._handleLinkRelatedClick=e=>{const i=this._nodeMark.getGraphics();if(!i||!i.length)return;const s=this._linkMark.getGraphics();if(!s||!s.length)return;if("source"===(JO(e)?"parents":"source"))this._linkMark&&s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&i.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)}));else{const n=JO(e),r=[n.source,n.target],a=[];Y(n.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));a.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=r:a.push({source:i,target:n,value:r})}})),s.forEach((e=>{const i=JO(e),s=i.datum;if(i.source===n.source&&i.target===n.target)return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void GY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1});const o=s?s.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(n.source)&&e.includes(n.target)})):null;if(o&&o.length){r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target);const s=o.filter((t=>t.parents.some(((e,i)=>{var s;return e.key===n.source&&(null===(s=t.parents[i+1])||void 0===s?void 0:s.key)===n.target})))).reduce(((t,e)=>t+e.value),0),a=s/i.value;return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void GY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:a})}const l=a.find((t=>t.source===i.source&&t.target===i.target));if(l)return r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void GY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:l.value/i.value});e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(i,r)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}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:this._spec.categoryField)}initData(){var e,i,s,n;super.initData();const r=this.getViewData(),a=this.getRawData();if(a&&r){cI(this._dataSet,"sankeyLayout",PY),cI(this._dataSet,"sankeyFormat",BY),a.transform({type:"sankeyFormat"},!1),r.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.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(e=this._spec.nodeAlign)&&void 0!==e?e:"justify",nodeGap:null!==(i=this._spec.nodeGap)&&void 0!==i?i:8,nodeWidth:null!==(s=this._spec.nodeWidth)&&void 0!==s?s:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(n=this._spec.minNodeHeight)&&void 0!==n?n:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,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,inverse:this._spec.inverse},level:t.TransformLevel.sankeyLayout});const{dataSet:o}=this._option;cI(o,"sankeyNodes",LY),cI(o,"flatten",uY);const l=new Pa(o,{name:`sankey-node-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyNodes"}),l.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),l.transform({type:"addVChartProperty",options:{beforeCall:fF.bind(this),call:mF}},!1),this._nodesSeriesData=l,cI(o,"sankeyLinks",RY);const h=new Pa(o,{name:`sankey-link-${this.id}-data`});h.parse([this.getViewData()],{type:"dataview"}),h.transform({type:"sankeyLinks"}),h.transform({type:"addVChartProperty",options:{beforeCall:fF.bind(this),call:mF}},!1),this._linksSeriesData=h}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(YY.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(YY.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,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()}_initNodeMarkStyle(){var e,i;const s=this._nodeMark;s&&(this.setMarkStyle(s,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Mark),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.node.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByNode},"normal",t.AttributeLevel.User_Mark))}_initLinkMarkStyle(){var e,i;const s=this._linkMark;s&&(s.setGlyphConfig({direction:this.direction}),this.setMarkStyle(s,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.link.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByLink},"normal",t.AttributeLevel.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=ZD(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={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;this._nodeMark&&this._nodeMark.setAnimationConfig(wF(null===(i=zR.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),CF("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(wF(null===(s=zR.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),CF("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:rI.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(e,i){e&&e.length&&e.forEach((e=>{e.removeState([t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]),i.includes(JO(e).key)?e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0):e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new OY(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_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&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new fR;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_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 EY(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),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]}getMarkData(t){return t.datum?y(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}YY.type=iR.sankey,YY.transformerConstructor=WY,YY.mark=UY,YY.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const $Y=()=>{WH(),lV(),Wk(),zR.registerGraphicComponent("path",(t=>tf(t))),zR.registerMark(VY.type,VY),TV(),zR.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:DY(t,e)},PD))),zR.registerAnimation("sankeyLinkPath",((t,e)=>({appear:FY(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:ED.disappear.duration}}))),pw.registerBuiltInAnimate("linkPathGrowOut",jY),pw.registerBuiltInAnimate("linkPathGrowIn",zY),RD(),zR.registerSeries(YY.type,YY)},XY=(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=uY(n);return i=hF([{latestData:r}],e),i};class KY extends oF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const qY=Object.assign(Object.assign({},yF),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),ZY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class JY extends IF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const QY=(t,e)=>{if(e.getViewBox()){const i=new qW(e).layout(t,e.getViewBox()),s=[];return _W(i,s,{maxDepth:null==e?void 0:e.maxDepth}),s.forEach(((t,i)=>{t&&[pF,"name"].forEach((i=>{t[i]=t.datum[t.depth][e.nameField]}))})),s}return[]};class t$ extends jF{constructor(){super(...arguments),this.type=iR.treemap,this.transformerConstructor=JY,this._categoryField="name",this._valueField="value",this._viewBox=new Ne,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:pF),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new We),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:pO},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,s,n;super.initData(),cI(this._dataSet,"treemap",QY),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{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}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(cI(this._rawData.dataSet,"addVChartProperty",tF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:vF.bind(this),call:_F}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=XY([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=j(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){cI(this._dataSet,"hierarchyDimensionStatistics",XY),cI(this._dataSet,"flatten",uY);const i=new Pa(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 yY(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(t$.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(t$.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}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()},t.STATE_VALUE_ENUM.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()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRichStyleOfLabelMark(e){"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(wF(null===(e=zR.getAnimationInKey("treemap"))||void 0===e?void 0:e(),CF(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 KY(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(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(eI.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(eI.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}t$.type=iR.treemap,t$.mark=qY,t$.builtInTheme={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"}}}},t$.transformerConstructor=JY,G(t$,vY),G(t$,SN);const e$=()=>{zR.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),zR.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),WH(),TV(),zR.registerAnimation("treemap",((t,e)=>({appear:ZY(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:ED.disappear.duration}}))),RD(),zR.registerSeries(t$.type,t$)},i$=Object.assign(Object.assign({},VU),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),s$=Object.assign(Object.assign({},yF),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),n$={type:"fadeIn"};function r$(t,e){return"fadeIn"===e?n$:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class a$ extends IF{constructor(){super(...arguments),this._supportStack=!1}}class o$ extends oF{enableByType(t){return"dimension"!==t}}const l$="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",h$={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:l$,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:l$,fill:"#ddd"}}};class c$ extends UU{constructor(){super(...arguments),this.type=iR.gaugePointer,this.transformerConstructor=a$,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(c$.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},c$.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(c$.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(){this._tooltipHelper=new o$(this),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=K(e),n=_t(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})}getInteractionTriggers(){return 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(wF(null===(i=zR.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),CF("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}c$.type=iR.gaugePointer,c$.mark=s$,c$.builtInTheme={gaugePointer:h$},c$.transformerConstructor=a$;const d$=()=>{zR.registerSeries(c$.type,c$),fN(),WH(),zR.registerAnimation("gaugePointer",((t,e)=>{const i=r$(t,e);return{appear:i,enter:i,disappear:{duration:ED.disappear.duration}}})),xU(),yU()};class u$ extends IF{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class p$ extends UU{constructor(){super(...arguments),this.type=iR.gauge,this.transformerConstructor=u$,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=oe(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();cI(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[LO]=t[this._angleField[0]],t[PO]=e>0?i[e-1][LO]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(p$.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(p$.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})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e&&"segment"===e.name){const i=this.getSpec().segment;if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}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),s=bt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?_R(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?_R(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return p(t[PO])?this.angleAxisHelper.dataToPosition([t[PO]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[LO]])}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(wF(null===(i=zR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),CF("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}p$.type=iR.gauge,p$.mark=i$,p$.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},p$.transformerConstructor=u$;class g$ extends bD{constructor(){super(...arguments),this.type=g$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Eg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="rect":a.symbolType=o,a}}g$.type="cell";function f$(t){return!1===t?{}:{type:"fadeIn"}}class m$ extends oF{enableByType(t){return"dimension"!==t}}const v$=Object.assign(Object.assign({},yF),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class _$ extends IF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class y$ extends jF{constructor(){super(...arguments),this.type=iR.heatmap,this.transformerConstructor=_$}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(y$.mark.cell,{isSeriesMark:!0},{morph:PF(this._spec,y$.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(y$.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){var e,i,s;t&&this.setMarkStyle(t,{fill:null!==(s=null===(i=null===(e=this._spec.cell)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s: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=ai(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]}}getInteractionTriggers(){return 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=zF(this);this._cellMark.setAnimationConfig(wF(null===(i=zR.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),CF("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 m$(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}y$.type=iR.heatmap,y$.mark=v$,y$.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1},label:{style:{lineWidth:2}}}},y$.transformerConstructor=_$;const b$=()=>{TV(),zR.registerMark(g$.type,g$),zR.registerGraphicComponent("symbol",Eg),Jk(),tM(),kB(),zR.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},PD),{appear:f$(e)}))),bj(),mj(),zR.registerSeries(y$.type,y$)},x$=Object.assign(Object.assign({},yF),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),S$=`${lO}_CORRELATION_X`,A$=`${lO}_CORRELATION_Y`,k$=`${lO}_CORRELATION_SIZE`,M$=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,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=oe(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=oe(null!==(s=e.endAngle)&&void 0!==s?s:270),A=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),k=Lt(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=Lt(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+Lt(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+Lt(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=Pt(e.field),C=t.map(w),[E,B]=Ot(C),P=E===B?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(B-E),L=u(e.radiusField)?w:Pt(e.radiusField),R=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=>R;if(L){const[i,s]=L!==w?Ot(t.map(L)):[E,B],n=null!==(f=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==f?f:5,r=null!==(v=null===(m=e.radiusRange)||void 0===m?void 0:m[1])&&void 0!==v?v:5;i!==s&&(O=t=>n+(r-n)*(L(t)-i)/(s-i))}const I=Math.min(b,x),D=Math.max(b,x),F=T$(I,D,t.length),z=[],j=(D-I)/60;return t.forEach(((t,e)=>{const i=P(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),w$({x:n,y:r,size:s},z)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=j,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},w$=(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,[uO]:null==n?void 0:n[uO],[gO]:null==n?void 0:n[gO]}};class E$ extends oV{constructor(){super(...arguments),this.type=E$.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=_t(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}E$.type="ripple";const B$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class P$ extends IF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class L$ extends NV{constructor(){super(...arguments),this.type=iR.correlation,this.transformerConstructor=P$,this._viewBox=new Ne}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;cI(this._dataSet,"correlation",M$);const s=new Ba;dI(s,"dataview",wa),cI(s,"correlationCenter",C$);const n=new Pa(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 fD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_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(){const e=this._createMark(L$.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:uO});e&&(e.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._nodePointMark=e);const i=this._createMark(L$.mark.ripplePoint,{key:uO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(this._ripplePointMark=i);const s=this._createMark(L$.mark.centerPoint,{key:uO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});s&&(s.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._centerPointMark=s)}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[S$],y:t=>t[A$],size:t=>t[k$],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.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)},t.STATE_VALUE_ENUM.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(wF(null===(e=zR.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),CF("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(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}L$.type=iR.correlation,L$.mark=x$,L$.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},L$.transformerConstructor=P$;const R$=()=>{dz(),lV(),tM(),zR.registerMark(E$.type,E$),zR.registerGraphicComponent("symbol",(t=>Eg(t))),zR.registerSeries(L$.type,L$),zR.registerAnimation("correlation",((t,e)=>Object.assign({appear:B$(0,e)},BD)))},O$=Object.assign(Object.assign({},yF),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class I$ extends oV{constructor(){super(...arguments),this.type=I$.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}I$.type="liquid";const D$=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class F$ extends oF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class z$ extends DF{constructor(){super(...arguments),this.type=iR.liquid,this.transformerConstructor=uz,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Dg({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Eg({x:s,y:n,size:r,symbolType:D$(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=wR(this._spec.outlineMargin),this._paddingSpec=wR(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Yt(...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(z$.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(z$.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(z$.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(z$.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.created(),this.setMarkStyle(e,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new F$(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(wF(null===(i=zR.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),CF("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(wF(null===(s=zR.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),CF("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=kM(t.attribute.fill,n.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]}}z$.type=iR.liquid,z$.mark=O$,z$.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},z$.transformerConstructor=uz;const j$=t=>Y(t).join(",");class H$ extends oF{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>j$(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>j$(null==t?void 0:t[this.series.getDimensionField()[0]])}}const N$=Object.assign(Object.assign({},yF),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class V$ extends IF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const U$=(t,e)=>{const i=e.getViewBox();return i&&(null==t?void 0:t.length)?lG(Object.assign({setField:e.setField,valueField:e.valueField},i),t):[]};class W$ extends DF{constructor(){super(...arguments),this.type=iR.venn,this.transformerConstructor=V$,this._viewBox=new Ne}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:pO)}initData(){var t;super.initData(),cI(this._dataSet,"venn",U$),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:{getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField}})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(W$.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(W$.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()},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},t.STATE_VALUE_ENUM.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=>j$(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)}},t.STATE_VALUE_ENUM.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=>j$(t.sets)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new H$(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(){super.onLayoutEnd(),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:j$(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return j$(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[j$(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(j$(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(wF(null===(e=zR.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),CF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(wF(null===(e=zR.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),CF(t.name,this._spec,this._markAttributeContext)))}))}}W$.type=iR.venn,W$.mark=N$,W$.builtInTheme={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"}}}}},W$.transformerConstructor=V$;class G$ extends KH{constructor(){super(...arguments),this.type=iR.mosaic,this.transformerConstructor=XH}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(CO),this.setFieldX2(wO)),this.setFieldY(BO),this.setFieldY2(EO)):(t&&(this.setFieldY(CO),this.setFieldY2(wO)),this.setFieldX(BO),this.setFieldX2(EO)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&u(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];u(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}G$.type=iR.mosaic,G$.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},G$.transformerConstructor=XH;class Y$ extends Uj{_isValidSeries(t){return t===iR.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class $$ extends Nj{constructor(){super(...arguments),this.transformerConstructor=Y$,this.type="map",this.seriesType=iR.map}}$$.type="map",$$.seriesType=iR.map,$$.transformerConstructor=Y$;class X$ extends Uj{_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,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],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 K$ extends X${needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_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=kz(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,FR({},s,l)),n&&Object.assign(o,FR({},n,o))}}class q$ extends X${needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}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 Z$ extends X${needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class J$ extends Nj{constructor(){super(...arguments),this.transformerConstructor=Z$}}J$.transformerConstructor=Z$;class Q$ extends J${constructor(){super(...arguments),this.transformerConstructor=Z$,this.type="pie",this.seriesType=iR.pie}}Q$.type="pie",Q$.seriesType=iR.pie,Q$.transformerConstructor=Z$;class tX extends q${_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return n.radius=null!==(e=t.radius)&&void 0!==e?e:Hz,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:Hz,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}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=>FR({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const eX=(t,e)=>{if(!t)return null;const i=QF(t,(t=>"angle"===t.getOrient()),e),s=QF(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&UC(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=$L({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=K(e),n=X(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=XL(d),f=null===(e=s[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 _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=ZF(v,t,"polar",r);n.push({index:_,value:v,position:i.scale(v),axis:t,data:y})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&UC(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=$L({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=XL(c),g=null===(e=i[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=s.invert(p);if(u(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const _=ZF(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:_})}})),n.length?n:null};class iX extends Nj{constructor(){super(...arguments),this.transformerConstructor=tX,this.type="rose",this.seriesType=iR.rose}_setModelOption(){this._modelOption.getDimensionInfo=eX}}iX.type="rose",iX.seriesType=iR.rose,iX.transformerConstructor=tX,G(iX,Xj);class sX extends q${_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t);return i.line=t.line,i.point=t.point,i.stack=t.stack,i.percent=t.percent,i.area=FR({visible:!1},t.area),i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"area",i.activePoint=t.activePoint,i.pointDis=t.pointDis,i.pointDisMul=t.pointDisMul,i.markOverlap=t.markOverlap,i}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=>FR({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class nX extends Nj{constructor(){super(...arguments),this.transformerConstructor=sX,this.type="radar",this.seriesType=iR.radar}_setModelOption(){this._modelOption.getDimensionInfo=eX}}nX.type="radar",nX.seriesType=iR.radar,nX.transformerConstructor=sX,G(nX,Xj);class rX extends Uj{_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=>{L(e,"trimPadding")&&FR(e,jI(this.type,t))})),this._transformAxisSpec(t)}}class aX extends Nj{constructor(){super(...arguments),this.transformerConstructor=rX,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=nH(t,e,i))&&void 0!==s?s:[],...null!==(n=eX(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=aH,this._modelOption.getRectByDimensionData=uH}}aX.type="common",aX.transformerConstructor=rX,G(aX,Xj);class oX extends Wj{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class lX extends Nj{constructor(){super(...arguments),this.transformerConstructor=oX}}lX.transformerConstructor=oX,G(lX,Xj);class hX extends oX{transformSpec(t){super.transformSpec(t),DI(t)}}class cX extends lX{constructor(){super(...arguments),this.transformerConstructor=hX,this.type="histogram",this.seriesType=iR.bar}_setModelOption(){this._modelOption.getDimensionInfo=nH,this._modelOption.getDimensionInfoByValue=aH,this._modelOption.getRectByDimensionData=uH}}cX.type="histogram",cX.seriesType=iR.bar,cX.transformerConstructor=hX;class dX extends K${_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class uX extends Nj{constructor(){super(...arguments),this.transformerConstructor=dX,this.type="circularProgress",this.seriesType=iR.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=eX}}uX.type="circularProgress",uX.seriesType=iR.circularProgress,uX.transformerConstructor=dX,G(uX,Xj);class pX extends K${_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=iR.circularProgress,e}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===iR.gauge||t.type===iR.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===iR.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 gX extends Nj{constructor(){super(...arguments),this.transformerConstructor=pX,this.type="gauge",this.seriesType=iR.gaugePointer}}gX.type="gauge",gX.seriesType=iR.gaugePointer,gX.transformerConstructor=pX;class fX extends Uj{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class mX extends Nj{constructor(){super(...arguments),this.transformerConstructor=fX,this.type="wordCloud",this.seriesType=iR.wordCloud}}mX.transformerConstructor=fX;class vX extends mX{constructor(){super(...arguments),this.transformerConstructor=fX,this.type="wordCloud",this.seriesType=iR.wordCloud}}vX.type="wordCloud",vX.seriesType=iR.wordCloud,vX.transformerConstructor=fX;class _X extends Uj{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class yX extends Nj{constructor(){super(...arguments),this.transformerConstructor=_X,this.type="funnel",this.seriesType=iR.funnel}}yX.type="funnel",yX.seriesType=iR.funnel,yX.transformerConstructor=_X;class bX extends Wj{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}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=kz(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=kz(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class xX extends Nj{constructor(){super(...arguments),this.transformerConstructor=bX,this.type="linearProgress",this.seriesType=iR.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=nH,this._modelOption.getDimensionInfoByValue=aH,this._modelOption.getRectByDimensionData=uH}}xX.type="linearProgress",xX.seriesType=iR.linearProgress,xX.transformerConstructor=bX,G(xX,Xj);class SX extends Wj{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"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),DI(t)}}class AX extends Nj{constructor(){super(...arguments),this.transformerConstructor=SX,this.type="rangeColumn",this.seriesType=iR.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=nH,this._modelOption.getDimensionInfoByValue=aH,this._modelOption.getRectByDimensionData=uH}}AX.type="rangeColumn",AX.seriesType=iR.rangeColumn,AX.transformerConstructor=SX;class kX extends Uj{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+le(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class MX extends Nj{constructor(){super(...arguments),this.transformerConstructor=kX,this.type="sunburst",this.seriesType=iR.sunburst}}MX.type="sunburst",MX.seriesType=iR.sunburst,MX.transformerConstructor=kX;class TX extends Uj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class wX extends Nj{constructor(){super(...arguments),this.transformerConstructor=TX,this.type="circlePacking",this.seriesType=iR.circlePacking}}wX.type="circlePacking",wX.seriesType=iR.circlePacking,wX.transformerConstructor=TX;class CX extends Uj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class EX extends Nj{constructor(){super(...arguments),this.transformerConstructor=CX,this.type="treemap",this.seriesType=iR.treemap}}EX.type="treemap",EX.seriesType=iR.treemap,EX.transformerConstructor=CX;class BX extends ZH{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),DI(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class PX extends JH{constructor(){super(...arguments),this.transformerConstructor=BX,this.type="waterfall",this.seriesType=iR.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=nH,this._modelOption.getDimensionInfoByValue=aH,this._modelOption.getRectByDimensionData=uH}}PX.type="waterfall",PX.seriesType=iR.waterfall,PX.transformerConstructor=BX;class LX extends Wj{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),DI(t)}}class RX extends Nj{constructor(){super(...arguments),this.transformerConstructor=LX,this.type="boxPlot",this.seriesType=iR.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=nH,this._modelOption.getDimensionInfoByValue=aH,this._modelOption.getRectByDimensionData=uH}}RX.type="boxPlot",RX.seriesType=iR.boxPlot,RX.transformerConstructor=LX;class OX extends Uj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class IX extends Nj{constructor(){super(...arguments),this.transformerConstructor=OX,this.type="sankey",this.seriesType=iR.sankey}_setStateInDatum(t,e,i,s){const n=y(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=JO(t))||void 0===e?void 0:e.datum;return y(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}IX.type="sankey",IX.seriesType=iR.sankey,IX.transformerConstructor=OX;class DX extends Wj{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.area=t.area,s.point=t.point,s.line=t.line,"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),DI(t)}}class FX extends Nj{constructor(){super(...arguments),this.transformerConstructor=DX,this.type="rangeArea",this.seriesType=iR.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=nH,this._modelOption.getDimensionInfoByValue=aH,this._modelOption.getRectByDimensionData=uH}}FX.type="rangeArea",FX.seriesType=iR.rangeArea,FX.transformerConstructor=DX;class zX extends Wj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class jX extends Nj{constructor(){super(...arguments),this.transformerConstructor=zX,this.type="heatmap",this.seriesType=iR.heatmap}}jX.type="heatmap",jX.seriesType=iR.heatmap,jX.transformerConstructor=zX;class HX extends Uj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class NX extends Nj{constructor(){super(...arguments),this.transformerConstructor=HX,this.type="correlation",this.seriesType=iR.correlation}}NX.type="correlation",NX.seriesType=iR.correlation,NX.transformerConstructor=HX;function VX(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=qO(t.style)),P(t.textStyle)||FR(s.textStyle,qO(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&qO(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&qO(s.background.style),s}const UX=(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},WX=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const u={};c.forEach((t=>{u[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:gO;return h?h(t,c,g):(y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===u[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===u[t.source]&&!0===u[t.target])))):p(g)&&(t=t.filter((t=>!0===u[r.getSeriesFieldValue(t,g)]))),t)};class GX extends Yz{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:()=>{qL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),qL(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=xR(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()}_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):(U(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new fD(this._option,e),this._initSelectedData(),qL(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(qL(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)U(s,this._cacheAttrs)||this._legendComponent.setAttributes(FR({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(FR({},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;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());U(t,this._cacheAttrs)||this._legendComponent.setAttributes(FR({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}GX.specKey="legends";class YX extends GX{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return JD(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),qL(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){cI(this._option.dataSet,"discreteLegendFilter",WX),cI(this._option.dataSet,"discreteLegendDataMake",UX);const t=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return qL(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(!Jy(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=FO(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 s=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:n={},item:r={},pager:a={},background:o={}}=t;n=I(n),r=I(r),a=I(a),o=I(o);const l=s;return n.visible?l.title=VX(n):l.title={visible:!1},P(r.focusIconStyle)||qO(r.focusIconStyle),r.shape&&(r.shape=$O(r.shape)),r.label&&(r.label=$O(r.label)),r.value&&(r.value=$O(r.value)),r.background&&(r.background=$O(r.background)),SR(r.maxWidth)&&(r.maxWidth=Number(r.maxWidth.substring(0,r.maxWidth.length-1))*i.width/100),SR(r.width)&&(r.width=Number(r.width.substring(0,r.width.length-1))*i.width/100),SR(r.height)&&(r.height=Number(r.height.substring(0,r.height.length-1))*i.width/100),l.item=r,"scrollbar"===a.type?(P(a.railStyle)||qO(a.railStyle),P(a.sliderStyle)||qO(a.sliderStyle)):(P(a.textStyle)||qO(a.textStyle),a.handler&&$O(a.handler)),l.pager=a,o.visible&&!P(o.style)&&(FR(l,o.style),p(o.padding)&&(l.padding=o.padding)),l}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return nL}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(ZP.legendItemClick,(i=>{const s=L(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(ZP.legendItemHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(ZP.legendItemUnHover,(e=>{const i=L(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}=ZD(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=ZD(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}YX.specKey="legends",YX.builtInTheme={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}},YX.type=r.discreteLegend;const $X=(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[]},XX=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=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(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?YO(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};const KX={color:hL,size:dL},qX={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}},ZX=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},qX),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},JX={horizontal:ZX(!0),vertical:ZX(!1)},QX=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},qX),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},tK={horizontal:QX(!0),vertical:QX(!1)},eK=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],iK=[2,10];class sK extends GX{static getSpecInfo(t){const e=JD(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}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(e){super.init(e),qL(this._regions,(e=>{e.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:e.isHierarchyData,customFilter:this._spec.customFilter},level:t.TransformLevel.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(){cI(this._option.dataSet,"continuousLegendFilter",XX),cI(this._option.dataSet,"continuousLegendDataMake",$X);const t=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>ZL(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=FO(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!Jy(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=FO(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()),P(a)&&(a="color"===this._legendType?eK:iK);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=FR({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:d={},type:u,id:g,visible:f,orient:m,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=VX(s):w.title={visible:!1},w.showHandler=!1!==n.visible,P(n.style)||(w.handlerStyle=qO(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),P(r.style)||(w.railStyle=qO(r.style)),P(a.style)||(w.trackStyle=qO(a.style)),w.startText=$O(o),w.endText=$O(l),w.handlerText=$O(h),P(c)||(w.sizeBackground=qO(c)),d.visible&&!P(d.style)&&(FR(w,d.style),p(d.padding)&&(w.padding=d.padding)),w}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return KX[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",St((i=>{const s=L(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}sK.specKey="legends",sK.builtInTheme={colorLegend:JX,sizeLegend:tK},sK.type=r.continuousLegend;const nK=(t,e)=>p(e)?t.map((t=>e[t])):void 0,rK=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),aK=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function oK(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),d=i.getOption(),g=d.getRegionsInUserIdOrIndex(p(c.regionId)?[c.regionId]:void 0,p(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=lK(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),_=g.getLayoutRect(),y=d.globalInstance.getContainer(),b=Object.assign({x:0,y:0},y?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(y):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>rK(i,s)(t)&&rK(n,r)(t)&&(u(a)||rK([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),A=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),_.width),y:Math.min(Math.max(t.y,0),_.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.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 l=[{value:t[e.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=>x(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=d.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:nI.chart,event:A({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=d.globalInstance;return YD.globalConfig.uniqueTooltip&&YD.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=d.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:nI.chart,event:A(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=d.globalInstance;return YD.globalConfig.uniqueTooltip&&YD.hideTooltip(a.id),m}return"none"}const lK=(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(),f=p(g)?t[g]:void 0,m=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=nK(c,t);let _=nK(d,t);const y=aK(_),b=!y&&p(g)&&u(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(rK(c,v));if(!y&&(_=nK(d,i),!aK(_)))return;const n=e.type===iR.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:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=UC(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(rK(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=nK(d,o),!aK(_))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(rK(c,n));if(!y&&(_=nK(d,r),!aK(_)))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:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===iR.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(rK(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(_=nK(d,i),!aK(_))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&&(()=>{var i,n,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(rK(c,v));const o=e.getNameMap(),l=null===(r=null===(n=e.getMapViewData)||void 0===n?void 0:n.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=_;if(l&&!a&&(a=Object.assign({},t)),!y){if(_=nK(d,a),h=_,!aK(_)&&!a)return;aK(_)||(_=[null])}const p=e.dataToPosition(a);u(p)||isNaN(p.x)||isNaN(p.y)||s.push({pos:p,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:h,hasMeasureData:y,groupField:g,groupData:f,originDatum:a},series:e})})()})),s},hK=t=>p(t)&&!y(t),cK=t=>p(t)&&y(t);class dK extends Gz{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i,s,n;const{spec:r,theme:a}=super._initTheme(t,e);return r.style=FR({},this._theme,r.style),r.offset=FR({},a.offset,t.offset),r.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:a.transitionDuration,r.trigger=null!==(s=t.trigger)&&void 0!==s?s:a.trigger,r.triggerOff=null!==(n=t.triggerOff)&&void 0!==n?n:a.triggerOff,{spec:r,theme:a}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(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]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:Xy(this._option.mode)||!Yy(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.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?_(t.parentElement)&&(t.parentElement=k_.getElementById(t.parentElement)):Yy(this._option.mode)&&(t.parentElement=null==Gy?void 0:Gy.body)}}const uK={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}};class pK extends Yz{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=dK,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=Yy(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&hK(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!u(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&YD.globalConfig.uniqueTooltip&&l&&YD.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;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;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:nI.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(null==r?void 0:r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:nI.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),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,this._enterable=!1;else{const t="canvas"===s?mH.canvas:mH.dom,n=zR.getComponentPluginInType(t);n||Vy("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,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=zR.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=Y(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),($y(s)||Xy(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,At(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===s||s.call(i)}else 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=oK(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_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(cK(t)){if(hK(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>KF(t,e[i])))}if(cK(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.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: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}getVisible(){return!1!==this._spec.visible}}pK.type=r.tooltip,pK.transformerConstructor=dK,pK.builtInTheme={tooltip:uK},pK.specKey="tooltip";var gK,fK;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(gK||(gK={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(fK||(fK={}));const mK={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class vK extends Yz{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=At((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},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.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{UC(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_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}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(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(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:rI.chart}:{source:nI.chart};y(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,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)}onBeforeRender(){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"}:$y(e)||Xy(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:nI.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:nI.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:nI.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=L(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{mK[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=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const u=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+u.left),o=Math.min(o,i-d+u.top),l=Math.max(l,e+t.getLayoutRect().width-c-u.right),h=Math.max(h,i+t.getLayoutRect().height-d-u.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_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)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_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 i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=L(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=L(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:d}=n,u=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:L(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{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||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}vK.specKey="crosshair";const _K={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}}}}};class yK extends vK{static getSpecInfo(t){return JD(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_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)}}_getDatumAtPoint(t,e){const i=HF(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){HF(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:NF(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();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 o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=JL(this._regions,"cartesian");e&&(oH(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=cH(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new lT(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new hT(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}yK.specKey="crosshair",yK.builtInTheme={crosshair:_K},yK.type=r.cartesianCrosshair;class bK extends vK{static getSpecInfo(t){return JD(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_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)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_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}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=JL(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&p(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=Az(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=ZD(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:ce(d,a.getInnerRadius(),o),end:ce(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=ue(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=ce(t,o,r),d=ce(t,o,h),m=_e([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=_t(ae.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new lT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new dT(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new uT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new cT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=pe(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}}(u):function(t){let e="center",i="middle";return e=(t=pe(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}}(g.startAngle),a="angle"===l?ce(e,p[1]+m.offset,u):ce(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}bK.specKey="crosshair",bK.builtInTheme={crosshair:_K},bK.type=r.polarCrosshair;const xK=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(u(o)||u(a))return t;const l=r(),h=y(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},SK=(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=>{let e=!1;return Y(r).every((i=>{t[i]>=a[0]&&t[i]<=$(a)&&(e=!0)})),e}:t=>{let e=!1;return Y(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},AK=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],d=[],g=[];let f=!1,m=!1;n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);p(null==t?void 0:t.max)&&p(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{u(h[t])&&(g.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(h[t[i]])&&(g.push(t[i]),h[t[i]]=0,c.push(t[i])),u(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const v=f?g:!1===r||m?g.sort(((t,e)=>t-e)):c;return v.forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),d.push(e)})),d},kK=(t,e,i)=>{const s=e.domain();if(NC(e.type))return i?s[0]+($(s)-s[0])*(1-t):s[0]+($(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+($(n)-n[0])*t;return e.invert(r)},MK=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&NC(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/($(n)-n[0])))},TK=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},wK=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}},CK=(t,e,i)=>"start"===t?"percent"===e&&p(i.start)||"value"===e&&p(i.startValue):"percent"===e&&p(i.end)||"value"===e&&p(i.endValue),EK=(t,e,i)=>{if(NC(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class BK{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})}constructor(t,e,i,s,n,r,a,o){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.initZoomEvent=()=>{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,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),d=Math.abs(this.getState().start-this.getState().end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=_t(this.getState().start+f,0,1),_=_t(this.getState().end-m,0,1);this._handleChange(Math.min(v,_),Math.max(v,_),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Ut(s/n)>=.5:Ut(n/s)>=.5;if(this._scrollAttr.reverse||(r=-r),a){const t=this._spec.scrollStep;if(k(t)){r=(r>0?1:-1)*(t*(this.getState().end-this.getState().start)/1)}this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1)}const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))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.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===WF(UF(e))}setEventAttrFromSpec(){!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=j({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=j({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=j({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,c(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&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.getEvent(),this._option.mode)}}G(BK,SN);class PK extends Yz{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:MK(t,this._stateScale,this._isHorizontal),a="percent"===n?e:MK(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var e;this._dataFilterEvent.initZoomEvent(),null===(e=this._relatedAxisComponent)||void 0===e||e.event.on(t.ChartEvent.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_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)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=TK(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[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._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._currentDataCollection=[],this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=EK(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!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&&wK(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({value:"force"})}else qL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),qL(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=UF(t),this._isHorizontal="horizontal"===WF(this._orient),this._dataFilterEvent=new BK(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){this._handleDataCollectionChangeBound=this._handleDataCollectionChange.bind(this),super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(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])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(NC(n.type)){const r=n.domain(),a=r[0],o=$(r)-a,l=p(t)?a+o*t:+e,h=p(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=p(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=p(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}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}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_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=>WF(t._orient)===WF(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!NC(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;}_collectDataInfo(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};qL(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l,u=NC(d.getScale(0).type),p=NC(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?Y(g.xField):Y(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?Y(g.yField):Y(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:d===l?f:m;u&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else qL(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});return{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}}_initData(){const{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}=this._collectDataInfo(),{dataSet:r}=this._option;dI(r,"dataview",wa),cI(r,"dataFilterComputeDomain",AK);const a=new Pa(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new fD(this._option,a),a.reRunAllTransform(),this._currentDataCollection=t,r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChangeBound)}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(cI(this._option.dataSet,"dataFilterWithNewDomain",SK),cI(this._option.dataSet,"lockStatisticsFilter",xK),qL(this._regions,(e=>{e.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>e.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>NC(this._stateScale.type)},level:1},!1),e.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>NC(this._stateScale.type)},level:t.TransformLevel.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r}=this._collectDataInfo();if(this._currentDataCollection.length!==e.length||this._currentDataCollection.some(((t,i)=>t!==e[i]))){this._currentDataCollection.forEach((t=>{var e;null===(e=null==t?void 0:t.target)||void 0===e||e.removeListener("change",this._handleDataCollectionChangeBound)})),this._currentDataCollection=e;const{dataSet:t}=this._option;t.multipleDataViewAddListener(this._currentDataCollection,"change",this._handleDataCollectionChangeBound)}this._data.getDataView().transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data.getDataView().reRunAllTransform();const a=this._computeDomainOfStateScale(NC(this._stateScale.type));this._stateScale.domain(a,!1),(p(this._spec.start)||p(this._spec.end))&&this._setStateFromSpec(),this._handleChange(this._start,this._end,!0),this._spec.auto&&!U(this._domainCache,a)&&(this._domainCache=a,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;CK("start",i,this._spec)&&CK("end",s,this._spec)&&(t="percent"===i?this._spec.start:MK(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:MK(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?MK(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?MK(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=kK(this._start,this._stateScale,TK(i,this._isHorizontal)),this._endValue=kK(this._end,this._stateScale,TK(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,NC(this._stateScale.type)&&this._stateScale.domain()[0]!==$(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=EK(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&qL(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);k(null==i?void 0:i.min)&&k(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new PE:new cE,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_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?[K(t),X(t)]:[-1/0,1/0]}return e}_autoVisible(e){if(!this._auto)return;e?this.show():this.hide();const i=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[i]:e?this[`_${i}`]:0},{[i]:t.AttributeLevel.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_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=wK(h);if(!this._dataUpdating&&UC(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,UC(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),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}G(PK,SN);class LK extends Gz{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=FR({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}}}const RK=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),OK={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:RK(!1),startHandler:{style:{symbolType:"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;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"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;",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:RK(!0)};class IK extends PK{constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=LK,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=this._isHorizontal?0:this._middleHandlerSize,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=this._isHorizontal?0:this._middleHandlerSize,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._getPreviewStateScale(),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._getPreviewStateScale(),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"}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange)if(s&&this._component)this._component.setStartAndEnd(e,i);else{const s=this._relatedAxisComponent,r=kK(e,this._stateScale,TK(s,this._isHorizontal)),a=kK(i,this._stateScale,TK(s,this._isHorizontal));if(!p(r)||!p(a))return;this._start=e,this._end=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(){this._data.getDataView().reRunAllTransform();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new PE),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(TK(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=TK(t,this._isHorizontal),this.effect.onZoomChange())}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,d=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+d,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+d),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);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(),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=isNaN(c)?this._backgroundSize:c-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=isNaN(c)?this._backgroundSize:c-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,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new PE;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(TK(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[K(e),X(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!NC(t.type)||e[0]!==$(e))&&(!UC(t.type)||1!==(i=e,i&&y(i)?Array.from(new Set(Y(i))):i).length);var i}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_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:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_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._computeWidth(),height:this._computeHeight()},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,isReverse:TK(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=this._isHorizontal?this._stateScale:this._valueScale,i=this._isHorizontal?this._valueScale:this._stateScale,s=this._isScaleValid(e)&&this._isScaleValid(i)&&!1!==this._spec.showBackgroundChart,n=this._getAttrs(s),r=this._relatedAxisComponent;if(this._component)this._component.setAttributes(n),t&&(this._component.setPreviewData(this._data.getDataView().latestData),s&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>kK(t,this._stateScale,TK(r,this._isHorizontal))))));else{const t=this.getContainer();this._component=new JB(n),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?s&&this._component.setPreviewPointsY1(this._dataToPositionY2):s&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>kK(t,this._stateScale,TK(r,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:qO(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:qO(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:qO(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:qO(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:qO(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:qO(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:qO(g.style)},selectedBackgroundStyle:qO(this._spec.selectedBackground.style),dragMaskStyle:qO(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:FR(qO(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},qO(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:FR(qO(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},qO(null===(d=m.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}=ZD(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(TK(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}}IK.type=r.dataZoom,IK.transformerConstructor=LK,IK.builtInTheme={dataZoom:OK},IK.specKey="dataZoom";const DK={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}};class FK extends PK{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"}_handleChange(e,i,s){super._handleChange(e,i,s);const n=NL(this._start,e)&&NL(this._end,i);if(this._shouldChange&&(!n||!1===this._spec.realTime)){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=kK(e,this._stateScale,!1),r=kK(i,this._stateScale,!1);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,n,r):this._handleStateChange(n,r))&&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(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r,a;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,minSliderSize:null===(a=this._spec)||void 0===a?void 0:a.minSliderSize},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new pM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=qO(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=qO(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}FK.type=r.scrollBar,FK.builtInTheme={scrollBar:DK},FK.specKey="scrollBar";const zK=(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},jK=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),HK={title:{visible:!0,autoLimit:!1,autoFit:!1,style:jK("l1FontSize","primaryFontColor")},content:{visible:!0,style:jK("l2FontSize","tertiaryFontColor")}};class NK extends Yz{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){return JD(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}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))}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(JO(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(JO(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){cI(this._option.dataSet,"indicatorFilter",zK);const t=new Pa(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 fD(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:i,height:s}=t.getLayoutRect(),{x:n,y:r}=t.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,u=e(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return Y(o).forEach((t=>{const e=FR({},this._theme.content,t);g.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({},KO(H(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?ER(l,this._computeLayoutRadius()):0,dy:h?ER(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!p(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},KO(H(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},u)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)U(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new gL(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_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.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}NK.type=r.indicator,NK.builtInTheme={indicator:HK},NK.specKey="indicator";const VK=["sum","average","min","max","variance","standardDeviation","median"];function UK(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=K(s),r=X(s);return er}function WK(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&UK(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=SR(t.x)?XK(t.x,n)+r.x:KK(l.getXAxisHelper(),[t.x])+r.x,h}function GK(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&UK(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=SR(t.y)?XK(t.y,n)+r.y:KK(l.getYAxisHelper(),[t.y])+r.y,h}function YK(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&UK(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)),KK(a.angleAxisHelper,[t.angle])}function $K(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&UK(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)),KK(a.radiusAxisHelper,[t.radius])}function XK(t,e){return Number(t.substring(0,t.length-1))*e/100}function KK(t,e){const i=t.getScale(0);return NC(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function qK(t){return VK.includes(t)}function ZK(t,e,i,s,n,r=!1){const a=e.getRegion(),o=a.getLayoutStartPoint(),l=i.getRegion(),h=l.getLayoutStartPoint(),c=Math.abs(Math.min(o.x,h.x)-Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width)),d=Math.abs(Math.min(o.y,h.y)-Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height)),u={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},g=[],f=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper(),v=s.getYAxisHelper(),_=m.getScale(0).domain(),y=v.getScale(0).domain(),b=r&&!m.isContinuous&&!!m.getBandwidth,x=r&&!v.isContinuous&&!!v.getBandwidth,S={min:null,max:null},A={min:null,max:null};return f.forEach((t=>{const e=p(t.x),i=p(t.y);let s,r;if(e&&i)s=WK(t,_,n,u,c,o),r=GK(t,y,n,u,d,o),JK(s,b,S,g.length),JK(r,x,A,g.length),g.push([{x:s,y:r}]);else if(e){s=WK(t,_,n,u,c,o),r=Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height);const e=Math.min(o.y,h.y);JK(s,b,S,g.length),g.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(o.x,h.x),r=GK(t,y,n,u,d,o);const e=Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width);JK(r,x,A,g.length),g.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(g,m,v,S,A),g}function JK(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=YK(t,l,n,r),i=$K(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=YK(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=$K(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function tq(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:f}=u.getLayoutRect();let m=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(m=SR(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=SR(i)?Number(i.substring(0,i.length-1))*f/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])&&UK(_,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])&&UK(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:KK(d.getXAxisHelper(),b)+p.x+m,y:KK(d.getYAxisHelper(),x)+p.y+v})})),n}function eq(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])&&UK(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])&&UK(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:KK(l.angleAxisHelper,d),radius:KK(l.radiusAxisHelper,u)})})),s}function iq(t,e,i){let{x:s,y:n}=t;return SR(s)&&(s=XK(s,e)),SR(n)&&(n=XK(n,i)),{x:s,y:n}}function sq(t,e,i){let s;if(s=d(t)?Y(t(e.getData().getLatestData(),e)):Y(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=iq(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>iq(t,n,r)))}function nq(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 rq(t,i,s){const{labelBackground:n={},style:r,shape:a}=t,o=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},qO(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},oq(qO(n.style),i,s)),p(n.padding)&&(t.padding=ai(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=oq(qO(r),i,s)),t}return{visible:!1}}function aq(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function oq(t,e,i){return d(t)?t(e,i):t}function lq(t,e){return d(t)?t(e):t}function hq(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 cq(t){return{isXProcess:p(t.x),isYProcess:p(t.y),isX1Process:p(t.x1),isY1Process:p(t.y1),isAngleProcess:p(t.angle),isRadiusProcess:p(t.radius),isAngle1Process:p(t.angle1),isRadius1Process:p(t.radius1),isCoordinatesProcess:p(t.coordinates),isValidProcess:p(t.process)}}function dq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=cq(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:h&&(!c||"process"in t&&"xy"in t.process)}}function uq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=cq(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function pq(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function gq(t,i){let s;if(i.coordinates){const t=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=t,o=e(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(d(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=Y(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;p(r)&&(c=Y(i)[r]),n&&Y(i).includes(n)&&(c=n);let d=s;p(l)&&(d=Y(s)[l]),a&&Y(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),_(t[c])&&qK(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),_(t[d])&&qK(t[d])?h.y={field:d,aggrType:t[d]}:h.y=Y(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;p(r)&&(a=Y(s)[r]),n&&Y(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),_(t[a])&&qK(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),_(t[l])&&qK(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=Y(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const s=e.x;y(s)?i.x=s.map((i=>mq(i,t,e))):i.x=mq(s,t,e)}if(p(e.y)){const s=e.y;y(s)?i.y=s.map((i=>mq(i,t,e))):i.y=mq(s,t,e)}if(p(e.angle)){const s=e.angle;y(s)?i.angle=s.map((i=>mq(i,t,e))):i.angle=mq(s,t,e)}if(p(e.radius)){const s=e.radius;y(s)?i.radius=s.map((i=>mq(i,t,e))):i.radius=mq(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=mq(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const fq={min:(t,e)=>VL(t[0].latestData,e.field),max:(t,e)=>UL(t[0].latestData,e.field),sum:function(t,e){return WL(t[0].latestData,e.field)},average:function(t,e){return GL(t[0].latestData,e.field)},variance:function(t,e){return YL(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(YL(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return dt(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function mq(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(m(t)){const{aggrType:i,field:s}=t;return fq[i](e,{field:s})}return t}function vq(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 _q extends Yz{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){return JD(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_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)&&qK(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){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Ba;return e.registerParser("array",s),new Pa(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)))}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=JL(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){u(this._spec.offsetX)||(this._layoutOffsetX=kR(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=kR(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();cI(this._option.dataSet,"markerAggregation",gq),cI(this._option.dataSet,"markerFilter",vq);const i=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),i.target.on("change",(()=>{this._markerLayout()})),this._markerData=i}}function yq(t,e){return function(t,e,i){const{predict:s}=Ft(t,(t=>t[e]),(t=>t[i])),n=VL(t,e),r=UL(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class bq extends _q{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}=dq(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;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={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},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:oq(qO(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>rq(t,this._markerData,this._markAttributeContext))),state:{line:aq(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:aq(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:aq(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return aq(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return aq(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:oq(qO(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:oq(qO(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||Y(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=nq([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=Y(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,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}=dq(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;cI(this._option.dataSet,"markerAggregation",gq),cI(this._option.dataSet,"markerRegression",yq),cI(this._option.dataSet,"markerFilter",vq);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new Pa(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",(()=>{this._markerLayout()})),this._markerData=m}}bq.specKey="markLine";const xq=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),Sq={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"}}},refY:5},Aq={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:xq(!1),endSymbol:xq(!0),label:Sq};class kq extends bq{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new FP(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:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:_}=dq(e);let y=[];if(u||f||g||m||v||a&&l||a&&h){const t=ZK(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=tq(i,r,d,e.coordinatesOffset):c&&(y=sq(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n;const r=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const n=this._startRelativeSeries,a=this._endRelativeSeries,{multiSegment:o,mainSegmentIndex:l}=this._spec.line||{},{connectDirection:h,expandDistance:c=0}=this._spec;let d;if(SR(c)){const t=n.getRegion(),e=t.getLayoutStartPoint(),i=a.getRegion(),s=i.getLayoutStartPoint();if("bottom"===h||"top"===h){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));d=Number(c.substring(0,c.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));d=Number(c.substring(0,c.length-1))*n/100}}else d=c;const{points:u,limitRect:g}=r;if(!u||u.length<2)return void(null===(t=this._markerComponent)||void 0===t||t.setAttributes(r));const f=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}(u[0],u[1],h,d);let m;m=o&&p(l)?{position:"middle",autoRotate:!1}: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)}:{}}(u[0],u[1],h,d));const v=Y((null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{}).label),_=Y(r.label),y=Y(this._spec.label);null===(s=this._markerComponent)||void 0===s||s.setAttributes({points:o?[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]]]:f,label:_.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=m.dx)&&void 0!==i?i:0,h=null!==(s=m.dy)&&void 0!==s?s:0;const c=null!==(n=y[e])&&void 0!==n?n:y[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),m),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=v[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:g,multiSegment:o,mainSegmentIndex:l,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(n=this._markerComponent)||void 0===n||n.setAttributes(r)}_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}=dq(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 Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&p(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&p(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&p(n.process.xy)){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}}}kq.type=r.markLine,kq.coordinateType="cartesian",kq.builtInTheme={markLine:Aq};class Mq extends bq{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=dq(this._spec);return e||i?new HP(t):new FP(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}=dq(e);let p=[],g={};const f={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=QK(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:f}:{points:p.map((t=>ce(f,t.radius,t.angle)))}}else u&&(p=eq(i,r,a),g={points:p.map((t=>ce(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=dq(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}}}Mq.type=r.polarMarkLine,Mq.coordinateType="polar",Mq.builtInTheme={polarMarkLine:Aq};class Tq extends Yz{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=xR(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return JD(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}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;if(!1===this._spec.visible)return{visible:!1};const a=this.getLayoutRect(),o=kR(this._spec.width,a.width,null,a.width),l=kR(this._spec.maxWidth,a.width,null,a.width),h=Math.max(Math.min(o,l,a.width),0),c=p(this._spec.text)&&""!==this._spec.text,d=p(this._spec.subtext)&&""!==this._spec.subtext,u=Object.assign(Object.assign({},H(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:c?this._spec.text:void 0,subtextType:null!==(e=this._spec.subtextType)&&void 0!==e?e:"text",subtext:d?this._spec.subtext:void 0,x:null!==(i=this._spec.x)&&void 0!==i?i:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:h,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(n=this._spec.align)&&void 0!==n?n:"left",verticalAlign:null!==(r=this._spec.verticalAlign)&&void 0!==r?r:"top",textStyle:Object.assign({maxLineWidth:h},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:h},this._spec.subtextStyle)});if(c&&(u.textStyle.width=h),d&&(u.subtextStyle.width=h),p(this._spec.width)){const t=Math.max(Math.min(o,a.width),0);c?u.textStyle.width=t:delete u.textStyle.width,d&&(u.subtextStyle.width=t)}return u}_createOrUpdateTitleComponent(t){if(this._titleComponent)U(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new uL(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}Tq.type=r.title,Tq.specKey=r.title,Tq.builtInTheme={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"}}}};class wq extends _q{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=uq(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={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:oq(qO(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>rq(t,this._markerData,this._markAttributeContext))),state:{area:aq(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>aq(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return aq(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||Y(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=nq([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=Y(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=Y(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,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}=uq(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}wq.specKey="markArea";const Cq={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"}}}}};class Eq extends wq{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new jP(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=uq(i),d=p(i.positions),u=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=ZK(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=ZK(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=tq(s,a,u,i.coordinatesOffset):d&&(f=sq(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=uq(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}Eq.type=r.markArea,Eq.coordinateType="cartesian",Eq.builtInTheme={markArea:Cq};class Bq extends wq{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=uq(this._spec);return i||e||s?new NP(t):new jP(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}=uq(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=QK(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=eq(i,r,c),u={points:d.map((t=>ce(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=uq(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}}}Bq.type=r.polarMarkArea,Bq.coordinateType="polar",Bq.builtInTheme={polarMarkArea:Cq};const Pq=t=>qO(Object.assign({},t)),Lq=t=>Object.assign(Object.assign({},t),{style:Object.assign({},qO(t.style))}),Rq=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=Pq(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=Pq(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:{},qO(Object.assign({},y)));var y;const b=Lq(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=Lq(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=Lq(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=Lq(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!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:A})});return t.visible||(k.controller.visible=!1,k.slider.visible=!1),k},Oq=t=>"left"===t||"right"===t,Iq=t=>"top"===t||"bottom"===t,Dq={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:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,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:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class Fq extends Yz{constructor(){super(...arguments),this.layoutZIndex=t.LayoutZIndex.Player,this.layoutLevel=t.LayoutLevel.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},Rq(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},Rq(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?U(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new CL(t):this._playerComponent=new PL(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...Y(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...Y(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...Y(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...Y(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=Oq(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=Oq(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this.autoPlayCallback=()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback),this._option.globalInstance.on(t.ChartEvent.rendered,this.autoPlayCallback),this._playerComponent.addEventListener(SL.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(SL.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(SL.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(SL.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(SL.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(SL.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}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=Oq(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=Iq(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}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):Oq(this._orient)?this._maxSize():t.width}_computeHeight(t){return S(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):Iq(this._orient)?this._maxSize():t.height}_computeDx(t){return Oq(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return Iq(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(e){const i=this._specs[e];this._option.globalInstance.updateFullData(i.data),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})}release(){this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback)}}Fq.builtInTheme={player:Dq},Fq.specKey="player",Fq.type=r.player;class zq extends Yz{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,U(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=cR({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:Y(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==UI.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&u(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}zq.type=r.label;class jq extends MV{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}render(){}}jq.type="text",jq.constructorType="label";const Hq=()=>{TV(),zR.registerMark(jq.constructorType,jq)};class Nq extends Gz{_initTheme(t,e){return{spec:t,theme:this._theme}}}class Vq extends zq{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.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(eI.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(eI.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),qL(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{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),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,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=FR({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},WN(h,r),Object.assign(Object.assign(Object.assign({},H(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[TO])):t=>t.filter((t=>t.data[MO]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?GN(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=y(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=Y(i())[t])}))}return e}}Vq.type=r.label,Vq.specKey="label",Vq.transformerConstructor=Nq;class Uq extends zq{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()}reInit(t){super.reInit(t),this._initTextMark()}_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[AO]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return FR({textStyle:{pickable:!0===this._spec.interactive},position:Wq(t,this._baseMark.type,a),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=>"bottom"===a?t.data[TO]:t.data[MO]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>GN({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function Wq(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}Uq.type=r.totalLabel,Uq.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},Uq.specKey="totalLabel";class Gq extends _q{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=pq(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,f,m,v,_,y,b,x,S,A,k,M,T,w,C,E,B,P,L,R,O;const{itemContent:I={},itemLine:D={},targetSymbol:F={}}=this._spec,z=I,{type:H="text",text:N,symbol:V,image:U,richText:W,customMark:G,textStyle:Y,symbolStyle:$,imageStyle:X,richTextStyle:K,customMarkStyle:q,style:Z={},state:J={}}=z,Q=e(z,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let tt=null,et=null,it={};"text"===H?(tt=null!==(t=null==N?void 0:N.state)&&void 0!==t?t:J,it={dx:0,dy:0},et=rq(Object.assign(Object.assign({},N),{style:j(it,null!==(n=null!==(s=null!==(i=null==N?void 0:N.style)&&void 0!==i?i:null==N?void 0:N.textStyle)&&void 0!==s?s:Y)&&void 0!==n?n:Z)}),this._markerData,this._markAttributeContext)):"richText"===H?(tt=null!==(r=null==W?void 0:W.state)&&void 0!==r?r:J,it={width:100,height:100},et=oq(j(it,null!==(o=null!==(a=null==W?void 0:W.style)&&void 0!==a?a:K)&&void 0!==o?o:Z),this._markerData,this._markAttributeContext)):"symbol"===H?(tt=null!==(l=null==V?void 0:V.state)&&void 0!==l?l:J,it={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},et=qO(oq(j(it,null!==(c=null!==(h=null==V?void 0:V.style)&&void 0!==h?h:$)&&void 0!==c?c:Z),this._markerData,this._markAttributeContext))):"image"===H?(tt=null!==(d=null==U?void 0:U.state)&&void 0!==d?d:J,it={width:80,height:80},et=oq(j(it,null!==(p=null!==(u=null==U?void 0:U.style)&&void 0!==u?u:X)&&void 0!==p?p:Z),this._markerData,this._markAttributeContext)):"custom"===H&&(tt=null!==(g=null==G?void 0:G.state)&&void 0!==g?g:J,et=oq(null!==(m=null!==(f=null==G?void 0:G.style)&&void 0!==f?f:q)&&void 0!==m?m:Z,this._markerData,this._markAttributeContext));const st={zIndex:this.layoutZIndex,interactive:null===(v=this._spec.interactive)||void 0===v||v,hover:null===(_=this._spec.interactive)||void 0===_||_,select:null===(y=this._spec.interactive)||void 0===y||y,position:{x:0,y:0},clipInRange:null!==(b=this._spec.clip)&&void 0!==b&&b,itemContent:Object.assign(Object.assign({type:H,offsetX:lq(I.offsetX,this._relativeSeries.getRegion()),offsetY:lq(I.offsetX,this._relativeSeries.getRegion())},Q),{style:oq(et,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(x=F.offset)&&void 0!==x?x:0,visible:null!==(S=F.visible)&&void 0!==S&&S,size:null!==(A=F.size)&&void 0!==A?A:20,style:oq(F.style,this._markerData,this._markAttributeContext)},state:{line:aq(null!==(M=null===(k=this._spec.itemLine.line)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),lineStartSymbol:aq(null!==(w=null===(T=this._spec.itemLine.startSymbol)||void 0===T?void 0:T.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),lineEndSymbol:aq(null!==(E=null===(C=this._spec.itemLine.endSymbol)||void 0===C?void 0:C.state)&&void 0!==E?E:{},this._markerData,this._markAttributeContext),itemContent:aq(tt,this._markerData,this._markAttributeContext),textBackground:aq(null===(P=null===(B=this._spec.itemContent.text)||void 0===B?void 0:B.labelBackground)||void 0===P?void 0:P.state,this._markerData,this._markAttributeContext),targetItem:aq(null!==(R=null===(L=this._spec.targetSymbol)||void 0===L?void 0:L.state)&&void 0!==R?R:{},this._markerData,this._markAttributeContext)},animation:null!==(O=this._spec.animation)&&void 0!==O&&O,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:nt,line:rt={}}=D,at=e(D,["visible","line"]);st.itemLine=!1!==nt?Object.assign(Object.assign({},at),{visible:!0,lineStyle:qO(rt.style)}):{visible:!1};return new UP(st)}_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}=nq([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:hq(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:hq(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}=pq(t);(p(t.coordinate)||e||i||s)&&this._initCommonDataView()}}Gq.specKey="markPoint";const Yq={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}};class $q extends Gq{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=p(s.x)&&p(s.y),o=p(s.coordinate),l=p(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=ZK(n,r,r,r,h))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=tq(n,r,h,s.coordinatesOffset)[0]:l&&(c=sq(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=pq(t),i=p(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}$q.type=r.markPoint,$q.coordinateType="cartesian",$q.builtInTheme={markPoint:Yq};class Xq extends Gq{constructor(){super(...arguments),this.type=r.polarMarkPoint,this.name=r.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=QK(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:ce({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}])]}}}Xq.type=r.polarMarkPoint,Xq.coordinateType="polar",Xq.builtInTheme={polarMarkPoint:Yq};class Kq extends Gq{constructor(){super(...arguments),this.type=r.geoMarkPoint,this.name=r.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){const t=function(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{p(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}(this._markerData,this._relativeSeries)[0][0];return{point:t}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}Kq.type=r.geoMarkPoint,Kq.coordinateType="geo",Kq.builtInTheme={geoMarkPoint:Yq};const qq="inBrush",Zq="outOfBrush";class Jq extends Yz{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._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return JD(t,this.specKey,this.type,(t=>!1!==t.visible))}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),qq,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),Zq,t.AttributeLevel.Series))}))}))}_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()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){p(this._spec.regionId)||p(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_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)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild()}_shouldEnableInteractive(){return!1!==this.getOption().getCompiler().getOption().interactive}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new IL(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:qO(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),this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(EL.brushActive,(s=>{this._initMarkBrushState(i,Zq),this._emitEvent(t.ChartEvent.brushActive,e,s)})),a.addEventListener(EL.drawStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener(EL.moveStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener(EL.drawing,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener(EL.moving,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener(EL.brushClear,(s=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)})),a.addEventListener(EL.drawEnd,(s=>{var n;this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:r}=s.detail,{updateElementsState:a=!0}=this._spec;if(null===(n=this._spec)||void 0===n?void 0:n.onBrushEnd)!0===this._spec.onBrushEnd(s)?(this.clearGraphic(),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)):(this._spec.onBrushEnd(s),this._emitEvent(t.ChartEvent.brushEnd,e,s));else{const i=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&i.length>0||!a)&&this._setAxisAndDataZoom(r,e),this._emitEvent(t.ChartEvent.brushEnd,e,s)}})),a.addEventListener(EL.moveEnd,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:s}=i.detail,{updateElementsState:n=!0}=this._spec,r=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&r.length>0||n)&&this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e,i)}))}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a],interactive:this._shouldEnableInteractive()}}_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({},qO(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail;this._operateMask=i;const{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e,i){var s;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},vchart:null===(s=this._option)||void 0===s?void 0:s.globalInstance,event:i})}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(i.addState(qq,!0),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(i.removeState(qq),i.addState(Zq,!0),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:_=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(_.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(i.addState(qq,!0),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(i.removeState(qq),i.addState(Zq,!0),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Pe(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;s.removeState(qq),s.removeState(Zq),i&&s.addState(i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_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?"width":"height",p=r?o:h,g=r?l:c;if(this._axisDataZoomMap[t.id]){const i=this._axisDataZoomMap[t.id],s=(p-e.getLayoutStartPoint()[d])/e.getLayoutRect()[u],n=(g-e.getLayoutStartPoint()[d])/e.getLayoutRect()[u],r=this._stateClamp(s-a),o=this._stateClamp(n+a);i.setStartAndEnd(Math.min(r,o),Math.max(r,o),["percent","percent"]),this._zoomRecord.push({operateComponent:i,start:r,end:o,startValue:kK(r,i.stateScale,TK(i.relatedAxisComponent,i.isHorizontal)),endValue:kK(o,i.stateScale,TK(i.relatedAxisComponent,i.isHorizontal))})}else{const i=t.getScale().range(),s=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],r=$(i){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}clearBrushStateAndMask(){this._relativeRegions.forEach(((t,e)=>{this._initMarkBrushState(e,""),this._brushComponents[e].children[0].removeAllChild()}))}}Jq.type=r.brush,Jq.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},Jq.specKey="brush";class Qq extends Yz{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}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;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${lO}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=wF({},CF(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(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)}))),p(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,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 Ne).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Ne;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),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}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}Qq.type=r.customMark,Qq.specKey="customMark";class tZ{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._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=>{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=>eZ(t))),a=n.filter((t=>!eZ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>eZ(t))),h=o.filter((t=>!eZ(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 eZ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}tZ.type="grid";const iZ="vchart-tooltip",sZ=`${iZ}-container`,nZ=`${iZ}-title`,rZ=`${iZ}-content-box`,aZ={offsetX:10,offsetY:10},oZ="99999999999999";function lZ(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const hZ=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,cZ=t=>_(t)&&""!==(null==t?void 0:t.trim())||S(t)?lZ(t):"",dZ=(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},uZ={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},pZ=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=uZ[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class gZ extends bz{constructor(){super(...arguments),this._visible=!0,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._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const _=e.event,{activeType:y,data:b}=t,x="dimension"===y?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:M}=this._option,T=m[y],w=iF(null==T?void 0:T.position,b,e),C=null!==(r=iF(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===y?"mark":"pointer",{width:E=0,height:B=0}=null!=i?i:{},P="canvas"===m.renderMode,L=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==L?void 0:L.width)&&void 0!==o?o:hO,O=null!==(l=null==L?void 0:L.height)&&void 0!==l?l:cO;let I=!1;const D={width:0,height:0};let F,z={x:0,y:0},j={x:0,y:0},H=1,N=1;const V=Yy(this._env);if(V&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=R,D.height=O),V&&!P){const t=this._getParentElement(m);j=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-j.x,y:F.y-j.y},H=hZ(e,F),N=hZ(t,j)}const U=N/H,W={},G={x:w,y:w},Y={x:["left","right"],y:["top","bottom"]},$=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?A:M;if("mark"===i){I=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){I=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(I){const e=Y[n][0],i="x"===n?E:B;switch(pZ(t,n)){case-2:W[e]=a-i*U-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*U/2;break;case-1:W[e]=(a+o)/2-i*U-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*U-c;break;case 2:W[e]=o+c}}},X=["x","y"];if(g(w))if(g(K=w)&&(p(K.left)||p(K.right)||p(K.top)||p(K.bottom))){const{left:t,right:e,top:i,bottom:s}=w;W.left=dZ(t,_),W.top=dZ(i,_),W.right=dZ(e,_),W.bottom=dZ(s,_)}else(t=>g(t)&&(p(t.x)||p(t.y)))(w)&&X.forEach((t=>{const e=w[t];S(e)||d(e)?W[Y[t][0]]=dZ(e,_):$(e,t)}));else p(w)&&($({orient:w,mode:C},"x"),$({orient:w,mode:C},"y"));var K;const q={x:null,y:null};return X.forEach((t=>{var e;const i="x"===t?E:B,s="x"===t?R:O,n="x"===t?A:M,r=pZ(G[t],t);if(k(W[Y[t][0]]))q[t]=W[Y[t][0]];else if(k(W[Y[t][1]]))q[t]=s-i*U-W[Y[t][1]];else{const e="x"===t?_.canvasX:_.canvasY;q[t]=r>0?e+n:0===r?e-i*U/2:e-i*U-n}q[t]*=H,V&&(q[t]+=z[t]),q[t]/=N;const a="x"===t?D.width:D.height,o=m.confine?-(j[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/H)/N:-j[t]/N,l=a/N+o-i;2!==r&&q[t]l&&(q[t]=l)):-2!==r&&q[t]>l&&(I?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",mZ=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=fZ(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=fZ(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},vZ=(t={})=>{const{lineHeight:e}=t;return t.fontSize?kR(e,t.fontSize):0},_Z=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),p(r)&&(o=ai(r),a.padding=fZ(o)),{panelStyle:a,panelPadding:o}};function yZ(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}class bZ extends gZ{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(bZ.type),this.type=mH.dom,this._tooltipContainer=null==Gy?void 0:Gy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(Gy&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:d,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=_Z(l),_={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(_.marginBottom=`${g}px`);const y={width:fZ(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=mZ(h),x=mZ(d),S=mZ(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),u(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),u(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),u(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),y[A]=fZ(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=fZ(null!==(s=d.spacing)&&void 0!==s?s:26),S[A]=fZ(null!==(n=p.spacing)&&void 0!==n?n:0);const M=Math.max(vZ(p),vZ(d));return _.lineHeight=M>0?`${M}px`:"20px",{panelPadding:v,row:_,panel:m,title:b,shape:y,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(nZ))),l=a.find((t=>t.className.includes(rZ)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(nZ),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(yZ(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${iZ}-column`),e.classList.add(`${iZ}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(rZ),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];yZ(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));yZ(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${iZ}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=cZ(e.key),e.keyStyle&&mZ(e.keyStyle,l)):"value"===i?(o.innerHTML=cZ(e.value),e.valueStyle&&mZ(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?lZ(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?lZ(c):m,y=p,b=t=>new Cg({symbolType:t,size:y,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new Ne));let M=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const T=vh.IsGradientStr(u);if(!u||_(u)&&!T||d)return m=d?"none":u?lZ(u):"currentColor",`\n \n \n \n `;const w=T?vh.Parse(u):g(u)?u:null;if(w){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=w.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===w.gradient?t=`\n ${i}\n `:"linear"===w.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),yZ(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(rZ))),h=[...o.children].find((t=>t.className.includes(nZ)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(nZ)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=kR(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,yZ(l,c))}const u=l.children,g=[];if(u){for(let i=0;i{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},ff||(ff=pf.CreateGraphic("richtext",{})),ff.setAttributes(a),ff.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function AZ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:xZ),{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:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const kZ=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};class MZ extends gZ{constructor(){super(MZ.type),this.type=mH.canvas,this._attributes=null}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 HL({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}_getTooltipBoxSize(t,e){var i,s;if(!e||u(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");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:f,valueLabel:m,spaceRow:v,align:_}=l,y=ai(d.padding),b=wR(d.padding),x=AZ(Object.assign({textAlign:"right"===_?"right":"left"},u),i),S=AZ(Object.assign({textAlign:"right"===_?"right":"left"},f),i),A=AZ(m,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:kZ(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,enterable:h,transitionDuration:c,align:_},{title:T={},content:w=[]}=t;let C=b.left+b.right,E=b.top+b.bottom,B=0;const P=!!w.length;let L=0,R=0,O=0,I=0;if(P){const t=[],e=[],i=[],s=[];let n=0;M.content=w.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:M}=r,T={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=FR({},S,AZ(b,void 0,{})),{width:s,height:n,text:r}=SZ(h,i);T.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(m)){const t=FR({},A,AZ(x,void 0,{})),{width:e,height:s,text:n}=SZ(m,t);T.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};M?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,T.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else T.shape={visible:!1};return T.height=o,n+=o,aU.autoWidth&&!1!==U.multiLine;if(j){U=FR({},x,AZ(N,void 0,{})),W()&&(U.multiLine=null===(r=U.multiLine)||void 0===r||r,U.maxWidth=null!==(a=U.maxWidth)&&void 0!==a?a:P?Math.ceil(B):void 0);const{text:t,width:e,height:i}=SZ(H,U);M.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=U.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},U),{text:t}),D=M.title.value.width,F=M.title.value.height,z=F+(P?M.title.spaceRow:0)}return E+=z,M.title.width=D,M.title.height=F,W()?C+=B||D:C+=Math.max(D,B),P&&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-I-L-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})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_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{activeTooltipSpec: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()}}MZ.type=mH.canvas;const TZ=/\{([^}]+)\}/,wZ=/\{([^}]+)\}/g,CZ=/:/;class EZ extends bz{constructor(){super(EZ.type),this.type="formatterPlugin",this._timeModeFormat={utc:mi.getInstance().timeUTCFormat,local:mi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=ki.getInstance().format,this._numericSpecifier=ki.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[EZ.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)),zR.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=TZ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(wZ,((t,i)=>{if(!CZ.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(xi.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):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}EZ.pluginType="chart",EZ.specKey="formatter",EZ.type="formatterPlugin";YD.useRegisters([()=>{xH(),AH(),MH(),Jj(),Zj(),Dj(),wj(),hz(),dz(),ID(),LD(),bj(),mj(),zR.registerSeries(Fj.type,Fj),zR.registerChart(TH.type,TH)},()=>{xH(),AH(),MH(),Zj(),Dj(),wj(),hz(),EH(),dz(),LH(),bj(),mj(),zR.registerSeries(OH.type,OH),Jj(),zR.registerChart(DH.type,DH)},()=>{xH(),AH(),MH(),Zj(),qH(),Jj(),zR.registerChart(JH.type,JH)},()=>{xH(),AH(),Jj(),Zj(),lN(),zR.registerChart(cN.type,cN)},()=>{AH(),rU(),zR.registerChart(Q$.type,Q$)},()=>{xH(),AH(),Jj(),Zj(),AU(),zR.registerChart(iX.type,iX)},()=>{xH(),AH(),MH(),Jj(),Zj(),LU(),zR.registerChart(nX.type,nX)},()=>{xH(),AH(),MH(),Jj(),Zj(),qH(),zR.registerTransform("bin",Kr),zR.registerChart(cX.type,cX)},()=>{AH(),MN(),fN(),zR.registerSeries(wN.type,wN),zR.registerImplement("registerMap",fI),zR.registerImplement("unregisterMap",mI),RD(),zR.registerChart($$.type,$$)},()=>{AH(),d$(),zR.registerSeries(p$.type,p$),QV(),$U(),yU(),qU(),zR.registerChart(gX.type,gX)},()=>{AH(),zG(),zR.registerChart(vX.type,vX)},()=>{AH(),nY(),zR.registerChart(yX.type,yX)},()=>{xH(),AH(),MH(),Jj(),Zj(),iV(),zR.registerChart(PX.type,PX)},()=>{xH(),AH(),Jj(),Zj(),kV(),zR.registerTransform("boxplot",qr),zR.registerChart(RX.type,RX)},()=>{xH(),AH(),Jj(),Zj(),qU(),zR.registerChart(uX.type,uX)},()=>{xH(),AH(),Jj(),Zj(),sW(),zR.registerChart(xX.type,xX)},()=>{xH(),AH(),Jj(),Zj(),IV(),zR.registerChart(AX.type,AX)},()=>{xH(),AH(),MH(),Jj(),Zj(),EH(),bj(),mj(),zR.registerSeries(HV.type,HV),zR.registerChart(FX.type,FX)},()=>{AH(),SY(),zR.registerChart(MX.type,MX)},()=>{AH(),CY(),zR.registerChart(wX.type,wX)},()=>{AH(),e$(),zR.registerChart(EX.type,EX)},()=>{AH(),xo.load(vM),$Y(),zR.registerChart(IX.type,IX)},()=>{AH(),b$(),zR.registerChart(jX.type,jX)},()=>{AH(),R$(),zR.registerChart(NX.type,NX)},()=>{xH(),AH(),MH(),Jj(),zR.registerChart(aX.type,aX),Zj()},mj,bj,()=>{zR.registerGraphicComponent($z.lineAxis,((t,e)=>new CC(t,e))),zR.registerGraphicComponent(Xz.lineAxisGrid,((t,e)=>new zB(t,e))),Qz(),zR.registerComponent(xj.type,xj)},()=>{zR.registerGraphicComponent($z.lineAxis,((t,e)=>new CC(t,e))),zR.registerGraphicComponent(Xz.lineAxisGrid,((t,e)=>new zB(t,e))),Qz(),zR.registerComponent(Sj.type,Sj)},()=>{zR.registerGraphicComponent($z.lineAxis,((t,e)=>new CC(t,e))),zR.registerGraphicComponent(Xz.lineAxisGrid,((t,e)=>new zB(t,e))),Qz(),zR.registerComponent(Aj.type,Aj)},xU,yU,()=>{zR.registerComponent(YX.type,YX)},()=>{zR.registerComponent(sK.type,sK)},()=>{zR.registerComponent(pK.type,pK)},()=>{zR.registerComponent(yK.type,yK)},()=>{zR.registerComponent(bK.type,bK)},()=>{zR.registerComponent(IK.type,IK)},()=>{zR.registerComponent(FK.type,FK)},()=>{zR.registerComponent(NK.type,NK)},MN,()=>{zR.registerComponent(kq.type,kq),DP()},()=>{zR.registerComponent(Eq.type,Eq),zP()},()=>{zR.registerComponent($q.type,$q),VP()},()=>{zR.registerComponent(Mq.type,Mq),HP._animate=vP,DP()},()=>{zR.registerComponent(Bq.type,Bq),NP._animate=yP,zP()},()=>{zR.registerComponent(Xq.type,Xq),VP()},()=>{zR.registerComponent(Kq.type,Kq),VP()},()=>{zR.registerComponent(Tq.type,Tq)},()=>{zR.registerComponent(Fq.type,Fq)},()=>{zR.registerGraphicComponent(Vq.type,(t=>new OB(t))),Hq(),qz(),zR.registerComponent(Vq.type,Vq,!0,1/0)},()=>{zR.registerGraphicComponent(Uq.type,(t=>new OB(t))),Hq(),qz(),zR.registerComponent(Uq.type,Uq,!0)},()=>{zR.registerComponent(Jq.type,Jq)},()=>{zR.registerComponent(Qq.type,Qq)},()=>{xo.load(aT)},()=>{zR.registerLayout(tZ.type,tZ)},()=>{var t;t=MZ,zR.registerComponentPlugin(t.type,t)},()=>{var t;t=EZ,zR.registerChartPlugin(t.type,t)},ND,WD]),YD.useRegisters([()=>{GS(xo)}]),t.DEFAULT_CHART_HEIGHT=cO,t.DEFAULT_CHART_WIDTH=hO,t.DEFAULT_CLOSE_STROKE_JOIN=KD,t.DEFAULT_DATA_INDEX=uO,t.DEFAULT_DATA_KEY=pO,t.DEFAULT_DATA_SERIES_FIELD=gO,t.DEFAULT_KEY=RO,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=XD,t.DEFAULT_MAP_LOOK_UP_KEY=OO,t.DEFAULT_MEASURE_CANVAS_ID=dO,t.DEFAULT_SERIES_STYLE_NAME=fO,t.DEFAULT_SMOOTH_INTERPOLATE=$D,t.Factory=zR,t.MOSAIC_CAT_END_PERCENT=BO,t.MOSAIC_CAT_START_PERCENT=EO,t.MOSAIC_VALUE_END_PERCENT=CO,t.MOSAIC_VALUE_START_PERCENT=wO,t.ManualTicker=class extends hw{constructor(t){super(t),this.lastFrameTime=0,this.status=Ro.RUNNING}setupTickHandler(){const t=new cw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===Ro.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Ro.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Ro.RUNNING,!0}},t.PREFIX=lO,t.SEGMENT_FIELD_END=LO,t.SEGMENT_FIELD_START=PO,t.STACK_FIELD_END=_O,t.STACK_FIELD_END_OffsetSilhouette=SO,t.STACK_FIELD_END_PERCENT=bO,t.STACK_FIELD_KEY=mO,t.STACK_FIELD_START=vO,t.STACK_FIELD_START_OffsetSilhouette=xO,t.STACK_FIELD_START_PERCENT=yO,t.STACK_FIELD_TOTAL=AO,t.STACK_FIELD_TOTAL_BOTTOM=TO,t.STACK_FIELD_TOTAL_PERCENT=kO,t.STACK_FIELD_TOTAL_TOP=MO,t.StreamLight=class extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=Ao.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Wl,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=Ao.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_;const y=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(y){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:qo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(_=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==_?_:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:qo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=cl(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=cl(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;e{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,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize: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=this.options.createCanvas({width:1,height:1}),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 f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),_=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*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],B=(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--;)B(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}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=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,e=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){this.grid=[];const e=this.options.shape;if(g(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?PG(t,o,l.width,l.height,h):"geometric"===t.type&&OG(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!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)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,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}=yG(this.options.shape,[e.width,e.height]);return 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),this.result=[],this.progressiveRun()}};IG.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class DG extends AG{constructor(t){super(j({},DG.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,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)}DG.defaultOptions={enlarge:!1};const zG={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},jG=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return ot.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?HG(t.fontFamily):"sans-serif",d=t.fontStyle?HG(t.fontStyle):"normal",u=t.fontWeight?HG(t.fontWeight):"normal",p=t.rotate?HG(t.rotate):0,g=HG(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?HG(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?Object.assign(Object.assign({},zG),t.as):zG,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?HG(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=NG(UG(t,l),C);w=i=>e(t(i))}let E=MG;"fast"===t.layoutType?E=DG:"grid"===t.layoutType&&(E=IG);const B=new E(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:w,shrink:_,clip:b,enlarge:y,minFontSize:x,random:A,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:B}:B.output()},HG=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],VG=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),NG=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=VG(t[0]),n=VG(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(VG(t)-r)/(a-r)*(e[1]-e[0])+e[0]},UG=(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 WG(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{YR.registerGrammarTransform("wordcloud",{transform:jG}),ON(),YR.registerAnimation("wordCloud",((t,e)=>({appear:SW(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:FD.disappear.duration}}))),YR.registerSeries(GG.type,GG)},$G=(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:f=!1,isCone:m=!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===f?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?m?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},XG=(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},KG=`${mO}_FUNNEL_TRANSFORM_RATIO`,qG=`${mO}_FUNNEL_REACH_RATIO`,ZG=`${mO}_FUNNEL_HEIGHT_RATIO`,JG=`${mO}_FUNNEL_VALUE_RATIO`,QG=`${mO}_FUNNEL_LAST_VALUE_RATIO`,tY=`${mO}_FUNNEL_NEXT_VALUE_RATIO`,eY=`${mO}_FUNNEL_LAST_VALUE`,iY=`${mO}_FUNNEL_CURRENT_VALUE`,sY=`${mO}_FUNNEL_NEXT_VALUE`,nY=`${mO}_FUNNEL_TRANSFORM_LEVEL`;class rY extends fF{constructor(t){var e,i;super(t),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)?this._transformRatioText: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[qG])).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 this._transformRatioText;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]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class aY extends CD{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class oY extends aY{constructor(){super(...arguments),this.type=oY.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}oY.type="polygon";const lY=()=>{YR.registerMark(oY.type,oY),Jk(),Yk(),pw.registerBuiltInAnimate("growPointsOut",cC),YR.registerGraphicComponent("polygon",cf)},hY=Object.assign(Object.assign({},wF),{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"}});class cY extends UF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class dY extends WF{constructor(){super(...arguments),this.type=cR.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=cY,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,i,s,n;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._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;_I(this._dataSet,"funnel",$G),_I(this._dataSet,"funnelTransform",XG);const t=new Pa(this._dataSet,{name:`${mO}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new AD(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}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:iY,asTransformRatio:KG,asReachRatio:qG,asHeightRatio:ZG,asValueRatio:JG,asNextValueRatio:tY,asLastValueRatio:QG,asLastValue:eY,asNextValue:sY,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:nY}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},dY.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:jF(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},dY.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),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(dY.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(dY.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new rY(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(){var e,i,s,n;const r=this._funnelMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const a=this._funnelTransformMark;a&&this.setMarkStyle(a,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const o=this._funnelOuterLabelMark.label;o&&(this.setMarkStyle(o,{text:t=>`${t[this.getCategoryField()]}`,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),width:0,height:0},"normal",t.AttributeLevel.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(o,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",t.AttributeLevel.User_Mark));const l=this._funnelOuterLabelMark.line;if(l&&o){this.setMarkStyle(l,{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);const r=null!==(s=null===(i=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.line)||void 0===i?void 0:i.visible)&&void 0!==s?s:null===(n=this._spec.outerLabel)||void 0===n?void 0:n.visible;p(r)&&l.setVisible(r)}}initLabelMarkStyle(e){var i;if(!e)return;const s=e.getTarget(),n=e.getComponent();if(s===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);const s=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&jy(s,this._funnelOuterLabelMark.label,n),this._funnelOuterLabelMark.line&&jy(s,this._funnelOuterLabelMark.line,null!==(i=this._funnelOuterLabelMark.label)&&void 0!==i?i:n)}else this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*oR(qG).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(IF(null===(s=YR.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.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),DF("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(IF(YR.getAnimationInKey("fadeInOut")(),DF(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(IF(YR.getAnimationInKey("funnel")({},o),DF(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(IF(null===(a=YR.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),DF("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[QG])/2:this._getSecondaryAxisLength(t[JG])/2,n=this._getSecondaryAxisLength(t[JG])/2):(s=this._getSecondaryAxisLength(t[JG])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[tY])/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[nY])}_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[xO]===t[xO]));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,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,_,y;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h: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!==f.alignLabel?(null==u?void 0:u.y2)+e:_-e,m=this._getPolygonCenter(i).x,_-y{lY(),ON(),GV(),YR.registerSeries(dY.type,dY),YR.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},jD))),YR.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Yw,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),VD()},pY=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},gY=t=>{const e=t.filter((t=>t.context.diffState===ZI.update)),i=K(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},fY=(t,e,i)=>{if(P(t))return[e,i];const s=K(t.map((t=>1*t.getFinalAttribute().startAngle))),n=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},mY=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=gY(i.parent.children),a=fY(r,s,n);return pY(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=gY(i.parent.children),a=fY(r,s,n);return pY(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),vY=t=>{const e=K(t.map((t=>1*t.getFinalAttribute().startAngle))),i=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},_Y=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=gY(i.parent.children),a=vY(r);return pY(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=gY(i.parent.children),a=vY(r);return pY(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),yY=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},bY=(t,e={})=>{if(!t)return[];const i=[];return TW(t,i,e),i},xY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new tG(i).layout(t,{width:s,height:n})};class SY extends fF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var AY;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(AY||(AY={}));const kY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===AY.DrillDown){return Y(JO(t,n,s,"children"))}if(i.type===AY.DrillUp){const e=QO(t,n,s,"children");if(e)return Y(e)}return t};class MY{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=CV(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;_I(t,"drillFilter",kY),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)||P(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:AY.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:AY.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)||P(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:AY.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:AY.DrillUp},model:this}),r}}const TY=Object.assign(Object.assign({},wF),{sunburst:{name:"sunburst",type:"arc"}}),wY=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:bF,operations:["max","min","values"]}),t.push({key:xF,operations:["values"]}),t),CY={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,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"}}}};class EY extends KN{constructor(){super(...arguments),this.type=cR.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:xF),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:xO},getRawData:()=>this.getRawData()}),this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(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),_I(this._dataSet,"sunburstLayout",xY),_I(this._dataSet,"flatten",bY),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 wY(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(_I(t.dataSet,"addVChartProperty",lF),t.transform({type:"addVChartProperty",options:{beforeCall:MF.bind(this),call:TF}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(EY.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_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()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(EY.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new SY(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(IF(null===(e=YR.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),DF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(IF(null===(e=YR.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),DF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),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]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}EY.type=cR.sunburst,EY.mark=TY,EY.builtInTheme={sunburst:CY},G(EY,MY);const BY=()=>{YR.registerSeries(EY.type,EY),oU(),ON(),VD(),YR.registerAnimation("sunburst",((t,e)=>({appear:yY(0,e),enter:mY(t),exit:_Y(t),disappear:{duration:FD.disappear.duration}})))},PY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new NW(i).layout(t,{width:s,height:n})};class LY extends fF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const RY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},OY=Object.assign(Object.assign({},wF),{circlePacking:{name:"circlePacking",type:"arc"}});class IY extends $F{constructor(){super(...arguments),this.type=cR.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:xF),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:xO},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),_I(this._dataSet,"circlePackingLayout",PY),_I(this._dataSet,"flatten",bY),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,valueField:this._valueField,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)||(_I(t.dataSet,"addVChartProperty",lF),t.transform({type:"addVChartProperty",options:{beforeCall:MF.bind(this),call:TF}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(IY.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_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},t.STATE_VALUE_ENUM.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(IY.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"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return wY(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new LY(this),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(IF(null===(i=YR.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),DF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(IF(null===(e=YR.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),DF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}IY.type=cR.circlePacking,IY.mark=OY,IY.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,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"}}}}},G(IY,MY);const DY=()=>{YR.registerSeries(IY.type,IY),oU(),ON(),HD(),YR.registerAnimation("circlePacking",((t,e)=>({appear:RY(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:FD.disappear.duration}})))},FY=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&FY(t,e.children,i)}))},zY=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},jY=(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 ZW(e),r=[];return r.push(n.layout(s,i)),r},HY=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:[]},VY=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 NY extends fF{constructor(){super(...arguments),this._getDimensionData=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},this.markTooltipValueCallback=t=>t.value}}const UY=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),WY=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:UY(t),GY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class YY extends kw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class $Y extends kw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const XY=(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,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=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}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},KY=(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,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=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}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class qY extends fN{constructor(){super(...arguments),this.type=qY.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?KY:XY,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}qY.type="linkPath";const ZY=Object.assign(Object.assign({},wF),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class JY extends UF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const QY=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&t.removeState(e),t.addState(e,s,n)};class t$ extends $F{constructor(){super(...arguments),this.type=cR.sankey,this.transformerConstructor=JY,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new Ve,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;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(p(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var e,i;if(!this._needClear)return;const s=null===(e=this._nodeMark)||void 0===e?void 0:e.getGraphics();if(!s||!s.length)return;const n=null===(i=this._linkMark)||void 0===i?void 0:i.getGraphics();n&&n.length&&(s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),n.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._needClear=!1)},this._handleNodeAdjacencyClick=e=>{const i=aI(e),s=[i.key];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,n)=>{const r=aI(e);r.source===i.key?(s.includes(r.target)||s.push(r.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):r.target===i.key?(s.includes(r.source)||s.push(r.source),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleLinkAdjacencyClick=e=>{const i=aI(e),s=[i.source,i.target];if(this._linkMark){const i=this._linkMark.getGraphics();if(!i||!i.length)return;i.forEach((i=>{i===e?(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),QY(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1})):(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),i.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleNodeRelatedClick=e=>{var i;const s=aI(e),n=this._nodeMark.getGraphics();if(!n||!n.length)return;const r=this._linkMark.getGraphics();if(!r||!r.length)return;const a=(null===(i=aI(r[0]))||void 0===i?void 0:i.parents)?"parents":"source";if("source"===a){const e=[s.key],i=[];if(r.forEach(((t,r)=>{var a,o,l,h;const c=aI(t),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(s.key)){if(i.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||i.push(null!==(o=c.key)&&void 0!==o?o:c.index),e.includes(c.source)||e.push(c.source),!e.includes(c.target)){e.push(c.target);let t=n.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.target))){e.push(t.target);const i=n.find((e=>e.data[0].key===t.target));s.push(i.data[0].targetLinks)}})),void(t=s)}}}else if(c.target===s.key&&(i.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||i.push(null!==(h=c.key)&&void 0!==h?h:c.index),!e.includes(c.source))){e.push(c.source);let t=n.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.source))){e.push(t.source);const i=n.find((e=>e.data[0].key===t.source));s.push(i.data[0].targetLinks)}})),void(t=s)}}})),this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,s)=>{var n;const r=aI(e);i.includes(null!==(n=r.key)&&void 0!==n?n:r.index)?(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}else{const e=[s.key],i=s.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const i=e.parents,n=i.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);r.forEach(((n,r)=>{const o=aI(n),l=o.datum,h=l?l.filter((t=>t[a].some((t=>t.key===s.key)))):null,c=i.find((t=>t.source===o.source&&t.target===o.target));if(h&&h.length){e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target);const i=h.reduce(((t,e)=>t+e.value),0),s=i/o.value;return n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void QY(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:s})}if(c)return e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target),n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void QY(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:c.value/o.value});n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),n.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}this._needClear=!0},this._handleLinkRelatedClick=e=>{const i=this._nodeMark.getGraphics();if(!i||!i.length)return;const s=this._linkMark.getGraphics();if(!s||!s.length)return;if("source"===(aI(e)?"parents":"source"))this._linkMark&&s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&i.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)}));else{const n=aI(e),r=[n.source,n.target],a=[];Y(n.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));a.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=r:a.push({source:i,target:n,value:r})}})),s.forEach((e=>{const i=aI(e),s=i.datum;if(i.source===n.source&&i.target===n.target)return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void QY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1});const o=s?s.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(n.source)&&e.includes(n.target)})):null;if(o&&o.length){r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target);const s=o.filter((t=>t.parents.some(((e,i)=>{var s;return e.key===n.source&&(null===(s=t.parents[i+1])||void 0===s?void 0:s.key)===n.target})))).reduce(((t,e)=>t+e.value),0),a=s/i.value;return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void QY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:a})}const l=a.find((t=>t.source===i.source&&t.target===i.target));if(l)return r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void QY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:l.value/i.value});e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(i,r)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}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:this._spec.categoryField)}initData(){var e,i,s,n;super.initData();const r=this.getViewData(),a=this.getRawData();if(a&&r){_I(this._dataSet,"sankeyLayout",jY),_I(this._dataSet,"sankeyFormat",zY),a.transform({type:"sankeyFormat"},!1),r.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.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(e=this._spec.nodeAlign)&&void 0!==e?e:"justify",nodeGap:null!==(i=this._spec.nodeGap)&&void 0!==i?i:8,nodeWidth:null!==(s=this._spec.nodeWidth)&&void 0!==s?s:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(n=this._spec.minNodeHeight)&&void 0!==n?n:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,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,inverse:this._spec.inverse},level:t.TransformLevel.sankeyLayout});const{dataSet:o}=this._option;_I(o,"sankeyNodes",HY),_I(o,"flatten",bY);const l=new Pa(o,{name:`sankey-node-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyNodes"}),l.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),l.transform({type:"addVChartProperty",options:{beforeCall:AF.bind(this),call:kF}},!1),this._nodesSeriesData=l,_I(o,"sankeyLinks",VY);const h=new Pa(o,{name:`sankey-link-${this.id}-data`});h.parse([this.getViewData()],{type:"dataview"}),h.transform({type:"sankeyLinks"}),h.transform({type:"addVChartProperty",options:{beforeCall:AF.bind(this),call:kF}},!1),this._linksSeriesData=h}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(t$.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(t$.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,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()}_initNodeMarkStyle(){var e,i;const s=this._nodeMark;s&&(this.setMarkStyle(s,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Mark),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.node.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByNode},"normal",t.AttributeLevel.User_Mark))}_initLinkMarkStyle(){var e,i;const s=this._linkMark;s&&(s.setGlyphConfig({direction:this.direction}),this.setMarkStyle(s,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.link.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByLink},"normal",t.AttributeLevel.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=rF(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={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;this._nodeMark&&this._nodeMark.setAnimationConfig(IF(null===(i=YR.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),DF("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(IF(null===(s=YR.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),DF("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:pI.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(e,i){e&&e.length&&e.forEach((e=>{e.removeState([t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]),i.includes(aI(e).key)?e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0):e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new NY(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_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&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new AR;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_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 FY(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),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]}getMarkData(t){return t.datum?y(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}t$.type=cR.sankey,t$.transformerConstructor=JY,t$.mark=ZY,t$.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const e$=()=>{JH(),mN(),Wk(),YR.registerGraphicComponent("path",(t=>tf(t))),YR.registerMark(qY.type,qY),ON(),YR.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:WY(t,e)},jD))),YR.registerAnimation("sankeyLinkPath",((t,e)=>({appear:GY(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:FD.disappear.duration}}))),pw.registerBuiltInAnimate("linkPathGrowOut",$Y),pw.registerBuiltInAnimate("linkPathGrowIn",YY),VD(),YR.registerSeries(t$.type,t$)},i$=(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=bY(n);return i=vF([{latestData:r}],e),i};class s$ extends fF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const n$=Object.assign(Object.assign({},wF),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),r$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class a$ extends UF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const o$=(t,e)=>{if(e.getViewBox()){const i=new nG(e).layout(t,e.getViewBox()),s=[];return TW(i,s,{maxDepth:null==e?void 0:e.maxDepth}),s.forEach(((t,i)=>{t&&[xF,"name"].forEach((i=>{t[i]=t.datum[t.depth][e.nameField]}))})),s}return[]};class l$ extends $F{constructor(){super(...arguments),this.type=cR.treemap,this.transformerConstructor=a$,this._categoryField="name",this._valueField="value",this._viewBox=new Ve,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:xF),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new We),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:xO},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,s,n;super.initData(),_I(this._dataSet,"treemap",o$),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{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}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(_I(this._rawData.dataSet,"addVChartProperty",lF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:MF.bind(this),call:TF}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=i$([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=j(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){_I(this._dataSet,"hierarchyDimensionStatistics",i$),_I(this._dataSet,"flatten",bY);const i=new Pa(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 wY(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(l$.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(l$.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}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()},t.STATE_VALUE_ENUM.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()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRichStyleOfLabelMark(e){"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(IF(null===(e=YR.getAnimationInKey("treemap"))||void 0===e?void 0:e(),DF(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 s$(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(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(hI.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(hI.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}l$.type=cR.treemap,l$.mark=n$,l$.builtInTheme={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"}}}},l$.transformerConstructor=a$,G(l$,MY),G(l$,BV);const h$=()=>{YR.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),YR.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),JH(),ON(),YR.registerAnimation("treemap",((t,e)=>({appear:r$(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:FD.disappear.duration}}))),VD(),YR.registerSeries(l$.type,l$)},c$=Object.assign(Object.assign({},qU),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),d$=Object.assign(Object.assign({},wF),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),u$={type:"fadeIn"};function p$(t,e){return"fadeIn"===e?u$:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class g$ extends UF{constructor(){super(...arguments),this._supportStack=!1}}class f$ extends fF{enableByType(t){return"dimension"!==t}}const m$="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",v$={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:m$,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:m$,fill:"#ddd"}}};class _$ extends ZU{constructor(){super(...arguments),this.type=cR.gaugePointer,this.transformerConstructor=g$,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(_$.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},_$.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(_$.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(){this._tooltipHelper=new f$(this),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=K(e),n=_t(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})}getInteractionTriggers(){return 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(IF(null===(i=YR.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),DF("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}_$.type=cR.gaugePointer,_$.mark=d$,_$.builtInTheme={gaugePointer:v$},_$.transformerConstructor=g$;const y$=()=>{YR.registerSeries(_$.type,_$),AV(),JH(),YR.registerAnimation("gaugePointer",((t,e)=>{const i=p$(t,e);return{appear:i,enter:i,disappear:{duration:FD.disappear.duration}}})),EU(),wU()};class b$ extends UF{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class x$ extends ZU{constructor(){super(...arguments),this.type=cR.gauge,this.transformerConstructor=b$,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=oe(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();_I(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[HO]=t[this._angleField[0]],t[jO]=e>0?i[e-1][HO]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(x$.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(x$.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})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e&&"segment"===e.name){const i=this.getSpec().segment;if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}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),s=bt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?TR(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?TR(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return p(t[jO])?this.angleAxisHelper.dataToPosition([t[jO]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[HO]])}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(IF(null===(i=YR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),DF("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}x$.type=cR.gauge,x$.mark=c$,x$.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},x$.transformerConstructor=b$;class S$ extends CD{constructor(){super(...arguments),this.type=S$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Eg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="rect":a.symbolType=o,a}}S$.type="cell";function A$(t){return!1===t?{}:{type:"fadeIn"}}class k$ extends fF{enableByType(t){return"dimension"!==t}}const M$=Object.assign(Object.assign({},wF),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class T$ extends UF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class w$ extends $F{constructor(){super(...arguments),this.type=cR.heatmap,this.transformerConstructor=T$}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(w$.mark.cell,{isSeriesMark:!0},{morph:jF(this._spec,w$.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(w$.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){var e,i,s;t&&this.setMarkStyle(t,{fill:null!==(s=null===(i=null===(e=this._spec.cell)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s: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=ai(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]}}getInteractionTriggers(){return 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=YF(this);this._cellMark.setAnimationConfig(IF(null===(i=YR.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),DF("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 k$(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}w$.type=cR.heatmap,w$.mark=M$,w$.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1},label:{style:{lineWidth:2}}}},w$.transformerConstructor=T$;const C$=()=>{ON(),YR.registerMark(S$.type,S$),YR.registerGraphicComponent("symbol",Eg),Jk(),tM(),kB(),YR.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},jD),{appear:A$(e)}))),Cj(),kj(),YR.registerSeries(w$.type,w$)},E$=Object.assign(Object.assign({},wF),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),B$=`${mO}_CORRELATION_X`,P$=`${mO}_CORRELATION_Y`,L$=`${mO}_CORRELATION_SIZE`,R$=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,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=oe(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=oe(null!==(s=e.endAngle)&&void 0!==s?s:270),A=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),k=Lt(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=Lt(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+Lt(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+Lt(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=Pt(e.field),C=t.map(w),[E,B]=Ot(C),P=E===B?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(B-E),L=u(e.radiusField)?w:Pt(e.radiusField),R=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=>R;if(L){const[i,s]=L!==w?Ot(t.map(L)):[E,B],n=null!==(f=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==f?f:5,r=null!==(v=null===(m=e.radiusRange)||void 0===m?void 0:m[1])&&void 0!==v?v:5;i!==s&&(O=t=>n+(r-n)*(L(t)-i)/(s-i))}const I=Math.min(b,x),D=Math.max(b,x),F=O$(I,D,t.length),z=[],j=(D-I)/60;return t.forEach(((t,e)=>{const i=P(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),I$({x:n,y:r,size:s},z)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=j,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},I$=(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,[bO]:null==n?void 0:n[bO],[SO]:null==n?void 0:n[SO]}};class F$ extends fN{constructor(){super(...arguments),this.type=F$.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=_t(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}F$.type="ripple";const z$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class j$ extends UF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class H$ extends KN{constructor(){super(...arguments),this.type=cR.correlation,this.transformerConstructor=j$,this._viewBox=new Ve}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;_I(this._dataSet,"correlation",R$);const s=new Ba;yI(s,"dataview",wa),_I(s,"correlationCenter",D$);const n=new Pa(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 AD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_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(){const e=this._createMark(H$.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:bO});e&&(e.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._nodePointMark=e);const i=this._createMark(H$.mark.ripplePoint,{key:bO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(this._ripplePointMark=i);const s=this._createMark(H$.mark.centerPoint,{key:bO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});s&&(s.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._centerPointMark=s)}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[B$],y:t=>t[P$],size:t=>t[L$],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.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)},t.STATE_VALUE_ENUM.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(IF(null===(e=YR.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),DF("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(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}H$.type=cR.correlation,H$.mark=E$,H$.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},H$.transformerConstructor=j$;const V$=()=>{yz(),mN(),tM(),YR.registerMark(F$.type,F$),YR.registerGraphicComponent("symbol",(t=>Eg(t))),YR.registerSeries(H$.type,H$),YR.registerAnimation("correlation",((t,e)=>Object.assign({appear:z$(0,e)},zD)))},N$=Object.assign(Object.assign({},wF),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class U$ extends fN{constructor(){super(...arguments),this.type=U$.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}U$.type="liquid";const W$=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class G$ extends fF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class Y$ extends WF{constructor(){super(...arguments),this.type=cR.liquid,this.transformerConstructor=bz,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Dg({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Eg({x:s,y:n,size:r,symbolType:W$(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=IR(this._spec.outlineMargin),this._paddingSpec=IR(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Yt(...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(Y$.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(Y$.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(Y$.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(Y$.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.created(),this.setMarkStyle(e,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new G$(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(IF(null===(i=YR.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),DF("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(IF(null===(s=YR.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),DF("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=kM(t.attribute.fill,n.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]}}Y$.type=cR.liquid,Y$.mark=N$,Y$.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},Y$.transformerConstructor=bz;const $$=t=>Y(t).join(",");class X$ extends fF{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>$$(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>$$(null==t?void 0:t[this.series.getDimensionField()[0]])}}const K$=Object.assign(Object.assign({},wF),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class q$ extends UF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const Z$=(t,e)=>{const i=e.getViewBox();return i&&(null==t?void 0:t.length)?mG(Object.assign({setField:e.setField,valueField:e.valueField},i),t):[]};class J$ extends WF{constructor(){super(...arguments),this.type=cR.venn,this.transformerConstructor=q$,this._viewBox=new Ve}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:xO)}initData(){var t;super.initData(),_I(this._dataSet,"venn",Z$),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:{getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField}})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(J$.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(J$.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()},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},t.STATE_VALUE_ENUM.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=>$$(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)}},t.STATE_VALUE_ENUM.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=>$$(t.sets)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new X$(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(){super.onLayoutEnd(),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:$$(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return $$(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[$$(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($$(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(IF(null===(e=YR.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),DF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(IF(null===(e=YR.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),DF(t.name,this._spec,this._markAttributeContext)))}))}}J$.type=cR.venn,J$.mark=K$,J$.builtInTheme={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"}}}}},J$.transformerConstructor=q$;class Q$ extends sV{constructor(){super(...arguments),this.type=cR.mosaic,this.transformerConstructor=iV}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(DO),this.setFieldX2(IO)),this.setFieldY(zO),this.setFieldY2(FO)):(t&&(this.setFieldY(DO),this.setFieldY2(IO)),this.setFieldX(zO),this.setFieldX2(FO)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&u(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];u(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}Q$.type=cR.mosaic,Q$.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},Q$.transformerConstructor=iV;class tX extends Zj{_isValidSeries(t){return t===cR.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class eX extends Kj{constructor(){super(...arguments),this.transformerConstructor=tX,this.type="map",this.seriesType=cR.map}}eX.type="map",eX.seriesType=cR.map,eX.transformerConstructor=tX;class iX extends Zj{_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,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],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 sX extends iX{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_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=Lz(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,GR({},s,l)),n&&Object.assign(o,GR({},n,o))}}class nX extends iX{needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}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 rX extends iX{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class aX extends Kj{constructor(){super(...arguments),this.transformerConstructor=rX}}aX.transformerConstructor=rX;class oX extends aX{constructor(){super(...arguments),this.transformerConstructor=rX,this.type="pie",this.seriesType=cR.pie}}oX.type="pie",oX.seriesType=cR.pie,oX.transformerConstructor=rX;class lX extends nX{_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return n.radius=null!==(e=t.radius)&&void 0!==e?e:Xz,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:Xz,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}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=>GR({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const hX=(t,e)=>{if(!t)return null;const i=oz(t,(t=>"angle"===t.getOrient()),e),s=oz(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&UC(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=eR({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=K(e),n=X(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=iR(d),f=null===(e=s[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 _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=rz(v,t,"polar",r);n.push({index:_,value:v,position:i.scale(v),axis:t,data:y})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&UC(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=eR({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=iR(c),g=null===(e=i[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=s.invert(p);if(u(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const _=rz(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:_})}})),n.length?n:null};class cX extends Kj{constructor(){super(...arguments),this.transformerConstructor=lX,this.type="rose",this.seriesType=cR.rose}_setModelOption(){this._modelOption.getDimensionInfo=hX}}cX.type="rose",cX.seriesType=cR.rose,cX.transformerConstructor=lX,G(cX,iH);class dX extends nX{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t);return i.line=t.line,i.point=t.point,i.stack=t.stack,i.percent=t.percent,i.area=GR({visible:!1},t.area),i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"area",i.activePoint=t.activePoint,i.pointDis=t.pointDis,i.pointDisMul=t.pointDisMul,i.markOverlap=t.markOverlap,i}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=>GR({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class uX extends Kj{constructor(){super(...arguments),this.transformerConstructor=dX,this.type="radar",this.seriesType=cR.radar}_setModelOption(){this._modelOption.getDimensionInfo=hX}}uX.type="radar",uX.seriesType=cR.radar,uX.transformerConstructor=dX,G(uX,iH);class pX extends Zj{_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=>{L(e,"trimPadding")&&GR(e,$I(this.type,t))})),this._transformAxisSpec(t)}}class gX extends Kj{constructor(){super(...arguments),this.transformerConstructor=pX,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=uH(t,e,i))&&void 0!==s?s:[],...null!==(n=hX(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=gH,this._modelOption.getRectByDimensionData=bH}}gX.type="common",gX.transformerConstructor=pX,G(gX,iH);class fX extends Jj{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class mX extends Kj{constructor(){super(...arguments),this.transformerConstructor=fX}}mX.transformerConstructor=fX,G(mX,iH);class vX extends fX{transformSpec(t){super.transformSpec(t),WI(t)}}class _X extends mX{constructor(){super(...arguments),this.transformerConstructor=vX,this.type="histogram",this.seriesType=cR.bar}_setModelOption(){this._modelOption.getDimensionInfo=uH,this._modelOption.getDimensionInfoByValue=gH,this._modelOption.getRectByDimensionData=bH}}_X.type="histogram",_X.seriesType=cR.bar,_X.transformerConstructor=vX;class yX extends sX{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class bX extends Kj{constructor(){super(...arguments),this.transformerConstructor=yX,this.type="circularProgress",this.seriesType=cR.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=hX}}bX.type="circularProgress",bX.seriesType=cR.circularProgress,bX.transformerConstructor=yX,G(bX,iH);class xX extends sX{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=cR.circularProgress,e}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===cR.gauge||t.type===cR.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===cR.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 SX extends Kj{constructor(){super(...arguments),this.transformerConstructor=xX,this.type="gauge",this.seriesType=cR.gaugePointer}}SX.type="gauge",SX.seriesType=cR.gaugePointer,SX.transformerConstructor=xX;class AX extends Zj{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class kX extends Kj{constructor(){super(...arguments),this.transformerConstructor=AX,this.type="wordCloud",this.seriesType=cR.wordCloud}}kX.transformerConstructor=AX;class MX extends kX{constructor(){super(...arguments),this.transformerConstructor=AX,this.type="wordCloud",this.seriesType=cR.wordCloud}}MX.type="wordCloud",MX.seriesType=cR.wordCloud,MX.transformerConstructor=AX;class TX extends Zj{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class wX extends Kj{constructor(){super(...arguments),this.transformerConstructor=TX,this.type="funnel",this.seriesType=cR.funnel}}wX.type="funnel",wX.seriesType=cR.funnel,wX.transformerConstructor=TX;class CX extends Jj{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}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=Lz(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=Lz(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class EX extends Kj{constructor(){super(...arguments),this.transformerConstructor=CX,this.type="linearProgress",this.seriesType=cR.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=uH,this._modelOption.getDimensionInfoByValue=gH,this._modelOption.getRectByDimensionData=bH}}EX.type="linearProgress",EX.seriesType=cR.linearProgress,EX.transformerConstructor=CX,G(EX,iH);class BX extends Jj{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"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),WI(t)}}class PX extends Kj{constructor(){super(...arguments),this.transformerConstructor=BX,this.type="rangeColumn",this.seriesType=cR.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=uH,this._modelOption.getDimensionInfoByValue=gH,this._modelOption.getRectByDimensionData=bH}}PX.type="rangeColumn",PX.seriesType=cR.rangeColumn,PX.transformerConstructor=BX;class LX extends Zj{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+le(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class RX extends Kj{constructor(){super(...arguments),this.transformerConstructor=LX,this.type="sunburst",this.seriesType=cR.sunburst}}RX.type="sunburst",RX.seriesType=cR.sunburst,RX.transformerConstructor=LX;class OX extends Zj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class IX extends Kj{constructor(){super(...arguments),this.transformerConstructor=OX,this.type="circlePacking",this.seriesType=cR.circlePacking}}IX.type="circlePacking",IX.seriesType=cR.circlePacking,IX.transformerConstructor=OX;class DX extends Zj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class FX extends Kj{constructor(){super(...arguments),this.transformerConstructor=DX,this.type="treemap",this.seriesType=cR.treemap}}FX.type="treemap",FX.seriesType=cR.treemap,FX.transformerConstructor=DX;class zX extends rV{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),WI(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class jX extends aV{constructor(){super(...arguments),this.transformerConstructor=zX,this.type="waterfall",this.seriesType=cR.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=uH,this._modelOption.getDimensionInfoByValue=gH,this._modelOption.getRectByDimensionData=bH}}jX.type="waterfall",jX.seriesType=cR.waterfall,jX.transformerConstructor=zX;class HX extends Jj{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),WI(t)}}class VX extends Kj{constructor(){super(...arguments),this.transformerConstructor=HX,this.type="boxPlot",this.seriesType=cR.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=uH,this._modelOption.getDimensionInfoByValue=gH,this._modelOption.getRectByDimensionData=bH}}VX.type="boxPlot",VX.seriesType=cR.boxPlot,VX.transformerConstructor=HX;class NX extends Zj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class UX extends Kj{constructor(){super(...arguments),this.transformerConstructor=NX,this.type="sankey",this.seriesType=cR.sankey}_setStateInDatum(t,e,i,s){const n=y(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=aI(t))||void 0===e?void 0:e.datum;return y(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}UX.type="sankey",UX.seriesType=cR.sankey,UX.transformerConstructor=NX;class WX extends Jj{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.area=t.area,s.point=t.point,s.line=t.line,"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),WI(t)}}class GX extends Kj{constructor(){super(...arguments),this.transformerConstructor=WX,this.type="rangeArea",this.seriesType=cR.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=uH,this._modelOption.getDimensionInfoByValue=gH,this._modelOption.getRectByDimensionData=bH}}GX.type="rangeArea",GX.seriesType=cR.rangeArea,GX.transformerConstructor=WX;class YX extends Jj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class $X extends Kj{constructor(){super(...arguments),this.transformerConstructor=YX,this.type="heatmap",this.seriesType=cR.heatmap}}$X.type="heatmap",$X.seriesType=cR.heatmap,$X.transformerConstructor=YX;class XX extends Zj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class KX extends Kj{constructor(){super(...arguments),this.transformerConstructor=XX,this.type="correlation",this.seriesType=cR.correlation}}KX.type="correlation",KX.seriesType=cR.correlation,KX.transformerConstructor=XX;function qX(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=nI(t.style)),P(t.textStyle)||GR(s.textStyle,nI(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&nI(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&nI(s.background.style),s}const ZX=(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},JX=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const u={};c.forEach((t=>{u[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:SO;return h?h(t,c,g):(y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===u[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===u[t.source]&&!0===u[t.target])))):p(g)&&(t=t.filter((t=>!0===u[r.getSeriesFieldValue(t,g)]))),t)};class QX extends tj{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:()=>{nR(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),nR(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=ER(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()}_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):(U(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new AD(this._option,e),this._initSelectedData(),nR(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(nR(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)U(s,this._cacheAttrs)||this._legendComponent.setAttributes(GR({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(GR({},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;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());U(t,this._cacheAttrs)||this._legendComponent.setAttributes(GR({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}QX.specKey="legends";class tK extends QX{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return aF(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),nR(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){_I(this._option.dataSet,"discreteLegendFilter",JX),_I(this._option.dataSet,"discreteLegendDataMake",ZX);const t=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return nR(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(!Jy(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=GO(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 s=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:n={},item:r={},pager:a={},background:o={}}=t;n=I(n),r=I(r),a=I(a),o=I(o);const l=s;return n.visible?l.title=qX(n):l.title={visible:!1},P(r.focusIconStyle)||nI(r.focusIconStyle),r.shape&&(r.shape=eI(r.shape)),r.label&&(r.label=eI(r.label)),r.value&&(r.value=eI(r.value)),r.background&&(r.background=eI(r.background)),BR(r.maxWidth)&&(r.maxWidth=Number(r.maxWidth.substring(0,r.maxWidth.length-1))*i.width/100),BR(r.width)&&(r.width=Number(r.width.substring(0,r.width.length-1))*i.width/100),BR(r.height)&&(r.height=Number(r.height.substring(0,r.height.length-1))*i.width/100),l.item=r,"scrollbar"===a.type?(P(a.railStyle)||nI(a.railStyle),P(a.sliderStyle)||nI(a.sliderStyle)):(P(a.textStyle)||nI(a.textStyle),a.handler&&eI(a.handler)),l.pager=a,o.visible&&!P(o.style)&&(GR(l,o.style),p(o.padding)&&(l.padding=o.padding)),l}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return uL}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(rL.legendItemClick,(i=>{const s=L(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(rL.legendItemHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(rL.legendItemUnHover,(e=>{const i=L(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}=rF(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=rF(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}tK.specKey="legends",tK.builtInTheme={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}},tK.type=r.discreteLegend;const eK=(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[]},iK=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=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(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?tI(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};function sK(t){const i=GR({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:u={},type:g,id:f,visible:m,orient:v,position:_,data:y,defaultSelected:b,field:x,filter:S,regionId:A,regionIndex:k,seriesIndex:M,seriesId:T,padding:w}=i,C=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?C.title=qX(s):C.title={visible:!1},C.showHandler=!1!==n.visible,P(n.style)||(C.handlerStyle=nI(n.style)),p(r.width)&&(C.railWidth=r.width),p(r.height)&&(C.railHeight=r.height),P(r.style)||(C.railStyle=nI(r.style)),P(a.style)||(C.trackStyle=nI(a.style)),C.startText=eI(o),C.endText=eI(l),C.handlerText=function(t){if(!t)return t;const e=Object.assign({},t),i=t.style;return d(i)?e.style=(t,e,s)=>nI(i(t,e,s)):P(i)||(e.style=nI(i)),e}(h),P(c)||(C.sizeBackground=nI(c)),u.visible&&!P(u.style)&&(GR(C,u.style),p(u.padding)&&(C.padding=u.padding)),C}const nK={color:vL,size:yL},rK={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}},aK=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},rK),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},oK={horizontal:aK(!0),vertical:aK(!1)},lK=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},rK),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},hK={horizontal:lK(!0),vertical:lK(!1)},cK=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],dK=[2,10];class uK extends QX{static getSpecInfo(t){const e=aF(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}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(e){super.init(e),nR(this._regions,(e=>{e.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:e.isHierarchyData,customFilter:this._spec.customFilter},level:t.TransformLevel.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(){_I(this._option.dataSet,"continuousLegendFilter",iK),_I(this._option.dataSet,"continuousLegendDataMake",eK);const t=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>rR(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=GO(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!Jy(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=GO(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var e,i;const s="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",n="horizontal"===s?"bottom":this.layoutOrient;let r=[];const a=this._getScaleInGlobal();a&&"linear"===a.type&&(r=a.range()),P(r)&&(r="color"===this._legendType?cK:dK);let o=null!==(e=this._legendData.getLatestData()[0])&&void 0!==e?e:0,l=null!==(i=this._legendData.getLatestData()[1])&&void 0!==i?i:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(o=Math.min(0,this._legendData.getLatestData()[0]),l=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const h=Object.assign({layout:s,align:n,zIndex:this.layoutZIndex,min:o,max:l,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:r},sK(this._spec));return this._addDefaultTitleText(h),h}_getLegendConstructor(){return nK[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",St((i=>{const s=L(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}uK.specKey="legends",uK.builtInTheme={colorLegend:oK,sizeLegend:hK},uK.type=r.continuousLegend;const pK=(t,e)=>p(e)?t.map((t=>e[t])):void 0,gK=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),fK=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function mK(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),d=i.getOption(),g=d.getRegionsInUserIdOrIndex(p(c.regionId)?[c.regionId]:void 0,p(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=vK(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),_=g.getLayoutRect(),y=d.globalInstance.getContainer(),b=Object.assign({x:0,y:0},y?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(y):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>gK(i,s)(t)&&gK(n,r)(t)&&(u(a)||gK([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),A=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),_.width),y:Math.min(Math.max(t.y,0),_.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.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 l=[{value:t[e.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=>x(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=d.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:uI.chart,event:A({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=d.globalInstance;return tF.globalConfig.uniqueTooltip&&tF.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=d.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:uI.chart,event:A(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=d.globalInstance;return tF.globalConfig.uniqueTooltip&&tF.hideTooltip(a.id),m}return"none"}const vK=(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(),f=p(g)?t[g]:void 0,m=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=pK(c,t);let _=pK(d,t);const y=fK(_),b=!y&&p(g)&&u(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(gK(c,v));if(!y&&(_=pK(d,i),!fK(_)))return;const n=e.type===cR.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:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=UC(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(gK(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=pK(d,o),!fK(_))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(gK(c,n));if(!y&&(_=pK(d,r),!fK(_)))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:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===cR.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(gK(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(_=pK(d,i),!fK(_))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&&(()=>{var i,n,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(gK(c,v));const o=e.getNameMap(),l=null===(r=null===(n=e.getMapViewData)||void 0===n?void 0:n.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=_;if(l&&!a&&(a=Object.assign({},t)),!y){if(_=pK(d,a),h=_,!fK(_)&&!a)return;fK(_)||(_=[null])}const p=e.dataToPosition(a);u(p)||isNaN(p.x)||isNaN(p.y)||s.push({pos:p,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:h,hasMeasureData:y,groupField:g,groupData:f,originDatum:a},series:e})})()})),s},_K=t=>p(t)&&!y(t),yK=t=>p(t)&&y(t);class bK extends Qz{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i,s,n;const{spec:r,theme:a}=super._initTheme(t,e);return r.style=GR({},this._theme,r.style),r.offset=GR({},a.offset,t.offset),r.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:a.transitionDuration,r.trigger=null!==(s=t.trigger)&&void 0!==s?s:a.trigger,r.triggerOff=null!==(n=t.triggerOff)&&void 0!==n?n:a.triggerOff,{spec:r,theme:a}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(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]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:Xy(this._option.mode)||!Yy(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.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?_(t.parentElement)&&(t.parentElement=k_.getElementById(t.parentElement)):Yy(this._option.mode)&&(t.parentElement=null==Gy?void 0:Gy.body)}}const xK={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}};class SK extends tj{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=bK,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=Yy(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&_K(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!u(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&tF.globalConfig.uniqueTooltip&&l&&tF.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;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;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:uI.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(null==r?void 0:r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:uI.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),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,this._enterable=!1;else{const t="canvas"===s?kH.canvas:kH.dom,n=YR.getComponentPluginInType(t);n||Ny("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,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=YR.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=Y(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),($y(s)||Xy(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,At(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===s||s.call(i)}else 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=mK(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_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(yK(t)){if(_K(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>sz(t,e[i])))}if(yK(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.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: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}getVisible(){return!1!==this._spec.visible}}SK.type=r.tooltip,SK.transformerConstructor=bK,SK.builtInTheme={tooltip:xK},SK.specKey="tooltip";var AK,kK;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(AK||(AK={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(kK||(kK={}));const MK={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class TK extends tj{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=At((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},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.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{UC(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_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}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(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(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:pI.chart}:{source:uI.chart};y(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,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)}onBeforeRender(){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"}:$y(e)||Xy(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:uI.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:uI.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:uI.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=L(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{MK[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=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const u=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+u.left),o=Math.min(o,i-d+u.top),l=Math.max(l,e+t.getLayoutRect().width-c-u.right),h=Math.max(h,i+t.getLayoutRect().height-d-u.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_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)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_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 i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=L(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=L(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:d}=n,u=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:L(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{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||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}TK.specKey="crosshair";const wK={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}}}}};class CK extends TK{static getSpecInfo(t){return aF(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_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)}}_getDatumAtPoint(t,e){const i=XF(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){XF(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:KF(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();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 o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=aR(this._regions,"cartesian");e&&(fH(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=_H(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new lT(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new hT(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}CK.specKey="crosshair",CK.builtInTheme={crosshair:wK},CK.type=r.cartesianCrosshair;class EK extends TK{static getSpecInfo(t){return aF(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_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)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_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}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=aR(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&p(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=Pz(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=rF(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:ce(d,a.getInnerRadius(),o),end:ce(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=ue(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=ce(t,o,r),d=ce(t,o,h),m=_e([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=_t(ae.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new lT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new dT(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new uT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new cT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=pe(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}}(u):function(t){let e="center",i="middle";return e=(t=pe(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}}(g.startAngle),a="angle"===l?ce(e,p[1]+m.offset,u):ce(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}EK.specKey="crosshair",EK.builtInTheme={crosshair:wK},EK.type=r.polarCrosshair;const BK=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(u(o)||u(a))return t;const l=r(),h=y(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},PK=(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=>{let e=!1;return Y(r).every((i=>{t[i]>=a[0]&&t[i]<=$(a)&&(e=!0)})),e}:t=>{let e=!1;return Y(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},LK=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],d=[],g=[];let f=!1,m=!1;n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);p(null==t?void 0:t.max)&&p(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{u(h[t])&&(g.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(h[t[i]])&&(g.push(t[i]),h[t[i]]=0,c.push(t[i])),u(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const v=f?g:!1===r||m?g.sort(((t,e)=>t-e)):c;return v.forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),d.push(e)})),d},RK=(t,e,i)=>{const s=e.domain();if(VC(e.type))return i?s[0]+($(s)-s[0])*(1-t):s[0]+($(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+($(n)-n[0])*t;return e.invert(r)},OK=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&VC(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/($(n)-n[0])))},IK=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},DK=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}},FK=(t,e,i)=>"start"===t?"percent"===e&&p(i.start)||"value"===e&&p(i.startValue):"percent"===e&&p(i.end)||"value"===e&&p(i.endValue),zK=(t,e,i)=>{if(VC(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class jK{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})}constructor(t,e,i,s,n,r,a,o){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.initZoomEvent=()=>{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,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),d=Math.abs(this.getState().start-this.getState().end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=_t(this.getState().start+f,0,1),_=_t(this.getState().end-m,0,1);this._handleChange(Math.min(v,_),Math.max(v,_),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Ut(s/n)>=.5:Ut(n/s)>=.5;if(this._scrollAttr.reverse||(r=-r),a){const t=this._spec.scrollStep;if(k(t)){r=(r>0?1:-1)*(t*(this.getState().end-this.getState().start)/1)}this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1)}const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))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.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===JF(ZF(e))}setEventAttrFromSpec(){!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=j({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=j({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=j({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,c(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&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.getEvent(),this._option.mode)}}G(jK,BV);class HK extends tj{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:OK(t,this._stateScale,this._isHorizontal),a="percent"===n?e:OK(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var e;this._dataFilterEvent.initZoomEvent(),null===(e=this._relatedAxisComponent)||void 0===e||e.event.on(t.ChartEvent.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_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)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=IK(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[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._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._currentDataCollection=[],this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=zK(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!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&&DK(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({value:"force"})}else nR(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),nR(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=ZF(t),this._isHorizontal="horizontal"===JF(this._orient),this._dataFilterEvent=new jK(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){this._handleDataCollectionChangeBound=this._handleDataCollectionChange.bind(this),super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(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])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(VC(n.type)){const r=n.domain(),a=r[0],o=$(r)-a,l=p(t)?a+o*t:+e,h=p(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=p(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=p(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}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}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_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=>JF(t._orient)===JF(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!VC(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;}_collectDataInfo(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};nR(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l,u=VC(d.getScale(0).type),p=VC(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?Y(g.xField):Y(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?Y(g.yField):Y(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:d===l?f:m;u&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else nR(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});return{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}}_initData(){const{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}=this._collectDataInfo(),{dataSet:r}=this._option;yI(r,"dataview",wa),_I(r,"dataFilterComputeDomain",LK);const a=new Pa(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new AD(this._option,a),a.reRunAllTransform(),this._currentDataCollection=t,r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChangeBound)}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(_I(this._option.dataSet,"dataFilterWithNewDomain",PK),_I(this._option.dataSet,"lockStatisticsFilter",BK),nR(this._regions,(e=>{e.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>e.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>VC(this._stateScale.type)},level:1},!1),e.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>VC(this._stateScale.type)},level:t.TransformLevel.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r}=this._collectDataInfo();if(this._currentDataCollection.length!==e.length||this._currentDataCollection.some(((t,i)=>t!==e[i]))){this._currentDataCollection.forEach((t=>{var e;null===(e=null==t?void 0:t.target)||void 0===e||e.removeListener("change",this._handleDataCollectionChangeBound)})),this._currentDataCollection=e;const{dataSet:t}=this._option;t.multipleDataViewAddListener(this._currentDataCollection,"change",this._handleDataCollectionChangeBound)}this._data.getDataView().transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data.getDataView().reRunAllTransform();const a=this._computeDomainOfStateScale(VC(this._stateScale.type));this._stateScale.domain(a,!1),(p(this._spec.start)||p(this._spec.end))&&this._setStateFromSpec(),this._handleChange(this._start,this._end,!0),this._spec.auto&&!U(this._domainCache,a)&&(this._domainCache=a,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;FK("start",i,this._spec)&&FK("end",s,this._spec)&&(t="percent"===i?this._spec.start:OK(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:OK(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?OK(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?OK(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=RK(this._start,this._stateScale,IK(i,this._isHorizontal)),this._endValue=RK(this._end,this._stateScale,IK(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,VC(this._stateScale.type)&&this._stateScale.domain()[0]!==$(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=zK(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&nR(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);k(null==i?void 0:i.min)&&k(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new PE:new cE,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_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?[K(t),X(t)]:[-1/0,1/0]}return e}_autoVisible(e){if(!this._auto)return;e?this.show():this.hide();const i=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[i]:e?this[`_${i}`]:0},{[i]:t.AttributeLevel.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_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=DK(h);if(!this._dataUpdating&&UC(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,UC(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),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}G(HK,BV);class VK extends Qz{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=GR({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}}}const NK=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),UK={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:NK(!1),startHandler:{style:{symbolType:"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;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"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;",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:NK(!0)};class WK extends HK{constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=VK,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=this._isHorizontal?0:this._middleHandlerSize,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=this._isHorizontal?0:this._middleHandlerSize,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._getPreviewStateScale(),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._getPreviewStateScale(),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"}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange)if(s&&this._component)this._component.setStartAndEnd(e,i);else{const s=this._relatedAxisComponent,r=RK(e,this._stateScale,IK(s,this._isHorizontal)),a=RK(i,this._stateScale,IK(s,this._isHorizontal));if(!p(r)||!p(a))return;this._start=e,this._end=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(){this._data.getDataView().reRunAllTransform(),this._initAfterLayout();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new PE),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(IK(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=IK(t,this._isHorizontal),this.effect.onZoomChange())}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,d=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+d,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+d),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);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(),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=isNaN(c)?this._backgroundSize:c-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=isNaN(c)?this._backgroundSize:c-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,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new PE;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(IK(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[K(e),X(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!VC(t.type)||e[0]!==$(e))&&(!UC(t.type)||1!==(i=e,i&&y(i)?Array.from(new Set(Y(i))):i).length);var i}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_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:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_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._computeWidth(),height:this._computeHeight()},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,isReverse:IK(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=!1!==this._spec.showBackgroundChart,i=this._getAttrs(e),s=this._relatedAxisComponent;if(this._component)this._component.setAttributes(i),t&&(this._component.setPreviewData(this._data.getDataView().latestData),e&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>RK(t,this._stateScale,IK(s,this._isHorizontal))))));else{const t=this.getContainer();this._component=new aP(i),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?e&&this._component.setPreviewPointsY1(this._dataToPositionY2):e&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>RK(t,this._stateScale,IK(s,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:nI(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:nI(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:nI(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:nI(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:nI(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:nI(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:nI(g.style)},selectedBackgroundStyle:nI(this._spec.selectedBackground.style),dragMaskStyle:nI(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:GR(nI(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},nI(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:GR(nI(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},nI(null===(d=m.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}=rF(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(IK(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}}WK.type=r.dataZoom,WK.transformerConstructor=VK,WK.builtInTheme={dataZoom:UK},WK.specKey="dataZoom";const GK={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}};class YK extends HK{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"}_handleChange(e,i,s){super._handleChange(e,i,s);const n=KL(this._start,e)&&KL(this._end,i);if(this._shouldChange&&(!n||!1===this._spec.realTime)){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this._relatedAxisComponent,r=IK(n,this._isHorizontal),a=RK(e,this._stateScale,r),o=RK(i,this._stateScale,r);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,a,o):this._handleStateChange(a,o))&&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(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r,a;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,minSliderSize:null===(a=this._spec)||void 0===a?void 0:a.minSliderSize},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new pM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=nI(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=nI(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}YK.type=r.scrollBar,YK.builtInTheme={scrollBar:GK},YK.specKey="scrollBar";const $K=(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},XK=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),KK={title:{visible:!0,autoLimit:!1,autoFit:!1,style:XK("l1FontSize","primaryFontColor")},content:{visible:!0,style:XK("l2FontSize","tertiaryFontColor")}};class qK extends tj{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){return aF(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}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))}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(aI(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(aI(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){_I(this._option.dataSet,"indicatorFilter",$K);const t=new Pa(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 AD(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:i,height:s}=t.getLayoutRect(),{x:n,y:r}=t.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,u=e(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return Y(o).forEach((t=>{const e=GR({},this._theme.content,t);g.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({},sI(H(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?FR(l,this._computeLayoutRadius()):0,dy:h?FR(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!p(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},sI(H(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},u)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)U(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new SL(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_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.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}qK.type=r.indicator,qK.builtInTheme={indicator:KK},qK.specKey="indicator";const ZK=["sum","average","min","max","variance","standardDeviation","median"];function JK(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=K(s),r=X(s);return er}function QK(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&JK(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=BR(t.x)?sq(t.x,n)+r.x:nq(l.getXAxisHelper(),[t.x])+r.x,h}function tq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&JK(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=BR(t.y)?sq(t.y,n)+r.y:nq(l.getYAxisHelper(),[t.y])+r.y,h}function eq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&JK(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)),nq(a.angleAxisHelper,[t.angle])}function iq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&JK(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)),nq(a.radiusAxisHelper,[t.radius])}function sq(t,e){return Number(t.substring(0,t.length-1))*e/100}function nq(t,e){const i=t.getScale(0);return VC(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function rq(t){return ZK.includes(t)}function aq(t,e,i,s,n,r=!1){const a=e.getRegion(),o=a.getLayoutStartPoint(),l=i.getRegion(),h=l.getLayoutStartPoint(),c=Math.abs(Math.min(o.x,h.x)-Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width)),d=Math.abs(Math.min(o.y,h.y)-Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height)),u={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},g=[],f=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper(),v=s.getYAxisHelper(),_=m.getScale(0).domain(),y=v.getScale(0).domain(),b=r&&!m.isContinuous&&!!m.getBandwidth,x=r&&!v.isContinuous&&!!v.getBandwidth,S={min:null,max:null},A={min:null,max:null};return f.forEach((t=>{const e=p(t.x),i=p(t.y);let s,r;if(e&&i)s=QK(t,_,n,u,c,o),r=tq(t,y,n,u,d,o),oq(s,b,S,g.length),oq(r,x,A,g.length),g.push([{x:s,y:r}]);else if(e){s=QK(t,_,n,u,c,o),r=Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height);const e=Math.min(o.y,h.y);oq(s,b,S,g.length),g.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(o.x,h.x),r=tq(t,y,n,u,d,o);const e=Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width);oq(r,x,A,g.length),g.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(g,m,v,S,A),g}function oq(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=eq(t,l,n,r),i=iq(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=eq(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=iq(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function hq(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:f}=u.getLayoutRect();let m=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(m=BR(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=BR(i)?Number(i.substring(0,i.length-1))*f/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])&&JK(_,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])&&JK(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:nq(d.getXAxisHelper(),b)+p.x+m,y:nq(d.getYAxisHelper(),x)+p.y+v})})),n}function cq(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])&&JK(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])&&JK(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:nq(l.angleAxisHelper,d),radius:nq(l.radiusAxisHelper,u)})})),s}function dq(t,e,i){let{x:s,y:n}=t;return BR(s)&&(s=sq(s,e)),BR(n)&&(n=sq(n,i)),{x:s,y:n}}function uq(t,e,i){let s;if(s=d(t)?Y(t(e.getData().getLatestData(),e)):Y(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=dq(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>dq(t,n,r)))}function pq(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 gq(t,i,s){const{labelBackground:n={},style:r,shape:a}=t,o=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},nI(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},mq(nI(n.style),i,s)),p(n.padding)&&(t.padding=ai(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=mq(nI(r),i,s)),t}return{visible:!1}}function fq(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function mq(t,e,i){return d(t)?t(e,i):t}function vq(t,e){return d(t)?t(e):t}function _q(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 yq(t){return{isXProcess:p(t.x),isYProcess:p(t.y),isX1Process:p(t.x1),isY1Process:p(t.y1),isAngleProcess:p(t.angle),isRadiusProcess:p(t.radius),isAngle1Process:p(t.angle1),isRadius1Process:p(t.radius1),isCoordinatesProcess:p(t.coordinates),isValidProcess:p(t.process)}}function bq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=yq(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:h&&(!c||"process"in t&&"xy"in t.process)}}function xq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=yq(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function Sq(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function Aq(t,i){let s;if(i.coordinates){const t=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=t,o=e(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(d(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=Y(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;p(r)&&(c=Y(i)[r]),n&&Y(i).includes(n)&&(c=n);let d=s;p(l)&&(d=Y(s)[l]),a&&Y(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),_(t[c])&&rq(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),_(t[d])&&rq(t[d])?h.y={field:d,aggrType:t[d]}:h.y=Y(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;p(r)&&(a=Y(s)[r]),n&&Y(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),_(t[a])&&rq(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),_(t[l])&&rq(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=Y(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const s=e.x;y(s)?i.x=s.map((i=>Mq(i,t,e))):i.x=Mq(s,t,e)}if(p(e.y)){const s=e.y;y(s)?i.y=s.map((i=>Mq(i,t,e))):i.y=Mq(s,t,e)}if(p(e.angle)){const s=e.angle;y(s)?i.angle=s.map((i=>Mq(i,t,e))):i.angle=Mq(s,t,e)}if(p(e.radius)){const s=e.radius;y(s)?i.radius=s.map((i=>Mq(i,t,e))):i.radius=Mq(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=Mq(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const kq={min:(t,e)=>qL(t[0].latestData,e.field),max:(t,e)=>ZL(t[0].latestData,e.field),sum:function(t,e){return JL(t[0].latestData,e.field)},average:function(t,e){return QL(t[0].latestData,e.field)},variance:function(t,e){return tR(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(tR(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return dt(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function Mq(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(m(t)){const{aggrType:i,field:s}=t;return kq[i](e,{field:s})}return t}function Tq(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 wq extends tj{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){return aF(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_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)&&rq(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){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Ba;return e.registerParser("array",s),new Pa(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)))}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=aR(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){u(this._spec.offsetX)||(this._layoutOffsetX=LR(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=LR(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();_I(this._option.dataSet,"markerAggregation",Aq),_I(this._option.dataSet,"markerFilter",Tq);const i=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),i.target.on("change",(()=>{this._markerLayout()})),this._markerData=i}}function Cq(t,e){return function(t,e,i){const{predict:s}=Ft(t,(t=>t[e]),(t=>t[i])),n=qL(t,e),r=ZL(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class Eq extends wq{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}=bq(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;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={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},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:mq(nI(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>gq(t,this._markerData,this._markAttributeContext))),state:{line:fq(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:fq(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:fq(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return fq(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return fq(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:mq(nI(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:mq(nI(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||Y(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=pq([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=Y(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,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}=bq(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;_I(this._option.dataSet,"markerAggregation",Aq),_I(this._option.dataSet,"markerRegression",Cq),_I(this._option.dataSet,"markerFilter",Tq);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new Pa(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",(()=>{this._markerLayout()})),this._markerData=m}}Eq.specKey="markLine";const Bq=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),Pq={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"}}},refY:5},Lq={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:Bq(!1),endSymbol:Bq(!0),label:Pq};class Rq extends Eq{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new GP(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:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:_}=bq(e);let y=[];if(u||f||g||m||v||a&&l||a&&h){const t=aq(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=hq(i,r,d,e.coordinatesOffset):c&&(y=uq(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n;const r=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const n=this._startRelativeSeries,a=this._endRelativeSeries,{multiSegment:o,mainSegmentIndex:l}=this._spec.line||{},{connectDirection:h,expandDistance:c=0}=this._spec;let d;if(BR(c)){const t=n.getRegion(),e=t.getLayoutStartPoint(),i=a.getRegion(),s=i.getLayoutStartPoint();if("bottom"===h||"top"===h){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));d=Number(c.substring(0,c.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));d=Number(c.substring(0,c.length-1))*n/100}}else d=c;const{points:u,limitRect:g}=r;if(!u||u.length<2)return void(null===(t=this._markerComponent)||void 0===t||t.setAttributes(r));const f=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}(u[0],u[1],h,d);let m;m=o&&p(l)?{position:"middle",autoRotate:!1}: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)}:{}}(u[0],u[1],h,d));const v=Y((null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{}).label),_=Y(r.label),y=Y(this._spec.label);null===(s=this._markerComponent)||void 0===s||s.setAttributes({points:o?[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]]]:f,label:_.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=m.dx)&&void 0!==i?i:0,h=null!==(s=m.dy)&&void 0!==s?s:0;const c=null!==(n=y[e])&&void 0!==n?n:y[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),m),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=v[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:g,multiSegment:o,mainSegmentIndex:l,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(n=this._markerComponent)||void 0===n||n.setAttributes(r)}_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}=bq(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 Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&p(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&p(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&p(n.process.xy)){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}}}Rq.type=r.markLine,Rq.coordinateType="cartesian",Rq.builtInTheme={markLine:Lq};class Oq extends Eq{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=bq(this._spec);return e||i?new XP(t):new GP(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}=bq(e);let p=[],g={};const f={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=lq(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:f}:{points:p.map((t=>ce(f,t.radius,t.angle)))}}else u&&(p=cq(i,r,a),g={points:p.map((t=>ce(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=bq(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}}}Oq.type=r.polarMarkLine,Oq.coordinateType="polar",Oq.builtInTheme={polarMarkLine:Lq};class Iq extends tj{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=ER(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return aF(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}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;if(!1===this._spec.visible)return{visible:!1};const a=this.getLayoutRect(),o=LR(this._spec.width,a.width,null,a.width),l=LR(this._spec.maxWidth,a.width,null,a.width),h=Math.max(Math.min(o,l,a.width),0),c=p(this._spec.text)&&""!==this._spec.text,d=p(this._spec.subtext)&&""!==this._spec.subtext,u=Object.assign(Object.assign({},H(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:c?this._spec.text:void 0,subtextType:null!==(e=this._spec.subtextType)&&void 0!==e?e:"text",subtext:d?this._spec.subtext:void 0,x:null!==(i=this._spec.x)&&void 0!==i?i:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:h,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(n=this._spec.align)&&void 0!==n?n:"left",verticalAlign:null!==(r=this._spec.verticalAlign)&&void 0!==r?r:"top",textStyle:Object.assign({maxLineWidth:h},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:h},this._spec.subtextStyle)});if(c&&(u.textStyle.width=h),d&&(u.subtextStyle.width=h),p(this._spec.width)){const t=Math.max(Math.min(o,a.width),0);c?u.textStyle.width=t:delete u.textStyle.width,d&&(u.subtextStyle.width=t)}return u}_createOrUpdateTitleComponent(t){if(this._titleComponent)U(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new bL(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}}Iq.type=r.title,Iq.specKey=r.title,Iq.builtInTheme={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"}}}};class Dq extends wq{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=xq(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={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:mq(nI(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>gq(t,this._markerData,this._markAttributeContext))),state:{area:fq(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>fq(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return fq(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||Y(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=pq([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=Y(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=Y(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,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}=xq(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}Dq.specKey="markArea";const Fq={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"}}}}};class zq extends Dq{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new $P(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=xq(i),d=p(i.positions),u=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=aq(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=aq(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=hq(s,a,u,i.coordinatesOffset):d&&(f=uq(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=xq(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}}}zq.type=r.markArea,zq.coordinateType="cartesian",zq.builtInTheme={markArea:Fq};class jq extends Dq{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=xq(this._spec);return i||e||s?new KP(t):new $P(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}=xq(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=lq(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=cq(i,r,c),u={points:d.map((t=>ce(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=xq(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}}}jq.type=r.polarMarkArea,jq.coordinateType="polar",jq.builtInTheme={polarMarkArea:Fq};const Hq=t=>nI(Object.assign({},t)),Vq=t=>Object.assign(Object.assign({},t),{style:Object.assign({},nI(t.style))}),Nq=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=Hq(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=Hq(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:{},nI(Object.assign({},y)));var y;const b=Vq(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=Vq(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=Vq(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=Vq(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!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,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},Uq=t=>"left"===t||"right"===t,Wq=t=>"top"===t||"bottom"===t,Gq={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:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,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:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class Yq extends tj{constructor(){super(...arguments),this.layoutZIndex=t.LayoutZIndex.Player,this.layoutLevel=t.LayoutLevel.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},Nq(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},Nq(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?U(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new DL(t):this._playerComponent=new jL(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=Uq(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=Uq(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.autoPlayCallback=()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback),this._option.globalInstance.on(t.ChartEvent.rendered,this.autoPlayCallback),this._playerComponent.addEventListener(BL.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(BL.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(BL.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(BL.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(BL.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(BL.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}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=Uq(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=Wq(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}_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)):Uq(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))):Wq(this._orient)?this._maxSize():t.height}_computeDx(t){return Uq(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return Wq(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(e){const i=this._specs[e];this._option.globalInstance.updateFullData(i.data),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})}release(){this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback)}}Yq.builtInTheme={player:Gq},Yq.specKey="player",Yq.type=r.player;class $q extends tj{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,U(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=_R({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:Y(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==ZI.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&u(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}$q.type=r.label;class Xq extends RN{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}render(){}}Xq.type="text",Xq.constructorType="label";const Kq=()=>{ON(),YR.registerMark(Xq.constructorType,Xq)};class qq extends Qz{_initTheme(t,e){return{spec:t,theme:this._theme}}}class Zq extends $q{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=qq,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.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(hI.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(hI.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),nR(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{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),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,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=GR({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},JV(h,r),Object.assign(Object.assign(Object.assign({},H(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[OO])):t=>t.filter((t=>t.data[RO]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?QV(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=y(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=Y(i())[t])}))}return e}}Zq.type=r.label,Zq.specKey="label",Zq.transformerConstructor=qq;class Jq extends $q{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()}reInit(t){super.reInit(t),this._initTextMark()}_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[PO]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return GR({textStyle:{pickable:!0===this._spec.interactive},position:Qq(t,this._baseMark.type,a),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=>"bottom"===a?t.data[OO]:t.data[RO]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>QV({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function Qq(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}Jq.type=r.totalLabel,Jq.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},Jq.specKey="totalLabel";class tZ extends wq{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=Sq(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,f,m,v,_,y,b,x,S,A,k,M,T,w,C,E,B,P,L,R,O;const{itemContent:I={},itemLine:D={},targetSymbol:F={}}=this._spec,z=I,{type:H="text",text:V,symbol:N,image:U,richText:W,customMark:G,textStyle:Y,symbolStyle:$,imageStyle:X,richTextStyle:K,customMarkStyle:q,style:Z={},state:J={}}=z,Q=e(z,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let tt=null,et=null,it={};"text"===H?(tt=null!==(t=null==V?void 0:V.state)&&void 0!==t?t:J,it={dx:0,dy:0},et=gq(Object.assign(Object.assign({},V),{style:j(it,null!==(n=null!==(s=null!==(i=null==V?void 0:V.style)&&void 0!==i?i:null==V?void 0:V.textStyle)&&void 0!==s?s:Y)&&void 0!==n?n:Z)}),this._markerData,this._markAttributeContext)):"richText"===H?(tt=null!==(r=null==W?void 0:W.state)&&void 0!==r?r:J,it={width:100,height:100},et=mq(j(it,null!==(o=null!==(a=null==W?void 0:W.style)&&void 0!==a?a:K)&&void 0!==o?o:Z),this._markerData,this._markAttributeContext)):"symbol"===H?(tt=null!==(l=null==N?void 0:N.state)&&void 0!==l?l:J,it={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},et=nI(mq(j(it,null!==(c=null!==(h=null==N?void 0:N.style)&&void 0!==h?h:$)&&void 0!==c?c:Z),this._markerData,this._markAttributeContext))):"image"===H?(tt=null!==(d=null==U?void 0:U.state)&&void 0!==d?d:J,it={width:80,height:80},et=mq(j(it,null!==(p=null!==(u=null==U?void 0:U.style)&&void 0!==u?u:X)&&void 0!==p?p:Z),this._markerData,this._markAttributeContext)):"custom"===H&&(tt=null!==(g=null==G?void 0:G.state)&&void 0!==g?g:J,et=mq(null!==(m=null!==(f=null==G?void 0:G.style)&&void 0!==f?f:q)&&void 0!==m?m:Z,this._markerData,this._markAttributeContext));const st={zIndex:this.layoutZIndex,interactive:null===(v=this._spec.interactive)||void 0===v||v,hover:null===(_=this._spec.interactive)||void 0===_||_,select:null===(y=this._spec.interactive)||void 0===y||y,position:{x:0,y:0},clipInRange:null!==(b=this._spec.clip)&&void 0!==b&&b,itemContent:Object.assign(Object.assign({type:H,offsetX:vq(I.offsetX,this._relativeSeries.getRegion()),offsetY:vq(I.offsetX,this._relativeSeries.getRegion())},Q),{style:mq(et,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(x=F.offset)&&void 0!==x?x:0,visible:null!==(S=F.visible)&&void 0!==S&&S,size:null!==(A=F.size)&&void 0!==A?A:20,style:mq(F.style,this._markerData,this._markAttributeContext)},state:{line:fq(null!==(M=null===(k=this._spec.itemLine.line)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),lineStartSymbol:fq(null!==(w=null===(T=this._spec.itemLine.startSymbol)||void 0===T?void 0:T.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),lineEndSymbol:fq(null!==(E=null===(C=this._spec.itemLine.endSymbol)||void 0===C?void 0:C.state)&&void 0!==E?E:{},this._markerData,this._markAttributeContext),itemContent:fq(tt,this._markerData,this._markAttributeContext),textBackground:fq(null===(P=null===(B=this._spec.itemContent.text)||void 0===B?void 0:B.labelBackground)||void 0===P?void 0:P.state,this._markerData,this._markAttributeContext),targetItem:fq(null!==(R=null===(L=this._spec.targetSymbol)||void 0===L?void 0:L.state)&&void 0!==R?R:{},this._markerData,this._markAttributeContext)},animation:null!==(O=this._spec.animation)&&void 0!==O&&O,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:nt,line:rt={}}=D,at=e(D,["visible","line"]);st.itemLine=!1!==nt?Object.assign(Object.assign({},at),{visible:!0,lineStyle:nI(rt.style)}):{visible:!1};return new ZP(st)}_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}=pq([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:_q(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:_q(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}=Sq(t);(p(t.coordinate)||e||i||s)&&this._initCommonDataView()}}tZ.specKey="markPoint";const eZ={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}};class iZ extends tZ{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=p(s.x)&&p(s.y),o=p(s.coordinate),l=p(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=aq(n,r,r,r,h))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=hq(n,r,h,s.coordinatesOffset)[0]:l&&(c=uq(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=Sq(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}}}iZ.type=r.markPoint,iZ.coordinateType="cartesian",iZ.builtInTheme={markPoint:eZ};class sZ extends tZ{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=lq(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:ce({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}])]}}}sZ.type=r.polarMarkPoint,sZ.coordinateType="polar",sZ.builtInTheme={polarMarkPoint:eZ};class nZ extends tZ{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}])]}}}nZ.type=r.geoMarkPoint,nZ.coordinateType="geo",nZ.builtInTheme={geoMarkPoint:eZ};const rZ="inBrush",aZ="outOfBrush";class oZ extends tj{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._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return aF(t,this.specKey,this.type,(t=>!1!==t.visible))}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),rZ,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),aZ,t.AttributeLevel.Series))}))}))}_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()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){p(this._spec.regionId)||p(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_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)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild()}_shouldEnableInteractive(){return!1!==this.getOption().getCompiler().getOption().interactive}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new UL(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:nI(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),this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(FL.brushActive,(s=>{this._initMarkBrushState(i,aZ),this._emitEvent(t.ChartEvent.brushActive,e,s)})),a.addEventListener(FL.drawStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener(FL.moveStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener(FL.drawing,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener(FL.moving,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener(FL.brushClear,(s=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)})),a.addEventListener(FL.drawEnd,(s=>{var n;this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:r}=s.detail,{updateElementsState:a=!0}=this._spec;if(null===(n=this._spec)||void 0===n?void 0:n.onBrushEnd)!0===this._spec.onBrushEnd(s)?(this.clearGraphic(),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)):(this._spec.onBrushEnd(s),this._emitEvent(t.ChartEvent.brushEnd,e,s));else{const i=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&i.length>0||!a)&&this._setAxisAndDataZoom(r,e),this._emitEvent(t.ChartEvent.brushEnd,e,s)}})),a.addEventListener(FL.moveEnd,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:s}=i.detail,{updateElementsState:n=!0}=this._spec,r=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&r.length>0||n)&&this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e,i)}))}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a],interactive:this._shouldEnableInteractive()}}_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({},nI(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail;this._operateMask=i;const{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e,i){var s;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},vchart:null===(s=this._option)||void 0===s?void 0:s.globalInstance,event:i})}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(i.addState(rZ,!0),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(i.removeState(rZ),i.addState(aZ,!0),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:_=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(_.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(i.addState(rZ,!0),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(i.removeState(rZ),i.addState(aZ,!0),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Pe(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;s.removeState(rZ),s.removeState(aZ),i&&s.addState(i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_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,g=t.getScale().range(),f=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],m=$(g){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}clearBrushStateAndMask(){this._relativeRegions.forEach(((t,e)=>{this._initMarkBrushState(e,""),this._brushComponents[e].children[0].removeAllChild()}))}}oZ.type=r.brush,oZ.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},oZ.specKey="brush";class lZ extends tj{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}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;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${mO}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=IF({},DF(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(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)}))),p(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,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 Ve).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Ve;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),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}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}lZ.type=r.customMark,lZ.specKey="customMark";class hZ{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._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=>{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=>cZ(t))),a=n.filter((t=>!cZ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>cZ(t))),h=o.filter((t=>!cZ(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 cZ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}hZ.type="grid";const dZ="vchart-tooltip",uZ=`${dZ}-container`,pZ=`${dZ}-title`,gZ=`${dZ}-content-box`,fZ={offsetX:10,offsetY:10},mZ="99999999999999";function vZ(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const _Z=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,yZ=t=>_(t)&&""!==(null==t?void 0:t.trim())||S(t)?vZ(t):"",bZ=(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},xZ={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},SZ=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=xZ[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class AZ extends Cz{constructor(){super(...arguments),this._visible=!0,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._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const _=e.event,{activeType:y,data:b}=t,x="dimension"===y?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:M}=this._option,T=m[y],w=cF(null==T?void 0:T.position,b,e),C=null!==(r=cF(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===y?"mark":"pointer",{width:E=0,height:B=0}=null!=i?i:{},P="canvas"===m.renderMode,L=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==L?void 0:L.width)&&void 0!==o?o:vO,O=null!==(l=null==L?void 0:L.height)&&void 0!==l?l:_O;let I=!1;const D={width:0,height:0};let F,z={x:0,y:0},j={x:0,y:0},H=1,V=1;const N=Yy(this._env);if(N&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=R,D.height=O),N&&!P){const t=this._getParentElement(m);j=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-j.x,y:F.y-j.y},H=_Z(e,F),V=_Z(t,j)}const U=V/H,W={},G={x:w,y:w},Y={x:["left","right"],y:["top","bottom"]},$=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?A:M;if("mark"===i){I=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){I=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(I){const e=Y[n][0],i="x"===n?E:B;switch(SZ(t,n)){case-2:W[e]=a-i*U-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*U/2;break;case-1:W[e]=(a+o)/2-i*U-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*U-c;break;case 2:W[e]=o+c}}},X=["x","y"];if(g(w))if(g(K=w)&&(p(K.left)||p(K.right)||p(K.top)||p(K.bottom))){const{left:t,right:e,top:i,bottom:s}=w;W.left=bZ(t,_),W.top=bZ(i,_),W.right=bZ(e,_),W.bottom=bZ(s,_)}else(t=>g(t)&&(p(t.x)||p(t.y)))(w)&&X.forEach((t=>{const e=w[t];S(e)||d(e)?W[Y[t][0]]=bZ(e,_):$(e,t)}));else p(w)&&($({orient:w,mode:C},"x"),$({orient:w,mode:C},"y"));var K;const q={x:null,y:null};return X.forEach((t=>{var e;const i="x"===t?E:B,s="x"===t?R:O,n="x"===t?A:M,r=SZ(G[t],t);if(k(W[Y[t][0]]))q[t]=W[Y[t][0]];else if(k(W[Y[t][1]]))q[t]=s-i*U-W[Y[t][1]];else{const e="x"===t?_.canvasX:_.canvasY;q[t]=r>0?e+n:0===r?e-i*U/2:e-i*U-n}q[t]*=H,N&&(q[t]+=z[t]),q[t]/=V;const a="x"===t?D.width:D.height,o=m.confine?-(j[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/H)/V:-j[t]/V,l=a/V+o-i;2!==r&&q[t]l&&(q[t]=l)):-2!==r&&q[t]>l&&(I?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",MZ=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=kZ(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=kZ(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},TZ=(t={})=>{const{lineHeight:e}=t;return t.fontSize?LR(e,t.fontSize):0},wZ=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),p(r)&&(o=ai(r),a.padding=kZ(o)),{panelStyle:a,panelPadding:o}};function CZ(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}class EZ extends AZ{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(EZ.type),this.type=kH.dom,this._tooltipContainer=null==Gy?void 0:Gy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(Gy&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:d,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=wZ(l),_={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(_.marginBottom=`${g}px`);const y={width:kZ(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=MZ(h),x=MZ(d),S=MZ(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),u(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),u(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),u(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),y[A]=kZ(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=kZ(null!==(s=d.spacing)&&void 0!==s?s:26),S[A]=kZ(null!==(n=p.spacing)&&void 0!==n?n:0);const M=Math.max(TZ(p),TZ(d));return _.lineHeight=M>0?`${M}px`:"20px",{panelPadding:v,row:_,panel:m,title:b,shape:y,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(pZ))),l=a.find((t=>t.className.includes(gZ)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(pZ),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(CZ(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${dZ}-column`),e.classList.add(`${dZ}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(gZ),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];CZ(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));CZ(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${dZ}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=yZ(e.key),e.keyStyle&&MZ(e.keyStyle,l)):"value"===i?(o.innerHTML=yZ(e.value),e.valueStyle&&MZ(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?vZ(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?vZ(c):m,y=p,b=t=>new Cg({symbolType:t,size:y,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new Ve));let M=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const T=vh.IsGradientStr(u);if(!u||_(u)&&!T||d)return m=d?"none":u?vZ(u):"currentColor",`\n \n \n \n `;const w=T?vh.Parse(u):g(u)?u:null;if(w){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=w.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===w.gradient?t=`\n ${i}\n `:"linear"===w.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),CZ(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(gZ))),h=[...o.children].find((t=>t.className.includes(pZ)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(pZ)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=LR(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,CZ(l,c))}const u=l.children,g=[];if(u){for(let i=0;i{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},ff||(ff=pf.CreateGraphic("richtext",{})),ff.setAttributes(a),ff.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function LZ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:BZ),{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:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const RZ=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};class OZ extends AZ{constructor(){super(OZ.type),this.type=kH.canvas,this._attributes=null}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 XL({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}_getTooltipBoxSize(t,e){var i,s;if(!e||u(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");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:f,valueLabel:m,spaceRow:v,align:_}=l,y=ai(d.padding),b=IR(d.padding),x=LZ(Object.assign({textAlign:"right"===_?"right":"left"},u),i),S=LZ(Object.assign({textAlign:"right"===_?"right":"left"},f),i),A=LZ(m,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:RZ(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,enterable:h,transitionDuration:c,align:_},{title:T={},content:w=[]}=t;let C=b.left+b.right,E=b.top+b.bottom,B=0;const P=!!w.length;let L=0,R=0,O=0,I=0;if(P){const t=[],e=[],i=[],s=[];let n=0;M.content=w.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:M}=r,T={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=GR({},S,LZ(b,void 0,{})),{width:s,height:n,text:r}=PZ(h,i);T.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(m)){const t=GR({},A,LZ(x,void 0,{})),{width:e,height:s,text:n}=PZ(m,t);T.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};M?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,T.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else T.shape={visible:!1};return T.height=o,n+=o,aU.autoWidth&&!1!==U.multiLine;if(j){U=GR({},x,LZ(V,void 0,{})),W()&&(U.multiLine=null===(r=U.multiLine)||void 0===r||r,U.maxWidth=null!==(a=U.maxWidth)&&void 0!==a?a:P?Math.ceil(B):void 0);const{text:t,width:e,height:i}=PZ(H,U);M.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=U.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},U),{text:t}),D=M.title.value.width,F=M.title.value.height,z=F+(P?M.title.spaceRow:0)}return E+=z,M.title.width=D,M.title.height=F,W()?C+=B||D:C+=Math.max(D,B),P&&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-I-L-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})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_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{activeTooltipSpec: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()}}OZ.type=kH.canvas;const IZ=/\{([^}]+)\}/,DZ=/\{([^}]+)\}/g,FZ=/:/;class zZ extends Cz{constructor(){super(zZ.type),this.type="formatterPlugin",this._timeModeFormat={utc:mi.getInstance().timeUTCFormat,local:mi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=ki.getInstance().format,this._numericSpecifier=ki.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[zZ.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)),YR.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=IZ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(DZ,((t,i)=>{if(!FZ.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(xi.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):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}zZ.pluginType="chart",zZ.specKey="formatter",zZ.type="formatterPlugin";tF.useRegisters([()=>{EH(),PH(),RH(),aH(),rH(),Wj(),Ij(),vz(),yz(),UD(),HD(),Cj(),kj(),YR.registerSeries(Gj.type,Gj),YR.registerChart(OH.type,OH)},()=>{EH(),PH(),RH(),rH(),Wj(),Ij(),vz(),FH(),yz(),HH(),Cj(),kj(),YR.registerSeries(NH.type,NH),aH(),YR.registerChart(WH.type,WH)},()=>{EH(),PH(),RH(),rH(),nV(),aH(),YR.registerChart(aV.type,aV)},()=>{EH(),PH(),aH(),rH(),mV(),YR.registerChart(_V.type,_V)},()=>{PH(),pU(),YR.registerChart(oX.type,oX)},()=>{EH(),PH(),aH(),rH(),PU(),YR.registerChart(cX.type,cX)},()=>{EH(),PH(),RH(),aH(),rH(),HU(),YR.registerChart(uX.type,uX)},()=>{EH(),PH(),RH(),aH(),rH(),nV(),YR.registerTransform("bin",Kr),YR.registerChart(_X.type,_X)},()=>{PH(),RV(),AV(),YR.registerSeries(IV.type,IV),YR.registerImplement("registerMap",AI),YR.registerImplement("unregisterMap",kI),VD(),YR.registerChart(eX.type,eX)},()=>{PH(),y$(),YR.registerSeries(x$.type,x$),oU(),eW(),wU(),nW(),YR.registerChart(SX.type,SX)},()=>{PH(),YG(),YR.registerChart(MX.type,MX)},()=>{PH(),uY(),YR.registerChart(wX.type,wX)},()=>{EH(),PH(),RH(),aH(),rH(),cN(),YR.registerChart(jX.type,jX)},()=>{EH(),PH(),aH(),rH(),LN(),YR.registerTransform("boxplot",qr),YR.registerChart(VX.type,VX)},()=>{EH(),PH(),aH(),rH(),nW(),YR.registerChart(bX.type,bX)},()=>{EH(),PH(),aH(),rH(),dW(),YR.registerChart(EX.type,EX)},()=>{EH(),PH(),aH(),rH(),UN(),YR.registerChart(PX.type,PX)},()=>{EH(),PH(),RH(),aH(),rH(),FH(),Cj(),kj(),YR.registerSeries(XN.type,XN),YR.registerChart(GX.type,GX)},()=>{PH(),BY(),YR.registerChart(RX.type,RX)},()=>{PH(),DY(),YR.registerChart(IX.type,IX)},()=>{PH(),h$(),YR.registerChart(FX.type,FX)},()=>{PH(),xo.load(vM),e$(),YR.registerChart(UX.type,UX)},()=>{PH(),C$(),YR.registerChart($X.type,$X)},()=>{PH(),V$(),YR.registerChart(KX.type,KX)},()=>{EH(),PH(),RH(),aH(),YR.registerChart(gX.type,gX),rH()},kj,Cj,()=>{YR.registerGraphicComponent(ej.lineAxis,((t,e)=>new CC(t,e))),YR.registerGraphicComponent(ij.lineAxisGrid,((t,e)=>new zB(t,e))),oj(),YR.registerComponent(Ej.type,Ej)},()=>{YR.registerGraphicComponent(ej.lineAxis,((t,e)=>new CC(t,e))),YR.registerGraphicComponent(ij.lineAxisGrid,((t,e)=>new zB(t,e))),oj(),YR.registerComponent(Bj.type,Bj)},()=>{YR.registerGraphicComponent(ej.lineAxis,((t,e)=>new CC(t,e))),YR.registerGraphicComponent(ij.lineAxisGrid,((t,e)=>new zB(t,e))),oj(),YR.registerComponent(Pj.type,Pj)},EU,wU,()=>{YR.registerComponent(tK.type,tK)},()=>{YR.registerComponent(uK.type,uK)},()=>{YR.registerComponent(SK.type,SK)},()=>{YR.registerComponent(CK.type,CK)},()=>{YR.registerComponent(EK.type,EK)},()=>{YR.registerComponent(WK.type,WK)},()=>{YR.registerComponent(YK.type,YK)},()=>{YR.registerComponent(qK.type,qK)},RV,()=>{YR.registerComponent(Rq.type,Rq),WP()},()=>{YR.registerComponent(zq.type,zq),YP()},()=>{YR.registerComponent(iZ.type,iZ),qP()},()=>{YR.registerComponent(Oq.type,Oq),XP._animate=MP,WP()},()=>{YR.registerComponent(jq.type,jq),KP._animate=wP,YP()},()=>{YR.registerComponent(sZ.type,sZ),qP()},()=>{YR.registerComponent(nZ.type,nZ),qP()},()=>{YR.registerComponent(Iq.type,Iq)},()=>{YR.registerComponent(Yq.type,Yq)},()=>{YR.registerGraphicComponent(Zq.type,(t=>new OB(t))),Kq(),nj(),YR.registerComponent(Zq.type,Zq,!0,1/0)},()=>{YR.registerGraphicComponent(Jq.type,(t=>new OB(t))),Kq(),nj(),YR.registerComponent(Jq.type,Jq,!0)},()=>{YR.registerComponent(oZ.type,oZ)},()=>{YR.registerComponent(lZ.type,lZ)},()=>{xo.load(aT)},()=>{YR.registerLayout(hZ.type,hZ)},()=>{var t;t=OZ,YR.registerComponentPlugin(t.type,t)},()=>{var t;t=zZ,YR.registerChartPlugin(t.type,t)},KD,JD]),tF.useRegisters([()=>{GS(xo)}]),t.DEFAULT_CHART_HEIGHT=_O,t.DEFAULT_CHART_WIDTH=vO,t.DEFAULT_CLOSE_STROKE_JOIN=sF,t.DEFAULT_DATA_INDEX=bO,t.DEFAULT_DATA_KEY=xO,t.DEFAULT_DATA_SERIES_FIELD=SO,t.DEFAULT_KEY=VO,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=iF,t.DEFAULT_MAP_LOOK_UP_KEY=NO,t.DEFAULT_MEASURE_CANVAS_ID=yO,t.DEFAULT_SERIES_STYLE_NAME=AO,t.DEFAULT_SMOOTH_INTERPOLATE=eF,t.Factory=YR,t.MOSAIC_CAT_END_PERCENT=zO,t.MOSAIC_CAT_START_PERCENT=FO,t.MOSAIC_VALUE_END_PERCENT=DO,t.MOSAIC_VALUE_START_PERCENT=IO,t.ManualTicker=class extends hw{constructor(t){super(t),this.lastFrameTime=0,this.status=Ro.RUNNING}setupTickHandler(){const t=new cw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===Ro.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Ro.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Ro.RUNNING,!0}},t.PREFIX=mO,t.SEGMENT_FIELD_END=HO,t.SEGMENT_FIELD_START=jO,t.STACK_FIELD_END=TO,t.STACK_FIELD_END_OffsetSilhouette=BO,t.STACK_FIELD_END_PERCENT=CO,t.STACK_FIELD_KEY=kO,t.STACK_FIELD_START=MO,t.STACK_FIELD_START_OffsetSilhouette=EO,t.STACK_FIELD_START_PERCENT=wO,t.STACK_FIELD_TOTAL=PO,t.STACK_FIELD_TOTAL_BOTTOM=OO,t.STACK_FIELD_TOTAL_PERCENT=LO,t.STACK_FIELD_TOTAL_TOP=RO,t.StreamLight=class extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=Ao.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Wl,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=Ao.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_;const y=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(y){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:qo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(_=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==_?_:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:qo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=cl(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=cl(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;et;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.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=(t,e=!1)=>e?"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 _=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||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=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||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 B=Object.prototype.hasOwnProperty;function P(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(B.call(t,e))return!1;return!0}var L=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&R.call(t,e);function I(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=y(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||_(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=I(r,e,i)}return s}function D(t,e,i=!1,s=!1){if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&y(t[a])?z(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(y(a)){if(s)o=[];else if(y(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(_(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function N(t){return Object.prototype.toString.call(t)}function V(t){return Object.keys(t)}function U(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(N(t)!==N(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(y(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!U(t[s],e[s],i))return!1;return!0}if(!m(t))return!1;const s=V(t),n=V(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!U(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;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},K=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;ne?1:t>=e?0:NaN}function it(t){return Number(t)}function st(t,e,i=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)}const nt="undefined"!=typeof console;function rt(t,e,i){const s=[e].concat([].slice.call(i));nt&&console[t].apply(console,s)}var at;!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"}(at||(at={}));class ot{static getInstance(t,e){return ot._instance&&S(t)?ot._instance.level(t):ot._instance||(ot._instance=new ot(t,e)),ot._instance}static setInstance(t){return ot._instance=t}static setInstanceLevel(t){ot._instance?ot._instance.level(t):ot._instance=new ot(t)}static clearInstance(){ot._instance=null}constructor(t=at.None,e){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(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=at.Info}canLogDebug(){return this._level>=at.Debug}canLogError(){return this._level>=at.Error}canLogWarn(){return this._level>=at.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=at.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):rt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=at.Warn&&rt(this._method||"warn","WARN",t),this}info(...t){return this._level>=at.Info&&rt(this._method||"log","INFO",t),this}debug(...t){return this._level>=at.Debug&&rt(this._method||"log","DEBUG",t),this}}function lt(t,e,i=0,s){for(u(s)&&(s=t.length);i>>1;et(t[n],e)>0?s=n:i=n+1}return i}ot._instance=null;const ht=(t,e)=>ct(0,t.length,(i=>e(t[i]))),ct=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},dt=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(et)),st(i,.5)},ut=1e-10,pt=1e-10;function gt(t,e,i=pt,s=ut){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function ft(t,e,i,s){return t>e&&!gt(t,e,i,s)}function mt(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var _t=function(t,e,i){return ti?i:t};var yt=(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 bt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let xt=!1;try{xt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){xt=!1}function St(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&xt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=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 _(){const t=Date.now();if(v(t))return y(t);o=m(_,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?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(_,e),c?f(t):a}(l);if(d)return o=m(_,e),f(l)}return void 0===o&&(o=m(_,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:y(Date.now())},b.pending=function(){return void 0!==o},b}function At(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),St(t,e,{leading:s,trailing:n,maxWait:e})}function kt(t,e){return i=>t*(1-i)+e*i}function Mt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Tt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function wt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}xt=!1;const Ct=4294967296;const Et=t=>e=>L(e,t),Bt=(t,e={})=>{if(d(t))return t;const i=[t];return(e&&e.get||Et)(i)},Pt=(t,e={})=>{if(y(t)){const i=t.map((t=>Bt(t,e)));return t=>i.map((e=>e(t)))}return Bt(t,e)},Lt=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t,Rt=t=>0,Ot=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function Dt(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Ft(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!u(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:d,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)d+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!u(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!u(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:d,b:p},predict:g,rSquared:Dt(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=It(f.min,f);for(let r=0;r=1?Ht:t<=-1?-Ht:Math.asin(t)}function Jt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Qt(t,e){return t[0]*e[1]-t[1]*e[0]}function te(t,e){let i=0;for(let s=0;s0?i:0}function se(t,e){return ee(t+e,10**Math.max(ie(t),ie(e)))}function ne(t,e){return ee(t-e,10**Math.max(ie(t),ie(e)))}class re{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new re(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 ae{static distancePP(t,e){return Kt(qt(t.x-e.x,2)+qt(t.y-e.y,2))}static distanceNN(t,e,i,s){return Kt(qt(t-i,2)+qt(e-s,2))}static distancePN(t,e,i){return Kt(qt(e-t.x,2)+qt(i-t.y,2))}static pointAtPP(t,e,i){return new re((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function oe(t){return t*(Math.PI/180)}function le(t){return 180*t/Math.PI}const he=(t=0)=>{if(t<0)for(;t<-Nt;)t+=Nt;else if(t>0)for(;t>Nt;)t-=Nt;return t};function ce(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 de(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function ue(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function pe(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ge(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=pe(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)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function fe(t){return(t=pe(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 me(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function ve(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function ye(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var be;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(be||(be={}));const xe=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function Se(t,e,i){if(!t||!e)return be.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function Me(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Te({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function we(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Ce(t,e){const i=e?oe(t.angle):t.angle,s=we(t);return[Te({x:t.x1,y:t.y1},i,s),Te({x:t.x2,y:t.y1},i,s),Te({x:t.x2,y:t.y2},i,s),Te({x:t.x1,y:t.y2},i,s)]}function Ee(t,e,i=!1){const s=Ce(t,i),n=Ce(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(we(t),we(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?oe(t.angle):t.angle;let u=i?oe(90-t.angle):t.angle+Ht;const p=i?oe(e.angle):e.angle;let g=i?oe(90-e.angle):e.angle+Ht;u>Vt&&(u-=Vt),g>Vt&&(g-=Vt);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Me(n,i)+Me(n,s))/2>Me(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Be=1e-8;function Pe(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Oe(t,e){return Math.abs(t-e){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"};function De(t,e={},i){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")}class Fe{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=De(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:f=o}=this._userSpec;if(_(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,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: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,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}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(Fe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Fe.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Fe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Fe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Fe.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}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)}}Fe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Fe.NUMBERS_CHAR_SET="0123456789",Fe.FULL_SIZE_CHAR="字";const ze=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),je=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=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(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=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(t=0,e=0,i=0,s=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(t=0,e=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(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return He(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 Ve extends Ne{}class Ue extends Ne{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Ee(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new Ue(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Te({x:this.x1,y:this.y1},this.angle,t),Te({x:this.x2,y:this.y1},this.angle,t),Te({x:this.x1,y:this.y2},this.angle,t),Te({x:this.x2,y:this.y2},this.angle,t)]}}class We{constructor(t=1,e=0,i=0,s=1,n=0,r=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 We,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,f=o*n+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 We;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:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new We(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=le(r.rotateDeg),r}}class Ge{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 Ye(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 $e(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 Xe=/^#([0-9a-f]{3,8})$/,Ke={transparent:4294967040},qe={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 Ze(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Je(t){return S(t)?new si(t>>16,t>>8&255,255&t,1):y(t)?new si(t[0],t[1],t[2]):new si(255,255,255)}function Qe(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ti(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ei=(t,e)=>{const i=Xe.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new si((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Je(t):8===e?new si(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class ii{static Brighter(t,e=1){return 1===e?t:new ii(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new ii(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof ii?t:new ii(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();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(Ke[t]))return function(t){return S(t)?new si(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new si(t[0],t[1],t[2],t[3]):new si(255,255,255,1)}(Ke[t]);if(p(qe[t]))return Je(qe[t]);const e=`${t}`.trim().toLowerCase(),i=ei(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new si(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=Ye(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new si(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ii.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new si(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=$e(this.color.r,this.color.g,this.color.b),r=Ye(u(t)?n.h:_t(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 si(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=ei(e,!0);return null!=i?i:this}setColorName(t){const e=qe[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(t=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}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new ii(this.color.toString())}copyGammaToLinear(t,e=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,e=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=Qe(t.color.r),this.color.g=Qe(t.color.g),this.color.b=Qe(t.color.b),this}copyLinearToSRGB(t){return this.color.r=ti(t.color.r),this.color.g=ti(t.color.g),this.color.b=ti(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class si{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`#${Ze(this.r)+Ze(this.g)+Ze(this.b)+(1===this.opacity?"":Ze(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}=$e(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ni(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 si(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:$e});function ai(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 oi(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=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:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}function li(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 hi(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}const ci=1e-10;function di(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+ci)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=fi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=ae.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=ui(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-ci,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function ui(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function pi(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return ui(t,t-(i*i-e*e+t*t)/(2*i))+ui(e,s)}function gi(t,e){const i=ae.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function fi(t){const e={x:0,y:0};for(let i=0;ithis.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 _i;function yi(t,e){const i=vi(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 bi{constructor(t={}){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 xi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Si(t){let e;if(e=xi.exec(t))return new bi({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]});ot.getInstance().error("invalid format: "+t)}const Ai=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class ki{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 ki.instance||(ki.instance=new ki),ki.instance}newFormat(t){const e=Si(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"):Mi[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=Mi[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:_,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)?m: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?Ai[8+_i/3]:"")+A+(t&&"("===n?")":""),f)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=Si(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=vi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=Ai[8+n/3];return function(t){return s(r*t)+a}}}const Mi={"%":(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)=>yi(100*t,e),r:yi,s:function(t,e){const i=vi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(_i=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")+vi(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 Ti(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(_.fx>e.fx?(Bi(y,1+c,v,-c,e),y.fx=t(y),y.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Bi(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=te(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Ri(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Ei(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},ts=Math.sqrt,es=Math.tan;function is(t){return t>1?0:t<-1?ji:Math.acos(t)}function ss(t){return t>1?Hi:t<-1?-Hi:Math.asin(t)}function ns(){}function rs(t,e){t&&os.hasOwnProperty(t.type)&&os[t.type](t,e)}var as={Feature:function(t,e){rs(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sji?t+Math.round(-t/Vi)*Vi:t,e]}function bs(t,e,i){return(t%=Vi)?e||i?_s(Ss(t),As(e,i)):Ss(t):e||i?As(e,i):ys}function xs(t){return function(e,i){return[(e+=t)>ji?e-Vi:e<-ji?e+Vi:e,i]}}function Ss(t){var e=xs(t);return e.invert=xs(-t),e}function As(t,e){var i=Xi(t),s=Ji(t),n=Xi(e),r=Ji(e);function a(t,e){var a=Xi(e),o=Xi(t)*a,l=Ji(t)*a,h=Ji(e),c=h*i+o*s;return[$i(l*n-c*r,o*i-h*s),ss(c*n+l*r)]}return a.invert=function(t,e){var a=Xi(e),o=Xi(t)*a,l=Ji(t)*a,h=Ji(e),c=h*n-l*r;return[$i(l*n+h*r,o*i+c*s),ss(c*i-o*s)]},a}function ks(t,e){(e=us(e))[0]-=t,vs(e);var i=is(-e[1]);return((-e[2]<0?-i:i)+Vi-zi)%Vi}function Ms(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:ns,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function Ts(t,e){return Gi(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 Es(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Is(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 Ds(t,e,i,s){return function(n){var r,a,o,l=e(n),h=Ms(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Is(a);var t=function(t,e){var i=Rs(e),s=e[1],n=Ji(s),r=[Ji(i),-Xi(i),0],a=0,o=0;Ls.reset(),1===n?s=Hi+zi:-1===n&&(s=-Hi-zi);for(var l=0,h=t.length;l=0?1:-1,M=k*A,T=M>ji,w=f*x;if(Ls.add($i(w*k*Ji(M),m*S+w*Xi(M))),a+=T?A+k*Vi:A,T^p>=i^y>=i){var C=gs(us(u),us(_));vs(C);var E=gs(r,C);vs(E);var B=(T^A>=0?-1:1)*ss(E[2]);(s>B||s===B&&(C[0]||C[1]))&&(o+=T^A>=0?1:-1)}}return(a<-zi||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(Fs))}return u}}function Fs(t){return t.length>1}function zs(t,e){return((t=t.x)[0]<0?t[1]-Hi-zi:Hi-t[1])-((e=e.x)[0]<0?e[1]-Hi-zi:Hi-e[1])}1===(Bs=Os).length&&(Ps=Bs,Bs=function(t,e){return Os(Ps(t),e)});var js=Ds((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?ji:-ji,l=Gi(r-i);Gi(l-ji)0?Hi:-Hi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=ji&&(Gi(i-n)zi?Yi((Ji(e)*(r=Xi(s))*Ji(i)-Ji(s)*(n=Xi(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*Hi,s.point(-ji,n),s.point(0,n),s.point(ji,n),s.point(ji,0),s.point(ji,-n),s.point(0,-n),s.point(-ji,-n),s.point(-ji,0),s.point(-ji,n);else if(Gi(t[0]-e[0])>zi){var r=t[0]0,n=Gi(e)>zi;function r(t,i){return Xi(t)*Xi(i)>e}function a(t,i,s){var n=[1,0,0],r=gs(us(t),us(i)),a=ps(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=gs(n,r),u=ms(n,h);fs(u,ms(r,c));var p=d,g=ps(u,p),f=ps(p,p),m=g*g-f*(ps(u,u)-1);if(!(m<0)){var v=ts(m),_=ms(p,(-g-v)/f);if(fs(_,u),_=ds(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],A=i[1];x0^_[1]<(Gi(_[0]-b)ji^(b<=_[0]&&_[0]<=x)){var T=ms(p,(-g+v)/f);return fs(T,u),[_,ds(T)]}}}function o(e,i){var n=s?t:ji-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Ds(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],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?ji:-ji),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||Ts(e,p)||Ts(g,p))&&(g[2]=1),f!==l)c=0,f?(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^f){var v;m&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)))}!f||e&&Ts(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},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=Xi(e),o=Ji(e),l=s*i;null==n?(n=e+s*Vi,r=e-l/2):(n=ks(a,n),r=ks(a,r),(s>0?nr)&&(n+=s*Vi));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 Gi(s[0]-t)0?0:3:Gi(s[0]-i)0?2:1:Gi(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,f,m,v,_,y=a,b=Ms(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(A(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&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=Is(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&Cs(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&&m)y.point(r,a);else{var l=[g=Math.max(Vs,Math.min(Ns,g)),f=Math.max(Vs,Math.min(Ns,f))],b=[r=Math.max(Vs,Math.min(Ns,r)),a=Math.max(Vs,Math.min(Ns,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):(m||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Ws(t){return t}var Gs,Ys,$s,Xs,Ks=Oi(),qs=Oi(),Zs={point:ns,lineStart:ns,lineEnd:ns,polygonStart:function(){Zs.lineStart=Js,Zs.lineEnd=en},polygonEnd:function(){Zs.lineStart=Zs.lineEnd=Zs.point=ns,Ks.add(Gi(qs)),qs.reset()},result:function(){var t=Ks/2;return Ks.reset(),t}};function Js(){Zs.point=Qs}function Qs(t,e){Zs.point=tn,Gs=$s=t,Ys=Xs=e}function tn(t,e){qs.add(Xs*t-$s*e),$s=t,Xs=e}function en(){tn(Gs,Ys)}var sn=Zs,nn=1/0,rn=nn,an=-nn,on=an;var ln,hn,cn,dn,un={point:function(t,e){tan&&(an=t);eon&&(on=e)},lineStart:ns,lineEnd:ns,polygonStart:ns,polygonEnd:ns,result:function(){var t=[[nn,rn],[an,on]];return an=on=-(rn=nn=1/0),t}},pn=0,gn=0,fn=0,mn=0,vn=0,_n=0,yn=0,bn=0,xn=0,Sn={point:An,lineStart:kn,lineEnd:wn,polygonStart:function(){Sn.lineStart=Cn,Sn.lineEnd=En},polygonEnd:function(){Sn.point=An,Sn.lineStart=kn,Sn.lineEnd=wn},result:function(){var t=xn?[yn/xn,bn/xn]:_n?[mn/_n,vn/_n]:fn?[pn/fn,gn/fn]:[NaN,NaN];return pn=gn=fn=mn=vn=_n=yn=bn=xn=0,t}};function An(t,e){pn+=t,gn+=e,++fn}function kn(){Sn.point=Mn}function Mn(t,e){Sn.point=Tn,An(cn=t,dn=e)}function Tn(t,e){var i=t-cn,s=e-dn,n=ts(i*i+s*s);mn+=n*(cn+t)/2,vn+=n*(dn+e)/2,_n+=n,An(cn=t,dn=e)}function wn(){Sn.point=An}function Cn(){Sn.point=Bn}function En(){Pn(ln,hn)}function Bn(t,e){Sn.point=Pn,An(ln=cn=t,hn=dn=e)}function Pn(t,e){var i=t-cn,s=e-dn,n=ts(i*i+s*s);mn+=n*(cn+t)/2,vn+=n*(dn+e)/2,_n+=n,yn+=(n=dn*t-cn*e)*(cn+t),bn+=n*(dn+e),xn+=3*n,An(cn=t,dn=e)}var Ln=Sn;function Rn(t){this._context=t}Rn.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,Vi)}},result:ns};var On,In,Dn,Fn,zn,jn=Oi(),Hn={point:ns,lineStart:function(){Hn.point=Nn},lineEnd:function(){On&&Vn(In,Dn),Hn.point=ns},polygonStart:function(){On=!0},polygonEnd:function(){On=null},result:function(){var t=+jn;return jn.reset(),t}};function Nn(t,e){Hn.point=Vn,In=Fn=t,Dn=zn=e}function Vn(t,e){Fn-=t,zn-=e,jn.add(ts(Fn*Fn+zn*zn)),Fn=t,zn=e}var Un=Hn;function Wn(){this._string=[]}function Gn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Yn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),cs(t,i(s))),s.result()}return r.area=function(t){return cs(t,i(sn)),sn.result()},r.measure=function(t){return cs(t,i(Un)),Un.result()},r.bounds=function(t){return cs(t,i(un)),un.result()},r.centroid=function(t){return cs(t,i(Ln)),Ln.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ws):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Wn):new Rn(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 $n(t){return function(e){var i=new Xn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Xn(){}function Kn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),cs(i,t.stream(un)),e(un.result()),null!=s&&t.clipExtent(s),t}function qn(t,e,i){return Kn(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 Zn(t,e,i){return qn(t,[[0,0],e],i)}function Jn(t,e,i){return Kn(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 Qn(t,e,i){return Kn(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)}Wn.prototype={_radius:4.5,_circle:Gn(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=Gn(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}},Xn.prototype={constructor:Xn,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 tr=16,er=Xi(30*Wi);function ir(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&f--){var b=a+u,x=o+p,S=l+g,A=ts(b*b+x*x+S*S),k=ss(S/=A),M=Gi(Gi(S)-1)e||Gi((v*E+_*B)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Wi:0,E()):[m*Ui,v*Ui,_*Ui]},w.angle=function(t){return arguments.length?(y=t%360*Wi,E()):y*Ui},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=ir(o,T=t*t),B()):ts(T)},w.fitExtent=function(t,e){return qn(w,t,e)},w.fitSize=function(t,e){return Zn(w,t,e)},w.fitWidth=function(t,e){return Jn(w,t,e)},w.fitHeight=function(t,e){return Qn(w,t,e)},function(){return e=t.apply(this,arguments),w.invert=e.invert&&C,E()}}function lr(t){var e=0,i=ji/3,s=or(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Wi,i=t[1]*Wi):[e*Ui,i*Ui]},n}function hr(t,e){var i=Ji(t),s=(i+Ji(e))/2;if(Gi(s)2?t[2]*Wi:0),e.invert=function(e){return(e=t.invert(e[0]*Wi,e[1]*Wi))[0]*=Ui,e[1]*=Ui,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===mr?[[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 _r(t){return es((Hi+t)/2)}function yr(t,e){var i=Xi(t),s=t===e?Ji(t):qi(i/Xi(e))/qi(_r(e)/_r(t)),n=i*Zi(_r(t),s)/s;if(!s)return mr;function r(t,e){n>0?e<-Hi+zi&&(e=-Hi+zi):e>Hi-zi&&(e=Hi-zi);var i=n/Zi(_r(e),s);return[i*Ji(s*t),n-i*Xi(s*t)]}return r.invert=function(t,e){var i=n-e,r=Qi(s)*ts(t*t+i*i),a=$i(t,Gi(i))*Qi(i);return i*s<0&&(a-=ji*Qi(t)*Qi(i)),[a/s,2*Yi(Zi(n/r,1/s))-Hi]},r}function br(t,e){return[t,e]}function xr(t,e){var i=Xi(t),s=t===e?Ji(t):(i-Xi(e))/(e-t),n=i/s+t;if(Gi(s)zi&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Br.invert=pr(ss),Pr.invert=pr((function(t){return 2*Yi(t)})),Lr.invert=function(t,e){return[-e,2*Yi(Ki(t))-Hi]};var Ir={exports:{}},Dr=function(t,e){this.p1=t,this.p2=e};Dr.prototype.rise=function(){return this.p2[1]-this.p1[1]},Dr.prototype.run=function(){return this.p2[0]-this.p1[0]},Dr.prototype.slope=function(){return this.rise()/this.run()},Dr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Dr.prototype.isVertical=function(){return!isFinite(this.slope())},Dr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Dr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Dr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Dr.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)},Dr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Fr=Dr,zr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Fr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=zr(t.slice(0,s),e),o=zr(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},jr=zr;!function(t){var e=jr;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;r{const i=Nr(Wr,e),{tolerance:s}=i;return Hr(t,s)};var Yr;!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"}(Yr||(Yr={}));const $r=(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.sort&&(k(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!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;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,_=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],A=new Set,k=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),A.has(i)||(A.add(i),S.push(i),y(m)?k.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):k.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else _[r][l]+=a;e&&e.includeValues&&!v&&_[r][c].push(t[n]);break}}}let M=0;const T=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=_.length;t0?_[t][l]/M:0,T.push(_[t])}return T},Kr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,_=-1/0;if(e.extent)v=e.extent[0],_=e.extent[1];else for(let e=0;e_&&(_=s))}if(!Number.isFinite(v)||!Number.isFinite(_)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=_;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(_-v>1){const e=Math.floor(v),i=Math.ceil((_-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>_){t=s,m.length=t+1;break}}else{const e=(_-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>_){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",A=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",k=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",M=null!==(d=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==d?d:"percentage",T=y(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],w=y(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],C=w.length?w:void 0,E=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:A,percentageName:M,valuesName:k,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:C});if(!T.length)return Xr(t,E);const B={};return t.forEach((t=>{const e=T.map((e=>null==t?void 0:t[e])).join("-&&-");B[e]?B[e].push(t):B[e]=[t]})),Object.values(B).map((t=>{const e=[...w,...T];return Xr(t,Object.assign(Object.assign({},E),{groupField:e.length?e:void 0,n:t.length}))})).flat()},qr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,_;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const A=!!(null==e?void 0:e.includeValues),k=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},M=null!==(n=k.key)&&void 0!==n?n:y(x)?null:null!==(r=x)&&void 0!==r?r:"key",T=null!==(a=k.count)&&void 0!==a?a:"count",w=null!==(o=k.mean)&&void 0!==o?o:"mean",C=null!==(l=k.q1)&&void 0!==l?l:"q1",E=null!==(h=k.median)&&void 0!==h?h:"median",B=null!==(c=k.q3)&&void 0!==c?c:"q3",P=null!==(d=k.iqr)&&void 0!==d?d:"iqr",L=null!==(p=k.min)&&void 0!==p?p:"min",R=null!==(g=k.max)&&void 0!==g?g:"max",O=null!==(f=k.lowerWhisker)&&void 0!==f?f:"lowerWhisker",I=null!==(m=k.upperWhisker)&&void 0!==m?m:"upperWhisker",D=null!==(v=k.outliers)&&void 0!==v?v:"outliers",F=null!==(_=k.values)&&void 0!==_?_:"values",z=new Map,j=new Map,H=new Map,N=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),A&&j.set(r,[]),y(x)?H.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):H.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),A){const t=j.get(r);t&&t.push(i)}}y(S)&&(S=[_t(Math.min.apply(null,S),0,1),_t(Math.max.apply(null,S),0,1)]);const V=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=H.get(t);if(null!==M)f[M]=m;else if(y(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[T]=s,f[w]=o,f[C]=l,f[E]=h,f[B]=c,f[P]=d,f[L]=n,f[R]=r,f[O]=u,f[I]=p,f[D]=g,A&&(f[F]=j.get(t)||[]),V.push(f)}return V};var Zr={},Jr={};function Qr(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function ta(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function ea(t,e){var i=t+"",s=i.length;return s9999?"+"+ea(e,6):ea(e,4))+"-"+ea(t.getUTCMonth()+1,2)+"-"+ea(t.getUTCDate(),2)+(r?"T"+ea(i,2)+":"+ea(s,2)+":"+ea(n,2)+"."+ea(r,3)+"Z":n?"T"+ea(i,2)+":"+ea(s,2)+":"+ea(n,2)+"Z":s||i?"T"+ea(i,2)+":"+ea(s,2)+"Z":"")}function sa(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 Jr;if(h)return h=!1,Zr;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(;a0}function ga(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=oa(t));var r=[];switch(t.type){case"GeometryCollection":return fa(t,(function(t){va(t,s)})),t;case"FeatureCollection":return ga(t,(function(t){ga(va(t,s),(function(t){r.push(t)}))})),hi(r)}return va(t,s)}function va(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return fa(t,(function(t){va(t,e)})),t;case"LineString":return _a(ua(t),e),t;case"Polygon":return ya(ua(t),e),t;case"MultiLineString":return ua(t).forEach((function(t){_a(t,e)})),t;case"MultiPolygon":return ua(t).forEach((function(t){ya(t,e)})),t;case"Point":case"MultiPoint":return t}}function _a(t,e){pa(t)===e&&t.reverse()}function ya(t,e){pa(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=ba(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},ka=(t,e={},i)=>{i.type=Yr.GEO;const s=Nr(Sa,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Aa(t))})):e.push(Aa(t))})),e})(t);let l=t.features;return o&&(l=ma(t,{reverse:!g(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=xa.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=xa.bounds(t);t.bbox=e}})),t.features=l,t},Ma={},Ta=(t,e,i)=>{i.type=Yr.GEO;const s=Nr(Sa,Ma,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 Or(a,t)}))}:Or(a,o));var a,o;return ka(r,s,i)},wa=(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 Ca=0;function Ea(t="dataset"){return Ca>1e8&&(Ca=0),t+"_"+Ca++}class Ba{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:Ea("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:ot.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()}}class Pa{constructor(t,e){let i;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=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&U(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Ea("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){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,e=!0){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)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}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,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&U(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof Pa||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!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",$r),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Yn();const La={},Ra={albers:dr,albersusa:function(){var t,e,i,s,n,r,a=dr(),o=cr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=cr().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)}},Oa=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Ia(t,e){return function i(){const s=e();return s.type=t,s.path=Yn().projection(s),s.copy=s.copy||function(){const t=i();return Oa.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Da{static GenAutoIncrementId(){return Da.auto_increment_id++}}Da.auto_increment_id=0;class Fa{constructor(t){this.id=Da.GenAutoIncrementId(),this.registry=t}}const za="named",ja="inject",Ha="multi_inject",Na="inversify:tagged",Va="inversify:paramtypes";class Ua{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===za?`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="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),s=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),n=new WeakMap;function r(t,e,i){let r=n.get(t);if(h(r)){if(!i)return;r=new s,n.set(t,r)}let a=r.get(e);if(h(a)){if(!i)return;a=new s,r.set(e,a)}return a}function a(t,e,i){if(o(t,e,i))return!0;const s=f(e);return!c(s)&&a(t,s,i)}function o(t,e,i){const s=r(e,i,!1);return!h(s)&&!!s.has(t)}function l(t,e,i){if(o(t,e,i))return function(t,e,i){const s=r(e,i,!1);if(!h(s))return s.get(t)}(t,e,i);const s=f(e);return c(s)?void 0:l(t,s,i)}function h(t){return void 0===t}function c(t){return null===t}function d(t){return"object"==typeof t?null!==t:"function"==typeof t}function u(t,i){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const s=3===i?"string":5===i?"number":"default",n=function(t,e){const i=t[e];if(null!=i){if(!g(i))throw new TypeError;return i}}(t,e);if(void 0!==n){const e=n.call(t,s);if(d(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.valueOf;if(g(i)){const e=i.call(t);if(!d(e))return e}}else{const e=t.valueOf;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.toString;if(g(i)){const e=i.call(t);if(!d(e))return e}}throw new TypeError}(t,"default"===s?"number":s)}function p(t){const e=u(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function g(t){return"function"==typeof t}function f(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const s=t.prototype,n=s&&Object.getPrototypeOf(s);if(null==n||n===Object.prototype)return e;const r=n.constructor;return"function"!=typeof r||r===t?e:r}t("defineMetadata",(function(t,e,i,s){if(!d(i))throw new TypeError;return n=t,a=e,void r(i,s,!0).set(n,a);var n,a})),t("hasMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),l(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function Ga(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};Wa.hasOwnMetadata(t,e)&&(r=Wa.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,Wa.defineMetadata(t,r,e)}(Na,t,i.toString(),s)}function Ya(t){return(e,i,s)=>{Ga(e,0,s,t)}}function $a(t){return e=>(i,s,n)=>Ya(new Ua(t,e))(i,s,n)}const Xa=$a(ja),Ka=$a(Ha);function qa(){return function(t){return Wa.defineMetadata(Va,null,t),t}}function Za(t){return Ya(new Ua(za,t))}const Ja="Singleton",Qa="Transient",to="ConstantValue",eo="DynamicValue",io="Factory",so="Function",no="Instance",ro="Invalid";class ao{constructor(t,e){this.id=Da.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=ro,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new ao(this.serviceIdentifier,this.scope);return t.activated=t.scope===Ja&&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 oo{getConstructorMetadata(t){return{compilerGeneratedMetadata:Wa.getMetadata(Va,t),userGeneratedMetadata:Wa.getMetadata(Na,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const lo=(ho=za,t=>{const e=e=>{if(null==e)return!1;if(e.key===ho&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const po=Symbol("ContributionProvider");class go{constructor(t,e){this.serviceIdentifier=t,this.container=e,mo.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function fo(t,e){t(po).toDynamicValue((({container:t})=>new go(e,t))).inSingletonScope().whenTargetNamed(e)}class mo{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}mo.store=new Map;class vo{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 _o extends vo{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const yo=Symbol.for("EnvContribution"),bo=Symbol.for("VGlobal"),xo=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Qa,this.options=e,this.id=Da.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new oo}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,za,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new ao(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new uo(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[ja],multiInject:s[Ha]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:a,metadata:e,bindings:l};n.push(t)}}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case to:case so:e=t.cache;break;case no: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===Ja&&(t.cache=e,t.activated=!0)}},So=Symbol.for("RenderService");const Ao=new class{get renderService(){return this._renderService||(this._renderService=xo.get(So)),this._renderService}};let ko=0;class Mo{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=Ao.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++ko,t),this.tryRunAnimationFrameNextFrame(),ko}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class To{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var wo=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Co=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Eo=function(t,e){return function(i,s){e(i,s,t)}},Bo=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 Po=class extends To{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}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){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Da.GenAutoIncrementId(),this.hooks={onSetEnv:new _o(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}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)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new Mo);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}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)}loadFont(t,e,i){return Bo(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}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,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var Lo,Ro,Oo,Io;Po=wo([qa(),Eo(0,Xa(po)),Eo(0,Za(yo)),Co("design:paramtypes",[Object])],Po),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(Lo||(Lo={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(Ro||(Ro={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(Oo||(Oo={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(Io||(Io={}));const Do=Nt-1e-8;class Fo{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>Do)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%=Nt)<0&&(s+=Nt),(n%=Nt)<0&&(n+=Nt),nn;++o,a-=Ht)g(a);else for(a=s-s%Ht+Ht,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const jo=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,Ho={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},No={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let Vo,Uo,Wo,Go,Yo,$o;var Xo,Ko,qo,Zo,Jo,Qo;function tl(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),f=Math.cos(n),m=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+f,A=i+m,k=S+y*m,M=A-y*f;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 el(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=oe(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 f=d/i,m=c/i,v=-c/s,_=d/s,y=f*o+m*l,b=v*o+_*l,x=f*t+m*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+=Nt:C>0&&0===r&&(C-=Nt);const E=Math.ceil(Math.abs(C/(Ht+.001))),B=[];for(let t=0;te.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 sl(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=cl(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=$t(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=$t(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function ul(t,e){const{p0:i,p1:s}=t,n=ae.pointAtPP(i,s,e);return[new pl(i,n),new pl(n,s)]}class pl extends nl{constructor(t,e){super(),this.type=Jo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return ae.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Wt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?ae.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Zo.ROW?Ut(this.p0.x-this.p1.x):t===Zo.COLUMN?Ut(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class gl{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new dl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new pl(new re(this._lastX,this._lastY),new re(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===Zo.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Ut(t.p0.y-s.y)}if(t===Zo.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Ut(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class fl extends gl{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 ml(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function vl(t,e,i){const s=null!=e?e:Ut(i[i.length-1].x-i[0].x)>Ut(i[i.length-1].y-i[0].y)?Zo.ROW:Zo.COLUMN;return"monotoneY"===t?new fl(t,s):new gl(t,s)}class _l{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 yl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=vl("linear",i,t);return function(t,e){ml(t,e,1)}(new _l(n,s),t),n}function bl(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 xl{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&&bl(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:bl(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 Sl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return yl(t,e);const n=vl("basis",i,t);return function(t,e){ml(t,e,2)}(new xl(n,s),t),n}function Al(t){return t<0?-1:1}function kl(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(Al(r)+Al(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Ml(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 wl{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,Ml(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,Ml(this,e=kl(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Tl(this,this._t0,e=kl(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 Cl extends wl{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function El(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return yl(t,e);const n=vl("monotoneX",i,t);return function(t,e){ml(t,e,2)}(new wl(n,s),t),n}function Bl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return yl(t,e);const n=vl("monotoneY",i,t);return function(t,e){ml(t,e,2)}(new Cl(n,s),t),n}let Pl=class{constructor(t,e=.5,i){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;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):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()}};class Ll extends Pl{lineEnd(){this.context.closePath()}}function Rl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new gl("step",null!=s?s:Ut(t[t.length-1].x-t[0].x)>Ut(t[t.length-1].y-t[0].y)?Zo.ROW:Zo.COLUMN);return Ol(new Pl(r,e,n),t),r}function Ol(t,e){return ml(t,e,1)}class Il extends _l{lineEnd(){this.context.closePath()}}function Dl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=vl("linear",i,t);return function(t,e){ml(t,e,1)}(new Il(n,s),t),n}function Fl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>zt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>zt){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function zl(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return yl(i,n);const o=vl(t,r,i);return ml(new e(o,s,a),i,2),o}}const jl=zl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:Fl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const Hl=zl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:Fl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class Nl extends nl{constructor(t,e,i){super(),this.type=Jo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return hl(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,rl([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===Zo.ROW?Ut(this.p0.x-this.p2.x):t===Zo.COLUMN?Ut(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Yt(t-.01,0),i=$t(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Wt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=hl(i,s,n,e),a=ae.pointAtPP(i,s,e),o=ae.pointAtPP(s,n,e);return[new Nl(i,a,r),new Nl(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Vl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new pl(new re(this._lastX,this._lastY),new re(t,e))}quadraticCurveTo(t,e,i,s){const n=new Nl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new dl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Ul(t,e,i){var s,n;switch(e){case"linear":default:return yl(t,i);case"basis":return Sl(t,i);case"monotoneX":return El(t,i);case"monotoneY":return Bl(t,i);case"step":return Rl(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new gl("step",null!=s?s:Ut(t[t.length-1].x-t[0].x)>Ut(t[t.length-1].y-t[0].y)?Zo.ROW:Zo.COLUMN);return Ol(new Ll(r,e,n),t),r}(t,.5,i);case"stepBefore":return Rl(t,0,i);case"stepAfter":return Rl(t,1,i);case"catmullRom":return jl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return Hl(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return Dl(t,i)}}class Wl extends zo{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Fo(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([No.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([No.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([No.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([No.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([No.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([No.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([No.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([No.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([No.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()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Vl(this);sl(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[No.M]=t=>`M${t[1]} ${t[2]}`,t[No.L]=t=>`L${t[1]} ${t[2]}`,t[No.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[No.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[No.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3];((t,e,i,s,n,r,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;e`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[No.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,e=Wo;for(let s=1,r=i.length;s{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,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),sl(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Zo.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Ut(t.p0.y-e.p1.y)}if(this.direction===Zo.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Ut(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{ot.getInstance().warn("空函数")}}),lh=Object.assign(Object.assign({},th),{points:[],cornerRadius:0,closePath:!0}),hh=Object.assign(Object.assign({},th),{width:100,height:100,spikes:5,thickness:.5}),ch=Object.assign(Object.assign({},th),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},th),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const dh=Object.assign(Object.assign({},th),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),uh=Object.assign(Object.assign(Object.assign({},th),Zl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),ph=Object.assign(Object.assign(Object.assign({},th),Zl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",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}),gh=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0,maxWidth:500,maxHeight:500},th),{fill:!0,cornerRadius:0,cornerType:"round"}),fh=Object.assign(Object.assign({},gh),{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}),mh=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 m("directional",t.sideOrCorner,1)||m("angular",t.angleValue,1)}function a(){return m("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=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 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=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 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 vh{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(vh.IsGradientStr(t))try{const e=mh(t)[0];if(e){if("linear"===e.type)return vh.ParseLinear(e);if("radial"===e.type)return vh.ParseRadial(e);if("conic"===e.type)return vh.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=jt/2,n=parseFloat(e.value)/180*jt-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Vt,stops:vh.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:vh.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=jt/2;let n="angular"===e.type?parseFloat(e.value)/180*jt:0;for(;n<0;)n+=Vt;for(;n>=Vt;)n-=Vt;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}const bh={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"}},xh=!0,Sh=!1,Ah=/\w|\(|\)|-/,kh=/[.?!,;:/,。?!、;:]/,Mh=/\S/,Th=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function wh(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=Ao.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=Ch(t,a)),a}function Ch(t,e,i=!1){let s=e;for(;Ah.test(t[s-1])&&Ah.test(t[s])||kh.test(t[s]);)if(s--,s<=0)return i?Eh(t,e):e;return s}function Eh(t,e){let i=e;for(;Ah.test(t[i+1])&&Ah.test(t[i])||kh.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Bh(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=Ao.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}var Ph=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Lh=class{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=uh.fontSize}){let i=0,s=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 a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=Ch(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_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){if(s===n){ot.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}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),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);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}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,a=!1){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=Ch(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}};Lh=Ph([qa()],Lh);var Rh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Oh=Symbol.for("TextMeasureContribution");let Ih=class extends Lh{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}};Ih=Rh([qa()],Ih);const Dh=Symbol.for("CanvasFactory"),Fh=Symbol.for("Context2dFactory");function zh(t){return xo.getNamed(Dh,Ao.global.env)(t)}const jh=1e-4,Hh=Math.sqrt(3),Nh=1/3;function Vh(t){return t>-ec&&tec||t<-ec}const Wh=[0,0],Gh=[0,0],Yh=[0,0];function $h(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Xh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function Kh(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 qh(t){return(t%=Vt)<0&&(t+=Vt),t}function Zh(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+=Vt);let d=Math.atan2(l,o);return d<0&&(d+=Vt),d>=s&&d<=n||d+Vt>=s&&d+Vt<=n}function tc(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(Vh(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 sc=[-1,-1,-1],nc=[-1,-1];function rc(){const t=nc[0];nc[0]=nc[1],nc[1]=t}function ac(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(Vh(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,Nh):Math.pow(i,Nh),s=s<0?-Math.pow(-s,Nh):Math.pow(s,Nh);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+Hh*Math.sin(e)))/(3*a),h=(-o+i*(s-Hh*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,sc);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&rc(),p=Kh(e,s,r,o,nc[0]),u>1&&(g=Kh(e,s,r,o,nc[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Vh(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,sc);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=Xh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);sc[0]=-l,sc[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Vt-1e-4){s=0,n=Vt;const e=r?1:-1;return a>=sc[0]+t&&a<=sc[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Vt,n+=Vt);let c=0;for(let e=0;e<2;e++){const i=sc[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Vt+t),(t>=s&&t<=n||t+Vt>=s&&t+Vt<=n)&&(t>jt/2&&t<1.5*jt&&(e=-e),c+=e)}}return c}function hc(t){return Math.round(t/jt*1e8)/1e8%2*jt}function cc(t,e){let i=hc(t[0]);i<0&&(i+=Vt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Vt?n=i+Vt:e&&i-n>=Vt?n=i-Vt:!e&&i>n?n=i+(Vt-hc(i-n)):e&&i1&&(i||(h+=Re(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],v=a[2],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,A=b;dc[0]=S,dc[1]=A,cc(dc,Boolean(a[6])),S=dc[0],A=dc[1];const k=S,M=A-S,T=!!(1-(a[6]?0:1)),w=(s-m)*_/_+m;switch(f){case No.M:u=m,p=v,c=u,d=p;break;case No.L:if(i){if(tc(c,d,m,v,e,s,n))return!0}else h+=Re(c,d,m,v,s,n)||0;c=m,d=v;break;case No.C:if(i){if(Jh(c,d,m,v,_,y,b,x,e,s,n))return!0}else h+=ac(c,d,m,v,_,y,b,x,s,n)||0;c=b,d=x;break;case No.Q:if(i){if(Zh(c,d,m,v,_,y,e,s,n))return!0}else h+=oc(c,d,m,v,_,y,s,n)||0;c=_,d=y;break;case No.A:if(o=Math.cos(k)*_+m,l=Math.sin(k)*_+v,g?(u=o,p=l):h+=Re(c,d,o,l,s,n),i){if(Qh(m,v,_,k,k+M,T,e,w,n))return!0}else h+=lc(m,v,_,k,k+M,T,w,n);c=Math.cos(k+M)*_+m,d=Math.sin(k+M)*_+v;break;case No.R:if(u=c=m,p=d=v,o=u+_,l=p+y,i){if(tc(u,p,o,p,e,s,n)||tc(o,p,o,l,e,s,n)||tc(o,l,u,l,e,s,n)||tc(u,l,u,p,e,s,n))return!0}else h+=Re(o,p,o,l,s,n),h+=Re(u,l,u,p,s,n);break;case No.Z:if(i){if(tc(c,d,u,p,e,s,n))return!0}else h+=Re(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},fc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const mc=Symbol.for("VWindow"),vc=Symbol.for("WindowHandlerContribution");let _c=class extends To{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(){super(),this.hooks={onChange:new _o(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(xo.getNamed(vc,t.env).configure(this,t),this.actived=!0)},this._uid=Da.GenAutoIncrementId(),this.global=Ao.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}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.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}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)}};_c=gc([qa(),fc("design:paramtypes",[])],_c);var yc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xc=function(t,e){return function(i,s){e(i,s,t)}};let Sc=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=Ao.global,this._textMeasureMap=new Map,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}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||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=pc.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="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:Zl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Fe(Object.assign({defaultFontParams:{fontFamily:Zl.fontFamily,fontSize:Zl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=xo.get(mc),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 Ac;Sc=yc([qa(),xc(0,Xa(po)),xc(0,Za(Oh)),bc("design:paramtypes",[Object])],Sc),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Ac||(Ac={}));const kc=new We;let Mc=class{constructor(){this.matrix=new We}init(t){return this.mode=Ac.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Ac.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(kc.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(kc.a,kc.b,kc.c,kc.d,kc.e,kc.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(kc.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(kc.a,kc.b,kc.c,kc.d,kc.e,kc.f),this}scale(t,e,i){return this.mode===Ac.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Ac.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return kc.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(kc.a,kc.b,kc.c,kc.d,kc.e,kc.f),this}translate(t,e){return this.mode===Ac.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Ac.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Mc=yc([qa(),bc("design:paramtypes",[])],Mc);const Tc={arc:eh,area:ih,circle:sh,line:ah,path:oh,symbol:dh,text:uh,rect:ch,polygon:lh,star:hh,richtext:ph,richtextIcon:fh,image:gh,group:nh,glyph:rh},wc=Object.keys(Tc);function Cc(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Ec={arc:Object.assign({},Tc.arc),area:Object.assign({},Tc.area),circle:Object.assign({},Tc.circle),line:Object.assign({},Tc.line),path:Object.assign({},Tc.path),symbol:Object.assign({},Tc.symbol),text:Object.assign({},Tc.text),rect:Object.assign({},Tc.rect),polygon:Object.assign({},Tc.polygon),star:Object.assign({},Tc.star),richtext:Object.assign({},Tc.richtext),richtextIcon:Object.assign({},Tc.richtextIcon),image:Object.assign({},Tc.image),group:Object.assign({},Tc.group),glyph:Object.assign({},Tc.glyph)};class Bc{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},wc.forEach((t=>{this._defaultTheme[t]=Object.create(Ec[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,i=!1){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,ot.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;wc.forEach((s=>{const n=Object.create(Ec[s]);t&&t[s]&&Cc(n,t[s]),i[s]&&Cc(n,i[s]),e[s]&&Cc(n,e[s]),this.combinedTheme[s]=n})),e.common&&wc.forEach((t=>{Cc(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 Pc=new Bc;function Lc(t,e){return t.glyphHost?Lc(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)):Pc.getTheme()}return null}(t)||t.attachedThemeGraphic&&Lc(t.attachedThemeGraphic)||Pc.getTheme()}var Rc=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 Oc 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=Da.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){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,e=!1){return Rc(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,e=!0){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,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)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===t||t===e)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&&ot.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)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,e=!1){let 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,e=!1){let 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,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Fc))return void ot.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(Nc(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 Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=Nc(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 Fc))return void ot.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=Nc(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 Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=Nc(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 Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=Hc.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Nc(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(Nc(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,Nc(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(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 Fc))return void ot.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"):Nc(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 zc))return void ot.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=Hc.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.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),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 Vc(s,{clickInterval:a,supportsTouchEvents:o}),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 Fc,this.rootWheelEvent=new zc,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.addEventListener("pointermove",this.onPointerMove,!0),t.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.addEventListener("mousemove",this.onPointerMove,!0),t.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.removeEventListener("pointermove",this.onPointerMove,!0),t.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.removeEventListener("mousemove",this.onPointerMove,!0),t.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 Yc{static GetImage(t,e){var i;const s=Yc.cache.get(t);s?"fail"===s.loadState?Ao.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):Yc.loadImage(t,e)}static GetSvg(t,e){var i;let s=Yc.cache.get(t);s?"fail"===s.loadState?Ao.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"},Yc.cache.set(t,s),s.dataPromise=Ao.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.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Yc.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Yc.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Ao.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Ao.global.loadBlob(t):"json"===e&&(i.dataPromise=Ao.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Yc.isLoading&&Yc.toLoadAueue.length){Yc.isLoading=!0;const t=Yc.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Yc.cache.set(i,n),n.dataPromise=Ao.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))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Yc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Yc.loading()})).catch((t=>{console.error(t),Yc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Yc.loading()}))}}),0)}static loadImage(t,e){const i=$c(t,Yc.toLoadAueue);if(-1!==i)return Yc.toLoadAueue[i].marks.push(e),void Yc.loading();Yc.toLoadAueue.push({url:t,marks:[e]}),Yc.loading()}static improveImageLoading(t){const e=$c(t,Yc.toLoadAueue);if(-1!==e){const t=Yc.toLoadAueue.splice(e,1);Yc.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function $c(t,e){for(let i=0;it?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(qc[0]=t[0],qc[2]=t[0],qc[1]=t[1],qc[3]=t[1],qc):t:t:0,Jc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Qc=[1,2,3,0,1,2,3,0];function td(t,e,i,s){for(;t>=Vt;)t-=Vt;for(;t<0;)t+=Vt;for(;t>e;)e+=Vt;Jc[0].x=i,Jc[1].y=i,Jc[2].x=-i,Jc[3].y=-i;const n=Math.ceil(t/Ht)%4,r=Math.ceil(e/Ht)%4;if(s.add(Gt(t)*i,Xt(t)*i),s.add(Gt(e)*i,Xt(e)*i),n!==r||e-t>jt){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{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)}}nd.TimeOut=1e3/60;const rd=new nd,ad=(t,e)=>{const i=((t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};class od{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}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function ld(t,e,i,s,n){return n?t.arc(i,s,e,0,Nt,!1,n):t.arc(i,s,e,0,Nt),!1}var hd=new class extends od{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 ld(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return ld(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(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 cd=new class extends od{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,this.parseSize(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,this.parseSize(e)/6,i,s,n,r)}};function dd(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 ud=new class extends od{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 dd(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return dd(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return dd(t,this.parseSize(e)/2+n,i,s,r)}};function pd(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var gd=new class extends od{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return pd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return pd(t,this.parseSize(e)/2+n,i,s)}};function fd(t,e,i,s,n=0){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}class md extends od{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 fd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return fd(t,this.parseSize(e)/2,i,s,n)}}var vd=new md;var _d=new class extends md{constructor(){super(...arguments),this.type="triangle"}};const yd=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),bd=Math.sin(Nt/10)*yd,xd=-Math.cos(Nt/10)*yd;function Sd(t,e,i,s){const n=bd*e,r=xd*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Nt*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 Ad=new class extends od{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 Sd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Sd(t,this.parseSize(e)/2+n,i,s)}};const kd=Kt(3);function Md(t,e,i,s){const n=e,r=n/kd,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 Td=new class extends od{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 Md(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Md(t,this.parseSize(e)/2+n,i,s)}};function wd(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 Cd=new class extends od{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return wd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return wd(t,this.parseSize(e)/2+n,i,s)}};function Ed(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Bd=new class extends od{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Ed(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ed(t,this.parseSize(e)/2+n,i,s)}};const Pd=-.5,Ld=Kt(3)/2,Rd=1/Kt(12);function Od(t,e,i,s){const n=e/2,r=e*Rd,a=n,o=e*Rd+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(Pd*n-Ld*r+i,Ld*n+Pd*r+s),t.lineTo(Pd*a-Ld*o+i,Ld*a+Pd*o+s),t.lineTo(Pd*l-Ld*h+i,Ld*l+Pd*h+s),t.lineTo(Pd*n+Ld*r+i,Pd*r-Ld*n+s),t.lineTo(Pd*a+Ld*o+i,Pd*o-Ld*a+s),t.lineTo(Pd*l+Ld*h+i,Pd*h-Ld*l+s),t.closePath(),!1}var Id=new class extends od{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 Od(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Od(t,this.parseSize(e)/2+n,i,s)}};function Dd(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}var Fd=new class extends od{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 Dd(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Dd(t,this.parseSize(e)/2,i,s,n)}};function zd(t,e,i,s,n=0){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}var jd=new class extends od{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 zd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return zd(t,this.parseSize(e)/2,i,s,n)}};function Hd(t,e,i,s,n=0){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}var Nd=new class extends od{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 Hd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Hd(t,this.parseSize(e)/2,i,s,n)}};const Vd=Kt(3);function Ud(t,e,i,s){const n=e*Vd;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var Wd=new class extends od{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Ud(t,this.parseSize(e)/2/Vd,i,s)}drawOffset(t,e,i,s,n){return Ud(t,this.parseSize(e)/2/Vd+n,i,s)}};function Gd(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 Yd=new class extends od{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 Gd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Gd(t,this.parseSize(e)/4+n,i,s)}};function $d(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 Xd=new class extends od{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 $d(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return $d(t,this.parseSize(e)/4+n,i,s)}};function Kd(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 qd=new class extends od{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 Kd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Kd(t,this.parseSize(e)/4+n,i,s)}};function Zd(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 Jd=new class extends od{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 Zd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Zd(t,this.parseSize(e)/4+n,i,s)}};function Qd(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var tu=new class extends od{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return Qd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Qd(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function eu(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var iu=new class extends od{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return eu(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return eu(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function su(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 nu=new class extends od{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 su(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return su(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function ru(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function au(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var ou=new class extends od{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)?au(t,e,i,s):ru(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?au(t,e+2*n,i,s):ru(t,[e[0]+2*n,e[1]+2*n],i,s)}};const lu=new Ve;class hu{constructor(t,e,i=!1){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 e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),sl(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(sl(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{lu.x1=i.bounds.x1*t,lu.y1=i.bounds.y1*t,lu.x2=i.bounds.x2*t,lu.y2=i.bounds.y2*t,e.union(lu)}))}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 cu={};[hd,cd,ud,gd,Wd,_d,Ad,Td,Cd,Bd,Id,Fd,jd,vd,Nd,Yd,Xd,qd,Jd,ou,tu,iu,nu].forEach((t=>{cu[t.type]=t}));const du={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"};class uu{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 pu(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function gu(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",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=gu(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=pu(t,"--\x3e",r+4,"Comment is not closed.");else{const a=gu(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 uu(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 uu(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 vu(t,e){return _u(t)}function _u(t,e){const i={};for(let e=0;ewu.set(t,!0)));const Cu=new Map;function Eu(t){if(wu.has(t))return!0;if(Cu.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>Cu.set(t,!0)));const Bu=Mu(),Pu=Mu(),Lu=Mu(),Ru=Mu(),Ou=Mu(),Iu=Mu(),Du=Mu(),Fu=Mu(),zu=Mu(),ju=Mu();Mu();const Hu=Mu();Mu();const Nu=Mu();Mu();const Vu=Mu(),Uu=Mu(),Wu=Symbol.for("GraphicService"),Gu=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"},$u=Object.keys(Yu),Xu={duration:200,easing:"cubicOut"};function Ku(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}function qu(t,e,i){const s=i[0],n=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]*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],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*s+c*n+g*r+e[12],t[13]=o*s+d*n+f*r+e[13],t[14]=l*s+u*n+m*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function Zu(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 Ju(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],f=e[12],m=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*f,t[1]=y*n+b*l+x*u+S*m,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*f,t[5]=y*n+b*l+x*u+S*m,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*f,t[9]=y*n+b*l+x*u+S*m,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*f,t[13]=y*n+b*l+x*u+S*m,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function Qu(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 tp{constructor(){this.pools=[]}static identity(t){return Ku(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 tp.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},np=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const rp=new We(1,0,0,1,0,0),ap={x:0,y:0};let op=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new We(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new We(1,0,0,1,0,0),this.path=new Wl,this._clearMatrix=new We(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return ep.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new We(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(ep.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(ep.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){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,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=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(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){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},ap),function(t,e,i){return uc(t,0,!1,e,i)}(this.path.commandList,ap.x,ap.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},ap);const i=_h(this,this.lineWidth,this.dpr);return function(t,e,i,s){return uc(t,e,!0,i,s)}(this.path.commandList,i,ap.x,ap.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(t=!0,e=this.dpr){this.setTransformFromMatrix(rp,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>ep.free(t))),this.stack.length=0}};op=sp([qa(),np("design:paramtypes",[Object,Number])],op);const lp={WIDTH:500,HEIGHT:500,DPR:1};class hp{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}set nativeCanvas(t){this._nativeCanvas=t}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=lp.WIDTH,height:n=lp.HEIGHT,dpr:r=lp.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(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var cp;hp.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(cp||(cp={}));class dp{static Get(t,e=cp.Color1,i=[0,0,0,1]){if(e===cp.Color1){const e=dp.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ii.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];dp.store1[t]=e,dp.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=dp.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ii.parseColorString(t);return n&&(dp.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],dp.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===cp.Color1){if(dp.store1[t])return;dp.store1[t]=i,dp.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(dp.store255[t])return;dp.store255[t]=i,dp.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function up(t,e=!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 pp(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)=>{var a,o;return gp(y(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,y(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):gp(t,e,i,s,n)}function gp(t,e,i,s,n){if(!t||!e)return t&&up(t)||e&&up(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=dp.Get(t,cp.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=dp.Get(e,cp.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:up(a)})))});return o?pp(r,l,i,s,n):pp(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:_p(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:_p(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:_p(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),up(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)}function fp(t,e,i){return`rgba(${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})`}dp.store255={},dp.store1={};const mp=[0,0,0,0],vp=[0,0,0,0];function _p(t,e,i){return dp.Get(t,cp.Color255,mp),dp.Get(e,cp.Color255,vp),`rgba(${Math.round(mp[0]+(vp[0]-mp[0])*i)},${Math.round(mp[1]+(vp[1]-mp[1])*i)},${Math.round(mp[2]+(vp[2]-mp[2])*i)},${mp[3]+(vp[3]-mp[3])*i})`}class yp{static GetCanvas(){try{return yp.canvas||(yp.canvas=Ao.global.createCanvas({})),yp.canvas}catch(t){return null}}static GetCtx(){if(!yp.ctx){const t=yp.GetCanvas();yp.ctx=t.getContext("2d")}return yp.ctx}}class bp extends Ge{static getInstance(){return bp._instance||(bp._instance=new bp),bp._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=yp.GetCanvas(),s=yp.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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new bp(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class xp{static GetSize(t){for(let e=0;e=t)return xp.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=xp.GenKey(t,e,i,s,n),l=xp.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=xp.GenKey(t,e,i,s,n);xp.cache[l]?xp.cache[l].push({width:a,height:o,pattern:r}):xp.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}xp.cache={},xp.ImageSize=[20,40,80,160,320,640,1280,2560];const Sp=new Ve,Ap=new We;new Ve;const kp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],Mp=["x","y"],Tp=["scaleX","scaleY"],wp=["angle"],Cp=new re,Ep={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Bp extends Oc{static mixin(t){const e=Object.keys(t);for(let i=0;i10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=cu[t];if(e)return e;if(e=Bp.userSymbolMap[t],e)return e;if(!0===((i=t=du[t]||t).startsWith("{const e=(new Wl).fromString(t.d),i={};$u.forEach((e=>{t[e]&&(i[Yu[e]]=t[e])})),n.push({path:e,attribute:i}),Sp.union(e.bounds)}));const r=Sp.width(),a=Sp.height(),o=1/Yt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new hu(t,n,!0);return Bp.userSymbolMap[t]=l,l}var i;const s=(new Wl).fromString(t),n=s.bounds.width(),r=s.bounds.height(),a=1/Yt(n,r);s.transform(0,0,a,a);const o=new hu(t,s);return Bp.userSymbolMap[t]=o,o}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,s=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:n=e.boundsPadding}=i,r=Zc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new Fo(t);return sl(e.commandList,i,0,0),!0}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(t=!0){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(t=!0){return this._transMatrix||(this._transMatrix=new We),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&Xo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&Xo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&Xo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&Xo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&Xo.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&Xo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=Xo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===Ko.GLOBAL){const i=new re(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){this.setAttributes(t,e,i),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||s)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,i){t&&((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,e=!1,i){const s=Object.keys(t);for(let e=0;e{i[e]?(o||(o={}),o[e]=t[e]):a[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(r=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==r?r:Xu;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:a,duration:l.duration,easing:l.easing}}]),o&&this.setAttributesAndPreventAnimate(o,!1,{type:qo.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t)}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:qo.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{type:qo.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(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,i;const s=this.attribute[t];return this.animates&&this.animates.size?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=s?s:null===(i=this.finalAttribute)||void 0===i?void 0:i[t]}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){const i=y(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);s.length!==this.currentStates.length&&this.useStates(s,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;this.stateSort&&(t=t.sort(this.stateSort));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|=Xo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=Xo.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=Xo.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&Xo.UPDATE_SHAPE_AND_BOUNDS)===Xo.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=Xo.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Xo.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Xo.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=Xo.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=Xo.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=Xo.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=Xo.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&Xo.UPDATE_LAYOUT)}getAnchor(t,e,i){const s=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=$l.x,y:e=$l.y,scaleX:i=$l.scaleX,scaleY:s=$l.scaleY,angle:n=$l.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(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=Gt(a),f=Xt(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const _=m-i,y=v-s,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,A=d*g-h*f;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*A,t.e=u+l*m+c*v-b*_-S*y,t.f=p+h*m+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,!0),Ao.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY($l);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Ap.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.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:qo.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Ao.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),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 Wl).fromString(t):this.pathProxy=new Wl,this.pathProxy}loadImage(t,e=!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(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",this.stopAnimates(),Ao.graphicService.onRelease(this),super.release()}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new jc(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)}}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||Ao.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new op(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}var Pp;Bp.userSymbolMap={},Bp.mixin(Uc),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Pp||(Pp={}));let Lp=class t extends Bp{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Iu,this._childUpdateTag=Xo.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 Bc),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Bc)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===Ko.GLOBAL){const i=new re(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&Xo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=$l.x,y:e=$l.y,dx:i=$l.dx,dy:s=$l.dy,scaleX:n=$l.scaleX,scaleY:r=$l.scaleY,angle:a=$l.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()}getGraphicTheme(){return Lc(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return Ao.graphicService.updateTempAABBBounds(i),Ao.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=Xo.CLEAR_BOUNDS,this._childUpdateTag&=Xo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=Xo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&Xo.UPDATE_BOUNDS||(this._childUpdateTag|=Xo.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(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().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),this.getGraphicService().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(t=!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&Xo.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=Ao.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}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}};function Rp(t){return new Lp(t)}Lp.NOWORK_ANIMATE_ATTR=Ep;class Op extends Lp{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 Bc,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!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=>{Ao.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=>{Ao.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 Ip=Symbol.for("TransformUtil"),Dp=Symbol.for("GraphicUtil"),Fp=Symbol.for("LayerService"),zp=Symbol.for("StaticLayerHandlerContribution"),jp=Symbol.for("DynamicLayerHandlerContribution"),Hp=Symbol.for("VirtualLayerHandlerContribution");var Np,Vp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)};let Wp=Np=class{static GenerateLayerId(){return`${Np.idprefix}_${Np.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Ao.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?xo.get(zp):"dynamic"===t?xo.get(jp):xo.get(Hp),e}createLayer(t,e={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 Op(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Np.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)}};Wp.idprefix="visactor_layer",Wp.prefix_count=0,Wp=Np=Vp([qa(),Up("design:paramtypes",[])],Wp);var Gp=new Fa((t=>{t(bo).to(Po).inSingletonScope(),t(mc).to(_c),t(Dp).to(Sc).inSingletonScope(),t(Ip).to(Mc).inSingletonScope(),t(Fp).to(Wp).inSingletonScope()}));function Yp(t,e){return!(!t&&!e)}function $p(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Xp(t,e,i){return i&&t*e>0}function Kp(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function qp(t,e){return t*e>0}function Zp(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Jp(t,e,i,s,n,r,a){const o=t-i,l=e-s,h=(a?r:-r)/Math.sqrt(o*o+l*l),c=h*l,d=-h*o,u=t+c,p=e+d,g=i+c,f=s+d,m=(u+g)/2,v=(p+f)/2,_=g-u,y=f-p,b=_*_+y*y,x=n-r,S=u*f-g*p,A=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let k=(S*y-_*A)/b,M=(-S*_-y*A)/b;const T=(S*y+_*A)/b,w=(-S*_+y*A)/b,C=k-m,E=M-v,B=T-m,P=w-v;return C*C+E*E>B*B+P*P&&(k=T,M=w),{cx:k,cy:M,x01:-c,y01:-d,x11:k*(n/x-1),y11:M*(n/x-1)}}function Qp(t,e,i,s,n){const r=Ut(i-e),a=t.getParsedCornerRadius(),o=y(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,_=Math.max(f,g),b=Math.max(m,v);let x=_,S=b;const A=n*Gt(c),k=n*Xt(c),M=s*Gt(u),T=s*Xt(u);let w,C,E,B;if((b>zt||_>zt)&&(w=n*Gt(d),C=n*Xt(d),E=s*Gt(p),B=s*Xt(p),r1?0:P<-1?jt:Math.acos(P))/2),l=Kt(t[0]*t[0]+t[1]*t[1]);S=$t(b,(s-l)/(o-1)),x=$t(_,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:E,yirs:B,xore:w,yore:C,xire:M,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:_,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function tg(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ut(l-o),c=l>o;let d=!1;if(n=Vt-zt)e.moveTo(i+n*Gt(o),s+n*Xt(o)),e.arc(i,s,n,o,l,!c),r>zt&&(e.moveTo(i+r*Gt(l),s+r*Xt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:M,limitedIcr:T,innerDeltaAngle:w,innerEndAngle:C,innerStartAngle:E,innerCornerRadiusStart:B,innerCornerRadiusEnd:P,maxInnerCornerRadius:L}=Qp(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>zt){const t=$t(v,m),r=$t(_,m),o=Jp(g,f,u,p,n,t,Number(c)),l=Jp(b,x,S,A,n,r,Number(c));m0&&e.arc(i+o.cx,s+o.cy,t,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,n,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Gt(Wt(l.y01,l.x01)),s+l.cy+r*Xt(Wt(l.y01,l.x01))):e.moveTo(i+b,s+n*Xt(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,M,!c)):e.moveTo(i+n*Gt(M),s+n*Xt(M));if(!(r>zt)||w<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(T>zt){const t=$t(B,T),n=$t(P,T),o=Jp(S,A,b,x,r,-n,Number(c)),l=Jp(u,p,g,f,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,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,r,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Gt(Wt(l.y01,l.x01)),s+l.cy+t*Xt(Wt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),!a||a[2]?e.arc(i,s,r,C,E,c):e.moveTo(i+r*Gt(E),s+r*Xt(E))}return a?a[3]&&e.lineTo(i+n*Gt(o),s+n*Xt(o)):e.closePath(),d}const eg=Symbol.for("ArcRenderContribution"),ig=Symbol.for("AreaRenderContribution"),sg=Symbol.for("CircleRenderContribution"),ng=Symbol.for("GroupRenderContribution"),rg=Symbol.for("ImageRenderContribution"),ag=Symbol.for("PathRenderContribution"),og=Symbol.for("PolygonRenderContribution"),lg=Symbol.for("RectRenderContribution"),hg=Symbol.for("SymbolRenderContribution"),cg=Symbol.for("TextRenderContribution"),dg=Symbol.for("InteractiveSubRenderContribution");function ug(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function pg(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}var gg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mg=function(t,e){return function(i,s){e(i,s,t)}};function vg(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:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:v}=e.attribute,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(s=m[2])&&void 0!==s?s:0}if(Ku(t),qu(t,t,[n+o,r+l,a+h]),qu(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),qu(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]),f){const i=ip.allocate(),s=[0,0];if(v){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=m[1]}qu(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,f),qu(i,i,[-s[0],-s[1],0]),Ju(t,t,i)}}let _g=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new _o(["graphic"]),onSetStage:new _o(["graphic","stage"]),onRemove:new _o(["graphic"]),onRelease:new _o(["graphic"]),onAddIncremental:new _o(["graphic","group","stage"]),onClearIncremental:new _o(["graphic","group","stage"]),beforeUpdateAABBBounds:new _o(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new _o(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new _o(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ve,this.tempAABBBounds2=new Ve}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)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new Fo(t);return sl(i.commandList,s,0,0),!0}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=pg(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=ug(n,e);i.set(s,i.y1,s+e,i.y2)}}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){Au(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;Au(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&&He(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};_g=gg([qa(),mg(0,Xa(Gu)),fg("design:paramtypes",[Object])],_g);const yg=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},bg=["radius","startAngle","endAngle",...kp];class xg extends Bp{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=Ru}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)}getGraphicTheme(){return Lc(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Ao.graphicService.updateTempAABBBounds(i);return yg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Vt-zt?i.set(-r,-r,r,r):td(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,bg)}needUpdateTag(t){return super.needUpdateTag(t,bg)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Wl,s.arc(0,0,r,a,o),s}clone(){return new xg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return xg.NOWORK_ANIMATE_ATTR}}function Sg(t){return new xg(t)}xg.NOWORK_ANIMATE_ATTR=Ep;class Ag{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Lo.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,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;a{t+=e.str})),(Array.isArray(r)?r.join(""):r).toString()!==t}return"vertical"===s.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==s.text.toString():null!=this.clipedText&&this.clipedText!==s.text.toString()}get multilineLayout(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=Uu,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}getGraphicTheme(){return Lc(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new Mg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Te(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=Ao.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Au(n,o/Math.abs(r+a),!0,l),i.union(n)}return Ao.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Ao.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,He(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:_=s.ignoreBuf,keepCenterInLine:y=s.keepCenterInLine}=n,b=_?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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(f/2),this._AABBBounds}const S=Ao.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new Ag(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:y}),{bbox:k}=A;return this.cache.layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{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,measureMode:v=r.measureMode,suffixPosition:_=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),k=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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 M=Ao.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),T={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:k},w=new Ag(a,T,M),C=y(t)?t.map((t=>t.toString())):[t.toString()],E=[],B=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/k),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),B[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const t=ug(_,a),e=this.cache.verticalList.length*v,i=pg(y,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>function(t){const e=[];let i=0,s="";for(let n=0;n{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===Tu.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))})),this.cache.verticalList=b,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const x=ug(_,a),S=this.cache.verticalList.length*v,A=pg(y,S,d);return this._AABBBounds.set(A,x,A+S,x+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=ad(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=kg){return super.needUpdateTags(t,e)}needUpdateTag(t,e=kg){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new Mg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Mg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return Mg.baselineMapAlign}getAlignMapBaseline(){return Mg.alignMapBaseline}}function Tg(t){return new Mg(t)}Mg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Ep),Mg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},Mg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const wg=["symbolType","size",...kp];let Cg=class t extends Bp{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=Vu}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}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{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return Lc(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Ao.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Au(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(y(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){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,wg)}needUpdateTag(t){return super.needUpdateTag(t,wg)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new Wl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Wl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Eg(t){return new Cg(t)}Cg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Ep);const Bg=["segments","points","curveType","curveTension",...kp];let Pg=class t extends Bp{constructor(t={}){super(t),this.type="line",this.numberType=Fu}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=id(i,s,e))}getGraphicTheme(){return Lc(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),Ao.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Bg)}needUpdateTag(t){return super.needUpdateTag(t,Bg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Wl;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Lg(t){return new Pg(t)}Pg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ep);const Rg=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}},Og=["width","x1","y1","height","cornerRadius",...kp];class Ig extends Bp{constructor(t){super(t),this.type="rect",this.numberType=Hu}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Lc(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=Ao.graphicService.updateTempAABBBounds(i);return yg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Og)}needUpdateTag(t){return super.needUpdateTag(t,Og)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=Rg(e);return t=new Wl,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new Ig(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ig.NOWORK_ANIMATE_ATTR}}function Dg(t){return new Ig(t)}Ig.NOWORK_ANIMATE_ATTR=Ep;class Fg extends Bp{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,e=!1,i){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}getGraphicTheme(){return Lc(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}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(),this.stateSort&&(t=t.sort(this.stateSort));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.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Fg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Fg.NOWORK_ANIMATE_ATTR}}function zg(t){return new Fg(t)}Fg.NOWORK_ANIMATE_ATTR=Ep;class jg{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=bh[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}}}function Hg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Ng{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=ad(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Bh(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||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,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r: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}=Bh(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=wh(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Bh(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=Hg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=wh(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Bh(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&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=wh(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Bh(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const Vg=["width","height","image",...kp];class Ug extends Bp{constructor(t){super(t),this.type="image",this.numberType=Du,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}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()})),this.addUpdateBoundTag()}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)}getGraphicTheme(){return Lc(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=Ao.graphicService.updateTempAABBBounds(i);return yg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return gh[t]}needUpdateTags(t){return super.needUpdateTags(t,Vg)}needUpdateTag(t){return super.needUpdateTag(t,Vg)}clone(){return new Ug(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ug.NOWORK_ANIMATE_ATTR}}function Wg(t){return new Ug(t)}Ug.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Ep);class Gg extends Ug{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=Zc(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=Zc(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=gh.width,height:e=gh.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 Yg{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 Gg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=bh[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Ng){const e=Mh.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,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Gg)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Bh(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Gg)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Gg)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||Sh;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,Th(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||xh;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?yh(t,s,{AABBBounds:i}):s,Th(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Gg)break;const{width:n}=Bh(t,s.character,s.ascentDescentMode),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.forEach(((t,e)=>{i+=t instanceof Gg?t.width:t.getWidthWithEllips(this.direction)})),i}}class $g{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=bh[this.direction]}store(t){if(t instanceof Gg){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 Yg(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,e=!1){t instanceof Gg?"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||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=wh(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Ng(i,t.newLine,t.character,t.ascentDescentMode),new Ng(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Xg=!1;try{Xg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Xg=!1}const Kg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...kp];class qg extends Bp{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Nu,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:ph.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:ph.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:ph.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:ph.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:ph.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:ph.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:ph.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:ph.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Lc(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&_(t.text)&&qg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&_(t.text)&&qg.splitText(t.text).length>1)))}static splitText(t){if(Xg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=qg.splitText(t.text.toString());if(_(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),Ao.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Ao.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Kg)}needUpdateTag(t){return super.needUpdateTag(t,Kg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!qg.AllSingleCharacter(_)&&(_=qg.TransformTextConfig2SingleCharacter(_),this.attribute.textConfig=_);const y=[],b=null!=t?t:_;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,y.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),M="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),T=new jg(0,0,(k?n:x?i:0)||0,(M?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&x,!M&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),w=new $g(T);if(w.newLine=v,p){let t=0,e=!1;for(let i=0;i{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new qg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(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())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return qg.NOWORK_ANIMATE_ATTR}}function Zg(t){return new qg(t)}qg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Ep);const Jg=["path","customPath",...kp];class Qg extends Bp{constructor(t){super(t),this.type="path",this.numberType=zu}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=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Wl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Wl?this.cache:t.path)}getGraphicTheme(){return Lc(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=Ao.graphicService.updateTempAABBBounds(i);yg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new Wl).fromString(t.path):t.customPath&&(this.cache=new Wl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,Jg)}needUpdateTag(t){return super.needUpdateTag(t,Jg)}toCustomPath(){return(new Wl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Qg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Qg.NOWORK_ANIMATE_ATTR}}function tf(t){return new Qg(t)}Qg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Ep);const ef=["segments","points","curveType","curveTension",...kp];class sf extends Bp{constructor(t){super(t),this.type="area",this.numberType=Lu}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}getGraphicTheme(){return Lc(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),Ao.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),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}_interpolate(t,e,i,s,n){"points"===t&&(n.points=id(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,ef)}needUpdateTag(t){return super.needUpdateTag(t,ef)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Wl;const 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 sf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return sf.NOWORK_ANIMATE_ATTR}}function nf(t){return new sf(t)}sf.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ep);const rf=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...kp];class af extends Bp{constructor(t){super(t),this.type="arc",this.numberType=Bu}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=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(y(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();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=he(e),i=e+r,s&&Ut(r)zt&&o>zt)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=this.getGraphicTheme(),{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=Kt(a*a+o*o)}=this.attribute,h=Ut(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>zt&&l>zt){const i=e>t?1:-1;let s=Zt(Number(l)/o*Xt(g)),n=Zt(Number(l)/a*Xt(g));return(f-=2*s)>zt?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>zt?(n*=i,c+=n,d-=n):(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}}getGraphicTheme(){return Lc(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Ao.graphicService.updateTempAABBBounds(i);yg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=zt?i.set(0,0,0,0):Math.abs(o-l)>Vt-zt?i.set(-s,-s,s,s):(td(l,o,s,i),td(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,rf)}needUpdateTag(t){return super.needUpdateTag(t,rf)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Ut(o-a),d=o>a;if(h=Vt-zt)n.moveTo(0+h*Gt(a),0+h*Xt(a)),n.arc(0,0,h,a,o,!d),l>zt&&(n.moveTo(0+l*Gt(o),0+l*Xt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Gt(a),e=h*Xt(a),i=l*Gt(o),s=l*Xt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new af(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return af.NOWORK_ANIMATE_ATTR}}function of(t){return new af(t)}af.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Ep);const lf=["points","cornerRadius",...kp];class hf extends Bp{constructor(t){super(t),this.type="polygon",this.numberType=ju}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Lc(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),Ao.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=id(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,lf)}needUpdateTag(t){return super.needUpdateTag(t,lf)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Wl,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new hf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return hf.NOWORK_ANIMATE_ATTR}}function cf(t){return new hf(t)}hf.NOWORK_ANIMATE_ATTR=Ep;class df extends Lp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!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 uf(t){return new df(t)}const pf=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 gf,ff;function mf(t){return gf||(gf=pf.CreateGraphic("text",{})),gf.initAttributes(t),gf.AABBBounds}var vf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},yf=function(t,e){return function(i,s){e(i,s,t)}};class bf{constructor(){this.time=Qo.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:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit,backgroundKeepAspectRatio:y=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip}=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=Lc(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:_,backgroundKeepAspectRatio:y,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s){const{backgroundMode:n,backgroundFit:r,backgroundKeepAspectRatio:a,backgroundScale:o=1,backgroundOffsetX:l=0,backgroundOffsetY:h=0}=s,c=i.width(),d=i.height();let u=c,p=d;if("no-repeat"===n)if(r)if(a){const s=Math.max(c/e.width,d/e.height);t.drawImage(e,i.x1+l,i.y1+h,e.width*s*o,e.height*s*o)}else t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const s=e.width*o,n=e.height*o;t.drawImage(e,i.x1+l,i.y1+h,s,n)}else{if(r&&"repeat"!==n&&(e.width||e.height)){const i=e.width,s=e.height;"repeat-x"===n?(u=i*(d/s),p=d):"repeat-y"===n&&(p=s*(c/i),u=c);const r=t.dpr,a=pc.allocate({width:u,height:p,dpr:r}),o=a.getContext("2d");o&&(o.inuse=!0,o.clearMatrix(),o.setTransformForCurrent(!0),o.clearRect(0,0,u,p),o.drawImage(e,0,0,u,p),e=a.nativeCanvas),pc.free(a)}const s=t.dpr,a=t.createPattern(e,n);a.setTransform&&a.setTransform(new DOMMatrix([1/s,0,0,1/s,0,0])),t.fillStyle=a,t.translate(i.x1,i.y1),t.fillRect(0,0,c,d),t.translate(-i.x1,-i.y1)}}}const xf=new bf;let Sf=class{constructor(t){this.subRenderContribitions=t,this.time=Qo.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)}))}};Sf=vf([qa(),yf(0,Xa(po)),yf(0,Za(dg)),_f("design:paramtypes",[Object])],Sf);const Af=new class{constructor(){this.time=Qo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),_=t.AABBBounds,y=null!==(p=t.attribute.width)&&void 0!==p?p:_.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:_.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[y,b],i+y/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const kf=new class{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}};class Mf{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=pc.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])),pc.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,Vt),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:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h;const{textureRatio:c=r.textureRatio,textureOptions:d=null}=e.attribute;let u=this.textureMap.get(t);if(!u)switch(t){case"circle":u=this.createCirclePattern(o,l,a,i);break;case"diamond":u=this.createDiamondPattern(o,l,a,i);break;case"rect":u=this.createRectPattern(o,l,a,i);break;case"vertical-line":u=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":u=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":u=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":u=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":u=this.createGridPattern(o,l,a,i)}if(d&&d.dynamicTexture){const{gridConfig:u={},useNewCanvas:p}=d,g=e.AABBBounds;s=g.x1,n=g.y1;const f=i;let m;if(p){m=pc.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=m.getContext("2d");t.clearRect(0,0,g.width(),g.height()),s=0,n=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,s,n,r),f.clip();const v=g.width(),_=g.height(),y=l,b=o,x=u.columns?u.columns:Math.ceil(v/b),S=u.rows?u.rows:Math.ceil(_/b),A=u.gutterColumn?u.gutterColumn:2*y,k=u.gutterRow?u.gutterRow:2*y;this._tempSymbolGraphic||(this._tempSymbolGraphic=Eg({}));const M=u.columns?v/u.columns:b,T=u.rows?_/u.rows:b;this._tempSymbolGraphic.setAttributes({size:[M-A,T-k],symbolType:t});const w=this._tempSymbolGraphic.getParsedPath();for(let t=0;t{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:_h(e,o,e.dpr),c=o/w,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:w+u*h,innerRadius:T-u*h,startAngle:_-u*c,endAngle:y+u*c}),e.beginPath(),tg(t,e,i,s,w+u*h,T-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/A,(S-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder"),t.setAttributes({outerRadius:w,innerRadius:T,startAngle:_,endAngle:y})}},Cf=Tf,Ef=xf;const Bf=new class{constructor(){this.time=Qo.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,f=p&&!1!==p.visible;if(!g&&!f)return;const{radius:m=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,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:_h(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),f&&M(p,"innerBorder")}},Pf=Tf,Lf=xf;const Rf=new class extends bf{constructor(){super(...arguments),this.time=Qo.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,backgroundKeepAspectRatio:f=l.backgroundKeepAspectRatio,backgroundScale:m=l.backgroundScale,backgroundOffsetX:v=l.backgroundOffsetX,backgroundOffsetY:_=l.backgroundOffsetY}=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,{backgroundMode:p,backgroundFit:g,backgroundKeepAspectRatio:f,backgroundScale:m,backgroundOffsetX:v,backgroundOffsetY:_}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Of=jt/2;function If(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=Ut(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Ut(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Ut(t[0]),i=Ut(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Ut(l[0]),l[1]=Ut(l[1]),l[2]=Ut(l[2]),l[3]=Ut(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],_=[c[0],c[1]+g[1]],y=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],x=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!q(v,_)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Of,0,!1)}if(o&&o[1]?o[1](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(y,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Of,!1)}if(o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),!q(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Of,jt,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],jt,jt+Of,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}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};class Ff{constructor(){this.time=Qo.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,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:M,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:w,height:C}=t.attribute;w=(null!=w?w:k-i)||0,C=(null!=C?C:M-s)||0;const E=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=T?h:_h(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||y(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,w-o*g,C-o*g)):(e.beginPath(),If(e,u,p,w-o*g,C-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&E(u,"outerBorder"),f&&E(p,"innerBorder")}}let zf=class{constructor(){this.time=Qo.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)}};zf=Df([qa()],zf);let jf=class{constructor(){this.time=Qo.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:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:_=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||y(v)&&v.every((t=>0===t)))){let n,r=0;return If(e,i,s,b,x,v,"bevel"!==_,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};jf=Df([qa()],jf);const Hf=new Ff,Nf=Tf,Vf=xf;const Uf=new class extends Ff{constructor(){super(...arguments),this.time=Qo.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)}},Wf=xf;const Gf=new class{constructor(){this.time=Qo.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,f=p&&!1!==p.visible,m=g&&!1!==g.visible;if(!f&&!m)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,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,k=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:_h(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(y-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}},Yf=new class{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:_=l.scaleX,scaleY:y=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/_,(f-s)/y,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/_,(f-s)/y,l),e.stroke())))}},$f=Tf,Xf=xf;const Kf={x:0,y:0,z:0,lastModelMatrix:null};class qf{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(Af),this.builtinContributions.push(kf),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===Qo.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Qo.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}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)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Lc(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,_=Xp(d,u,h),y=qp(d,g),b=Yp(h),x=$p(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(_||y||a||o))return!0;e.beginPath();return sl(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),!0}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=Xp(o,l,n),p=qp(o,c),g=Yp(n,r),f=$p(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){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;Kf.x=n,Kf.y=r,Kf.z=a,Kf.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=ip.allocate(),n=ip.allocate();vg(n,t,e),Ju(s,d||s,n),Kf.x=0,Kf.y=0,Kf.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),ip.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Kf.x+=s.x,Kf.y+=s.y,Kf.z=a,i.setTransformForCurrent()}else if(p)Kf.x=0,Kf.y=0,Kf.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Kf.x+=s.x,Kf.y+=s.y,this.transformWithoutTranslate(i,Kf.x,Kf.y,Kf.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Kf.x=0,Kf.y=0,Kf.z=0;return Kf}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,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,_=(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,f,m,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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&ip.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}var Zf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qf=function(t,e){return function(i,s){e(i,s,t)}};let tm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Bu,this.builtinContributions=[wf,Ef,Cf],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=d>c;let p=!1;if(nzt){const t=$t(b,y),r=$t(x,y),a=Jp(v,_,f,m,n,t,Number(u)),o=Jp(A,k,M,T,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,Wt(o.y11,o.x11),Wt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>zt)||C<.001)e.lineTo(i+M,s+T),p=!0;else if(w>zt){const t=$t(B,w),n=$t(P,w),a=Jp(M,T,A,k,r,-n,Number(u)),o=Jp(f,m,v,_,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),w0&&e.arc(i+a.cx,s+a.cy,n,Wt(a.y01,a.x01),Wt(a.y11,a.x11),!u);const t=Wt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Gt(E),s+r*Xt(E));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Lc(t,null==r?void 0:r.theme).arc;const{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:k=l.outerRadius,innerRadius:M=l.innerRadius}=t.attribute;k+=b,M-=x;let T=0;const w=(c(S)&&S||S[0])&&"conical"===h.gradient;if(w){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Ut(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((_||E)&&(e.beginPath(),tg(t,e,i,s,k,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),g?(this._runStroke(t,e,i,s,l,y,E,v,o),this._runFill(t,e,i,s,l,_,m,u,p,a)):(this._runFill(t,e,i,s,l,_,m,u,p,a),this._runStroke(t,e,i,s,l,y,E,v,o))),!E&&y&&(e.beginPath(),tg(t,e,i,s,k,M,B),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(c(S)&&S||S[1])&&A){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Ut(h-r)>=Vt-zt){e.beginPath();const r=Math.abs(k-M)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,M,d,d+r),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o);const u=()=>{if(_){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+=Vt;for(;i>Vt;)i-=Vt;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),pp(o.color,l.color,h,!1)}(0,0,h,n);a||Xp&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}},p=()=>{y&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};u(),p()}}this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),w&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}};tm=Zf([qa(),Qf(0,Xa(po)),Qf(0,Za(eg)),Jf("design:paramtypes",[Object])],tm);var em=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},im=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sm=function(t,e){return function(i,s){e(i,s,t)}};let nm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ru,this.builtinContributions=[Bf,Lf,Pf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Lc(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,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f;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,_,y,m,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{y&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o)}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function rm(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]=cl(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 am(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function om(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=am(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),rm(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=Zo.ROW:"y"===s?u=Zo.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.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 hm=class extends qf{constructor(){super(...arguments),this.numberType=Fu}draw(t,e,i,s){const n=Lc(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 f;if(!e)return;t.beginPath();om(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),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:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!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:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===_)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=Ul(x(t.points,v),_,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===_){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===y){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],y,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=y*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],$t(_,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,y,b,i,s,t,a,o)}};function cm(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),rm(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),rm(t,l,1,s),o=!1):o=!0}t.closePath()}hm=lm([qa()],hm);const dm=new class extends Mf{constructor(){super(...arguments),this.time=Qo.afterFillStroke}drawShape(t,e,i,s,n,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:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:sd(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:sd(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:sd(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:sd(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},um=xf;var pm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fm=function(t,e){return function(i,s){e(i,s,t)}};let mm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Lu,this.builtinContributions=[dm,um],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,_=m[0];e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const i=m[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,v)}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:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(y(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Lc(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:M=g.clipRange,closePath:T,points:w,segments:C}=t.attribute;let{curveType:E=g.curveType}=t.attribute;function B(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===E&&(E="linearClosed"),1===M&&!C&&!w.some((t=>!1===t.defined))&&"linear"===E)return this.drawLinearAreaHighPerformance(t,e,!!f,k,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(C&&C.length){let e,i;const s=C.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=Ul(B(t.points,x),E,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=C.length-1;t>=0;t--){const e=C[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=C[t-1].points,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=Ul(B(i,x),"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!w||!w.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=B(w,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Ul(e,E,{curveTension:b}),n=Ul(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===M){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,y,r[c],[g,t.attribute],M,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=M*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,A,v,k,y,r[u],[g,t.attribute],$t(f,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,y,t.attribute,g,M,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Lc(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,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let _,b,x=Zo.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],_=t.points[t.points.length-1]}else b=m[0],_=m[m.length-1];const S=Ut(_.x-b.x),A=Ut(_.y-b.y);x=null==_.x1?Zo.ROW:null==_.y1?Zo.COLUMN:Number.isFinite(S+A)?S>A?Zo.ROW:Zo.COLUMN:Zo.ROW,function(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?Zo.ROW:Zo.COLUMN,Number.isFinite(c)||(o=Zo.COLUMN),Number.isFinite(d)||(o=Zo.ROW);const u=i*(o===Zo.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;y(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),om(t,i[0]?e.top:e.bottom,l,x===Zo.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,M-c,o),t.stroke()}})(),!1}};mm=pm([qa(),fm(0,Xa(po)),fm(0,Za(ig)),gm("design:paramtypes",[Object])],mm);const vm=Tf,_m=xf;var ym=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xm=function(t,e){return function(i,s){e(i,s,t)}};let Sm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=zu,this.builtinContributions=[_m,vm],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:Lc(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:_,doFill:y,doStroke:b}=m;if(e.beginPath(),t.pathShape)sl(t.pathShape.commandList,e,i,s,1,1,f);else{sl((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,y,b,v,_,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):_&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{y&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,y,b,v,_,d,n,a,o)}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Sm=ym([qa(),xm(0,Xa(po)),xm(0,Za(ag)),bm("design:paramtypes",[Object])],Sm);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)}};let Tm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=Hu,this.builtinContributions=[Hf,Vf,Nf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Lc(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:_=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:M=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:w}=t.attribute;T=(null!=T?T:b-S)||0,w=(null!=w?w:x-A)||0;const C=Kp(g,f,T,w,h),E=Zp(g,v,T,w,M),B=Yp(h,c),P=$p(d,m);if(!t.valid||!_)return;if(!B&&!P)return;if(!(C||E||a||o||c))return;0===u||y(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,T,w)):(e.beginPath(),If(e,i,s,T,w,u,"bevel"!==p));const L={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,B,P,C,E,l,n,a,o,L),k?(this._runStroke(t,e,i,s,l,L,E,S,A,o),this._runFill(t,e,i,s,l,L,C,S,A,a)):(this._runFill(t,e,i,s,l,L,C,S,A,a),this._runStroke(t,e,i,s,l,L,E,S,A,o)),this.afterRenderStep(t,e,i,s,B,P,C,E,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}};Tm=Am([qa(),Mm(0,Xa(po)),Mm(0,Za(lg)),km("design:paramtypes",[Object])],Tm);var wm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Em=function(t,e){return function(i,s){e(i,s,t)}};let Bm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Vu,this.builtinContributions=[Gf,Xf,$f,Yf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:Lc(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,M=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,w=s,C=M;const E=e.camera;if(k&&E&&e.project){const t=e.project(i,s,M);e.camera=null,y(c)&&(c[0],c[1]),T=t.x,w=t.y,C=void 0}!1===A.draw(e,c,T,w,C,((n,r)=>{var h,c,v,_;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(_=r.lineWidth)&&void 0!==_?_:t.attribute.lineWidth,r=e}const y=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),y()):(y(),x())}))&&e.closePath(),e.camera=E,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,_,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,_,d,u,A,a)):(this._runFill(t,e,i,s,l,x,_,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,_,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Bm=wm([qa(),Em(0,Xa(po)),Em(0,Za(hg)),Cm("design:paramtypes",[Object])],Bm);const Pm=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ve)}allocate(t,e,i,s){if(!this.pools.length)return(new Ve).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 Ve(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(...t){this.pools=[]}};const Lm=new class extends bf{constructor(){super(...arguments),this.time=Qo.beforeFillStroke}drawShape(t,e,i,s,n,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,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio}=t.attribute;let T,{background:w}=t.attribute;if(!w)return;const C=()=>{"richtext"===t.type&&(e.restore(),e.save(),T&&e.setTransformFromMatrix(T,!0,1))};let E;"richtext"===t.type&&(T=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const B=g(w)&&w.background,P=t.transMatrix.onlyTranslate();if(B){const e=t.AABBBounds,i=(null!==(u=w.x)&&void 0!==u?u:e.x1)+(null!==(p=w.dx)&&void 0!==p?p:0),s=(null!==(f=w.y)&&void 0!==f?f:e.y1)+(null!==(m=w.dy)&&void 0!==m?m:0),n=null!==(v=w.width)&&void 0!==v?v:e.width(),r=null!==(_=w.height)&&void 0!==_?_:e.height();if(E=Pm.allocate(i,s,i+n,s+r),w=w.background,!P){const t=E.width(),e=E.height();E.set((null!==(y=w.x)&&void 0!==y?y:0)+(null!==(b=w.dx)&&void 0!==b?b:0),(null!==(x=w.y)&&void 0!==x?x:0)+(null!==(S=w.dy)&&void 0!==S?S:0),t,e)}}else E=t.AABBBounds,P||(E=mf(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(w);if("success"!==n.state||!n.data)return void C();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,E,{backgroundMode:A,backgroundFit:k,backgroundKeepAspectRatio:M}),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=w,n?(If(e,E.x1,E.y1,E.width(),E.height(),n,!0),e.fill()):e.fillRect(E.x1,E.y1,E.width(),E.height()),e.highPerformanceRestore()}B&&Pm.free(E),C()}};var Rm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Om=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Im=function(t,e){return function(i,s){e(i,s,t)}};let Dm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Uu,this.builtinContributions=[Lm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Lc(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,fontSize:v=d.fontSize,verticalMode:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute,x=null!==(l=ad(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:M,doStroke:T}=S,w=!f,C=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,M,T,A,k,d,n,a,o),w&&this.transformUseContext2d(t,d,C,e);const E=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=ep.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),ep.free(t)}T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,C))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,C))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,C),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,C)})))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,C),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,C,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!_){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Yt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;E(i,a-(e+1)*x+u,r,n),r+=s}))}))}w&&this.restoreTransformUseContext2d(t,d,C,e),this.afterRenderStep(t,e,i,s,M,T,A,k,d,n,a,o)}draw(t,e,i,s){const n=Lc(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,l,h,c){if(e+t<=0)return;const{textAlign:d=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,_=!u(c),y=_?c.width:i.clipedWidth,b=_?0:ug(d,y),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+y,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+y,t,o),h.stroke()}}};function Fm(t,e,i,s){if(e&&e.length){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},Um=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wm=function(t,e){return function(i,s){e(i,s,t)}};let Gm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ju,this.builtinContributions=[Nm,Hm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Lc(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,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:b}=f;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?Fm(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Fm(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,f=(Math.atan2(u,d)-Math.atan2(g,p))/2,m=Math.abs(Math.tan(f));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,_=v/m;const y=zm(d,u),b=zm(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*m);const S=jm(h,_,y,d,u),A=jm(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=zm(k,M),w=jm(h,zm(_,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 B=E-C;B<0&&(C=E,B=-B),B>Math.PI&&(B-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),B&&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,_,b,m,v,l,n,a,o);const x=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,_,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Gm=Vm([qa(),Wm(0,Xa(po)),Wm(0,Za(og)),Um("design:paramtypes",[Object])],Gm);var Ym=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Xm=function(t,e){return function(i,s){e(i,s,t)}};let Km=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Iu}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Rf)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:Lc(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:M=l.x,y:T=l.y}=t.attribute,w=Kp(p,m,g,f,c),C=Zp(p,v,g,f),E=Yp(c,u),B=$p(d,x);if(!t.valid||!S)return;if(!h){if(!E&&!B)return;if(!(w||C||a||o||u))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,g,f)):(e.beginPath(),If(e,i,s,g,f,_,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Rf));const P={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===Qo.beforeFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o,P)})),h&&e.clip();const L=()=>{P.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,M-i,T-s,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,M-i,T-s,l),e.stroke()))};A?(R(),L()):(L(),R()),this._groupRenderContribitions.forEach((r=>{r.time===Qo.afterFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=Ao.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=Lc(t,null==s?void 0:s.theme).group,i=ip.allocate(),n=ip.allocate();vg(n,t,e),Ju(i,p||i,n),a.modelMatrix=i,ip.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&ip.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}};Km=Ym([qa(),Xm(0,Xa(po)),Xm(0,Za(ng)),$m("design:paramtypes",[Object])],Km);var qm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jm=function(t,e){return function(i,s){e(i,s,t)}};const Qm=["","repeat-x","repeat-y","repeat"];let tv=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Du,this.builtinContributions=[Uf,Wf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Lc(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,image:m}=t.attribute,v=this.valid(t,l,a);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v;if(!m||!t.resources)return;const A=t.resources.get(m);if("success"!==A.state)return;const k=t.width,M=t.height;e.beginPath();let T=!1;0===p||y(p)&&p.every((t=>0===t))?e.rect(i,s,k,M):(If(e,i,s,k,M,p,"bevel"!==f),T=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const w=()=>{if(x)if(a)a(e,t.attribute,l);else if(_){e.setCommonStyle(t,t.attribute,i,s,l);let n=0;if("repeat"===h&&(n|=1),"repeat"===c&&(n|=2),n){const t=e.createPattern(A.data,Qm[n]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,k,M),e.translate(-i,-s,!0)}else e.drawImage(A.data,i,s,k,M)}},C=()=>{S&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(C(),T&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),w(),T&&e.restore()):(T&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),w(),T&&e.restore(),C()),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 Yc.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Lc(t).image;this._draw(t,a,!1,i)}};tv=qm([qa(),Jm(0,Xa(po)),Jm(0,Za(rg)),Zm("design:paramtypes",[Object])],tv);const ev=Symbol.for("IncrementalDrawContribution"),iv=Symbol.for("ArcRender"),sv=Symbol.for("AreaRender"),nv=Symbol.for("CircleRender"),rv=Symbol.for("GraphicRender"),av=Symbol.for("GroupRender"),ov=Symbol.for("LineRender"),lv=Symbol.for("PathRender"),hv=Symbol.for("PolygonRender"),cv=Symbol.for("RectRender"),dv=Symbol.for("SymbolRender"),uv=Symbol.for("TextRender"),pv=Symbol.for("RichTextRender"),gv=Symbol.for("GlyphRender"),fv=Symbol.for("ImageRender"),mv=Symbol.for("DrawContribution"),vv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Pu,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];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+=Vt;for(;o<0;)o+=Vt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};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},yv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const bv=Symbol.for("DrawItemInterceptor"),xv=new Ve,Sv=new Ve;class Av{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){xv.copy(s.dirtyBounds),Sv.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,ep.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(xv),s.backupDirtyBounds.copy(Sv)),!0}}class kv{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 Mv=class{constructor(){this.order=1,this.interceptors=[new Av,new wv,new Tv,new kv]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&ip.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Cv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},Bv=function(t,e){return function(i,s){e(i,s,t)}};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))}reInit(){this.drawContribution.reInit()}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=Cv([qa(),Bv(0,Xa(mv)),Ev("design:paramtypes",[Object])],Pv);var Lv=new Fa((t=>{t(So).to(Pv)}));const Rv=Symbol.for("PickerService"),Ov=Symbol.for("GlobalPickerService"),Iv=Symbol.for("PickItemInterceptor"),Dv=Symbol.for("PickServiceInterceptor");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};let zv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};zv=Fv([qa()],zv);let jv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Lc(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=ep.allocateByObj(a),u=new re(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};jv=Fv([qa()],jv);let Hv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new re(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}};Hv=Fv([qa()],Hv);let Nv=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){const a=vv(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};Nv=Fv([qa()],Nv);var Vv=new Fa(((t,e,i)=>{i(Rv)||(t(Ov).toSelf(),t(Rv).toService(Ov)),t(Nv).toSelf().inSingletonScope(),t(Iv).toService(Nv),t(jv).toSelf().inSingletonScope(),t(Iv).toService(jv),t(Hv).toSelf().inSingletonScope(),t(Iv).toService(Hv),fo(t,Iv),t(zv).toSelf().inSingletonScope(),t(Dv).toService(zv),fo(t,Dv)})),Uv=new Fa((t=>{t(Wu).to(_g),t(Gu).toConstantValue(pf)}));const Wv=Symbol.for("AutoEnablePlugins"),Gv=Symbol.for("PluginService");var Yv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$v=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Xv=function(t,e){return function(i,s){e(i,s,t)}};let Kv=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&&xo.isBound(Wv)&&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(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Kv=Yv([qa(),Xv(0,Xa(po)),Xv(0,Za(Wv)),$v("design:paramtypes",[Object])],Kv);var qv=new Fa((t=>{t(Gv).to(Kv),function(t,e){t(po).toDynamicValue((({container:t})=>new go(e,t))).whenTargetNamed(e)}(t,Wv)})),Zv=new Fa((t=>{fo(t,yo)})),Jv=new Fa((t=>{t(Oh).to(Ih).inSingletonScope(),fo(t,Oh)})),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.type="static",this.offscreen=!1,this.global=Ao.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=zh({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()}};e_=Qv([qa(),t_("design:paramtypes",[])],e_);var i_=new Fa((t=>{t(e_).toSelf(),t(zp).toService(e_)}));var s_=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 n_(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function r_(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=n_(t,e,s);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;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=n_(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var l_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},h_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},c_=function(t,e){return function(i,s){e(i,s,t)}};let d_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):r_(e,th.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Ne,this.backupDirtyBounds=new Ne,this.global=Ao.global,this.layerService=Ao.layerService,y(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}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){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=ye(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.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,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:th.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:th.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,ep.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=o_(e,i,th.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&&!Ae(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Pm.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=ep.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Pm.free(n),ep.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||xo.get(ev);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let p_=class extends hm{constructor(){super(...arguments),this.numberType=Fu}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=Lc(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=Xp(u,p,c),_=qp(u,g),y=Yp(c),b=$p(d,f);if(!t.valid||!m)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())}};p_=u_([qa()],p_);var g_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 f_=class extends mm{constructor(){super(...arguments),this.numberType=Lu}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=Lc(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Xp(u,d,c),f=Yp(c);if(!t.valid||!p)return;if(!f)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())}};f_=g_([qa()],f_);var m_,v_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},__=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},y_=function(t,e){return function(i,s){e(i,s,t)}},b_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(m_||(m_={}));let x_=class extends d_{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=m_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new _o([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return b_(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:th.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:th.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 b_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return b_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>b_(this,void 0,void 0,(function*(){if(2!==t.count)yield a_(t,th.zIndex,((i,s)=>{if(this.status===m_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return b_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return b_(this,void 0,void 0,(function*(){this.rendering&&(this.status=m_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=m_.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return b_(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:()=>b_(this,void 0,void 0,(function*(){yield a_(t,th.zIndex,(t=>b_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};x_=v_([qa(),y_(0,Ka(rv)),y_(1,Xa(p_)),y_(2,Xa(f_)),y_(3,Xa(po)),y_(3,Za(bv)),__("design:paramtypes",[Array,Object,Object,Object])],x_);var S_=new Fa((t=>{t(bf).toSelf().inSingletonScope(),t(Mf).toSelf().inSingletonScope(),t(mv).to(d_),t(ev).to(x_),t(av).to(Km).inSingletonScope(),t(rv).toService(av),fo(t,ng),t(Sf).toSelf().inSingletonScope(),fo(t,dg),fo(t,rv),t(Mv).toSelf().inSingletonScope(),t(bv).toService(Mv),fo(t,bv)}));function A_(){A_.__loaded||(A_.__loaded=!0,xo.load(Gp),xo.load(Uv),xo.load(Lv),xo.load(Vv),xo.load(qv),function(t){t.load(Zv),t.load(Jv),t.load(i_)}(xo),function(t){t.load(S_)}(xo))}A_.__loaded=!1,A_();const k_=xo.get(bo);Ao.global=k_;const M_=xo.get(Dp);Ao.graphicUtil=M_;const T_=xo.get(Ip);Ao.transformUtil=T_;const w_=xo.get(Wu);Ao.graphicService=w_;const C_=xo.get(Fp);Ao.layerService=C_;class E_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class B_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=Ao.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=Ao.global.getRequestAnimationFrame();this.rafId=t((()=>{Ao.global.devicePixelRatio!==this.dpr&&(this.dpr=Ao.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=Ao.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class P_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.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))})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Ao.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())}}const L_=new Ve;class R_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Da.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()}));const e=this.pluginService.stage;e&&(e.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&&(L_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(L_,t.parent&&t.parent.globalTransMatrix)))})),e.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))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let O_;function I_(){!function(){if(null==O_)try{const t=document.createElement("canvas"),e=t.getContext("2d");O_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),O_&&(O_=!!document.createElement)}catch(t){O_=!1}}();const t=Ao.global&&Ao.global.env;return t?"browser"===t:O_}let D_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};D_._pluginClasses={};const F_="white";class z_ extends Lp{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:F_}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={}){var e,i;super({}),this.tickedBeforeRender=!0,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._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Bc,this.hooks={beforeRender:new _o(["stage"]),afterRender:new _o(["stage"]),afterClearScreen:new _o(["stage"]),afterClearRect:new _o(["stage"])},this.global=Ao.global,!this.global.env&&I_()&&this.global.setEnv("browser"),this.window=xo.get(mc),this.renderService=xo.get(So),this.pluginService=xo.get(Gv),this.layerService=xo.get(Fp),this.graphicService=xo.get(Wu),this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],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:F_,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(),t.autoRefresh&&this.enableAutoRefresh(),!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),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&_(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(i=t.rafId)&&void 0!==i?i:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new Gc(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(t=!1){t&&(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:f=[1,1,-1],color:m="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);const k=D_.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const M={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]}};if(this.camera)this.camera.params=M;else{const t=D_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=D_.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}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 E_))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new B_))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new P_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Ne;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new R_,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=D_.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=D_.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=D_.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();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.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();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===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),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.dirtyBounds&&this.dirtyBounds.clear(),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,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new re(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;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.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=xo.get(mc),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=xo.get(Rv)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}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},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())}))};let N_=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ve}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}}loadFont(t,e,i){return H_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}};N_=j_([qa()],N_);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},U_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let W_=class{constructor(){this._uid=Da.GenAutoIncrementId(),this.viewBox=new Ve,this.modelMatrix=new We(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){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}};W_=V_([qa(),U_("design:paramtypes",[])],W_);var G_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Y_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$_=function(t,e){return function(i,s){e(i,s,t)}};let X_=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=Ao.global}reInit(){this._init()}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.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 Ve).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 We(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),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new re(e.x,e.y),a=Lc(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 re(e.x,e.y);l.transformPoint(a,a);const o=Lc(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&&ip.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),ep.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function K_(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 q_(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function iy(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;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}))),oy=(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]},ly=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new Ne;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 oy(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return oy(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);ly(n[0],s,i),ly(n[1],e-s,i)}};let hy=!1;const cy=new Fa((t=>{hy||(hy=!0,t(tm).toSelf().inSingletonScope(),t(iv).to(tm).inSingletonScope(),t(rv).toService(iv),t(eg).toService(Sf),fo(t,eg))}));let dy=!1;const uy=new Fa((t=>{dy||(dy=!0,t(Tm).toSelf().inSingletonScope(),t(cv).to(Tm).inSingletonScope(),t(rv).toService(cv),t(jf).toSelf(),t(zf).toSelf(),t(lg).toService(jf),t(lg).toService(zf),t(lg).toService(Sf),fo(t,lg))}));let py=!1;const gy=new Fa((t=>{py||(py=!0,t(hm).toSelf().inSingletonScope(),t(p_).toSelf().inSingletonScope(),t(ov).to(hm).inSingletonScope(),t(rv).toService(ov))}));let fy=!1;const my=new Fa((t=>{fy||(fy=!0,t(mm).toSelf().inSingletonScope(),t(sv).to(mm).inSingletonScope(),t(rv).toService(sv),t(ig).toService(Sf),fo(t,ig),t(f_).toSelf().inSingletonScope())}));let vy=!1;const _y=new Fa((t=>{vy||(vy=!0,t(Bm).toSelf().inSingletonScope(),t(dv).to(Bm).inSingletonScope(),t(rv).toService(dv),t(hg).toService(Sf),fo(t,hg))}));let yy=!1;const by=new Fa((t=>{yy||(yy=!0,t(nm).toSelf().inSingletonScope(),t(nv).to(nm).inSingletonScope(),t(rv).toService(nv),t(sg).toService(Sf),fo(t,sg))}));let xy=!1;const Sy=new Fa((t=>{xy||(xy=!0,t(uv).to(Dm).inSingletonScope(),t(rv).toService(uv),t(cg).toService(Sf),fo(t,cg))}));let Ay=!1;const ky=new Fa((t=>{Ay||(Ay=!0,t(Sm).toSelf().inSingletonScope(),t(lv).to(Sm).inSingletonScope(),t(rv).toService(lv),t(ag).toService(Sf),fo(t,ag))}));let My=!1;const Ty=new Fa((t=>{My||(My=!0,t(hv).to(Gm).inSingletonScope(),t(rv).toService(hv),t(og).toService(Sf),fo(t,og))}));var wy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Cy=class{constructor(){this.numberType=Ou}reInit(){}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=Lc(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};Cy=wy([qa()],Cy);let Ey=!1;const By=new Fa((t=>{Ey||(Ey=!0,t(gv).to(Cy).inSingletonScope(),t(rv).toService(gv))}));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},Ly=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ry=class extends qf{constructor(){super(),this.numberType=Nu,this.builtinContributions=[Lm],this.init()}drawShape(t,e,i,s,n){const r=Lc(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=Xp(o,l,!0),d=Xp(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),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=Lc(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:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),If(e,i-t,s-n,v,_,f,!0)),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=Lc(t).richtext;this._draw(t,s,!1,i)}};Ry=Py([qa(),Ly("design:paramtypes",[])],Ry);let Oy=!1;const Iy=new Fa((t=>{Oy||(Oy=!0,t(pv).to(Ry).inSingletonScope(),t(rv).toService(pv))}));let Dy=!1;const Fy=new Fa((t=>{Dy||(Dy=!0,t(fv).to(tv).inSingletonScope(),t(rv).toService(fv),t(rg).toService(Sf),fo(t,rg))}));function zy(t){const e=[];for(let i=0;i=0&&n>=0&&sot.getInstance().info(`[VChart log]: ${t}`,...e),Ny=(t,e)=>(d(Uy.warnHandler)&&Uy.warnHandler.call(null,t,e),e?ot.getInstance().warn(`[VChart warn]: ${t}`,e):ot.getInstance().warn(`[VChart warn]: ${t}`)),Vy=(t,e,i)=>{if(!d(Uy.errorHandler))throw new Error(t);Uy.errorHandler.call(null,t,e)},Uy={silent:!1,warnHandler:!1,errorHandler:!1},Wy=I_(),Gy=Wy&&globalThis?globalThis.document:void 0;function Yy(t){return("desktop-browser"===t||"mobile-browser"===t)&&Wy}function $y(t){return Xy(t)||"mobile-browser"===t}function Xy(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let Ky=0;function qy(){return Ky>=9999999&&(Ky=0),Ky++}function Zy(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function Jy(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const Qy=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class tb extends Lp{constructor(t,e){super(t),this._skipRenderAttributes=Qy,(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,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?j(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.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,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.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 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"},Cb=(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 Eb extends l{constructor(t,e={}){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.startTime=Hc.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.pressTimeout=null}),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=Hc.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||wb(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=Cb(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=Hc.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=Cb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=wb(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&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("pointerleave",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("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=Hc.now()-i>this.config.press.time&&Cb(s[0],t){Ao.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;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){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){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},Pb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Lb=[0,0,0];let Rb=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t: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(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},Xl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},ql),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Zl),{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 We(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new We(1,0,0,1,0,0),this._clearMatrix=new We(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&ot.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new We(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&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 ep.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&&(ep.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(ep.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){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,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=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(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){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-=Vt;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(f,-2*y),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&&xp.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&&(Qu(Lb,[t,e,i],this.modelMatrix),t=Lb[0],e=Lb[1],i=Lb[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&&(Qu(Lb,[t,e,i],this.modelMatrix),t=Lb[0],e=Lb[1],i=Lb[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Qu(Lb,[e,i,s],this.modelMatrix),e=Lb[0],i=Lb[1],s=Lb[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,e=Ao.global.measureTextMethod){var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Ao.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Zl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Zl.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&&(Qu(Lb,[e,i,s],this.modelMatrix),e=Lb[0],i=Lb[1],s=Lb[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=yh(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:_h(this,a,this.dpr),r.strokeStyle=yh(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=De(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?this.font=t.font:this.font=De(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(t=!0,e=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(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>ep.free(t))),this.stack.length=0}};Rb.env="browser",Rb=Bb([qa(),Pb("design:paramtypes",[Object,Number])],Rb);var Ob=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ib=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Db=class extends hp{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Ao.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new Rb(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 Fb(t,e){return new Fa((i=>{i(Dh).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Fh).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Db.env="browser",Db=Ob([qa(),Ib("design:paramtypes",[Object])],Db);const zb=Fb(Db,Rb);var jb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nb=function(t,e){return function(i,s){e(i,s,t)}};let Vb=class extends X_{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,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=pc.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 Wb=class{constructor(){this.type="group",this.numberType=Iu}contains(t,e,i){return!1}};Wb=Ub([qa()],Wb);const Gb=new Fa(((t,e,i,s)=>{Gb.__vloaded||(Gb.__vloaded=!0,t(Mb).to(Wb).inSingletonScope(),t(Tb).toService(Mb),fo(t,Tb))}));Gb.__vloaded=!1;var Yb=Gb;const $b=new Fa(((t,e,i,s)=>{i(Vb)||t(Vb).toSelf().inSingletonScope(),i(Rv)?s(Rv).toService(Vb):t(Rv).toService(Vb)}));var Xb,Kb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)};let Zb=Xb=class extends W_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Xb.idprefix}_${Xb.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Ao.global,this.viewBox=new Ve,this.modelMatrix=new We(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:Xb.GenerateCanvasId(),canvasControled:!0};this.canvas=new Db(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 Db({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)}};Zb.env="browser",Zb.idprefix="visactor_window",Zb.prefix_count=0,Zb=Xb=Kb([qa(),qb("design:paramtypes",[])],Zb);const Jb=new Fa((t=>{t(Zb).toSelf(),t(vc).toDynamicValue((t=>t.container.get(Zb))).whenTargetNamed(Zb.env)}));var Qb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},ex=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 ix{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 sx(t,e=!1){const i=document.createElement("img");if(Ao.global.isImageAnonymous&&(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 nx=class extends N_{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 ix(t)}return new Ve}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 sx(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return sx(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:Da.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(...t){}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}}loadFont(t,e,i){return ex(this,void 0,void 0,(function*(){return new FontFace(t,_(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}};nx=Qb([qa(),tx("design:paramtypes",[])],nx);const rx=new Fa((t=>{rx.isBrowserBound||(rx.isBrowserBound=!0,t(nx).toSelf().inSingletonScope(),t(yo).toService(nx))}));function ax(t,e=!0){ax.__loaded||(ax.__loaded=!0,t.load(rx),t.load(zb),t.load(Jb),e&&function(t){t.load(Yb),t.load($b)}(t))}rx.isBrowserBound=!1,ax.__loaded=!1;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};let lx=class extends Rb{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}};lx.env="feishu",lx=ox([qa()],lx);var hx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let dx=class extends hp{constructor(t){super(t)}init(){this._context=new lx(this,this._dpr)}release(...t){}};dx.env="feishu",dx=hx([qa(),cx("design:paramtypes",[Object])],dx);const ux=Fb(dx,lx);var px=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gx=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 mx{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 vx=class extends W_{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new mx}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:Da.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new dx(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 dx({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()}};vx.env="feishu",vx=px([qa(),fx(0,Xa(bo)),gx("design:paramtypes",[Object])],vx);const _x=new Fa((t=>{t(vx).toSelf(),t(vc).toDynamicValue((t=>t.container.get(vx))).whenTargetNamed(vx.env)}));var yx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xx=function(t,e){return function(i,s){e(i,s,t)}};let Sx=class extends X_{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,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 op(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}};Sx=yx([qa(),xx(0,Xa(po)),xx(0,Za(eb)),xx(1,Xa(po)),xx(1,Za(Iv)),xx(2,Xa(po)),xx(2,Za(Dv)),bx("design:paramtypes",[Object,Object,Object])],Sx);const Ax=new Fa((t=>{Ax.__vloaded||(Ax.__vloaded=!0,fo(t,eb))}));Ax.__vloaded=!1;var kx=Ax;class Mx{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();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,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:_h(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}var Tx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Cx=function(t,e){return function(i,s){e(i,s,t)}};let Ex=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Bu}};Ex=Tx([qa(),Cx(0,Xa(iv)),wx("design:paramtypes",[Object])],Ex);let Bx=!1;const Px=new Fa(((t,e,i,s)=>{Bx||(Bx=!0,t(ib).to(Ex).inSingletonScope(),t(eb).toService(ib))}));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},Rx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ox=function(t,e){return function(i,s){e(i,s,t)}};let Ix=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Lu}};Ix=Lx([qa(),Ox(0,Xa(sv)),Rx("design:paramtypes",[Object])],Ix);let Dx=!1;const Fx=new Fa(((t,e,i,s)=>{Dx||(Dx=!0,t(sb).to(Ix).inSingletonScope(),t(eb).toService(sb))}));var zx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hx=function(t,e){return function(i,s){e(i,s,t)}};let Nx=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Ru}};Nx=zx([qa(),Hx(0,Xa(nv)),jx("design:paramtypes",[Object])],Nx);let Vx=!1;const Ux=new Fa(((t,e,i,s)=>{Vx||(Vx=!0,t(nb).to(Nx).inSingletonScope(),t(eb).toService(nb))}));class Wx{constructor(){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}}var Gx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},$x=function(t,e){return function(i,s){e(i,s,t)}};let Xx=class extends Wx{constructor(t){super(),this.canvasRenderer=t}};Xx=Gx([qa(),$x(0,Xa(gv)),Yx("design:paramtypes",[Object])],Xx);let Kx=!1;const qx=new Fa(((t,e,i,s)=>{Kx||(Kx=!0,t(ub).to(Xx).inSingletonScope(),t(Xx).toService(ub))}));var Zx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Jx=class{constructor(){this.type="image",this.numberType=Du}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Jx=Zx([qa()],Jx);let Qx=!1;const tS=new Fa(((t,e,i,s)=>{Qx||(Qx=!0,t(rb).to(Jx).inSingletonScope(),t(Jx).toService(rb))}));var eS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sS=function(t,e){return function(i,s){e(i,s,t)}};let nS=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Fu}};nS=eS([qa(),sS(0,Xa(ov)),iS("design:paramtypes",[Object])],nS);let rS=!1;const aS=new Fa(((t,e,i,s)=>{rS||(rS=!0,t(ab).to(nS).inSingletonScope(),t(eb).toService(ab))}));var oS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hS=function(t,e){return function(i,s){e(i,s,t)}};let cS=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=ju}};cS=oS([qa(),hS(0,Xa(hv)),lS("design:paramtypes",[Object])],cS);let dS=!1;const uS=new Fa(((t,e,i,s)=>{dS||(dS=!0,t(db).to(cS).inSingletonScope(),t(eb).toService(db))}));var pS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fS=function(t,e){return function(i,s){e(i,s,t)}};let mS=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=zu}};mS=pS([qa(),fS(0,Xa(lv)),gS("design:paramtypes",[Object])],mS);let vS=!1;const _S=new Fa(((t,e,i,s)=>{vS||(vS=!0,t(ob).to(mS).inSingletonScope(),t(eb).toService(ob))})),yS=new Ve;class bS{constructor(){this.type="rect",this.numberType=Hu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{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,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:_h(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;yS.setValue(i.x1,i.y1,i.x2,i.y2),yS.expand(-r/2),h=!yS.containsPoint(e)}}return s.highPerformanceRestore(),h}}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 extends bS{constructor(t){super(),this.canvasRenderer=t}};kS=xS([qa(),AS(0,Xa(cv)),SS("design:paramtypes",[Object])],kS);let MS=!1;const TS=new Fa(((t,e,i,s)=>{MS||(MS=!0,t(lb).to(kS).inSingletonScope(),t(eb).toService(lb))}));let wS=!1;const CS=new Fa(((t,e,i,s)=>{wS||(wS=!0,t(rb).to(Jx).inSingletonScope(),t(Jx).toService(rb))}));var ES=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},BS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},PS=function(t,e){return function(i,s){e(i,s,t)}};let LS=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Vu}};LS=ES([qa(),PS(0,Xa(dv)),BS("design:paramtypes",[Object])],LS);let RS=!1;const OS=new Fa(((t,e,i,s)=>{RS||(RS=!0,t(hb).to(LS).inSingletonScope(),t(eb).toService(hb))}));var IS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 DS=class{constructor(){this.type="text",this.numberType=Uu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};DS=IS([qa()],DS);let FS=!1;const zS=new Fa(((t,e,i,s)=>{FS||(FS=!0,t(cb).to(DS).inSingletonScope(),t(eb).toService(cb))})),jS=new Fa(((t,e,i,s)=>{i(Sx)||t(Sx).toSelf().inSingletonScope(),i(Rv)?s(Rv).toService(Sx):t(Rv).toService(Sx)}));class HS{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 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},VS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let US=class extends N_{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 HS(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 rd.call(t)}}getCancelAnimationFrame(){return t=>{rd.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(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};US=NS([qa(),VS("design:paramtypes",[])],US);const WS=new Fa((t=>{WS.isFeishuBound||(WS.isFeishuBound=!0,t(US).toSelf().inSingletonScope(),t(yo).toService(US))}));function GS(t,e=!0){GS.__loaded||(GS.__loaded=!0,t.load(WS),t.load(ux),t.load(_x),e&&function(t){t.load(kx),t.load(jS),t.load(Px),t.load(Fx),t.load(Ux),t.load(qx),t.load(tS),t.load(aS),t.load(uS),t.load(_S),t.load(TS),t.load(CS),t.load(OS),t.load(zS)}(t))}WS.isFeishuBound=!1,GS.__loaded=!1;var YS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$S=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let XS=class extends Rb{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 We(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};XS.env="node",XS=YS([qa(),$S("design:paramtypes",[Object,Number])],XS);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},qS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ZS=class extends hp{constructor(t){super(t)}init(){this._context=new XS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};ZS.env="node",ZS=KS([qa(),qS("design:paramtypes",[Object])],ZS);const JS=Fb(ZS,XS);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},tA=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 iA=class extends W_{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:Da.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new ZS(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new ZS({width:n,height:r,dpr:s,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}getImageBuffer(t="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){}};iA.env="node",iA=QS([qa(),eA(0,Xa(bo)),tA("design:paramtypes",[Object])],iA);const sA=new Fa((t=>{t(iA).toSelf(),t(vc).toDynamicValue((t=>t.container.get(iA))).whenTargetNamed(iA.env)}));var nA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let rA=class extends N_{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 rd.call(t)}}getCancelAnimationFrame(){return t=>{rd.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};rA=nA([qa()],rA);const aA=new Fa((t=>{aA.isNodeBound||(aA.isNodeBound=!0,t(rA).toSelf().inSingletonScope(),t(yo).toService(rA))}));function oA(t,e=!0){oA.__loaded||(oA.__loaded=!0,t.load(aA),t.load(JS),t.load(sA))}aA.isNodeBound=!1,oA.__loaded=!1;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},hA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cA=function(t,e){return function(i,s){e(i,s,t)}};let dA=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Bu}};dA=lA([qa(),cA(0,Xa(iv)),hA("design:paramtypes",[Object])],dA);let uA=!1;const pA=new Fa(((t,e,i,s)=>{uA||(uA=!0,t(pb).to(dA).inSingletonScope(),t(Tb).toService(pb))}));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},fA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mA=function(t,e){return function(i,s){e(i,s,t)}};let vA=class extends bS{constructor(t){super(),this.canvasRenderer=t}};vA=gA([qa(),mA(0,Xa(cv)),fA("design:paramtypes",[Object])],vA);let _A=!1;const yA=new Fa(((t,e,i,s)=>{_A||(_A=!0,t(yb).to(vA).inSingletonScope(),t(Tb).toService(yb))}));class bA extends qf{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=t.getGraphicTheme(),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,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:_h(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&ip.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}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){return function(i,s){e(i,s,t)}};let kA=class extends bA{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Fu}};kA=xA([qa(),AA(0,Xa(ov)),SA("design:paramtypes",[Object])],kA);let MA=!1;const TA=new Fa(((t,e,i,s)=>{MA||(MA=!0,t(vb).to(kA).inSingletonScope(),t(Tb).toService(vb))}));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 BA=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Lu}};BA=wA([qa(),EA(0,Xa(sv)),CA("design:paramtypes",[Object])],BA);let PA=!1;const LA=new Fa(((t,e,i,s)=>{PA||(PA=!0,t(gb).to(BA).inSingletonScope(),t(Tb).toService(gb))}));class RA extends qf{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();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,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&ip.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var OA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},IA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},DA=function(t,e){return function(i,s){e(i,s,t)}};let FA=class extends RA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Vu}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=t.getGraphicTheme(),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,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:_h(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&ip.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};FA=OA([qa(),DA(0,Xa(dv)),IA("design:paramtypes",[Object])],FA);let zA=!1;const jA=new Fa(((t,e,i,s)=>{zA||(zA=!0,t(bb).to(FA).inSingletonScope(),t(Tb).toService(bb))}));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},NA=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)}};let UA=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Ru}};UA=HA([qa(),VA(0,Xa(nv)),NA("design:paramtypes",[Object])],UA);let WA=!1;const GA=new Fa(((t,e,i,s)=>{WA||(WA=!0,t(fb).to(UA).inSingletonScope(),t(Tb).toService(fb))}));var YA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$A=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XA=function(t,e){return function(i,s){e(i,s,t)}};let KA=class extends RA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=Uu}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=t.getGraphicTheme(),{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(),f=l.width(),m=pg(a,u,n),v=ug(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,s.modelMatrix!==u&&ip.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};KA=YA([qa(),XA(0,Xa(uv)),$A("design:paramtypes",[Object])],KA);let qA=!1;const ZA=new Fa(((t,e,i,s)=>{qA||(qA=!0,t(xb).to(KA).inSingletonScope(),t(Tb).toService(xb))}));var JA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},QA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tk=function(t,e){return function(i,s){e(i,s,t)}};let ek=class extends bA{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=zu}};ek=JA([qa(),tk(0,Xa(lv)),QA("design:paramtypes",[Object])],ek);let ik=!1;const sk=new Fa(((t,e,i,s)=>{ik||(ik=!0,t(_b).to(ek).inSingletonScope(),t(Tb).toService(_b))}));var nk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ak=function(t,e){return function(i,s){e(i,s,t)}};let ok=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=ju}};ok=nk([qa(),ak(0,Xa(hv)),rk("design:paramtypes",[Object])],ok);let lk=!1;const hk=new Fa(((t,e,i,s)=>{lk||(lk=!0,t(Sb).to(ok).inSingletonScope(),t(Tb).toService(Sb))}));var ck=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uk=function(t,e){return function(i,s){e(i,s,t)}};let pk=class extends Wx{constructor(t){super(),this.canvasRenderer=t}};pk=ck([qa(),uk(0,Xa(gv)),dk("design:paramtypes",[Object])],pk);let gk=!1;const fk=new Fa(((t,e,i,s)=>{gk||(gk=!0,t(kb).to(pk).inSingletonScope(),t(Tb).toService(kb))}));var mk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_k=function(t,e){return function(i,s){e(i,s,t)}};let yk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Nu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};yk=mk([qa(),_k(0,Xa(pv)),vk("design:paramtypes",[Object])],yk);let bk=!1;const xk=new Fa(((t,e,i,s)=>{bk||(bk=!0,t(Ab).to(yk).inSingletonScope(),t(Tb).toService(Ab))}));var Sk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ak=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kk=function(t,e){return function(i,s){e(i,s,t)}};let Mk=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=Du}};Mk=Sk([qa(),kk(0,Xa(fv)),Ak("design:paramtypes",[Object])],Mk);let Tk=!1;const wk=new Fa(((t,e,i,s)=>{Tk||(Tk=!0,t(mb).to(Mk).inSingletonScope(),t(Tb).toService(mb))})),Ck=I_();function Ek(){Ek.__loaded||(Ek.__loaded=!0,pf.RegisterGraphicCreator("arc",of),xo.load(cy),xo.load(Ck?pA:Px))}Ek.__loaded=!1;const Bk=Ek;function Pk(){Pk.__loaded||(Pk.__loaded=!0,pf.RegisterGraphicCreator("area",nf),xo.load(my),xo.load(Ck?LA:Fx))}Pk.__loaded=!1;const Lk=Pk;function Rk(){Rk.__loaded||(Rk.__loaded=!0,pf.RegisterGraphicCreator("circle",Sg),xo.load(by),xo.load(Ck?GA:Ux))}Rk.__loaded=!1;const Ok=Rk;function Ik(){Ik.__loaded||(Ik.__loaded=!0,pf.RegisterGraphicCreator("glyph",zg),xo.load(By),xo.load(Ck?fk:qx))}Ik.__loaded=!1;const Dk=Ik;function Fk(){Fk.__loaded||(Fk.__loaded=!0,pf.RegisterGraphicCreator("group",Rp))}Fk.__loaded=!1;const zk=Fk;function jk(){jk.__loaded||(jk.__loaded=!0,pf.RegisterGraphicCreator("image",Wg),xo.load(Fy),xo.load(Ck?wk:tS))}jk.__loaded=!1;const Hk=jk;function Nk(){Nk.__loaded||(Nk.__loaded=!0,pf.RegisterGraphicCreator("line",Lg),xo.load(gy),xo.load(Ck?TA:aS))}Nk.__loaded=!1;const Vk=Nk;function Uk(){Uk.__loaded||(Uk.__loaded=!0,pf.RegisterGraphicCreator("path",tf),xo.load(ky),xo.load(Ck?sk:_S))}Uk.__loaded=!1;const Wk=Uk;function Gk(){Gk.__loaded||(Gk.__loaded=!0,pf.RegisterGraphicCreator("polygon",cf),xo.load(Ty),xo.load(Ck?hk:uS))}Gk.__loaded=!1;const Yk=Gk;function $k(){$k.__loaded||($k.__loaded=!0,pf.RegisterGraphicCreator("rect",Dg),xo.load(uy),xo.load(Ck?yA:TS))}$k.__loaded=!1;const Xk=$k;function Kk(){Kk.__loaded||(Kk.__loaded=!0,pf.RegisterGraphicCreator("richtext",Zg),xo.load(Iy),xo.load(Ck?xk:CS))}Kk.__loaded=!1;const qk=Kk;function Zk(){Zk.__loaded||(Zk.__loaded=!0,pf.RegisterGraphicCreator("shadowRoot",uf))}Zk.__loaded=!1;const Jk=Zk;function Qk(){Qk.__loaded||(Qk.__loaded=!0,pf.RegisterGraphicCreator("symbol",Eg),xo.load(_y),xo.load(Ck?jA:OS))}Qk.__loaded=!1;const tM=Qk;function eM(){eM.__loaded||(eM.__loaded=!0,pf.RegisterGraphicCreator("text",Tg),xo.load(Sy),xo.load(Ck?ZA:zS))}eM.__loaded=!1;const iM=eM;function sM(){zk(),Xk()}const nM=-.5*Math.PI,rM=1.5*Math.PI,aM="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 oM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(oM||(oM={}));const lM={[oM.selectedReverse]:{},[oM.selected]:{},[oM.hover]:{},[oM.hoverReverse]:{}},hM={container:"",width:30,height:30,style:{}},cM="scrollDrag";function dM(){return"browser"===k_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const uM={debounce:St,throttle:At};sM();let pM=class t extends tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},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=_t(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=_t(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=>{this._clearDragEvents();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});const r=dM(),a="browser"===k_.env?k_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=_t(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},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:uM[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:yt(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=yt(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(cM,{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",uM[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===k_.env?k_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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(yt(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:ai(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,[s,n,r,a]=ai(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,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=_t(t[0],0,1),c=_t(t[1],0,1),d=_t(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=yt(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?yt([a+i*n,a+s*n],a,n-l):yt([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=dM(),e="browser"===k_.env?k_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===k_.env?k_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};pM.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,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};var gM,fM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 mM=gM=class{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new Ne).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Ut(t.deltaX)>Ut(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ve,e.addEventListener("wheel",this.scroll),this.params=gM.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(cM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new pM(v),h.name=a,e.add(h),h.isScrollBar=!0);const _=this.childrenBounds,{scrollX:y,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/_.width(),1),e=Math.max(Math.min(y/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/_.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=i{i(mM)||(t(mM).toSelf(),t(Wv).toService(mM))}));function _M(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&_M(t,e)}))}const yM=t=>!u(t)&&!1!==t.visible;function bM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function xM(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 AM=["#ffffff","#000000"];function kM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ii(t).toHex(),o=new ii(e).toHex();return MM(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(...AM);for(const n of a)if(t!==n&&MM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function MM(t,e,i,s,n){if("lightness"===n){const i=ii.getColorBrightness(new ii(e));return ii.getColorBrightness(new ii(t))<.5?i>=.5:i<.5}return s?TM(t,e)>s:"largeText"===i?TM(t,e)>3:TM(t,e)>4.5}function TM(t,e){const i=wM(t),s=wM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function wM(t){const e=ni(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 CM(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 EM(t,e){return[t[0]*e,t[1]*e]}function BM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function PM(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=Qt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const LM=(t,e,i,s)=>new Fe(Object.assign({defaultFontParams:Object.assign({fontFamily:aM,fontSize:14},s),getTextBounds:i?void 0:mf,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function RM(t,e,i={}){if(!t)return{width:0,height:0};const s=mf({text:t,fontFamily:e.fontFamily||i.fontFamily||aM,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 OM(t,e="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 IM(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function DM(t,e="type"){const i=OM(t,e);return"rich"===i?pf.richtext(IM(t)):("html"===i?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"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),pf.text(t))}function FM(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 zM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function jM(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 HM(t,e){const{dx:i,dy:s}=jM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function NM(){zk(),Xk(),tM(),qk(),iM()}var VM=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&&(T=h,R.setAttribute("maxLineWidth",h-b[1]-b[2]))),k=0,M=0;let H=0;"left"===z||"start"===z?H=1:"right"===z||"end"===z?H=-1:"center"===z&&(H=0),H?H<0?(k-=T,A&&A.setAttribute("x",(A.attribute.x||0)-O),x.setAttribute("x",-b[1]-E)):H>0&&x.setAttribute("x",b[3]):(k-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-O/2),x.setAttribute("x",-E/2));const N="right"===y||"end"===y,V="left"===y||"start"===y,U=(t,e)=>{"richtext"===R.type?R.setAttributes({x:t,textAlign:e,textConfig:Y(R.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):R.setAttributes({x:t,textAlign:e})};if((y?"center"===y:_)&&H){const t=T-b[1]-b[3],e=O+E,i=1===H?(t-e)/2+E+O/2:b[0]+E-(T/2+e/2-E)+O/2;if(U(i,"center"),A){const t=i-O/2-E+F/2;A.setAttributes({x:t})}}if(V&&1!==H){const t=T-b[1]-b[3],e=0===H?-t/2+E/2:-T+b[3]+b[1]+E;if(U(e+E,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(N&&-1!==H){const t=T-b[1]-b[3],e=0===H?t/2+E/2:t;if(U(e,"right"),A){const t=e-O-E+F/2;A.setAttributes({x:t})}}"middle"===j?(M-=w/2,A&&A.setAttribute("y",0)):"bottom"===j?(M-=w,A&&A.setAttribute("y",-I/2),x.setAttribute("y",-b[2])):"top"===j&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",I/2)),P(null==m?void 0:m.text)||(R.states=m.text);const{visible:W}=a,G=VM(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},G),{visible:W&&!!s,width:T,height:w,x:k,y:M}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),G.customShape){const e=G.customShape;t.pathProxy=t=>e(this,t,new Wl)}this._bgRect=t}this._textShape=R,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:j({},UM.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}UM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const WM={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}},GM={poptip:j({},WM)};var YM=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);nA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(y(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),I.setAttribute("x",I.attribute.x+e),o.setAttribute("dx",$t(Yt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),I.setAttribute("y",I.attribute.y+e),o.setAttribute("dy",$t(Yt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?jt/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:jt/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?jt/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?jt/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:jt/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?jt/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?jt:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:jt,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?jt:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}QM.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"},panel:{},maxWidthPercent:.8,space:8,padding:10};var tT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 eT=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};j(s,QM.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new QM(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};j(e,GM.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,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),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}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}};eT=tT([qa()],eT);var iT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 sT{constructor(){this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(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)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}let nT=class extends sT{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};nT=iT([qa()],nT);let rT=class extends sT{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}};rT=iT([qa()],rT);const aT=new Fa(((t,e,i,s)=>{i(eT)||(t(eT).toSelf().inSingletonScope(),t(dg).toService(eT)),i(nT)||(t(nT).toSelf(),t(Wv).toService(nT)),i(rT)||(t(rT).toSelf(),t(Wv).toService(rT))}));class oT extends tb{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}zk(),Vk();class lT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},lT.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})}}lT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},zk(),Xk();class hT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},hT.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})}}hT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},zk(),Bk();class cT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},cT.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=ae.distancePP(t,e);this.setAttribute("radius",i)}}cT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},zk(),Bk();class dT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},dT.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=nM,endAngle:s=rM}=this.attribute,n=s-i,r=le(ue(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}dT.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},zk(),Wk();class uT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},uT.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=ce(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=ae.distancePP(t,e);this.setAttribute("radius",i)}}function pT(){zk(),Vk(),Yk(),tM()}function gT(){zk(),Vk(),Bk(),tM()}uT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},pT();class fT extends tb{getStartAngle(){return pe(this._startAngle)}getEndAngle(){return pe(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},fT.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=pf.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),P(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=pf.line;Y(i)[0].cornerRadius&&(t=pf.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"),P(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:f=12}=t;let m,v;"start"===i?(m={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)):(m={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=pf.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(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}}fT.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}}},gT();class mT extends fT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},fT.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=pf.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"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var vT,_T;!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.labelHoverOnAxis="axis-label-hover-on-axis",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",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(vT||(vT={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(_T||(_T={}));const yT={[_T.selectedReverse]:{},[_T.selected]:{},[_T.hover]:{},[_T.hoverReverse]:{}},bT={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}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},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}}},xT={size:8,stroke:"#000",lineWidth:1,zIndex:1};const ST=Math.sin(Math.PI/10);function AT(t,e=ST){const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function kT(t,e=ST){const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function MT(t){const e={};return _M(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function TT(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function wT(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return EM(r,(s?-1:1)*(n?-1:1)*t/BM(r))}function CT(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function BT(t,e,i){var s;if(kT(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>ze(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>ze(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>je(n,r)}function PT(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(oM.hover,!0),_M(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(oM.hoverReverse,!0)})),s):i},RT=(t,e,i)=>i?(_M(e,(t=>{t.name&&!P(t.states)&&(t.removeState(oM.hoverReverse),t.removeState(oM.hover))})),null):i,OT=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(oM.selected)?(_M(e,(t=>{t.name&&!P(t.states)&&(t.removeState(oM.selectedReverse),t.removeState(oM.selected))})),null):s.name&&!P(s.states)?(s.addState(oM.selected,!0),_M(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(oM.selectedReverse,!0)})),s):i};class IT extends tb{_prepareAnimate(t){if(!1!==this.attribute.animation){const{animation:e,animationEnter:i,animationExit:s,animationUpdate:n}=this.attribute,r=g(e)?e:{};this._animationConfig={enter:!1!==i&&j({},t,r,null!=i?i:{}),exit:!1!==s&&j({},t,r,null!=s?s:{}),update:!1!==n&&(y(n)?n:j({},t,r,null!=n?n:{}))}}else this._animationConfig={enter:!1,exit:!1,update:!1}}}const DT={type:"default",duration:300,easing:"linear"};class FT extends IT{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=LT(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=RT(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=OT(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=pf.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._prepare(),this._prevInnerView=this._innerView&&MT(this._innerView),this.removeAllChild(!0),this._innerView=pf.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation()}_prepare(){this._prepareAnimate(DT)}_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=pf.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=vT.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=pf.group({x:0,y:0,pickable:!1});t.name=vT.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",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=pf.group({x:0,y:0,pickable:!1});i.name=vT.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=pf.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=vT.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=lM;else{const t=this.data[s],e=j({},lM,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=pf.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=vT.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=lM;else{const i=j({},lM,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=pf.group({x:0,y:0,pickable:!1});return r.name=`${vT.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=DM(this._getLabelAttribute(t,e,n,i));if(a.name=vT.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=lM;else{const s=j({},lM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new UM(Object.assign({},e));i.name=vT.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return TT(t,this.getVerticalVector(e,i,t))}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;Ut(s[0])>Ut(s[1])?o=jt/2*(l.x>e.x?1:-1):h=jt/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+L(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+L(this.attribute,"label.space",4))*s);const f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:_}=this.attribute.label;_=d(_)?j({},bT.label.style,_(t,e,i,s)):_;_=j(this.getLabelAlign(m,o,_.angle),_),d(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let y=_.react;return d(y)&&(y=y(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,_)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==_?void 0:_.fontSize,type:h}),_),{react:y})}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}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},_M(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(e.setFinalAttributes(e.attribute),r){r.release();const i=r.attribute,a=e.getFinalAttribute(),o=function(t,e,i){const s={};for(const i in e)i in t&&U(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}(i,a);let l=Object.keys(o).length>0;if("opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l){this._newElementAttrMap[e.id]={state:"update",node:e,attrs:e.attribute};const i=r.attribute;e.setAttributes(i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}])}}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const zT={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&&BT(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function jT(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function HT(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=d(n)?n:zT[n]||zT.parity;if(s.length>=3&&PT(s,r)){do{s=a(s,r)}while(s.length>=3&&PT(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=$(i);BT(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),HT(l,s,n,(t=>BT(t,l,r))),HT(h,s,o,(t=>BT(t,h,r)||!(!n||t===l)&&BT(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function VT(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},GT(t,e.attribute.angle)),{angle:WT(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({},YT(t,e.attribute.angle)),{angle:WT(e.attribute.angle)}))}))}(t,e),function(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=Te({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function WT(t=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 GT(t,e=0){let 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=WT(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 YT(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=WT(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 $T(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!u(h),d=c?Math.cos(h):1,p=c?Math.sin(h):0,f=kT(h),m=AT(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===_||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/d,l=Math.abs(i/p);if(y&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(d);r=Math.min(t,l)}else if(y&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(d);r=Math.min(t,l)}else r=l}else r=Math.abs(i/d);k(t.attribute.maxLineWidth)&&(r=k(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function XT(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class KT{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,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=BM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return EM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class qT{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-qT.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*qT.bounceIn(2*t):.5*qT.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Vt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Vt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Vt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Vt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Vt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Vt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Vt/e)*.5+1}}static registerFunc(t,e){qT[t]=e}}function ZT(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}qT.quadIn=qT.getPowIn(2),qT.quadOut=qT.getPowOut(2),qT.quadInOut=qT.getPowInOut(2),qT.cubicIn=qT.getPowIn(3),qT.cubicOut=qT.getPowOut(3),qT.cubicInOut=qT.getPowInOut(3),qT.quartIn=qT.getPowIn(4),qT.quartOut=qT.getPowOut(4),qT.quartInOut=qT.getPowInOut(4),qT.quintIn=qT.getPowIn(5),qT.quintOut=qT.getPowOut(5),qT.quintInOut=qT.getPowInOut(5),qT.backIn=qT.getBackIn(1.7),qT.backOut=qT.getBackOut(1.7),qT.backInOut=qT.getBackInOut(1.7),qT.elasticIn=qT.getElasticIn(1,.3),qT.elasticOut=qT.getElasticOut(1,.3),qT.elasticInOut=qT.getElasticInOut(1,.3*1.5),qT.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),qT.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},qT.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)qT[`flicker${t}`]=e=>ZT(e,t);for(let t=2;t<10;t++)qT[`aIn${t}`]=e=>t*e*e+(1-t)*e;function JT(t,e,i){return t+(e-t)*i}const QT=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=JT(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=JT(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=JT(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=JT(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=JT(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=JT(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=JT(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=JT(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=JT(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=pp(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?fp(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=pp(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?fp(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=JT(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=JT(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=JT(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=JT(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=JT(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=JT(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=JT(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=JT(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=JT(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=id(e,i,s),r.addUpdateBoundTag()}}};function tw(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.setAttributes(this.target.attribute)},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=qT[s])&&void 0!==n?n:qT.linear:qT.linear,"wait"===t&&(this.onUpdate=ew),this.id=Da.GenAutoIncrementId(),this.syncAttributeUpdate=ew}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(_(i)&&_(s)){const n=dp.Get(i,cp.Color255),r=dp.Get(s,cp.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(QT["fill"===e?"fillPure":"strokePure"])}else QT[e]?t.push(QT[e]):t.push(tw)}else QT[e]?t.push(QT[e]):t.push(tw)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate;this.target.animates.forEach((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const i=e.getStartProps();this.propKeys.forEach((t=>{null!=i[t]&&e.preventAttr(t)}))}))}deleteSelfAttr(t){var e;delete this.props[t],this.fromProps&&delete this.fromProps[t];const i=this.propKeys.indexOf(t);-1!==i&&(this.propKeys.splice(i,1),null===(e=this.interpolateUpdateFunctions)||void 0===e||e.splice(i,1))}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){this.target.setAttributes(this.props),t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class sw extends iw{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();this.target.setAttributes(t)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class nw extends l{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Da.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Io.END?this.removeAnimate(t,!0):t.status!==Io.RUNNING&&t.status!==Io.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const rw=new nw;rw.isGlobal=!0;class aw{constructor(t=Da.GenAutoIncrementId(),e=rw,i){this.id=t,this.status=Io.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){return this.target=t,this.target.animates||(this.target.animates=new Map),this.target.animates.set(this.id,this),this.onRemove((()=>{this.stop(),this.target.animates.delete(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new iw(Oo.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new sw(Oo.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new iw(Oo.from,t,e,i);return this._firstStep?(this._lastStep.append(s),this._lastStep=s):(this._firstStep=s,this._lastStep=s),this.updateDuration(),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Io.RUNNING&&(this.status=Io.PAUSED)}resume(){this.status===Io.PAUSED&&(this.status=Io.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this._preventAttrs.add(t),delete this._startProps[t],delete this._endProps[t];let e=this._firstStep;for(;e;)e.deleteSelfAttr(t),e=e.next}preventAttrs(t){t.forEach((t=>this._preventAttrs.add(t)))}validAttr(t){return!this._preventAttrs.has(t)}runCb(t){var e;return null===(e=this._lastStep)||void 0===e||e.onEnd(t),this}startAt(t){return this._startTime=t,this}customInterpolate(t,e,i,s,n,r){return!1}getFromValue(){return this._startProps}getToValue(){return this._endProps}stop(t){let e=this._firstStep;for(;e;)e.stop(),e=e.next;this.status!==Io.END&&this.onEnd(),this.status=Io.END,this.target&&("start"===t?this.target.setAttributes(this._startProps):"end"===t?this.target.setAttributes(this._endProps):t&&this.target.setAttributes(t))}release(){this.status=Io.END,this._onRemove&&this._onRemove.forEach((t=>t())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Io.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),void(this.status=Io.END);this.status=Io.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&this.target.setAttributes(this._startProps);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const ow=new Mo;class lw{constructor(){this.released=!1}tick(t,e){ow.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class hw extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Ro.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Ro.INITIAL,Ao.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),Ao.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new lw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Ro.INITIAL&&(this.status=Ro.PAUSE,!0)}resume(){return this.status!==Ro.INITIAL&&(this.status=Ro.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Ro.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Ro.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Ro.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Ro.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Ro.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Ro.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,Ao.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}function uw(t){if(!t||!d(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1}return 2}dw.getInstance();class pw{static registerBuiltInAnimate(t,e){pw.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;y(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:pw.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=uw(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:pw.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=uw(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=k(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){Array.isArray(t)?t.forEach((t=>this._execute(t))):this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,u;const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:_=0,duration:y=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:M,custom:T,customType:w,controlOptions:C}=t,E=e.animate();E.priority=k;const B=d(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],L=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&L&&(i=null!==(h=P[L])&&void 0!==h?h:i),E.startAt(b);const R=i*x+B;R>0&&E.wait(R);let O=null,I=t.to,D=t.from;I||(O||(O=this.createPropsFromChannel(g,e)),I=O.props),D||(O||(O=this.createPropsFromChannel(g,e)),D=O.from),O.attrOutChannel&&e.setAttributes(O.attrOutChannel),this._handleRunAnimate(E,T,w,D,I,y,m,f,C,M,p,e);let F=0;x&&(F=x*(s-i-1));const z=d(_)?_(null===(u=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===u?void 0:u[0],e,{}):_;return z>0&&(F+=z),F>0&&E.wait(F),S&&S>0&&E.loop(S),A&&E.bounce(!0),E}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,u){var p,g,f,m,v,_,y,b;if(e&&i){i=uw(e);let c=this.resolveValue(o,u);"function"==typeof c&&(c=c(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),c=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},c);const x=d(h)?h.call(null,null!==(_=c&&(null===(v=c.data)||void 0===v?void 0:v[0]))&&void 0!==_?_:null===(b=null===(y=u.context)||void 0===y?void 0:y.data)||void 0===b?void 0:b[0],u,c):h;c.options=x,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:u=0}=t,p=d(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=d(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;u||(d||(d=this.createPropsFromChannel(a,i)),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i)),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const g=null!==(n=t.custom)&&void 0!==n?n:pw.builtInAnimateMap[r],f=t.custom?t.customType:uw(g);this._handleRunAnimate(e,g,f,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e){var i;const s={};let n=null;if(!t)return{from:n,props:s,attrOutChannel:null};const r={};let a=!1;const o=null===(i=e.context)||void 0===i?void 0:i.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===o[e]||(t[e]={to:o[e]}),t)),{})),Object.keys(t).forEach((i=>{var r,a,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?s[i]=h.to(null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,{}):s[i]=h.to),void 0!==h.from&&(n||(n={}),"function"==typeof h.from?n[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):n[i]=h.from)})),o)for(const t in o){const e=o[t];void 0!==e&&(s.hasOwnProperty(t)||(r[t]=e,a=!0))}return{from:n,props:s,attrOutChannel:a?r:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}executeItem(t,e,i=0,s=1){return Array.isArray(t)?t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean):[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Io.END),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}pw.builtInAnimateMap={};const gw="appear",fw="disappear",mw="update",vw="highlight",_w="unhighlight";class yw{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class bw{constructor(t){this.stateList=null,this.graphic=t}applyState(t,e,i){const s=dw.getInstance(),n=[],r=[];if(this.stateList&&this.stateList.length?t.forEach(((t,i)=>{const a={allowTransition:!0,stopOriginalTransition:!0};this.stateList.forEach((e=>{const i=s.isTransitionAllowed(e.state,t,this.graphic);a.allowTransition=a.allowTransition&&i.allowTransition})),a.allowTransition&&(r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new pw(this.graphic)}),this.stateList.forEach((e=>{s.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&n.push(e)})))})):t.forEach(((t,i)=>{r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new pw(this.graphic)})})),n.forEach((t=>{t.executor.stop(null,!1)})),r.length){r[0].executor.execute(r[0].animationConfig);for(let t=0;t{e&&e.executor.execute(e.animationConfig),this.stateList=this.stateList.filter((t=>t!==s)),t===r.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!n.includes(t))):this.stateList=[],this.stateList.push(...r)}applyAppearState(t,e){this.applyState([gw],[{name:gw,animation:t}],e)}applyDisappearState(t,e){this.applyState([fw],[{name:fw,animation:t}],e)}applyUpdateState(t,e){this.applyState([mw],[{name:mw,animation:t}],e)}applyHighlightState(t,e){this.applyState([vw],[{name:vw,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([_w],[{name:_w,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class xw{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new bw(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new yw(t)),t._animationStateStore}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return(new xw)._getAnimationStateManager(t),t}}class Sw{getAttributes(t=!1){return t&&this.finalAttribute?this.finalAttribute:this.attribute}animate(t){var e,i,s;const n=new aw(null==t?void 0:t.id,null!==(i=null!==(e=null==t?void 0:t.timeline)&&void 0!==e?e:this.stage&&this.stage.getTimeline())&&void 0!==i?i:rw,null==t?void 0:t.slience);if(n.bind(this),t){const{onStart:e,onEnd:i,onRemove:s}=t;null!=e&&n.onStart(e),null!=i&&n.onEnd(i),null!=s&&n.onRemove(s)}return null===(s=this.stage)||void 0===s||s.ticker.start(),n}createTimeline(){return new nw}createTicker(t){return new hw(t)}setFinalAttributes(t){this.finalAttribute||(this.finalAttribute={}),Object.assign(this.finalAttribute,t)}initFinalAttributes(t){this.finalAttribute=t}initAnimateExecutor(){this._animateExecutor||(this._animateExecutor=new pw(this))}executeAnimation(t){return this.initAnimateExecutor(),this._animateExecutor.execute(t),this}executeAnimations(t){return this.initAnimateExecutor(),t.forEach((t=>{this._animateExecutor.execute(t)})),this}getFinalAttribute(){return this.finalAttribute}getGraphicAttribute(t,e=!1){return!e&&this.finalAttribute?this.finalAttribute[t]:this.attribute[t]}pauseAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function Aw(){G(Bp,xw),G(Bp,Sw)}class kw extends iw{constructor(t,e,i,s,n){super("customAnimate",e,i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class Mw extends kw{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class Tw{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new pw(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttr(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function ww(t){return new Tw(t)}class Cw extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,this.target.setAttribute("text",n)}}const Ew=1e3,Bw="quadInOut",Pw=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],Lw=(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=pp(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Rw=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?ey(t):[],n=ey(e);i&&s&&(i.fromTransform&&iy(s,i.fromTransform.clone().getInverse()),iy(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})))},Iw=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Dw=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Iw.includes(n))return;const r=e[n];if(!u(r)&&!u(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?dp.Get(t,cp.Color255):t;i.push({from:y(t[n])?t[n].map(e):e(t[n]),to:y(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class Fw extends kw{constructor(t,e,i){super({},{},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;Rw(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&Lw(this.otherAttrs,i,e),this.target.setAttributes(i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const zw=(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=Ow(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Dw(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new Fw({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Ew,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Bw);return c.play(d),c};class jw extends kw{constructor(t,e,i){super({},{},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;Rw(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&&Lw(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Hw=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Pw.includes(t))(i)||(e[i]=t[i])})),e},Nw=(t,e,i)=>{const s=Hw(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),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=Ao.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},Vw=(t,e,i)=>{const s=[],n=i?null:Hw(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:Hw(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=Rg(t.attribute),n=ny(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(Ao.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=ny(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(Ao.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=ny(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(Ao.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 ry(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 ry(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(Ao.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:ay(i)}];const s=[];return ly(i,e,s),s})(t,e).forEach((t=>{s.push(Ao.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 ly(l,e,h),h})(t,e).forEach((t=>{s.push(Ao.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=ey(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(Ao.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(Ao.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Nw(t,s,e),s};class Ww extends kw{constructor(t,e,i,s,n){super(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(){super.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:qo.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:qo.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:qo.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Gw extends Ww{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;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=Ao.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!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:y/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(_+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 Yw extends Ww{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:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=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=Ao.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:f,height:"in"===v&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===y?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class $w extends kw{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){super.onBind();const{points:t,segments:e}=this.target.attribute,{points:i,segments:s}=this.target.getFinalAttribute();this.from={points:t,segments:e},this.to={points:i,segments:s},this.props=this.to;const n=this.getPoints(this.from),r=this.getPoints(this.to,!0);this.fromPoints=n?Array.isArray(n)?n:[n]:[],this.toPoints=r?Array.isArray(r)?r:[r]:[];const a=new Map;this.fromPoints.forEach((t=>{t.context&&a.set(t.context,t)}));let o,l,h=1/0,c=-1/0;for(let t=0;t=0;t-=1)if(a.has(this.toPoints[t].context)){c=t,l=a.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(c)?(this.clipRange=this.toPoints[c][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[c][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=_t(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let d=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=a.get(t.context);return i?(d=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ec&&l?[l,t]:[d,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new re(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(t)return Object.keys(this.to).forEach((t=>{this.target.attribute[t]=this.to[t]})),this.target.addUpdatePositionTag(),void this.target.addUpdateShapeAndBoundsTag();if(this.points=this.points.map(((t,i)=>{const s=ed(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));this.target.setAttributes({clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.target.attribute.segments=e}else this.target.attribute.points=this.points;this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Xw extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0}));const o=this.target.getFinalAttribute();o&&this.target.setAttributes(o),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(a)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Kw extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Object.assign(this.target.attribute,i),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class qw extends Xw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class Zw extends Kw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}const Jw=(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.getFinalAttribute();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.getFinalAttribute();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)};class Qw extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this._updateFunction=null}updateStartAngle(t){this.target.attribute.startAngle=this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t}updateEndAngle(t){this.target.attribute.endAngle=this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class tC extends Qw{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=Jw(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r),this.determineUpdateFunction()}}class eC extends Qw{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class iC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/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:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class sC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const nC=(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,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:u(l)?void 0:c,height:u(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class rC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=nC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class aC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:u(o)?void 0:h,height:u(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const oC=(t,e,i)=>{const s=t.getFinalAttribute().points,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.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class lC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(this.target.attribute.points=r.map(((t,i)=>ed(r[i],a[i],e))),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class hC extends lC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:oC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class cC extends lC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:oC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const dC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class uC extends lC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:dC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class pC extends lC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:dC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const gC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class fC extends lC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:gC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class mC extends lC{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:gC(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const vC=(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.getFinalAttribute(),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.getFinalAttribute();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)};class _C extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class yC extends _C{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=vC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}}class bC extends _C{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const xC=(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.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:u(a)?void 0:l,width:u(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class SC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=xC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class AC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class kC extends Mw{onBind(){var t;const e=ww(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;this.target.setAttributes({x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class MC extends Mw{onBind(){const t=ww(this.target);this._animator=t;const e=this.duration,i=this.easing,{config:s,diffAttrs:n}=this.params;t.animate(this.target,{type:"to",to:Object.assign({},n),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},n)}}),this.completeBind(t)}deleteSelfAttr(t){super.deleteSelfAttr(t),this._animator.deleteSelfAttr(t)}tryPreventConflict(){}}function TC(){zk(),Vk(),qk(),iM(),pw.registerBuiltInAnimate("axisEnter",kC),pw.registerBuiltInAnimate("axisUpdate",MC)}var wC=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{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=pf.group({zIndex:999});e.name=vT.axisBreak,e.id=this._getNodeId(`${vT.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=j({},xT,s),a=null!==(e=r.size)&&void 0!==e?e:xT.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=pf.symbol(Object.assign({x:s.x,y:s.y},o));l.name=vT.axisBreakSymbol;const h=pf.symbol(Object.assign({x:n.x,y:n.y},o));h.name=vT.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=pf.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=vT.background,n.id=this._getNodeId("background"),n.states=j({},yT,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new UM(Object.assign({},t));e.name=vT.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=wC(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];P(l)||(c.state={line:j({},yT,l),symbol:j({},yT,l)});const d=new fT(c);d.name=vT.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return gt(t[0],0)?gt(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}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:d}=s,p=wC(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),_=this.getRelativeVector();let y=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+L(this.attribute,"label.space",4);y+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===_[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?y+=i+(e-1)*t:y=0}else if(0===_[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;y+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}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.getActualOffset(x),A=this.getVerticalCoord(v,S,!1),M=this.getVerticalVector(S,!1,{x:0,y:0});let T,w,{angle:C}=p;if(T="start"===n?"start":"end"===n?"end":"center",u(C)&&o){C=PM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;w=1==-1*t?"bottom":"top"}else T=this.getTextAlign(M),w=this.getTextBaseline(M,!1);let E=d;if(u(E)){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(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=s-S;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=s-S}const B=Object.assign(Object.assign(Object.assign({},A),p),{maxWidth:E,textStyle:Object.assign({textAlign:T,textBaseline:w},a),state:{text:j({},yT,c.text),shape:j({},yT,c.shape),panel:j({},yT,c.background)}});return B.angle=C,l&&l.visible&&(B.shape=Object.assign({visible:!0},l.style),l.space&&(B.space=l.space)),h&&h.visible&&(B.panel=Object.assign({visible:!0},h.style)),B}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:d}=s,p=wC(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),_=this.getVerticalVector(m,!1,{x:0,y:0});let y,{angle:b}=p,x="center";if(u(b)&&a){b=PM(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;y=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(_,!1,o.angle);x=t,y=e}const S=d,A=h?h(c):c,k=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:y},o),text:A});return k.angle=b,l&&l.visible&&(k.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),k}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return gt(t[1],0)?i=!gt(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 GT(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return YT(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=$(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(P(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(P(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,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=oe(e)})),UT(i,t),!VT(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=kT(a),l=AT(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=XT(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);k(i)&&(c=$t(c,i))}}else{if(l){const i=XT(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);k(i)&&(c=$t(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&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);$T(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&NT(t,{orient:o,method:m,separation:v,lastVisible:_,firstVisible: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=pf.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=vT.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-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(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 f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=RM(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=ai(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(){super.release(),this._breaks=null}}CC.defaultAttributes=bT,G(CC,KT);class EC{isInValidValue(t){const{startAngle:e=nM,endAngle:i=rM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=nM,endAngle:i=rM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return ce(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return wT(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function BC(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=BC(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var RC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),k(l)&&l>=3){const t=CT(n,l,c,e,i);h=pf.path(Object.assign(Object.assign({},a.style),{path:ET(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=pf.circle(t)}h.name=vT.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=j({},yT,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=RC(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=L(this.attribute.label,"style.fontSize",12)+L(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=n+m+f+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:j({},yT,d.text),shape:j({},yT,d.shape),panel:j({},yT,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;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(gt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=BC(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&PC(e,c,i)}else e.AABBBounds.width()>r&&PC(e,r,i)}else o>a.x&&h.x2>n.x2?(PC(e,n.x2-o,i),r&&LC(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return gt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}OC.defaultAttributes=bT,G(OC,EC);const IC=t=>t.map(((t,e)=>({index:e,value:t}))),DC=(t,e,i=0)=>{const s=new Ve(t).expand(i/2),n=new Ve(e).expand(i/2);return s.intersects(n)},FC=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=oe(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;u||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=LM(a),_=t.range();let y=[];for(let i=0;i{HC[t]=!0}));const GC=t=>-Math.log(-t),YC=t=>-Math.exp(-t),$C=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,XC=t=>10===t?$C:t===Math.E?Math.exp:e=>Math.pow(t,e),KC=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),qC=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),ZC=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function JC(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 QC(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function tE(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function eE(t,e,i,s){return 1===i&&(i=0),tE(t,i,s)*(e/(1-i))}function iE(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function sE(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=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 rE{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=iE(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=_t(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}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const aE=Symbol("implicit");class oE extends rE{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=jC.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=aE}clone(){const t=(new oE).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!==aE)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&&a>1;)a-=1,r=Math.floor((e-t)/a);return lE(t,e,r,n)}class cE extends oE{constructor(t){super(),this.type=jC.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=eE(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)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("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),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]}}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(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:hE(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=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(t=10){const e=this.calculateVisibleDomain(this._range);return hE(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=bt(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,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 cE(!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:dE}=ri;function uE(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return kt(t,e);if("string"===i){if(s=ii.parseColorString(e)){const e=dE(ii.parseColorString(t),s);return t=>e(t).formatRgb()}return kt(Number(t),Number(e))}return e instanceof si?dE(t,e):e instanceof ii?dE(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):kt(Number(t),Number(e))}class pE extends rE{constructor(t=WC,e=WC){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=WC,this._piecewise=QC,this._interpolate=uE}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),kt)),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=Mt,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=bt(i[0],i[r-1])),this._piecewise=r>2?sE:QC,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:WC),this.rescale(i)):this._clamp!==WC}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=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 gE=Math.sqrt(50),fE=Math.sqrt(10),mE=Math.sqrt(2),vE=[1,2,5,10],_E=(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=SE(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?bE(0,-(e-1)/s,s):bE((e-1)/s,0,s)},yE=vt(((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 _E(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return _E(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=bE(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=bE(t,e,l);return n&&r.reverse(),r})),SE=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=vE[0];return i>=gE?s=vE[3]:i>=fE?s=vE[2]:i>=mE&&(s=vE[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function AE(t,e,i){const s=(e-t)/Math.max(0,i);return SE(s)}function kE(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;e0;){if(s=AE(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function TE(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 wE=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),CE=vt(((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})),EE=vt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=xE(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?wE(t,e,n):wE(t,e,nE(n)),h=wE(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),BE=vt(((t,e,i,s,n)=>kE(s(t),s(e),i).map((t=>nE(n(t))))));class PE extends pE{constructor(){super(...arguments),this.type=jC.Linear}clone(){var t;const e=new PE;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return yE(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(d(null==e?void 0:e.customTicks))return e.customTicks(this,t);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=xE(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(t=10){const e=this.calculateVisibleDomain(this._range);return kE(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(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r: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}}function RE(t){return e=>-t(-e)}function OE(t=Number.EPSILON){return e=>Math.max(e,t)}class IE extends pE{constructor(){super(KC(10),XC(10)),this.type=jC.Log,this._limit=OE(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new IE).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=KC(this._base),s=XC(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=RE(i),this._pows=RE(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=GC,this.untransformer=YC):(this._logs=i,this._pows=s,this._limit=OE(),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 WC}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return CE(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return EE(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return BE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return BE(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{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))))}}}G(IE,LE);class DE extends PE{constructor(){super(qC(1),ZC(1)),this.type=jC.Symlog,this._const=1}clone(){return(new DE).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=qC(t),this.untransformer=ZC(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return CE(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return EE(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return BE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return BE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}G(DE,LE);class FE{constructor(){this.type=jC.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[lt(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 FE).domain(this._domain).range(this._range).unknown(this._unknown)}}function zE(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function jE(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!NC(t.type))return IC(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return IC([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:u=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),_=f&&f()?f().breakDomains:null,m=_&&_.length?v.filter((t=>_.every((e=>te[1])))):v;else if(p(h))m=zE(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=zE(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:u}):t.d3Ticks(e,{noDecimals:u})))}else{const i=null!==(s=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;m=zE(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:u,customTicks:n}):t.ticks(e,{noDecimals:u,customTicks:n})))}var v,_;const y=t.domain();if(e.labelFirstVisible&&y[0]!==m[0]&&!m.includes(y[0])&&m.unshift(y[0]),e.labelLastVisible&&y[y.length-1]!==m[m.length-1]&&!m.includes(y[y.length-1])&&m.push(y[y.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=zC(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=zC(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=$(l),r=f&&f()?NE.greedy:NE.parity;for(;l.length>=3&&PT(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;BT(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),jE(t,l,a,(e=>BT(e,t,i))),jE(n,l,o,(e=>BT(e,n,i)||!(!a||e===t)&&BT(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),$(h)!==$(m)&&h.push($(m))),m=h}}return IC(m)},NE={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&BT(i,t,e)||(i=t,0))))}},VE=(t,e,i,s)=>{const n=zC(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},UE=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,WE=(t,e)=>t[1]{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),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?IC([s[s.length-1]]):IC([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:f,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=K(g),a=X(g);if(s.length<=f/n){const i=VE(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=YE(s,i,o,e.labelLastVisible,Math.floor(n/l),!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=VE(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!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])){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&&!UE(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?WE(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{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=LM(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=ce({x:0,y:0},i,t),a=TT(r,wT(s,r,e,n));return o=a,l=wT(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return _.align||(gt(y,f.x)?_.baseline||(_.baseline=b>f.y?"top":"bottom"):y>f.x?_.align="left":y{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||h<=0)return IC(t.domain());let c;if(p(n))c=t.stepTicks(n);else if(p(s))c=t.forceTicks(s);else if(p(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=d(i)?i({axisLength:s,labelStyle:l}):i;c=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=$E(t,i,e),r=K(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=KE(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-p)}else c=t.domain();return IC(c)},KE=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&DC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},qE=new Uint32Array(33),ZE=new Uint32Array(33);ZE[0]=0,qE[0]=~ZE[0];for(let t=1;t<=32;++t)ZE[t]=ZE[t-1]<<1|1,qE[t]=~ZE[t];function JE(t,e,i={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:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&qE[31&o]&ZE[1+(31&l)])return!0}else{if(i[h]&qE[31&o])return!0;if(i[c]&ZE[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,qE[31&o]&ZE[1+(31&l)]);else for(s(h,qE[31&o]),s(c,ZE[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,ZE[31&a]|qE[1+(31&o)]);else for(n(l,ZE[31&a]),n(h,qE[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=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 QE(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=_t(i,-o,t.width+l),d=_t(s,-o,t.width+l),u=_t(n,-a,t.height+h),p=_t(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function tB(t,e,i=!1){return i?QE(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function eB(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=tB(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=QE(t,r)),e.getRange(r)))}function iB(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>p(t))),u=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return iB(t,e,n,o,h,c,l)}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 iB(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 iB(t,e,n,s,h,c)}return!1}const nB=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],rB=["top","inside-top","inside"];function aB(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let _=0,y=0;return u<0-h?_=-u:p>m&&(_=m-p),g<0-l?y=-g:f>v&&(y=v-f),{dx:_,dy:y}}const oB={mode:"same-time",duration:300,easing:"linear"};function lB(t){return 3===t||4===t}function hB(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 cB=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 dB(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)}}var uB=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{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const fB=(t,e)=>Math.ceil(t)>Math.floor(e),mB=([t,e],[i,s])=>s>t&&e>i;function vB(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}var _B=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{const e=t.target;e===this._lastHover||P(e.states)||(e.addState(oM.hover,!0),_M(this,(t=>{t===e||P(t.states)||t.addState(oM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(_M(this,(t=>{P(t.states)||(t.removeState(oM.hoverReverse),t.removeState(oM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void _M(this,(t=>{P(t.states)||(t.removeState(oM.selectedReverse),t.removeState(oM.selected))}));P(e.states)||(e.addState(oM.selected,!0),_M(this,(t=>{t===e||P(t.states)||t.addState(oM.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)===qo.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===qo.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(Ae(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,f=p-d;return[dB(g,f,c,d,a,o),dB(-g,-f,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds)}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=pf.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Wl)}return e&&e.getAttributes(!0).fill&&s.setAttribute("stroke",e.getAttributes(!0).fill),this.attribute.line&&!P(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;const t=[];!1!==this._enableAnimation&&this._baseMarks.forEach((e=>{t.push(e.attribute),e.initAttributes(e.getAttributes(!0))}));const{overlap:e,smartInvert:i,dataFilter:s,customLayoutFunc:n,customOverlapFunc:r}=this.attribute;let a=this.attribute.data;if(d(s)&&(a=s(a)),a&&a.length){const t=new Set;a=a.filter((e=>!t.has(e.id)&&t.add(e.id)))}let o=this._initText(a);o=d(n)?n(a,o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(o);const l=[],h=o;if(!c(e)&&d(null==e?void 0:e.filterBeforeOverlap)){const t=this.getRelatedGraphic.bind(this);o.forEach((i=>{e.filterBeforeOverlap(i,t,this)?h.push(i):l.push(i)}))}d(r)?o=r(h,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(l):!1!==e&&(o=this._overlapping(h).concat(l)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),o&&o.length&&o.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==i&&this._smartInvert(o),this._renderLabels(o),!1!==this._enableAnimation&&this._baseMarks.forEach(((e,i)=>{e.initAttributes(t[i])}))}_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&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(e)&&(t.states=e)}_createLabelText(t){var e,i;return DM(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;const i=[];let s;if(s=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),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&fB(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&fB(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(gt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(vB([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!mB([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let y=0,b=t.length-1;for(;y<=b;)y===b?_.push(t[y]):(_.push(t[y]),_.push(t[b])),y++,b--;return _}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&s.setRange(tB(i,t.AABBBounds,!0))}))),h.length>0&&h.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&&s.setRange(tB(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(tB(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){var s;if(t){if(!1!==t.attribute.visible){if(null===(s=t.context)||void 0===s?void 0:s.animationState){const e=t.clone();return Object.assign(e.attribute,t.getAttributes(!0)),e.AABBBounds}return t.AABBBounds}const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:n,y:r}=e;return{x1:n,x2:n,y1:r,y2:r}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:p}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{bB[t]=e};var SB=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{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,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*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}AB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const kB=()=>{xB("symbol",AB),xB("line-data",AB)};var MB=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{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}})(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}}}TB.tag="rect-label",TB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var wB=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{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=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}}(t,e,i,s)}};CB.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const EB=()=>{xB("line",CB),xB("area",CB)};var BB=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);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=d(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=d(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}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),h=l.getAttributes(!0),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.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=(h.startAngle+h.endAngle)/2,u=h.endAngle-h.startAngle,p=fe(h.endAngle-u/2),g=ce(c,h.outerRadius,o),f=ce(c,a+e.line.line1MinLength,o),m=new PB(t,g,f,p,u,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=ce(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(d=m.quadrant)||2===d?this._arcRight.set(m.refDatum,m):lB(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var d}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":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 f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,_=0;if("inside"===o&&(_="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=ce(t.circleCenter,v,t.middleAngle),t.labelLimit=f,ft(f,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.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=lB(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=lB(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.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 c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(mt(t.pointB.x,this._line2MinLength+h)||ft(t.pointB.x,c-this._line2MinLength-h))&&(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(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;k(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=lB(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-y-c:0+y+c;break;default:m=p.x+f*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+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?lB(t.quadrant)?"left":"right":lB(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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*(lB(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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,f,m;if(gt(l/2,u))g=0,f=1,m=-p;else if(gt(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,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,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?gt(v[0].y,v[1].y)?ft(t.middleAngle,-Math.PI)&&mt(t.middleAngle,0)||ft(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.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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;e{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 IB(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=ae.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 DB(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=ET(t,!!n),o=ET(r,!!n);const h=ae.distancePP(s,l),c=ae.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=IB(e,t,!1,!!n),o=IB(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=ET(t,!!n),o=ET(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}OB.defaultAttributes={pickable:!1};class FB extends tb{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&MT(this._innerView),this.removeAllChild(!0),this._innerView=pf.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 TT(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:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${vT.grid}-sub`:`${vT.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=ET(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=IB(t,o,!1,!!a)}const u=pf.path(Object.assign({path:c,z:l},d(r)?j({},this.skipDefault?null:FB.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 f=ET(o,!!a),m=Ut(o[0].x-o[1].x),v=Ut(o[0].y-o[1].y),_=pf.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*jt/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?j({},this.skipDefault?null:FB.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],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!gt(a.value,0)&&!gt(l.value,0),d=!gt(a.value,1)&&!gt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}FB.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},zk(),Wk();class zB extends FB{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},FB.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=nM,endAngle:r=rM}=this.attribute;i=CT(t,s,ae.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=j({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);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})}}G(zB,KT);var jB,HB,NB,VB=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){const e=this._getPointsOfSubGrid(p,d);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"})}}G(UB,EC),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(jB||(jB={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(HB||(HB={})),function(t){t.dataZoomChange="dataZoomChange"}(NB||(NB={}));const WB="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",GB={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:WB,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:WB,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},YB={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}},$B=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var XB=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;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto"},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,k,M,T;const{orient:w,middleHandlerStyle:C={},startHandlerStyle:E={},endHandlerStyle:B={},zoomLock:P}=this.attribute,{start:L,end:R}=this._getState(),{position:O,width:I,height:D}=this._getLayoutAttrFromConfig(),F=null!==(t=E.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=B.triggerMinSize)&&void 0!==e?e:40,j=this._getContainer();if(this._isHorizontal){if(C.visible){const t=(null===(i=C.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:O.x+L*I,y:O.y-t,width:(R-L)*I,height:t},null===(s=C.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=C.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:O.x+(L+R)/2*I,y:O.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=C.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square"},C.icon),{pickable:!P&&(null===(h=C.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:O.x+L*I,y:O.y+D/2,size:D,symbolType:null!==(c=E.symbolType)&&void 0!==c?c:"square"},YB.horizontal),E),{pickable:!P&&(null===(d=E.pickable)||void 0===d||d)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:O.x+R*I,y:O.y+D/2,size:D,symbolType:null!==(u=B.symbolType)&&void 0!==u?u:"square"},YB.horizontal),B),{pickable:!P&&(null===(p=B.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:O.x+L*I-t/2,y:O.y+D/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:999},YB.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:O.x+R*I-g/2,y:O.y+D/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:999},YB.horizontal),{pickable:!P}),"rect")}else{if(C.visible){const t=(null===(g=C.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===w?O.x-t:O.x+I,y:O.y+L*D,width:t,height:(R-L)*D},null===(f=C.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(_=null===(v=null===(m=C.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===_||_)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===w?O.x-t/2:O.x+I+t/2,y:O.y+(L+R)/2*D,angle:Math.PI/180*90,symbolType:null!==(b=null===(y=C.icon)||void 0===y?void 0:y.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0},C.icon),{pickable:!P&&(null===(S=null===(x=C.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:O.x+I/2,y:O.y+L*D,size:I,symbolType:null!==(A=E.symbolType)&&void 0!==A?A:"square"},YB.vertical),E),{pickable:!P&&(null===(k=E.pickable)||void 0===k||k)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:O.x+I/2,y:O.y+R*D,size:I,symbolType:null!==(M=B.symbolType)&&void 0!==M?M:"square"},YB.vertical),B),{pickable:!P&&(null===(T=B.pickable)||void 0===T||T)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:O.x+I/2+t/2,y:O.y+L*D-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},YB.vertical),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:O.x+I/2+i/2,y:O.y+R*D-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},YB.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move"},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move"},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_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))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){return t.length<=10||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,void 0!==e?e*e:1)}(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(t);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(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){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 Ne).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)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=XB(c,["formatMethod"]),{formatMethod:g}=d,f=XB(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:_,width:y,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,A={x1:_.x,y1:_.y,x2:_.x+y,y2:_.y+b};let k,M,T,w;this._isHorizontal?(k={x:_.x+m*y,y:_.y+b/2},M={x:_.x+v*y,y:_.y+b/2},T={textAlign:$B(A,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},w={textAlign:$B(A,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:_.x+y/2,y:_.y+m*b},M={x:_.x+y/2,y:_.y+v*b},T={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:$B(A,t,"start",this._isHorizontal)?"top":"bottom"},w={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:$B(A,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),j({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),j({},f,{text:S,x:M.x,y:M.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new UM(e),s.name=i,t.add(s)),s}}const qB={debounce:St,throttle:At};class ZB extends l{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=jB.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=jB.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=jB.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=jB.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=jB.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===k_.env?k_:this.stage,s=dM();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===jB.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===jB.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===jB.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===jB.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(HB.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(HB.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(HB.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===jB.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(HB.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(HB.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:qB[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===k_.env?k_:this.stage,e=dM();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===k_.env?k_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===k_.env?k_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:_t(e+t,0,1),end:_t(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=jB.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}NM(),Xk(),tM(),Lk(),Vk();let JB=class t extends tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,_;h.visible?this._isHorizontal?(m=p,v=g-f,_={x:a.x,y:a.y+f}):(m=p-f,v=g,_={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(y+b)/2,_={x:_.x+y/2,y:_.y}):(v-=(y+b)/2,_={x:_.x,y:_.y+y/2})),v+=(null!==(n=u.lineWidth)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:_,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new KB(this._getRendererAttrs()),this._interaction=new ZB(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(HB.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(HB.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(NB.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(HB.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;p(t)&&p(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(NB.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.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._renderer.previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._renderer.statePointToData=t)}};var QB,tP,eP,iP;function sP(){zk(),NM(),Aw()}JB.defaultAttributes=GB,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"}(QB||(QB={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(tP||(tP={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(eP||(eP={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(iP||(iP={}));class nP extends tb{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=LT(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=RT(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=OT(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:j({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:j({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:j({},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=pf.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=pf.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=pf.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 rP(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 aP(t,e,i,s){t&&(rP(t.startSymbol,e,i,s),t.lines.forEach((t=>rP(t,e,i,s))),rP(t.line,e,i,s),rP(t.endSymbol,e,i,s))}function oP(t,e,i,s){t&&(rP(t.getTextShape(),e,i,s),rP(t.getBgRect(),e,i,s))}function lP(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 hP(t,e,i,s){t&&(lP(t.startSymbol,e,i,s),t.lines.forEach((t=>lP(t,e,i,s))),lP(t.line,e,i,s),lP(t.endSymbol,e,i,s))}function cP(t,e,i,s){t&&(lP(t.getTextShape(),e,i,s),lP(t.getBgRect(),e,i,s))}function dP(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;rP(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)})),rP(t.endSymbol,s+r+a,o,n),Y(e).forEach((t=>{const e=s+r+a+o;rP(t.getTextShape(),e,l,n),rP(t.getBgRect(),e,l,n)}))}function uP(t,e,i,s,n){aP(t,s,i,n),Y(e).forEach((t=>{oP(t,s,i,n)}))}function pP(t,e,i,s,n){rP(t,s,i,n),Y(e).forEach((t=>{oP(t,s,i,n)}))}function gP(t,e,i,s,n){rP(t,s,i,n),Y(e).forEach((t=>{oP(t,s,i,n)}))}function fP(t,e,i,s,n,r){var a;aP(t,n,s,r),rP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?oP(i,n,s,r):rP(i,n,s,r)}function mP(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;rP(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)})),rP(e,n+o+l,h,r),rP(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(rP(i.getTextShape(),n+o+l+h+c,d,r),rP(i.getBgRect(),n+o+l+c,d,r)):rP(i,n+o+l+c,d,r)}function vP(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?dP(t,e,s,r,a):"fadeIn"===i&&uP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?dP(t,e,s,n,a):"fadeIn"===i&&uP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){hP(t,s,i,n),Y(e).forEach((t=>{cP(t,s,i,n)}))}(t,e,i,s,n)}}function _P(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&&pP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&pP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){lP(t,s,i,n),Y(e).forEach((t=>{cP(t,s,i,n)}))}(t,e,i,s,n)}}function yP(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&&gP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&gP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){lP(t,s,i,n),Y(e).forEach((t=>{cP(t,s,i,n)}))}(t,e,i,s,n)}}function bP(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?fP(n,r,e,i,s,o):"callIn"===t&&mP(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?fP(n,r,e,i,s,a):"callIn"===t&&mP(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;hP(t,n,s,r),lP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?cP(i,n,s,r):lP(i,n,s,r)}(n,r,e,t,i,s)}}const xP={type:"clipIn",duration:500,easing:"linear",delay:0},SP={type:"fadeIn",duration:500,easing:"linear",delay:0},AP={type:"callIn",duration:500,easing:"linear",delay:0},kP={type:"fadeOut",duration:500,easing:"linear",delay:0};class MP{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=Y(null==n?void 0:n.label),a=Y(null==n?void 0:n.labelBackground),o=Y(s).map(((s,n)=>{var o,l;const h=j({},i,s),c=new UM(Object.assign(Object.assign({},h),{state:{panel:j({},lM,null!==(o=a[n])&&void 0!==o?o:$(a)),text:j({},lM,null!==(l=r[n])&&void 0!==l?l:$(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===Y(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=Y(this._label),n=Y(null==i?void 0:i.label),r=Y(null==i?void 0:i.labelBackground);if(s.length){const i=Y(e);s.forEach(((e,s)=>{var a,o;const l=j({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:j({},lM,null!==(a=r[s])&&void 0!==a?a:$(r)),text:j({},lM,null!==(o=n[s])&&void 0!==o?o:$(n))}})),this.setLabelPos(e,l)}))}}}class TP extends nP{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=xP,this.defaultExitAnimation=kP}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;HM(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}G(TP,MP);const wP=.001,CP={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:QB.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]}},EP={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"}}},BP={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:{autoRotate:!0,position:eP.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]}},PP={interactive:!0,label:{position:tP.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}},LP={interactive:!0,label:{autoRotate:!0,position:eP.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}},RP={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"}},OP={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"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},IP={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 DP(){FP._animate=vP}sP(),pT(),Aw();class FP extends TP{markerAnimate(t){FP._animate&&this._animationConfig&&FP._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},FP.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i: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,e){var i;return(bM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return xM(Math.abs(e),Math.PI/2,wP)||xM(Math.abs(e),3*Math.PI/2,wP)?SM(i,e,t):bM(e)?EP.postiveXAxis[t]:EP.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new fT({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:j({},lM,null==a?void 0:a.line),startSymbol:j({},lM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},lM,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:j({},lM,null==a?void 0:a.line),startSymbol:j({},lM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},lM,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}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",FP.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(FP.defaultAttributes.label)}}function zP(){jP._animate=_P}FP.defaultAttributes=CP,sP(),Yk(),Aw();class jP extends nP{markerAnimate(t){jP._animate&&this._animationConfig&&jP._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},jP.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=SP,this.defaultExitAnimation=kP}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},OP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;HM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=pf.polygon(Object.assign({points:e},i));n.states=j({},lM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",jP.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=j({},lM,null==i?void 0:i.area)),this._updateMarkLabels(jP.defaultAttributes.label)}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}}jP.defaultAttributes=PP,G(jP,MP),sP(),gT(),Aw();class HP extends TP{markerAnimate(t){HP._animate&&this._animationConfig&&HP._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},HP.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case eP.arcInnerStart:l=n;case eP.arcOuterStart:l=n;break;case eP.arcInnerEnd:l=r;case eP.arcOuterEnd:l=r;break;case eP.center:case eP.arcInnerMiddle:case eP.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return RP[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new mT({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:j({},lM,null==o?void 0:o.line),startSymbol:j({},lM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},lM,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:j({},lM,null==o?void 0:o.line),startSymbol:j({},lM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},lM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",HP.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(HP.defaultAttributes.label)}}HP.defaultAttributes=BP,sP(),Bk(),Aw();class NP extends nP{markerAnimate(t){NP._animate&&this._animationConfig&&NP._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},NP.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=SP,this.defaultExitAnimation=kP}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case eP.center:h=(s+n)/2,c=(r+a)/2;break;case eP.arcInnerStart:h=s,c=r;break;case eP.arcOuterStart:h=n,c=r;break;case eP.arcInnerEnd:h=s,c=a;break;case eP.arcOuterEnd:h=n,c=a;break;case eP.arcInnerMiddle:h=s,c=(r+a)/2;break;case eP.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},RP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;HM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=pf.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=j({},lM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",NP.defaultAttributes.label)}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=j({},lM,null==o?void 0:o.area)),this._updateMarkLabels(NP.defaultAttributes.label)}isValidPoints(){return!0}}function VP(){UP._animate=bP}NP.defaultAttributes=LP,G(NP,MP),sP(),pT(),gT(),tM(),Hk(),Vk(),Aw();class UP extends nP{markerAnimate(t){UP._animate&&this._animationConfig&&UP._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},UP.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=AP,this.defaultExitAnimation=kP,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return xM(Math.abs(s),Math.PI/2,wP)||xM(Math.abs(s),3*Math.PI/2,wP)?SM(t,s,n):bM(s)?IP.postiveXAxis[n]:IP.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,style:d,position:u=iP.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-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,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:j({},lM,null==p?void 0:p.textBackground),text:j({},lM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=j({},lM,null==p?void 0:p.itemContent));const v=bM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+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",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=pf.symbol(Object.assign(Object.assign({},i),r)),o.states=j({},lM,null==s?void 0:s.itemContent)):"text"===n?o=new UM(Object.assign(Object.assign({},i),{state:{panel:j({},lM,null==s?void 0:s.textBackground),text:j({},lM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=pf.richtext(Object.assign(Object.assign({},i),r)),o.states=j({},lM,null==s?void 0:s.itemContent)):"image"===n?(o=pf.image(Object.assign(Object.assign({},i),r)),o.states=j({},lM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=j({},lM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}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=xM(c,0,wP)||xM(d,0,wP),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=zM(e-u,t-d),o=zM(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*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(JP.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(JP.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===JP.focus||"focus"===o){const s=a.hasState(qP.focus);a.toggleState(qP.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[qP.unSelected,qP.unSelectedHover,qP.focus],t),this._setLegendItemState(e,qP.selected,t)})):(this._setLegendItemState(a,qP.selected,t),this._removeLegendItemState(a,[qP.unSelected,qP.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[qP.selected,qP.selectedHover,qP.focus],t),this._setLegendItemState(e,qP.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(qP.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(qP.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(ZP.legendItemClick,a,t);i?(this._removeLegendItemState(a,[qP.selected,qP.selectedHover],t),this._setLegendItemState(a,qP.unSelected,t)):(this._setLegendItemState(a,qP.selected,t),this._removeLegendItemState(a,[qP.unSelected,qP.unSelectedHover],t))}else this._setLegendItemState(a,qP.selected,t),this._removeLegendItemState(a,[qP.unSelected,qP.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[qP.selected,qP.selectedHover],t),this._setLegendItemState(e,qP.unSelected,t))}))}this._dispatchLegendEvent(ZP.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,qP.selected),this._removeLegendItemState(e,[qP.unSelected,qP.unSelectedHover])):(this._removeLegendItemState(e,[qP.selected,qP.selectedHover]),this._setLegendItemState(e,qP.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=$P,spaceRow:l=XP,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:u?i:e,v=this._contentMaxHeight;let _,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,M=0,T=0;const w=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),_=d[t],_.id||(_.id=_.label),_.index=t;let e=!0;y(n)&&(e=n.includes(_.label));const i=this._renderEachItem(_,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||w.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=T+l,T=0,w.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),w.push(i)):(p(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=M+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=pf.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:u}=t,g=[];p(c)&&g.push(c),p(d)&&g.push(d),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=K(g)),p(u)&&(this._itemHeightByUser=u);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,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:f,autoEllipsisStrategy:m}=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=ai(c);let w;!1===x.visible?(w=pf.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,JP.item,t,w)):(w=pf.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,JP.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?qP.selected:qP.unSelected);const C=pf.group({x:0,y:0,pickable:!1});w.add(C);let E,B=0,P=0,R=0;if(v&&!1!==v.visible){const i=L(S,"style.size",10);P=y(i)?i[0]||0:i,R=L(v,"space",8);const s=pf.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,JP.itemShape,t,w,S.state),s.addState(e?qP.selected:qP.unSelected),C.add(s)}let O=0;if(d){const e=L(g,"size",10);E=pf.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,JP.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=DM(Object.assign(Object.assign({x:P/2+R,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,JP.itemLabel,t,w,A.state),D.addState(e?qP.selected:qP.unSelected),C.add(D);const F=L(_,"space",8);if(p(l)){const s=L(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=DM(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,JP.itemValue,t,w,k.state),r.addState(e?qP.selected:qP.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-P-R-F-O-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-P/2-T[1]-T[3]-O-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));B=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-P-R-O),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",B),C.add(E));const z=C.AABBBounds,j=z.width();if("right"===f){const t=z.x2,e=z.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=z.height(),N=p(this.attribute.item.width)?this.attribute.item.width:j+T[1]+T[3],V=this._itemHeightByUser||H+T[0]+T[2];return w.attribute.width=N,w.attribute.height=V,E&&E.setAttribute("visible",!1),C.translateTo(-z.x1+T[3],-z.y1+T[0]),w}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new YP(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},j({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new YP(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new pM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new pM(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?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 i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",At(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=$P,spaceRow:o=XP}=n,l=this._itemsContainer,{space:h=KP,defaultCurrent:c=1}=r,d=iL(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,_=0,y=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v0&&(y=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:y,y:b}),y+=a+i})),this._itemContext.startX=y,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),_=p-g.AABBBounds.height()-h-t,_<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;_0&&(b=0,y+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:y,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=pf.group({x:0,y:t,width:u?v:f,height:u?m:_,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=$P,spaceRow:a=XP}=s,o=this._itemsContainer,{space:l=KP,defaultCurrent:h=1}=n,c=iL(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const _=pf.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=pf.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];gt(_t(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),gt(_t(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(qP.selected)?this._setLegendItemState(t,qP.selectedHover,e):this._setLegendItemState(t,qP.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===JP.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(ZP.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(qP.unSelectedHover)||t.hasState(qP.selectedHover))&&(i=!0),t.removeState(qP.unSelectedHover),t.removeState(qP.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(qP.unSelectedHover)&&!t.hasState(qP.selectedHover)||(i=!0),t.removeState(qP.unSelectedHover),t.removeState(qP.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===JP.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(ZP.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(ZP.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!==JP.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(ZP.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!==JP.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(ZP.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(qP.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=j({},sL,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(qP.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}release(){super.release(),this.removeAllEventListeners()}};var rL;function aL(t){return y(t)?t:[t,t]}function oL(t){return t?"ew-resize":"ns-resize"}nL.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:$P,spaceRow:XP,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:KP,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"}(rL||(rL={})),tL();class lL extends tb{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},lL.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=_t(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=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=dM(),n="browser"===k_.env?k_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;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=_t(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=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=dM(),n="browser"===k_.env?k_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{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?_t(t+p,h,c):_t(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?_t(t+p,0,c-h):_t(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=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),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:aL(d)[0],endValue:aL(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=pf.group({x:0,y:0});f.name=rL.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=pf.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)),m.name=rL.startText,f.add(m);const e=p(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const _=pf.group({x:g?v:0,y:g?0:v});f.add(_);const y=pf.group({x:0,y:0});let b;if(y.name=rL.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=pf.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=rL.endText,f.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=pf.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=rL.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,f]=aL(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":oL(p)},r));if(v.name=rL.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=rL.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":oL(p)},r));if(i.name=rL.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f,"end");e.name=rL.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=yt(h,i,s);c=t[0],d=t[1]}else c=i,d=_t(h,i,s);const p=this._isHorizontal;e||(c=i);const f=pf.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=rL.trackContainer;const m=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":oL(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=pf.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=rL.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return pf.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":oL(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),pf.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=pf.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=pf.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),("browser"===k_.env?k_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=dM(),e="browser"===k_.env?k_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_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===rL.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===rL.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===rL.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===rL.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}}release(t){super.release(t),("browser"===k_.env?k_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}lL.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}}},eL(),tL();class hL extends QP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},hL.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:f,handlerText:m,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:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function cL(t="bottom"){let 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`}hL.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"}}},eL(),tL(),Wk();class dL extends QP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},dL.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:f,showTooltip:m,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=pf.group({x:0,y:0});this._innerView.add(x);const S=new lL({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:cL(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,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=pf.path(Object.assign(Object.assign({x:0,y:k,path:A},_),{zIndex:0}));x.add(M);const T=this._title?this._title.AABBBounds.height()+L(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))}}dL.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)"}},zk(),iM(),qk();let uL=class t extends tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,b,x;const{textType:S,text:A,subtextType:k,textStyle:M={},subtext:T,subtextStyle:w={},width:C,height:E,minWidth:B,maxWidth:P,minHeight:L,maxHeight:R,align:O,verticalAlign:I,padding:D=0}=this.attribute,F=ai(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),j=null!==(t=M.height)&&void 0!==t?t:E;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:u="break-word",maxWidth:g,lineClamp:f}=M;if("rich"===S||p(M.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:C)&&void 0!==e?e:0,height:null!=j?j:0,ellipsis:null==d||d,wordBreak:null!=u?u:"break-word",maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:null!==(i=M.character)&&void 0!==i?i:A},M);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},hM),M),x:h,y:c,width:null!==(s=null!=t?t:C)&&void 0!==s?s:0,height:null!=j?j:0,ellipsis:d,wordBreak:u,maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:[]},M);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else p(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(A)?A:[A],whiteSpace:"normal"},M),{maxLineWidth:null!==(r=null!==(n=M.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:C,heightLimit:null!==(a=M.height)&&void 0!==a?a:R,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const H=this._mainTitle?this._mainTitle.AABBBounds.height():0,N=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==w.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=w,v=Math.max(Number.MIN_VALUE,R-H);if("rich"===k||p(w.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:C)&&void 0!==o?o:0,height:null!==(l=null!=e?e:E)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=w.character)&&void 0!==h?h:T},w);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:T},hM),w),x:n,y:r,width:null!==(c=null!=t?t:C)&&void 0!==c?c:0,height:null!==(d=null!=e?e:E)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},w);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else p(T)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(T)?T:[T],whiteSpace:"normal"},w),{maxLineWidth:null!==(u=w.maxLineWidth)&&void 0!==u?u:C,heightLimit:null!==(g=w.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:H}),"text"))}const V=this._subTitle?this._subTitle.AABBBounds.height():0,U=this._subTitle?this._subTitle.AABBBounds.width():0;let W=Math.max(N,U),G=H+(null!==(f=w.height)&&void 0!==f?f:V);if(p(C)&&(W=C),p(E)&&(G=E),p(B)&&WP&&(W=P),p(L)&&GR&&(G=R),z.attribute.width=W,z.attribute.height=G,z.attribute.boundsPadding=F,this._mainTitle){if(p(O)||p(M.align)){const t=M.align?M.align:O,e=null!==(m=M.width)&&void 0!==m?m:W;"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")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:I,e=null!=j?j:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"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")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(p(O)||p(w.align)){const t=w.align?w.align:O,e=null!==(_=null!==(v=w.width)&&void 0!==v?v:M.width)&&void 0!==_?_:W;"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")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=w.verticalAlign?w.verticalAlign:I,e=this._mainTitle?p(j)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),j):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=w.height)&&void 0!==b?b:E)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"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")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};uL.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 pL={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"}}};zk(),iM(),qk();let gL=class extends tb{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=j({},L(pL,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=DM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{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,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(p(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),p(s)){const t=Y(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e: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=RM(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,f=c/2,m=g**2+1,v=2*f*g,_=f**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*m*_))/(2*m))+f),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 fL extends Cg{constructor(t){super(t)}}var mL,vL;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(mL||(mL={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(vL||(vL={}));class _L extends tb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},_L.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"},_L.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"},_L.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},_L.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},_L.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 fL(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new fL(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new fL(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(mL.OnPlay)},this.pause=()=>{this._dispatchEvent(mL.OnPause)},this.forward=()=>{this._dispatchEvent(mL.OnForward)},this.backward=()=>{this._dispatchEvent(mL.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()}}_L.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},_L.defaultAttributes={[vL.Start]:{},[vL.Pause]:{},[vL.Backward]:{},[vL.Forward]:{}};const yL={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},bL=[200,10];var xL,SL;!function(t){t.Default="default",t.Reverse="reverse"}(xL||(xL={})),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"}(SL||(SL={}));const AL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===xL.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===xL.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),kL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===xL.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===xL.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),ML=t=>"top"===t||"bottom"===t;class TL extends tb{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},TL.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=Yt(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(ML(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:bL[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:bL[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 lL(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 t.layout=ML(this._orient)?"horizontal":"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 _L(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=ML(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:bL[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Yt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(ML(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:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:ML(this._orient)?t+s:(this._size.width-r)/2,y:ML(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:ML(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:ML(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:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:ML(this._orient)?t+s:(this._size.width-r)/2,y:ML(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]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function wL(){tL(),zk(),tM()}TL.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({},yL),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},yL),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},yL),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},yL),{key:"backward",position:"start"})}},wL();class CL extends TL{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},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:xL.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(mL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(mL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(mL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(mL.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(SL.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(AL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||kL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===xL.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(SL.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=k_.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(SL.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(SL.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=k_.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(),k_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(SL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,k_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(SL.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(SL.change),this.dispatchCustomEvent(SL.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var EL,BL=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())}))};wL();class PL extends TL{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(mL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(mL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(mL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(mL.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(SL.change))},this.play=()=>BL(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(SL.play),this._rafId=k_.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=k_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,k_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(SL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,k_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(SL.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(SL.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(SL.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.brushActive="brushActive",t.brushClear="brushClear"}(EL||(EL={}));const LL={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],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:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},RL=5;const OL={debounce:St,throttle:At};zk(),Yk();let IL=class t extends tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=LL.updateTrigger,endTrigger:i=LL.endTrigger,brushMoved:s=!0}=this.attribute;Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushingWithDelay))),Y(i).forEach((t=>this.stage.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos]},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:OL[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(EL.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const{trigger:t=LL.trigger,resetTrigger:e=LL.resetTrigger}=this.attribute;Y(t).forEach((t=>this.stage.addEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(EL.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;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,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(EL.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=RL}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(EL.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(EL.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;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._dispatchBrushEvent(EL.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=RL}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(EL.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(EL.brushClear,t)):Math.abs(r-s)this.stage.removeEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents()}_releaseBrushUpdateEvents(){const{updateTrigger:t=LL.updateTrigger,endTrigger:e=LL.endTrigger}=this.attribute;Y(t).forEach((t=>this.stage.removeEventListener(t,this._onBrushingWithDelay))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushEnd)))}_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=pf.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}_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(Le(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_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.ythis._brushMaskAABBBoundsDict[t].empty()))}};IL.defaultAttributes=LL;const DL=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return j(t,...e,{shape:i.every(u)?void 0:j({},...i),key:s.every(u)?void 0:j({},...s),value:n.every(u)?void 0:j({},...n)})},FL=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}},zL={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:aM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:aM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:aM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ve).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},jL=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];zk(),Xk(),tM(),iM(),qk();let HL=class t extends tb{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: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=ai(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",j({symbolType:"circle"},u.shape,{visible:yM(u)&&yM(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:yM(u)&&yM(u.value)},FL(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:yM(u)&&yM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:yM(u)&&yM(u.value)},FL(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},hM),u.value),visible:yM(u)&&yM(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=yM(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:f,textBaseline:m}=u.value,v=n.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 _=yM(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(!yM(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)+(yM(n.key)?r+n.key.spacing:0)+(yM(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&&(FM(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";p(n.value.textAlign)?t=n.value.textAlign:yM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),FM(c,f,t,u,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(yM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=ad(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(yM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},FL(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},FL(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},hM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(yM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},FL(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},FL(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=>jL.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)&&yM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=yM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=LM(d),_=LM(u);let y=0;if(yM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),y=Math.max(y,e)}if(yM(u)){const{width:t,height:e}=_.quickMeasure(u.text);h.push(t),y=Math.max(y,e)}f&&cu[m]&&(t=!0,r.push(p.size),y=Math.max(p.size,y)),e.height=y,o+=y,a{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 DL({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return DL({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};HL.defaultAttributes=zL;const NL=gt;function VL(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:K(i)}function UL(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function WL(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function GL(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 YL(t,e){const i=GL(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 $L(t,e){const i=XL(t),s=XL(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 XL(t,e={x:0,y:0}){return ae.distancePP(t,e)}function KL(t){return k(t.x)&&k(t.y)}function qL(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 ZL(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const JL=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function tR(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&tR(t[i],e)}}var eR,iR,sR;function nR(t){var e,i;const{type:s}=t;return s===iR.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!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.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_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"}(eR||(eR={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",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",t.mosaic="mosaic",t.pictogram="pictogram"}(iR||(iR={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",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.transform="transform",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.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.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(sR||(sR={}));const rR={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},aR={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function oR(t,e){var i;if(!t)return[];const s=gR(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?uR(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>dR(i)?hR(t,i,e):i)).filter(p)}))):i.map((i=>dR(i)?hR(t,i,e):i)).filter(p):[]}return[]}function lR(t,e){var i,s;return uR(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 hR(t,e,i){var s;const n=gR(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=rR[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=aR[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 ii(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=$e(t,i,s),a=Ye(n,r,e.l),l=new ii(`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 cR=(t,e)=>{if(e&&dR(t)){const i=hR(e,t);if(i)return i}return t};function dR(t){return t&&"palette"===t.type&&!!t.key}function uR(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function pR(t){return y(t)?{dataScheme:t}:t}function gR(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=nR(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 fR extends oE{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(!uR(this._range))return void super.range(this._range);const t=lR(this._range,this._domain);super.range(t)}}const mR={linear:PE,band:cE,point:class extends cE{constructor(t){super(!1),this.type=jC.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:oE,threshold:FE,colorOrdinal:fR};function vR(t){const e=mR[t];return e?new e:null}function _R(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function yR(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function bR(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function xR(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function SR(t){return!!_(t)&&(!!t.endsWith("%")&&Zy(t.substring(0,t.length-1)))}function AR(t){return!!g(t)&&("percent"in t||"offset"in t)}function kR(t,e,i,s=0){var n,r;return S(t)?t:SR(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 MR(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]=kR(t[s],e.size,i)}))})),o}function TR(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}}function wR(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)||SR(t)||d(t)||AR(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function CR(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const ER=(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},BR=[{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"]}];function PR(t,e){return t&&e.key in t?t[e.key]:e.default}function LR(t){return t&&"token"===t.type&&!!t.key}const RR={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%"},OR={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:BR,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)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:RR,component:{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}}},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:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},IR={name:"dark",colorScheme:{default:{dataScheme:BR,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",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},DR=(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]={}),DR(t[s],e.slice(1),i))};function FR(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=pR(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}zR._charts={},zR._series={},zR._components={},zR._graphicComponents={},zR._marks={},zR._regions={},zR._animations={},zR._implements={},zR._chartPlugin={},zR._vChartPlugin={},zR._componentPlugin={},zR.transforms={fields:$r,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}},zR.dataParser={csv:(t,e={},i)=>(i.type=Yr.DSV,na(t)),dsv:(t,e={},i)=>{i.type=Yr.DSV;const s=Nr(aa,e),{delimiter:n}=s;if(!_(n))throw new TypeError("Invalid delimiter: must be a string!");return sa(n).parse(t)},tsv:(t,e={},i)=>(i.type=Yr.DSV,ra(t))},zR._layout={},zR._grammarTransforms={},zR._stageEventPlugins={},zR.registerStageEventPlugin=(t,e)=>{zR._stageEventPlugins[t]=e},zR.getStageEventPlugin=t=>zR._stageEventPlugins[t],zR._interactionTriggers={},zR.registerInteractionTrigger=(t,e)=>{zR._interactionTriggers[t]=e},zR._composedEventMap={},zR.registerComposedEvent=(t,e)=>{zR._composedEventMap[t]=e},zR._tooltipProcessors={},zR.registerTooltipProcessor=(t,e)=>{zR._tooltipProcessors[t]=e},zR.createTooltipProcessor=(t,e)=>{const i=zR._tooltipProcessors[t];return i?new i(e):null};const NR=t=>{const e={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"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},VR=NR(),UR={[OR.name]:OR},WR=OR.name,GR=new Map(Object.keys(UR).map((t=>[t,UR[t]]))),YR=new Map,$R=new Map(Object.keys(UR).map((t=>[t,t===WR]))),XR=(t,e)=>{if(!t)return;const i=JR(e);GR.set(t,i),$R.set(t,!0)},KR=(t=WR)=>($R.has(t)&&!$R.get(t)&&XR(t,GR.get(t)),GR.get(t)),qR=t=>GR.delete(t)&&YR.delete(t)&&$R.delete(t),ZR=t=>!!_(t)&&GR.has(t),JR=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:WR;return jR({},KR(i),t)};class QR{static registerInstance(t){QR.instances.set(t.id,t)}static unregisterInstance(t){QR.instances.delete(t.id)}static getInstance(t){return QR.instances.get(t)}static instanceExist(t){return QR.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return QR.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}QR.instances=new Map;class tO{static registerTheme(t,e){XR(t,e)}static getTheme(t,e=!1){return KR(t)}static removeTheme(t){return qR(t)}static themeExist(t){return ZR(t)}static getDefaultTheme(){return tO.themes.get(WR)}static setCurrentTheme(t){tO.themeExist(t)&&(tO._currentThemeName=t,QR.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return tO.getTheme(tO._currentThemeName,t)}static getCurrentThemeName(){return tO._currentThemeName}}function eO(t){return _(t)?tO.themeExist(t)?tO.getTheme(t):{}:g(t)?t:{}}tO.themes=GR,tO._currentThemeName=WR;const iO=["animationThreshold","colorScheme","name","padding"];function sO(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];iO.includes(n)?s[n]=r:m(r)?dR(r)?s[n]=cR(r,e):LR(r)?s[n]=PR(i,r):s[n]=sO(r,e,i):s[n]=r})),s}function nO(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]=nO(t[s],e)}return i}return y(t)?t.map((t=>nO(t,e))):t}function rO(t,e){if(!t)return t;if(m(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]=rO(t[s],e)}return i}return y(t)?t.map((t=>rO(t,e))):t}function aO(t,...e){return d(t)?t(...e):t}const oO=(t,e,i,s)=>((t,e,i)=>LM(t,e,i,{fontFamily:RR.fontFamily,fontSize:RR.fontSize}))(e,i,s).measure(t),lO="__VCHART",hO=500,cO=500,dO=`${lO}_MEASURE_CANVAS_ID`,uO=`${lO}_DEFAULT_DATA_INDEX`,pO=`${lO}_DEFAULT_DATA_KEY`,gO=`${lO}_DEFAULT_DATA_SERIES_FIELD`,fO=`${lO}_DEFAULT_SERIES_STYLE_NAME`,mO=`${lO}_STACK_KEY`,vO=`${lO}_STACK_START`,_O=`${lO}_STACK_END`,yO=`${lO}_STACK_START_PERCENT`,bO=`${lO}_STACK_END_PERCENT`,xO=`${lO}_STACK_START_OffsetSilhouette`,SO=`${lO}_STACK_END_OffsetSilhouette`,AO=`${lO}_STACK_TOTAL`,kO=`${lO}_STACK_TOTAL_PERCENT`,MO=`${lO}_STACK_TOTAL_TOP`,TO=`${lO}_STACK_TOTAL_BOTTOM`,wO=`${lO}_MOSAIC_VALUE_START_PERCENT`,CO=`${lO}_MOSAIC_VALUE_END_PERCENT`,EO=`${lO}_MOSAIC_CAT_START_PERCENT`,BO=`${lO}_MOSAIC_CAT_END_PERCENT`,PO=`${lO}_SEGMENT_START`,LO=`${lO}_SEGMENT_END`,RO=`${lO}_KEY`,OO=`${lO}_MAP_LOOK_UP_KEY`;function IO(t,e){for(let i=0;it.key===e))}function FO(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 zO(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:{groupField:a.groupField,nodes:{}},UO(t,a,n[o],l,e,r))})),s?jO(n):n}function jO(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))):jO(t[e].nodes);return t}function HO(t,e){if("values"in t&&t.values.length){const i=WL(t.values,e),s=UL(t.values,bO);t.values.forEach((t=>{t[AO]=i,t[kO]=s}))}else for(const i in t.nodes)HO(t.nodes[i],e)}function NO(t){if(!t.values.length)return;const e=t.values[t.values.length-1][_O]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)VO(t.nodes[r],e,i,s,n)}function UO(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[_O]=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 l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),UO(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const WO=(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]=YO(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function $O(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>qO(t.style(e,i,s,n)):P(t.style)||(e.style=qO(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>qO(t.state[e](i,s,n,r)):P(t.state[e])||(i[e]=qO(t.state[e]))})),e.state=i}return e}function XO(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>qO(t[i](e,s,n,r)):P(t[i])||(e[i]=qO(t[i]))})),e}function KO(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),qO(i)}function qO(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:oe(t.angle)}):t}const ZO=t=>"line"===t||"area"===t,JO=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return ZO(i)?e:null==e?void 0:e[0]},QO=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let tI=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},n=zR.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{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(zR.getComposedEvent(t))if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};var eI;!function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(eI||(eI={}));const iI=["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 sI,nI,rI;t.ChartEvent=void 0,(sI=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",sI.rendered="rendered",sI.renderFinished="renderFinished",sI.animationFinished="animationFinished",sI.regionSeriesDataFilterOver="regionSeriesDataFilterOver",sI.afterInitData="afterInitData",sI.afterInitEvent="afterInitEvent",sI.afterInitMark="afterInitMark",sI.rawDataUpdate="rawDataUpdate",sI.viewDataFilterOver="viewDataFilterOver",sI.viewDataUpdate="viewDataUpdate",sI.viewDataStatisticsUpdate="viewDataStatisticsUpdate",sI.markDeltaYUpdate="markDeltaYUpdate",sI.viewDataLabelUpdate="viewDataLabelUpdate",sI.scaleDomainUpdate="scaleDomainUpdate",sI.scaleRawDomainUpdate="scaleRawDomainUpdate",sI.scaleUpdate="scaleUpdate",sI.dataZoomChange="dataZoomChange",sI.drill="drill",sI.layoutStart="layoutStart",sI.layoutEnd="layoutEnd",sI.layoutRectUpdate="layoutRectUpdate",sI.playerPlay="playerPlay",sI.playerPause="playerPause",sI.playerEnd="playerEnd",sI.playerChange="playerChange",sI.playerForward="playerForward",sI.playerBackward="playerBackward",sI.scrollBarChange="scrollBarChange",sI.brushStart="brushStart",sI.brushChange="brushChange",sI.brushEnd="brushEnd",sI.brushClear="brushClear",sI.brushActive="brushActive",sI.legendSelectedDataChange="legendSelectedDataChange",sI.legendFilter="legendFilter",sI.legendItemClick="legendItemClick",sI.legendItemHover="legendItemHover",sI.legendItemUnHover="legendItemUnHover",sI.tooltipShow="tooltipShow",sI.tooltipHide="tooltipHide",sI.tooltipRelease="tooltipRelease",sI.afterResize="afterResize",sI.afterRender="afterRender",sI.afterLayout="afterLayout",sI.afterMarkLayoutEnd="afterMarkLayoutEnd",sI.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(nI||(nI={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(rI||(rI={}));const aI=[rI.mark,rI.model,rI.chart,rI.vchart];class oI{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(rI.vchart,[]),this._levelNodes.set(rI.chart,[]),this._levelNodes.set(rI.model,[]),this._levelNodes.set(rI.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const lI={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"};class hI{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=L(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>JO(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||nI.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||nI.chart);o.get(t)||o.set(t,new oI);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||nI.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||nI.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||nI.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||nI.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?aI.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[nI.chart,nI.window,nI.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.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&&L(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 lI[a]&&(a=lI[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)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?rI.model:rI.vchart:rI.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=At(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=St(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=nI.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==rI.model&&s!==rI.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=rI.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case nI.chart:return this._viewBubbles;case nI.window:return this._windowBubbles;case nI.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case nI.chart:return this._viewListeners;case nI.window:return this._windowListeners;case nI.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return iI.includes(t)||Object.values(eI).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&zR.hasInteractionTrigger(e)}}function cI(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function dI(t,e,i){t.getParser(e)||t.registerParser(e,i)}const uI=new Map;let pI;function gI(){pI||(pI=new Ba,dI(pI,"geojson",ka),dI(pI,"topojson",Ta),cI(pI,"simplify",Gr))}function fI(t,e,i={type:"geojson",centroid:!0}){uI.has(t)&&Ny(`map type of '${t}' already exists, will be overwritten.`),gI();const s=new Pa(pI),n=j({},{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}),uI.set(t,s)}function mI(t){uI.has(t)?uI.delete(t):Ny(`map type of '${t}' does not exists.`)}function vI(t,e=!1){let i=e;return t.latestData instanceof Pa&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const _I=(t,e)=>0===t.length?[]:1===t.length?vI(t[0],null==e?void 0:e.deep):t.map((t=>vI(t,null==e?void 0:e.deep)));function yI(e,i,s){cI(i=i instanceof Ba?i:e.dataSet,"copyDataView",_I);const n=new Pa(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function bI(t,e,i=[]){var s;if(t instanceof Pa)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new Pa(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return Ny(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return Ny(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!_(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),Ny("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function xI(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var SI,AI,kI,MI;t.TransformLevel=void 0,(SI=t.TransformLevel||(t.TransformLevel={}))[SI.copyDataView=-10]="copyDataView",SI[SI.treemapFilter=-8]="treemapFilter",SI[SI.treemapFlatten=-7]="treemapFlatten",SI[SI.dotObjFlat=-7]="dotObjFlat",SI[SI.linkDotInfo=-7]="linkDotInfo",SI[SI.sankeyLayout=-7]="sankeyLayout",SI[SI.dataZoomFilter=-6]="dataZoomFilter",SI[SI.legendFilter=-5]="legendFilter",function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(AI||(AI={})),function(t){t.data="data",t.mark="mark"}(kI||(kI={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(MI||(MI={}));const TI=["line","area","trail"];function wI(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(RO,i?t.slice().sort(i):t.slice()),{keys:[RO],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const CI=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function EI(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{EI(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function PI(t,e,i,s){const n=wI(t,(t=>i(t))),r=wI(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!u(t)){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}}const LI=`${lO}_BuiltIn_CallBack_Disappear`;var RI;!function(t){t.render="render",t.disappear="disappear"}(RI||(RI={}));class OI{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(e,i){this._count=0,this._rootMarks=[],this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{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._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var e,i,s,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:u,background:f}=this._option;k_.setEnv(function(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}(o),null!=l?l:{}),this._stage=null!==(e=this._option.stage)&&void 0!==e?e:new z_(Object.assign({background:f,width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,canvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:u},ReactDOM:this._option.ReactDOM,autoRefresh:p(r)?r:!p(a)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{})),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const m=Rp({x:0,y:0,width:this._width,height:this._height});m.name="root",this._stage.defaultLayer.appendChild(m),this._rootGroup=m;const v=(p(h)?h:$y(o))&&!1!==c&&zR.getStageEventPlugin("gesture");v&&(this._gestureController=new v(this._stage,g(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=MI.before}_setCanvasStyle(){if(this._stage&&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")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(k_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=k_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>EI(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>EI(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{EI(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;this._hasCommitedMark()&&(Hy(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),this._rootMarks.forEach((t=>{t.render()})),this._layoutState===MI.before&&(this._layoutState=MI.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=MI.reevaluate,this._hasCommitedMark()&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),this.findProgressiveMarks(),this.updateStateAnimation(),this._doRender(!0),this.doPreProgressive(),Hy(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=BI(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=PI(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=PI(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=wI(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=wI(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}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];y(s)?e[i]="disappear"===i?s.map((t=>{return"function"==typeof(e=t.callBack)&&/^class\s/.test(e.toString())?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:LI,customParameters:{callBack:t.callBack}});var e})):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{EI(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===AI.appear))?AI.appear:e.every((t=>t===AI.disappear))?AI.disappear:AI.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===nI.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=e;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=i.parent,i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:JO(o),markId:h,modelId:c,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===nI.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===nI.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===nI.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===nI.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===nI.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this.releaseGrammar(!0),this._stage!==(null===(t=this._option)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{EI(t,(t=>{t.removeProduct()}),null,!0)})):this._cachedMarks=BI(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return Yy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&function(t){return Su(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Ao.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()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{EI(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=k_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){k_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function II(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:Vy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function DI(t){t.crosshair=Y(t.crosshair||{}).map((e=>FR({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function FI(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}=oi(l,i.width,i.height);a=t,o=e}else if(h&&Yy(e.mode)){let t;t=_(h)?k_.getElementById(h):h;const{width:e,height:s}=oi(t,i.width,i.height);a=e,o=s}else if(Xy(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 zI(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function jI(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}}var HI,NI,VI,UI,WI,GI;t.LayoutZIndex=void 0,(HI=t.LayoutZIndex||(t.LayoutZIndex={}))[HI.SeriesGroup=0]="SeriesGroup",HI[HI.Axis_Grid=50]="Axis_Grid",HI[HI.CrossHair_Grid=100]="CrossHair_Grid",HI[HI.Region=450]="Region",HI[HI.Mark=300]="Mark",HI[HI.Node=400]="Node",HI[HI.Axis=100]="Axis",HI[HI.MarkLine=500]="MarkLine",HI[HI.MarkArea=100]="MarkArea",HI[HI.MarkPoint=500]="MarkPoint",HI[HI.DataZoom=500]="DataZoom",HI[HI.ScrollBar=500]="ScrollBar",HI[HI.Player=500]="Player",HI[HI.Legend=500]="Legend",HI[HI.CrossHair=500]="CrossHair",HI[HI.Indicator=500]="Indicator",HI[HI.Title=500]="Title",HI[HI.Label=500]="Label",HI[HI.Brush=500]="Brush",HI[HI.CustomMark=500]="CustomMark",HI[HI.Interaction=700]="Interaction",t.LayoutLevel=void 0,(NI=t.LayoutLevel||(t.LayoutLevel={}))[NI.Indicator=10]="Indicator",NI[NI.Region=20]="Region",NI[NI.Axis=30]="Axis",NI[NI.DataZoom=40]="DataZoom",NI[NI.Player=40]="Player",NI[NI.ScrollBar=40]="ScrollBar",NI[NI.Legend=50]="Legend",NI[NI.Title=70]="Title",NI[NI.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(VI=t.AttributeLevel||(t.AttributeLevel={}))[VI.Default=0]="Default",VI[VI.Theme=1]="Theme",VI[VI.Chart=2]="Chart",VI[VI.Base_Series=3]="Base_Series",VI[VI.Series=4]="Series",VI[VI.Mark=5]="Mark",VI[VI.User_Chart=6]="User_Chart",VI[VI.User_Series=7]="User_Series",VI[VI.User_Mark=8]="User_Mark",VI[VI.User_SeriesStyle=9]="User_SeriesStyle",VI[VI.Built_In=99]="Built_In";class YI{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({},YI.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]))))}}YI.defaultMarkInfo={};class $I{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class XI{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=>FR({},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 KI extends $I{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}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=XI,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new YI,this._lastLayoutRect=null,this.id=qy(),this.userId=t.id,this._spec=t,this.effect={},this.event=new tI(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){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}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){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_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){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${lO}_${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,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=zR.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_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 L(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}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class qI{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}get lastComputeRect(){return this._lastComputeRect}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}get willLayoutTag(){return this._willLayoutTag}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._willLayoutTag=!0,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){let a=MR(wR(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),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:kR(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:kR(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:kR(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:kR(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:kR(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:kR(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=kR(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=kR(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){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_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]=kR(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(TR(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class ZI extends KI{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,this._transformLayoutPadding=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 qI(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&U(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.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,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 JI extends XI{_initTheme(t,e){return{spec:t,theme:this._theme}}}class QI extends ZI{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=JI,this.modelType="region",this.specKey="region",this.type=QI.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,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"}_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,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[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.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex: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()}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,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(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})}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=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function tD(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 eD(t,e,i){e?t.forEach((t=>{const e=$(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=$(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 iD(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 sD(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=oD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),iD(d,!0,p,l),s&&eD(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function nD(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=oD(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=oD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),iD(d,!1,p,o),s&&eD(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function aD(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=oD(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_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){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_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,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=oD(t,this,e);"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,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=tD(t);n.length&&sD(n,e,i,!1,"left",s),r.length&&sD(r,e,i,!0,"left",s),a.length&&nD(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=tD(t);n.length&&rD(n,e,i,!1,"top",s),r.length&&rD(r,e,i,!0,"top",s),a.length&&aD(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=tD(t);n.length&&sD(n,e,i,!1,"right",s),r.length&&sD(r,e,i,!0,"right",s),a.length&&nD(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=tD(t);n.length&&rD(n,e,i,!1,"bottom",s),r.length&&rD(r,e,i,!0,"bottom",s),a.length&&aD(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=oD(t,this,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=>{U(i.getLayoutRect(),e.rect)||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{rect:i}=oD(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);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+c-l})}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+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&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:Vy)("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}}}lD.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(UI||(UI={})),t.STATE_VALUE_ENUM=void 0,(WI=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",WI.STATE_HOVER="hover",WI.STATE_HOVER_REVERSE="hover_reverse",WI.STATE_DIMENSION_HOVER="dimension_hover",WI.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",WI.STATE_SELECTED="selected",WI.STATE_SELECTED_REVERSE="selected_reverse",WI.STATE_SANKEY_EMPHASIS="selected",WI.STATE_SANKEY_EMPHASIS_REVERSE="blur",WI.STATE_HIGHLIGHT="highlight",WI.STATE_BLUR="blur",WI.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(GI||(GI={}));const hD=["linear","radial","conical"],cD={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const dD={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{dD[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class uD extends $I{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(j(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class pD extends uD{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:{}})}))}_isMultiMark(){return!this._mark||(t=this._mark.type,TI.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!dD[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(y(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(lO)));i=t.datums.some((t=>e&&y(null==t?void 0:t.items)?n.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])})):n.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(lO))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(NC(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class gD extends $I{constructor(){super(...arguments),this.id=qy(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=zR.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class fD extends gD{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}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._data=null,this._data=e}removeProduct(){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const mD=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,vD=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=mD(l.delay,n,a,o),d=mD(l.duration,n,a,o),u=mD(l.oneByOne,n,a,o),p=mD(l.splitPath,n,a,o),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)?Vw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Uw)(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);zw(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{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)?Vw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Uw)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Ow(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Dw(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:qo.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 Fw({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Ew,null!==(l=i.easing)&&void 0!==l?l:Bw))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:qo.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new jw({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Ew,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Bw))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):zw(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},_D=(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))))},yD=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}};class bD extends gD{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}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){u(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];y(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new fD(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}u(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=Rp("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){u(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(){this._product&&this._product.parent&&this._product.parent.removeChild(this._product),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Wl)),i&&(d(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==UI.enter&&t.context.diffState!==UI.update||(t.stateProxy=(e,i)=>{var s;return this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)},t.context.states&&t.useStates(t.context.states,e))},this.name=e,this.model=i.model,this.key=i.key,this.state=new pD(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_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,oe)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];u(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}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){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[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"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&FR(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(VC(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=vR(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),e.clamp&&t.clamp&&t.clamp(e.clamp))}(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=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):hD.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):VC(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=d(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_computeGradientAttr(t){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=t,c=e(t,["gradient","scale","field"]);let u=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(u=t),g||(g=e)}const f=lR(oR(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},cD[o]),c);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==u?void 0:u.scale(t[g]);return d(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=ii.SetOpacity(a,s)),{offset:d(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):d(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];d(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)hD.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=lR(oR(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return wI(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._graphics=t.getGraphics(),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear)}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return zR.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=d(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[pO],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=wI(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===AI.appear))?AI.appear:t.every((t=>t===AI.disappear))?AI.disappear:t[0];return null!=e?e:AI.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{yD(t),s.push(...t.getGraphics())})),e.forEach((t=>{yD(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);vD([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=_D(e,n),r=_D(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===AI.exit?AI.exit:i===AI.update?AI.update:AI.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===UI.exit&&(t.context.reusing=!0,t.animates&&t.animates.forEach((t=>t.stop())))}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===UI.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,d,p,g;let f,m;return u(e)?(f=this._graphicMap.get(t),f&&(m=UI.exit)):u(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=UI.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=UI.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(d=f.context)||void 0===d?void 0:d.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=AI.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=AI.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return CI(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=CI(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(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))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach(((t,e)=>{var i,n;let r=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i.update,t);null===(n=t.currentStates)||void 0===n||n.forEach((e=>{var i;const s=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i[e],t);r=Object.assign(Object.assign({},r),s)})),u(this._markConfig.interactive)||(r.pickable=this._markConfig.interactive);const a=this._transformGraphicAttributes(t,r,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=a}))}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r,a;const o=i.context.finalAttrs,l=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=QO(i,o);i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes({}),i.context.reusing=!1):l||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),!(null===(a=this.renderContext)||void 0===a?void 0:a.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i),e&&i.setFinalAttributes(o)}else{const a=i;i=this._createGraphic(o),e&&(null===(n=i.setFinalAttributes)||void 0===n||n.call(i,o)),i.context=a.context,i.context.diffAttrs=o,i.stateSort=this._stateSort;const l=this._graphics===t?s:s+this._graphics.length-t.length;if(l>=0&&(this._graphics[l]=i),null===(r=this.renderContext)||void 0===r?void 0:r.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,l),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(u(e)||(t.zIndex=e),u(i)||(t.clip=i),!u(s)){const e=y(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return u(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=zR.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=zR.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=Y(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===MI.before||(Hy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{"in"===this.state.checkOneState(i,i.context.data,e)?i.addState(t,!0,this.hasAnimationByState("state")):i.removeState(t,this.hasAnimationByState("state"))}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===UI.exit&&!e.isExiting)if(e.context.animationState===UI.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:UI.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=Rp({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}}var xD;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(xD||(xD={}));class SD extends bD{constructor(){super(...arguments),this.type=SD.type,this._marks=[],this._diffState=UI.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(Ny("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?(Ny("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))}getMarkInUserId(t){let e;return EI(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.diffState===UI.update){const t=this.hasAnimation(),e=QO(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e)),t&&this._product.setFinalAttributes(i)}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=UI.update}render(){this._isCommited&&(Hy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct()}}SD.type="group";const AD={measureText:oO};class kD{static instance(){return kD.instance_||(kD.instance_=new kD),kD.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 MD{constructor(){this.id=qy(),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))?Ny("不要重复添加相同的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 TD extends MD{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)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const wD={type:"fadeIn"};function CD(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 wD;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const ED={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"},state:{duration:300,easing:"linear"}},BD={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},PD={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},LD=()=>{zR.registerAnimation("scaleInOut",(()=>BD))},RD=()=>{zR.registerAnimation("fadeInOut",(()=>PD))},OD=(t,e)=>({appear:CD(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:$w,duration:ED.update.duration,easing:ED.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),ID=()=>{zR.registerAnimation("line",OD)},DD=()=>{pw.registerBuiltInAnimate("growPointsIn",hC),pw.registerBuiltInAnimate("growPointsOut",cC),pw.registerBuiltInAnimate("growPointsXIn",uC),pw.registerBuiltInAnimate("growPointsXOut",pC),pw.registerBuiltInAnimate("growPointsYIn",fC),pw.registerBuiltInAnimate("growPointsYOut",mC),pw.registerBuiltInAnimate("clipIn",qw),pw.registerBuiltInAnimate("clipOut",Zw)},FD=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class zD{constructor(t){this._markSet=new YI,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){y(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.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 jD={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class HD extends zD{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},jD,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}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}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll(e)}}HD.type="element-highlight",HD.defaultOptions=jD;const ND=()=>{zR.registerInteractionTrigger(HD.type,HD)},VD={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class UD extends zD{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},VD,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}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,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),t.addState(i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll(e)}}UD.type="element-select",UD.defaultOptions=VD;const WD=()=>{zR.registerInteractionTrigger(UD.type,UD)};class GD extends MD{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class YD{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>zR.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>zR.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>zR.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return zR.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>zR.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){zR.registerTransform(t,e)}static registerFunction(t,e){t&&e&&kD.instance().registerFunction(t,e)}static unregisterFunction(t){t&&kD.instance().unregisterFunction(t)}static getFunction(t){return t?kD.instance().getFunction(t):null}static getFunctionList(){return kD.instance().getFunctionNameList()}static registerMap(t,e,i){const s=zR.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=zR.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,uI.get(e);var e}static registerSVG(t,e,i){const s=zR.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=zR.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){QR.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 ot.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d,u;this.id=qy(),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._renderState=RI.render,this._disableDimensionHoverEvent=!1,this._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))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;U(n.theme,this._spec.theme)?U(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=zI(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?zR.getSeriesBuiltInTheme(e):zR.getComponentBuiltInTheme(e);i=i?FR({},s,i[e]):s}s===t.length-1&&p(i)&&(i=sO({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},tR(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:y,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=Yy(v);if(S?ax(xo):"node"===v&&oA(xo),S&&f&&(this._container=_(f)?k_.getElementById(f):f),m&&(this._canvas=m),y&&(this._stage=y),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=tO.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[];!1!==b&&A.push("poptipForText"),"sankey"===i.type&&A.push("scrollbar");const k=new ot(null!==(a=this._option.logLevel)&&void 0!==a?a:at.Error);ot.setInstance(k),(null===(o=this._option)||void 0===o?void 0:o.onError)&&k.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._compiler=new OI({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:y,pluginList:A},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new hI(this,this._compiler),this._event=new tI(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),QR.registerInstance(this),null===(u=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===u||u.call(d,this)}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=FR({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=nO(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;YD.getFunctionList()&&YD.getFunctionList().length&&(t=rO(t,YD)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=zR.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=zR.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=zR.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._chartSpecTransformer),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)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=At(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.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 FI(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:hO,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:cO})}_initDataSet(t){this._dataSet=t instanceof Ba?t:new Ba,dI(this._dataSet,"dataview",wa),dI(this._dataSet,"array",s),cI(this._dataSet,"copyDataView",_I);for(const t in zR.transforms)cI(this._dataSet,t,zR.transforms[t]);for(const t in zR.dataParser)dI(this._dataSet,t,zR.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake?(null===(n=this._compiler)||void 0===n||n.releaseGrammar(),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.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.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),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),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(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"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?AI.none:AI.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}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._cachedProcessedTheme=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,QR.unregisterInstance(this)}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):y(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._reSetRenderState(),u(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof Pa?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=bI(t,this._dataSet,s);y(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?FR({},t[n][e.index],i):i):t[n]=s?FR({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?FR({},t[n][r],i):i)}else t.id===e&&(t[n]=s?FR({},t[n],i):i)}))}(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=FR({},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),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,this),!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)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=jR({},e,e.chart[t])),e};let l;if(P(n)&&P(r))l=eO(this._currentThemeName),this._currentTheme=o(a,l);else if(_(n)&&(!r||_(r))||_(r)&&(!n||_(n))){const t=jR({},eO(this._currentThemeName),eO(n),eO(r));this._currentTheme=o(a,t)}else{const t=jR({},eO(this._currentThemeName),eO(n),eO(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),j(GM.poptip,WM,h),null===(s=this._compiler)||void 0===s||s.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=!!Yy(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return eO(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!tO.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),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}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield II(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(!Yy(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;this._chart.resetLayoutItemTag(),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)?k_.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)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(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?CR(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||P(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 Ny("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?CR(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Ny("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return kD.instance().getFunction(t)}registerFunction(t,e){t&&e&&kD.instance().registerFunction(t,e)}unregisterFunction(t){t&&kD.instance().unregisterFunction(t)}getFunctionList(){return kD.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=zR.getChartPlugins();t.length>0&&(this._chartPlugin=new TD(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=zR.getVChartPlugins();e.length>0&&(this._vChartPlugin=new GD(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_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,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=RI.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){this._renderState=RI.render,this.getStage().eventSystem.resumeTriggerEvent()}}YD.InstanceManager=QR,YD.ThemeManager=tO,YD.globalConfig={uniqueTooltip:!0},YD.Utils=AD,YD.vglobal=k_;zR.registerRegion("region",QI),zR.registerLayout("base",lD),Jk(),zk(),zR.registerMark(SD.type,SD),zR.registerStageEventPlugin("gesture",Eb),ND(),WD(),XR(IR.name,IR);const $D="monotone",XD="linear",KD="bevel";function qD(t,e){return e("component",t)}function ZD(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=zR.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));const JD=(t,e,i,s)=>{if(u(t[e]))return;const n=y(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},QD=(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)))},tF=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},eF=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):m(t)&&p(t.field)?L(e,t.field):t,s){const{formatFunc:i,args:r}=ZD(void 0,s,t,e);i&&r&&(n=i(...r))}return n},iF=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const sF=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(y(e.activeType)?e.activeType.includes(t):e.activeType===t)));function nF(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=u(i.key)&&u(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:d,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:_}=l,y=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=aF(eF(h,r,a,c),d,g),o.value=aF(eF(f,r,a,m),v,_),Object.keys(y).forEach((t=>{o[t]=eF(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};y(i)?i.forEach((t=>{o(t)})):o(i)}function rF(t,e,i,s,n,r,a){if(d(e)){nF(t,e(n,a),i,s,r,a)}else e&&nF(t,e,i,s,r,a)}const aF=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=mi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class oF{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},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.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{y(t)?t.forEach((t=>{rF(a,t,e,i,s,n,r)})):d(t)?rF(a,t,e,i,s,n,r):t&&nF(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=d(e)?e(s,n):e;if(r?u(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){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}(s),e={visible:eF(r.visible,t,n),value:aF(eF(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:eF(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=eF(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&sF(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const lF={min:t=>t.length?K(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?K(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}},hF=(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=IO([],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 cF(a,n,o)},cF=(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&&t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{Zy(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=>{Zy(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&&!0===o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=lF[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},dF=(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=>{Zy(t[e])||(t[e]=0)}))})),t},uF=`${lO}_HIERARCHY_DEPTH`,pF=`${lO}_HIERARCHY_ROOT`,gF=`${lO}_HIERARCHY_ROOT_INDEX`;function fF(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function mF(t,e,i){t&&(i.needDefaultSeriesField&&(t[gO]=i.defaultSeriesField),t[uO]=e,t[pO]=i.getKey(t,e,i))}function vF(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function _F(t,e,i,s=0,n,r){void 0===r&&(r=e),mF(t,e,i),t[uF]=s,t[pF]=n||t[i.categoryField],t[gF]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>_F(e,s,i,t[uF]+1,t[pF],r)))}const yF={label:{name:"label",type:"text"}},bF=`${lO}_rect_x`,xF=`${lO}_rect_x1`,SF=`${lO}_rect_y`,AF=`${lO}_rect_y1`,kF={data:!0},MF={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},TF=[...Object.keys(ED),"normal"];function wF(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 LF(n)&&delete n.type,n.oneByOne&&(n=EF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:BF,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=FR({},o[e],a);return LF(n)&&delete n.type,n.oneByOne&&(n=EF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:BF,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function CF(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=I(t,null,i),RF(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}),i),t}(h,i)}function EF(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.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function BF(t,e){var i;return null!==(i=null==t?void 0:t[uO])&&void 0!==i?i:e.context.graphicIndex}function PF(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 LF(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function RF(t,e,i=[]){if(y(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),RF(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),RF(t[s],e,i))}function OF(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class IF extends XI{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=nR(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=zR.getSeriesMarkMap(o)?function(t,e,i){const s=zR.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=FR({},i("mark",Y(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return FR({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;Y(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(d(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,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=FR({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>FR({},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 DF extends KI{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)}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:`${lO}_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(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=IF,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=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.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=OF(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),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)&&(cI(this._rawData.dataSet,"invalidTravel",dF),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;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=bI(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=yI(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=yI(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new fD(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=K(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=cF(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=j(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){cI(this._dataSet,"dimensionStatistics",hF);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new Pa(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&&IO(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){cI(this._dataSet,"dimensionStatistics",hF);const s=new Pa(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=IO(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&IO(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new Pa(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)&&(cI(this._rawData.dataSet,"addVChartProperty",tF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:fF.bind(this),call:mF}},!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,i;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.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(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:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=wF({},CF(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)}))),!u(t.dataId)||!u(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(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:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_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"}}:$y(s)||Xy(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=FR(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=FR(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=FD(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=FD(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=FD(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:gO;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:fO,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,fO,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.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()}initTooltip(){this._tooltipHelper=new oF(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||e.visible!==t[i].visible))?i.reMake=!0:!i.reCompile&&e.some(((e,i)=>!U(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!U(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},kF),MF),i),{extensionMark:!0,label:!0,totalLabel:!0});return this._compareExtensionMarksSpec(Y(t.extensionMark),Y(e.extensionMark),s),!s.reMake&&this._compareLabelSpec(Y(t.label),Y(e.label),s),!s.reMake&&this._compareLabelSpec(Y(t.totalLabel),Y(e.totalLabel),s),s.reMake?s:(!s.reCompile&&this._marks.getMarks().some((i=>{var s,n;return r[i.name]=!0,(null===(s=e[i.name])||void 0===s?void 0:s.visible)!==(null===(n=t[i.name])||void 0===n?void 0:n.visible)}))&&(s.reCompile=!0),!s.reCompile&&n.some((i=>MF[i]&&!U(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!U(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Pa||xI(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.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();OF(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),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:gO,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new fR).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return oR(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:gO}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:d={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:_=!1}=e,y=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:_,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(y)){const e=this.getSpec()||{};this._marks.addMark(y,{name:t.name}),v&&(this._seriesMark=y),u(f)?y.setData(this._data):!1!==f&&y.setDataView(f),y.setSkipBeforeLayouted(!1!==c),u(h)||y.setGroupKey(h);const l=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:null!==(s=i.morph)&&void 0!==s&&s,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(n=i.support3d)&&void 0!==n?n:e.support3d||!!e.zField,morphKey:(null===(r=e.morph)||void 0===r?void 0:r.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});y.setMarkConfig(l),this.initMarkStyleWithSpec(y,FR({},d,g||e[y.name]))}return y}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:pO}_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!==_O&&t!==bO&&t!==vO&&t!==yO||(t=this.getStackValueField()),null!==(e=FO(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>Zy(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:gO]}}function FF(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();NC(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 zF(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}}}DF.mark=yF,DF.transformerConstructor=IF;class jF extends DF{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);NC(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:`${lO}_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(_O),this.setFieldX2(vO)):(this.setFieldY(_O),this.setFieldY2(vO))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(bO),this.setFieldX2(yO)):(this.setFieldY(bO),this.setFieldY2(yO))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(SO),this.setFieldX2(xO)):(this.setFieldY(SO),this.setFieldY2(xO))}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)&&(FF("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)}}function HF(t){return"bottom"===t||"top"===t}function NF(t){return"left"===t||"right"===t}function VF(t){return"z"===t}function UF(t,e){return xR(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function WF(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function GF(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?HF(t)?"linear":"band":HF(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const YF=(t,e,i)=>{var s;const n=null!==(s="band"===e?qD("axisBand",i):["linear","log","symlog"].includes(e)?qD("axisLinear",i):{})&&void 0!==s?s:{},r=HF(t)?qD("axisX",i):NF(t)?qD("axisY",i):qD("axisZ",i);return FR({},qD("axis",i),n,r)};class $F{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:Vy)("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:Vy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;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)))),r=n.filter((t=>UC(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return HF(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class XF extends $F{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(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:nI.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const KF=(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))},qF=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},ZF=(t,e,i,s)=>{var n;const r=e.getScale(),a=UC(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=Y(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.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))})),o.push({series:h,datum:e,key:JF(h,s)})}else if(p(i[1])){const e=[],s=[];l.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 r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{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("_")}`,QF=(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};class tz extends $F{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!KF(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:nI.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:nI.canvas}),callback:this.onMouseOut}),$y(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:nI.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),$y(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var ez;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(ez||(ez={}));const iz={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class sz{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",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.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(iz.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),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:KD,curveType:XD,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===$D?"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){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(iz.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:PF(this._spec,iz.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new Pa(this._option.dataSet,{name:`${lO}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),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(ez.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[iz.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(ez.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,FR({},this._spec[iz.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.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=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},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.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const nz=Object.assign(Object.assign({},yF),iz),rz=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(y(t))return t.length===e.length&&t.every(((t,i)=>rz(t,e[i])));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]))},az=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class oz extends bD{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return az}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(u(o)||s.includes(a))return;r&&n.includes(a)&&(VC(null==o?void 0:o.type)||(null==o?void 0:o.scale)||d(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((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?rz(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n,r;const a=e.context.data,o=[],l=[],h={},c=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,d=c&&0===c.currentIndex;if(a.forEach(((e,i)=>{var s;l[i]={},o[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?l[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!c?o[i][s]=t[s](e):0!==i||c&&!d||(h[s]=t[s](e))})),l[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),c){const t=null!==(r=null===(n=e.attribute)||void 0===n?void 0:n.segments)&&void 0!==r?r:[];return t.push({points:l}),d?Object.assign(Object.assign({},h),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(o,l);if(t)return Object.assign(Object.assign(Object.assign({},h),o[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},h),o[0]),{points:l,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:UI.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[pO]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}class lz extends oz{constructor(){super(...arguments),this.type=lz.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)===iR.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}lz.type="line";const hz=()=>{zR.registerMark(lz.type,lz),Jk(),Vk(),EB(),kB(),DD(),zR.registerGraphicComponent("line",Lg)};class cz extends bD{constructor(){super(...arguments),this.type=cz.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="circle":a.symbolType=o,a}}cz.type="symbol";const dz=()=>{zR.registerMark(cz.type,cz),Jk(),tM(),kB(),zR.registerGraphicComponent("symbol",Eg)};class uz extends IF{_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)}}function pz(t){return t.length>=2&&k(t[0])&&k($(t))&&$(t)>=t[0]}function gz(t,e){var i;const s=$(e)-e[0],n=$(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=$(e)>0?$(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!k(o.min),extendable_max:!k(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):$(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function fz(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 mz(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 vz(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 _z(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 yz=(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=>t.type.includes("ticks"))))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)-p[0];if(0===g)return t;const f=c.domain(),m=$(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=ne(t,e),a=Math.max(ie(i),ie(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return IC(v)};class bz{constructor(t){this.id=qy(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class xz extends bz{constructor(){super(xz.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!NC(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&&pz(c)&&pz(d)))return;const u=gz(t,c),p=gz(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!mz(u,p))return}else if(0===y&&0===b){if(!mz(p,u))return}else if(_||A)if(_&&!A){if(!fz(u,p))return}else if(A&&!_){if(!fz(p,u))return}else{if(f===b)return;if(f>b){if(!vz(u,p))return}else if(!vz(p,u))return}else{if(0===f&&0===y){if(!_z(u,p))return}else if(0===b&&0===g&&!_z(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===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){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){cI(e.getOption().dataSet,"tickAlign",yz);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}xz.pluginType="component",xz.type="AxisSyncPlugin";const Sz={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function Az(t){let e=0;return L(t,"tick.visible")&&(e+=L(t,"tick.tickSize")),L(t,"label.visible")&&(e+=L(t,"label.space")),e}function kz(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 Mz(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const Tz=t=>"band"===t||"ordinal"===t||"point"===t;function wz(t,e){return{id:t,label:t,value:e,rawValue:t}}function Cz(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class Ez extends MD{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const Bz=`${lO}_ARC_TRANSFORM_VALUE`,Pz=`${lO}_ARC_RATIO`,Lz=`${lO}_ARC_START_ANGLE`,Rz=`${lO}_ARC_END_ANGLE`,Oz=`${lO}_ARC_K`,Iz=`${lO}_ARC_MIDDLE_ANGLE`,Dz=`${lO}_ARC_QUADRANT`,Fz=`${lO}_ARC_RADIAN`,zz=-Math.PI/2,jz=3*Math.PI/2,Hz=.6,Nz=(t,e,i,s)=>{const n=t();if(S(n))return n;if(d(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return ge(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},Vz=(t,e,i)=>{var s;const n=null!==(s="band"===e?qD("axisBand",i):"linear"===e?qD("axisLinear",i):{})&&void 0!==s?s:{},r=qD("angle"===t?"axisAngle":"axisRadius",i);return FR({},qD("axis",i),n,r)};function Uz(t,e,i,s){switch(t){case r.cartesianBandAxis:return YF(UF(i,["z"]),"band",e);case r.cartesianLinearAxis:return YF(UF(i,["z"]),"linear",e);case r.cartesianLogAxis:return YF(UF(i,["z"]),"log",e);case r.cartesianSymlogAxis:return YF(UF(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return YF(UF(i),void 0,e);case r.polarBandAxis:return Vz(i.orient,"band",e);case r.polarLinearAxis:return Vz(i.orient,"linear",e);case r.polarAxis:return Vz(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,trigger:c,triggerOff:d}=null!==(s=qD(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>HF(t.orient)));let g;g=p(u)?FR({},Tz(u.type)?a:o,l):l;const f=n.find((t=>NF(t.orient)));let m;return m=p(f)?FR({},UC(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(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,trigger:c,triggerOff:d}=null!==(s=qD(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>"angle"===t.orient));let g;g=p(u)?FR({},Tz(u.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?FR({},UC(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return Wz(i,qD(t,e));default:return qD(t,e)}}const Wz=(t,e)=>{var i;const s=FR({},e,e[WF(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class Gz extends XI{getTheme(t,e){return Uz(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({},wR(e)),{[s]:0}))}}class Yz extends ZI{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=Gz,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof jc||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:nI.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}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 Ez(this)}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)))}_getNeedClearVRenderComponents(){return[]}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=>!U(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&&(t.release(!0),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=>{e.compile({group:t,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}}getDatum(t){}}var $z,Xz;Yz.transformerConstructor=Gz,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}($z||($z={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(Xz||(Xz={}));class Kz extends bD{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}clearComponent(){this._component&&(this._component.parent&&this._component.parent.removeChild(this._component),this._component=null)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=zR.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(eI.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){super.release(),this.removeProduct()}}Kz.type="component";const qz=()=>{zR.registerMark(Kz.type,Kz)},Zz=t=>t;class Jz extends Yz{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._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,y,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?$z.circleAxis:$z.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?Xz.circleAxisGrid:Xz.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if((null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==L(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=wF(null===(h=zR.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(d=null!==(c=this._spec.animationAppear)&&void 0!==c?c:L(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==d?d:L(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(u=this._spec.animationDisappear)&&void 0!==u?u:L(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:L(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:L(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:L(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(_=null!==(v=this._spec.animationExit)&&void 0!==v?v:L(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==_?_:L(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(y=this._spec.animationUpdate)&&void 0!==y?y:L(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b:L(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()),e=new fD(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return qL(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=y(a)?NC(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!NC(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return qL(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=ZL(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()})),qL(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(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&U(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):qL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(qL(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_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=$O(s=t.domainLine)).startSymbol=$O(s.startSymbol),s.endSymbol=$O(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 qO(FR({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:qO(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>qO(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=qO(t[i]))})),e}(t.label.state)),d(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}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:d(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},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 qO(FR({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:qO(t.tick.style)),t.tick.state&&(i.tick.state=XO(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 qO(FR({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:qO(t.subTick.style)),t.subTick.state&&(i.subTick.state=XO(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=Sz[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?oe(p):null,textStyle:FR({},d,qO(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:qO(h.style)}),h.state&&(i.title.state.shape=XO(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:qO(o.style)}),o.state&&(i.title.state.background=XO(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=XO(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=qO(t.background.style)),t.background.state&&(i.panel.state=XO(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:aO(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 qO(FR({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:qO(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:aO(t.subGrid.alternateColor),style:qO(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=ZD(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){dI(this._option.dataSet,"scale",Zz);const i=this.registerTicksTransform();return new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,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)}getDatum(t){var e;return t&&t.name===vT.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}Jz.specKey="axes";const Qz=()=>{qz(),zR.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},tj=[xz];class ej extends Jz{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}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),qL(this._regions,(t=>{const e=this.getOrient();HF(e)?Cz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):NF(e)?Cz(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):VF(e)&&Cz(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&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._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=FR({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(FR({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=HF(this.getOrient()),n=t=>{var e;return(s?!HF(t.getOrient()):HF(t.getOrient()))&&NC(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())>=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,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=UF(i,["z"]),VF(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(!Mz(e))return null;const{axisType:t,componentName:s}=GF(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=>NF(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(!Mz(t))return;const{axisType:s,componentName:n}=GF(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=zR.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}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return HF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):VF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(tj.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){HF(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&&!HF(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!VF(this.getOrient())&&this._spec.innerOffset){const t=this._spec;NF(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=kR(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=kR(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=HF(this.getOrient())?t.fieldX:VF(this.getOrient())?t.fieldZ:t.fieldY,NC(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;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,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:NC(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 t;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(eI.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(HF(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._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=HF(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:K(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return qL(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]:HF(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:VF(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();qL(this._regions,(e=>{HF(t)?Cz(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):NF(t)?Cz(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):VF(t)&&Cz(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(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=HF(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=HF(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)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=FR(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new Ne).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=HF(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?_t(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):_t(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-$(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&u(null===(e=a.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=a.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 o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return wz(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:NC(this._scale.type)?i>=s[0]&&i<=$(s):s.includes(i)}))]:[]}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 i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}ej.type=r.cartesianAxis,ej.specKey="axes";const ij=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function sj(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,rj=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function aj(t,e,i="count"){const s=rj(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const oj=Math.sqrt(50),lj=Math.sqrt(10),hj=Math.sqrt(2);class cj{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){p(this._spec.nice)&&(this._nice=this._spec.nice),p(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=kz(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(i.forceTickCount))e=i.forceTickCount;else if(d(i.tickCount)){const t=this._scale.range();let s=Math.abs($(t)-t[0]);if(1===s&&this._option){s=HF(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=k(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return u(s)&&u(n)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&u(n)&&u(this._softMaxValue)?this._scale.niceMax(e):!(!u(s)||!u(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return u(e)&&u(i)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&u(i)&&u(this._softMaxValue)?this._scale.niceMax():!(!u(e)||!u(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=u(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(nj),e.sort(nj),{domain:sj(t,e),scope:aj(t,e,i)}}(r,zy(t),this._spec.breaks[0].scopeType);e=zy(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return 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);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}=kz(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs(K(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[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=oj?10:n>=lj?5:n>=hj?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max($(t),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)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}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)-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}_updateRawDomain(){const e=this.collectData(0,!0),i=this.computeLinearDomain(e);this._rawDomain=i,this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}const dj={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},uj={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}}},pj={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}}},gj={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}}};class fj extends ej{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new PE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}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)}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!VF(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=HF(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=SR(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=zy(this._break.scope).map((t=>i[0]+($(i)-i[0])*t))),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}registerTicksTransform(){const t=`${this.type}-ticks`;return cI(this._option.dataSet,t,HE),t}}fj.type=r.cartesianLinearAxis,fj.specKey="axes",fj.builtInTheme={axis:gj,axisLinear:dj,axisX:uj,axisY:pj},G(fj,cj);const mj=()=>{zR.registerGraphicComponent($z.lineAxis,((t,e)=>new CC(t,e))),zR.registerGraphicComponent(Xz.lineAxisGrid,((t,e)=>new zB(t,e))),Qz(),zR.registerComponent(fj.type,fj)};class vj{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new fD(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{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._spec.showAllGroupLayers?this._scales:[this._scales[0]]).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=wz(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=>wz(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const e=this._spec.domain;for(let t=0;tthis._rawDomainIndex[t][e]=i))}this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const _j={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}};class yj extends ej{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new cE}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}}registerTicksTransform(){const t=`${this.type}-ticks`;return cI(this._option.dataSet,t,GE),t}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=eE(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{zR.registerGraphicComponent($z.lineAxis,((t,e)=>new CC(t,e))),zR.registerGraphicComponent(Xz.lineAxisGrid,((t,e)=>new zB(t,e))),Qz(),zR.registerComponent(yj.type,yj,!1)};class xj extends fj{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),qL(this._regions,(t=>{HF(this.getOrient())?Cz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):Cz(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=FR({},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 Pa(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.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 fD(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=mi.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=>wz(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=>wz(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return cI(this._option.dataSet,t,HE),t}transformScaleDomain(){}}xj.type=r.cartesianTimeAxis,xj.specKey="axes",xj.builtInTheme={axis:gj,axisX:uj,axisY:pj};class Sj extends fj{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new IE}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return cI(this._option.dataSet,t,HE),t}transformScaleDomain(){}}Sj.type=r.cartesianLogAxis,Sj.specKey="axes",Sj.builtInTheme={axis:gj,axisLinear:dj,axisX:uj,axisY:pj},G(Sj,cj);class Aj extends fj{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new DE}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return cI(this._option.dataSet,t,HE),t}transformScaleDomain(){}}Aj.type=r.cartesianSymlogAxis,Aj.specKey="axes",Aj.builtInTheme={axis:gj,axisLinear:dj,axisX:uj,axisY:pj},G(Aj,cj);const kj=`${lO}_hide_`;function Mj(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const Tj=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[kj]&&(Mj(t,!0),t[kj]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=u(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[kj]=!0,Mj(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},wj=()=>{zR.registerGrammarTransform("symbolOverlap",{transform:Tj,runType:"afterEncode"})},Cj={min:K,max:X,average:GL,sum:WL};function Ej(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}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function Bj(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 Pj(t,e,i,s){return Bj(t,e,i,"min",s)}function Lj(t,e,i,s){return Bj(t,e,i,"max",s)}function Rj(t,e,i,s){return Bj(t,e,i,"average",s)}function Oj(t,e,i,s){return Bj(t,e,i,"sum",s)}const Ij=(t,e)=>{let i=d(t.size)?t.size():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=Ej;if("min"===n?l=Pj:"max"===n?l=Lj:"average"===n?l=Rj:"sum"===n&&(l=Oj),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[]},Dj=()=>{zR.registerGrammarTransform("dataSampling",{transform:Ij})};class Fj extends jF{constructor(){super(...arguments),this.type=iR.line,this.transformerConstructor=uz,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.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(wF(null===(i=zR.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),CF("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=zF(this);this._symbolMark.setAnimationConfig(wF(null===(s=zR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),CF("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),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]}}Fj.type=iR.line,Fj.mark=nz,Fj.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},Fj.transformerConstructor=uz,G(Fj,sz);class zj{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{xI(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof Pa)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];Ny(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];Ny(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class jj{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)=>{Jy(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{IO(e,[{key:t,operations:NC(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&&IO(e,[{key:i.field,operations:NC(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?vR("colorOrdinal"):vR(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(Jy(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),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(U(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;if(!U(r.specified,s.specified))return e.reMake=!0,e;s.range&&!U(s.range,n.range())&&(n.range(s.range),e.reRender=!0),Jy(s.domain)?e.reRender=!0:U(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(!Jy(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=NC(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=NC(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;NC(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(NC(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=NC(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(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)));NC(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 Hj{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&t.addState(i,!0,l):a&&t.addState(s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&t.addState(i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{t.removeState(i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&t.removeState(e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}class Nj extends $I{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){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=qy(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:hO,height:cO},this._viewRect={width:hO,height:cO},this._viewBox={x1:0,y1:0,x2:hO,y2:cO},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=wR(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new tI(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new zj(this._dataSet),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===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new Hj;const t=this.getAllSeries(),e=[],i={};t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=`${n}-${t.type}`;i[r]?s.forEach((t=>{i[r].marks.push(t)})):(i[r]=Object.assign(Object.assign({},t),{marks:s}),e.push(i[r]))}))}})),e.forEach((t=>{const e=zR.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(wF({},CF("stage",this._spec,{}),null))}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.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=H(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=zR.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({},i),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_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){const s=zR.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"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(){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e,this._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof KI)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 bD))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof bD)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}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&&xI(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=FI(this._spec,this._option,{width:hO,height:cO})),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),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=oR(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new jj(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){zI(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=oR(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0};return Object.keys(t).filter((t=>!e[t])).sort()}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=this._getSpecKeys(this._spec);if(!U(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{zI(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[r.title]:!0,[r.brush]:!0,[r.indicator]:!0};this._components.forEach((s=>{var n,a;if(s.type===r.label||s.type===r.totalLabel)return;i[s.type]&&(i[s.type]=!1);const o=s.specKey||s.type,l=null!==(n=this._spec[o])&&void 0!==n?n:{};y(l)?(e[o]=e[o]||{specCount:l.length,componentCount:0},e[o].componentCount++,zI(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):zI(t,s.updateSpec(l))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}const s=t=>t&&!1!==t.visible;Object.keys(i).forEach((e=>{if(i[e]){const i=this._spec[e];(y(i)?i.some(s):s(i))&&(t.reMake=!0)}}))}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];zI(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=MR(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.resetLayoutItemTag(),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(){this._backgroundMark&&this._backgroundMark.compile()}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._option.globalInstance),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,this._option.globalInstance)}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._option.globalInstance),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,this._option.globalInstance)}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._option.globalInstance),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,this._option.globalInstance)}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(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(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(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(eI.AFTER_MARK_RENDER_END,e)};this._event.on(eI.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?Y(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:JO;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||d(e.filter)&&e.filter(o,l))){if(ZO(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===ez.dimensionHover||s===ez.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=u(t)||!n||n.every((t=>UC(t.axis.getScale().type)&&u(t.index))),o=a||n.every((t=>UC(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(n))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(r.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(r.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),n=[];s.forEach((e=>{const i=t(e);!1!==i&&n.push({axis:e,value:i})})),i.showCrosshair(n)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const Vj=(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 Uj{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)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):DR(t,a,c.spec),DR(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));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=Vj(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=Vj(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,e,i){var s,n,r,a,o;const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,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},h=this.seriesType;return h&&(l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(zR.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(zR.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=zR.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=zR.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=zR.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.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):JD(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=JD(t,u.specKey,u.type))||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"];return 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}))}_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 Wj extends Uj{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_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;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{u(i[t])&&(i[t]=n[t])})),L(i,"trimPadding")&&FR(i,jI(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class Gj extends Wj{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),DI(t)}}const Yj=(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&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=zO(t,!0);for(const e in o)for(const i in o[e].nodes)VO(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)NO(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&HO(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}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 Xj{_beforeInit(){this._dataSet&&cI(this._dataSet,"stackSplit",Yj)}_initStack(){this._stack=new $j(this),this._stack.init()}}const Kj={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:ez.dimensionHover};class qj extends zD{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},Kj,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=JO(i);let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}qj.type="dimension-hover",qj.defaultOptions=Kj;const Zj=()=>{zR.registerInteractionTrigger(qj.type,qj)},Jj=()=>{zR.registerComposedEvent(ez.dimensionHover,tz),zR.registerComposedEvent(ez.dimensionClick,XF)},Qj=t=>t.fieldX[0],tH=t=>t.fieldY[0],eH=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},iH=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},sH=(t,e)=>t?e?Qj:eH:e?tH:iH,nH=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=QF(t,(t=>HF(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=QF(t,(t=>NF(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{UC(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((t=>{if(d.size>0){if(d.has(t)){const s=rH(t,i,sH(e,UC(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=rH(t,i,sH(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},rH=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:aH(t,s,i)},aH=(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=ZF(e,t,"cartesian",null!=i?i:HF(t.getOrient())?Qj:tH);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},oH=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:u,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,_=0,y=null;if(d.size){const t=Array.from(d.values())[0];_=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,y=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(_)&&!Number.isNaN(_),x=s&&!b&&p(u),S=x?u:{coordRange:[0,0],sizeRange:[0,0],coord:_,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:y};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(UC(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(NC(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,_=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=Az(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(a=y.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&y&&null!==(o=y.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(l=y.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&y&&null!==(h=y.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(c=y.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&y&&null!==(d=y.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(u=y.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&y&&null!==(p=y.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};hH(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=_+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=_+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&lH(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),lH=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=ZD(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},hH=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},cH=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=dH(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},dH=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},uH=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return oH(c,r,e),c.xField.cacheInfo?cH(c.xField):c.yField.cacheInfo?cH(c.yField):void 0},pH=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],gH=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&pH.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(fH(s).every((t=>{var e;return!sF("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},fH=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},mH={dom:`${lO}_TOOLTIP_HANDLER_DOM`,canvas:`${lO}_TOOLTIP_HANDLER_CANVAS`},vH={key:"其他",value:"..."};var _H;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(_H||(_H={}));class yH{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(u(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,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:h,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}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:d,model:g}=e;if(!d||!this._cacheActiveSpec){const d=this.component.getSpec();if(this._cacheActiveSpec=gH(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){u(this._cacheActiveSpec.handler)&&p(d.handler)&&(this._cacheActiveSpec.handler=d.handler);const g=null!==(i=d[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},vH),t):vH;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!u(e)&&sF(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class bH extends yH{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)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],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(!UC(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(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}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const xH=()=>{zR.registerTooltipProcessor("dimension",bH)};class SH extends yH{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,Ko.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(JO(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const AH=()=>{zR.registerTooltipProcessor("mark",SH)};class kH extends yH{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:Y(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?Y(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_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 MH=()=>{zR.registerTooltipProcessor("group",kH)};class TH extends Nj{constructor(){super(...arguments),this.transformerConstructor=Gj,this.type="line",this.seriesType=iR.line}_setModelOption(){this._modelOption.getDimensionInfo=nH,this._modelOption.getDimensionInfoByValue=aH,this._modelOption.getRectByDimensionData=uH}}TH.type="line",TH.seriesType=iR.line,TH.transformerConstructor=Gj,G(TH,Xj);const wH=[...az,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class CH extends oz{constructor(){super(...arguments),this.type=CH.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return wH}_getIgnoreAttributes(){return[]}}CH.type="area";const EH=()=>{zR.registerMark(CH.type,CH),Jk(),Lk(),EB(),kB(),DD(),zR.registerGraphicComponent("area",nf)};class BH extends oF{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 PH=Object.assign(Object.assign(Object.assign({},yF),iz),{area:{name:"area",type:"area"}}),LH=()=>{zR.registerAnimation("area",OD),ID(),LD()};class RH extends uz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!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,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_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,f=h;("line"===c||u&&!d)&&(g=h,f=l),l.style=FR({},f.style,g.style),l.state=FR({},f.state,g.state),!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),t.area=l,t.line=h}}class OH extends jF{constructor(){super(...arguments),this.type=iR.area,this.transformerConstructor=RH,this._sortDataByAxis=!1}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(OH.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}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===$D?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return _R(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),y1: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),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return _R(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:!!e&&this.getColorAttribute(),stroke:!!i&&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.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[_O]},"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(wF(null===(e=zR.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),CF("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(wF(null===(i=zR.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),CF("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=zF(this);this._symbolMark.setAnimationConfig(wF(null===(s=zR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),CF("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new BH(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.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(){super.onLayoutEnd(),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}}}OH.type=iR.area,OH.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},OH.mark=PH,OH.transformerConstructor=RH,G(OH,sz);class IH extends Wj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),DI(t)}}class DH extends Nj{constructor(){super(...arguments),this.transformerConstructor=IH,this.type="area",this.seriesType=iR.area}_setModelOption(){this._modelOption.getDimensionInfo=nH,this._modelOption.getDimensionInfoByValue=aH,this._modelOption.getRectByDimensionData=uH}}DH.type="area",DH.seriesType=iR.area,DH.transformerConstructor=IH,G(DH,Xj);function FH(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 zH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:FH(t,e)}),jH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:FH(t,e)}),HH={type:"fadeIn"},NH={type:"growCenterIn"};function VH(t,e){if(!1===e)return{};switch(e){case"fadeIn":return HH;case"scaleIn":return NH;default:return zH(t)}}class UH extends bD{constructor(){super(...arguments),this.type=UH.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}UH.type="rect";const WH=()=>{Jk(),Xk(),xB("rect",TB),zR.registerMark(UH.type,UH),pw.registerBuiltInAnimate("growHeightIn",rC),pw.registerBuiltInAnimate("growHeightOut",aC),pw.registerBuiltInAnimate("growWidthIn",SC),pw.registerBuiltInAnimate("growWidthOut",AC),pw.registerBuiltInAnimate("growCenterIn",iC),pw.registerBuiltInAnimate("growCenterOut",sC),zR.registerGraphicComponent("rect",Dg)},GH=Object.assign(Object.assign({},yF),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function YH(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;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=ER(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[bF]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):_R(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[xF]):_R(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=_R(this._dataToPosX(t),e,i),n=_R(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[SF]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):_R(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[AF]):_R(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=_R(this._dataToPosY(t),e,i),n=_R(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},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(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},KH.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:PF(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(KH.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}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(cI(this._option.dataSet,"addVChartProperty",tF),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};cI(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new Pa(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:fF.bind(this),call:mF}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new fD(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=AF,s=SF,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=xF,s=bF,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=zO(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)YH(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=_R(this[r](t),l,i),u=_R(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!yR(t[this.getStackValueField()],l)?p=0:pthis._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.setMarkConfig({clip:!0,clipPath:()=>{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[vO],n=t[_O],r=t[yO],h=t[bO];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]),{[vO]:i,[_O]:s}),a?{[yO]:o,[bO]:l}:void 0),c="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)};t.push(Dg(Object.assign(Object.assign({},c),{cornerRadius:d(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(c,h,this._markAttributeContext):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=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>_R(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},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=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>_R(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),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;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=K(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=zF(this);this._barMark.setAnimationConfig(wF(null===(e=zR.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),CF(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=p(this._spec.barWidth)&&r===n,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=a;return o&&(c=ER(this._spec.barWidth,a)),l&&(c=Math.max(c,ER(this._spec.barMinWidth,a))),h&&(c=Math.min(c,ER(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=u(i)?f:Math.min(f,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,m-1))&&void 0!==r?r:6,_=m===f?this._barMark.getAttribute(c,e):v;if(m>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=ER(null!==(l=i[r-1])&&void 0!==l?l:$(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=NC(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(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}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}}KH.type=iR.bar,KH.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},KH.mark=GH,KH.transformerConstructor=XH;const qH=()=>{Dj(),WH(),zR.registerAnimation("bar",((t,e)=>({appear:VH(t,e),enter:zH(t,!1),exit:jH(t,!1),disappear:{duration:ED.disappear.duration}}))),bj(),mj(),zR.registerSeries(KH.type,KH)};class ZH extends Wj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),DI(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 JH extends Nj{constructor(){super(...arguments),this.transformerConstructor=ZH,this.type="bar",this.seriesType=iR.bar}_setModelOption(){this._modelOption.getDimensionInfo=nH,this._modelOption.getDimensionInfoByValue=aH,this._modelOption.getRectByDimensionData=uH}}JH.type="bar",JH.seriesType=iR.bar,JH.transformerConstructor=ZH,G(JH,Xj);const QH=[10,20],tN=jC.Linear,eN="circle",iN=jC.Ordinal,sN=["circle","square","triangle","diamond","star"],nN=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},rN=Object.assign(Object.assign({},yF),{point:{name:"point",type:"symbol"}});class aN extends IF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class oN extends jF{constructor(){super(...arguments),this.type=iR.scatter,this.transformerConstructor=aN,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=`${lO}_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=`${lO}_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:tN,defaultRange:QH},"size")}getShapeAttribute(t,e){return u(e)?eN:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:iN,defaultRange:sN},"shape")}initMark(){this._symbolMark=this._createMark(oN.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:PF(this._spec,oN.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=zF(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(wF(null===(i=zR.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),CF("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:eN},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{if(!t)return;const e=t.getGraphics();e&&e.length&&e.forEach(((t,e)=>{var i,s;const n=null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],r=this.dataToPosition(n);r&&t&&t.translateTo(r.x,r.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){this.handleZoom(t)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}oN.type=iR.scatter,oN.mark=rN,oN.builtInTheme={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"}}}}},oN.transformerConstructor=aN;const lN=()=>{dz(),zR.registerAnimation("scatter",((t,e)=>Object.assign({appear:nN(0,e)},BD))),bj(),mj(),zR.registerSeries(oN.type,oN)};class hN extends Wj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class cN extends Nj{constructor(){super(...arguments),this.transformerConstructor=hN,this.type="scatter",this.seriesType=iR.scatter}_setModelOption(){this._modelOption.getDimensionInfo=nH,this._modelOption.getDimensionInfoByValue=aH,this._modelOption.getRectByDimensionData=uH}}cN.type="scatter",cN.seriesType=iR.scatter,cN.transformerConstructor=hN,G(cN,Xj);class dN extends DF{constructor(){super(...arguments),this.type=iR.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=`${lO}_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 uN=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[uO]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[OO]=e.nameMap[n]:t[OO]=n})),t.features);class pN extends oF{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 gN extends bD{constructor(){super(...arguments),this.type=gN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}gN.type="path";const fN=()=>{zR.registerMark(gN.type,gN),Jk(),Wk(),zR.registerGraphicComponent("path",tf)},mN=Object.assign(Object.assign({},yF),{area:{name:"area",type:"path"}});class vN{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Ia(i,e):Ra[i]?(La[i]||(La[i]=Ia(i,Ra[i])),La[i]):null}(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 _N{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(){}}class yN{constructor(){this._lastScale=0}clearZoom(){this._lastScale=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 bN(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:_N}:$y(e)||Xy(e)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:yN}:null}const xN={debounce:St,throttle:At};class SN{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=$y(this._renderMode)||Xy(this._renderMode),bN(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return bN(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(u(r))return;if(!ke({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{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(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:rI.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:rI.chart,consume:!1}];l.on(...c,xN[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,xN[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||bN(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||bN(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:ke({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:rI.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:rI.chart,consume:!1}];l.on(...c,xN[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,xN[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){bN(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||bN(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(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:rI.chart},(t=>{if(!t.event)return;const{event:n}=t;ke({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:rI.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||bN(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:rI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||bN(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:rI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:rI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:rI.chart,source:nI.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:rI.chart,source:nI.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=xN[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=xN[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:rI.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:rI.chart,source:nI.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:rI.chart,source:nI.chart},this._handleDragMouseUp)}))}}function AN(t,e){return`${lO}_${e}_${t}`}class kN extends Yz{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:AN(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;const l=p(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,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,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):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,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=FR(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var e,i,s;this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:n}=this._spec;if(n){let t=!0,r=!0,a=!1;!0!==n&&(t=null===(e=n.zoom)||void 0===e||e,r=null===(i=n.drag)||void 0===i||i,a=null!==(s=n.blank)&&void 0!==s&&s),t&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!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 vN(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===iR.map||e.type===iR.pictogram?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(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),qL(this._regions,(t=>{var e;if(t.type===iR.map||t.type===iR.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new We})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==iR.map&&e.type!==iR.pictogram||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[OO],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!U(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}kN.type=r.geoCoordinate,G(kN,SN);const MN=()=>{zR.registerComponent(kN.type,kN)};class TN extends IF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class wN extends dN{constructor(){super(...arguments),this.type=iR.map,this.transformerConstructor=TN,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 !`),uI.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var e,i;super.initData(),cI(this._dataSet,"copyDataView",_I),cI(this._dataSet,"map",uN),cI(this._dataSet,"lookup",QD);const s=uI.get(this.map);s||null===(e=this._option)||void 0===e||e.onError("no valid map data found!");const n=new Pa(this._dataSet,{name:`map_${this.id}_data`});n.parse([s],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:t.TransformLevel.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:OO,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",n.reRunAllTransform),this._mapViewData=new fD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(wN.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:PF(this._spec,wN.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}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:gO])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:gO]):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(wF(null===(t=zR.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),CF("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new pN(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[uO]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[uO],{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;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new We}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new We}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}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 uO}getActiveMarks(){return[this._pathMark]}}wN.type=iR.map,wN.mark=mN,wN.builtInTheme={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"}}}}},wN.transformerConstructor=TN;const CN=`${lO}_waterfall_default_seriesField`,EN=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n,calculationMode:r}=e,a=[],{dimensionValues:o,dimensionData:l}=n().latestData;let h=Array.from(o[i]);"decrease"===r&&(h=h.reverse());let c={start:0,end:0,positive:0,negative:0,lastIndex:null};return h.forEach(((t,i)=>{const n={start:c.end,end:c.end,lastIndex:c.lastIndex,lastEnd:c.end,index:t,isTotal:!1,positive:c.end,negative:c.end},r=!0===e.stackInverse?l[t].reverse():l[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[MO]=!0:delete t[MO]})),r.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===h.length-1)return!0;return!1};if(r.some((t=>o(t))))return c=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,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=BN([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 f=g[0];let{start:m,end:v}=PN(f,i,s,n,u);i.start=m,i.end=v;let _=m,y=m,b=v-m;const x=p.reduce(((t,e)=>ne(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=se(_,e)):(t[c]=+y,y=se(y,e)),t[d]=se(t[c],e),m=se(m,e),b=ne(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,n,a,c,h,i,e,o),void a.push(n)}c=BN(r,t,n,a,c,h,i,e),a.push(n)})),a};function BN(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}=PN(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=se(i.positive,e)):(t[h]=+i.negative,i.negative=se(i.negative,e)),t[c]=se(t[h],e),i.end=se(i.end,e)}i.isTotal=e,(u(p)||p===CN)&&(t[CN]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function PN(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?Ny("total.collectCountField error"):n=e[a].start;o<0?Ny("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=se(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 LN=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>se(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?t.unshift(o):t.push(o),t},RN={type:"fadeIn"},ON={type:"growCenterIn"};function IN(t,e){switch(e){case"fadeIn":return RN;case"scaleIn":return ON;default:return zH(t,!1)}}class DN extends bD{constructor(){super(...arguments),this.type=DN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(t,i,s){const n=super._transformGraphicAttributes(t,i,s),{x:r,x1:a,y:o,y1:l}=n,h=e(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return Lg(t)}}DN.type="rule";const FN=()=>{zR.registerMark(DN.type,DN),Jk(),Vk(),zR.registerGraphicComponent("line",Lg)},zN=Object.assign(Object.assign({},GH),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),jN=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:HN(t.map((t=>t.latestData)).flat(),e.fields,i)}};function HN(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)=>HN(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class NN{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 Pa(e instanceof Ba?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),cI(e,"dimensionTree",jN),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 VN extends XH{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const UN={rect:KN,symbol:$N,arc:ZN,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=$N(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:JN,line:QN,area:QN,rect3d:KN,arc3d:ZN,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function WN(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=UN[t])&&void 0!==i?i:UN.point;return e.series.type===iR.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=YN(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;_(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!_(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:tV(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function GN(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==iR.sankey){const{formatFunc:t,args:n}=ZD(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function YN(t){return d(t)?e=>t(e.data):t}function $N(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=YN(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:XN(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function XN(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function KN(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=YN(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;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:qN(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function qN(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 ZN(t){var e;const{labelSpec:i}=t,s=null!==(e=YN(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 JN(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=GN(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),Tg(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 QN(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}))):[{index:0,[gO]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function tV(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class eV extends KH{constructor(){super(...arguments),this.type=iR.waterfall,this.transformerConstructor=VN,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&HO(t,e)}}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 NN(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=CN)}getSeriesKeys(){return this._seriesField===CN?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t,e,i;super.initData(),cI(this._dataSet,"waterfallFillTotal",LN),cI(this._dataSet,"waterfall",EN),(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,calculationMode:null!==(e=this._spec.calculationMode)&&void 0!==e?e:"increase",stackInverse:this.getRegion().getStackInverse()}},!1));const s=yI(this.getViewData(),this._dataSet,{name:`${lO}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",s.reRunAllTransform),this._totalData=new fD(this._option,s),s.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:vO,endAs:_O,total:this._spec.total,calculationMode:null!==(i=this._spec.calculationMode)&&void 0!==i?i:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}},!1),s.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}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=zF(this);this._barMark.setAnimationConfig(wF(null===(i=zR.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),CF("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(wF(null===(s=zR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),CF("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(){super.initMark();const t=this._createMark(eV.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:ne(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:ne(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return JN(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?_R(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):_R(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle();const e="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),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",e?0:1):0,y1:t=>this.totalPositionY(t,"index",e?1:0)},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",e?0:1):0,x1:t=>this.totalPositionX(t,"index",e?1:0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}isVisibleLeaderLine(t){return!u(t.lastIndex)&&yR([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}eV.type=iR.waterfall,eV.mark=zN,eV.builtInTheme={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}}}},eV.transformerConstructor=VN;const iV=()=>{FN(),WH(),zR.registerAnimation("waterfall",((t,e)=>({appear:IN(t,e),enter:zH(t,!1),exit:jH(t,!1),disappear:{duration:ED.disappear.duration}}))),RD(),bj(),mj(),zR.registerSeries(eV.type,eV)},sV=`${lO}_BOX_PLOT_OUTLIER_VALUE`;var nV;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(nV||(nV={}));const rV=(t,e)=>{const i=[],{outliersField:s,dimensionField:n,seriesField:r}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];y(e)||(e=[e]),i.push(...e.map((e=>{const i={[sV]:e};return n.forEach((e=>{i[e]=t[e]})),p(r)&&(i[r]=t[r]),i})))})),i};class aV extends oF{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===nV.OUTLIER)return this.series.getOutliersField();if(t===nV.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case nV.MIN:return this.series.getMinField();case nV.MAX:return this.series.getMaxField();case nV.MEDIAN:return this.series.getMedianField();case nV.Q1:return this.series.getQ1Field();case nV.Q3:return this.series.getQ3Field();case nV.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===nV.OUTLIER)return e[sV];if(t===nV.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case nV.MIN:return e[this.series.getMinField()];case nV.MAX:return e[this.series.getMaxField()];case nV.MEDIAN:return e[this.series.getMedianField()];case nV.Q1:return e[this.series.getQ1Field()];case nV.Q3:return e[this.series.getQ3Field()];case nV.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,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>p(t[sV])}getDefaultContentList(t){return[{key:this.getContentKey(nV.OUTLIER),value:this.getContentValue(nV.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(nV.MAX),value:this.getContentValue(nV.MAX)},{key:this.getContentKey(nV.Q3),value:this.getContentValue(nV.Q3)},{key:this.getContentKey(nV.MEDIAN),value:this.getContentValue(nV.MEDIAN)},{key:this.getContentKey(nV.Q1),value:this.getContentValue(nV.Q1)},{key:this.getContentKey(nV.MIN),value:this.getContentValue(nV.MIN)},{key:this.getContentKey(nV.SERIES_FIELD),value:this.getContentValue(nV.SERIES_FIELD)}]}}class oV extends bD{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==UI.enter&&t.context.diffState!==UI.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;return this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?j(r,i):i}})),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=zg(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=zR.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const lV=()=>{zR.registerGraphicComponent("glyph",zg),Jk(),Dk()},hV=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],cV=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class dV extends oV{constructor(){super(...arguments),this.type=dV.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=hV,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=cV,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}dV.type="boxPlot";const uV=Object.assign(Object.assign({},yF),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),pV=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},gV=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},fV=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),mV=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,M;if(i&&k(i.center))return i.center;let T,w,C,E,B;if("horizontal"===e){T=null===(r=null===(n=(null===(s=fV(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,w=null===(h=null===(l=null===(o=null===(a=fV(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,C=null===(p=null===(u=null===(d=null===(c=fV(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=fV(t,"box").attribute.width,i=fV(t,"box").attribute.x;E=i,B=i+e}else{T=null===(m=null===(f=(null===(g=fV(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,w=null===(b=null===(y=null===(_=null===(v=fV(t,"max"))||void 0===v?void 0:v.attribute)||void 0===_?void 0:_.points)||void 0===y?void 0:y[0])||void 0===b?void 0:b.y,C=null===(M=null===(A=null===(S=null===(x=fV(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===M?void 0:M.y;const e=fV(t,"box").attribute.height,i=fV(t,"box").attribute.y;E=i,B=i+e}return k(T)?T:k(E)&&k(B)?(E+B)/2:k(w)&&k(C)?(w+C)/2:k(C)?C:k(w)?w:NaN},vV=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,_,y,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=fV(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=fV(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=fV(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;y=i,_=i+e;const c=(null===(l=fV(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=fV(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=fV(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=fV(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=fV(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;y=i,_=i+e;const s=(null===(f=fV(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=fV(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(_)&&k(y)?(_+y)/2:k(y)?y:k(_)?_:NaN};class _V extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return pV(mV)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class yV extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return gV(mV)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class bV extends _V{computeAttribute(){return pV(vV)(this.target,this.params,this.params.options)}}class xV extends yV{computeAttribute(){return gV(vV)(this.target,this.params,this.params.options)}}class SV extends IF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}class AV extends jF{constructor(){super(...arguments),this.type=iR.boxPlot,this.transformerConstructor=SV,this._bandPosition=0}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,r,a;super.setAttrFromSpec();const o=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=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(AV.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(AV.mark.outlier,{key:uO,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var e,i,s,n,r,a;const o=this._boxPlotMark;if(o){const s={lineWidth:this._lineWidth,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"!==this._shaftShape?"#000":this.getColorAttribute()};o.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const n="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return ER(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return ER(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return ER(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return ER(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return ER(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return ER(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return ER(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return ER(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(o,s,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(o,n,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Built_In)}const l=this._outlierMark;l&&this.setMarkStyle(l,{fill:null!==(r=null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this._boxFillColor)&&void 0!==r?r:this.getColorAttribute(),stroke:this.getColorAttribute(),size:S(null===(a=this._outliersStyle)||void 0===a?void 0:a.size)?this._outliersStyle.size:10},t.STATE_VALUE_ENUM.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=>_R(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>_R(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>_R(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>_R(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>_R(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},t.STATE_VALUE_ENUM.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:t=>this._getPosition(this.direction,t),x:t=>_R(e(this.getDatumPositionValues(t,sV),{bandPosition:this._bandPosition}),s)}:{x:t=>this._getPosition(this.direction,t),y:t=>_R(e(this.getDatumPositionValues(t,sV),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;cI(this._dataSet,"foldOutlierData",rV),cI(this._dataSet,"addVChartProperty",tF);const t=new Pa(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${lO}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField}}),t.transform({type:"addVChartProperty",options:{beforeCall:fF.bind(this),call:mF}},!1),this._outlierData=new fD(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t;if(this._autoBoxWidth)return this._autoBoxWidth;const e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,i=this._groups?this._groups.fields.length:1,s=null===(t=e.getBandwidth)||void 0===t?void 0:t.call(e,i-1);let n=s;return p(this._spec.boxWidth)&&(n=ER(this._spec.boxWidth,s)),p(this._spec.boxMinWidth)&&(n=Math.max(n,ER(this._spec.boxMinWidth,s))),p(this._spec.boxMaxWidth)&&(n=Math.min(n,ER(this._spec.boxMaxWidth,s))),this._autoBoxWidth=n,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r;let a,o,l;"horizontal"===t?(a=this.getYAxisHelper(),o="boxHeight",l=this.dataToPositionY.bind(this)):(a=this.getXAxisHelper(),o="boxWidth",l=this.dataToPositionX.bind(this));const h=a.getScale(0),c=this._groups?this._groups.fields.length:1,d=null===(i=a.getBandwidth)||void 0===i?void 0:i.call(a,c-1),u=this._boxPlotMark.getAttribute(o,e);if(c>1&&p(this._spec.boxGapInGroup)){const t=this._groups.fields,i=Y(this._spec.boxGapInGroup);let o=0,l=0;for(let h=t.length-1;h>=1;h--){const c=t[h],p=null!==(n=null===(s=a.getScale(h))||void 0===s?void 0:s.domain())&&void 0!==n?n:[],g=p.length,f=ER(null!==(r=i[h-1])&&void 0!==r?r:$(i),d),m=p.indexOf(e[c]);h===t.length-1?(o+=g*u+(g-1)*f,l+=m*(u+f)):(l+=m*(o+f),o+=o+(g-1)*f)}return h.scale(e[t[0]])+a.getBandwidth(0)/2-o/2+l+u/2}const g=NC(h.type||"band");return l(e)+.5*d+(g?-d/2:0)}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=j({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=zF(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=zR.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(CF("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(wF(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(wF(null===(a=zR.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new aV(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}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}AV.type=iR.boxPlot,AV.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},AV.mark=uV,AV.transformerConstructor=SV;const kV=()=>{lV(),Vk(),Xk(),zR.registerGraphicComponent("line",(t=>Lg(t))),zR.registerGraphicComponent("rect",(t=>Dg(t))),zR.registerMark(dV.type,dV),dz(),LD(),bj(),mj(),pw.registerBuiltInAnimate("boxplotScaleIn",_V),pw.registerBuiltInAnimate("boxplotScaleOut",yV),pw.registerBuiltInAnimate("barBoxplotScaleIn",bV),pw.registerBuiltInAnimate("barBoxplotScaleOut",xV),zR.registerSeries(AV.type,AV)};class MV extends bD{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=MV.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?Zg(t):Tg(t)}}MV.type="text";const TV=()=>{zR.registerMark(MV.type,MV),Jk(),iM(),qk(),zR.registerGraphicComponent("text",Tg),zR.registerGraphicComponent("richtext",Zg)};class wV extends oF{constructor(){super(...arguments),this._getMeasureData=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]]}}const CV=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),EV={type:"fadeIn"},BV=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function PV(t,e){return"fadeIn"===e?EV:CV(t)}const LV=Object.assign(Object.assign({},GH),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class RV extends XH{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 OV extends KH{constructor(){super(...arguments),this.type=iR.rangeColumn,this._barMarkType="rect",this._barName=iR.bar,this.transformerConstructor=RV}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(OV.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:PF(this._spec,OV.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(OV.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(OV.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(e,i,s,n){var r,a,o,l;if(e){this.setMarkStyle(e,{fill:null!==(a=null===(r=null==i?void 0:i.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[s]]:t[this._spec.yField[s]];return(null==i?void 0:i.formatMethod)?i.formatMethod(e,t):e}});!function(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)}(this,e,null!==(o=null==i?void 0:i.position)&&void 0!==o?o:n,null!==(l=null==i?void 0:i.offset)&&void 0!==l?l:"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=zF(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(wF(null===(i=zR.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),CF("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(wF(null===(s=zR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),CF("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(wF(null===(n=zR.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),CF("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new wV(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)}}OV.type=iR.rangeColumn,OV.mark=LV,OV.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},OV.transformerConstructor=RV;const IV=()=>{WH(),TV(),zR.registerAnimation("rangeColumn",((t,e)=>({appear:PV(t,e),enter:CV(t),exit:BV(t),disappear:{duration:ED.disappear.duration}}))),RD(),bj(),mj(),zR.registerSeries(OV.type,OV)};var DV,FV;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(DV||(DV={})),function(t){t.middle="middle",t.start="start",t.end="end"}(FV||(FV={}));class zV extends oF{constructor(){super(...arguments),this._getMeasureData=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]]}}const jV=Object.assign({},PH);class HV extends OH{constructor(){super(...arguments),this.type=iR.rangeArea}initMark(){this._areaMark=this._createMark(HV.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}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 zV(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}HV.type=iR.rangeArea,HV.mark=jV;class NV extends DF{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=Hz,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.radiusAxisHelper.dataToPosition(Y(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(Y(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}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:[]};NC(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:[]};NC(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)&&FF(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}}function VV(t){return Zy(t)?Number.parseFloat(t):0}const UV=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&WV(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=fe(e+a/2)};let _=0,y=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,M=0;const T=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))}(x);if(m.forEach(((t,e)=>{const i=t[Bz],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/M;A=p,m.forEach((e=>{const i=e[r]===f?f:e[Bz]*t;v(e,A,i),A+=i}))}if(0!==_&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},WV=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===VV(t[e])))||!i&&0===t.reduce(((t,i)=>t+VV(i[e])),0)));function GV(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const YV=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:GV(t,!0,AI.appear)}),$V={type:"fadeIn"},XV=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:GV(t,!0,AI.enter)}),KV=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:GV(t,!0,AI.exit)});function qV(t,e){if(!1===e)return{};switch(e){case"fadeIn":return $V;case"growRadius":return YV(Object.assign(Object.assign({},t),{growField:"radius"}));default:return YV(Object.assign(Object.assign({},t),{growField:"angle"}))}}class ZV extends bD{constructor(t,e){super(t,e),this.type=JV.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>ce({x:0,y:0},this.getAttribute("centerOffset",e,i),e[Iz])[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 JV extends ZV{constructor(){super(...arguments),this.type=JV.type}}JV.type="arc";const QV=()=>{Jk(),Bk(),xB("arc",LB),pw.registerBuiltInAnimate("growRadiusIn",yC),pw.registerBuiltInAnimate("growRadiusOut",bC),pw.registerBuiltInAnimate("growAngleIn",tC),pw.registerBuiltInAnimate("growAngleOut",eC),zR.registerGraphicComponent("arc",of),zR.registerMark(JV.type,JV)},tU=Object.assign(Object.assign({},yF),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class eU extends IF{_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=FR({},this._theme,i,t);const n=(t,e)=>FR({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);y(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const iU=`${lO}_LABEL_VISIBLE`;class sU extends NV{constructor(){super(...arguments),this.transformerConstructor=eU,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:kR(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:kR(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=zz,this._endAngle=jz,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[Iz];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return ce(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;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 a=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)?oe(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?oe(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?oe(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=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;cI(this._dataSet,"pie",UV),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?oe(this._spec.minAngle):0,asStartAngle:Lz,asEndAngle:Rz,asRatio:Pz,asMiddleAngle:Iz,asRadian:Fz,asQuadrant:Dz,asK:Oz,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new Pa(this._dataSet,{name:`${lO}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new fD(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},sU.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:pO,groupKey:this._seriesField,isSeriesMark:!0},{morph:PF(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return QL(Lz)(t)}endAngleScale(t){return QL(Rz)(t)}_computeLayoutRadius(){return Nz((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:bR(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:bR(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},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),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)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:QL(iU).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(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[Iz];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return ce(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===AI.appear)return this._startAngle;if(i===AI.disappear)return this._endAngle;const r=[AI.disappear,AI.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[uO];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[uO]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[uO])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[uO])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[Iz]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[Iz]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[Iz]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[Iz]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=wF(null===(i=zR.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}sU.transformerConstructor=eU,sU.mark=tU,sU.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class nU extends sU{constructor(){super(...arguments),this.type=iR.pie}}nU.type=iR.pie;const rU=()=>{QV(),zR.registerAnimation("pie",((t,e)=>({appear:qV(t,e),enter:XV(t),exit:KV(t),disappear:{duration:ED.disappear.duration}}))),zR.registerAnimation("emptyCircle",((t,e)=>({appear:qV(t,e)}))),zR.registerSeries(nU.type,nU)};function aU(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const oU=t=>({type:aU(t.growField),options:{overall:!0}}),lU={type:"fadeIn"},hU=t=>({type:aU(t.growField)}),cU=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function dU(t,e){if(!1===e)return{};switch(e){case"fadeIn":return lU;case"growAngle":return oU(Object.assign(Object.assign({},t),{growField:"angle"}));default:return oU(Object.assign(Object.assign({},t),{growField:"radius"}))}}class uU extends NV{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(_O),this.setInnerRadiusField(vO)}setValueFieldToPercent(){this.setRadiusField(bO),this.setInnerRadiusField(yO)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const pU=Object.assign(Object.assign({},yF),{rose:{name:"rose",type:"arc"}});class gU extends IF{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class fU extends Jz{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=y(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let n,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:u,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((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:-90,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.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=u,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const _={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(_),"radius"===i.orient?(o.push(_),a=h):(l.push(_),n=h)})),o.forEach((t=>{t.angleAxisIndex=n})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=zR.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=zz,this._endAngle=jz,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),qL(this._regions,(t=>{"radius"===this.getOrient()?Cz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):Cz(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(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.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:kR(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:kR(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this.visible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(this._spec.endAngle),this._inverse=this._spec.inverse}_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:Az(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}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(){qL(this._regions,(t=>{"radius"===this.getOrient()?Cz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):Cz(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(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 NC(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:NC(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 ce(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return de(t,this.getCenter(),this._startAngle,this._endAngle)}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=>wz(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_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=ae.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",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return Nz((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=Hz,e=0;const i=this.getChart().getSpec();return qL(this.getRegions(),(s=>{const n=s;if(r=n.type,[iR.rose,iR.radar,iR.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.getComponent().setAttributes(FR({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(FR({},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)}}fU.type=r.polarAxis,fU.specKey="axes";const mU={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},vU={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class _U extends fU{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new PE}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}registerTicksTransform(){const t=`${this.type}-ticks`;return cI(this._option.dataSet,t,HE),t}}_U.type=r.polarLinearAxis,_U.specKey="axes",_U.builtInTheme={axis:gj,axisLinear:dj,axisAngle:vU,axisRadius:mU},G(_U,cj);const yU=()=>{zR.registerGraphicComponent($z.lineAxis,((t,e)=>new CC(t,e))),zR.registerGraphicComponent(Xz.lineAxisGrid,((t,e)=>new zB(t,e))),zR.registerGraphicComponent($z.circleAxis,((t,e)=>new OC(t,e))),zR.registerGraphicComponent(Xz.circleAxisGrid,((t,e)=>new UB(t,e))),Qz(),zR.registerComponent(_U.type,_U)};class bU extends fU{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new cE}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)}registerTicksTransform(){const t=`${this.type}-ticks`;return cI(this._option.dataSet,t,XE),t}transformScaleDomain(){}}bU.type=r.polarBandAxis,bU.specKey="axes",bU.builtInTheme={axis:gj,axisBand:_j,axisAngle:vU,axisRadius:mU},G(bU,vj);const xU=()=>{zR.registerGraphicComponent($z.lineAxis,((t,e)=>new CC(t,e))),zR.registerGraphicComponent(Xz.lineAxisGrid,((t,e)=>new zB(t,e))),zR.registerGraphicComponent($z.circleAxis,((t,e)=>new OC(t,e))),zR.registerGraphicComponent(Xz.circleAxisGrid,((t,e)=>new UB(t,e))),Qz(),zR.registerComponent(bU.type,bU)};class SU extends uU{constructor(){super(...arguments),this.type=iR.rose,this.transformerConstructor=gU,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(){this._roseMark=this._createMark(SU.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:PF(this._spec,SU.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}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=>_R(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=_R(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(wF(null===(i=zR.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),CF("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}SU.type=iR.rose,SU.mark=pU,SU.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},SU.transformerConstructor=gU;const AU=()=>{zR.registerSeries(SU.type,SU),QV(),zR.registerAnimation("rose",((t,e)=>({appear:dU(t,e),enter:hU(t),exit:cU(t),disappear:{duration:ED.disappear.duration}}))),xU(),yU()};class kU extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:ce(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=de(this.from,this._prevCenter),{angle:i,radius:s}=de(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,NL(this._fromAngle,this._toAngle)&&NL(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class MU extends $w{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!KL(t)&&!KL(e))return e;const s=de(t,this._prevCenter),n=de(e,this._center);let r=pe(s.angle),a=pe(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new re(s,n,r,a);return o.defined=e.defined,o}}const TU=t=>({type:"in"===t?"fadeIn":"fadeOut"});function wU(t,e,i){return"fadeIn"===e?TU(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function CU(t,e,i){return"fadeIn"===e?TU(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 EU=(t,e)=>({custom:Gw,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),BU=Object.assign(Object.assign(Object.assign({},yF),iz),{area:{name:"area",type:"area"}});class PU extends uU{constructor(){super(...arguments),this.type=iR.radar,this.transformerConstructor=uz,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!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),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(PU.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}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:XD,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{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.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)?oe(this._spec.startAngle):zz},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(wF(null===(s=zR.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),CF("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=zR.getAnimationInKey(e);t.setAnimationConfig(wF(null==i?void 0:i(n,r),CF(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}}}PU.type=iR.radar,PU.mark=BU,PU.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},PU.transformerConstructor=uz,G(PU,sz);const LU=()=>{zR.registerSeries(PU.type,PU),EH(),hz(),dz(),zR.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:wU(t,e,"in"),enter:wU(t,e,"in"),exit:wU(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:ED.disappear.duration},update:[{channel:["points","center"],custom:MU,customParameters:t,duration:ED.update.duration,easing:ED.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),zR.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:CU(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:ED.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:kU,customParameters:t,duration:ED.update.duration,easing:ED.update.easing}]}))),zR.registerAnimation("radarGroup",((t,e)=>({appear:EU(t,"in"),disappear:{duration:ED.disappear.duration}}))),Bk(),xU(),yU()};class RU extends oF{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>mi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const OU=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(lO)||(i[n]=t[n],s=p(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[uO]:r,[pO]:`${s}_${e}`})),r++}))})),n},IU={fill:"#bbb",fillOpacity:.2},DU=Object.assign(Object.assign({},yF),{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"}});class FU extends jF{constructor(){super(...arguments),this.type=iR.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 e;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),cI(this._option.dataSet,"objFlat",OU),cI(this._option.dataSet,"copyDataView",_I),dI(this._option.dataSet,"dataview",wa),null===(e=this.getViewData())||void 0===e||e.transform({type:"objFlat",options:"dots",level:t.TransformLevel.dotObjFlat},!1)}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(FR(IU,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(FU.mark.group),this._containerMark=this._createMark(FU.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(FU.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(FU.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(FU.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(FU.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(FU.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(FU.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var e;const i=this._clipMark;i&&(this.setMarkStyle(i,{x:-(null!==(e=this._spec.leftAppendPadding)&&void 0!==e?e:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",t.AttributeLevel.Series),i.setMarkConfig({interactive:!1,clip:!0}));const s=this._containerMark;s&&(this.setMarkStyle(s,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),s.setMarkConfig({interactive:!1}));const n=this._gridBackgroundMark;n&&this.setMarkStyle(n,{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 r=this._gridMark;r&&this.setMarkStyle(r,{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 a=this._dotMark;a&&this.setMarkStyle(a,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const o=this._titleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._subTitleMark;l&&this.setMarkStyle(l,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const h=this._symbolMark;h&&this.setMarkStyle(h,{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(){var e,i;super.onLayoutEnd();const s=null!==(i=null===(e=this._spec)||void 0===e?void 0:e.leftAppendPadding)&&void 0!==i?i:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+s},"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:gO}}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 fR).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:gO}}initTooltip(){this._tooltipHelper=new RU(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}FU.type=iR.dot,FU.mark=DU,FU.builtInTheme={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"}}}}};class zU extends oF{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>mi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const jU=Object.assign(Object.assign({},yF),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),HU=(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 NU extends jF{constructor(){super(...arguments),this.type=iR.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 e;super.initData(),cI(this._option.dataSet,"linkDotInfo",HU),null===(e=this.getViewData())||void 0===e||e.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:t.TransformLevel.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(NU.mark.group),this._containerMark=this._createMark(NU.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(NU.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(NU.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},"normal",t.AttributeLevel.Series),r.setMarkConfig({interactive:!1,clip:!0}));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setMarkConfig({interactive:!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:gO}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new zU(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}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]}}NU.type=iR.link,NU.mark=jU,NU.builtInTheme={link:{arrow:{style:{size:10}}}};const VU=Object.assign(Object.assign({},yF),{group:{name:"group",type:"group"}});class UU extends NV{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()?vO:PO],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle);let o;if(p(s)){const t=ht(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()?_O:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle),o=ht(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)?oe(n):zz;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?oe(r):jz,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=_R(this.angleAxisHelper.dataToPosition([t[vO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=_R(this.angleAxisHelper.dataToPosition([t[_O]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?_R(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(UU.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+oe(a),o=oe(r)/2;return of(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[Dg({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_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 $U=()=>{zR.registerAnimation("circularProgress",((t,e)=>({appear:YU(t,e),enter:{type:"growAngleIn"},disappear:{duration:ED.disappear.duration}})))};class XU extends IF{constructor(){super(...arguments),this._supportStack=!0}}class KU extends UU{constructor(){super(...arguments),this.type=iR.circularProgress,this.transformerConstructor=XU,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(){return this._progressMark=this._createMark(KU.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:PF(this._spec,"progress")}),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)}getInteractionTriggers(){const t=[];return 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(){return this._trackMark=this._createMark(KU.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),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()?vO:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?_O: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(wF(null===(i=zR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),CF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(wF(null===(s=zR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),CF("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}KU.type=iR.circularProgress,KU.mark=WU,KU.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},KU.transformerConstructor=XU;const qU=()=>{zR.registerSeries(KU.type,KU),QV(),$U(),RD(),xU(),yU()};function ZU(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const JU={type:"fadeIn"};function QU(t,e="grow"){return!1===e?{}:"fadeIn"===e?JU:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:ZU(t)}))(t)}class tW extends oF{enableByType(t){return"dimension"!==t}}const eW=Object.assign(Object.assign({},yF),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class iW extends jF{constructor(){super(...arguments),this.type=iR.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=p(e.width)?e.width:e.x1-e.x,o=p(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(iW.mark.progress,{isSeriesMark:!0}),u(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n;const r=this._progressMark;if(r)if("vertical"===this._spec.direction){const s=this._spec.progress||{},n=null!==(e=s.leftPadding)&&void 0!==e?e:0,a=null!==(i=s.rightPadding)&&void 0!==i?i:0;this.setMarkStyle(r,{x:t=>{var e,i;return _R(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),!0)-this._spec.bandWidth/2+n},y1:t=>{var e,i;return _R(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))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?_R(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-n-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=this._spec.progress||{},i=null!==(s=e.topPadding)&&void 0!==s?s:0,a=null!==(n=e.bottomPadding)&&void 0!==n?n:0;this.setMarkStyle(r,{x1:t=>{var e,i;return _R(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))},y:t=>{var e,s;return _R(this.dataToPositionY(t),null===(s=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===s?void 0:s.call(e,0),!0)-this._spec.bandWidth/2+i},height:this._spec.bandWidth-i-a,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?_R(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){return this._trackMark=this._createMark(iW.mark.track),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return _R(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),!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 _R(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),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series))}getInteractionTriggers(){const t=[];return 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(wF(null===(i=zR.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),CF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(wF(null===(s=zR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),CF("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new tW(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}iW.type=iR.linearProgress,iW.mark=eW,iW.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const sW=()=>{WH(),zR.registerAnimation("linearProgress",((t,e)=>({appear:QU(t,e),enter:QU(t),disappear:{duration:ED.disappear.duration}}))),RD(),zR.registerSeries(iW.type,iW)},nW=[0],rW=[20,40],aW=[200,500],oW={shrink:!1,enlarge:!1,fontSizeLimitMin:0},lW=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class hW{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const cW=`${lO}_WORD_CLOUD_TEXT`,dW=Object.assign(Object.assign({},yF),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),uW={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic",scaleX:1,scaleY:1}}};class pW extends DF{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},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._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=rW}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,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:aW,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:nW,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?cW:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:oW},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||Yy(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:nW,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!lW.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new hW(1e3))}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",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var e;this._wordMark=this._createMark(pW.mark.word,{key:pO,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(e=this._spec.wordMask)||void 0===e?void 0:e.visible)&&(this._maskMark=this._createMark(pW.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",t.AttributeLevel.Series)}initMarkStyleOfWord(e,i,s,n,r){var a,o;e&&(this.setMarkStyle(e,{text:(null==i?void 0:i.formatMethod)?t=>i.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{fill:null!==(o=null===(a=null==i?void 0:i.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(wF(zR.getAnimationInKey("wordCloud")(n,s),CF("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 fR).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:gO])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new PE).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new PE).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[uO])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(e=this._spec.word)&&void 0!==e?e:{},h=null!==(i=l.style)&&void 0!==i?i:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const e=()=>{var i,s,n,r;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((t=>t.fn!==e)),null===(s=(i=this._option).dispatchEvent)||void 0===s||s.call(i,t.ChartEvent.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(r=null===(n=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===n?void 0:n.afterWordcloudShapeDraw)||void 0===r||r.call(n,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:e})},dataIndexKey:pO,text:l.formatMethod?t=>l.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(n=null===(s=this._spec.word)||void 0===s?void 0:s.padding)&&void 0!==n?n:1,fontFamily:p(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(r=h.fontFamily)&&void 0!==r?r:this._defaultFontFamily,fontWeight:p(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:p(h.fontWeight)?h.fontWeight:p(this._valueField)?this._calculateFontWeight:"normal",fontStyle:p(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:h.fontStyle,createCanvas:k_.createCanvas.bind(k_),getTextBounds:mf}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,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,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:Wg,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:p(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:p(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:p(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}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(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}pW.mark=dW,pW.builtInTheme={wordCloud:uW};function gW(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||ED.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,d;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(d=t.children)||void 0===d?void 0:d.length){p.children=[],p.isLeaf=!1;const e=fW(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Tt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Tt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},mW=(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=mW(t.children,e,t,n))})),s},vW=(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=vW(t.children,e,t,n)),n=e(t,s,i,n)})),n},_W=(t,e=[],i)=>{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):_W(t.children,e,i)))})),e};function yW(t,e){let i,s;if(SW(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function SW(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 TW(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 wW(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 CW(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 EW(t){return{_:t,next:null,prev:null}}function BW(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];TW(n,s,r);let a,o,l,h,c,d,u,p=EW(s),g=EW(n),f=EW(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.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=fW(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%Ct)/Ct}(),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:OW.defaultOpionts.nodeSort;mW([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)mW([o],PW(h)),vW([o],LW(this._getPadding,.5,a)),mW([o],RW(1,this._maxDepth));else{const t=Math.min(s.width,s.height);mW([o],PW(OW.defaultOpionts.setRadius)),vW([o],LW(Rt,1,a)),c&&vW([o],LW(this._getPadding,o.radius/t,a)),mW([o],RW(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}OW.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const IW=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=IW(t.children):t.value=0),e+=Math.abs(t.value)})),e};function DW(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){IW(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=u(t.value)?0:Tt(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=H(t,["parents"]);if(a.parents=t.parents.map((t=>H(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=Tt(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function FW(t){return t.depth}function zW(t,e){return e-1-t.endDepth}const jW=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),HW=(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},NW={left:FW,right:zW,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?K(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:FW,end:zW},VW=bt(0,1);class UW{constructor(t){this._ascendingSourceBreadth=(t,e)=>jW(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>jW(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},UW.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._logger=ot.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):NW[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)};"vertical"===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<=0)return null;const a=this.computeNodeBreadths(n);if(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))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;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}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return 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){return DW(t,this._getNodeKey)}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=[HW(s[t.source]),HW(s[t.target],!0)].filter((t=>!u(t)));e.length&&(t.value=K(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){return function(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))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=d(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}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=_t(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;ea)&&(o=a);let l=0,h=null,c=null;if(d(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)c=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:c>0?t=>c:t=>Math.max(t.value*l,0),m=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*VW(t.value/e.value):0,n,0),o);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;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,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(jW),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(jW),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{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];WW(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),GW);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({},YW.defaultOpionts,t):Object.assign({},YW.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Lt(this.options.center[0],t.width),s=t.y0+Lt(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=>Lt(t,n))):Lt(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>Lt(t,n))):Lt(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=Lt(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=fW(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=ce({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)}}}function $W(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(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,f,m,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,_=Math.max(v/x,x/m),_>y){f-=h;break}y=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{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*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:WW,slice:$W,sliceDice:function(t,e,i,s,n){(t.depth%2==1?$W:WW)(t,e,i,s,n)}};class qW{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({},qW.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?Pt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?XW(this.options.aspectRatio):null!==(e=KW[this.options.splitType])&&void 0!==e?e:KW.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=fW(t,n,0,-1,null,this._getNodeKey,this.options.valueField);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)}))}}function ZW(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+ci?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return ot.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=ZW(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=Ci(o.map(Ci))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rwt(e)));u=Ri(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=JW(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&ot.getInstance().error("Area "+r+" not represented on screen")}return i}function rG(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Pi((function(i){return-1*aG({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},lG=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=Y(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!P(Y(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:Y(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||tG,s=e.lossFunction||QW,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=Y(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];di(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rae.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:oG(f),arcs:f})}))},hG={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:cG,triangle:cG,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.955)%(2*Math.PI/5)-2*Math.PI/10>=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 cG(){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 dG(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*.4),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"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const uG=t=>hG[t]?hG[t]():hG.circle(),pG=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function gG(t){return d(t)?t:function(){return t}}class fG{constructor(t){var e,i;switch(this.options=j({},fG.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=uG(this.options.shape),this.getText=null!==(e=gG(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=gG(this.options.fontWeight),this.getTextFontSize=gG(this.options.fontSize),this.getTextFontStyle=gG(this.options.fontStyle),this.getTextFontFamily=gG(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>pG(10,50);break;case"random-light":this.getTextColor=()=>pG(50,90);break;default:this.getTextColor=gG(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 oe(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():wt(e);return oe(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+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:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1: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 vG extends fG{constructor(t){var e;super(j({},vG.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<=vG.defaultOptions.minFontSize&&(this.options.minFontSize=vG.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=mG[this.options.spiral])&&void 0!==e?e:mG.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=gG(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}=dG(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,f,m;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,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,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._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=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(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=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}));if(this.originalData=s,this.data=s,this.progressiveRun(),!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._originSize[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],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});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 f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);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*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(xG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(bG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}xG(p,this._size)&&(p=SG(p,this._size))}else if(xG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||yG(p,i))&&(!i||!_G(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 _G(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 yG(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,xG=(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 SG(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{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const u=n.measureText(h),g="normal"!==o?1.1:1,f=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(u.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},kG=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>ce(t,e,i+r*n)))},MG=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},TG=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=dG(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=uG("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return ce(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)MG(n,kG({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)MG(n,kG({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)MG(n,kG({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)MG(n,kG({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)MG(n,kG({x:l,y:h},o,0,3));else if("star"===t.shape){const t=kG({x:l,y:h},o,-Math.PI/2,5),e=kG({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);MG(n,i)}else n.fillRect(0,0,i,s)}; + ***************************************************************************** */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.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=(t,e=!1)=>e?"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 _=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||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=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||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 B=Object.prototype.hasOwnProperty;function P(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(B.call(t,e))return!1;return!0}var L=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&R.call(t,e);function I(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=y(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||_(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=I(r,e,i)}return s}function D(t,e,i=!1,s=!1){if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&y(t[a])?z(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(y(a)){if(s)o=[];else if(y(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.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 U(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(!U(t[s],e[s],i))return!1;return!0}if(!m(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(!U(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;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},K=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;ne?1:t>=e?0:NaN}function it(t){return Number(t)}function st(t,e,i=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)}const nt="undefined"!=typeof console;function rt(t,e,i){const s=[e].concat([].slice.call(i));nt&&console[t].apply(console,s)}var at;!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"}(at||(at={}));class ot{static getInstance(t,e){return ot._instance&&S(t)?ot._instance.level(t):ot._instance||(ot._instance=new ot(t,e)),ot._instance}static setInstance(t){return ot._instance=t}static setInstanceLevel(t){ot._instance?ot._instance.level(t):ot._instance=new ot(t)}static clearInstance(){ot._instance=null}constructor(t=at.None,e){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(...t){this._onErrorHandler.forEach((e=>e(...t)))}canLogInfo(){return this._level>=at.Info}canLogDebug(){return this._level>=at.Debug}canLogError(){return this._level>=at.Error}canLogWarn(){return this._level>=at.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(...t){var e;return this._level>=at.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):rt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=at.Warn&&rt(this._method||"warn","WARN",t),this}info(...t){return this._level>=at.Info&&rt(this._method||"log","INFO",t),this}debug(...t){return this._level>=at.Debug&&rt(this._method||"log","DEBUG",t),this}}function lt(t,e,i=0,s){for(u(s)&&(s=t.length);i>>1;et(t[n],e)>0?s=n:i=n+1}return i}ot._instance=null;const ht=(t,e)=>ct(0,t.length,(i=>e(t[i]))),ct=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},dt=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(et)),st(i,.5)},ut=1e-10,pt=1e-10;function gt(t,e,i=pt,s=ut){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function ft(t,e,i,s){return t>e&&!gt(t,e,i,s)}function mt(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var _t=function(t,e,i){return ti?i:t};var yt=(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 bt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let xt=!1;try{xt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){xt=!1}function St(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&xt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=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 _(){const t=Date.now();if(v(t))return y(t);o=m(_,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?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(_,e),c?f(t):a}(l);if(d)return o=m(_,e),f(l)}return void 0===o&&(o=m(_,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:y(Date.now())},b.pending=function(){return void 0!==o},b}function At(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),St(t,e,{leading:s,trailing:n,maxWait:e})}function kt(t,e){return i=>t*(1-i)+e*i}function Mt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Tt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function wt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}xt=!1;const Ct=4294967296;const Et=t=>e=>L(e,t),Bt=(t,e={})=>{if(d(t))return t;const i=[t];return(e&&e.get||Et)(i)},Pt=(t,e={})=>{if(y(t)){const i=t.map((t=>Bt(t,e)));return t=>i.map((e=>e(t)))}return Bt(t,e)},Lt=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t,Rt=t=>0,Ot=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function Dt(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Ft(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!u(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:d,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)d+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!u(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!u(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:d,b:p},predict:g,rSquared:Dt(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=It(f.min,f);for(let r=0;r=1?Ht:t<=-1?-Ht:Math.asin(t)}function Jt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Qt(t,e){return t[0]*e[1]-t[1]*e[0]}function te(t,e){let i=0;for(let s=0;s0?i:0}function se(t,e){return ee(t+e,10**Math.max(ie(t),ie(e)))}function ne(t,e){return ee(t-e,10**Math.max(ie(t),ie(e)))}class re{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new re(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 ae{static distancePP(t,e){return Kt(qt(t.x-e.x,2)+qt(t.y-e.y,2))}static distanceNN(t,e,i,s){return Kt(qt(t-i,2)+qt(e-s,2))}static distancePN(t,e,i){return Kt(qt(e-t.x,2)+qt(i-t.y,2))}static pointAtPP(t,e,i){return new re((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function oe(t){return t*(Math.PI/180)}function le(t){return 180*t/Math.PI}const he=(t=0)=>{if(t<0)for(;t<-Vt;)t+=Vt;else if(t>0)for(;t>Vt;)t-=Vt;return t};function ce(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 de(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function ue(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function pe(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ge(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=pe(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)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function fe(t){return(t=pe(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 me(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function ve(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function ye(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var be;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(be||(be={}));const xe=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function Se(t,e,i){if(!t||!e)return be.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=xe(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function Me(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Te({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function we(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Ce(t,e){const i=e?oe(t.angle):t.angle,s=we(t);return[Te({x:t.x1,y:t.y1},i,s),Te({x:t.x2,y:t.y1},i,s),Te({x:t.x2,y:t.y2},i,s),Te({x:t.x1,y:t.y2},i,s)]}function Ee(t,e,i=!1){const s=Ce(t,i),n=Ce(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(we(t),we(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?oe(t.angle):t.angle;let u=i?oe(90-t.angle):t.angle+Ht;const p=i?oe(e.angle):e.angle;let g=i?oe(90-e.angle):e.angle+Ht;u>Nt&&(u-=Nt),g>Nt&&(g-=Nt);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Me(n,i)+Me(n,s))/2>Me(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Be=1e-8;function Pe(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Oe(t,e){return Math.abs(t-e){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"};function De(t,e={},i){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")}class Fe{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=De(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:f=o}=this._userSpec;if(_(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,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: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,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}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(Fe.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Fe.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Fe.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Fe.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Fe.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}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)}}Fe.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Fe.NUMBERS_CHAR_SET="0123456789",Fe.FULL_SIZE_CHAR="字";const ze=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),je=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=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(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=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(t=0,e=0,i=0,s=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(t=0,e=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(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return He(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 Ne extends Ve{}class Ue extends Ve{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Ee(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new Ue(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Te({x:this.x1,y:this.y1},this.angle,t),Te({x:this.x2,y:this.y1},this.angle,t),Te({x:this.x1,y:this.y2},this.angle,t),Te({x:this.x2,y:this.y2},this.angle,t)]}}class We{constructor(t=1,e=0,i=0,s=1,n=0,r=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 We,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,f=o*n+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 We;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:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new We(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=le(r.rotateDeg),r}}class Ge{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 Ye(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 $e(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 Xe=/^#([0-9a-f]{3,8})$/,Ke={transparent:4294967040},qe={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 Ze(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Je(t){return S(t)?new si(t>>16,t>>8&255,255&t,1):y(t)?new si(t[0],t[1],t[2]):new si(255,255,255)}function Qe(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function ti(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ei=(t,e)=>{const i=Xe.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new si((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Je(t):8===e?new si(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class ii{static Brighter(t,e=1){return 1===e?t:new ii(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new ii(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof ii?t:new ii(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();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(Ke[t]))return function(t){return S(t)?new si(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new si(t[0],t[1],t[2],t[3]):new si(255,255,255,1)}(Ke[t]);if(p(qe[t]))return Je(qe[t]);const e=`${t}`.trim().toLowerCase(),i=ei(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new si(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=Ye(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new si(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ii.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new si(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=$e(this.color.r,this.color.g,this.color.b),r=Ye(u(t)?n.h:_t(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 si(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=ei(e,!0);return null!=i?i:this}setColorName(t){const e=qe[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(t=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}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new ii(this.color.toString())}copyGammaToLinear(t,e=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,e=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=Qe(t.color.r),this.color.g=Qe(t.color.g),this.color.b=Qe(t.color.b),this}copyLinearToSRGB(t){return this.color.r=ti(t.color.r),this.color.g=ti(t.color.g),this.color.b=ti(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class si{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`#${Ze(this.r)+Ze(this.g)+Ze(this.b)+(1===this.opacity?"":Ze(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}=$e(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ni(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 si(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:$e});function ai(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 oi(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=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:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}function li(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 hi(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}const ci=1e-10;function di(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+ci)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=fi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=ae.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=ui(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-ci,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function ui(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function pi(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return ui(t,t-(i*i-e*e+t*t)/(2*i))+ui(e,s)}function gi(t,e){const i=ae.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function fi(t){const e={x:0,y:0};for(let i=0;ithis.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 _i;function yi(t,e){const i=vi(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 bi{constructor(t={}){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 xi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Si(t){let e;if(e=xi.exec(t))return new bi({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]});ot.getInstance().error("invalid format: "+t)}const Ai=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class ki{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 ki.instance||(ki.instance=new ki),ki.instance}newFormat(t){const e=Si(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"):Mi[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=Mi[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:_,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)?m: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?Ai[8+_i/3]:"")+A+(t&&"("===n?")":""),f)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=Si(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=vi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=Ai[8+n/3];return function(t){return s(r*t)+a}}}const Mi={"%":(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)=>yi(100*t,e),r:yi,s:function(t,e){const i=vi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(_i=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")+vi(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 Ti(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(_.fx>e.fx?(Bi(y,1+c,v,-c,e),y.fx=t(y),y.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Bi(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=te(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Ri(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Ei(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},ts=Math.sqrt,es=Math.tan;function is(t){return t>1?0:t<-1?ji:Math.acos(t)}function ss(t){return t>1?Hi:t<-1?-Hi:Math.asin(t)}function ns(){}function rs(t,e){t&&os.hasOwnProperty(t.type)&&os[t.type](t,e)}var as={Feature:function(t,e){rs(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sji?t+Math.round(-t/Ni)*Ni:t,e]}function bs(t,e,i){return(t%=Ni)?e||i?_s(Ss(t),As(e,i)):Ss(t):e||i?As(e,i):ys}function xs(t){return function(e,i){return[(e+=t)>ji?e-Ni:e<-ji?e+Ni:e,i]}}function Ss(t){var e=xs(t);return e.invert=xs(-t),e}function As(t,e){var i=Xi(t),s=Ji(t),n=Xi(e),r=Ji(e);function a(t,e){var a=Xi(e),o=Xi(t)*a,l=Ji(t)*a,h=Ji(e),c=h*i+o*s;return[$i(l*n-c*r,o*i-h*s),ss(c*n+l*r)]}return a.invert=function(t,e){var a=Xi(e),o=Xi(t)*a,l=Ji(t)*a,h=Ji(e),c=h*n-l*r;return[$i(l*n+h*r,o*i+c*s),ss(c*i-o*s)]},a}function ks(t,e){(e=us(e))[0]-=t,vs(e);var i=is(-e[1]);return((-e[2]<0?-i:i)+Ni-zi)%Ni}function Ms(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:ns,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function Ts(t,e){return Gi(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 Es(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Is(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 Ds(t,e,i,s){return function(n){var r,a,o,l=e(n),h=Ms(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Is(a);var t=function(t,e){var i=Rs(e),s=e[1],n=Ji(s),r=[Ji(i),-Xi(i),0],a=0,o=0;Ls.reset(),1===n?s=Hi+zi:-1===n&&(s=-Hi-zi);for(var l=0,h=t.length;l=0?1:-1,M=k*A,T=M>ji,w=f*x;if(Ls.add($i(w*k*Ji(M),m*S+w*Xi(M))),a+=T?A+k*Ni:A,T^p>=i^y>=i){var C=gs(us(u),us(_));vs(C);var E=gs(r,C);vs(E);var B=(T^A>=0?-1:1)*ss(E[2]);(s>B||s===B&&(C[0]||C[1]))&&(o+=T^A>=0?1:-1)}}return(a<-zi||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(Fs))}return u}}function Fs(t){return t.length>1}function zs(t,e){return((t=t.x)[0]<0?t[1]-Hi-zi:Hi-t[1])-((e=e.x)[0]<0?e[1]-Hi-zi:Hi-e[1])}1===(Bs=Os).length&&(Ps=Bs,Bs=function(t,e){return Os(Ps(t),e)});var js=Ds((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?ji:-ji,l=Gi(r-i);Gi(l-ji)0?Hi:-Hi),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=ji&&(Gi(i-n)zi?Yi((Ji(e)*(r=Xi(s))*Ji(i)-Ji(s)*(n=Xi(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*Hi,s.point(-ji,n),s.point(0,n),s.point(ji,n),s.point(ji,0),s.point(ji,-n),s.point(0,-n),s.point(-ji,-n),s.point(-ji,0),s.point(-ji,n);else if(Gi(t[0]-e[0])>zi){var r=t[0]0,n=Gi(e)>zi;function r(t,i){return Xi(t)*Xi(i)>e}function a(t,i,s){var n=[1,0,0],r=gs(us(t),us(i)),a=ps(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=gs(n,r),u=ms(n,h);fs(u,ms(r,c));var p=d,g=ps(u,p),f=ps(p,p),m=g*g-f*(ps(u,u)-1);if(!(m<0)){var v=ts(m),_=ms(p,(-g-v)/f);if(fs(_,u),_=ds(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],A=i[1];x0^_[1]<(Gi(_[0]-b)ji^(b<=_[0]&&_[0]<=x)){var T=ms(p,(-g+v)/f);return fs(T,u),[_,ds(T)]}}}function o(e,i){var n=s?t:ji-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Ds(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],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?ji:-ji),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||Ts(e,p)||Ts(g,p))&&(g[2]=1),f!==l)c=0,f?(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^f){var v;m&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)))}!f||e&&Ts(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},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=Xi(e),o=Ji(e),l=s*i;null==n?(n=e+s*Ni,r=e-l/2):(n=ks(a,n),r=ks(a,r),(s>0?nr)&&(n+=s*Ni));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 Gi(s[0]-t)0?0:3:Gi(s[0]-i)0?2:1:Gi(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,f,m,v,_,y=a,b=Ms(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(A(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&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=Is(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&Cs(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&&m)y.point(r,a);else{var l=[g=Math.max(Ns,Math.min(Vs,g)),f=Math.max(Ns,Math.min(Vs,f))],b=[r=Math.max(Ns,Math.min(Vs,r)),a=Math.max(Ns,Math.min(Vs,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):(m||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Ws(t){return t}var Gs,Ys,$s,Xs,Ks=Oi(),qs=Oi(),Zs={point:ns,lineStart:ns,lineEnd:ns,polygonStart:function(){Zs.lineStart=Js,Zs.lineEnd=en},polygonEnd:function(){Zs.lineStart=Zs.lineEnd=Zs.point=ns,Ks.add(Gi(qs)),qs.reset()},result:function(){var t=Ks/2;return Ks.reset(),t}};function Js(){Zs.point=Qs}function Qs(t,e){Zs.point=tn,Gs=$s=t,Ys=Xs=e}function tn(t,e){qs.add(Xs*t-$s*e),$s=t,Xs=e}function en(){tn(Gs,Ys)}var sn=Zs,nn=1/0,rn=nn,an=-nn,on=an;var ln,hn,cn,dn,un={point:function(t,e){tan&&(an=t);eon&&(on=e)},lineStart:ns,lineEnd:ns,polygonStart:ns,polygonEnd:ns,result:function(){var t=[[nn,rn],[an,on]];return an=on=-(rn=nn=1/0),t}},pn=0,gn=0,fn=0,mn=0,vn=0,_n=0,yn=0,bn=0,xn=0,Sn={point:An,lineStart:kn,lineEnd:wn,polygonStart:function(){Sn.lineStart=Cn,Sn.lineEnd=En},polygonEnd:function(){Sn.point=An,Sn.lineStart=kn,Sn.lineEnd=wn},result:function(){var t=xn?[yn/xn,bn/xn]:_n?[mn/_n,vn/_n]:fn?[pn/fn,gn/fn]:[NaN,NaN];return pn=gn=fn=mn=vn=_n=yn=bn=xn=0,t}};function An(t,e){pn+=t,gn+=e,++fn}function kn(){Sn.point=Mn}function Mn(t,e){Sn.point=Tn,An(cn=t,dn=e)}function Tn(t,e){var i=t-cn,s=e-dn,n=ts(i*i+s*s);mn+=n*(cn+t)/2,vn+=n*(dn+e)/2,_n+=n,An(cn=t,dn=e)}function wn(){Sn.point=An}function Cn(){Sn.point=Bn}function En(){Pn(ln,hn)}function Bn(t,e){Sn.point=Pn,An(ln=cn=t,hn=dn=e)}function Pn(t,e){var i=t-cn,s=e-dn,n=ts(i*i+s*s);mn+=n*(cn+t)/2,vn+=n*(dn+e)/2,_n+=n,yn+=(n=dn*t-cn*e)*(cn+t),bn+=n*(dn+e),xn+=3*n,An(cn=t,dn=e)}var Ln=Sn;function Rn(t){this._context=t}Rn.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,Ni)}},result:ns};var On,In,Dn,Fn,zn,jn=Oi(),Hn={point:ns,lineStart:function(){Hn.point=Vn},lineEnd:function(){On&&Nn(In,Dn),Hn.point=ns},polygonStart:function(){On=!0},polygonEnd:function(){On=null},result:function(){var t=+jn;return jn.reset(),t}};function Vn(t,e){Hn.point=Nn,In=Fn=t,Dn=zn=e}function Nn(t,e){Fn-=t,zn-=e,jn.add(ts(Fn*Fn+zn*zn)),Fn=t,zn=e}var Un=Hn;function Wn(){this._string=[]}function Gn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Yn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),cs(t,i(s))),s.result()}return r.area=function(t){return cs(t,i(sn)),sn.result()},r.measure=function(t){return cs(t,i(Un)),Un.result()},r.bounds=function(t){return cs(t,i(un)),un.result()},r.centroid=function(t){return cs(t,i(Ln)),Ln.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ws):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Wn):new Rn(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 $n(t){return function(e){var i=new Xn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Xn(){}function Kn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),cs(i,t.stream(un)),e(un.result()),null!=s&&t.clipExtent(s),t}function qn(t,e,i){return Kn(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 Zn(t,e,i){return qn(t,[[0,0],e],i)}function Jn(t,e,i){return Kn(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 Qn(t,e,i){return Kn(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)}Wn.prototype={_radius:4.5,_circle:Gn(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=Gn(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}},Xn.prototype={constructor:Xn,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 tr=16,er=Xi(30*Wi);function ir(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&f--){var b=a+u,x=o+p,S=l+g,A=ts(b*b+x*x+S*S),k=ss(S/=A),M=Gi(Gi(S)-1)e||Gi((v*E+_*B)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Wi:0,E()):[m*Ui,v*Ui,_*Ui]},w.angle=function(t){return arguments.length?(y=t%360*Wi,E()):y*Ui},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=ir(o,T=t*t),B()):ts(T)},w.fitExtent=function(t,e){return qn(w,t,e)},w.fitSize=function(t,e){return Zn(w,t,e)},w.fitWidth=function(t,e){return Jn(w,t,e)},w.fitHeight=function(t,e){return Qn(w,t,e)},function(){return e=t.apply(this,arguments),w.invert=e.invert&&C,E()}}function lr(t){var e=0,i=ji/3,s=or(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Wi,i=t[1]*Wi):[e*Ui,i*Ui]},n}function hr(t,e){var i=Ji(t),s=(i+Ji(e))/2;if(Gi(s)2?t[2]*Wi:0),e.invert=function(e){return(e=t.invert(e[0]*Wi,e[1]*Wi))[0]*=Ui,e[1]*=Ui,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===mr?[[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 _r(t){return es((Hi+t)/2)}function yr(t,e){var i=Xi(t),s=t===e?Ji(t):qi(i/Xi(e))/qi(_r(e)/_r(t)),n=i*Zi(_r(t),s)/s;if(!s)return mr;function r(t,e){n>0?e<-Hi+zi&&(e=-Hi+zi):e>Hi-zi&&(e=Hi-zi);var i=n/Zi(_r(e),s);return[i*Ji(s*t),n-i*Xi(s*t)]}return r.invert=function(t,e){var i=n-e,r=Qi(s)*ts(t*t+i*i),a=$i(t,Gi(i))*Qi(i);return i*s<0&&(a-=ji*Qi(t)*Qi(i)),[a/s,2*Yi(Zi(n/r,1/s))-Hi]},r}function br(t,e){return[t,e]}function xr(t,e){var i=Xi(t),s=t===e?Ji(t):(i-Xi(e))/(e-t),n=i/s+t;if(Gi(s)zi&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Br.invert=pr(ss),Pr.invert=pr((function(t){return 2*Yi(t)})),Lr.invert=function(t,e){return[-e,2*Yi(Ki(t))-Hi]};var Ir={exports:{}},Dr=function(t,e){this.p1=t,this.p2=e};Dr.prototype.rise=function(){return this.p2[1]-this.p1[1]},Dr.prototype.run=function(){return this.p2[0]-this.p1[0]},Dr.prototype.slope=function(){return this.rise()/this.run()},Dr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Dr.prototype.isVertical=function(){return!isFinite(this.slope())},Dr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Dr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Dr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Dr.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)},Dr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Fr=Dr,zr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Fr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=zr(t.slice(0,s),e),o=zr(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},jr=zr;!function(t){var e=jr;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;r{const i=Vr(Wr,e),{tolerance:s}=i;return Hr(t,s)};var Yr;!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"}(Yr||(Yr={}));const $r=(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.sort&&(k(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!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;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,_=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],A=new Set,k=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),A.has(i)||(A.add(i),S.push(i),y(m)?k.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):k.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else _[r][l]+=a;e&&e.includeValues&&!v&&_[r][c].push(t[n]);break}}}let M=0;const T=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=_.length;t0?_[t][l]/M:0,T.push(_[t])}return T},Kr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,_=-1/0;if(e.extent)v=e.extent[0],_=e.extent[1];else for(let e=0;e_&&(_=s))}if(!Number.isFinite(v)||!Number.isFinite(_)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=_;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(_-v>1){const e=Math.floor(v),i=Math.ceil((_-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>_){t=s,m.length=t+1;break}}else{const e=(_-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>_){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",A=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",k=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",M=null!==(d=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==d?d:"percentage",T=y(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],w=y(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],C=w.length?w:void 0,E=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:A,percentageName:M,valuesName:k,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:C});if(!T.length)return Xr(t,E);const B={};return t.forEach((t=>{const e=T.map((e=>null==t?void 0:t[e])).join("-&&-");B[e]?B[e].push(t):B[e]=[t]})),Object.values(B).map((t=>{const e=[...w,...T];return Xr(t,Object.assign(Object.assign({},E),{groupField:e.length?e:void 0,n:t.length}))})).flat()},qr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,_;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const A=!!(null==e?void 0:e.includeValues),k=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},M=null!==(n=k.key)&&void 0!==n?n:y(x)?null:null!==(r=x)&&void 0!==r?r:"key",T=null!==(a=k.count)&&void 0!==a?a:"count",w=null!==(o=k.mean)&&void 0!==o?o:"mean",C=null!==(l=k.q1)&&void 0!==l?l:"q1",E=null!==(h=k.median)&&void 0!==h?h:"median",B=null!==(c=k.q3)&&void 0!==c?c:"q3",P=null!==(d=k.iqr)&&void 0!==d?d:"iqr",L=null!==(p=k.min)&&void 0!==p?p:"min",R=null!==(g=k.max)&&void 0!==g?g:"max",O=null!==(f=k.lowerWhisker)&&void 0!==f?f:"lowerWhisker",I=null!==(m=k.upperWhisker)&&void 0!==m?m:"upperWhisker",D=null!==(v=k.outliers)&&void 0!==v?v:"outliers",F=null!==(_=k.values)&&void 0!==_?_:"values",z=new Map,j=new Map,H=new Map,V=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),A&&j.set(r,[]),y(x)?H.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):H.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),A){const t=j.get(r);t&&t.push(i)}}y(S)&&(S=[_t(Math.min.apply(null,S),0,1),_t(Math.max.apply(null,S),0,1)]);const N=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=H.get(t);if(null!==M)f[M]=m;else if(y(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[T]=s,f[w]=o,f[C]=l,f[E]=h,f[B]=c,f[P]=d,f[L]=n,f[R]=r,f[O]=u,f[I]=p,f[D]=g,A&&(f[F]=j.get(t)||[]),N.push(f)}return N};var Zr={},Jr={};function Qr(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function ta(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function ea(t,e){var i=t+"",s=i.length;return s9999?"+"+ea(e,6):ea(e,4))+"-"+ea(t.getUTCMonth()+1,2)+"-"+ea(t.getUTCDate(),2)+(r?"T"+ea(i,2)+":"+ea(s,2)+":"+ea(n,2)+"."+ea(r,3)+"Z":n?"T"+ea(i,2)+":"+ea(s,2)+":"+ea(n,2)+"Z":s||i?"T"+ea(i,2)+":"+ea(s,2)+"Z":"")}function sa(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 Jr;if(h)return h=!1,Zr;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(;a0}function ga(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=oa(t));var r=[];switch(t.type){case"GeometryCollection":return fa(t,(function(t){va(t,s)})),t;case"FeatureCollection":return ga(t,(function(t){ga(va(t,s),(function(t){r.push(t)}))})),hi(r)}return va(t,s)}function va(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return fa(t,(function(t){va(t,e)})),t;case"LineString":return _a(ua(t),e),t;case"Polygon":return ya(ua(t),e),t;case"MultiLineString":return ua(t).forEach((function(t){_a(t,e)})),t;case"MultiPolygon":return ua(t).forEach((function(t){ya(t,e)})),t;case"Point":case"MultiPoint":return t}}function _a(t,e){pa(t)===e&&t.reverse()}function ya(t,e){pa(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=ba(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},ka=(t,e={},i)=>{i.type=Yr.GEO;const s=Vr(Sa,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Aa(t))})):e.push(Aa(t))})),e})(t);let l=t.features;return o&&(l=ma(t,{reverse:!g(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=xa.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=xa.bounds(t);t.bbox=e}})),t.features=l,t},Ma={},Ta=(t,e,i)=>{i.type=Yr.GEO;const s=Vr(Sa,Ma,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 Or(a,t)}))}:Or(a,o));var a,o;return ka(r,s,i)},wa=(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 Ca=0;function Ea(t="dataset"){return Ca>1e8&&(Ca=0),t+"_"+Ca++}class Ba{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:Ea("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:ot.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()}}class Pa{constructor(t,e){let i;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=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&U(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Ea("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){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,e=!0){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)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}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,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&U(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof Pa||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!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",$r),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Yn();const La={},Ra={albers:dr,albersusa:function(){var t,e,i,s,n,r,a=dr(),o=cr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=cr().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)}},Oa=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Ia(t,e){return function i(){const s=e();return s.type=t,s.path=Yn().projection(s),s.copy=s.copy||function(){const t=i();return Oa.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Da{static GenAutoIncrementId(){return Da.auto_increment_id++}}Da.auto_increment_id=0;class Fa{constructor(t){this.id=Da.GenAutoIncrementId(),this.registry=t}}const za="named",ja="inject",Ha="multi_inject",Va="inversify:tagged",Na="inversify:paramtypes";class Ua{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===za?`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="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),s=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),n=new WeakMap;function r(t,e,i){let r=n.get(t);if(h(r)){if(!i)return;r=new s,n.set(t,r)}let a=r.get(e);if(h(a)){if(!i)return;a=new s,r.set(e,a)}return a}function a(t,e,i){if(o(t,e,i))return!0;const s=f(e);return!c(s)&&a(t,s,i)}function o(t,e,i){const s=r(e,i,!1);return!h(s)&&!!s.has(t)}function l(t,e,i){if(o(t,e,i))return function(t,e,i){const s=r(e,i,!1);if(!h(s))return s.get(t)}(t,e,i);const s=f(e);return c(s)?void 0:l(t,s,i)}function h(t){return void 0===t}function c(t){return null===t}function d(t){return"object"==typeof t?null!==t:"function"==typeof t}function u(t,i){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const s=3===i?"string":5===i?"number":"default",n=function(t,e){const i=t[e];if(null!=i){if(!g(i))throw new TypeError;return i}}(t,e);if(void 0!==n){const e=n.call(t,s);if(d(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.valueOf;if(g(i)){const e=i.call(t);if(!d(e))return e}}else{const e=t.valueOf;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.toString;if(g(i)){const e=i.call(t);if(!d(e))return e}}throw new TypeError}(t,"default"===s?"number":s)}function p(t){const e=u(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function g(t){return"function"==typeof t}function f(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const s=t.prototype,n=s&&Object.getPrototypeOf(s);if(null==n||n===Object.prototype)return e;const r=n.constructor;return"function"!=typeof r||r===t?e:r}t("defineMetadata",(function(t,e,i,s){if(!d(i))throw new TypeError;return n=t,a=e,void r(i,s,!0).set(n,a);var n,a})),t("hasMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),l(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function Ga(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};Wa.hasOwnMetadata(t,e)&&(r=Wa.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,Wa.defineMetadata(t,r,e)}(Va,t,i.toString(),s)}function Ya(t){return(e,i,s)=>{Ga(e,0,s,t)}}function $a(t){return e=>(i,s,n)=>Ya(new Ua(t,e))(i,s,n)}const Xa=$a(ja),Ka=$a(Ha);function qa(){return function(t){return Wa.defineMetadata(Na,null,t),t}}function Za(t){return Ya(new Ua(za,t))}const Ja="Singleton",Qa="Transient",to="ConstantValue",eo="DynamicValue",io="Factory",so="Function",no="Instance",ro="Invalid";class ao{constructor(t,e){this.id=Da.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=ro,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new ao(this.serviceIdentifier,this.scope);return t.activated=t.scope===Ja&&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 oo{getConstructorMetadata(t){return{compilerGeneratedMetadata:Wa.getMetadata(Na,t),userGeneratedMetadata:Wa.getMetadata(Va,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const lo=(ho=za,t=>{const e=e=>{if(null==e)return!1;if(e.key===ho&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const po=Symbol("ContributionProvider");class go{constructor(t,e){this.serviceIdentifier=t,this.container=e,mo.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function fo(t,e){t(po).toDynamicValue((({container:t})=>new go(e,t))).inSingletonScope().whenTargetNamed(e)}class mo{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}mo.store=new Map;class vo{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 _o extends vo{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const yo=Symbol.for("EnvContribution"),bo=Symbol.for("VGlobal"),xo=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Qa,this.options=e,this.id=Da.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new oo}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,za,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new ao(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new uo(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[ja],multiInject:s[Ha]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:a,metadata:e,bindings:l};n.push(t)}}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case to:case so:e=t.cache;break;case no: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===Ja&&(t.cache=e,t.activated=!0)}},So=Symbol.for("RenderService");const Ao=new class{get renderService(){return this._renderService||(this._renderService=xo.get(So)),this._renderService}};let ko=0;class Mo{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=Ao.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++ko,t),this.tryRunAnimationFrameNextFrame(),ko}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class To{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var wo=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Co=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Eo=function(t,e){return function(i,s){e(i,s,t)}},Bo=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 Po=class extends To{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}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){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Da.GenAutoIncrementId(),this.hooks={onSetEnv:new _o(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}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)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new Mo);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}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)}loadFont(t,e,i){return Bo(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}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,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var Lo,Ro,Oo,Io;Po=wo([qa(),Eo(0,Xa(po)),Eo(0,Za(yo)),Co("design:paramtypes",[Object])],Po),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(Lo||(Lo={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(Ro||(Ro={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(Oo||(Oo={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(Io||(Io={}));const Do=Vt-1e-8;class Fo{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>Do)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%=Vt)<0&&(s+=Vt),(n%=Vt)<0&&(n+=Vt),nn;++o,a-=Ht)g(a);else for(a=s-s%Ht+Ht,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const jo=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,Ho={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},Vo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let No,Uo,Wo,Go,Yo,$o;var Xo,Ko,qo,Zo,Jo,Qo;function tl(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),f=Math.cos(n),m=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+f,A=i+m,k=S+y*m,M=A-y*f;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 el(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=oe(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 f=d/i,m=c/i,v=-c/s,_=d/s,y=f*o+m*l,b=v*o+_*l,x=f*t+m*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+=Vt:C>0&&0===r&&(C-=Vt);const E=Math.ceil(Math.abs(C/(Ht+.001))),B=[];for(let t=0;te.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 sl(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=cl(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=$t(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=$t(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function ul(t,e){const{p0:i,p1:s}=t,n=ae.pointAtPP(i,s,e);return[new pl(i,n),new pl(n,s)]}class pl extends nl{constructor(t,e){super(),this.type=Jo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return ae.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Wt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?ae.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===Zo.ROW?Ut(this.p0.x-this.p1.x):t===Zo.COLUMN?Ut(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class gl{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new dl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new pl(new re(this._lastX,this._lastY),new re(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===Zo.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Ut(t.p0.y-s.y)}if(t===Zo.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Ut(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class fl extends gl{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 ml(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function vl(t,e,i){const s=null!=e?e:Ut(i[i.length-1].x-i[0].x)>Ut(i[i.length-1].y-i[0].y)?Zo.ROW:Zo.COLUMN;return"monotoneY"===t?new fl(t,s):new gl(t,s)}class _l{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 yl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=vl("linear",i,t);return function(t,e){ml(t,e,1)}(new _l(n,s),t),n}function bl(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 xl{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&&bl(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:bl(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 Sl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return yl(t,e);const n=vl("basis",i,t);return function(t,e){ml(t,e,2)}(new xl(n,s),t),n}function Al(t){return t<0?-1:1}function kl(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(Al(r)+Al(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Ml(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 wl{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,Ml(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,Ml(this,e=kl(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Tl(this,this._t0,e=kl(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 Cl extends wl{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function El(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return yl(t,e);const n=vl("monotoneX",i,t);return function(t,e){ml(t,e,2)}(new wl(n,s),t),n}function Bl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return yl(t,e);const n=vl("monotoneY",i,t);return function(t,e){ml(t,e,2)}(new Cl(n,s),t),n}let Pl=class{constructor(t,e=.5,i){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;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):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()}};class Ll extends Pl{lineEnd(){this.context.closePath()}}function Rl(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new gl("step",null!=s?s:Ut(t[t.length-1].x-t[0].x)>Ut(t[t.length-1].y-t[0].y)?Zo.ROW:Zo.COLUMN);return Ol(new Pl(r,e,n),t),r}function Ol(t,e){return ml(t,e,1)}class Il extends _l{lineEnd(){this.context.closePath()}}function Dl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=vl("linear",i,t);return function(t,e){ml(t,e,1)}(new Il(n,s),t),n}function Fl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>zt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>zt){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function zl(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return yl(i,n);const o=vl(t,r,i);return ml(new e(o,s,a),i,2),o}}const jl=zl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:Fl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const Hl=zl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:Fl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class Vl extends nl{constructor(t,e,i){super(),this.type=Jo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return hl(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,rl([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===Zo.ROW?Ut(this.p0.x-this.p2.x):t===Zo.COLUMN?Ut(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Yt(t-.01,0),i=$t(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Wt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=hl(i,s,n,e),a=ae.pointAtPP(i,s,e),o=ae.pointAtPP(s,n,e);return[new Vl(i,a,r),new Vl(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Nl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new pl(new re(this._lastX,this._lastY),new re(t,e))}quadraticCurveTo(t,e,i,s){const n=new Vl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new dl(new re(this._lastX,this._lastY),new re(t,e),new re(i,s),new re(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Ul(t,e,i){var s,n;switch(e){case"linear":default:return yl(t,i);case"basis":return Sl(t,i);case"monotoneX":return El(t,i);case"monotoneY":return Bl(t,i);case"step":return Rl(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new gl("step",null!=s?s:Ut(t[t.length-1].x-t[0].x)>Ut(t[t.length-1].y-t[0].y)?Zo.ROW:Zo.COLUMN);return Ol(new Ll(r,e,n),t),r}(t,.5,i);case"stepBefore":return Rl(t,0,i);case"stepAfter":return Rl(t,1,i);case"catmullRom":return jl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return Hl(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return Dl(t,i)}}class Wl extends zo{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Fo(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([Vo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([Vo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([Vo.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([Vo.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([Vo.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([Vo.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([Vo.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([Vo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([Vo.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()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Nl(this);sl(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[Vo.M]=t=>`M${t[1]} ${t[2]}`,t[Vo.L]=t=>`L${t[1]} ${t[2]}`,t[Vo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[Vo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[Vo.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3];((t,e,i,s,n,r,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;e`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[Vo.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,e=Wo;for(let s=1,r=i.length;s{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,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),sl(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===Zo.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Ut(t.p0.y-e.p1.y)}if(this.direction===Zo.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Ut(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{ot.getInstance().warn("空函数")}}),lh=Object.assign(Object.assign({},th),{points:[],cornerRadius:0,closePath:!0}),hh=Object.assign(Object.assign({},th),{width:100,height:100,spikes:5,thickness:.5}),ch=Object.assign(Object.assign({},th),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},th),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const dh=Object.assign(Object.assign({},th),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),uh=Object.assign(Object.assign(Object.assign({},th),Zl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),ph=Object.assign(Object.assign(Object.assign({},th),Zl),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",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}),gh=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0,maxWidth:500,maxHeight:500},th),{fill:!0,cornerRadius:0,cornerType:"round"}),fh=Object.assign(Object.assign({},gh),{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}),mh=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 m("directional",t.sideOrCorner,1)||m("angular",t.angleValue,1)}function a(){return m("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=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 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=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 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 vh{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(vh.IsGradientStr(t))try{const e=mh(t)[0];if(e){if("linear"===e.type)return vh.ParseLinear(e);if("radial"===e.type)return vh.ParseRadial(e);if("conic"===e.type)return vh.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=jt/2,n=parseFloat(e.value)/180*jt-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Nt,stops:vh.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:vh.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=jt/2;let n="angular"===e.type?parseFloat(e.value)/180*jt:0;for(;n<0;)n+=Nt;for(;n>=Nt;)n-=Nt;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}const bh={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"}},xh=!0,Sh=!1,Ah=/\w|\(|\)|-/,kh=/[.?!,;:/,。?!、;:]/,Mh=/\S/,Th=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function wh(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=Ao.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=Ch(t,a)),a}function Ch(t,e,i=!1){let s=e;for(;Ah.test(t[s-1])&&Ah.test(t[s])||kh.test(t[s]);)if(s--,s<=0)return i?Eh(t,e):e;return s}function Eh(t,e){let i=e;for(;Ah.test(t[i+1])&&Ah.test(t[i])||kh.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Bh(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=Ao.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}var Ph=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Lh=class{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=uh.fontSize}){let i=0,s=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 a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=Ch(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_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){if(s===n){ot.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}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),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);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}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,a=!1){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=Ch(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}};Lh=Ph([qa()],Lh);var Rh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Oh=Symbol.for("TextMeasureContribution");let Ih=class extends Lh{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}};Ih=Rh([qa()],Ih);const Dh=Symbol.for("CanvasFactory"),Fh=Symbol.for("Context2dFactory");function zh(t){return xo.getNamed(Dh,Ao.global.env)(t)}const jh=1e-4,Hh=Math.sqrt(3),Vh=1/3;function Nh(t){return t>-ec&&tec||t<-ec}const Wh=[0,0],Gh=[0,0],Yh=[0,0];function $h(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function Xh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function Kh(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 qh(t){return(t%=Nt)<0&&(t+=Nt),t}function Zh(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+=Nt);let d=Math.atan2(l,o);return d<0&&(d+=Nt),d>=s&&d<=n||d+Nt>=s&&d+Nt<=n}function tc(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(Nh(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 sc=[-1,-1,-1],nc=[-1,-1];function rc(){const t=nc[0];nc[0]=nc[1],nc[1]=t}function ac(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(Nh(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,Vh):Math.pow(i,Vh),s=s<0?-Math.pow(-s,Vh):Math.pow(s,Vh);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+Hh*Math.sin(e)))/(3*a),h=(-o+i*(s-Hh*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,sc);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&rc(),p=Kh(e,s,r,o,nc[0]),u>1&&(g=Kh(e,s,r,o,nc[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Nh(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,sc);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=Xh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);sc[0]=-l,sc[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Nt-1e-4){s=0,n=Nt;const e=r?1:-1;return a>=sc[0]+t&&a<=sc[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Nt,n+=Nt);let c=0;for(let e=0;e<2;e++){const i=sc[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Nt+t),(t>=s&&t<=n||t+Nt>=s&&t+Nt<=n)&&(t>jt/2&&t<1.5*jt&&(e=-e),c+=e)}}return c}function hc(t){return Math.round(t/jt*1e8)/1e8%2*jt}function cc(t,e){let i=hc(t[0]);i<0&&(i+=Nt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Nt?n=i+Nt:e&&i-n>=Nt?n=i-Nt:!e&&i>n?n=i+(Nt-hc(i-n)):e&&i1&&(i||(h+=Re(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],v=a[2],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,A=b;dc[0]=S,dc[1]=A,cc(dc,Boolean(a[6])),S=dc[0],A=dc[1];const k=S,M=A-S,T=!!(1-(a[6]?0:1)),w=(s-m)*_/_+m;switch(f){case Vo.M:u=m,p=v,c=u,d=p;break;case Vo.L:if(i){if(tc(c,d,m,v,e,s,n))return!0}else h+=Re(c,d,m,v,s,n)||0;c=m,d=v;break;case Vo.C:if(i){if(Jh(c,d,m,v,_,y,b,x,e,s,n))return!0}else h+=ac(c,d,m,v,_,y,b,x,s,n)||0;c=b,d=x;break;case Vo.Q:if(i){if(Zh(c,d,m,v,_,y,e,s,n))return!0}else h+=oc(c,d,m,v,_,y,s,n)||0;c=_,d=y;break;case Vo.A:if(o=Math.cos(k)*_+m,l=Math.sin(k)*_+v,g?(u=o,p=l):h+=Re(c,d,o,l,s,n),i){if(Qh(m,v,_,k,k+M,T,e,w,n))return!0}else h+=lc(m,v,_,k,k+M,T,w,n);c=Math.cos(k+M)*_+m,d=Math.sin(k+M)*_+v;break;case Vo.R:if(u=c=m,p=d=v,o=u+_,l=p+y,i){if(tc(u,p,o,p,e,s,n)||tc(o,p,o,l,e,s,n)||tc(o,l,u,l,e,s,n)||tc(u,l,u,p,e,s,n))return!0}else h+=Re(o,p,o,l,s,n),h+=Re(u,l,u,p,s,n);break;case Vo.Z:if(i){if(tc(c,d,u,p,e,s,n))return!0}else h+=Re(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},fc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const mc=Symbol.for("VWindow"),vc=Symbol.for("WindowHandlerContribution");let _c=class extends To{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(){super(),this.hooks={onChange:new _o(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(xo.getNamed(vc,t.env).configure(this,t),this.actived=!0)},this._uid=Da.GenAutoIncrementId(),this.global=Ao.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}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.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}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)}};_c=gc([qa(),fc("design:paramtypes",[])],_c);var yc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xc=function(t,e){return function(i,s){e(i,s,t)}};let Sc=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=Ao.global,this._textMeasureMap=new Map,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}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||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=pc.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="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:Zl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Fe(Object.assign({defaultFontParams:{fontFamily:Zl.fontFamily,fontSize:Zl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=xo.get(mc),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 Ac;Sc=yc([qa(),xc(0,Xa(po)),xc(0,Za(Oh)),bc("design:paramtypes",[Object])],Sc),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Ac||(Ac={}));const kc=new We;let Mc=class{constructor(){this.matrix=new We}init(t){return this.mode=Ac.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Ac.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(kc.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(kc.a,kc.b,kc.c,kc.d,kc.e,kc.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(kc.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(kc.a,kc.b,kc.c,kc.d,kc.e,kc.f),this}scale(t,e,i){return this.mode===Ac.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Ac.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return kc.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(kc.a,kc.b,kc.c,kc.d,kc.e,kc.f),this}translate(t,e){return this.mode===Ac.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Ac.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Mc=yc([qa(),bc("design:paramtypes",[])],Mc);const Tc={arc:eh,area:ih,circle:sh,line:ah,path:oh,symbol:dh,text:uh,rect:ch,polygon:lh,star:hh,richtext:ph,richtextIcon:fh,image:gh,group:nh,glyph:rh},wc=Object.keys(Tc);function Cc(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Ec={arc:Object.assign({},Tc.arc),area:Object.assign({},Tc.area),circle:Object.assign({},Tc.circle),line:Object.assign({},Tc.line),path:Object.assign({},Tc.path),symbol:Object.assign({},Tc.symbol),text:Object.assign({},Tc.text),rect:Object.assign({},Tc.rect),polygon:Object.assign({},Tc.polygon),star:Object.assign({},Tc.star),richtext:Object.assign({},Tc.richtext),richtextIcon:Object.assign({},Tc.richtextIcon),image:Object.assign({},Tc.image),group:Object.assign({},Tc.group),glyph:Object.assign({},Tc.glyph)};class Bc{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},wc.forEach((t=>{this._defaultTheme[t]=Object.create(Ec[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,i=!1){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,ot.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;wc.forEach((s=>{const n=Object.create(Ec[s]);t&&t[s]&&Cc(n,t[s]),i[s]&&Cc(n,i[s]),e[s]&&Cc(n,e[s]),this.combinedTheme[s]=n})),e.common&&wc.forEach((t=>{Cc(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 Pc=new Bc;function Lc(t,e){return t.glyphHost?Lc(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)):Pc.getTheme()}return null}(t)||t.attachedThemeGraphic&&Lc(t.attachedThemeGraphic)||Pc.getTheme()}var Rc=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 Oc 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=Da.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){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,e=!1){return Rc(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,e=!0){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,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)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===t||t===e)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&&ot.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this===t)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,e=!1){let 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,e=!1){let 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,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Fc))return void ot.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(Vc(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 Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=Vc(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 Fc))return void ot.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=Vc(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 Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=Vc(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 Fc))return void ot.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=Hc.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Vc(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(Vc(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,Vc(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(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 Fc))return void ot.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"):Vc(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 zc))return void ot.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=Hc.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.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),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,supportsTouchEvents:o}),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 Fc,this.rootWheelEvent=new zc,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.addEventListener("pointermove",this.onPointerMove,!0),t.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.addEventListener("mousemove",this.onPointerMove,!0),t.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.removeEventListener("pointermove",this.onPointerMove,!0),t.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.removeEventListener("mousemove",this.onPointerMove,!0),t.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 Yc{static GetImage(t,e){var i;const s=Yc.cache.get(t);s?"fail"===s.loadState?Ao.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):Yc.loadImage(t,e)}static GetSvg(t,e){var i;let s=Yc.cache.get(t);s?"fail"===s.loadState?Ao.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"},Yc.cache.set(t,s),s.dataPromise=Ao.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.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Yc.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Yc.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Ao.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Ao.global.loadBlob(t):"json"===e&&(i.dataPromise=Ao.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Yc.isLoading&&Yc.toLoadAueue.length){Yc.isLoading=!0;const t=Yc.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Yc.cache.set(i,n),n.dataPromise=Ao.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))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Yc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Yc.loading()})).catch((t=>{console.error(t),Yc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Yc.loading()}))}}),0)}static loadImage(t,e){const i=$c(t,Yc.toLoadAueue);if(-1!==i)return Yc.toLoadAueue[i].marks.push(e),void Yc.loading();Yc.toLoadAueue.push({url:t,marks:[e]}),Yc.loading()}static improveImageLoading(t){const e=$c(t,Yc.toLoadAueue);if(-1!==e){const t=Yc.toLoadAueue.splice(e,1);Yc.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function $c(t,e){for(let i=0;it?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(qc[0]=t[0],qc[2]=t[0],qc[1]=t[1],qc[3]=t[1],qc):t:t:0,Jc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Qc=[1,2,3,0,1,2,3,0];function td(t,e,i,s){for(;t>=Nt;)t-=Nt;for(;t<0;)t+=Nt;for(;t>e;)e+=Nt;Jc[0].x=i,Jc[1].y=i,Jc[2].x=-i,Jc[3].y=-i;const n=Math.ceil(t/Ht)%4,r=Math.ceil(e/Ht)%4;if(s.add(Gt(t)*i,Xt(t)*i),s.add(Gt(e)*i,Xt(e)*i),n!==r||e-t>jt){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new re(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{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)}}nd.TimeOut=1e3/60;const rd=new nd,ad=(t,e)=>{const i=((t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};class od{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}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function ld(t,e,i,s,n){return n?t.arc(i,s,e,0,Vt,!1,n):t.arc(i,s,e,0,Vt),!1}var hd=new class extends od{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 ld(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return ld(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(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 cd=new class extends od{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,this.parseSize(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,this.parseSize(e)/6,i,s,n,r)}};function dd(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 ud=new class extends od{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 dd(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return dd(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return dd(t,this.parseSize(e)/2+n,i,s,r)}};function pd(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var gd=new class extends od{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return pd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return pd(t,this.parseSize(e)/2+n,i,s)}};function fd(t,e,i,s,n=0){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}class md extends od{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 fd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return fd(t,this.parseSize(e)/2,i,s,n)}}var vd=new md;var _d=new class extends md{constructor(){super(...arguments),this.type="triangle"}};const yd=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),bd=Math.sin(Vt/10)*yd,xd=-Math.cos(Vt/10)*yd;function Sd(t,e,i,s){const n=bd*e,r=xd*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Vt*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 Ad=new class extends od{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 Sd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Sd(t,this.parseSize(e)/2+n,i,s)}};const kd=Kt(3);function Md(t,e,i,s){const n=e,r=n/kd,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 Td=new class extends od{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 Md(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Md(t,this.parseSize(e)/2+n,i,s)}};function wd(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 Cd=new class extends od{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return wd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return wd(t,this.parseSize(e)/2+n,i,s)}};function Ed(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Bd=new class extends od{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Ed(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ed(t,this.parseSize(e)/2+n,i,s)}};const Pd=-.5,Ld=Kt(3)/2,Rd=1/Kt(12);function Od(t,e,i,s){const n=e/2,r=e*Rd,a=n,o=e*Rd+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(Pd*n-Ld*r+i,Ld*n+Pd*r+s),t.lineTo(Pd*a-Ld*o+i,Ld*a+Pd*o+s),t.lineTo(Pd*l-Ld*h+i,Ld*l+Pd*h+s),t.lineTo(Pd*n+Ld*r+i,Pd*r-Ld*n+s),t.lineTo(Pd*a+Ld*o+i,Pd*o-Ld*a+s),t.lineTo(Pd*l+Ld*h+i,Pd*h-Ld*l+s),t.closePath(),!1}var Id=new class extends od{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 Od(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Od(t,this.parseSize(e)/2+n,i,s)}};function Dd(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}var Fd=new class extends od{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 Dd(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Dd(t,this.parseSize(e)/2,i,s,n)}};function zd(t,e,i,s,n=0){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}var jd=new class extends od{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 zd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return zd(t,this.parseSize(e)/2,i,s,n)}};function Hd(t,e,i,s,n=0){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}var Vd=new class extends od{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 Hd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Hd(t,this.parseSize(e)/2,i,s,n)}};const Nd=Kt(3);function Ud(t,e,i,s){const n=e*Nd;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var Wd=new class extends od{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Ud(t,this.parseSize(e)/2/Nd,i,s)}drawOffset(t,e,i,s,n){return Ud(t,this.parseSize(e)/2/Nd+n,i,s)}};function Gd(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 Yd=new class extends od{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 Gd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Gd(t,this.parseSize(e)/4+n,i,s)}};function $d(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 Xd=new class extends od{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 $d(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return $d(t,this.parseSize(e)/4+n,i,s)}};function Kd(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 qd=new class extends od{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 Kd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Kd(t,this.parseSize(e)/4+n,i,s)}};function Zd(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 Jd=new class extends od{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 Zd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Zd(t,this.parseSize(e)/4+n,i,s)}};function Qd(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var tu=new class extends od{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return Qd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Qd(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function eu(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var iu=new class extends od{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return eu(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return eu(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function su(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 nu=new class extends od{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 su(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return su(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function ru(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function au(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var ou=new class extends od{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)?au(t,e,i,s):ru(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?au(t,e+2*n,i,s):ru(t,[e[0]+2*n,e[1]+2*n],i,s)}};const lu=new Ne;class hu{constructor(t,e,i=!1){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 e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),sl(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(sl(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{lu.x1=i.bounds.x1*t,lu.y1=i.bounds.y1*t,lu.x2=i.bounds.x2*t,lu.y2=i.bounds.y2*t,e.union(lu)}))}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 cu={};[hd,cd,ud,gd,Wd,_d,Ad,Td,Cd,Bd,Id,Fd,jd,vd,Vd,Yd,Xd,qd,Jd,ou,tu,iu,nu].forEach((t=>{cu[t.type]=t}));const du={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"};class uu{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 pu(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function gu(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",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=gu(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=pu(t,"--\x3e",r+4,"Comment is not closed.");else{const a=gu(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 uu(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 uu(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 vu(t,e){return _u(t)}function _u(t,e){const i={};for(let e=0;ewu.set(t,!0)));const Cu=new Map;function Eu(t){if(wu.has(t))return!0;if(Cu.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>Cu.set(t,!0)));const Bu=Mu(),Pu=Mu(),Lu=Mu(),Ru=Mu(),Ou=Mu(),Iu=Mu(),Du=Mu(),Fu=Mu(),zu=Mu(),ju=Mu();Mu();const Hu=Mu();Mu();const Vu=Mu();Mu();const Nu=Mu(),Uu=Mu(),Wu=Symbol.for("GraphicService"),Gu=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"},$u=Object.keys(Yu),Xu={duration:200,easing:"cubicOut"};function Ku(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}function qu(t,e,i){const s=i[0],n=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]*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],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*s+c*n+g*r+e[12],t[13]=o*s+d*n+f*r+e[13],t[14]=l*s+u*n+m*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function Zu(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 Ju(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],f=e[12],m=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*f,t[1]=y*n+b*l+x*u+S*m,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*f,t[5]=y*n+b*l+x*u+S*m,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*f,t[9]=y*n+b*l+x*u+S*m,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*f,t[13]=y*n+b*l+x*u+S*m,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function Qu(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 tp{constructor(){this.pools=[]}static identity(t){return Ku(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 tp.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},np=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const rp=new We(1,0,0,1,0,0),ap={x:0,y:0};let op=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new We(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new We(1,0,0,1,0,0),this.path=new Wl,this._clearMatrix=new We(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return ep.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new We(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(ep.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(ep.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){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,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=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(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){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},ap),function(t,e,i){return uc(t,0,!1,e,i)}(this.path.commandList,ap.x,ap.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},ap);const i=_h(this,this.lineWidth,this.dpr);return function(t,e,i,s){return uc(t,e,!0,i,s)}(this.path.commandList,i,ap.x,ap.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(t=!0,e=this.dpr){this.setTransformFromMatrix(rp,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>ep.free(t))),this.stack.length=0}};op=sp([qa(),np("design:paramtypes",[Object,Number])],op);const lp={WIDTH:500,HEIGHT:500,DPR:1};class hp{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}set nativeCanvas(t){this._nativeCanvas=t}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=lp.WIDTH,height:n=lp.HEIGHT,dpr:r=lp.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(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var cp;hp.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(cp||(cp={}));class dp{static Get(t,e=cp.Color1,i=[0,0,0,1]){if(e===cp.Color1){const e=dp.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ii.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];dp.store1[t]=e,dp.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=dp.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ii.parseColorString(t);return n&&(dp.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],dp.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===cp.Color1){if(dp.store1[t])return;dp.store1[t]=i,dp.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(dp.store255[t])return;dp.store255[t]=i,dp.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function up(t,e=!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 pp(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)=>{var a,o;return gp(y(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,y(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):gp(t,e,i,s,n)}function gp(t,e,i,s,n){if(!t||!e)return t&&up(t)||e&&up(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=dp.Get(t,cp.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=dp.Get(e,cp.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:up(a)})))});return o?pp(r,l,i,s,n):pp(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:_p(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:_p(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:_p(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),up(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)}function fp(t,e,i){return`rgba(${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})`}dp.store255={},dp.store1={};const mp=[0,0,0,0],vp=[0,0,0,0];function _p(t,e,i){return dp.Get(t,cp.Color255,mp),dp.Get(e,cp.Color255,vp),`rgba(${Math.round(mp[0]+(vp[0]-mp[0])*i)},${Math.round(mp[1]+(vp[1]-mp[1])*i)},${Math.round(mp[2]+(vp[2]-mp[2])*i)},${mp[3]+(vp[3]-mp[3])*i})`}class yp{static GetCanvas(){try{return yp.canvas||(yp.canvas=Ao.global.createCanvas({})),yp.canvas}catch(t){return null}}static GetCtx(){if(!yp.ctx){const t=yp.GetCanvas();yp.ctx=t.getContext("2d")}return yp.ctx}}class bp extends Ge{static getInstance(){return bp._instance||(bp._instance=new bp),bp._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=yp.GetCanvas(),s=yp.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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new bp(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class xp{static GetSize(t){for(let e=0;e=t)return xp.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=xp.GenKey(t,e,i,s,n),l=xp.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=xp.GenKey(t,e,i,s,n);xp.cache[l]?xp.cache[l].push({width:a,height:o,pattern:r}):xp.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}xp.cache={},xp.ImageSize=[20,40,80,160,320,640,1280,2560];const Sp=new Ne,Ap=new We;new Ne;const kp=["lineWidth","scaleX","scaleY","angle","anchor","visible"],Mp=["x","y"],Tp=["scaleX","scaleY"],wp=["angle"],Cp=new re,Ep={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Bp extends Oc{static mixin(t){const e=Object.keys(t);for(let i=0;i10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=cu[t];if(e)return e;if(e=Bp.userSymbolMap[t],e)return e;if(!0===((i=t=du[t]||t).startsWith("{const e=(new Wl).fromString(t.d),i={};$u.forEach((e=>{t[e]&&(i[Yu[e]]=t[e])})),n.push({path:e,attribute:i}),Sp.union(e.bounds)}));const r=Sp.width(),a=Sp.height(),o=1/Yt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new hu(t,n,!0);return Bp.userSymbolMap[t]=l,l}var i;const s=(new Wl).fromString(t),n=s.bounds.width(),r=s.bounds.height(),a=1/Yt(n,r);s.transform(0,0,a,a);const o=new hu(t,s);return Bp.userSymbolMap[t]=o,o}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,s=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:n=e.boundsPadding}=i,r=Zc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new Fo(t);return sl(e.commandList,i,0,0),!0}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(t=!0){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(t=!0){return this._transMatrix||(this._transMatrix=new We),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&Xo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&Xo.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&Xo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&Xo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&Xo.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&Xo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=Xo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===Ko.GLOBAL){const i=new re(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){this.setAttributes(t,e,i),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||s)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,i){t&&((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,e=!1,i){const s=Object.keys(t);for(let e=0;e{i[e]?(o||(o={}),o[e]=t[e]):a[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(r=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==r?r:Xu;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:a,duration:l.duration,easing:l.easing}}]),o&&this.setAttributesAndPreventAnimate(o,!1,{type:qo.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t)}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:qo.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{type:qo.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(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,i;const s=this.attribute[t];return this.animates&&this.animates.size?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=s?s:null===(i=this.finalAttribute)||void 0===i?void 0:i[t]}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){const i=y(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);s.length!==this.currentStates.length&&this.useStates(s,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;this.stateSort&&(t=t.sort(this.stateSort));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|=Xo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=Xo.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=Xo.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&Xo.UPDATE_SHAPE_AND_BOUNDS)===Xo.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=Xo.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Xo.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=Xo.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=Xo.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=Xo.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=Xo.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=Xo.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&Xo.UPDATE_LAYOUT)}getAnchor(t,e,i){const s=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=$l.x,y:e=$l.y,scaleX:i=$l.scaleX,scaleY:s=$l.scaleY,angle:n=$l.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(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=Gt(a),f=Xt(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const _=m-i,y=v-s,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,A=d*g-h*f;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*A,t.e=u+l*m+c*v-b*_-S*y,t.f=p+h*m+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,!0),Ao.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY($l);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Ap.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.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:qo.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Ao.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),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 Wl).fromString(t):this.pathProxy=new Wl,this.pathProxy}loadImage(t,e=!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(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",this.stopAnimates(),Ao.graphicService.onRelease(this),super.release()}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new jc(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)}}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||Ao.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new op(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}var Pp;Bp.userSymbolMap={},Bp.mixin(Uc),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Pp||(Pp={}));let Lp=class t extends Bp{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Iu,this._childUpdateTag=Xo.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 Bc),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Bc)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===Ko.GLOBAL){const i=new re(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&Xo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=$l.x,y:e=$l.y,dx:i=$l.dx,dy:s=$l.dy,scaleX:n=$l.scaleX,scaleY:r=$l.scaleY,angle:a=$l.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()}getGraphicTheme(){return Lc(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return Ao.graphicService.updateTempAABBBounds(i),Ao.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=Xo.CLEAR_BOUNDS,this._childUpdateTag&=Xo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=Xo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&Xo.UPDATE_BOUNDS||(this._childUpdateTag|=Xo.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(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().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),this.getGraphicService().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(t=!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&Xo.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=Ao.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}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}};function Rp(t){return new Lp(t)}Lp.NOWORK_ANIMATE_ATTR=Ep;class Op extends Lp{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 Bc,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!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=>{Ao.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=>{Ao.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 Ip=Symbol.for("TransformUtil"),Dp=Symbol.for("GraphicUtil"),Fp=Symbol.for("LayerService"),zp=Symbol.for("StaticLayerHandlerContribution"),jp=Symbol.for("DynamicLayerHandlerContribution"),Hp=Symbol.for("VirtualLayerHandlerContribution");var Vp,Np=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)};let Wp=Vp=class{static GenerateLayerId(){return`${Vp.idprefix}_${Vp.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Ao.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?xo.get(zp):"dynamic"===t?xo.get(jp):xo.get(Hp),e}createLayer(t,e={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 Op(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Vp.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)}};Wp.idprefix="visactor_layer",Wp.prefix_count=0,Wp=Vp=Np([qa(),Up("design:paramtypes",[])],Wp);var Gp=new Fa((t=>{t(bo).to(Po).inSingletonScope(),t(mc).to(_c),t(Dp).to(Sc).inSingletonScope(),t(Ip).to(Mc).inSingletonScope(),t(Fp).to(Wp).inSingletonScope()}));function Yp(t,e){return!(!t&&!e)}function $p(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function Xp(t,e,i){return i&&t*e>0}function Kp(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function qp(t,e){return t*e>0}function Zp(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Jp(t,e,i,s,n,r,a){const o=t-i,l=e-s,h=(a?r:-r)/Math.sqrt(o*o+l*l),c=h*l,d=-h*o,u=t+c,p=e+d,g=i+c,f=s+d,m=(u+g)/2,v=(p+f)/2,_=g-u,y=f-p,b=_*_+y*y,x=n-r,S=u*f-g*p,A=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let k=(S*y-_*A)/b,M=(-S*_-y*A)/b;const T=(S*y+_*A)/b,w=(-S*_+y*A)/b,C=k-m,E=M-v,B=T-m,P=w-v;return C*C+E*E>B*B+P*P&&(k=T,M=w),{cx:k,cy:M,x01:-c,y01:-d,x11:k*(n/x-1),y11:M*(n/x-1)}}function Qp(t,e,i,s,n){const r=Ut(i-e),a=t.getParsedCornerRadius(),o=y(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,_=Math.max(f,g),b=Math.max(m,v);let x=_,S=b;const A=n*Gt(c),k=n*Xt(c),M=s*Gt(u),T=s*Xt(u);let w,C,E,B;if((b>zt||_>zt)&&(w=n*Gt(d),C=n*Xt(d),E=s*Gt(p),B=s*Xt(p),r1?0:P<-1?jt:Math.acos(P))/2),l=Kt(t[0]*t[0]+t[1]*t[1]);S=$t(b,(s-l)/(o-1)),x=$t(_,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:E,yirs:B,xore:w,yore:C,xire:M,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:_,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function tg(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ut(l-o),c=l>o;let d=!1;if(n=Nt-zt)e.moveTo(i+n*Gt(o),s+n*Xt(o)),e.arc(i,s,n,o,l,!c),r>zt&&(e.moveTo(i+r*Gt(l),s+r*Xt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:M,limitedIcr:T,innerDeltaAngle:w,innerEndAngle:C,innerStartAngle:E,innerCornerRadiusStart:B,innerCornerRadiusEnd:P,maxInnerCornerRadius:L}=Qp(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>zt){const t=$t(v,m),r=$t(_,m),o=Jp(g,f,u,p,n,t,Number(c)),l=Jp(b,x,S,A,n,r,Number(c));m0&&e.arc(i+o.cx,s+o.cy,t,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,n,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Gt(Wt(l.y01,l.x01)),s+l.cy+r*Xt(Wt(l.y01,l.x01))):e.moveTo(i+b,s+n*Xt(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,M,!c)):e.moveTo(i+n*Gt(M),s+n*Xt(M));if(!(r>zt)||w<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(T>zt){const t=$t(B,T),n=$t(P,T),o=Jp(S,A,b,x,r,-n,Number(c)),l=Jp(u,p,g,f,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,Wt(o.y01,o.x01),Wt(o.y11,o.x11),!c),e.arc(i,s,r,Wt(o.cy+o.y11,o.cx+o.x11),Wt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Wt(l.y11,l.x11),Wt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Gt(Wt(l.y01,l.x01)),s+l.cy+t*Xt(Wt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),!a||a[2]?e.arc(i,s,r,C,E,c):e.moveTo(i+r*Gt(E),s+r*Xt(E))}return a?a[3]&&e.lineTo(i+n*Gt(o),s+n*Xt(o)):e.closePath(),d}const eg=Symbol.for("ArcRenderContribution"),ig=Symbol.for("AreaRenderContribution"),sg=Symbol.for("CircleRenderContribution"),ng=Symbol.for("GroupRenderContribution"),rg=Symbol.for("ImageRenderContribution"),ag=Symbol.for("PathRenderContribution"),og=Symbol.for("PolygonRenderContribution"),lg=Symbol.for("RectRenderContribution"),hg=Symbol.for("SymbolRenderContribution"),cg=Symbol.for("TextRenderContribution"),dg=Symbol.for("InteractiveSubRenderContribution");function ug(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function pg(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}var gg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mg=function(t,e){return function(i,s){e(i,s,t)}};function vg(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:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:v}=e.attribute,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(s=m[2])&&void 0!==s?s:0}if(Ku(t),qu(t,t,[n+o,r+l,a+h]),qu(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),qu(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]),f){const i=ip.allocate(),s=[0,0];if(v){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=m[1]}qu(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,f),qu(i,i,[-s[0],-s[1],0]),Ju(t,t,i)}}let _g=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new _o(["graphic"]),onSetStage:new _o(["graphic","stage"]),onRemove:new _o(["graphic"]),onRelease:new _o(["graphic"]),onAddIncremental:new _o(["graphic","group","stage"]),onClearIncremental:new _o(["graphic","group","stage"]),beforeUpdateAABBBounds:new _o(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new _o(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new _o(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ne,this.tempAABBBounds2=new Ne}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)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new Fo(t);return sl(i.commandList,s,0,0),!0}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=pg(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=ug(n,e);i.set(s,i.y1,s+e,i.y2)}}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){Au(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;Au(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&&He(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};_g=gg([qa(),mg(0,Xa(Gu)),fg("design:paramtypes",[Object])],_g);const yg=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},bg=["radius","startAngle","endAngle",...kp];class xg extends Bp{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=Ru}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)}getGraphicTheme(){return Lc(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Ao.graphicService.updateTempAABBBounds(i);return yg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Nt-zt?i.set(-r,-r,r,r):td(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,bg)}needUpdateTag(t){return super.needUpdateTag(t,bg)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Wl,s.arc(0,0,r,a,o),s}clone(){return new xg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return xg.NOWORK_ANIMATE_ATTR}}function Sg(t){return new xg(t)}xg.NOWORK_ANIMATE_ATTR=Ep;class Ag{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Lo.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,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;a{t+=e.str})),(Array.isArray(r)?r.join(""):r).toString()!==t}return"vertical"===s.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==s.text.toString():null!=this.clipedText&&this.clipedText!==s.text.toString()}get multilineLayout(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=Uu,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}getGraphicTheme(){return Lc(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new Mg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Te(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=Ao.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Au(n,o/Math.abs(r+a),!0,l),i.union(n)}return Ao.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Ao.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,He(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:_=s.ignoreBuf,keepCenterInLine:y=s.keepCenterInLine}=n,b=_?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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(f/2),this._AABBBounds}const S=Ao.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new Ag(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:y}),{bbox:k}=A;return this.cache.layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{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,measureMode:v=r.measureMode,suffixPosition:_=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),k=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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 M=Ao.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),T={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:k},w=new Ag(a,T,M),C=y(t)?t.map((t=>t.toString())):[t.toString()],E=[],B=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/k),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),B[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const t=ug(_,a),e=this.cache.verticalList.length*v,i=pg(y,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>function(t){const e=[];let i=0,s="";for(let n=0;n{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===Tu.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))})),this.cache.verticalList=b,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Yt(e,a)}));const x=ug(_,a),S=this.cache.verticalList.length*v,A=pg(y,S,d);return this._AABBBounds.set(A,x,A+S,x+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=ad(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=kg){return super.needUpdateTags(t,e)}needUpdateTag(t,e=kg){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new Mg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Mg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return Mg.baselineMapAlign}getAlignMapBaseline(){return Mg.alignMapBaseline}}function Tg(t){return new Mg(t)}Mg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Ep),Mg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},Mg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const wg=["symbolType","size",...kp];let Cg=class t extends Bp{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=Nu}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}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{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return Lc(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Ao.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Au(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(y(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){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,wg)}needUpdateTag(t){return super.needUpdateTag(t,wg)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new Wl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Wl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Eg(t){return new Cg(t)}Cg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Ep);const Bg=["segments","points","curveType","curveTension",...kp];let Pg=class t extends Bp{constructor(t={}){super(t),this.type="line",this.numberType=Fu}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=id(i,s,e))}getGraphicTheme(){return Lc(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),Ao.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Bg)}needUpdateTag(t){return super.needUpdateTag(t,Bg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Wl;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Lg(t){return new Pg(t)}Pg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ep);const Rg=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}},Og=["width","x1","y1","height","cornerRadius",...kp];class Ig extends Bp{constructor(t){super(t),this.type="rect",this.numberType=Hu}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Lc(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=Ao.graphicService.updateTempAABBBounds(i);return yg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Og)}needUpdateTag(t){return super.needUpdateTag(t,Og)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=Rg(e);return t=new Wl,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new Ig(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ig.NOWORK_ANIMATE_ATTR}}function Dg(t){return new Ig(t)}Ig.NOWORK_ANIMATE_ATTR=Ep;class Fg extends Bp{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,e=!1,i){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}getGraphicTheme(){return Lc(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}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(),this.stateSort&&(t=t.sort(this.stateSort));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.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Fg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Fg.NOWORK_ANIMATE_ATTR}}function zg(t){return new Fg(t)}Fg.NOWORK_ANIMATE_ATTR=Ep;class jg{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=bh[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}}}function Hg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Vg{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=ad(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Bh(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||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,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r: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}=Bh(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=wh(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Bh(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=Hg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=wh(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Bh(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=Hg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&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=wh(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Bh(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const Ng=["width","height","image",...kp];class Ug extends Bp{constructor(t){super(t),this.type="image",this.numberType=Du,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}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()})),this.addUpdateBoundTag()}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)}getGraphicTheme(){return Lc(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=Ao.graphicService.updateTempAABBBounds(i);return yg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return gh[t]}needUpdateTags(t){return super.needUpdateTags(t,Ng)}needUpdateTag(t){return super.needUpdateTag(t,Ng)}clone(){return new Ug(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ug.NOWORK_ANIMATE_ATTR}}function Wg(t){return new Ug(t)}Ug.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Ep);class Gg extends Ug{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=Zc(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=Zc(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=gh.width,height:e=gh.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 Yg{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 Gg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=bh[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Vg){const e=Mh.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,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Gg)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Bh(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Gg)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Gg)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||Sh;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,Th(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||xh;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?yh(t,s,{AABBBounds:i}):s,Th(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Gg)break;const{width:n}=Bh(t,s.character,s.ascentDescentMode),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.forEach(((t,e)=>{i+=t instanceof Gg?t.width:t.getWidthWithEllips(this.direction)})),i}}class $g{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=bh[this.direction]}store(t){if(t instanceof Gg){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 Yg(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,e=!1){t instanceof Gg?"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||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=wh(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Vg(i,t.newLine,t.character,t.ascentDescentMode),new Vg(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let Xg=!1;try{Xg=Intl&&"function"==typeof Intl.Segmenter}catch(t){Xg=!1}const Kg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...kp];class qg extends Bp{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Vu,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:ph.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:ph.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:ph.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:ph.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:ph.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:ph.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:ph.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:ph.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Lc(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&_(t.text)&&qg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&_(t.text)&&qg.splitText(t.text).length>1)))}static splitText(t){if(Xg){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=qg.splitText(t.text.toString());if(_(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),Ao.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Ao.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Ao.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Kg)}needUpdateTag(t){return super.needUpdateTag(t,Kg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!qg.AllSingleCharacter(_)&&(_=qg.TransformTextConfig2SingleCharacter(_),this.attribute.textConfig=_);const y=[],b=null!=t?t:_;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,y.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),M="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),T=new jg(0,0,(k?n:x?i:0)||0,(M?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&x,!M&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),w=new $g(T);if(w.newLine=v,p){let t=0,e=!1;for(let i=0;i{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new qg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(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())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return qg.NOWORK_ANIMATE_ATTR}}function Zg(t){return new qg(t)}qg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Ep);const Jg=["path","customPath",...kp];class Qg extends Bp{constructor(t){super(t),this.type="path",this.numberType=zu}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=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Wl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Wl?this.cache:t.path)}getGraphicTheme(){return Lc(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=Ao.graphicService.updateTempAABBBounds(i);yg(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new Wl).fromString(t.path):t.customPath&&(this.cache=new Wl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,Jg)}needUpdateTag(t){return super.needUpdateTag(t,Jg)}toCustomPath(){return(new Wl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Qg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Qg.NOWORK_ANIMATE_ATTR}}function tf(t){return new Qg(t)}Qg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Ep);const ef=["segments","points","curveType","curveTension",...kp];class sf extends Bp{constructor(t){super(t),this.type="area",this.numberType=Lu}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}getGraphicTheme(){return Lc(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),Ao.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),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}_interpolate(t,e,i,s,n){"points"===t&&(n.points=id(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,ef)}needUpdateTag(t){return super.needUpdateTag(t,ef)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Wl;const 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 sf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return sf.NOWORK_ANIMATE_ATTR}}function nf(t){return new sf(t)}sf.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ep);const rf=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...kp];class af extends Bp{constructor(t){super(t),this.type="arc",this.numberType=Bu}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=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(y(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();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=he(e),i=e+r,s&&Ut(r)zt&&o>zt)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=this.getGraphicTheme(),{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=Kt(a*a+o*o)}=this.attribute,h=Ut(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>zt&&l>zt){const i=e>t?1:-1;let s=Zt(Number(l)/o*Xt(g)),n=Zt(Number(l)/a*Xt(g));return(f-=2*s)>zt?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>zt?(n*=i,c+=n,d-=n):(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}}getGraphicTheme(){return Lc(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Ao.graphicService.updateTempAABBBounds(i);yg(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=zt?i.set(0,0,0,0):Math.abs(o-l)>Nt-zt?i.set(-s,-s,s,s):(td(l,o,s,i),td(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,rf)}needUpdateTag(t){return super.needUpdateTag(t,rf)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Ut(o-a),d=o>a;if(h=Nt-zt)n.moveTo(0+h*Gt(a),0+h*Xt(a)),n.arc(0,0,h,a,o,!d),l>zt&&(n.moveTo(0+l*Gt(o),0+l*Xt(o)),n.arc(0,0,l,o,a,d));else{const t=h*Gt(a),e=h*Xt(a),i=l*Gt(o),s=l*Xt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new af(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return af.NOWORK_ANIMATE_ATTR}}function of(t){return new af(t)}af.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Ep);const lf=["points","cornerRadius",...kp];class hf extends Bp{constructor(t){super(t),this.type="polygon",this.numberType=ju}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Lc(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),Ao.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Ao.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=id(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,lf)}needUpdateTag(t){return super.needUpdateTag(t,lf)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Wl,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new hf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return hf.NOWORK_ANIMATE_ATTR}}function cf(t){return new hf(t)}hf.NOWORK_ANIMATE_ATTR=Ep;class df extends Lp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!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 uf(t){return new df(t)}const pf=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 gf,ff;function mf(t){return gf||(gf=pf.CreateGraphic("text",{})),gf.initAttributes(t),gf.AABBBounds}var vf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},yf=function(t,e){return function(i,s){e(i,s,t)}};class bf{constructor(){this.time=Qo.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:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit,backgroundKeepAspectRatio:y=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip}=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=Lc(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:_,backgroundKeepAspectRatio:y,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s){const{backgroundMode:n,backgroundFit:r,backgroundKeepAspectRatio:a,backgroundScale:o=1,backgroundOffsetX:l=0,backgroundOffsetY:h=0}=s,c=i.width(),d=i.height();let u=c,p=d;if("no-repeat"===n)if(r)if(a){const s=Math.max(c/e.width,d/e.height);t.drawImage(e,i.x1+l,i.y1+h,e.width*s*o,e.height*s*o)}else t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const s=e.width*o,n=e.height*o;t.drawImage(e,i.x1+l,i.y1+h,s,n)}else{if(r&&"repeat"!==n&&(e.width||e.height)){const i=e.width,s=e.height;"repeat-x"===n?(u=i*(d/s),p=d):"repeat-y"===n&&(p=s*(c/i),u=c);const r=t.dpr,a=pc.allocate({width:u,height:p,dpr:r}),o=a.getContext("2d");o&&(o.inuse=!0,o.clearMatrix(),o.setTransformForCurrent(!0),o.clearRect(0,0,u,p),o.drawImage(e,0,0,u,p),e=a.nativeCanvas),pc.free(a)}const s=t.dpr,a=t.createPattern(e,n);a.setTransform&&a.setTransform(new DOMMatrix([1/s,0,0,1/s,0,0])),t.fillStyle=a,t.translate(i.x1,i.y1),t.fillRect(0,0,c,d),t.translate(-i.x1,-i.y1)}}}const xf=new bf;let Sf=class{constructor(t){this.subRenderContribitions=t,this.time=Qo.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)}))}};Sf=vf([qa(),yf(0,Xa(po)),yf(0,Za(dg)),_f("design:paramtypes",[Object])],Sf);const Af=new class{constructor(){this.time=Qo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),_=t.AABBBounds,y=null!==(p=t.attribute.width)&&void 0!==p?p:_.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:_.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[y,b],i+y/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const kf=new class{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}};class Mf{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=pc.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])),pc.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,Nt),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:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h;const{textureRatio:c=r.textureRatio,textureOptions:d=null}=e.attribute;let u=this.textureMap.get(t);if(!u)switch(t){case"circle":u=this.createCirclePattern(o,l,a,i);break;case"diamond":u=this.createDiamondPattern(o,l,a,i);break;case"rect":u=this.createRectPattern(o,l,a,i);break;case"vertical-line":u=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":u=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":u=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":u=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":u=this.createGridPattern(o,l,a,i)}if(d&&d.dynamicTexture){const{gridConfig:u={},useNewCanvas:p}=d,g=e.AABBBounds;s=g.x1,n=g.y1;const f=i;let m;if(p){m=pc.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=m.getContext("2d");t.clearRect(0,0,g.width(),g.height()),s=0,n=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,s,n,r),f.clip();const v=g.width(),_=g.height(),y=l,b=o,x=u.columns?u.columns:Math.ceil(v/b),S=u.rows?u.rows:Math.ceil(_/b),A=u.gutterColumn?u.gutterColumn:2*y,k=u.gutterRow?u.gutterRow:2*y;this._tempSymbolGraphic||(this._tempSymbolGraphic=Eg({}));const M=u.columns?v/u.columns:b,T=u.rows?_/u.rows:b;this._tempSymbolGraphic.setAttributes({size:[M-A,T-k],symbolType:t});const w=this._tempSymbolGraphic.getParsedPath();for(let t=0;t{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:_h(e,o,e.dpr),c=o/w,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:w+u*h,innerRadius:T-u*h,startAngle:_-u*c,endAngle:y+u*c}),e.beginPath(),tg(t,e,i,s,w+u*h,T-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/A,(S-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder"),t.setAttributes({outerRadius:w,innerRadius:T,startAngle:_,endAngle:y})}},Cf=Tf,Ef=xf;const Bf=new class{constructor(){this.time=Qo.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,f=p&&!1!==p.visible;if(!g&&!f)return;const{radius:m=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,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:_h(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),f&&M(p,"innerBorder")}},Pf=Tf,Lf=xf;const Rf=new class extends bf{constructor(){super(...arguments),this.time=Qo.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,backgroundKeepAspectRatio:f=l.backgroundKeepAspectRatio,backgroundScale:m=l.backgroundScale,backgroundOffsetX:v=l.backgroundOffsetX,backgroundOffsetY:_=l.backgroundOffsetY}=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,{backgroundMode:p,backgroundFit:g,backgroundKeepAspectRatio:f,backgroundScale:m,backgroundOffsetX:v,backgroundOffsetY:_}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Of=jt/2;function If(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=Ut(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Ut(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Ut(t[0]),i=Ut(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Ut(l[0]),l[1]=Ut(l[1]),l[2]=Ut(l[2]),l[3]=Ut(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],_=[c[0],c[1]+g[1]],y=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],x=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!q(v,_)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Of,0,!1)}if(o&&o[1]?o[1](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(y,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Of,!1)}if(o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),!q(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Of,jt,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],jt,jt+Of,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}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};class Ff{constructor(){this.time=Qo.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,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:M,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:w,height:C}=t.attribute;w=(null!=w?w:k-i)||0,C=(null!=C?C:M-s)||0;const E=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=T?h:_h(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||y(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,w-o*g,C-o*g)):(e.beginPath(),If(e,u,p,w-o*g,C-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&E(u,"outerBorder"),f&&E(p,"innerBorder")}}let zf=class{constructor(){this.time=Qo.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)}};zf=Df([qa()],zf);let jf=class{constructor(){this.time=Qo.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:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:_=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||y(v)&&v.every((t=>0===t)))){let n,r=0;return If(e,i,s,b,x,v,"bevel"!==_,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};jf=Df([qa()],jf);const Hf=new Ff,Vf=Tf,Nf=xf;const Uf=new class extends Ff{constructor(){super(...arguments),this.time=Qo.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)}},Wf=xf;const Gf=new class{constructor(){this.time=Qo.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,f=p&&!1!==p.visible,m=g&&!1!==g.visible;if(!f&&!m)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,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,k=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:_h(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(y-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}},Yf=new class{constructor(){this.time=Qo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:_=l.scaleX,scaleY:y=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/_,(f-s)/y,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/_,(f-s)/y,l),e.stroke())))}},$f=Tf,Xf=xf;const Kf={x:0,y:0,z:0,lastModelMatrix:null};class qf{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(Af),this.builtinContributions.push(kf),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===Qo.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Qo.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}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)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Lc(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,_=Xp(d,u,h),y=qp(d,g),b=Yp(h),x=$p(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(_||y||a||o))return!0;e.beginPath();return sl(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),!0}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=Xp(o,l,n),p=qp(o,c),g=Yp(n,r),f=$p(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){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;Kf.x=n,Kf.y=r,Kf.z=a,Kf.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=ip.allocate(),n=ip.allocate();vg(n,t,e),Ju(s,d||s,n),Kf.x=0,Kf.y=0,Kf.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),ip.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Kf.x+=s.x,Kf.y+=s.y,Kf.z=a,i.setTransformForCurrent()}else if(p)Kf.x=0,Kf.y=0,Kf.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Kf.x+=s.x,Kf.y+=s.y,this.transformWithoutTranslate(i,Kf.x,Kf.y,Kf.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Kf.x=0,Kf.y=0,Kf.z=0;return Kf}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,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,_=(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,f,m,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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&ip.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}var Zf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qf=function(t,e){return function(i,s){e(i,s,t)}};let tm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Bu,this.builtinContributions=[wf,Ef,Cf],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=d>c;let p=!1;if(nzt){const t=$t(b,y),r=$t(x,y),a=Jp(v,_,f,m,n,t,Number(u)),o=Jp(A,k,M,T,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,Wt(o.y11,o.x11),Wt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>zt)||C<.001)e.lineTo(i+M,s+T),p=!0;else if(w>zt){const t=$t(B,w),n=$t(P,w),a=Jp(M,T,A,k,r,-n,Number(u)),o=Jp(f,m,v,_,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),w0&&e.arc(i+a.cx,s+a.cy,n,Wt(a.y01,a.x01),Wt(a.y11,a.x11),!u);const t=Wt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Gt(E),s+r*Xt(E));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Lc(t,null==r?void 0:r.theme).arc;const{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:k=l.outerRadius,innerRadius:M=l.innerRadius}=t.attribute;k+=b,M-=x;let T=0;const w=(c(S)&&S||S[0])&&"conical"===h.gradient;if(w){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Ut(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((_||E)&&(e.beginPath(),tg(t,e,i,s,k,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),g?(this._runStroke(t,e,i,s,l,y,E,v,o),this._runFill(t,e,i,s,l,_,m,u,p,a)):(this._runFill(t,e,i,s,l,_,m,u,p,a),this._runStroke(t,e,i,s,l,y,E,v,o))),!E&&y&&(e.beginPath(),tg(t,e,i,s,k,M,B),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(c(S)&&S||S[1])&&A){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Ut(h-r)>=Nt-zt){e.beginPath();const r=Math.abs(k-M)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,M,d,d+r),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o);const u=()=>{if(_){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+=Nt;for(;i>Nt;)i-=Nt;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),pp(o.color,l.color,h,!1)}(0,0,h,n);a||Xp&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}},p=()=>{y&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};u(),p()}}this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),w&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}};tm=Zf([qa(),Qf(0,Xa(po)),Qf(0,Za(eg)),Jf("design:paramtypes",[Object])],tm);var em=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},im=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sm=function(t,e){return function(i,s){e(i,s,t)}};let nm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Ru,this.builtinContributions=[Bf,Lf,Pf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Lc(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,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f;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,_,y,m,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{y&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o)}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function rm(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]=cl(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 am(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function om(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=am(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),rm(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=Zo.ROW:"y"===s?u=Zo.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.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 hm=class extends qf{constructor(){super(...arguments),this.numberType=Fu}draw(t,e,i,s){const n=Lc(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 f;if(!e)return;t.beginPath();om(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),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:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!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:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===_)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=Ul(x(t.points,v),_,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===_){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===y){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],y,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=y*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],$t(_,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,y,b,i,s,t,a,o)}};function cm(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),rm(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),rm(t,l,1,s),o=!1):o=!0}t.closePath()}hm=lm([qa()],hm);const dm=new class extends Mf{constructor(){super(...arguments),this.time=Qo.afterFillStroke}drawShape(t,e,i,s,n,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:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:sd(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:sd(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:sd(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:sd(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},um=xf;var pm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fm=function(t,e){return function(i,s){e(i,s,t)}};let mm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Lu,this.builtinContributions=[dm,um],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,_=m[0];e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const i=m[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,v)}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:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(y(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Lc(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:M=g.clipRange,closePath:T,points:w,segments:C}=t.attribute;let{curveType:E=g.curveType}=t.attribute;function B(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===E&&(E="linearClosed"),1===M&&!C&&!w.some((t=>!1===t.defined))&&"linear"===E)return this.drawLinearAreaHighPerformance(t,e,!!f,k,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(C&&C.length){let e,i;const s=C.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=Ul(B(t.points,x),E,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=C.length-1;t>=0;t--){const e=C[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=C[t-1].points,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=Ul(B(i,x),"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!w||!w.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=B(w,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Ul(e,E,{curveTension:b}),n=Ul(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===M){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,y,r[c],[g,t.attribute],M,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=M*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,A,v,k,y,r[u],[g,t.attribute],$t(f,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,y,t.attribute,g,M,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Lc(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,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let _,b,x=Zo.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],_=t.points[t.points.length-1]}else b=m[0],_=m[m.length-1];const S=Ut(_.x-b.x),A=Ut(_.y-b.y);x=null==_.x1?Zo.ROW:null==_.y1?Zo.COLUMN:Number.isFinite(S+A)?S>A?Zo.ROW:Zo.COLUMN:Zo.ROW,function(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?Zo.ROW:Zo.COLUMN,Number.isFinite(c)||(o=Zo.COLUMN),Number.isFinite(d)||(o=Zo.ROW);const u=i*(o===Zo.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;y(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),om(t,i[0]?e.top:e.bottom,l,x===Zo.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,M-c,o),t.stroke()}})(),!1}};mm=pm([qa(),fm(0,Xa(po)),fm(0,Za(ig)),gm("design:paramtypes",[Object])],mm);const vm=Tf,_m=xf;var ym=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xm=function(t,e){return function(i,s){e(i,s,t)}};let Sm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=zu,this.builtinContributions=[_m,vm],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:Lc(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:_,doFill:y,doStroke:b}=m;if(e.beginPath(),t.pathShape)sl(t.pathShape.commandList,e,i,s,1,1,f);else{sl((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,y,b,v,_,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):_&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{y&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,y,b,v,_,d,n,a,o)}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Sm=ym([qa(),xm(0,Xa(po)),xm(0,Za(ag)),bm("design:paramtypes",[Object])],Sm);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)}};let Tm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=Hu,this.builtinContributions=[Hf,Nf,Vf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Lc(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:_=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:M=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:w}=t.attribute;T=(null!=T?T:b-S)||0,w=(null!=w?w:x-A)||0;const C=Kp(g,f,T,w,h),E=Zp(g,v,T,w,M),B=Yp(h,c),P=$p(d,m);if(!t.valid||!_)return;if(!B&&!P)return;if(!(C||E||a||o||c))return;0===u||y(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,T,w)):(e.beginPath(),If(e,i,s,T,w,u,"bevel"!==p));const L={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,B,P,C,E,l,n,a,o,L),k?(this._runStroke(t,e,i,s,l,L,E,S,A,o),this._runFill(t,e,i,s,l,L,C,S,A,a)):(this._runFill(t,e,i,s,l,L,C,S,A,a),this._runStroke(t,e,i,s,l,L,E,S,A,o)),this.afterRenderStep(t,e,i,s,B,P,C,E,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}};Tm=Am([qa(),Mm(0,Xa(po)),Mm(0,Za(lg)),km("design:paramtypes",[Object])],Tm);var wm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Em=function(t,e){return function(i,s){e(i,s,t)}};let Bm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Nu,this.builtinContributions=[Gf,Xf,$f,Yf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:Lc(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,M=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,w=s,C=M;const E=e.camera;if(k&&E&&e.project){const t=e.project(i,s,M);e.camera=null,y(c)&&(c[0],c[1]),T=t.x,w=t.y,C=void 0}!1===A.draw(e,c,T,w,C,((n,r)=>{var h,c,v,_;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(_=r.lineWidth)&&void 0!==_?_:t.attribute.lineWidth,r=e}const y=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),y()):(y(),x())}))&&e.closePath(),e.camera=E,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,_,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,_,d,u,A,a)):(this._runFill(t,e,i,s,l,x,_,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,_,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Bm=wm([qa(),Em(0,Xa(po)),Em(0,Za(hg)),Cm("design:paramtypes",[Object])],Bm);const Pm=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ne)}allocate(t,e,i,s){if(!this.pools.length)return(new Ne).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 Ne(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(...t){this.pools=[]}};const Lm=new class extends bf{constructor(){super(...arguments),this.time=Qo.beforeFillStroke}drawShape(t,e,i,s,n,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,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio}=t.attribute;let T,{background:w}=t.attribute;if(!w)return;const C=()=>{"richtext"===t.type&&(e.restore(),e.save(),T&&e.setTransformFromMatrix(T,!0,1))};let E;"richtext"===t.type&&(T=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const B=g(w)&&w.background,P=t.transMatrix.onlyTranslate();if(B){const e=t.AABBBounds,i=(null!==(u=w.x)&&void 0!==u?u:e.x1)+(null!==(p=w.dx)&&void 0!==p?p:0),s=(null!==(f=w.y)&&void 0!==f?f:e.y1)+(null!==(m=w.dy)&&void 0!==m?m:0),n=null!==(v=w.width)&&void 0!==v?v:e.width(),r=null!==(_=w.height)&&void 0!==_?_:e.height();if(E=Pm.allocate(i,s,i+n,s+r),w=w.background,!P){const t=E.width(),e=E.height();E.set((null!==(y=w.x)&&void 0!==y?y:0)+(null!==(b=w.dx)&&void 0!==b?b:0),(null!==(x=w.y)&&void 0!==x?x:0)+(null!==(S=w.dy)&&void 0!==S?S:0),t,e)}}else E=t.AABBBounds,P||(E=mf(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(w);if("success"!==n.state||!n.data)return void C();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,E,{backgroundMode:A,backgroundFit:k,backgroundKeepAspectRatio:M}),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n,backgroundOpacity:r=1}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=r,e.fillStyle=w,n?(If(e,E.x1,E.y1,E.width(),E.height(),n,!0),e.fill()):e.fillRect(E.x1,E.y1,E.width(),E.height()),e.highPerformanceRestore()}B&&Pm.free(E),C()}};var Rm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Om=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Im=function(t,e){return function(i,s){e(i,s,t)}};let Dm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Uu,this.builtinContributions=[Lm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Lc(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,fontSize:v=d.fontSize,verticalMode:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute,x=null!==(l=ad(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:M,doStroke:T}=S,w=!f,C=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,M,T,A,k,d,n,a,o),w&&this.transformUseContext2d(t,d,C,e);const E=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=ep.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),ep.free(t)}T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,C))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,C))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,C),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,C)})))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,C),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,C,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!_){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Yt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;E(i,a-(e+1)*x+u,r,n),r+=s}))}))}w&&this.restoreTransformUseContext2d(t,d,C,e),this.afterRenderStep(t,e,i,s,M,T,A,k,d,n,a,o)}draw(t,e,i,s){const n=Lc(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,l,h,c){if(e+t<=0)return;const{textAlign:d=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,_=!u(c),y=_?c.width:i.clipedWidth,b=_?0:ug(d,y),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+y,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+y,t,o),h.stroke()}}};function Fm(t,e,i,s){if(e&&e.length){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},Um=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wm=function(t,e){return function(i,s){e(i,s,t)}};let Gm=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ju,this.builtinContributions=[Vm,Hm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Lc(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,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:b}=f;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?Fm(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Fm(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,f=(Math.atan2(u,d)-Math.atan2(g,p))/2,m=Math.abs(Math.tan(f));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,_=v/m;const y=zm(d,u),b=zm(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*m);const S=jm(h,_,y,d,u),A=jm(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=zm(k,M),w=jm(h,zm(_,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 B=E-C;B<0&&(C=E,B=-B),B>Math.PI&&(B-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),B&&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,_,b,m,v,l,n,a,o);const x=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,_,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=Lc(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Gm=Nm([qa(),Wm(0,Xa(po)),Wm(0,Za(og)),Um("design:paramtypes",[Object])],Gm);var Ym=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Xm=function(t,e){return function(i,s){e(i,s,t)}};let Km=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Iu}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Rf)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:Lc(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:M=l.x,y:T=l.y}=t.attribute,w=Kp(p,m,g,f,c),C=Zp(p,v,g,f),E=Yp(c,u),B=$p(d,x);if(!t.valid||!S)return;if(!h){if(!E&&!B)return;if(!(w||C||a||o||u))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,g,f)):(e.beginPath(),If(e,i,s,g,f,_,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Rf));const P={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===Qo.beforeFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o,P)})),h&&e.clip();const L=()=>{P.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,M-i,T-s,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,M-i,T-s,l),e.stroke()))};A?(R(),L()):(L(),R()),this._groupRenderContribitions.forEach((r=>{r.time===Qo.afterFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=Ao.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=Lc(t,null==s?void 0:s.theme).group,i=ip.allocate(),n=ip.allocate();vg(n,t,e),Ju(i,p||i,n),a.modelMatrix=i,ip.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&ip.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}};Km=Ym([qa(),Xm(0,Xa(po)),Xm(0,Za(ng)),$m("design:paramtypes",[Object])],Km);var qm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jm=function(t,e){return function(i,s){e(i,s,t)}};const Qm=["","repeat-x","repeat-y","repeat"];let tv=class extends qf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Du,this.builtinContributions=[Uf,Wf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Lc(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,image:m}=t.attribute,v=this.valid(t,l,a);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v;if(!m||!t.resources)return;const A=t.resources.get(m);if("success"!==A.state)return;const k=t.width,M=t.height;e.beginPath();let T=!1;0===p||y(p)&&p.every((t=>0===t))?e.rect(i,s,k,M):(If(e,i,s,k,M,p,"bevel"!==f),T=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const w=()=>{if(x)if(a)a(e,t.attribute,l);else if(_){e.setCommonStyle(t,t.attribute,i,s,l);let n=0;if("repeat"===h&&(n|=1),"repeat"===c&&(n|=2),n){const t=e.createPattern(A.data,Qm[n]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,k,M),e.translate(-i,-s,!0)}else e.drawImage(A.data,i,s,k,M)}},C=()=>{S&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(C(),T&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),w(),T&&e.restore()):(T&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),w(),T&&e.restore(),C()),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 Yc.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Lc(t).image;this._draw(t,a,!1,i)}};tv=qm([qa(),Jm(0,Xa(po)),Jm(0,Za(rg)),Zm("design:paramtypes",[Object])],tv);const ev=Symbol.for("IncrementalDrawContribution"),iv=Symbol.for("ArcRender"),sv=Symbol.for("AreaRender"),nv=Symbol.for("CircleRender"),rv=Symbol.for("GraphicRender"),av=Symbol.for("GroupRender"),ov=Symbol.for("LineRender"),lv=Symbol.for("PathRender"),hv=Symbol.for("PolygonRender"),cv=Symbol.for("RectRender"),dv=Symbol.for("SymbolRender"),uv=Symbol.for("TextRender"),pv=Symbol.for("RichTextRender"),gv=Symbol.for("GlyphRender"),fv=Symbol.for("ImageRender"),mv=Symbol.for("DrawContribution"),vv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Pu,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];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+=Nt;for(;o<0;)o+=Nt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};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},yv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const bv=Symbol.for("DrawItemInterceptor"),xv=new Ne,Sv=new Ne;class Av{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){xv.copy(s.dirtyBounds),Sv.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,ep.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(xv),s.backupDirtyBounds.copy(Sv)),!0}}class kv{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 Mv=class{constructor(){this.order=1,this.interceptors=[new Av,new wv,new Tv,new kv]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&ip.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Cv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},Bv=function(t,e){return function(i,s){e(i,s,t)}};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))}reInit(){this.drawContribution.reInit()}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=Cv([qa(),Bv(0,Xa(mv)),Ev("design:paramtypes",[Object])],Pv);var Lv=new Fa((t=>{t(So).to(Pv)}));const Rv=Symbol.for("PickerService"),Ov=Symbol.for("GlobalPickerService"),Iv=Symbol.for("PickItemInterceptor"),Dv=Symbol.for("PickServiceInterceptor");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};let zv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};zv=Fv([qa()],zv);let jv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Lc(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=ep.allocateByObj(a),u=new re(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};jv=Fv([qa()],jv);let Hv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new re(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}};Hv=Fv([qa()],Hv);let Vv=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){const a=vv(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};Vv=Fv([qa()],Vv);var Nv=new Fa(((t,e,i)=>{i(Rv)||(t(Ov).toSelf(),t(Rv).toService(Ov)),t(Vv).toSelf().inSingletonScope(),t(Iv).toService(Vv),t(jv).toSelf().inSingletonScope(),t(Iv).toService(jv),t(Hv).toSelf().inSingletonScope(),t(Iv).toService(Hv),fo(t,Iv),t(zv).toSelf().inSingletonScope(),t(Dv).toService(zv),fo(t,Dv)})),Uv=new Fa((t=>{t(Wu).to(_g),t(Gu).toConstantValue(pf)}));const Wv=Symbol.for("AutoEnablePlugins"),Gv=Symbol.for("PluginService");var Yv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$v=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Xv=function(t,e){return function(i,s){e(i,s,t)}};let Kv=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&&xo.isBound(Wv)&&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(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Kv=Yv([qa(),Xv(0,Xa(po)),Xv(0,Za(Wv)),$v("design:paramtypes",[Object])],Kv);var qv=new Fa((t=>{t(Gv).to(Kv),function(t,e){t(po).toDynamicValue((({container:t})=>new go(e,t))).whenTargetNamed(e)}(t,Wv)})),Zv=new Fa((t=>{fo(t,yo)})),Jv=new Fa((t=>{t(Oh).to(Ih).inSingletonScope(),fo(t,Oh)})),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.type="static",this.offscreen=!1,this.global=Ao.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=zh({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()}};e_=Qv([qa(),t_("design:paramtypes",[])],e_);var i_=new Fa((t=>{t(e_).toSelf(),t(zp).toService(e_)}));var s_=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 n_(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function r_(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=n_(t,e,s);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;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=n_(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var l_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},h_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},c_=function(t,e){return function(i,s){e(i,s,t)}};let d_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):r_(e,th.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Ve,this.backupDirtyBounds=new Ve,this.global=Ao.global,this.layerService=Ao.layerService,y(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}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){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=ye(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.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,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:th.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:th.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,ep.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=o_(e,i,th.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&&!Ae(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Pm.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=ep.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Pm.free(n),ep.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||xo.get(ev);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let p_=class extends hm{constructor(){super(...arguments),this.numberType=Fu}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=Lc(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=Xp(u,p,c),_=qp(u,g),y=Yp(c),b=$p(d,f);if(!t.valid||!m)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())}};p_=u_([qa()],p_);var g_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 f_=class extends mm{constructor(){super(...arguments),this.numberType=Lu}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=Lc(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=Xp(u,d,c),f=Yp(c);if(!t.valid||!p)return;if(!f)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())}};f_=g_([qa()],f_);var m_,v_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},__=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},y_=function(t,e){return function(i,s){e(i,s,t)}},b_=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(m_||(m_={}));let x_=class extends d_{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=m_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new _o([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return b_(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:th.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:th.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 b_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return b_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>b_(this,void 0,void 0,(function*(){if(2!==t.count)yield a_(t,th.zIndex,((i,s)=>{if(this.status===m_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return b_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return b_(this,void 0,void 0,(function*(){this.rendering&&(this.status=m_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=m_.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return b_(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:()=>b_(this,void 0,void 0,(function*(){yield a_(t,th.zIndex,(t=>b_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};x_=v_([qa(),y_(0,Ka(rv)),y_(1,Xa(p_)),y_(2,Xa(f_)),y_(3,Xa(po)),y_(3,Za(bv)),__("design:paramtypes",[Array,Object,Object,Object])],x_);var S_=new Fa((t=>{t(bf).toSelf().inSingletonScope(),t(Mf).toSelf().inSingletonScope(),t(mv).to(d_),t(ev).to(x_),t(av).to(Km).inSingletonScope(),t(rv).toService(av),fo(t,ng),t(Sf).toSelf().inSingletonScope(),fo(t,dg),fo(t,rv),t(Mv).toSelf().inSingletonScope(),t(bv).toService(Mv),fo(t,bv)}));function A_(){A_.__loaded||(A_.__loaded=!0,xo.load(Gp),xo.load(Uv),xo.load(Lv),xo.load(Nv),xo.load(qv),function(t){t.load(Zv),t.load(Jv),t.load(i_)}(xo),function(t){t.load(S_)}(xo))}A_.__loaded=!1,A_();const k_=xo.get(bo);Ao.global=k_;const M_=xo.get(Dp);Ao.graphicUtil=M_;const T_=xo.get(Ip);Ao.transformUtil=T_;const w_=xo.get(Wu);Ao.graphicService=w_;const C_=xo.get(Fp);Ao.layerService=C_;class E_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class B_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=Ao.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=Ao.global.getRequestAnimationFrame();this.rafId=t((()=>{Ao.global.devicePixelRatio!==this.dpr&&(this.dpr=Ao.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=Ao.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class P_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.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))})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Ao.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())}}const L_=new Ne;class R_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Da.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()}));const e=this.pluginService.stage;e&&(e.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&&(L_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(L_,t.parent&&t.parent.globalTransMatrix)))})),e.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))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let O_;function I_(){!function(){if(null==O_)try{const t=document.createElement("canvas"),e=t.getContext("2d");O_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),O_&&(O_=!!document.createElement)}catch(t){O_=!1}}();const t=Ao.global&&Ao.global.env;return t?"browser"===t:O_}let D_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};D_._pluginClasses={};const F_="white";class z_ extends Lp{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:F_}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={}){var e,i;super({}),this.tickedBeforeRender=!0,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._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Bc,this.hooks={beforeRender:new _o(["stage"]),afterRender:new _o(["stage"]),afterClearScreen:new _o(["stage"]),afterClearRect:new _o(["stage"])},this.global=Ao.global,!this.global.env&&I_()&&this.global.setEnv("browser"),this.window=xo.get(mc),this.renderService=xo.get(So),this.pluginService=xo.get(Gv),this.layerService=xo.get(Fp),this.graphicService=xo.get(Wu),this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],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:F_,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(),t.autoRefresh&&this.enableAutoRefresh(),!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),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&_(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(i=t.rafId)&&void 0!==i?i:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new Gc(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(t=!1){t&&(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:f=[1,1,-1],color:m="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);const k=D_.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const M={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]}};if(this.camera)this.camera.params=M;else{const t=D_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=D_.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}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 E_))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new B_))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new P_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Ve;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new R_,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=D_.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=D_.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=D_.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();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.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();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===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),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.dirtyBounds&&this.dirtyBounds.clear(),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,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new re(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;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.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=xo.get(mc),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=xo.get(Rv)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}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},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())}))};let V_=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ne}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}}loadFont(t,e,i){return H_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}};V_=j_([qa()],V_);var N_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},U_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let W_=class{constructor(){this._uid=Da.GenAutoIncrementId(),this.viewBox=new Ne,this.modelMatrix=new We(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){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}};W_=N_([qa(),U_("design:paramtypes",[])],W_);var G_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Y_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$_=function(t,e){return function(i,s){e(i,s,t)}};let X_=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=Ao.global}reInit(){this._init()}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.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 Ne).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 We(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),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new re(e.x,e.y),a=Lc(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 re(e.x,e.y);l.transformPoint(a,a);const o=Lc(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&&ip.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),ep.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function K_(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 q_(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function iy(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;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}))),oy=(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]},ly=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new Ve;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 oy(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return oy(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);ly(n[0],s,i),ly(n[1],e-s,i)}};let hy=!1;const cy=new Fa((t=>{hy||(hy=!0,t(tm).toSelf().inSingletonScope(),t(iv).to(tm).inSingletonScope(),t(rv).toService(iv),t(eg).toService(Sf),fo(t,eg))}));let dy=!1;const uy=new Fa((t=>{dy||(dy=!0,t(Tm).toSelf().inSingletonScope(),t(cv).to(Tm).inSingletonScope(),t(rv).toService(cv),t(jf).toSelf(),t(zf).toSelf(),t(lg).toService(jf),t(lg).toService(zf),t(lg).toService(Sf),fo(t,lg))}));let py=!1;const gy=new Fa((t=>{py||(py=!0,t(hm).toSelf().inSingletonScope(),t(p_).toSelf().inSingletonScope(),t(ov).to(hm).inSingletonScope(),t(rv).toService(ov))}));let fy=!1;const my=new Fa((t=>{fy||(fy=!0,t(mm).toSelf().inSingletonScope(),t(sv).to(mm).inSingletonScope(),t(rv).toService(sv),t(ig).toService(Sf),fo(t,ig),t(f_).toSelf().inSingletonScope())}));let vy=!1;const _y=new Fa((t=>{vy||(vy=!0,t(Bm).toSelf().inSingletonScope(),t(dv).to(Bm).inSingletonScope(),t(rv).toService(dv),t(hg).toService(Sf),fo(t,hg))}));let yy=!1;const by=new Fa((t=>{yy||(yy=!0,t(nm).toSelf().inSingletonScope(),t(nv).to(nm).inSingletonScope(),t(rv).toService(nv),t(sg).toService(Sf),fo(t,sg))}));let xy=!1;const Sy=new Fa((t=>{xy||(xy=!0,t(uv).to(Dm).inSingletonScope(),t(rv).toService(uv),t(cg).toService(Sf),fo(t,cg))}));let Ay=!1;const ky=new Fa((t=>{Ay||(Ay=!0,t(Sm).toSelf().inSingletonScope(),t(lv).to(Sm).inSingletonScope(),t(rv).toService(lv),t(ag).toService(Sf),fo(t,ag))}));let My=!1;const Ty=new Fa((t=>{My||(My=!0,t(hv).to(Gm).inSingletonScope(),t(rv).toService(hv),t(og).toService(Sf),fo(t,og))}));var wy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Cy=class{constructor(){this.numberType=Ou}reInit(){}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=Lc(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};Cy=wy([qa()],Cy);let Ey=!1;const By=new Fa((t=>{Ey||(Ey=!0,t(gv).to(Cy).inSingletonScope(),t(rv).toService(gv))}));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},Ly=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ry=class extends qf{constructor(){super(),this.numberType=Vu,this.builtinContributions=[Lm],this.init()}drawShape(t,e,i,s,n){const r=Lc(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=Xp(o,l,!0),d=Xp(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),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=Lc(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:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),If(e,i-t,s-n,v,_,f,!0)),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=Lc(t).richtext;this._draw(t,s,!1,i)}};Ry=Py([qa(),Ly("design:paramtypes",[])],Ry);let Oy=!1;const Iy=new Fa((t=>{Oy||(Oy=!0,t(pv).to(Ry).inSingletonScope(),t(rv).toService(pv))}));let Dy=!1;const Fy=new Fa((t=>{Dy||(Dy=!0,t(fv).to(tv).inSingletonScope(),t(rv).toService(fv),t(rg).toService(Sf),fo(t,rg))}));function zy(t){const e=[];for(let i=0;i=0&&n>=0&&sot.getInstance().info(`[VChart log]: ${t}`,...e),Vy=(t,e)=>(d(Uy.warnHandler)&&Uy.warnHandler.call(null,t,e),e?ot.getInstance().warn(`[VChart warn]: ${t}`,e):ot.getInstance().warn(`[VChart warn]: ${t}`)),Ny=(t,e,i)=>{if(!d(Uy.errorHandler))throw new Error(t);Uy.errorHandler.call(null,t,e)},Uy={silent:!1,warnHandler:!1,errorHandler:!1},Wy=I_(),Gy=Wy&&globalThis?globalThis.document:void 0;function Yy(t){return("desktop-browser"===t||"mobile-browser"===t)&&Wy}function $y(t){return Xy(t)||"mobile-browser"===t}function Xy(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let Ky=0;function qy(){return Ky>=9999999&&(Ky=0),Ky++}function Zy(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function Jy(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const Qy=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class tb extends Lp{constructor(t,e){super(t),this._skipRenderAttributes=Qy,(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,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?j(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.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,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.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 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"},Cb=(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 Eb extends l{constructor(t,e={}){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.startTime=Hc.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.pressTimeout=null}),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=Hc.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||wb(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=Cb(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=Hc.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=Cb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=wb(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&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("pointerleave",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("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=Hc.now()-i>this.config.press.time&&Cb(s[0],t){Ao.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;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){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){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},Pb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Lb=[0,0,0];let Rb=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t: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(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},Xl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},ql),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},Zl),{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 We(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new We(1,0,0,1,0,0),this._clearMatrix=new We(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&ot.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new We(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&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 ep.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&&(ep.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(ep.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){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,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=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(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){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-=Nt;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(f,-2*y),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&&xp.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&&(Qu(Lb,[t,e,i],this.modelMatrix),t=Lb[0],e=Lb[1],i=Lb[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&&(Qu(Lb,[t,e,i],this.modelMatrix),t=Lb[0],e=Lb[1],i=Lb[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Qu(Lb,[e,i,s],this.modelMatrix),e=Lb[0],i=Lb[1],s=Lb[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,e=Ao.global.measureTextMethod){var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Ao.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:Zl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:Zl.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&&(Qu(Lb,[e,i,s],this.modelMatrix),e=Lb[0],i=Lb[1],s=Lb[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=yh(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:_h(this,a,this.dpr),r.strokeStyle=yh(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=De(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?this.font=t.font:this.font=De(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(t=!0,e=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(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>ep.free(t))),this.stack.length=0}};Rb.env="browser",Rb=Bb([qa(),Pb("design:paramtypes",[Object,Number])],Rb);var Ob=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ib=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Db=class extends hp{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Ao.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new Rb(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 Fb(t,e){return new Fa((i=>{i(Dh).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Fh).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Db.env="browser",Db=Ob([qa(),Ib("design:paramtypes",[Object])],Db);const zb=Fb(Db,Rb);var jb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vb=function(t,e){return function(i,s){e(i,s,t)}};let Nb=class extends X_{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,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=pc.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 Wb=class{constructor(){this.type="group",this.numberType=Iu}contains(t,e,i){return!1}};Wb=Ub([qa()],Wb);const Gb=new Fa(((t,e,i,s)=>{Gb.__vloaded||(Gb.__vloaded=!0,t(Mb).to(Wb).inSingletonScope(),t(Tb).toService(Mb),fo(t,Tb))}));Gb.__vloaded=!1;var Yb=Gb;const $b=new Fa(((t,e,i,s)=>{i(Nb)||t(Nb).toSelf().inSingletonScope(),i(Rv)?s(Rv).toService(Nb):t(Rv).toService(Nb)}));var Xb,Kb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)};let Zb=Xb=class extends W_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Xb.idprefix}_${Xb.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Ao.global,this.viewBox=new Ne,this.modelMatrix=new We(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:Xb.GenerateCanvasId(),canvasControled:!0};this.canvas=new Db(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 Db({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)}};Zb.env="browser",Zb.idprefix="visactor_window",Zb.prefix_count=0,Zb=Xb=Kb([qa(),qb("design:paramtypes",[])],Zb);const Jb=new Fa((t=>{t(Zb).toSelf(),t(vc).toDynamicValue((t=>t.container.get(Zb))).whenTargetNamed(Zb.env)}));var Qb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},ex=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 ix{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 sx(t,e=!1){const i=document.createElement("img");if(Ao.global.isImageAnonymous&&(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 nx=class extends V_{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 ix(t)}return new Ne}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 sx(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return sx(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:Da.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(...t){}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}}loadFont(t,e,i){return ex(this,void 0,void 0,(function*(){return new FontFace(t,_(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}};nx=Qb([qa(),tx("design:paramtypes",[])],nx);const rx=new Fa((t=>{rx.isBrowserBound||(rx.isBrowserBound=!0,t(nx).toSelf().inSingletonScope(),t(yo).toService(nx))}));function ax(t,e=!0){ax.__loaded||(ax.__loaded=!0,t.load(rx),t.load(zb),t.load(Jb),e&&function(t){t.load(Yb),t.load($b)}(t))}rx.isBrowserBound=!1,ax.__loaded=!1;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};let lx=class extends Rb{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}};lx.env="feishu",lx=ox([qa()],lx);var hx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let dx=class extends hp{constructor(t){super(t)}init(){this._context=new lx(this,this._dpr)}release(...t){}};dx.env="feishu",dx=hx([qa(),cx("design:paramtypes",[Object])],dx);const ux=Fb(dx,lx);var px=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gx=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 mx{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 vx=class extends W_{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new mx}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:Da.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new dx(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 dx({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()}};vx.env="feishu",vx=px([qa(),fx(0,Xa(bo)),gx("design:paramtypes",[Object])],vx);const _x=new Fa((t=>{t(vx).toSelf(),t(vc).toDynamicValue((t=>t.container.get(vx))).whenTargetNamed(vx.env)}));var yx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xx=function(t,e){return function(i,s){e(i,s,t)}};let Sx=class extends X_{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,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 op(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}};Sx=yx([qa(),xx(0,Xa(po)),xx(0,Za(eb)),xx(1,Xa(po)),xx(1,Za(Iv)),xx(2,Xa(po)),xx(2,Za(Dv)),bx("design:paramtypes",[Object,Object,Object])],Sx);const Ax=new Fa((t=>{Ax.__vloaded||(Ax.__vloaded=!0,fo(t,eb))}));Ax.__vloaded=!1;var kx=Ax;class Mx{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();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,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:_h(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}var Tx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Cx=function(t,e){return function(i,s){e(i,s,t)}};let Ex=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Bu}};Ex=Tx([qa(),Cx(0,Xa(iv)),wx("design:paramtypes",[Object])],Ex);let Bx=!1;const Px=new Fa(((t,e,i,s)=>{Bx||(Bx=!0,t(ib).to(Ex).inSingletonScope(),t(eb).toService(ib))}));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},Rx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ox=function(t,e){return function(i,s){e(i,s,t)}};let Ix=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Lu}};Ix=Lx([qa(),Ox(0,Xa(sv)),Rx("design:paramtypes",[Object])],Ix);let Dx=!1;const Fx=new Fa(((t,e,i,s)=>{Dx||(Dx=!0,t(sb).to(Ix).inSingletonScope(),t(eb).toService(sb))}));var zx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hx=function(t,e){return function(i,s){e(i,s,t)}};let Vx=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Ru}};Vx=zx([qa(),Hx(0,Xa(nv)),jx("design:paramtypes",[Object])],Vx);let Nx=!1;const Ux=new Fa(((t,e,i,s)=>{Nx||(Nx=!0,t(nb).to(Vx).inSingletonScope(),t(eb).toService(nb))}));class Wx{constructor(){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}}var Gx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},$x=function(t,e){return function(i,s){e(i,s,t)}};let Xx=class extends Wx{constructor(t){super(),this.canvasRenderer=t}};Xx=Gx([qa(),$x(0,Xa(gv)),Yx("design:paramtypes",[Object])],Xx);let Kx=!1;const qx=new Fa(((t,e,i,s)=>{Kx||(Kx=!0,t(ub).to(Xx).inSingletonScope(),t(Xx).toService(ub))}));var Zx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Jx=class{constructor(){this.type="image",this.numberType=Du}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Jx=Zx([qa()],Jx);let Qx=!1;const tS=new Fa(((t,e,i,s)=>{Qx||(Qx=!0,t(rb).to(Jx).inSingletonScope(),t(Jx).toService(rb))}));var eS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sS=function(t,e){return function(i,s){e(i,s,t)}};let nS=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Fu}};nS=eS([qa(),sS(0,Xa(ov)),iS("design:paramtypes",[Object])],nS);let rS=!1;const aS=new Fa(((t,e,i,s)=>{rS||(rS=!0,t(ab).to(nS).inSingletonScope(),t(eb).toService(ab))}));var oS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hS=function(t,e){return function(i,s){e(i,s,t)}};let cS=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=ju}};cS=oS([qa(),hS(0,Xa(hv)),lS("design:paramtypes",[Object])],cS);let dS=!1;const uS=new Fa(((t,e,i,s)=>{dS||(dS=!0,t(db).to(cS).inSingletonScope(),t(eb).toService(db))}));var pS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fS=function(t,e){return function(i,s){e(i,s,t)}};let mS=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=zu}};mS=pS([qa(),fS(0,Xa(lv)),gS("design:paramtypes",[Object])],mS);let vS=!1;const _S=new Fa(((t,e,i,s)=>{vS||(vS=!0,t(ob).to(mS).inSingletonScope(),t(eb).toService(ob))})),yS=new Ne;class bS{constructor(){this.type="rect",this.numberType=Hu}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{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,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:_h(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;yS.setValue(i.x1,i.y1,i.x2,i.y2),yS.expand(-r/2),h=!yS.containsPoint(e)}}return s.highPerformanceRestore(),h}}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 extends bS{constructor(t){super(),this.canvasRenderer=t}};kS=xS([qa(),AS(0,Xa(cv)),SS("design:paramtypes",[Object])],kS);let MS=!1;const TS=new Fa(((t,e,i,s)=>{MS||(MS=!0,t(lb).to(kS).inSingletonScope(),t(eb).toService(lb))}));let wS=!1;const CS=new Fa(((t,e,i,s)=>{wS||(wS=!0,t(rb).to(Jx).inSingletonScope(),t(Jx).toService(rb))}));var ES=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},BS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},PS=function(t,e){return function(i,s){e(i,s,t)}};let LS=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Nu}};LS=ES([qa(),PS(0,Xa(dv)),BS("design:paramtypes",[Object])],LS);let RS=!1;const OS=new Fa(((t,e,i,s)=>{RS||(RS=!0,t(hb).to(LS).inSingletonScope(),t(eb).toService(hb))}));var IS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 DS=class{constructor(){this.type="text",this.numberType=Uu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};DS=IS([qa()],DS);let FS=!1;const zS=new Fa(((t,e,i,s)=>{FS||(FS=!0,t(cb).to(DS).inSingletonScope(),t(eb).toService(cb))})),jS=new Fa(((t,e,i,s)=>{i(Sx)||t(Sx).toSelf().inSingletonScope(),i(Rv)?s(Rv).toService(Sx):t(Rv).toService(Sx)}));class HS{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 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},NS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let US=class extends V_{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 HS(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 rd.call(t)}}getCancelAnimationFrame(){return t=>{rd.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(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};US=VS([qa(),NS("design:paramtypes",[])],US);const WS=new Fa((t=>{WS.isFeishuBound||(WS.isFeishuBound=!0,t(US).toSelf().inSingletonScope(),t(yo).toService(US))}));function GS(t,e=!0){GS.__loaded||(GS.__loaded=!0,t.load(WS),t.load(ux),t.load(_x),e&&function(t){t.load(kx),t.load(jS),t.load(Px),t.load(Fx),t.load(Ux),t.load(qx),t.load(tS),t.load(aS),t.load(uS),t.load(_S),t.load(TS),t.load(CS),t.load(OS),t.load(zS)}(t))}WS.isFeishuBound=!1,GS.__loaded=!1;var YS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$S=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let XS=class extends Rb{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 We(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};XS.env="node",XS=YS([qa(),$S("design:paramtypes",[Object,Number])],XS);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},qS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ZS=class extends hp{constructor(t){super(t)}init(){this._context=new XS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};ZS.env="node",ZS=KS([qa(),qS("design:paramtypes",[Object])],ZS);const JS=Fb(ZS,XS);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},tA=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 iA=class extends W_{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:Da.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new ZS(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new ZS({width:n,height:r,dpr:s,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}getImageBuffer(t="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){}};iA.env="node",iA=QS([qa(),eA(0,Xa(bo)),tA("design:paramtypes",[Object])],iA);const sA=new Fa((t=>{t(iA).toSelf(),t(vc).toDynamicValue((t=>t.container.get(iA))).whenTargetNamed(iA.env)}));var nA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let rA=class extends V_{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 rd.call(t)}}getCancelAnimationFrame(){return t=>{rd.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};rA=nA([qa()],rA);const aA=new Fa((t=>{aA.isNodeBound||(aA.isNodeBound=!0,t(rA).toSelf().inSingletonScope(),t(yo).toService(rA))}));function oA(t,e=!0){oA.__loaded||(oA.__loaded=!0,t.load(aA),t.load(JS),t.load(sA))}aA.isNodeBound=!1,oA.__loaded=!1;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},hA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cA=function(t,e){return function(i,s){e(i,s,t)}};let dA=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Bu}};dA=lA([qa(),cA(0,Xa(iv)),hA("design:paramtypes",[Object])],dA);let uA=!1;const pA=new Fa(((t,e,i,s)=>{uA||(uA=!0,t(pb).to(dA).inSingletonScope(),t(Tb).toService(pb))}));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},fA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mA=function(t,e){return function(i,s){e(i,s,t)}};let vA=class extends bS{constructor(t){super(),this.canvasRenderer=t}};vA=gA([qa(),mA(0,Xa(cv)),fA("design:paramtypes",[Object])],vA);let _A=!1;const yA=new Fa(((t,e,i,s)=>{_A||(_A=!0,t(yb).to(vA).inSingletonScope(),t(Tb).toService(yb))}));class bA extends qf{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=t.getGraphicTheme(),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,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:_h(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&ip.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}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){return function(i,s){e(i,s,t)}};let kA=class extends bA{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Fu}};kA=xA([qa(),AA(0,Xa(ov)),SA("design:paramtypes",[Object])],kA);let MA=!1;const TA=new Fa(((t,e,i,s)=>{MA||(MA=!0,t(vb).to(kA).inSingletonScope(),t(Tb).toService(vb))}));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 BA=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Lu}};BA=wA([qa(),EA(0,Xa(sv)),CA("design:paramtypes",[Object])],BA);let PA=!1;const LA=new Fa(((t,e,i,s)=>{PA||(PA=!0,t(gb).to(BA).inSingletonScope(),t(Tb).toService(gb))}));class RA extends qf{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();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,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&ip.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var OA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},IA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},DA=function(t,e){return function(i,s){e(i,s,t)}};let FA=class extends RA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Nu}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=t.getGraphicTheme(),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,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:_h(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&ip.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};FA=OA([qa(),DA(0,Xa(dv)),IA("design:paramtypes",[Object])],FA);let zA=!1;const jA=new Fa(((t,e,i,s)=>{zA||(zA=!0,t(bb).to(FA).inSingletonScope(),t(Tb).toService(bb))}));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},VA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},NA=function(t,e){return function(i,s){e(i,s,t)}};let UA=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Ru}};UA=HA([qa(),NA(0,Xa(nv)),VA("design:paramtypes",[Object])],UA);let WA=!1;const GA=new Fa(((t,e,i,s)=>{WA||(WA=!0,t(fb).to(UA).inSingletonScope(),t(Tb).toService(fb))}));var YA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$A=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XA=function(t,e){return function(i,s){e(i,s,t)}};let KA=class extends RA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=Uu}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=t.getGraphicTheme(),{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(),f=l.width(),m=pg(a,u,n),v=ug(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,s.modelMatrix!==u&&ip.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};KA=YA([qa(),XA(0,Xa(uv)),$A("design:paramtypes",[Object])],KA);let qA=!1;const ZA=new Fa(((t,e,i,s)=>{qA||(qA=!0,t(xb).to(KA).inSingletonScope(),t(Tb).toService(xb))}));var JA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},QA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tk=function(t,e){return function(i,s){e(i,s,t)}};let ek=class extends bA{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=zu}};ek=JA([qa(),tk(0,Xa(lv)),QA("design:paramtypes",[Object])],ek);let ik=!1;const sk=new Fa(((t,e,i,s)=>{ik||(ik=!0,t(_b).to(ek).inSingletonScope(),t(Tb).toService(_b))}));var nk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ak=function(t,e){return function(i,s){e(i,s,t)}};let ok=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=ju}};ok=nk([qa(),ak(0,Xa(hv)),rk("design:paramtypes",[Object])],ok);let lk=!1;const hk=new Fa(((t,e,i,s)=>{lk||(lk=!0,t(Sb).to(ok).inSingletonScope(),t(Tb).toService(Sb))}));var ck=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uk=function(t,e){return function(i,s){e(i,s,t)}};let pk=class extends Wx{constructor(t){super(),this.canvasRenderer=t}};pk=ck([qa(),uk(0,Xa(gv)),dk("design:paramtypes",[Object])],pk);let gk=!1;const fk=new Fa(((t,e,i,s)=>{gk||(gk=!0,t(kb).to(pk).inSingletonScope(),t(Tb).toService(kb))}));var mk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_k=function(t,e){return function(i,s){e(i,s,t)}};let yk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Vu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};yk=mk([qa(),_k(0,Xa(pv)),vk("design:paramtypes",[Object])],yk);let bk=!1;const xk=new Fa(((t,e,i,s)=>{bk||(bk=!0,t(Ab).to(yk).inSingletonScope(),t(Tb).toService(Ab))}));var Sk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ak=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kk=function(t,e){return function(i,s){e(i,s,t)}};let Mk=class extends Mx{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=Du}};Mk=Sk([qa(),kk(0,Xa(fv)),Ak("design:paramtypes",[Object])],Mk);let Tk=!1;const wk=new Fa(((t,e,i,s)=>{Tk||(Tk=!0,t(mb).to(Mk).inSingletonScope(),t(Tb).toService(mb))})),Ck=I_();function Ek(){Ek.__loaded||(Ek.__loaded=!0,pf.RegisterGraphicCreator("arc",of),xo.load(cy),xo.load(Ck?pA:Px))}Ek.__loaded=!1;const Bk=Ek;function Pk(){Pk.__loaded||(Pk.__loaded=!0,pf.RegisterGraphicCreator("area",nf),xo.load(my),xo.load(Ck?LA:Fx))}Pk.__loaded=!1;const Lk=Pk;function Rk(){Rk.__loaded||(Rk.__loaded=!0,pf.RegisterGraphicCreator("circle",Sg),xo.load(by),xo.load(Ck?GA:Ux))}Rk.__loaded=!1;const Ok=Rk;function Ik(){Ik.__loaded||(Ik.__loaded=!0,pf.RegisterGraphicCreator("glyph",zg),xo.load(By),xo.load(Ck?fk:qx))}Ik.__loaded=!1;const Dk=Ik;function Fk(){Fk.__loaded||(Fk.__loaded=!0,pf.RegisterGraphicCreator("group",Rp))}Fk.__loaded=!1;const zk=Fk;function jk(){jk.__loaded||(jk.__loaded=!0,pf.RegisterGraphicCreator("image",Wg),xo.load(Fy),xo.load(Ck?wk:tS))}jk.__loaded=!1;const Hk=jk;function Vk(){Vk.__loaded||(Vk.__loaded=!0,pf.RegisterGraphicCreator("line",Lg),xo.load(gy),xo.load(Ck?TA:aS))}Vk.__loaded=!1;const Nk=Vk;function Uk(){Uk.__loaded||(Uk.__loaded=!0,pf.RegisterGraphicCreator("path",tf),xo.load(ky),xo.load(Ck?sk:_S))}Uk.__loaded=!1;const Wk=Uk;function Gk(){Gk.__loaded||(Gk.__loaded=!0,pf.RegisterGraphicCreator("polygon",cf),xo.load(Ty),xo.load(Ck?hk:uS))}Gk.__loaded=!1;const Yk=Gk;function $k(){$k.__loaded||($k.__loaded=!0,pf.RegisterGraphicCreator("rect",Dg),xo.load(uy),xo.load(Ck?yA:TS))}$k.__loaded=!1;const Xk=$k;function Kk(){Kk.__loaded||(Kk.__loaded=!0,pf.RegisterGraphicCreator("richtext",Zg),xo.load(Iy),xo.load(Ck?xk:CS))}Kk.__loaded=!1;const qk=Kk;function Zk(){Zk.__loaded||(Zk.__loaded=!0,pf.RegisterGraphicCreator("shadowRoot",uf))}Zk.__loaded=!1;const Jk=Zk;function Qk(){Qk.__loaded||(Qk.__loaded=!0,pf.RegisterGraphicCreator("symbol",Eg),xo.load(_y),xo.load(Ck?jA:OS))}Qk.__loaded=!1;const tM=Qk;function eM(){eM.__loaded||(eM.__loaded=!0,pf.RegisterGraphicCreator("text",Tg),xo.load(Sy),xo.load(Ck?ZA:zS))}eM.__loaded=!1;const iM=eM;function sM(){zk(),Xk()}const nM=-.5*Math.PI,rM=1.5*Math.PI,aM="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 oM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(oM||(oM={}));const lM={[oM.selectedReverse]:{},[oM.selected]:{},[oM.hover]:{},[oM.hoverReverse]:{}},hM={container:"",width:30,height:30,style:{}},cM="scrollDrag";function dM(){return"browser"===k_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const uM={debounce:St,throttle:At};sM();let pM=class t extends tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},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=_t(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=_t(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=>{this._clearDragEvents();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});const r=dM(),a="browser"===k_.env?k_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=_t(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},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:uM[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:yt(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=yt(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(cM,{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",uM[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===k_.env?k_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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(yt(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:ai(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,[s,n,r,a]=ai(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,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=_t(t[0],0,1),c=_t(t[1],0,1),d=_t(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=yt(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?yt([a+i*n,a+s*n],a,n-l):yt([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=dM(),e="browser"===k_.env?k_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===k_.env?k_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};pM.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,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};var gM,fM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 mM=gM=class{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new Ve).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Ut(t.deltaX)>Ut(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ne,e.addEventListener("wheel",this.scroll),this.params=gM.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(cM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new pM(v),h.name=a,e.add(h),h.isScrollBar=!0);const _=this.childrenBounds,{scrollX:y,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/_.width(),1),e=Math.max(Math.min(y/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/_.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=i{i(mM)||(t(mM).toSelf(),t(Wv).toService(mM))}));function _M(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&_M(t,e)}))}const yM=t=>!u(t)&&!1!==t.visible;function bM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function xM(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 AM=["#ffffff","#000000"];function kM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ii(t).toHex(),o=new ii(e).toHex();return MM(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(...AM);for(const n of a)if(t!==n&&MM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function MM(t,e,i,s,n){if("lightness"===n){const i=ii.getColorBrightness(new ii(e));return ii.getColorBrightness(new ii(t))<.5?i>=.5:i<.5}return s?TM(t,e)>s:"largeText"===i?TM(t,e)>3:TM(t,e)>4.5}function TM(t,e){const i=wM(t),s=wM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function wM(t){const e=ni(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 CM(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 EM(t,e){return[t[0]*e,t[1]*e]}function BM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function PM(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=Qt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const LM=(t,e,i,s)=>new Fe(Object.assign({defaultFontParams:Object.assign({fontFamily:aM,fontSize:14},s),getTextBounds:i?void 0:mf,specialCharSet:"-/: .,@%'\"~"+Fe.ALPHABET_CHAR_SET+Fe.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function RM(t,e,i={}){if(!t)return{width:0,height:0};const s=mf({text:t,fontFamily:e.fontFamily||i.fontFamily||aM,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 OM(t,e="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 IM(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function DM(t,e="type"){const i=OM(t,e);return"rich"===i?pf.richtext(IM(t)):("html"===i?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"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),pf.text(t))}function FM(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 zM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function jM(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 HM(t,e){const{dx:i,dy:s}=jM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function VM(){zk(),Xk(),tM(),qk(),iM()}var NM=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&&(T=h,R.setAttribute("maxLineWidth",h-b[1]-b[2]))),k=0,M=0;let H=0;"left"===z||"start"===z?H=1:"right"===z||"end"===z?H=-1:"center"===z&&(H=0),H?H<0?(k-=T,A&&A.setAttribute("x",(A.attribute.x||0)-O),x.setAttribute("x",-b[1]-E)):H>0&&x.setAttribute("x",b[3]):(k-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-O/2),x.setAttribute("x",-E/2));const V="right"===y||"end"===y,N="left"===y||"start"===y,U=(t,e)=>{"richtext"===R.type?R.setAttributes({x:t,textAlign:e,textConfig:Y(R.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):R.setAttributes({x:t,textAlign:e})};if((y?"center"===y:_)&&H){const t=T-b[1]-b[3],e=O+E,i=1===H?(t-e)/2+E+O/2:b[0]+E-(T/2+e/2-E)+O/2;if(U(i,"center"),A){const t=i-O/2-E+F/2;A.setAttributes({x:t})}}if(N&&1!==H){const t=T-b[1]-b[3],e=0===H?-t/2+E/2:-T+b[3]+b[1]+E;if(U(e+E,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(V&&-1!==H){const t=T-b[1]-b[3],e=0===H?t/2+E/2:t;if(U(e,"right"),A){const t=e-O-E+F/2;A.setAttributes({x:t})}}"middle"===j?(M-=w/2,A&&A.setAttribute("y",0)):"bottom"===j?(M-=w,A&&A.setAttribute("y",-I/2),x.setAttribute("y",-b[2])):"top"===j&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",I/2)),P(null==m?void 0:m.text)||(R.states=m.text);const{visible:W}=a,G=NM(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},G),{visible:W&&!!s,width:T,height:w,x:k,y:M}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),G.customShape){const e=G.customShape;t.pathProxy=t=>e(this,t,new Wl)}this._bgRect=t}this._textShape=R,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:j({},UM.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}UM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const WM={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}},GM={poptip:j({},WM)};var YM=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);nA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(y(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),I.setAttribute("x",I.attribute.x+e),o.setAttribute("dx",$t(Yt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),I.setAttribute("y",I.attribute.y+e),o.setAttribute("dy",$t(Yt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?jt/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:jt/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?jt/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?jt/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:jt/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?jt/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?jt:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:jt,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?jt:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}QM.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"},panel:{},maxWidthPercent:.8,space:8,padding:10};var tT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 eT=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};j(s,QM.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new QM(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};j(e,GM.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,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),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}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}};eT=tT([qa()],eT);var iT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 sT{constructor(){this.activeEvent="onRegister",this._uid=Da.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(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)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}let nT=class extends sT{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};nT=iT([qa()],nT);let rT=class extends sT{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}};rT=iT([qa()],rT);const aT=new Fa(((t,e,i,s)=>{i(eT)||(t(eT).toSelf().inSingletonScope(),t(dg).toService(eT)),i(nT)||(t(nT).toSelf(),t(Wv).toService(nT)),i(rT)||(t(rT).toSelf(),t(Wv).toService(rT))}));class oT extends tb{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}zk(),Nk();class lT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},lT.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})}}lT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},zk(),Xk();class hT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},hT.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})}}hT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},zk(),Bk();class cT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},cT.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=ae.distancePP(t,e);this.setAttribute("radius",i)}}cT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},zk(),Bk();class dT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},dT.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=nM,endAngle:s=rM}=this.attribute,n=s-i,r=le(ue(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}dT.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},zk(),Wk();class uT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},uT.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=ce(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=ae.distancePP(t,e);this.setAttribute("radius",i)}}function pT(){zk(),Nk(),Yk(),tM()}function gT(){zk(),Nk(),Bk(),tM()}uT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},pT();class fT extends tb{getStartAngle(){return pe(this._startAngle)}getEndAngle(){return pe(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},fT.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=pf.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),P(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=pf.line;Y(i)[0].cornerRadius&&(t=pf.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"),P(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:f=12}=t;let m,v;"start"===i?(m={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)):(m={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=pf.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(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}}fT.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}}},gT();class mT extends fT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},fT.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=pf.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"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var vT,_T;!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.labelHoverOnAxis="axis-label-hover-on-axis",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",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(vT||(vT={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(_T||(_T={}));const yT={[_T.selectedReverse]:{},[_T.selected]:{},[_T.hover]:{},[_T.hoverReverse]:{}},bT={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}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},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}}},xT={size:8,stroke:"#000",lineWidth:1,zIndex:1};const ST=Math.sin(Math.PI/10);function AT(t,e=ST){const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function kT(t,e=ST){const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function MT(t){const e={};return _M(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function TT(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function wT(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return EM(r,(s?-1:1)*(n?-1:1)*t/BM(r))}function CT(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function BT(t,e,i){var s;if(kT(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>ze(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>ze(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>je(n,r)}function PT(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(oM.hover,!0),_M(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(oM.hoverReverse,!0)})),s):i},RT=(t,e,i)=>i?(_M(e,(t=>{t.name&&!P(t.states)&&(t.removeState(oM.hoverReverse),t.removeState(oM.hover))})),null):i,OT=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(oM.selected)?(_M(e,(t=>{t.name&&!P(t.states)&&(t.removeState(oM.selectedReverse),t.removeState(oM.selected))})),null):s.name&&!P(s.states)?(s.addState(oM.selected,!0),_M(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(oM.selectedReverse,!0)})),s):i};class IT extends tb{_prepareAnimate(t){if(!1!==this.attribute.animation){const{animation:e,animationEnter:i,animationExit:s,animationUpdate:n}=this.attribute,r=g(e)?e:{};this._animationConfig={enter:!1!==i&&j({},t,r,null!=i?i:{}),exit:!1!==s&&j({},t,r,null!=s?s:{}),update:!1!==n&&(y(n)?n:j({},t,r,null!=n?n:{}))}}else this._animationConfig={enter:!1,exit:!1,update:!1}}}const DT={type:"default",duration:300,easing:"linear"};class FT extends IT{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=LT(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=RT(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=OT(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=pf.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._prepare(),this._prevInnerView=this._innerView&&MT(this._innerView),this.removeAllChild(!0),this._innerView=pf.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation()}_prepare(){this._prepareAnimate(DT)}_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=pf.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=vT.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=pf.group({x:0,y:0,pickable:!1});t.name=vT.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",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=pf.group({x:0,y:0,pickable:!1});i.name=vT.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=pf.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=vT.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=lM;else{const t=this.data[s],e=j({},lM,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=pf.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=vT.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=lM;else{const i=j({},lM,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=pf.group({x:0,y:0,pickable:!1});return r.name=`${vT.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=DM(this._getLabelAttribute(t,e,n,i));if(a.name=vT.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=lM;else{const s=j({},lM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new UM(Object.assign({},e));i.name=vT.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return TT(t,this.getVerticalVector(e,i,t))}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;Ut(s[0])>Ut(s[1])?o=jt/2*(l.x>e.x?1:-1):h=jt/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+L(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+L(this.attribute,"label.space",4))*s);const f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:_}=this.attribute.label;_=d(_)?j({},bT.label.style,_(t,e,i,s)):_;_=j(this.getLabelAlign(m,o,_.angle),_),d(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let y=_.react;return d(y)&&(y=y(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,_)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==_?void 0:_.fontSize,type:h}),_),{react:y})}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}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},_M(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(e.setFinalAttributes(e.attribute),r){r.release();const i=r.attribute,a=e.getFinalAttribute(),o=function(t,e,i){const s={};for(const i in e)i in t&&U(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}(i,a);let l=Object.keys(o).length>0;if("opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l){this._newElementAttrMap[e.id]={state:"update",node:e,attrs:e.attribute};const i=r.attribute;e.setAttributes(i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}])}}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const zT={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&&BT(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function jT(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function HT(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=d(n)?n:zT[n]||zT.parity;if(s.length>=3&&PT(s,r)){do{s=a(s,r)}while(s.length>=3&&PT(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=$(i);BT(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),HT(l,s,n,(t=>BT(t,l,r))),HT(h,s,o,(t=>BT(t,h,r)||!(!n||t===l)&&BT(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function NT(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},GT(t,e.attribute.angle)),{angle:WT(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({},YT(t,e.attribute.angle)),{angle:WT(e.attribute.angle)}))}))}(t,e),function(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=Te({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function WT(t=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 GT(t,e=0){let 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=WT(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 YT(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=WT(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 $T(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!u(h),d=c?Math.cos(h):1,p=c?Math.sin(h):0,f=kT(h),m=AT(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===_||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/d,l=Math.abs(i/p);if(y&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(d);r=Math.min(t,l)}else if(y&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(d);r=Math.min(t,l)}else r=l}else r=Math.abs(i/d);k(t.attribute.maxLineWidth)&&(r=k(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function XT(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class KT{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,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=BM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return EM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class qT{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-qT.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*qT.bounceIn(2*t):.5*qT.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Nt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Nt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Nt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Nt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Nt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Nt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Nt/e)*.5+1}}static registerFunc(t,e){qT[t]=e}}function ZT(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}qT.quadIn=qT.getPowIn(2),qT.quadOut=qT.getPowOut(2),qT.quadInOut=qT.getPowInOut(2),qT.cubicIn=qT.getPowIn(3),qT.cubicOut=qT.getPowOut(3),qT.cubicInOut=qT.getPowInOut(3),qT.quartIn=qT.getPowIn(4),qT.quartOut=qT.getPowOut(4),qT.quartInOut=qT.getPowInOut(4),qT.quintIn=qT.getPowIn(5),qT.quintOut=qT.getPowOut(5),qT.quintInOut=qT.getPowInOut(5),qT.backIn=qT.getBackIn(1.7),qT.backOut=qT.getBackOut(1.7),qT.backInOut=qT.getBackInOut(1.7),qT.elasticIn=qT.getElasticIn(1,.3),qT.elasticOut=qT.getElasticOut(1,.3),qT.elasticInOut=qT.getElasticInOut(1,.3*1.5),qT.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),qT.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},qT.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)qT[`flicker${t}`]=e=>ZT(e,t);for(let t=2;t<10;t++)qT[`aIn${t}`]=e=>t*e*e+(1-t)*e;function JT(t,e,i){return t+(e-t)*i}const QT=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=JT(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=JT(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=JT(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=JT(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=JT(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=JT(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=JT(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=JT(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=JT(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=pp(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?fp(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=pp(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?fp(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=JT(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=JT(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=JT(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=JT(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=JT(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=JT(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=JT(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=JT(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=JT(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=id(e,i,s),r.addUpdateBoundTag()}}};function tw(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.setAttributes(this.target.attribute)},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=qT[s])&&void 0!==n?n:qT.linear:qT.linear,"wait"===t&&(this.onUpdate=ew),this.id=Da.GenAutoIncrementId(),this.syncAttributeUpdate=ew}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(_(i)&&_(s)){const n=dp.Get(i,cp.Color255),r=dp.Get(s,cp.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(QT["fill"===e?"fillPure":"strokePure"])}else QT[e]?t.push(QT[e]):t.push(tw)}else QT[e]?t.push(QT[e]):t.push(tw)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate;this.target.animates.forEach((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const i=e.getStartProps();this.propKeys.forEach((t=>{null!=i[t]&&e.preventAttr(t)}))}))}deleteSelfAttr(t){var e;delete this.props[t],this.fromProps&&delete this.fromProps[t];const i=this.propKeys.indexOf(t);-1!==i&&(this.propKeys.splice(i,1),null===(e=this.interpolateUpdateFunctions)||void 0===e||e.splice(i,1))}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){this.target.setAttributes(this.props),t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class sw extends iw{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();this.target.setAttributes(t)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class nw extends l{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Da.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Io.END?this.removeAnimate(t,!0):t.status!==Io.RUNNING&&t.status!==Io.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const rw=new nw;rw.isGlobal=!0;class aw{constructor(t=Da.GenAutoIncrementId(),e=rw,i){this.id=t,this.status=Io.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){return this.target=t,this.target.animates||(this.target.animates=new Map),this.target.animates.set(this.id,this),this.onRemove((()=>{this.stop(),this.target.animates.delete(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new iw(Oo.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new sw(Oo.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new iw(Oo.from,t,e,i);return this._firstStep?(this._lastStep.append(s),this._lastStep=s):(this._firstStep=s,this._lastStep=s),this.updateDuration(),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Io.RUNNING&&(this.status=Io.PAUSED)}resume(){this.status===Io.PAUSED&&(this.status=Io.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this._preventAttrs.add(t),delete this._startProps[t],delete this._endProps[t];let e=this._firstStep;for(;e;)e.deleteSelfAttr(t),e=e.next}preventAttrs(t){t.forEach((t=>this._preventAttrs.add(t)))}validAttr(t){return!this._preventAttrs.has(t)}runCb(t){var e;return null===(e=this._lastStep)||void 0===e||e.onEnd(t),this}startAt(t){return this._startTime=t,this}customInterpolate(t,e,i,s,n,r){return!1}getFromValue(){return this._startProps}getToValue(){return this._endProps}stop(t){let e=this._firstStep;for(;e;)e.stop(),e=e.next;this.status!==Io.END&&this.onEnd(),this.status=Io.END,this.target&&("start"===t?this.target.setAttributes(this._startProps):"end"===t?this.target.setAttributes(this._endProps):t&&this.target.setAttributes(t))}release(){this.status=Io.END,this._onRemove&&this._onRemove.forEach((t=>t())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Io.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),void(this.status=Io.END);this.status=Io.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&this.target.setAttributes(this._startProps);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const ow=new Mo;class lw{constructor(){this.released=!1}tick(t,e){ow.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class hw extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Ro.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Ro.INITIAL,Ao.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),Ao.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new lw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Ro.INITIAL&&(this.status=Ro.PAUSE,!0)}resume(){return this.status!==Ro.INITIAL&&(this.status=Ro.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Ro.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Ro.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Ro.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Ro.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Ro.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Ro.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,Ao.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}function uw(t){if(!t||!d(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1}return 2}dw.getInstance();class pw{static registerBuiltInAnimate(t,e){pw.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;y(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:pw.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=uw(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:pw.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=uw(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=k(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){Array.isArray(t)?t.forEach((t=>this._execute(t))):this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,u;const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:_=0,duration:y=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:M,custom:T,customType:w,controlOptions:C}=t,E=e.animate();E.priority=k;const B=d(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],L=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&L&&(i=null!==(h=P[L])&&void 0!==h?h:i),E.startAt(b);const R=i*x+B;R>0&&E.wait(R);let O=null,I=t.to,D=t.from;I||(O||(O=this.createPropsFromChannel(g,e)),I=O.props),D||(O||(O=this.createPropsFromChannel(g,e)),D=O.from),O.attrOutChannel&&e.setAttributes(O.attrOutChannel),this._handleRunAnimate(E,T,w,D,I,y,m,f,C,M,p,e);let F=0;x&&(F=x*(s-i-1));const z=d(_)?_(null===(u=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===u?void 0:u[0],e,{}):_;return z>0&&(F+=z),F>0&&E.wait(F),S&&S>0&&E.loop(S),A&&E.bounce(!0),E}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,u){var p,g,f,m,v,_,y,b;if(e&&i){i=uw(e);let c=this.resolveValue(o,u);"function"==typeof c&&(c=c(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),c=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},c);const x=d(h)?h.call(null,null!==(_=c&&(null===(v=c.data)||void 0===v?void 0:v[0]))&&void 0!==_?_:null===(b=null===(y=u.context)||void 0===y?void 0:y.data)||void 0===b?void 0:b[0],u,c):h;c.options=x,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:u=0}=t,p=d(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=d(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;u||(d||(d=this.createPropsFromChannel(a,i)),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i)),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const g=null!==(n=t.custom)&&void 0!==n?n:pw.builtInAnimateMap[r],f=t.custom?t.customType:uw(g);this._handleRunAnimate(e,g,f,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e){var i;const s={};let n=null;if(!t)return{from:n,props:s,attrOutChannel:null};const r={};let a=!1;const o=null===(i=e.context)||void 0===i?void 0:i.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===o[e]||(t[e]={to:o[e]}),t)),{})),Object.keys(t).forEach((i=>{var r,a,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?s[i]=h.to(null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,{}):s[i]=h.to),void 0!==h.from&&(n||(n={}),"function"==typeof h.from?n[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):n[i]=h.from)})),o)for(const t in o){const e=o[t];void 0!==e&&(s.hasOwnProperty(t)||(r[t]=e,a=!0))}return{from:n,props:s,attrOutChannel:a?r:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}executeItem(t,e,i=0,s=1){return Array.isArray(t)?t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean):[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Io.END),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}pw.builtInAnimateMap={};const gw="appear",fw="disappear",mw="update",vw="highlight",_w="unhighlight";class yw{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class bw{constructor(t){this.stateList=null,this.graphic=t}applyState(t,e,i){const s=dw.getInstance(),n=[],r=[];if(this.stateList&&this.stateList.length?t.forEach(((t,i)=>{const a={allowTransition:!0,stopOriginalTransition:!0};this.stateList.forEach((e=>{const i=s.isTransitionAllowed(e.state,t,this.graphic);a.allowTransition=a.allowTransition&&i.allowTransition})),a.allowTransition&&(r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new pw(this.graphic)}),this.stateList.forEach((e=>{s.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&n.push(e)})))})):t.forEach(((t,i)=>{r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new pw(this.graphic)})})),n.forEach((t=>{t.executor.stop(null,!1)})),r.length){r[0].executor.execute(r[0].animationConfig);for(let t=0;t{e&&e.executor.execute(e.animationConfig),this.stateList=this.stateList.filter((t=>t!==s)),t===r.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!n.includes(t))):this.stateList=[],this.stateList.push(...r)}applyAppearState(t,e){this.applyState([gw],[{name:gw,animation:t}],e)}applyDisappearState(t,e){this.applyState([fw],[{name:fw,animation:t}],e)}applyUpdateState(t,e){this.applyState([mw],[{name:mw,animation:t}],e)}applyHighlightState(t,e){this.applyState([vw],[{name:vw,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([_w],[{name:_w,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class xw{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new bw(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new yw(t)),t._animationStateStore}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return(new xw)._getAnimationStateManager(t),t}}class Sw{getAttributes(t=!1){return t&&this.finalAttribute?this.finalAttribute:this.attribute}animate(t){var e,i,s;const n=new aw(null==t?void 0:t.id,null!==(i=null!==(e=null==t?void 0:t.timeline)&&void 0!==e?e:this.stage&&this.stage.getTimeline())&&void 0!==i?i:rw,null==t?void 0:t.slience);if(n.bind(this),t){const{onStart:e,onEnd:i,onRemove:s}=t;null!=e&&n.onStart(e),null!=i&&n.onEnd(i),null!=s&&n.onRemove(s)}return null===(s=this.stage)||void 0===s||s.ticker.start(),n}createTimeline(){return new nw}createTicker(t){return new hw(t)}setFinalAttributes(t){this.finalAttribute||(this.finalAttribute={}),Object.assign(this.finalAttribute,t)}initFinalAttributes(t){this.finalAttribute=t}initAnimateExecutor(){this._animateExecutor||(this._animateExecutor=new pw(this))}executeAnimation(t){return this.initAnimateExecutor(),this._animateExecutor.execute(t),this}executeAnimations(t){return this.initAnimateExecutor(),t.forEach((t=>{this._animateExecutor.execute(t)})),this}getFinalAttribute(){return this.finalAttribute}getGraphicAttribute(t,e=!1){return!e&&this.finalAttribute?this.finalAttribute[t]:this.attribute[t]}pauseAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function Aw(){G(Bp,xw),G(Bp,Sw)}class kw extends iw{constructor(t,e,i,s,n){super("customAnimate",e,i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class Mw extends kw{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class Tw{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new pw(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttr(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function ww(t){return new Tw(t)}class Cw extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,this.target.setAttribute("text",n)}}const Ew=1e3,Bw="quadInOut",Pw=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],Lw=(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=pp(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Rw=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?ey(t):[],n=ey(e);i&&s&&(i.fromTransform&&iy(s,i.fromTransform.clone().getInverse()),iy(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})))},Iw=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Dw=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Iw.includes(n))return;const r=e[n];if(!u(r)&&!u(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?dp.Get(t,cp.Color255):t;i.push({from:y(t[n])?t[n].map(e):e(t[n]),to:y(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class Fw extends kw{constructor(t,e,i){super({},{},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;Rw(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&Lw(this.otherAttrs,i,e),this.target.setAttributes(i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const zw=(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=Ow(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Dw(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new Fw({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Ew,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Bw);return c.play(d),c};class jw extends kw{constructor(t,e,i){super({},{},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;Rw(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&&Lw(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Hw=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Pw.includes(t))(i)||(e[i]=t[i])})),e},Vw=(t,e,i)=>{const s=Hw(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),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=Ao.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},Nw=(t,e,i)=>{const s=[],n=i?null:Hw(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:Hw(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=Rg(t.attribute),n=ny(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(Ao.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=ny(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(Ao.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=ny(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(Ao.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 ry(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 ry(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(Ao.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:ay(i)}];const s=[];return ly(i,e,s),s})(t,e).forEach((t=>{s.push(Ao.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 ly(l,e,h),h})(t,e).forEach((t=>{s.push(Ao.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=ey(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(Ao.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(Ao.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Vw(t,s,e),s};class Ww extends kw{constructor(t,e,i,s,n){super(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(){super.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:qo.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:qo.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:qo.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Gw extends Ww{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;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=Ao.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!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:y/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(_+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 Yw extends Ww{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:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=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=Ao.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:f,height:"in"===v&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===y?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class $w extends kw{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){super.onBind();const{points:t,segments:e}=this.target.attribute,{points:i,segments:s}=this.target.getFinalAttribute();this.from={points:t,segments:e},this.to={points:i,segments:s},this.props=this.to;const n=this.getPoints(this.from),r=this.getPoints(this.to,!0);this.fromPoints=n?Array.isArray(n)?n:[n]:[],this.toPoints=r?Array.isArray(r)?r:[r]:[];const a=new Map;this.fromPoints.forEach((t=>{t.context&&a.set(t.context,t)}));let o,l,h=1/0,c=-1/0;for(let t=0;t=0;t-=1)if(a.has(this.toPoints[t].context)){c=t,l=a.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(c)?(this.clipRange=this.toPoints[c][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[c][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=_t(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let d=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=a.get(t.context);return i?(d=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ec&&l?[l,t]:[d,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new re(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(t)return Object.keys(this.to).forEach((t=>{this.target.attribute[t]=this.to[t]})),this.target.addUpdatePositionTag(),void this.target.addUpdateShapeAndBoundsTag();if(this.points=this.points.map(((t,i)=>{const s=ed(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));this.target.setAttributes({clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.target.attribute.segments=e}else this.target.attribute.points=this.points;this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Xw extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0}));const o=this.target.getFinalAttribute();o&&this.target.setAttributes(o),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(a)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Kw extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Object.assign(this.target.attribute,i),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class qw extends Xw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class Zw extends Kw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}const Jw=(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.getFinalAttribute();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.getFinalAttribute();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)};class Qw extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this._updateFunction=null}updateStartAngle(t){this.target.attribute.startAngle=this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t}updateEndAngle(t){this.target.attribute.endAngle=this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class tC extends Qw{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=Jw(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r),this.determineUpdateFunction()}}class eC extends Qw{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class iC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/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:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class sC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const nC=(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,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:u(l)?void 0:c,height:u(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class rC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=nC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class aC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:u(o)?void 0:h,height:u(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const oC=(t,e,i)=>{const s=t.getFinalAttribute().points,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.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class lC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(this.target.attribute.points=r.map(((t,i)=>ed(r[i],a[i],e))),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class hC extends lC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:oC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class cC extends lC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:oC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const dC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class uC extends lC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:dC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class pC extends lC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:dC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const gC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class fC extends lC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:gC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class mC extends lC{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:gC(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const vC=(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.getFinalAttribute(),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.getFinalAttribute();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)};class _C extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class yC extends _C{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=vC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}}class bC extends _C{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const xC=(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.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:u(a)?void 0:l,width:u(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class SC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=xC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class AC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class kC extends Mw{onBind(){var t;const e=ww(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;this.target.setAttributes({x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class MC extends Mw{onBind(){const t=ww(this.target);this._animator=t;const e=this.duration,i=this.easing,{config:s,diffAttrs:n}=this.params;t.animate(this.target,{type:"to",to:Object.assign({},n),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},n)}}),this.completeBind(t)}deleteSelfAttr(t){super.deleteSelfAttr(t),this._animator.deleteSelfAttr(t)}tryPreventConflict(){}}function TC(){zk(),Nk(),qk(),iM(),pw.registerBuiltInAnimate("axisEnter",kC),pw.registerBuiltInAnimate("axisUpdate",MC)}var wC=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{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=pf.group({zIndex:999});e.name=vT.axisBreak,e.id=this._getNodeId(`${vT.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=j({},xT,s),a=null!==(e=r.size)&&void 0!==e?e:xT.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=pf.symbol(Object.assign({x:s.x,y:s.y},o));l.name=vT.axisBreakSymbol;const h=pf.symbol(Object.assign({x:n.x,y:n.y},o));h.name=vT.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=pf.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=vT.background,n.id=this._getNodeId("background"),n.states=j({},yT,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new UM(Object.assign({},t));e.name=vT.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=wC(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];P(l)||(c.state={line:j({},yT,l),symbol:j({},yT,l)});const d=new fT(c);d.name=vT.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return gt(t[0],0)?gt(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}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:d}=s,p=wC(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),_=this.getRelativeVector();let y=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+L(this.attribute,"label.space",4);y+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===_[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?y+=i+(e-1)*t:y=0}else if(0===_[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;y+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}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.getActualOffset(x),A=this.getVerticalCoord(v,S,!1),M=this.getVerticalVector(S,!1,{x:0,y:0});let T,w,{angle:C}=p;if(T="start"===n?"start":"end"===n?"end":"center",u(C)&&o){C=PM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;w=1==-1*t?"bottom":"top"}else T=this.getTextAlign(M),w=this.getTextBaseline(M,!1);let E=d;if(u(E)){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(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=s-S;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=s-S}const B=Object.assign(Object.assign(Object.assign({},A),p),{maxWidth:E,textStyle:Object.assign({textAlign:T,textBaseline:w},a),state:{text:j({},yT,c.text),shape:j({},yT,c.shape),panel:j({},yT,c.background)}});return B.angle=C,l&&l.visible&&(B.shape=Object.assign({visible:!0},l.style),l.space&&(B.space=l.space)),h&&h.visible&&(B.panel=Object.assign({visible:!0},h.style)),B}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:d}=s,p=wC(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),_=this.getVerticalVector(m,!1,{x:0,y:0});let y,{angle:b}=p,x="center";if(u(b)&&a){b=PM(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;y=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(_,!1,o.angle);x=t,y=e}const S=d,A=h?h(c):c,k=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:y},o),text:A});return k.angle=b,l&&l.visible&&(k.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),k}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return gt(t[1],0)?i=!gt(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 GT(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return YT(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=$(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(P(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(P(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,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=oe(e)})),UT(i,t),!NT(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=kT(a),l=AT(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=XT(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);k(i)&&(c=$t(c,i))}}else{if(l){const i=XT(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);k(i)&&(c=$t(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&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);$T(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&VT(t,{orient:o,method:m,separation:v,lastVisible:_,firstVisible: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=pf.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=vT.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-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(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 f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=RM(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=ai(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(){super.release(),this._breaks=null}}CC.defaultAttributes=bT,G(CC,KT);class EC{isInValidValue(t){const{startAngle:e=nM,endAngle:i=rM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=nM,endAngle:i=rM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return ce(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return wT(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function BC(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=BC(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var RC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),k(l)&&l>=3){const t=CT(n,l,c,e,i);h=pf.path(Object.assign(Object.assign({},a.style),{path:ET(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=pf.circle(t)}h.name=vT.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=j({},yT,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=RC(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=L(this.attribute.label,"style.fontSize",12)+L(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=n+m+f+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:j({},yT,d.text),shape:j({},yT,d.shape),panel:j({},yT,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;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(gt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=BC(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&PC(e,c,i)}else e.AABBBounds.width()>r&&PC(e,r,i)}else o>a.x&&h.x2>n.x2?(PC(e,n.x2-o,i),r&&LC(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return gt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}OC.defaultAttributes=bT,G(OC,EC);const IC=t=>t.map(((t,e)=>({index:e,value:t}))),DC=(t,e,i=0)=>{const s=new Ne(t).expand(i/2),n=new Ne(e).expand(i/2);return s.intersects(n)},FC=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=oe(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;u||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=LM(a),_=t.range();let y=[];for(let i=0;i{HC[t]=!0}));const GC=t=>-Math.log(-t),YC=t=>-Math.exp(-t),$C=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,XC=t=>10===t?$C:t===Math.E?Math.exp:e=>Math.pow(t,e),KC=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),qC=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),ZC=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function JC(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 QC(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function tE(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function eE(t,e,i,s){return 1===i&&(i=0),tE(t,i,s)*(e/(1-i))}function iE(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function sE(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=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 rE{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=iE(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=_t(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}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const aE=Symbol("implicit");class oE extends rE{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=jC.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=aE}clone(){const t=(new oE).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!==aE)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&&a>1;)a-=1,r=Math.floor((e-t)/a);return lE(t,e,r,n)}class cE extends oE{constructor(t){super(),this.type=jC.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=eE(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)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("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),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]}}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(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:hE(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=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(t=10){const e=this.calculateVisibleDomain(this._range);return hE(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=bt(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,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 cE(!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:dE}=ri;function uE(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return kt(t,e);if("string"===i){if(s=ii.parseColorString(e)){const e=dE(ii.parseColorString(t),s);return t=>e(t).formatRgb()}return kt(Number(t),Number(e))}return e instanceof si?dE(t,e):e instanceof ii?dE(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):kt(Number(t),Number(e))}class pE extends rE{constructor(t=WC,e=WC){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=WC,this._piecewise=QC,this._interpolate=uE}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),kt)),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=Mt,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=bt(i[0],i[r-1])),this._piecewise=r>2?sE:QC,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:WC),this.rescale(i)):this._clamp!==WC}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=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 gE=Math.sqrt(50),fE=Math.sqrt(10),mE=Math.sqrt(2),vE=[1,2,5,10],_E=(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=SE(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?bE(0,-(e-1)/s,s):bE((e-1)/s,0,s)},yE=vt(((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 _E(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return _E(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=bE(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=bE(t,e,l);return n&&r.reverse(),r})),SE=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=vE[0];return i>=gE?s=vE[3]:i>=fE?s=vE[2]:i>=mE&&(s=vE[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function AE(t,e,i){const s=(e-t)/Math.max(0,i);return SE(s)}function kE(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;e0;){if(s=AE(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function TE(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 wE=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),CE=vt(((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})),EE=vt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=xE(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?wE(t,e,n):wE(t,e,nE(n)),h=wE(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),BE=vt(((t,e,i,s,n)=>kE(s(t),s(e),i).map((t=>nE(n(t))))));class PE extends pE{constructor(){super(...arguments),this.type=jC.Linear}clone(){var t;const e=new PE;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return yE(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(d(null==e?void 0:e.customTicks))return e.customTicks(this,t);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=xE(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(t=10){const e=this.calculateVisibleDomain(this._range);return kE(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(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r: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}}function RE(t){return e=>-t(-e)}function OE(t=Number.EPSILON){return e=>Math.max(e,t)}class IE extends pE{constructor(){super(KC(10),XC(10)),this.type=jC.Log,this._limit=OE(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new IE).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=KC(this._base),s=XC(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=RE(i),this._pows=RE(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=GC,this.untransformer=YC):(this._logs=i,this._pows=s,this._limit=OE(),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 WC}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return CE(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return EE(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return BE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return BE(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{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))))}}}G(IE,LE);class DE extends PE{constructor(){super(qC(1),ZC(1)),this.type=jC.Symlog,this._const=1}clone(){return(new DE).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=qC(t),this.untransformer=ZC(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return CE(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return EE(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return BE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return BE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}G(DE,LE);class FE{constructor(){this.type=jC.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[lt(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 FE).domain(this._domain).range(this._range).unknown(this._unknown)}}function zE(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function jE(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!VC(t.type))return IC(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return IC([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:u=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),_=f&&f()?f().breakDomains:null,m=_&&_.length?v.filter((t=>_.every((e=>te[1])))):v;else if(p(h))m=zE(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=zE(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:u}):t.d3Ticks(e,{noDecimals:u})))}else{const i=null!==(s=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;m=zE(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:u,customTicks:n}):t.ticks(e,{noDecimals:u,customTicks:n})))}var v,_;const y=t.domain();if(e.labelFirstVisible&&y[0]!==m[0]&&!m.includes(y[0])&&m.unshift(y[0]),e.labelLastVisible&&y[y.length-1]!==m[m.length-1]&&!m.includes(y[y.length-1])&&m.push(y[y.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=zC(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=zC(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=$(l),r=f&&f()?VE.greedy:VE.parity;for(;l.length>=3&&PT(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;BT(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),jE(t,l,a,(e=>BT(e,t,i))),jE(n,l,o,(e=>BT(e,n,i)||!(!a||e===t)&&BT(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),$(h)!==$(m)&&h.push($(m))),m=h}}return IC(m)},VE={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&BT(i,t,e)||(i=t,0))))}},NE=(t,e,i,s)=>{const n=zC(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},UE=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,WE=(t,e)=>t[1]{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),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?IC([s[s.length-1]]):IC([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:f,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=K(g),a=X(g);if(s.length<=f/n){const i=NE(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=YE(s,i,o,e.labelLastVisible,Math.floor(n/l),!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=NE(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!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])){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&&!UE(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?WE(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{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=LM(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=ce({x:0,y:0},i,t),a=TT(r,wT(s,r,e,n));return o=a,l=wT(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return _.align||(gt(y,f.x)?_.baseline||(_.baseline=b>f.y?"top":"bottom"):y>f.x?_.align="left":y{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||h<=0)return IC(t.domain());let c;if(p(n))c=t.stepTicks(n);else if(p(s))c=t.forceTicks(s);else if(p(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=d(i)?i({axisLength:s,labelStyle:l}):i;c=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=$E(t,i,e),r=K(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=KE(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-p)}else c=t.domain();return IC(c)},KE=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&DC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},qE=new Uint32Array(33),ZE=new Uint32Array(33);ZE[0]=0,qE[0]=~ZE[0];for(let t=1;t<=32;++t)ZE[t]=ZE[t-1]<<1|1,qE[t]=~ZE[t];function JE(t,e,i={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:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&qE[31&o]&ZE[1+(31&l)])return!0}else{if(i[h]&qE[31&o])return!0;if(i[c]&ZE[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,qE[31&o]&ZE[1+(31&l)]);else for(s(h,qE[31&o]),s(c,ZE[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,ZE[31&a]|qE[1+(31&o)]);else for(n(l,ZE[31&a]),n(h,qE[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=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 QE(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=_t(i,-o,t.width+l),d=_t(s,-o,t.width+l),u=_t(n,-a,t.height+h),p=_t(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function tB(t,e,i=!1){return i?QE(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function eB(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=tB(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=QE(t,r)),e.getRange(r)))}function iB(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>p(t))),u=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return iB(t,e,n,o,h,c,l)}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 iB(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 iB(t,e,n,s,h,c)}return!1}const nB=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],rB=["top","inside-top","inside"];function aB(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let _=0,y=0;return u<0-h?_=-u:p>m&&(_=m-p),g<0-l?y=-g:f>v&&(y=v-f),{dx:_,dy:y}}const oB={mode:"same-time",duration:300,easing:"linear"};function lB(t){return 3===t||4===t}function hB(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 cB=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 dB(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)}}var uB=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{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const fB=(t,e)=>Math.ceil(t)>Math.floor(e),mB=([t,e],[i,s])=>s>t&&e>i;function vB(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}var _B=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{const e=t.target;e===this._lastHover||P(e.states)||(e.addState(oM.hover,!0),_M(this,(t=>{t===e||P(t.states)||t.addState(oM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(_M(this,(t=>{P(t.states)||(t.removeState(oM.hoverReverse),t.removeState(oM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void _M(this,(t=>{P(t.states)||(t.removeState(oM.selectedReverse),t.removeState(oM.selected))}));P(e.states)||(e.addState(oM.selected,!0),_M(this,(t=>{t===e||P(t.states)||t.addState(oM.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)===qo.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===qo.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(Ae(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,f=p-d;return[dB(g,f,c,d,a,o),dB(-g,-f,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds)}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=pf.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Wl)}return e&&e.getAttributes(!0).fill&&s.setAttribute("stroke",e.getAttributes(!0).fill),this.attribute.line&&!P(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;const t=[];!1!==this._enableAnimation&&this._baseMarks.forEach((e=>{t.push(e.attribute),e.initAttributes(e.getAttributes(!0))}));const{overlap:e,smartInvert:i,dataFilter:s,customLayoutFunc:n,customOverlapFunc:r}=this.attribute;let a=this.attribute.data;if(d(s)&&(a=s(a)),a&&a.length){const t=new Set;a=a.filter((e=>!t.has(e.id)&&t.add(e.id)))}let o=this._initText(a);o=d(n)?n(a,o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(o);const l=[],h=o;if(!c(e)&&d(null==e?void 0:e.filterBeforeOverlap)){const t=this.getRelatedGraphic.bind(this);o.forEach((i=>{e.filterBeforeOverlap(i,t,this)?h.push(i):l.push(i)}))}d(r)?o=r(h,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(l):!1!==e&&(o=this._overlapping(h).concat(l)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),o&&o.length&&o.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==i&&this._smartInvert(o),this._renderLabels(o),!1!==this._enableAnimation&&this._baseMarks.forEach(((e,i)=>{e.initAttributes(t[i])}))}_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&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(e)&&(t.states=e)}_createLabelText(t){var e,i;return DM(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;const i=[];let s;if(s=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),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&fB(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&fB(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(gt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(vB([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!mB([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let y=0,b=t.length-1;for(;y<=b;)y===b?_.push(t[y]):(_.push(t[y]),_.push(t[b])),y++,b--;return _}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&s.setRange(tB(i,t.AABBBounds,!0))}))),h.length>0&&h.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&&s.setRange(tB(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(tB(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){var s;if(t){if(!1!==t.attribute.visible){if(null===(s=t.context)||void 0===s?void 0:s.animationState){const e=t.clone();return Object.assign(e.attribute,t.getAttributes(!0)),e.AABBBounds}return t.AABBBounds}const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:n,y:r}=e;return{x1:n,x2:n,y1:r,y2:r}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:p}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{bB[t]=e};var SB=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{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,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*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}AB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const kB=()=>{xB("symbol",AB),xB("line-data",AB)};var MB=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{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}})(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}}}TB.tag="rect-label",TB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var wB=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{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=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}}(t,e,i,s)}};CB.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const EB=()=>{xB("line",CB),xB("area",CB)};var BB=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);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=d(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=d(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}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),h=l.getAttributes(!0),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.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=(h.startAngle+h.endAngle)/2,u=h.endAngle-h.startAngle,p=fe(h.endAngle-u/2),g=ce(c,h.outerRadius,o),f=ce(c,a+e.line.line1MinLength,o),m=new PB(t,g,f,p,u,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=ce(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(d=m.quadrant)||2===d?this._arcRight.set(m.refDatum,m):lB(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var d}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":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 f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,_=0;if("inside"===o&&(_="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=ce(t.circleCenter,v,t.middleAngle),t.labelLimit=f,ft(f,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.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=lB(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=lB(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.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 c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(mt(t.pointB.x,this._line2MinLength+h)||ft(t.pointB.x,c-this._line2MinLength-h))&&(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(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;k(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=lB(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-y-c:0+y+c;break;default:m=p.x+f*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+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?lB(t.quadrant)?"left":"right":lB(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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*(lB(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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,f,m;if(gt(l/2,u))g=0,f=1,m=-p;else if(gt(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,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,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?gt(v[0].y,v[1].y)?ft(t.middleAngle,-Math.PI)&&mt(t.middleAngle,0)||ft(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.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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;e{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 IB(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=ae.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 DB(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=ET(t,!!n),o=ET(r,!!n);const h=ae.distancePP(s,l),c=ae.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=IB(e,t,!1,!!n),o=IB(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=ET(t,!!n),o=ET(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}OB.defaultAttributes={pickable:!1};class FB extends tb{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&MT(this._innerView),this.removeAllChild(!0),this._innerView=pf.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 TT(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:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${vT.grid}-sub`:`${vT.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=ET(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=IB(t,o,!1,!!a)}const u=pf.path(Object.assign({path:c,z:l},d(r)?j({},this.skipDefault?null:FB.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 f=ET(o,!!a),m=Ut(o[0].x-o[1].x),v=Ut(o[0].y-o[1].y),_=pf.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*jt/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?j({},this.skipDefault?null:FB.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],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!gt(a.value,0)&&!gt(l.value,0),d=!gt(a.value,1)&&!gt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}FB.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},zk(),Wk();class zB extends FB{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},FB.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=nM,endAngle:r=rM}=this.attribute;i=CT(t,s,ae.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=j({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);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})}}G(zB,KT);var jB,HB,VB,NB=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){const e=this._getPointsOfSubGrid(p,d);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"})}}G(UB,EC),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(jB||(jB={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(HB||(HB={})),function(t){t.dataZoomChange="dataZoomChange"}(VB||(VB={}));const WB="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",GB={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:WB,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:WB,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},YB={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}},$B=0,XB=1,KB=2,qB=3,ZB=4,JB=5,QB=5,tP=999,eP=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var iP=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;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s,zIndex:KB},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s,zIndex:KB},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto",zIndex:$B},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,k,M,T;const{orient:w,middleHandlerStyle:C={},startHandlerStyle:E={},endHandlerStyle:B={},zoomLock:P}=this.attribute,{start:L,end:R}=this._getState(),{position:O,width:I,height:D}=this._getLayoutAttrFromConfig(),F=null!==(t=E.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=B.triggerMinSize)&&void 0!==e?e:40,j=this._getContainer();if(this._isHorizontal){if(C.visible){const t=(null===(i=C.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:O.x+L*I,y:O.y-t,width:(R-L)*I,height:t,zIndex:JB},null===(s=C.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=C.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:O.x+(L+R)/2*I,y:O.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=C.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square",zIndex:JB},C.icon),{pickable:!P&&(null===(h=C.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:O.x+L*I,y:O.y+D/2,size:D,symbolType:null!==(c=E.symbolType)&&void 0!==c?c:"square"},YB.horizontal),{zIndex:JB}),E),{pickable:!P&&(null===(d=E.pickable)||void 0===d||d)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:O.x+R*I,y:O.y+D/2,size:D,symbolType:null!==(u=B.symbolType)&&void 0!==u?u:"square"},YB.horizontal),{zIndex:JB}),B),{pickable:!P&&(null===(p=B.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:O.x+L*I-t/2,y:O.y+D/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:tP},YB.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:O.x+R*I-g/2,y:O.y+D/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:tP},YB.horizontal),{pickable:!P}),"rect")}else{if(C.visible){const t=(null===(g=C.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===w?O.x-t:O.x+I,y:O.y+L*D,width:t,height:(R-L)*D,zIndex:JB},null===(f=C.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(_=null===(v=null===(m=C.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===_||_)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===w?O.x-t/2:O.x+I+t/2,y:O.y+(L+R)/2*D,angle:Math.PI/180*90,symbolType:null!==(b=null===(y=C.icon)||void 0===y?void 0:y.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0,zIndex:JB},C.icon),{pickable:!P&&(null===(S=null===(x=C.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:O.x+I/2,y:O.y+L*D,size:I,symbolType:null!==(A=E.symbolType)&&void 0!==A?A:"square"},YB.vertical),{zIndex:JB}),E),{pickable:!P&&(null===(k=E.pickable)||void 0===k||k)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:O.x+I/2,y:O.y+R*D,size:I,symbolType:null!==(M=B.symbolType)&&void 0!==M?M:"square",zIndex:JB},YB.vertical),B),{pickable:!P&&(null===(T=B.pickable)||void 0===T||T)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:O.x+I/2+t/2,y:O.y+L*D-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:tP},YB.vertical),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:O.x+I/2+i/2,y:O.y+R*D-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:tP},YB.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move",zIndex:qB},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move",zIndex:qB},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1,zIndex:XB},"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))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1,zIndex:ZB},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){return t.length<=10||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,void 0!==e?e*e:1)}(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(t);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(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){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 Ve).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)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=iP(c,["formatMethod"]),{formatMethod:g}=d,f=iP(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:_,width:y,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,A={x1:_.x,y1:_.y,x2:_.x+y,y2:_.y+b};let k,M,T,w;this._isHorizontal?(k={x:_.x+m*y,y:_.y+b/2},M={x:_.x+v*y,y:_.y+b/2},T={textAlign:eP(A,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},w={textAlign:eP(A,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:_.x+y/2,y:_.y+m*b},M={x:_.x+y/2,y:_.y+v*b},T={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:eP(A,t,"start",this._isHorizontal)?"top":"bottom"},w={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:eP(A,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),j({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T,zIndex:QB}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),j({},f,{text:S,x:M.x,y:M.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w,zIndex:QB}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new UM(e),s.name=i,t.add(s)),s}}const nP={debounce:St,throttle:At};class rP extends l{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=jB.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=jB.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=jB.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=jB.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=jB.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===k_.env?k_:this.stage,s=dM();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===jB.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===jB.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===jB.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===jB.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(HB.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(HB.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(HB.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===jB.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(HB.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(HB.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:nP[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===k_.env?k_:this.stage,e=dM();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===k_.env?k_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===k_.env?k_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:_t(e+t,0,1),end:_t(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=jB.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}VM(),Xk(),tM(),Lk(),Nk();let aP=class t extends tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,_;h.visible?this._isHorizontal?(m=p,v=g-f,_={x:a.x,y:a.y+f}):(m=p-f,v=g,_={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(y+b)/2,_={x:_.x+y/2,y:_.y}):(v-=(y+b)/2,_={x:_.x,y:_.y+y/2})),v+=(null!==(n=u.lineWidth)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:_,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new sP(this._getRendererAttrs()),this._interaction=new rP(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(HB.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(HB.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(VB.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(HB.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;p(t)&&p(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(VB.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.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._renderer.previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._renderer.statePointToData=t)}};var oP,lP,hP,cP;function dP(){zk(),VM(),Aw()}aP.defaultAttributes=GB,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"}(oP||(oP={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(lP||(lP={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(hP||(hP={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(cP||(cP={}));class uP extends tb{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=LT(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=RT(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=OT(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:j({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:j({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:j({},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=pf.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=pf.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=pf.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 pP(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 gP(t,e,i,s){t&&(pP(t.startSymbol,e,i,s),t.lines.forEach((t=>pP(t,e,i,s))),pP(t.line,e,i,s),pP(t.endSymbol,e,i,s))}function fP(t,e,i,s){t&&(pP(t.getTextShape(),e,i,s),pP(t.getBgRect(),e,i,s))}function mP(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 vP(t,e,i,s){t&&(mP(t.startSymbol,e,i,s),t.lines.forEach((t=>mP(t,e,i,s))),mP(t.line,e,i,s),mP(t.endSymbol,e,i,s))}function _P(t,e,i,s){t&&(mP(t.getTextShape(),e,i,s),mP(t.getBgRect(),e,i,s))}function yP(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;pP(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)})),pP(t.endSymbol,s+r+a,o,n),Y(e).forEach((t=>{const e=s+r+a+o;pP(t.getTextShape(),e,l,n),pP(t.getBgRect(),e,l,n)}))}function bP(t,e,i,s,n){gP(t,s,i,n),Y(e).forEach((t=>{fP(t,s,i,n)}))}function xP(t,e,i,s,n){pP(t,s,i,n),Y(e).forEach((t=>{fP(t,s,i,n)}))}function SP(t,e,i,s,n){pP(t,s,i,n),Y(e).forEach((t=>{fP(t,s,i,n)}))}function AP(t,e,i,s,n,r){var a;gP(t,n,s,r),pP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?fP(i,n,s,r):pP(i,n,s,r)}function kP(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;pP(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)})),pP(e,n+o+l,h,r),pP(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(pP(i.getTextShape(),n+o+l+h+c,d,r),pP(i.getBgRect(),n+o+l+c,d,r)):pP(i,n+o+l+c,d,r)}function MP(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?yP(t,e,s,r,a):"fadeIn"===i&&bP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?yP(t,e,s,n,a):"fadeIn"===i&&bP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){vP(t,s,i,n),Y(e).forEach((t=>{_P(t,s,i,n)}))}(t,e,i,s,n)}}function TP(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&&xP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&xP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){mP(t,s,i,n),Y(e).forEach((t=>{_P(t,s,i,n)}))}(t,e,i,s,n)}}function wP(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&&SP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&SP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){mP(t,s,i,n),Y(e).forEach((t=>{_P(t,s,i,n)}))}(t,e,i,s,n)}}function CP(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?AP(n,r,e,i,s,o):"callIn"===t&&kP(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?AP(n,r,e,i,s,a):"callIn"===t&&kP(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;vP(t,n,s,r),mP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?_P(i,n,s,r):mP(i,n,s,r)}(n,r,e,t,i,s)}}const EP={type:"clipIn",duration:500,easing:"linear",delay:0},BP={type:"fadeIn",duration:500,easing:"linear",delay:0},PP={type:"callIn",duration:500,easing:"linear",delay:0},LP={type:"fadeOut",duration:500,easing:"linear",delay:0};class RP{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=Y(null==n?void 0:n.label),a=Y(null==n?void 0:n.labelBackground),o=Y(s).map(((s,n)=>{var o,l;const h=j({},i,s),c=new UM(Object.assign(Object.assign({},h),{state:{panel:j({},lM,null!==(o=a[n])&&void 0!==o?o:$(a)),text:j({},lM,null!==(l=r[n])&&void 0!==l?l:$(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===Y(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=Y(this._label),n=Y(null==i?void 0:i.label),r=Y(null==i?void 0:i.labelBackground);if(s.length){const i=Y(e);s.forEach(((e,s)=>{var a,o;const l=j({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:j({},lM,null!==(a=r[s])&&void 0!==a?a:$(r)),text:j({},lM,null!==(o=n[s])&&void 0!==o?o:$(n))}})),this.setLabelPos(e,l)}))}}}class OP extends uP{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=EP,this.defaultExitAnimation=LP}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;HM(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}G(OP,RP);const IP=.001,DP={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:oP.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]}},FP={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"}}},zP={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:{autoRotate:!0,position:hP.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]}},jP={interactive:!0,label:{position:lP.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}},HP={interactive:!0,label:{autoRotate:!0,position:hP.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}},VP={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"}},NP={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"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},UP={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 WP(){GP._animate=MP}dP(),pT(),Aw();class GP extends OP{markerAnimate(t){GP._animate&&this._animationConfig&&GP._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},GP.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i: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,e){var i;return(bM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return xM(Math.abs(e),Math.PI/2,IP)||xM(Math.abs(e),3*Math.PI/2,IP)?SM(i,e,t):bM(e)?FP.postiveXAxis[t]:FP.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new fT({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:j({},lM,null==a?void 0:a.line),startSymbol:j({},lM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},lM,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:j({},lM,null==a?void 0:a.line),startSymbol:j({},lM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},lM,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}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",GP.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(GP.defaultAttributes.label)}}function YP(){$P._animate=TP}GP.defaultAttributes=DP,dP(),Yk(),Aw();class $P extends uP{markerAnimate(t){$P._animate&&this._animationConfig&&$P._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},$P.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=BP,this.defaultExitAnimation=LP}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},NP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;HM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=pf.polygon(Object.assign({points:e},i));n.states=j({},lM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",$P.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=j({},lM,null==i?void 0:i.area)),this._updateMarkLabels($P.defaultAttributes.label)}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}}$P.defaultAttributes=jP,G($P,RP),dP(),gT(),Aw();class XP extends OP{markerAnimate(t){XP._animate&&this._animationConfig&&XP._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},XP.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case hP.arcInnerStart:l=n;case hP.arcOuterStart:l=n;break;case hP.arcInnerEnd:l=r;case hP.arcOuterEnd:l=r;break;case hP.center:case hP.arcInnerMiddle:case hP.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return VP[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new mT({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:j({},lM,null==o?void 0:o.line),startSymbol:j({},lM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},lM,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:j({},lM,null==o?void 0:o.line),startSymbol:j({},lM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},lM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",XP.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(XP.defaultAttributes.label)}}XP.defaultAttributes=zP,dP(),Bk(),Aw();class KP extends uP{markerAnimate(t){KP._animate&&this._animationConfig&&KP._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},KP.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=BP,this.defaultExitAnimation=LP}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case hP.center:h=(s+n)/2,c=(r+a)/2;break;case hP.arcInnerStart:h=s,c=r;break;case hP.arcOuterStart:h=n,c=r;break;case hP.arcInnerEnd:h=s,c=a;break;case hP.arcOuterEnd:h=n,c=a;break;case hP.arcInnerMiddle:h=s,c=(r+a)/2;break;case hP.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},VP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;HM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=pf.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=j({},lM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",KP.defaultAttributes.label)}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=j({},lM,null==o?void 0:o.area)),this._updateMarkLabels(KP.defaultAttributes.label)}isValidPoints(){return!0}}function qP(){ZP._animate=CP}KP.defaultAttributes=HP,G(KP,RP),dP(),pT(),gT(),tM(),Hk(),Nk(),Aw();class ZP extends uP{markerAnimate(t){ZP._animate&&this._animationConfig&&ZP._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},ZP.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=PP,this.defaultExitAnimation=LP,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return xM(Math.abs(s),Math.PI/2,IP)||xM(Math.abs(s),3*Math.PI/2,IP)?SM(t,s,n):bM(s)?UP.postiveXAxis[n]:UP.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,style:d,position:u=cP.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-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,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:j({},lM,null==p?void 0:p.textBackground),text:j({},lM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=j({},lM,null==p?void 0:p.itemContent));const v=bM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+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",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=pf.symbol(Object.assign(Object.assign({},i),r)),o.states=j({},lM,null==s?void 0:s.itemContent)):"text"===n?o=new UM(Object.assign(Object.assign({},i),{state:{panel:j({},lM,null==s?void 0:s.textBackground),text:j({},lM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=pf.richtext(Object.assign(Object.assign({},i),r)),o.states=j({},lM,null==s?void 0:s.itemContent)):"image"===n?(o=pf.image(Object.assign(Object.assign({},i),r)),o.states=j({},lM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=j({},lM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}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=xM(c,0,IP)||xM(d,0,IP),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=zM(e-u,t-d),o=zM(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*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(aL.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(aL.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===aL.focus||"focus"===o){const s=a.hasState(nL.focus);a.toggleState(nL.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[nL.unSelected,nL.unSelectedHover,nL.focus],t),this._setLegendItemState(e,nL.selected,t)})):(this._setLegendItemState(a,nL.selected,t),this._removeLegendItemState(a,[nL.unSelected,nL.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[nL.selected,nL.selectedHover,nL.focus],t),this._setLegendItemState(e,nL.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(nL.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(nL.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(rL.legendItemClick,a,t);i?(this._removeLegendItemState(a,[nL.selected,nL.selectedHover],t),this._setLegendItemState(a,nL.unSelected,t)):(this._setLegendItemState(a,nL.selected,t),this._removeLegendItemState(a,[nL.unSelected,nL.unSelectedHover],t))}else this._setLegendItemState(a,nL.selected,t),this._removeLegendItemState(a,[nL.unSelected,nL.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[nL.selected,nL.selectedHover],t),this._setLegendItemState(e,nL.unSelected,t))}))}this._dispatchLegendEvent(rL.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,nL.selected),this._removeLegendItemState(e,[nL.unSelected,nL.unSelectedHover])):(this._removeLegendItemState(e,[nL.selected,nL.selectedHover]),this._setLegendItemState(e,nL.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=eL,spaceRow:l=iL,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:u?i:e,v=this._contentMaxHeight;let _,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,M=0,T=0;const w=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),_=d[t],_.id||(_.id=_.label),_.index=t;let e=!0;y(n)&&(e=n.includes(_.label));const i=this._renderEachItem(_,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||w.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=T+l,T=0,w.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),w.push(i)):(p(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=M+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=pf.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:u}=t,g=[];p(c)&&g.push(c),p(d)&&g.push(d),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=K(g)),p(u)&&(this._itemHeightByUser=u);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,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:f,autoEllipsisStrategy:m}=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=ai(c);let w;!1===x.visible?(w=pf.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,aL.item,t,w)):(w=pf.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,aL.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?nL.selected:nL.unSelected);const C=pf.group({x:0,y:0,pickable:!1});w.add(C);let E,B=0,P=0,R=0;if(v&&!1!==v.visible){const i=L(S,"style.size",10);P=y(i)?i[0]||0:i,R=L(v,"space",8);const s=pf.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,aL.itemShape,t,w,S.state),s.addState(e?nL.selected:nL.unSelected),C.add(s)}let O=0;if(d){const e=L(g,"size",10);E=pf.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,aL.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=DM(Object.assign(Object.assign({x:P/2+R,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,aL.itemLabel,t,w,A.state),D.addState(e?nL.selected:nL.unSelected),C.add(D);const F=L(_,"space",8);if(p(l)){const s=L(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=DM(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,aL.itemValue,t,w,k.state),r.addState(e?nL.selected:nL.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-P-R-F-O-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-P/2-T[1]-T[3]-O-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));B=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-P-R-O),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",B),C.add(E));const z=C.AABBBounds,j=z.width();if("right"===f){const t=z.x2,e=z.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=z.height(),V=p(this.attribute.item.width)?this.attribute.item.width:j+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(-z.x1+T[3],-z.y1+T[0]),w}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new tL(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},j({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new tL(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new pM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new pM(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?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 i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",At(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=eL,spaceRow:o=iL}=n,l=this._itemsContainer,{space:h=sL,defaultCurrent:c=1}=r,d=cL(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,_=0,y=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v0&&(y=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:y,y:b}),y+=a+i})),this._itemContext.startX=y,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),_=p-g.AABBBounds.height()-h-t,_<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;_0&&(b=0,y+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:y,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=pf.group({x:0,y:t,width:u?v:f,height:u?m:_,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=eL,spaceRow:a=iL}=s,o=this._itemsContainer,{space:l=sL,defaultCurrent:h=1}=n,c=cL(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const _=pf.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=pf.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];gt(_t(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),gt(_t(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(nL.selected)?this._setLegendItemState(t,nL.selectedHover,e):this._setLegendItemState(t,nL.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===aL.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(rL.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(nL.unSelectedHover)||t.hasState(nL.selectedHover))&&(i=!0),t.removeState(nL.unSelectedHover),t.removeState(nL.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(nL.unSelectedHover)&&!t.hasState(nL.selectedHover)||(i=!0),t.removeState(nL.unSelectedHover),t.removeState(nL.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===aL.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(rL.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(rL.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!==aL.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(rL.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!==aL.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(rL.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(nL.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=j({},dL,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(nL.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}release(){super.release(),this.removeAllEventListeners()}};var pL;function gL(t){return y(t)?t:[t,t]}function fL(t){return t?"ew-resize":"ns-resize"}uL.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:eL,spaceRow:iL,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:sL,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"}(pL||(pL={})),lL();class mL extends tb{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},mL.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=_t(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=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=dM(),n="browser"===k_.env?k_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;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=_t(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=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=dM(),n="browser"===k_.env?k_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{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?_t(t+p,h,c):_t(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?_t(t+p,0,c-h):_t(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=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),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:gL(d)[0],endValue:gL(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=pf.group({x:0,y:0});f.name=pL.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=pf.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)),m.name=pL.startText,f.add(m);const e=p(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const _=pf.group({x:g?v:0,y:g?0:v});f.add(_);const y=pf.group({x:0,y:0});let b;if(y.name=pL.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=pf.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=pL.endText,f.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=pf.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=pL.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,f]=gL(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":fL(p)},r));if(v.name=pL.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=pL.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":fL(p)},r));if(i.name=pL.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f,"end");e.name=pL.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=yt(h,i,s);c=t[0],d=t[1]}else c=i,d=_t(h,i,s);const p=this._isHorizontal;e||(c=i);const f=pf.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=pL.trackContainer;const m=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":fL(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=pf.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=pL.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return pf.symbol(t)}_renderHandlerText(t,e){return pf.text(this._getHandlerTextAttributes(t,e))}_getHandlerPosition(t){return this.attribute.range&&t?"start":"end"}_getHandlerTextStyle(t,e){const{align:i,handlerSize:s=14,handlerText:n={},railHeight:r,railWidth:a,slidable:o}=this.attribute;return d(n.style)?n.style(t,e,{layout:this.attribute.layout,align:i,railWidth:a,railHeight:r,handlerSize:s,slidable:o}):n.style}_getHandlerTextAttributes(t,e){var i,s;const{align:n,handlerSize:r=14,handlerText:a={},railHeight:o,railWidth:l,slidable:h}=this.attribute,c=this._isHorizontal,d=this.calculatePosByValue(t,e),u=null!==(i=a.space)&&void 0!==i?i:4,p=this._getHandlerTextStyle(t,e),g={text:a.formatter?a.formatter(t):t.toFixed(null!==(s=a.precision)&&void 0!==s?s:0),lineHeight:null==p?void 0:p.lineHeight,cursor:!1===h?"default":fL(c)};return c?"top"===n?(g.textBaseline="bottom",g.textAlign="center",g.x=d,g.y=(o-r)/2-u):(g.textBaseline="top",g.textAlign="center",g.x=d,g.y=(o+r)/2+u):"left"===n?(g.textBaseline="middle",g.textAlign="end",g.x=(l-r)/2-u,g.y=d):(g.textBaseline="middle",g.textAlign="start",g.x=(l+r)/2+u,g.y=d),Object.assign(Object.assign({},g),p)}_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=pf.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=pf.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),("browser"===k_.env?k_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=dM(),e="browser"===k_.env?k_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_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){const s=this._isHorizontal;t.setAttribute(s?"x":"y",e);const n=t.name===pL.startHandler?this._startHandlerText:this._endHandlerText;if(n){const e=this._getHandlerPosition(t.name===pL.startHandler);n.setAttributes(this._getHandlerTextAttributes(i,e))}t.name===pL.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){const s=this._isHorizontal,n=this._getHandlerPosition(t.name===pL.startHandlerText);t.setAttributes(this._getHandlerTextAttributes(i,n));const r=t.name===pL.startHandlerText?this._startHandler:this._endHandler;r&&r.setAttributes({[s?"x":"y"]:e}),t.name===pL.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}}release(t){super.release(t),("browser"===k_.env?k_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}mL.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}}},hL(),lL();class vL extends oL{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},vL.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:f,handlerText:m,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:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function _L(t="bottom"){let 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`}vL.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"}}},hL(),lL(),Wk();class yL extends oL{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},yL.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:f,showTooltip:m,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=pf.group({x:0,y:0});this._innerView.add(x);const S=new mL({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:_L(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,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=pf.path(Object.assign(Object.assign({x:0,y:k,path:A},_),{zIndex:0}));x.add(M);const T=this._title?this._title.AABBBounds.height()+L(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))}}yL.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)"}},zk(),iM(),qk();let bL=class t extends tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,b,x;const{textType:S,text:A,subtextType:k,textStyle:M={},subtext:T,subtextStyle:w={},width:C,height:E,minWidth:B,maxWidth:P,minHeight:L,maxHeight:R,align:O,verticalAlign:I,padding:D=0}=this.attribute,F=ai(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),j=null!==(t=M.height)&&void 0!==t?t:E;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:u="break-word",maxWidth:g,lineClamp:f}=M;if("rich"===S||p(M.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:C)&&void 0!==e?e:0,height:null!=j?j:0,ellipsis:null==d||d,wordBreak:null!=u?u:"break-word",maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:null!==(i=M.character)&&void 0!==i?i:A},M);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},hM),M),x:h,y:c,width:null!==(s=null!=t?t:C)&&void 0!==s?s:0,height:null!=j?j:0,ellipsis:d,wordBreak:u,maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:[]},M);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else p(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(A)?A:[A],whiteSpace:"normal"},M),{maxLineWidth:null!==(r=null!==(n=M.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:C,heightLimit:null!==(a=M.height)&&void 0!==a?a:R,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const H=this._mainTitle?this._mainTitle.AABBBounds.height():0,V=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==w.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=w,v=Math.max(Number.MIN_VALUE,R-H);if("rich"===k||p(w.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:C)&&void 0!==o?o:0,height:null!==(l=null!=e?e:E)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=w.character)&&void 0!==h?h:T},w);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:T},hM),w),x:n,y:r,width:null!==(c=null!=t?t:C)&&void 0!==c?c:0,height:null!==(d=null!=e?e:E)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},w);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else p(T)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(T)?T:[T],whiteSpace:"normal"},w),{maxLineWidth:null!==(u=w.maxLineWidth)&&void 0!==u?u:C,heightLimit:null!==(g=w.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:H}),"text"))}const N=this._subTitle?this._subTitle.AABBBounds.height():0,U=this._subTitle?this._subTitle.AABBBounds.width():0;let W=Math.max(V,U),G=H+(null!==(f=w.height)&&void 0!==f?f:N);if(p(C)&&(W=C),p(E)&&(G=E),p(B)&&WP&&(W=P),p(L)&&GR&&(G=R),z.attribute.width=W,z.attribute.height=G,z.attribute.boundsPadding=F,this._mainTitle){if(p(O)||p(M.align)){const t=M.align?M.align:O,e=null!==(m=M.width)&&void 0!==m?m:W;"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")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:I,e=null!=j?j:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"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")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(p(O)||p(w.align)){const t=w.align?w.align:O,e=null!==(_=null!==(v=w.width)&&void 0!==v?v:M.width)&&void 0!==_?_:W;"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")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=w.verticalAlign?w.verticalAlign:I,e=this._mainTitle?p(j)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),j):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=w.height)&&void 0!==b?b:E)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"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")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};bL.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 xL={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"}}};zk(),iM(),qk();let SL=class extends tb{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=j({},L(xL,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=DM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{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,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(p(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),p(s)){const t=Y(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e: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=RM(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,f=c/2,m=g**2+1,v=2*f*g,_=f**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*m*_))/(2*m))+f),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 AL extends Cg{constructor(t){super(t)}}var kL,ML;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(kL||(kL={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(ML||(ML={}));class TL extends tb{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},TL.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"},TL.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"},TL.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},TL.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},TL.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 AL(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new AL(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new AL(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(kL.OnPlay)},this.pause=()=>{this._dispatchEvent(kL.OnPause)},this.forward=()=>{this._dispatchEvent(kL.OnForward)},this.backward=()=>{this._dispatchEvent(kL.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()}}TL.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},TL.defaultAttributes={[ML.Start]:{},[ML.Pause]:{},[ML.Backward]:{},[ML.Forward]:{}};const wL={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},CL=[200,10];var EL,BL;!function(t){t.Default="default",t.Reverse="reverse"}(EL||(EL={})),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"}(BL||(BL={}));const PL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===EL.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===EL.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),LL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===EL.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===EL.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),RL=t=>"top"===t||"bottom"===t;class OL extends tb{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},OL.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=Yt(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(RL(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:CL[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:CL[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 mL(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 t.layout=RL(this._orient)?"horizontal":"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 TL(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=RL(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:CL[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Yt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(RL(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:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:RL(this._orient)?t+s:(this._size.width-r)/2,y:RL(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:RL(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:RL(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:Yt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:RL(this._orient)?t+s:(this._size.width-r)/2,y:RL(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]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function IL(){lL(),zk(),tM()}OL.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({},wL),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},wL),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},wL),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},wL),{key:"backward",position:"start"})}},IL();class DL extends OL{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},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:EL.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(kL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(kL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(kL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(kL.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(BL.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(PL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||LL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===EL.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(BL.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=k_.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(BL.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(BL.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=k_.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(),k_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(BL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,k_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(BL.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(BL.change),this.dispatchCustomEvent(BL.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var FL,zL=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())}))};IL();class jL extends OL{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(kL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(kL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(kL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(kL.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(BL.change))},this.play=()=>zL(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(BL.play),this._rafId=k_.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=k_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,k_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(BL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,k_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(BL.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(BL.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(BL.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.brushActive="brushActive",t.brushClear="brushClear"}(FL||(FL={}));const HL={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],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:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},VL=5;const NL={debounce:St,throttle:At};zk(),Yk();let UL=class t extends tb{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=HL.updateTrigger,endTrigger:i=HL.endTrigger,brushMoved:s=!0}=this.attribute;Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushingWithDelay))),Y(i).forEach((t=>this.stage.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos]},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:NL[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(FL.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const{trigger:t=HL.trigger,resetTrigger:e=HL.resetTrigger}=this.attribute;Y(t).forEach((t=>this.stage.addEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(FL.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;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,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(FL.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=VL}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(FL.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(FL.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;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._dispatchBrushEvent(FL.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=VL}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(FL.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(FL.brushClear,t)):Math.abs(r-s)this.stage.removeEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents()}_releaseBrushUpdateEvents(){const{updateTrigger:t=HL.updateTrigger,endTrigger:e=HL.endTrigger}=this.attribute;Y(t).forEach((t=>this.stage.removeEventListener(t,this._onBrushingWithDelay))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushEnd)))}_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=pf.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}_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(Le(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_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.ythis._brushMaskAABBBoundsDict[t].empty()))}};UL.defaultAttributes=HL;const WL=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return j(t,...e,{shape:i.every(u)?void 0:j({},...i),key:s.every(u)?void 0:j({},...s),value:n.every(u)?void 0:j({},...n)})},GL=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}},YL={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:aM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:aM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:aM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ne).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},$L=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];zk(),Xk(),tM(),iM(),qk();let XL=class t extends tb{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: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=ai(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",j({symbolType:"circle"},u.shape,{visible:yM(u)&&yM(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:yM(u)&&yM(u.value)},GL(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:yM(u)&&yM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:yM(u)&&yM(u.value)},GL(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},hM),u.value),visible:yM(u)&&yM(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=yM(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:f,textBaseline:m}=u.value,v=n.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 _=yM(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(!yM(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)+(yM(n.key)?r+n.key.spacing:0)+(yM(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&&(FM(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";p(n.value.textAlign)?t=n.value.textAlign:yM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),FM(c,f,t,u,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(yM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=ad(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(yM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},GL(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},GL(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},hM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(yM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},GL(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},GL(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=>$L.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)&&yM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=yM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=LM(d),_=LM(u);let y=0;if(yM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),y=Math.max(y,e)}if(yM(u)){const{width:t,height:e}=_.quickMeasure(u.text);h.push(t),y=Math.max(y,e)}f&&cu[m]&&(t=!0,r.push(p.size),y=Math.max(p.size,y)),e.height=y,o+=y,a{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 WL({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return WL({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};XL.defaultAttributes=YL;const KL=gt;function qL(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:K(i)}function ZL(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function JL(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function QL(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 tR(t,e){const i=QL(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 eR(t,e){const i=iR(t),s=iR(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 iR(t,e={x:0,y:0}){return ae.distancePP(t,e)}function sR(t){return k(t.x)&&k(t.y)}function nR(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 rR(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const aR=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function lR(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&lR(t[i],e)}}var hR,cR,dR;function uR(t){var e,i;const{type:s}=t;return s===cR.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!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.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_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"}(hR||(hR={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",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",t.mosaic="mosaic",t.pictogram="pictogram"}(cR||(cR={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",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.transform="transform",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.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.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(dR||(dR={}));const pR={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},gR={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function fR(t,e){var i;if(!t)return[];const s=SR(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?bR(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>yR(i)?vR(t,i,e):i)).filter(p)}))):i.map((i=>yR(i)?vR(t,i,e):i)).filter(p):[]}return[]}function mR(t,e){var i,s;return bR(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 vR(t,e,i){var s;const n=SR(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=pR[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=gR[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 ii(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=$e(t,i,s),a=Ye(n,r,e.l),l=new ii(`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 _R=(t,e)=>{if(e&&yR(t)){const i=vR(e,t);if(i)return i}return t};function yR(t){return t&&"palette"===t.type&&!!t.key}function bR(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function xR(t){return y(t)?{dataScheme:t}:t}function SR(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=uR(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 AR extends oE{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(!bR(this._range))return void super.range(this._range);const t=mR(this._range,this._domain);super.range(t)}}const kR={linear:PE,band:cE,point:class extends cE{constructor(t){super(!1),this.type=jC.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:oE,threshold:FE,colorOrdinal:AR};function MR(t){const e=kR[t];return e?new e:null}function TR(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function wR(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function CR(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function ER(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function BR(t){return!!_(t)&&(!!t.endsWith("%")&&Zy(t.substring(0,t.length-1)))}function PR(t){return!!g(t)&&("percent"in t||"offset"in t)}function LR(t,e,i,s=0){var n,r;return S(t)?t:BR(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 RR(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]=LR(t[s],e.size,i)}))})),o}function OR(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}}function IR(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)||BR(t)||d(t)||PR(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function DR(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const FR=(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},zR=[{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"]}];function jR(t,e){return t&&e.key in t?t[e.key]:e.default}function HR(t){return t&&"token"===t.type&&!!t.key}const VR={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%"},NR={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:zR,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)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:VR,component:{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}}},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:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},UR={name:"dark",colorScheme:{default:{dataScheme:zR,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",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},WR=(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]={}),WR(t[s],e.slice(1),i))};function GR(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=xR(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}YR._charts={},YR._series={},YR._components={},YR._graphicComponents={},YR._marks={},YR._regions={},YR._animations={},YR._implements={},YR._chartPlugin={},YR._vChartPlugin={},YR._componentPlugin={},YR.transforms={fields:$r,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}},YR.dataParser={csv:(t,e={},i)=>(i.type=Yr.DSV,na(t)),dsv:(t,e={},i)=>{i.type=Yr.DSV;const s=Vr(aa,e),{delimiter:n}=s;if(!_(n))throw new TypeError("Invalid delimiter: must be a string!");return sa(n).parse(t)},tsv:(t,e={},i)=>(i.type=Yr.DSV,ra(t))},YR._layout={},YR._grammarTransforms={},YR._stageEventPlugins={},YR.registerStageEventPlugin=(t,e)=>{YR._stageEventPlugins[t]=e},YR.getStageEventPlugin=t=>YR._stageEventPlugins[t],YR._interactionTriggers={},YR.registerInteractionTrigger=(t,e)=>{YR._interactionTriggers[t]=e},YR._composedEventMap={},YR.registerComposedEvent=(t,e)=>{YR._composedEventMap[t]=e},YR._tooltipProcessors={},YR.registerTooltipProcessor=(t,e)=>{YR._tooltipProcessors[t]=e},YR.createTooltipProcessor=(t,e)=>{const i=YR._tooltipProcessors[t];return i?new i(e):null};const KR=t=>{const e={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"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},qR=KR(),ZR={[NR.name]:NR},JR=NR.name,QR=new Map(Object.keys(ZR).map((t=>[t,ZR[t]]))),tO=new Map,eO=new Map(Object.keys(ZR).map((t=>[t,t===JR]))),iO=(t,e)=>{if(!t)return;const i=aO(e);QR.set(t,i),eO.set(t,!0)},sO=(t=JR)=>(eO.has(t)&&!eO.get(t)&&iO(t,QR.get(t)),QR.get(t)),nO=t=>QR.delete(t)&&tO.delete(t)&&eO.delete(t),rO=t=>!!_(t)&&QR.has(t),aO=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:JR;return $R({},sO(i),t)};class oO{static registerInstance(t){oO.instances.set(t.id,t)}static unregisterInstance(t){oO.instances.delete(t.id)}static getInstance(t){return oO.instances.get(t)}static instanceExist(t){return oO.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return oO.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}oO.instances=new Map;class lO{static registerTheme(t,e){iO(t,e)}static getTheme(t,e=!1){return sO(t)}static removeTheme(t){return nO(t)}static themeExist(t){return rO(t)}static getDefaultTheme(){return lO.themes.get(JR)}static setCurrentTheme(t){lO.themeExist(t)&&(lO._currentThemeName=t,oO.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return lO.getTheme(lO._currentThemeName,t)}static getCurrentThemeName(){return lO._currentThemeName}}function hO(t){return _(t)?lO.themeExist(t)?lO.getTheme(t):{}:g(t)?t:{}}lO.themes=QR,lO._currentThemeName=JR;const cO=["animationThreshold","colorScheme","name","padding"];function dO(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];cO.includes(n)?s[n]=r:m(r)?yR(r)?s[n]=_R(r,e):HR(r)?s[n]=jR(i,r):s[n]=dO(r,e,i):s[n]=r})),s}function uO(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]=uO(t[s],e)}return i}return y(t)?t.map((t=>uO(t,e))):t}function pO(t,e){if(!t)return t;if(m(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]=pO(t[s],e)}return i}return y(t)?t.map((t=>pO(t,e))):t}function gO(t,...e){return d(t)?t(...e):t}const fO=(t,e,i,s)=>((t,e,i)=>LM(t,e,i,{fontFamily:VR.fontFamily,fontSize:VR.fontSize}))(e,i,s).measure(t),mO="__VCHART",vO=500,_O=500,yO=`${mO}_MEASURE_CANVAS_ID`,bO=`${mO}_DEFAULT_DATA_INDEX`,xO=`${mO}_DEFAULT_DATA_KEY`,SO=`${mO}_DEFAULT_DATA_SERIES_FIELD`,AO=`${mO}_DEFAULT_SERIES_STYLE_NAME`,kO=`${mO}_STACK_KEY`,MO=`${mO}_STACK_START`,TO=`${mO}_STACK_END`,wO=`${mO}_STACK_START_PERCENT`,CO=`${mO}_STACK_END_PERCENT`,EO=`${mO}_STACK_START_OffsetSilhouette`,BO=`${mO}_STACK_END_OffsetSilhouette`,PO=`${mO}_STACK_TOTAL`,LO=`${mO}_STACK_TOTAL_PERCENT`,RO=`${mO}_STACK_TOTAL_TOP`,OO=`${mO}_STACK_TOTAL_BOTTOM`,IO=`${mO}_MOSAIC_VALUE_START_PERCENT`,DO=`${mO}_MOSAIC_VALUE_END_PERCENT`,FO=`${mO}_MOSAIC_CAT_START_PERCENT`,zO=`${mO}_MOSAIC_CAT_END_PERCENT`,jO=`${mO}_SEGMENT_START`,HO=`${mO}_SEGMENT_END`,VO=`${mO}_KEY`,NO=`${mO}_MAP_LOOK_UP_KEY`;function UO(t,e){for(let i=0;it.key===e))}function GO(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 YO(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:{groupField:a.groupField,nodes:{}},ZO(t,a,n[o],l,e,r))})),s?$O(n):n}function $O(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))):$O(t[e].nodes);return t}function XO(t,e){if("values"in t&&t.values.length){const i=JL(t.values,e),s=ZL(t.values,CO);t.values.forEach((t=>{t[PO]=i,t[LO]=s}))}else for(const i in t.nodes)XO(t.nodes[i],e)}function KO(t){if(!t.values.length)return;const e=t.values[t.values.length-1][TO]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)qO(t.nodes[r],e,i,s,n)}function ZO(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[TO]=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 l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),ZO(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const JO=(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]=tI(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function eI(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>nI(t.style(e,i,s,n)):P(t.style)||(e.style=nI(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>nI(t.state[e](i,s,n,r)):P(t.state[e])||(i[e]=nI(t.state[e]))})),e.state=i}return e}function iI(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>nI(t[i](e,s,n,r)):P(t[i])||(e[i]=nI(t[i]))})),e}function sI(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),nI(i)}function nI(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:oe(t.angle)}):t}const rI=t=>"line"===t||"area"===t,aI=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return rI(i)?e:null==e?void 0:e[0]},oI=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let lI=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},n=YR.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{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(YR.getComposedEvent(t))if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};var hI;!function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(hI||(hI={}));const cI=["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 dI,uI,pI;t.ChartEvent=void 0,(dI=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",dI.rendered="rendered",dI.renderFinished="renderFinished",dI.animationFinished="animationFinished",dI.regionSeriesDataFilterOver="regionSeriesDataFilterOver",dI.afterInitData="afterInitData",dI.afterInitEvent="afterInitEvent",dI.afterInitMark="afterInitMark",dI.rawDataUpdate="rawDataUpdate",dI.viewDataFilterOver="viewDataFilterOver",dI.viewDataUpdate="viewDataUpdate",dI.viewDataStatisticsUpdate="viewDataStatisticsUpdate",dI.markDeltaYUpdate="markDeltaYUpdate",dI.viewDataLabelUpdate="viewDataLabelUpdate",dI.scaleDomainUpdate="scaleDomainUpdate",dI.scaleRawDomainUpdate="scaleRawDomainUpdate",dI.scaleUpdate="scaleUpdate",dI.dataZoomChange="dataZoomChange",dI.drill="drill",dI.layoutStart="layoutStart",dI.layoutEnd="layoutEnd",dI.layoutRectUpdate="layoutRectUpdate",dI.playerPlay="playerPlay",dI.playerPause="playerPause",dI.playerEnd="playerEnd",dI.playerChange="playerChange",dI.playerForward="playerForward",dI.playerBackward="playerBackward",dI.scrollBarChange="scrollBarChange",dI.brushStart="brushStart",dI.brushChange="brushChange",dI.brushEnd="brushEnd",dI.brushClear="brushClear",dI.brushActive="brushActive",dI.legendSelectedDataChange="legendSelectedDataChange",dI.legendFilter="legendFilter",dI.legendItemClick="legendItemClick",dI.legendItemHover="legendItemHover",dI.legendItemUnHover="legendItemUnHover",dI.tooltipShow="tooltipShow",dI.tooltipHide="tooltipHide",dI.tooltipRelease="tooltipRelease",dI.afterResize="afterResize",dI.afterRender="afterRender",dI.afterLayout="afterLayout",dI.afterMarkLayoutEnd="afterMarkLayoutEnd",dI.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(uI||(uI={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(pI||(pI={}));const gI=[pI.mark,pI.model,pI.chart,pI.vchart];class fI{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(pI.vchart,[]),this._levelNodes.set(pI.chart,[]),this._levelNodes.set(pI.model,[]),this._levelNodes.set(pI.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const mI={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"};class vI{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=L(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>aI(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||uI.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||uI.chart);o.get(t)||o.set(t,new fI);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||uI.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||uI.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||uI.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||uI.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?gI.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[uI.chart,uI.window,uI.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.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&&L(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 mI[a]&&(a=mI[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)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?pI.model:pI.vchart:pI.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=At(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=St(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=uI.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==pI.model&&s!==pI.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=pI.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case uI.chart:return this._viewBubbles;case uI.window:return this._windowBubbles;case uI.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case uI.chart:return this._viewListeners;case uI.window:return this._windowListeners;case uI.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return cI.includes(t)||Object.values(hI).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&YR.hasInteractionTrigger(e)}}function _I(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function yI(t,e,i){t.getParser(e)||t.registerParser(e,i)}const bI=new Map;let xI;function SI(){xI||(xI=new Ba,yI(xI,"geojson",ka),yI(xI,"topojson",Ta),_I(xI,"simplify",Gr))}function AI(t,e,i={type:"geojson",centroid:!0}){bI.has(t)&&Vy(`map type of '${t}' already exists, will be overwritten.`),SI();const s=new Pa(xI),n=j({},{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}),bI.set(t,s)}function kI(t){bI.has(t)?bI.delete(t):Vy(`map type of '${t}' does not exists.`)}function MI(t,e=!1){let i=e;return t.latestData instanceof Pa&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const TI=(t,e)=>0===t.length?[]:1===t.length?MI(t[0],null==e?void 0:e.deep):t.map((t=>MI(t,null==e?void 0:e.deep)));function wI(e,i,s){_I(i=i instanceof Ba?i:e.dataSet,"copyDataView",TI);const n=new Pa(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function CI(t,e,i=[]){var s;if(t instanceof Pa)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new Pa(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return Vy(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return Vy(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!_(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),Vy("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function EI(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var BI,PI,LI,RI;t.TransformLevel=void 0,(BI=t.TransformLevel||(t.TransformLevel={}))[BI.copyDataView=-10]="copyDataView",BI[BI.treemapFilter=-8]="treemapFilter",BI[BI.treemapFlatten=-7]="treemapFlatten",BI[BI.dotObjFlat=-7]="dotObjFlat",BI[BI.linkDotInfo=-7]="linkDotInfo",BI[BI.sankeyLayout=-7]="sankeyLayout",BI[BI.dataZoomFilter=-6]="dataZoomFilter",BI[BI.legendFilter=-5]="legendFilter",function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(PI||(PI={})),function(t){t.data="data",t.mark="mark"}(LI||(LI={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(RI||(RI={}));const OI=["line","area","trail"];function II(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(VO,i?t.slice().sort(i):t.slice()),{keys:[VO],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const DI=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function FI(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{FI(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function jI(t,e,i,s){const n=II(t,(t=>i(t))),r=II(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!u(t)){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}}const HI=`${mO}_BuiltIn_CallBack_Disappear`;var VI;!function(t){t.render="render",t.disappear="disappear"}(VI||(VI={}));class NI{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(e,i){this._count=0,this._rootMarks=[],this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{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._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var e,i,s,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:u,background:f}=this._option;k_.setEnv(function(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}(o),null!=l?l:{}),this._stage=null!==(e=this._option.stage)&&void 0!==e?e:new z_(Object.assign({background:f,width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,canvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:u},ReactDOM:this._option.ReactDOM,autoRefresh:p(r)?r:!p(a)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{})),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const m=Rp({x:0,y:0,width:this._width,height:this._height});m.name="root",this._stage.defaultLayer.appendChild(m),this._rootGroup=m;const v=(p(h)?h:$y(o))&&!1!==c&&YR.getStageEventPlugin("gesture");v&&(this._gestureController=new v(this._stage,g(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=RI.before}_setCanvasStyle(){if(this._stage&&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")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(k_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=k_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>FI(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>FI(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{FI(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;this._hasCommitedMark()&&(Hy(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),this._rootMarks.forEach((t=>{t.render()})),this._layoutState===RI.before&&(this._layoutState=RI.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=RI.reevaluate,this._hasCommitedMark()&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),this.findProgressiveMarks(),this.updateStateAnimation(),this._doRender(!0),this.doPreProgressive(),Hy(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=zI(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=jI(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=jI(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=II(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=II(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}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];y(s)?e[i]="disappear"===i?s.map((t=>{return"function"==typeof(e=t.callBack)&&/^class\s/.test(e.toString())?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:HI,customParameters:{callBack:t.callBack}});var e})):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{FI(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===PI.appear))?PI.appear:e.every((t=>t===PI.disappear))?PI.disappear:PI.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===uI.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=e;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=i.parent,i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:aI(o),markId:h,modelId:c,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===uI.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===uI.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===uI.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===uI.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===uI.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this.releaseGrammar(!0),this._stage!==(null===(t=this._option)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{FI(t,(t=>{t.removeProduct()}),null,!0)})):this._cachedMarks=zI(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return Yy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&function(t){return Su(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Ao.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()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{FI(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=k_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){k_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function UI(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:Ny)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function WI(t){t.crosshair=Y(t.crosshair||{}).map((e=>GR({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function GI(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}=oi(l,i.width,i.height);a=t,o=e}else if(h&&Yy(e.mode)){let t;t=_(h)?k_.getElementById(h):h;const{width:e,height:s}=oi(t,i.width,i.height);a=e,o=s}else if(Xy(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 YI(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function $I(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}}var XI,KI,qI,ZI,JI,QI;t.LayoutZIndex=void 0,(XI=t.LayoutZIndex||(t.LayoutZIndex={}))[XI.SeriesGroup=0]="SeriesGroup",XI[XI.Axis_Grid=50]="Axis_Grid",XI[XI.CrossHair_Grid=100]="CrossHair_Grid",XI[XI.Region=450]="Region",XI[XI.Mark=300]="Mark",XI[XI.Node=400]="Node",XI[XI.Axis=100]="Axis",XI[XI.MarkLine=500]="MarkLine",XI[XI.MarkArea=100]="MarkArea",XI[XI.MarkPoint=500]="MarkPoint",XI[XI.DataZoom=500]="DataZoom",XI[XI.ScrollBar=500]="ScrollBar",XI[XI.Player=500]="Player",XI[XI.Legend=500]="Legend",XI[XI.CrossHair=500]="CrossHair",XI[XI.Indicator=500]="Indicator",XI[XI.Title=500]="Title",XI[XI.Label=500]="Label",XI[XI.Brush=500]="Brush",XI[XI.CustomMark=500]="CustomMark",XI[XI.Interaction=700]="Interaction",t.LayoutLevel=void 0,(KI=t.LayoutLevel||(t.LayoutLevel={}))[KI.Indicator=10]="Indicator",KI[KI.Region=20]="Region",KI[KI.Axis=30]="Axis",KI[KI.DataZoom=40]="DataZoom",KI[KI.Player=40]="Player",KI[KI.ScrollBar=40]="ScrollBar",KI[KI.Legend=50]="Legend",KI[KI.Title=70]="Title",KI[KI.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(qI=t.AttributeLevel||(t.AttributeLevel={}))[qI.Default=0]="Default",qI[qI.Theme=1]="Theme",qI[qI.Chart=2]="Chart",qI[qI.Base_Series=3]="Base_Series",qI[qI.Series=4]="Series",qI[qI.Mark=5]="Mark",qI[qI.User_Chart=6]="User_Chart",qI[qI.User_Series=7]="User_Series",qI[qI.User_Mark=8]="User_Mark",qI[qI.User_SeriesStyle=9]="User_SeriesStyle",qI[qI.Built_In=99]="Built_In";class tD{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({},tD.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]))))}}tD.defaultMarkInfo={};class eD{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class iD{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=>GR({},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 sD extends eD{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}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=iD,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new tD,this._lastLayoutRect=null,this.id=qy(),this.userId=t.id,this._spec=t,this.effect={},this.event=new lI(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){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}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){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_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){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${mO}_${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,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=YR.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_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 L(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}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class nD{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}get lastComputeRect(){return this._lastComputeRect}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}get willLayoutTag(){return this._willLayoutTag}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._willLayoutTag=!0,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){let a=RR(IR(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),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:LR(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:LR(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:LR(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:LR(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:LR(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:LR(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=LR(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=LR(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){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_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]=LR(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(OR(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class rD extends sD{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,this._transformLayoutPadding=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 nD(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&U(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.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,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 aD extends iD{_initTheme(t,e){return{spec:t,theme:this._theme}}}class oD extends rD{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=aD,this.modelType="region",this.specKey="region",this.type=oD.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,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"}_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,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[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.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex: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()}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,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(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})}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=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function lD(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 hD(t,e,i){e?t.forEach((t=>{const e=$(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=$(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 cD(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 dD(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=fD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),cD(d,!0,p,l),s&&hD(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function uD(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=fD(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=fD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),cD(d,!1,p,o),s&&hD(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function gD(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=fD(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_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){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_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,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=fD(t,this,e);"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,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=lD(t);n.length&&dD(n,e,i,!1,"left",s),r.length&&dD(r,e,i,!0,"left",s),a.length&&uD(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=lD(t);n.length&&pD(n,e,i,!1,"top",s),r.length&&pD(r,e,i,!0,"top",s),a.length&&gD(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=lD(t);n.length&&dD(n,e,i,!1,"right",s),r.length&&dD(r,e,i,!0,"right",s),a.length&&uD(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=lD(t);n.length&&pD(n,e,i,!1,"bottom",s),r.length&&pD(r,e,i,!0,"bottom",s),a.length&&gD(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=fD(t,this,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=>{U(i.getLayoutRect(),e.rect)||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{rect:i}=fD(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);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+c-l})}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+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&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:Ny)("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}}}mD.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(ZI||(ZI={})),t.STATE_VALUE_ENUM=void 0,(JI=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",JI.STATE_HOVER="hover",JI.STATE_HOVER_REVERSE="hover_reverse",JI.STATE_DIMENSION_HOVER="dimension_hover",JI.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",JI.STATE_SELECTED="selected",JI.STATE_SELECTED_REVERSE="selected_reverse",JI.STATE_SANKEY_EMPHASIS="selected",JI.STATE_SANKEY_EMPHASIS_REVERSE="blur",JI.STATE_HIGHLIGHT="highlight",JI.STATE_BLUR="blur",JI.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(QI||(QI={}));const vD=["linear","radial","conical"],_D={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const yD={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{yD[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class bD extends eD{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(j(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class xD extends bD{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:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||(t=this._mark.type,OI.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!yD[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(y(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(mO)));i=t.datums.some((t=>e&&y(null==t?void 0:t.items)?n.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])})):n.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(mO))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(VC(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class SD extends eD{constructor(){super(...arguments),this.id=qy(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=YR.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class AD extends SD{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}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._data=null,this._data=e}removeProduct(){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const kD=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,MD=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=kD(l.delay,n,a,o),d=kD(l.duration,n,a,o),u=kD(l.oneByOne,n,a,o),p=kD(l.splitPath,n,a,o),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)?Nw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Uw)(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);zw(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{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)?Nw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Uw)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Ow(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Dw(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:qo.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 Fw({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Ew,null!==(l=i.easing)&&void 0!==l?l:Bw))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:qo.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new jw({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Ew,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Bw))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):zw(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},TD=(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))))},wD=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}};class CD extends SD{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}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){u(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];y(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new AD(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}u(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=Rp("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){u(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(){this._product&&this._product.parent&&this._product.parent.removeChild(this._product),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Wl)),i&&(d(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==ZI.enter&&t.context.diffState!==ZI.update||(t.stateProxy=(e,i)=>{var s;return this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)},t.context.states&&t.useStates(t.context.states,e))},this.name=e,this.model=i.model,this.key=i.key,this.state=new xD(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_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,oe)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];u(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}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){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[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"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&GR(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(NC(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=MR(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),e.clamp&&t.clamp&&t.clamp(e.clamp))}(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=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):vD.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):NC(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=d(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_computeGradientAttr(t){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=t,c=e(t,["gradient","scale","field"]);let u=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(u=t),g||(g=e)}const f=mR(fR(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},_D[o]),c);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==u?void 0:u.scale(t[g]);return d(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=ii.SetOpacity(a,s)),{offset:d(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):d(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];d(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)vD.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=mR(fR(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return II(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return YR.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=d(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[xO],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=II(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===PI.appear))?PI.appear:t.every((t=>t===PI.disappear))?PI.disappear:t[0];return null!=e?e:PI.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{wD(t),s.push(...t.getGraphics())})),e.forEach((t=>{wD(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);MD([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=TD(e,n),r=TD(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===PI.exit?PI.exit:i===PI.update?PI.update:PI.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===ZI.exit&&(t.context.reusing=!0,t.animates&&t.animates.forEach((t=>t.stop())))}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===ZI.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,d,p,g;let f,m;return u(e)?(f=this._graphicMap.get(t),f&&(m=ZI.exit)):u(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=ZI.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=ZI.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(d=f.context)||void 0===d?void 0:d.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=PI.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=PI.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return DI(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=DI(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(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))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach(((t,e)=>{var i,n;let r=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i.update,t);null===(n=t.currentStates)||void 0===n||n.forEach((e=>{var i;const s=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i[e],t);r=Object.assign(Object.assign({},r),s)})),u(this._markConfig.interactive)||(r.pickable=this._markConfig.interactive);const a=this._transformGraphicAttributes(t,r,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=a}))}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r,a;const o=i.context.finalAttrs,l=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=oI(i,o);i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes({}),i.context.reusing=!1):l||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),!(null===(a=this.renderContext)||void 0===a?void 0:a.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i),e&&i.setFinalAttributes(o)}else{const a=i;i=this._createGraphic(o),e&&(null===(n=i.setFinalAttributes)||void 0===n||n.call(i,o)),i.context=a.context,i.context.diffAttrs=o,i.stateSort=this._stateSort;const l=this._graphics===t?s:s+this._graphics.length-t.length;if(l>=0&&(this._graphics[l]=i),null===(r=this.renderContext)||void 0===r?void 0:r.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,l),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(u(e)||(t.zIndex=e),u(i)||(t.clip=i),!u(s)){const e=y(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return u(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=YR.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=YR.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=Y(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===RI.before||(this._product||this._initProduct(),Hy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{"in"===this.state.checkOneState(i,i.context.data,e)?i.addState(t,!0,this.hasAnimationByState("state")):i.removeState(t,this.hasAnimationByState("state"))}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===ZI.exit&&!e.isExiting)if(e.context.animationState===ZI.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:ZI.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=Rp({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{t.clearStates()}))}}var ED;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(ED||(ED={}));class BD extends CD{constructor(){super(...arguments),this.type=BD.type,this._marks=[],this._diffState=ZI.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(Vy("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?(Vy("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))}getMarkInUserId(t){let e;return FI(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.diffState===ZI.update){const t=this.hasAnimation(),e=oI(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e)),t&&this._product.setFinalAttributes(i)}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=ZI.update}render(){this._isCommited&&(Hy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct()}}BD.type="group";const PD={measureText:fO};class LD{static instance(){return LD.instance_||(LD.instance_=new LD),LD.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 RD{constructor(){this.id=qy(),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))?Vy("不要重复添加相同的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 OD extends RD{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)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const ID={type:"fadeIn"};function DD(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 ID;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const FD={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"},state:{duration:300,easing:"linear"}},zD={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},jD={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},HD=()=>{YR.registerAnimation("scaleInOut",(()=>zD))},VD=()=>{YR.registerAnimation("fadeInOut",(()=>jD))},ND=(t,e)=>({appear:DD(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:$w,duration:FD.update.duration,easing:FD.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),UD=()=>{YR.registerAnimation("line",ND)},WD=()=>{pw.registerBuiltInAnimate("growPointsIn",hC),pw.registerBuiltInAnimate("growPointsOut",cC),pw.registerBuiltInAnimate("growPointsXIn",uC),pw.registerBuiltInAnimate("growPointsXOut",pC),pw.registerBuiltInAnimate("growPointsYIn",fC),pw.registerBuiltInAnimate("growPointsYOut",mC),pw.registerBuiltInAnimate("clipIn",qw),pw.registerBuiltInAnimate("clipOut",Zw)},GD=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class YD{constructor(t){this._markSet=new tD,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){y(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.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 $D={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class XD extends YD{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},$D,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}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}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll(e)}}XD.type="element-highlight",XD.defaultOptions=$D;const KD=()=>{YR.registerInteractionTrigger(XD.type,XD)},qD={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class ZD extends YD{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},qD,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}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,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),t.addState(i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll(e)}}ZD.type="element-select",ZD.defaultOptions=qD;const JD=()=>{YR.registerInteractionTrigger(ZD.type,ZD)};class QD extends RD{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class tF{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>YR.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>YR.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>YR.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return YR.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>YR.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){YR.registerTransform(t,e)}static registerFunction(t,e){t&&e&&LD.instance().registerFunction(t,e)}static unregisterFunction(t){t&&LD.instance().unregisterFunction(t)}static getFunction(t){return t?LD.instance().getFunction(t):null}static getFunctionList(){return LD.instance().getFunctionNameList()}static registerMap(t,e,i){const s=YR.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=YR.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,bI.get(e);var e}static registerSVG(t,e,i){const s=YR.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=YR.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){oO.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 ot.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d,u;this.id=qy(),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._renderState=VI.render,this._disableDimensionHoverEvent=!1,this._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))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;U(n.theme,this._spec.theme)?U(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=YI(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?YR.getSeriesBuiltInTheme(e):YR.getComponentBuiltInTheme(e);i=i?GR({},s,i[e]):s}s===t.length-1&&p(i)&&(i=dO({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},lR(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:y,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=Yy(v);if(S?ax(xo):"node"===v&&oA(xo),S&&f&&(this._container=_(f)?k_.getElementById(f):f),m&&(this._canvas=m),y&&(this._stage=y),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=lO.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[];!1!==b&&A.push("poptipForText"),"sankey"===i.type&&A.push("scrollbar");const k=new ot(null!==(a=this._option.logLevel)&&void 0!==a?a:at.Error);ot.setInstance(k),(null===(o=this._option)||void 0===o?void 0:o.onError)&&k.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._compiler=new NI({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:y,pluginList:A},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new vI(this,this._compiler),this._event=new lI(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),oO.registerInstance(this),null===(u=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===u||u.call(d,this)}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=GR({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=uO(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;tF.getFunctionList()&&tF.getFunctionList().length&&(t=pO(t,tF)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=YR.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=YR.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=YR.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._chartSpecTransformer),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)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=At(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.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 GI(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:vO,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:_O})}_initDataSet(t){this._dataSet=t instanceof Ba?t:new Ba,yI(this._dataSet,"dataview",wa),yI(this._dataSet,"array",s),_I(this._dataSet,"copyDataView",TI);for(const t in YR.transforms)_I(this._dataSet,t,YR.transforms[t]);for(const t in YR.dataParser)yI(this._dataSet,t,YR.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake?(null===(n=this._compiler)||void 0===n||n.releaseGrammar(),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.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.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),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),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(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"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?PI.none:PI.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}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._cachedProcessedTheme=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,oO.unregisterInstance(this)}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):y(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._reSetRenderState(),u(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof Pa?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=CI(t,this._dataSet,s);y(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?GR({},t[n][e.index],i):i):t[n]=s?GR({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?GR({},t[n][r],i):i)}else t.id===e&&(t[n]=s?GR({},t[n],i):i)}))}(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=GR({},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),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,this),!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)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=$R({},e,e.chart[t])),e};let l;if(P(n)&&P(r))l=hO(this._currentThemeName),this._currentTheme=o(a,l);else{const t=$R({},hO(g(r)&&r.type?r.type:g(n)&&n.type?n.type:this._currentThemeName),hO(n),hO(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),j(GM.poptip,WM,h),null===(s=this._compiler)||void 0===s||s.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=!!Yy(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return hO(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!lO.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),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}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield UI(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(!Yy(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;this._chart.resetLayoutItemTag(),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)?k_.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)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(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?DR(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||P(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 Vy("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?DR(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Vy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return LD.instance().getFunction(t)}registerFunction(t,e){t&&e&&LD.instance().registerFunction(t,e)}unregisterFunction(t){t&&LD.instance().unregisterFunction(t)}getFunctionList(){return LD.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=YR.getChartPlugins();t.length>0&&(this._chartPlugin=new OD(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=YR.getVChartPlugins();e.length>0&&(this._vChartPlugin=new QD(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_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,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=VI.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){this._renderState=VI.render,this.getStage().eventSystem.resumeTriggerEvent()}}tF.InstanceManager=oO,tF.ThemeManager=lO,tF.globalConfig={uniqueTooltip:!0},tF.Utils=PD,tF.vglobal=k_;YR.registerRegion("region",oD),YR.registerLayout("base",mD),Jk(),zk(),YR.registerMark(BD.type,BD),YR.registerStageEventPlugin("gesture",Eb),KD(),JD(),iO(UR.name,UR);const eF="monotone",iF="linear",sF="bevel";function nF(t,e){return e("component",t)}function rF(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=YR.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));const aF=(t,e,i,s)=>{if(u(t[e]))return;const n=y(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},oF=(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)))},lF=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},hF=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):m(t)&&p(t.field)?L(e,t.field):t,s){const{formatFunc:i,args:r}=rF(void 0,s,t,e);i&&r&&(n=i(...r))}return n},cF=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const dF=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(y(e.activeType)?e.activeType.includes(t):e.activeType===t)));function uF(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=u(i.key)&&u(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:d,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:_}=l,y=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=gF(hF(h,r,a,c),d,g),o.value=gF(hF(f,r,a,m),v,_),Object.keys(y).forEach((t=>{o[t]=hF(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};y(i)?i.forEach((t=>{o(t)})):o(i)}function pF(t,e,i,s,n,r,a){if(d(e)){uF(t,e(n,a),i,s,r,a)}else e&&uF(t,e,i,s,r,a)}const gF=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=mi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class fF{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},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.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{y(t)?t.forEach((t=>{pF(a,t,e,i,s,n,r)})):d(t)?pF(a,t,e,i,s,n,r):t&&uF(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=d(e)?e(s,n):e;if(r?u(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){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}(s),e={visible:hF(r.visible,t,n),value:gF(hF(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:hF(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=hF(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&dF(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const mF={min:t=>t.length?K(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?K(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}},vF=(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=UO([],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 _F(a,n,o)},_F=(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&&t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{Zy(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=>{Zy(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&&!0===o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=mF[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},yF=(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=>{Zy(t[e])||(t[e]=0)}))})),t},bF=`${mO}_HIERARCHY_DEPTH`,xF=`${mO}_HIERARCHY_ROOT`,SF=`${mO}_HIERARCHY_ROOT_INDEX`;function AF(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function kF(t,e,i){t&&(i.needDefaultSeriesField&&(t[SO]=i.defaultSeriesField),t[bO]=e,t[xO]=i.getKey(t,e,i))}function MF(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function TF(t,e,i,s=0,n,r){void 0===r&&(r=e),kF(t,e,i),t[bF]=s,t[xF]=n||t[i.categoryField],t[SF]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>TF(e,s,i,t[bF]+1,t[xF],r)))}const wF={label:{name:"label",type:"text"}},CF=`${mO}_rect_x`,EF=`${mO}_rect_x1`,BF=`${mO}_rect_y`,PF=`${mO}_rect_y1`,LF={data:!0},RF={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},OF=[...Object.keys(FD),"normal"];function IF(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 HF(n)&&delete n.type,n.oneByOne&&(n=FF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:zF,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=GR({},o[e],a);return HF(n)&&delete n.type,n.oneByOne&&(n=FF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:zF,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function DF(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=I(t,null,i),VF(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}),i),t}(h,i)}function FF(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.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function zF(t,e){var i;return null!==(i=null==t?void 0:t[bO])&&void 0!==i?i:e.context.graphicIndex}function jF(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 HF(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function VF(t,e,i=[]){if(y(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),VF(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),VF(t[s],e,i))}function NF(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class UF extends iD{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=uR(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=YR.getSeriesMarkMap(o)?function(t,e,i){const s=YR.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=GR({},i("mark",Y(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return GR({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;Y(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(d(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,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=GR({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>GR({},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 WF extends sD{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)}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:`${mO}_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(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=UF,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=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.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=NF(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),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)&&(_I(this._rawData.dataSet,"invalidTravel",yF),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;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=CI(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=wI(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=wI(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new AD(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=K(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=_F(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=j(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){_I(this._dataSet,"dimensionStatistics",vF);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new Pa(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&&UO(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){_I(this._dataSet,"dimensionStatistics",vF);const s=new Pa(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=UO(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&UO(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new Pa(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)&&(_I(this._rawData.dataSet,"addVChartProperty",lF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:AF.bind(this),call:kF}},!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,i;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.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(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:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=IF({},DF(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)}))),!u(t.dataId)||!u(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(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:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_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"}}:$y(s)||Xy(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=GR(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=GR(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=GD(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=GD(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=GD(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:SO;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:AO,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,AO,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.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()}initTooltip(){this._tooltipHelper=new fF(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||e.visible!==t[i].visible))?i.reMake=!0:!i.reCompile&&e.some(((e,i)=>!U(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!U(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},LF),RF),i),{extensionMark:!0,label:!0,totalLabel:!0});return this._compareExtensionMarksSpec(Y(t.extensionMark),Y(e.extensionMark),s),!s.reMake&&this._compareLabelSpec(Y(t.label),Y(e.label),s),!s.reMake&&this._compareLabelSpec(Y(t.totalLabel),Y(e.totalLabel),s),s.reMake?s:(!s.reCompile&&this._marks.getMarks().some((i=>{var s,n;return r[i.name]=!0,(null===(s=e[i.name])||void 0===s?void 0:s.visible)!==(null===(n=t[i.name])||void 0===n?void 0:n.visible)}))&&(s.reCompile=!0),!s.reCompile&&n.some((i=>RF[i]&&!U(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!U(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Pa||EI(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();NF(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),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:SO,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new AR).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return fR(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:SO}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:d={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:_=!1}=e,y=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:_,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(y)){const e=this.getSpec()||{};this._marks.addMark(y,{name:t.name}),v&&(this._seriesMark=y),u(f)?y.setData(this._data):!1!==f&&y.setDataView(f),y.setSkipBeforeLayouted(!1!==c),u(h)||y.setGroupKey(h);const l=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:null!==(s=i.morph)&&void 0!==s&&s,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(n=i.support3d)&&void 0!==n?n:e.support3d||!!e.zField,morphKey:(null===(r=e.morph)||void 0===r?void 0:r.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});y.setMarkConfig(l),this.initMarkStyleWithSpec(y,GR({},d,g||e[y.name]))}return y}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:xO}_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!==TO&&t!==CO&&t!==MO&&t!==wO||(t=this.getStackValueField()),null!==(e=GO(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>Zy(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:SO]}}function GF(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();VC(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 YF(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}}}WF.mark=wF,WF.transformerConstructor=UF;class $F extends WF{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);VC(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:`${mO}_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(TO),this.setFieldX2(MO)):(this.setFieldY(TO),this.setFieldY2(MO))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(CO),this.setFieldX2(wO)):(this.setFieldY(CO),this.setFieldY2(wO))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(BO),this.setFieldX2(EO)):(this.setFieldY(BO),this.setFieldY2(EO))}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)&&(GF("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)}}function XF(t){return"bottom"===t||"top"===t}function KF(t){return"left"===t||"right"===t}function qF(t){return"z"===t}function ZF(t,e){return ER(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function JF(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function QF(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?XF(t)?"linear":"band":XF(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const tz=(t,e,i)=>{var s;const n=null!==(s="band"===e?nF("axisBand",i):["linear","log","symlog"].includes(e)?nF("axisLinear",i):{})&&void 0!==s?s:{},r=XF(t)?nF("axisX",i):KF(t)?nF("axisY",i):nF("axisZ",i);return GR({},nF("axis",i),n,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:Ny)("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:Ny)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;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)))),r=n.filter((t=>UC(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return XF(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class iz 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(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:uI.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const sz=(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))},nz=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},rz=(t,e,i,s)=>{var n;const r=e.getScale(),a=UC(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=Y(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.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))})),o.push({series:h,datum:e,key:az(h,s)})}else if(p(i[1])){const e=[],s=[];l.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 r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{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("_")}`,oz=(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};class lz extends ez{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!sz(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:uI.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:uI.canvas}),callback:this.onMouseOut}),$y(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:uI.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),$y(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var hz;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(hz||(hz={}));const cz={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class dz{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",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.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(cz.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),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:sF,curveType:iF,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===eF?"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){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(cz.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:jF(this._spec,cz.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new Pa(this._option.dataSet,{name:`${mO}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),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(hz.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[cz.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(hz.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,GR({},this._spec[cz.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.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=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},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.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const uz=Object.assign(Object.assign({},wF),cz),pz=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(y(t))return t.length===e.length&&t.every(((t,i)=>pz(t,e[i])));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]))},gz=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class fz extends CD{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return gz}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(u(o)||s.includes(a))return;r&&n.includes(a)&&(NC(null==o?void 0:o.type)||(null==o?void 0:o.scale)||d(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((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?pz(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n,r;const a=e.context.data,o=[],l=[],h={},c=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,d=c&&0===c.currentIndex;if(a.forEach(((e,i)=>{var s;l[i]={},o[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?l[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!c?o[i][s]=t[s](e):0!==i||c&&!d||(h[s]=t[s](e))})),l[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),c){const t=null!==(r=null===(n=e.attribute)||void 0===n?void 0:n.segments)&&void 0!==r?r:[];return t.push({points:l}),d?Object.assign(Object.assign({},h),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(o,l);if(t)return Object.assign(Object.assign(Object.assign({},h),o[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},h),o[0]),{points:l,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:ZI.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[xO]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}class mz extends fz{constructor(){super(...arguments),this.type=mz.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)===cR.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}mz.type="line";const vz=()=>{YR.registerMark(mz.type,mz),Jk(),Nk(),EB(),kB(),WD(),YR.registerGraphicComponent("line",Lg)};class _z extends CD{constructor(){super(...arguments),this.type=_z.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="circle":a.symbolType=o,a}}_z.type="symbol";const yz=()=>{YR.registerMark(_z.type,_z),Jk(),tM(),kB(),YR.registerGraphicComponent("symbol",Eg)};class bz extends UF{_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)}}function xz(t){return t.length>=2&&k(t[0])&&k($(t))&&$(t)>=t[0]}function Sz(t,e){var i;const s=$(e)-e[0],n=$(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=$(e)>0?$(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!k(o.min),extendable_max:!k(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):$(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function Az(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 kz(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 Mz(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 Tz(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 wz=(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=>t.type.includes("ticks"))))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)-p[0];if(0===g)return t;const f=c.domain(),m=$(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=ne(t,e),a=Math.max(ie(i),ie(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return IC(v)};class Cz{constructor(t){this.id=qy(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class Ez extends Cz{constructor(){super(Ez.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!VC(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&&xz(c)&&xz(d)))return;const u=Sz(t,c),p=Sz(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!kz(u,p))return}else if(0===y&&0===b){if(!kz(p,u))return}else if(_||A)if(_&&!A){if(!Az(u,p))return}else if(A&&!_){if(!Az(p,u))return}else{if(f===b)return;if(f>b){if(!Mz(u,p))return}else if(!Mz(p,u))return}else{if(0===f&&0===y){if(!Tz(u,p))return}else if(0===b&&0===g&&!Tz(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===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){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){_I(e.getOption().dataSet,"tickAlign",wz);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}Ez.pluginType="component",Ez.type="AxisSyncPlugin";const Bz={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function Pz(t){let e=0;return L(t,"tick.visible")&&(e+=L(t,"tick.tickSize")),L(t,"label.visible")&&(e+=L(t,"label.space")),e}function Lz(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 Rz(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const Oz=t=>"band"===t||"ordinal"===t||"point"===t;function Iz(t,e){return{id:t,label:t,value:e,rawValue:t}}function Dz(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class Fz extends RD{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const zz=`${mO}_ARC_TRANSFORM_VALUE`,jz=`${mO}_ARC_RATIO`,Hz=`${mO}_ARC_START_ANGLE`,Vz=`${mO}_ARC_END_ANGLE`,Nz=`${mO}_ARC_K`,Uz=`${mO}_ARC_MIDDLE_ANGLE`,Wz=`${mO}_ARC_QUADRANT`,Gz=`${mO}_ARC_RADIAN`,Yz=-Math.PI/2,$z=3*Math.PI/2,Xz=.6,Kz=(t,e,i,s)=>{const n=t();if(S(n))return n;if(d(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return ge(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},qz=(t,e,i)=>{var s;const n=null!==(s="band"===e?nF("axisBand",i):"linear"===e?nF("axisLinear",i):{})&&void 0!==s?s:{},r=nF("angle"===t?"axisAngle":"axisRadius",i);return GR({},nF("axis",i),n,r)};function Zz(t,e,i,s){switch(t){case r.cartesianBandAxis:return tz(ZF(i,["z"]),"band",e);case r.cartesianLinearAxis:return tz(ZF(i,["z"]),"linear",e);case r.cartesianLogAxis:return tz(ZF(i,["z"]),"log",e);case r.cartesianSymlogAxis:return tz(ZF(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return tz(ZF(i),void 0,e);case r.polarBandAxis:return qz(i.orient,"band",e);case r.polarLinearAxis:return qz(i.orient,"linear",e);case r.polarAxis:return qz(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,trigger:c,triggerOff:d}=null!==(s=nF(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>XF(t.orient)));let g;g=p(u)?GR({},Oz(u.type)?a:o,l):l;const f=n.find((t=>KF(t.orient)));let m;return m=p(f)?GR({},UC(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(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,trigger:c,triggerOff:d}=null!==(s=nF(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>"angle"===t.orient));let g;g=p(u)?GR({},Oz(u.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?GR({},UC(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return Jz(i,nF(t,e));default:return nF(t,e)}}const Jz=(t,e)=>{var i;const s=GR({},e,e[JF(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class Qz extends iD{getTheme(t,e){return Zz(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({},IR(e)),{[s]:0}))}}class tj extends rD{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=Qz,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof jc||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:uI.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}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 Fz(this)}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)))}_getNeedClearVRenderComponents(){return[]}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=>!U(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&&(t.release(!0),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=>{e.compile({group:t,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}}getDatum(t){}}var ej,ij;tj.transformerConstructor=Qz,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(ej||(ej={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(ij||(ij={}));class sj extends CD{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}clearComponent(){this._component&&(this._component.parent&&this._component.parent.removeChild(this._component),this._component=null)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=YR.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(hI.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){super.release(),this.removeProduct()}}sj.type="component";const nj=()=>{YR.registerMark(sj.type,sj)},rj=t=>t;class aj extends tj{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}getVisible(){return this._visible}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i,s;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._specVisible=!0,this._hideWhenEmpty=!1,this._tick=void 0,this._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._specVisible=null===(i=t.visible)||void 0===i||i,this._hideWhenEmpty=null!==(s=t.hideWhenEmpty)&&void 0!==s&&s,this._visible=this._specVisible,this._coordinateType="none"}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._specVisible=null===(t=this._spec.visible)||void 0===t||t,this._hideWhenEmpty=null!==(e=this._spec.hideWhenEmpty)&&void 0!==e&&e,this._visible=this._specVisible,this._scale&&this._refreshVisibilityByData()}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,y,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._refreshVisibilityByData(),this._shouldComputeTickData()&&this._initData(),this._specVisible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?ej.circleAxis:ej.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?ij.circleAxisGrid:ij.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if(this._syncComponentVisibility(),(null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==L(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=IF(null===(h=YR.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(d=null!==(c=this._spec.animationAppear)&&void 0!==c?c:L(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==d?d:L(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(u=this._spec.animationDisappear)&&void 0!==u?u:L(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:L(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:L(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:L(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(_=null!==(v=this._spec.animationExit)&&void 0!==v?v:L(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==_?_:L(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(y=this._spec.animationUpdate)&&void 0!==y?y:L(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b:L(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._specVisible&&(this.getVisible()||this._spec.forceInitTick||this._hideWhenEmpty)}_initData(){const t=this._initTickDataSet(this._tickTransformOption()),e=new AD(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return this._regions&&nR(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=y(a)?VC(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!VC(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return nR(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=rR(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()})),nR(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(){}_hasCollectedSeriesData(){return this.collectData(0).length>0}_refreshVisibilityByData(){const t=this._specVisible&&(!this._hideWhenEmpty||this._hasCollectedSeriesData()),e=this._visible!==t;return this._visible=t,(this._axisMark||this._gridMark)&&this._syncComponentVisibility(),e&&this._forceLayout(),e}_syncComponentVisibility(){var t,e,i,s,n,r,a,o,l,h,c,d;null===(t=this._axisMark)||void 0===t||t.setVisible(this._visible),null===(e=this._gridMark)||void 0===e||e.setVisible(this._visible&&!1!==(null===(i=this._spec.grid)||void 0===i?void 0:i.visible)),null===(a=null===(r=null===(n=null===(s=this._axisMark)||void 0===s?void 0:s.getComponent)||void 0===n?void 0:n.call(s))||void 0===r?void 0:r.setAttributes)||void 0===a||a.call(r,{visibleAll:this._visible}),null===(c=null===(h=null===(l=null===(o=this._gridMark)||void 0===o?void 0:o.getComponent)||void 0===l?void 0:l.call(o))||void 0===h?void 0:h.setAttributes)||void 0===c||c.call(h,{visibleAll:this._visible&&!1!==(null===(d=this._spec.grid)||void 0===d?void 0:d.visible)})}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&U(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):nR(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(nR(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_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=eI(s=t.domainLine)).startSymbol=eI(s.startSymbol),s.endSymbol=eI(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 nI(GR({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:nI(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>nI(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=nI(t[i]))})),e}(t.label.state)),d(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}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:d(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},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 nI(GR({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:nI(t.tick.style)),t.tick.state&&(i.tick.state=iI(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 nI(GR({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:nI(t.subTick.style)),t.subTick.state&&(i.subTick.state=iI(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=Bz[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?oe(p):null,textStyle:GR({},d,nI(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:nI(h.style)}),h.state&&(i.title.state.shape=iI(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:nI(o.style)}),o.state&&(i.title.state.background=iI(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=iI(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=nI(t.background.style)),t.background.state&&(i.panel.state=iI(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:gO(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 nI(GR({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:nI(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:gO(t.subGrid.alternateColor),style:nI(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=rF(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){yI(this._option.dataSet,"scale",rj);const i=this.registerTicksTransform();return new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,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)}getDatum(t){var e;return t&&t.name===vT.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}aj.specKey="axes";const oj=()=>{nj(),YR.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},lj=[Ez];class hj extends aj{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}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),nR(this._regions,(t=>{const e=this.getOrient();XF(e)?Dz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):KF(e)?Dz(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):qF(e)&&Dz(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&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._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{if(!this._visible)return void this._syncComponentVisibility();const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=GR({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(GR({x:t.x,y:t.y},this._getGridAttributes(),s)),this._syncComponentVisibility()},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=XF(this.getOrient()),n=t=>{var e;return(s?!XF(t.getOrient()):XF(t.getOrient()))&&VC(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())>=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,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=ZF(i,["z"]),qF(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(!Rz(e))return null;const{axisType:t,componentName:s}=QF(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=>KF(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(!Rz(t))return;const{axisType:s,componentName:n}=QF(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=YR.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}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return XF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):qF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(lj.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this._specVisible){XF(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&&!XF(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!qF(this.getOrient())&&this._spec.innerOffset){const t=this._spec;KF(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=LR(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=LR(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=XF(this.getOrient())?t.fieldX:qF(this.getOrient())?t.fieldZ:t.fieldY,VC(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;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,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:VC(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 t;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(hI.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(XF(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._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=XF(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:K(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return nR(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]:XF(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:qF(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();nR(this._regions,(e=>{XF(t)?Dz(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):KF(t)?Dz(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):qF(t)&&Dz(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(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=XF(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=XF(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)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=GR(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new Ve).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=XF(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?_t(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):_t(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-$(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&u(null===(e=a.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=a.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 o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return Iz(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:VC(this._scale.type)?i>=s[0]&&i<=$(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this._specVisible&&(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 i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}hj.type=r.cartesianAxis,hj.specKey="axes";const cj=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function dj(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,pj=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function gj(t,e,i="count"){const s=pj(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const fj=Math.sqrt(50),mj=Math.sqrt(10),vj=Math.sqrt(2);class _j{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){p(this._spec.nice)&&(this._nice=this._spec.nice),p(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=Lz(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(i.forceTickCount))e=i.forceTickCount;else if(d(i.tickCount)){const t=this._scale.range();let s=Math.abs($(t)-t[0]);if(1===s&&this._option){s=XF(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=k(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return u(s)&&u(n)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&u(n)&&u(this._softMaxValue)?this._scale.niceMax(e):!(!u(s)||!u(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return u(e)&&u(i)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&u(i)&&u(this._softMaxValue)?this._scale.niceMax():!(!u(e)||!u(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=u(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(uj),e.sort(uj),{domain:dj(t,e),scope:gj(t,e,i)}}(r,zy(t),this._spec.breaks[0].scopeType);e=zy(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return 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);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}=Lz(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs(K(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[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=fj?10:n>=mj?5:n>=vj?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max($(t),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)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}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._refreshVisibilityByData(),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)-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}_updateRawDomain(){const e=this.collectData(0,!0),i=this.computeLinearDomain(e);this._rawDomain=i,this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}const yj={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},bj={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}}},xj={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}}},Sj={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}}};class Aj extends hj{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new PE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}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)}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!qF(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=XF(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=BR(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=zy(this._break.scope).map((t=>i[0]+($(i)-i[0])*t))),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}registerTicksTransform(){const t=`${this.type}-ticks`;return _I(this._option.dataSet,t,HE),t}}Aj.type=r.cartesianLinearAxis,Aj.specKey="axes",Aj.builtInTheme={axis:Sj,axisLinear:yj,axisX:bj,axisY:xj},G(Aj,_j);const kj=()=>{YR.registerGraphicComponent(ej.lineAxis,((t,e)=>new CC(t,e))),YR.registerGraphicComponent(ij.lineAxisGrid,((t,e)=>new zB(t,e))),oj(),YR.registerComponent(Aj.type,Aj)};class Mj{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new AD(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{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._refreshVisibilityByData(),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._spec.showAllGroupLayers?this._scales:[this._scales[0]]).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=Iz(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=>Iz(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const e=this._spec.domain;for(let t=0;tthis._rawDomainIndex[t][e]=i))}this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const Tj={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}};class wj extends hj{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new cE}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}}registerTicksTransform(){const t=`${this.type}-ticks`;return _I(this._option.dataSet,t,GE),t}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=eE(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{YR.registerGraphicComponent(ej.lineAxis,((t,e)=>new CC(t,e))),YR.registerGraphicComponent(ij.lineAxisGrid,((t,e)=>new zB(t,e))),oj(),YR.registerComponent(wj.type,wj,!1)};class Ej extends Aj{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),nR(this._regions,(t=>{XF(this.getOrient())?Dz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):Dz(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=GR({},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 Pa(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.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 AD(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=mi.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=>Iz(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=>Iz(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return _I(this._option.dataSet,t,HE),t}transformScaleDomain(){}}Ej.type=r.cartesianTimeAxis,Ej.specKey="axes",Ej.builtInTheme={axis:Sj,axisX:bj,axisY:xj};class Bj extends Aj{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new IE}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return _I(this._option.dataSet,t,HE),t}transformScaleDomain(){}}Bj.type=r.cartesianLogAxis,Bj.specKey="axes",Bj.builtInTheme={axis:Sj,axisLinear:yj,axisX:bj,axisY:xj},G(Bj,_j);class Pj extends Aj{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new DE}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return _I(this._option.dataSet,t,HE),t}transformScaleDomain(){}}Pj.type=r.cartesianSymlogAxis,Pj.specKey="axes",Pj.builtInTheme={axis:Sj,axisLinear:yj,axisX:bj,axisY:xj},G(Pj,_j);const Lj=`${mO}_hide_`;function Rj(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const Oj=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[Lj]&&(Rj(t,!0),t[Lj]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=u(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[Lj]=!0,Rj(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},Ij=()=>{YR.registerGrammarTransform("symbolOverlap",{transform:Oj,runType:"afterEncode"})},Dj={min:K,max:X,average:QL,sum:JL};function Fj(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}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function zj(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 jj(t,e,i,s){return zj(t,e,i,"min",s)}function Hj(t,e,i,s){return zj(t,e,i,"max",s)}function Vj(t,e,i,s){return zj(t,e,i,"average",s)}function Nj(t,e,i,s){return zj(t,e,i,"sum",s)}const Uj=(t,e)=>{let i=d(t.size)?t.size():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=Fj;if("min"===n?l=jj:"max"===n?l=Hj:"average"===n?l=Vj:"sum"===n&&(l=Nj),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[]},Wj=()=>{YR.registerGrammarTransform("dataSampling",{transform:Uj})};class Gj extends $F{constructor(){super(...arguments),this.type=cR.line,this.transformerConstructor=bz,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.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(IF(null===(i=YR.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),DF("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=YF(this);this._symbolMark.setAnimationConfig(IF(null===(s=YR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),DF("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),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]}}Gj.type=cR.line,Gj.mark=uz,Gj.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},Gj.transformerConstructor=bz,G(Gj,dz);class Yj{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{EI(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof Pa)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];Vy(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];Vy(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class $j{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)=>{Jy(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{UO(e,[{key:t,operations:VC(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&&UO(e,[{key:i.field,operations:VC(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?MR("colorOrdinal"):MR(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(Jy(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),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(U(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;if(!U(r.specified,s.specified))return e.reMake=!0,e;s.range&&!U(s.range,n.range())&&(n.range(s.range),e.reRender=!0),Jy(s.domain)?e.reRender=!0:U(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(!Jy(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=VC(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=VC(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;VC(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(VC(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=VC(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(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)));VC(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 Xj{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&t.addState(i,!0,l):a&&t.addState(s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&t.addState(i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{t.removeState(i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&t.removeState(e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}class Kj extends eD{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){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=qy(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:vO,height:_O},this._viewRect={width:vO,height:_O},this._viewBox={x1:0,y1:0,x2:vO,y2:_O},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=IR(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new lI(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new Yj(this._dataSet),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===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new Xj;const t=this.getAllSeries(),e=[],i={};t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=`${n}-${t.type}`;i[r]?s.forEach((t=>{i[r].marks.push(t)})):(i[r]=Object.assign(Object.assign({},t),{marks:s}),e.push(i[r]))}))}})),e.forEach((t=>{const e=YR.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(IF({},DF("stage",this._spec,{}),null))}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.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=H(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=YR.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({},i),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_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){const s=YR.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"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(){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e,this._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof sD)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 CD))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof CD)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}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&&EI(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=GI(this._spec,this._option,{width:vO,height:_O})),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),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=fR(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new $j(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){YI(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=fR(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0};return Object.keys(t).filter((t=>!e[t])).sort()}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=this._getSpecKeys(this._spec);if(!U(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{YI(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[r.title]:!0,[r.brush]:!0,[r.indicator]:!0};this._components.forEach((s=>{var n,a;if(s.type===r.label||s.type===r.totalLabel)return;i[s.type]&&(i[s.type]=!1);const o=s.specKey||s.type,l=null!==(n=this._spec[o])&&void 0!==n?n:{};y(l)?(e[o]=e[o]||{specCount:l.length,componentCount:0},e[o].componentCount++,YI(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):YI(t,s.updateSpec(l))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}const s=t=>t&&!1!==t.visible;Object.keys(i).forEach((e=>{if(i[e]){const i=this._spec[e];(y(i)?i.some(s):s(i))&&(t.reMake=!0)}}))}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];YI(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=RR(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.resetLayoutItemTag(),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(){this._backgroundMark&&this._backgroundMark.compile()}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._option.globalInstance),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,this._option.globalInstance)}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._option.globalInstance),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,this._option.globalInstance)}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._option.globalInstance),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,this._option.globalInstance)}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(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(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(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(hI.AFTER_MARK_RENDER_END,e)};this._event.on(hI.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?Y(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:aI;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||d(e.filter)&&e.filter(o,l))){if(rI(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===hz.dimensionHover||s===hz.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=u(t)||!n||n.every((t=>UC(t.axis.getScale().type)&&u(t.index))),o=a||n.every((t=>UC(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(n))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(r.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(r.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),n=[];s.forEach((e=>{const i=t(e);!1!==i&&n.push({axis:e,value:i})})),i.showCrosshair(n)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const qj=(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 Zj{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)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):WR(t,a,c.spec),WR(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));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=qj(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=qj(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,e,i){var s,n,r,a,o;const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,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},h=this.seriesType;return h&&(l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(YR.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(YR.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=YR.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=YR.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=YR.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.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):aF(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=aF(t,u.specKey,u.type))||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"];return 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}))}_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 Jj extends Zj{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_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;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{u(i[t])&&(i[t]=n[t])})),L(i,"trimPadding")&&GR(i,$I(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class Qj extends Jj{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),WI(t)}}const tH=(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&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=YO(t,!0);for(const e in o)for(const i in o[e].nodes)qO(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)KO(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&XO(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}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 iH{_beforeInit(){this._dataSet&&_I(this._dataSet,"stackSplit",tH)}_initStack(){this._stack=new eH(this),this._stack.init()}}const sH={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:hz.dimensionHover};class nH extends YD{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},sH,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=aI(i);let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}nH.type="dimension-hover",nH.defaultOptions=sH;const rH=()=>{YR.registerInteractionTrigger(nH.type,nH)},aH=()=>{YR.registerComposedEvent(hz.dimensionHover,lz),YR.registerComposedEvent(hz.dimensionClick,iz)},oH=t=>t.fieldX[0],lH=t=>t.fieldY[0],hH=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},cH=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},dH=(t,e)=>t?e?oH:hH:e?lH:cH,uH=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=oz(t,(t=>XF(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=oz(t,(t=>KF(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{UC(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((t=>{if(d.size>0){if(d.has(t)){const s=pH(t,i,dH(e,UC(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=pH(t,i,dH(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},pH=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:gH(t,s,i)},gH=(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=rz(e,t,"cartesian",null!=i?i:XF(t.getOrient())?oH:lH);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},fH=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:u,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,_=0,y=null;if(d.size){const t=Array.from(d.values())[0];_=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,y=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(_)&&!Number.isNaN(_),x=s&&!b&&p(u),S=x?u:{coordRange:[0,0],sizeRange:[0,0],coord:_,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:y};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(UC(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(VC(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,_=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=Pz(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(a=y.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&y&&null!==(o=y.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(l=y.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&y&&null!==(h=y.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(c=y.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&y&&null!==(d=y.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(u=y.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&y&&null!==(p=y.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};vH(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=_+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=_+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&mH(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),mH=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=rF(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},vH=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},_H=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=yH(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},yH=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},bH=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return fH(c,r,e),c.xField.cacheInfo?_H(c.xField):c.yField.cacheInfo?_H(c.yField):void 0},xH=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],SH=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&xH.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(AH(s).every((t=>{var e;return!dF("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},AH=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},kH={dom:`${mO}_TOOLTIP_HANDLER_DOM`,canvas:`${mO}_TOOLTIP_HANDLER_CANVAS`},MH={key:"其他",value:"..."};var TH;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(TH||(TH={}));class wH{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(u(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,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:h,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}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:d,model:g}=e;if(!d||!this._cacheActiveSpec){const d=this.component.getSpec();if(this._cacheActiveSpec=SH(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){u(this._cacheActiveSpec.handler)&&p(d.handler)&&(this._cacheActiveSpec.handler=d.handler);const g=null!==(i=d[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},MH),t):MH;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!u(e)&&dF(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class CH extends wH{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)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],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(!UC(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(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}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const EH=()=>{YR.registerTooltipProcessor("dimension",CH)};class BH extends wH{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,Ko.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(aI(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const PH=()=>{YR.registerTooltipProcessor("mark",BH)};class LH extends wH{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:Y(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?Y(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_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 RH=()=>{YR.registerTooltipProcessor("group",LH)};class OH extends Kj{constructor(){super(...arguments),this.transformerConstructor=Qj,this.type="line",this.seriesType=cR.line}_setModelOption(){this._modelOption.getDimensionInfo=uH,this._modelOption.getDimensionInfoByValue=gH,this._modelOption.getRectByDimensionData=bH}}OH.type="line",OH.seriesType=cR.line,OH.transformerConstructor=Qj,G(OH,iH);const IH=[...gz,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class DH extends fz{constructor(){super(...arguments),this.type=DH.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return IH}_getIgnoreAttributes(){return[]}}DH.type="area";const FH=()=>{YR.registerMark(DH.type,DH),Jk(),Lk(),EB(),kB(),WD(),YR.registerGraphicComponent("area",nf)};class zH extends fF{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 jH=Object.assign(Object.assign(Object.assign({},wF),cz),{area:{name:"area",type:"area"}}),HH=()=>{YR.registerAnimation("area",ND),UD(),HD()};class VH extends bz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!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,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_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,f=h;("line"===c||u&&!d)&&(g=h,f=l),l.style=GR({},f.style,g.style),l.state=GR({},f.state,g.state),!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),t.area=l,t.line=h}}class NH extends $F{constructor(){super(...arguments),this.type=cR.area,this.transformerConstructor=VH,this._sortDataByAxis=!1}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(NH.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}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===eF?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return TR(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),y1: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),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return TR(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:!!e&&this.getColorAttribute(),stroke:!!i&&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.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[TO]},"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(IF(null===(e=YR.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),DF("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(IF(null===(i=YR.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),DF("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=YF(this);this._symbolMark.setAnimationConfig(IF(null===(s=YR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),DF("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new zH(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.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(){super.onLayoutEnd(),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}}}NH.type=cR.area,NH.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},NH.mark=jH,NH.transformerConstructor=VH,G(NH,dz);class UH extends Jj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),WI(t)}}class WH extends Kj{constructor(){super(...arguments),this.transformerConstructor=UH,this.type="area",this.seriesType=cR.area}_setModelOption(){this._modelOption.getDimensionInfo=uH,this._modelOption.getDimensionInfoByValue=gH,this._modelOption.getRectByDimensionData=bH}}WH.type="area",WH.seriesType=cR.area,WH.transformerConstructor=UH,G(WH,iH);function GH(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 YH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:GH(t,e)}),$H=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:GH(t,e)}),XH={type:"fadeIn"},KH={type:"growCenterIn"};function qH(t,e){if(!1===e)return{};switch(e){case"fadeIn":return XH;case"scaleIn":return KH;default:return YH(t)}}class ZH extends CD{constructor(){super(...arguments),this.type=ZH.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}ZH.type="rect";const JH=()=>{Jk(),Xk(),xB("rect",TB),YR.registerMark(ZH.type,ZH),pw.registerBuiltInAnimate("growHeightIn",rC),pw.registerBuiltInAnimate("growHeightOut",aC),pw.registerBuiltInAnimate("growWidthIn",SC),pw.registerBuiltInAnimate("growWidthOut",AC),pw.registerBuiltInAnimate("growCenterIn",iC),pw.registerBuiltInAnimate("growCenterOut",sC),YR.registerGraphicComponent("rect",Dg)},QH=Object.assign(Object.assign({},wF),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function tV(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;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=FR(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[CF]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):TR(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[EF]):TR(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=TR(this._dataToPosX(t),e,i),n=TR(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[BF]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):TR(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[PF]):TR(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=TR(this._dataToPosY(t),e,i),n=TR(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},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(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},sV.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:jF(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(sV.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}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(_I(this._option.dataSet,"addVChartProperty",lF),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};_I(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new Pa(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:AF.bind(this),call:kF}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new AD(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=PF,s=BF,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=EF,s=CF,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=YO(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)tV(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=TR(this[r](t),l,i),u=TR(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!wR(t[this.getStackValueField()],l)?p=0:pthis._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.setMarkConfig({clip:!0,clipPath:()=>{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[MO],n=t[TO],r=t[wO],h=t[CO];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]),{[MO]:i,[TO]:s}),a?{[wO]:o,[CO]:l}:void 0),c="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)};t.push(Dg(Object.assign(Object.assign({},c),{cornerRadius:d(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(c,h,this._markAttributeContext):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=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>TR(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},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=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>TR(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),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;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=K(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=YF(this);this._barMark.setAnimationConfig(IF(null===(e=YR.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),DF(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=p(this._spec.barWidth)&&r===n,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=a;return o&&(c=FR(this._spec.barWidth,a)),l&&(c=Math.max(c,FR(this._spec.barMinWidth,a))),h&&(c=Math.min(c,FR(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=u(i)?f:Math.min(f,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,m-1))&&void 0!==r?r:6,_=m===f?this._barMark.getAttribute(c,e):v;if(m>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=FR(null!==(l=i[r-1])&&void 0!==l?l:$(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=VC(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(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}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}}sV.type=cR.bar,sV.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},sV.mark=QH,sV.transformerConstructor=iV;const nV=()=>{Wj(),JH(),YR.registerAnimation("bar",((t,e)=>({appear:qH(t,e),enter:YH(t,!1),exit:$H(t,!1),disappear:{duration:FD.disappear.duration}}))),Cj(),kj(),YR.registerSeries(sV.type,sV)};class rV extends Jj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),WI(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 aV extends Kj{constructor(){super(...arguments),this.transformerConstructor=rV,this.type="bar",this.seriesType=cR.bar}_setModelOption(){this._modelOption.getDimensionInfo=uH,this._modelOption.getDimensionInfoByValue=gH,this._modelOption.getRectByDimensionData=bH}}aV.type="bar",aV.seriesType=cR.bar,aV.transformerConstructor=rV,G(aV,iH);const oV=[10,20],lV=jC.Linear,hV="circle",cV=jC.Ordinal,dV=["circle","square","triangle","diamond","star"],uV=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},pV=Object.assign(Object.assign({},wF),{point:{name:"point",type:"symbol"}});class gV extends UF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class fV extends $F{constructor(){super(...arguments),this.type=cR.scatter,this.transformerConstructor=gV,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=`${mO}_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=`${mO}_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:lV,defaultRange:oV},"size")}getShapeAttribute(t,e){return u(e)?hV:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:cV,defaultRange:dV},"shape")}initMark(){this._symbolMark=this._createMark(fV.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:jF(this._spec,fV.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=YF(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(IF(null===(i=YR.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),DF("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:hV},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{if(!t)return;const e=t.getGraphics();e&&e.length&&e.forEach(((t,e)=>{var i,s;const n=null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],r=this.dataToPosition(n);r&&t&&t.translateTo(r.x,r.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){this.handleZoom(t)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}fV.type=cR.scatter,fV.mark=pV,fV.builtInTheme={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"}}}}},fV.transformerConstructor=gV;const mV=()=>{yz(),YR.registerAnimation("scatter",((t,e)=>Object.assign({appear:uV(0,e)},zD))),Cj(),kj(),YR.registerSeries(fV.type,fV)};class vV extends Jj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class _V extends Kj{constructor(){super(...arguments),this.transformerConstructor=vV,this.type="scatter",this.seriesType=cR.scatter}_setModelOption(){this._modelOption.getDimensionInfo=uH,this._modelOption.getDimensionInfoByValue=gH,this._modelOption.getRectByDimensionData=bH}}_V.type="scatter",_V.seriesType=cR.scatter,_V.transformerConstructor=vV,G(_V,iH);class yV extends WF{constructor(){super(...arguments),this.type=cR.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=`${mO}_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 bV=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[bO]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[NO]=e.nameMap[n]:t[NO]=n})),t.features);class xV extends fF{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 SV extends CD{constructor(){super(...arguments),this.type=SV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}SV.type="path";const AV=()=>{YR.registerMark(SV.type,SV),Jk(),Wk(),YR.registerGraphicComponent("path",tf)},kV=Object.assign(Object.assign({},wF),{area:{name:"area",type:"path"}});class MV{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Ia(i,e):Ra[i]?(La[i]||(La[i]=Ia(i,Ra[i])),La[i]):null}(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 TV{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(){}}class wV{constructor(){this._lastScale=0}clearZoom(){this._lastScale=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 CV(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:TV}:$y(e)||Xy(e)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:wV}:null}const EV={debounce:St,throttle:At};class BV{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=$y(this._renderMode)||Xy(this._renderMode),CV(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return CV(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(u(r))return;if(!ke({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{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(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:pI.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:pI.chart,consume:!1}];l.on(...c,EV[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,EV[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||CV(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||CV(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:ke({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:pI.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:pI.chart,consume:!1}];l.on(...c,EV[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,EV[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){CV(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||CV(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(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:pI.chart},(t=>{if(!t.event)return;const{event:n}=t;ke({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:pI.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||CV(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:pI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||CV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:pI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:pI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:pI.chart,source:uI.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:pI.chart,source:uI.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=EV[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=EV[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:pI.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:pI.chart,source:uI.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:pI.chart,source:uI.chart},this._handleDragMouseUp)}))}}function PV(t,e){return`${mO}_${e}_${t}`}class LV extends tj{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:PV(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;const l=p(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,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,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):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,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=GR(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var e,i,s;this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:n}=this._spec;if(n){let t=!0,r=!0,a=!1;!0!==n&&(t=null===(e=n.zoom)||void 0===e||e,r=null===(i=n.drag)||void 0===i||i,a=null!==(s=n.blank)&&void 0!==s&&s),t&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!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 MV(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===cR.map||e.type===cR.pictogram?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(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),nR(this._regions,(t=>{var e;if(t.type===cR.map||t.type===cR.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new We})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==cR.map&&e.type!==cR.pictogram||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[NO],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!U(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}LV.type=r.geoCoordinate,G(LV,BV);const RV=()=>{YR.registerComponent(LV.type,LV)};class OV extends UF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class IV extends yV{constructor(){super(...arguments),this.type=cR.map,this.transformerConstructor=OV,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 !`),bI.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var e,i;super.initData(),_I(this._dataSet,"copyDataView",TI),_I(this._dataSet,"map",bV),_I(this._dataSet,"lookup",oF);const s=bI.get(this.map);s||null===(e=this._option)||void 0===e||e.onError("no valid map data found!");const n=new Pa(this._dataSet,{name:`map_${this.id}_data`});n.parse([s],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:t.TransformLevel.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:NO,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",n.reRunAllTransform),this._mapViewData=new AD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(IV.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:jF(this._spec,IV.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}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:SO])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:SO]):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(IF(null===(t=YR.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),DF("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new xV(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[bO]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[bO],{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;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new We}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new We}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}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 bO}getActiveMarks(){return[this._pathMark]}}IV.type=cR.map,IV.mark=kV,IV.builtInTheme={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"}}}}},IV.transformerConstructor=OV;const DV=`${mO}_waterfall_default_seriesField`,FV=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n,calculationMode:r}=e,a=[],{dimensionValues:o,dimensionData:l}=n().latestData;let h=Array.from(o[i]);"decrease"===r&&(h=h.reverse());let c={start:0,end:0,positive:0,negative:0,lastIndex:null};return h.forEach(((t,i)=>{const n={start:c.end,end:c.end,lastIndex:c.lastIndex,lastEnd:c.end,index:t,isTotal:!1,positive:c.end,negative:c.end},r=!0===e.stackInverse?l[t].reverse():l[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[RO]=!0:delete t[RO]})),r.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===h.length-1)return!0;return!1};if(r.some((t=>o(t))))return c=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,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=zV([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 f=g[0];let{start:m,end:v}=jV(f,i,s,n,u);i.start=m,i.end=v;let _=m,y=m,b=v-m;const x=p.reduce(((t,e)=>ne(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=se(_,e)):(t[c]=+y,y=se(y,e)),t[d]=se(t[c],e),m=se(m,e),b=ne(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,n,a,c,h,i,e,o),void a.push(n)}c=zV(r,t,n,a,c,h,i,e),a.push(n)})),a};function zV(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}=jV(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=se(i.positive,e)):(t[h]=+i.negative,i.negative=se(i.negative,e)),t[c]=se(t[h],e),i.end=se(i.end,e)}i.isTotal=e,(u(p)||p===DV)&&(t[DV]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function jV(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?Vy("total.collectCountField error"):n=e[a].start;o<0?Vy("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=se(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 HV=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>se(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?t.unshift(o):t.push(o),t},VV={type:"fadeIn"},NV={type:"growCenterIn"};function UV(t,e){switch(e){case"fadeIn":return VV;case"scaleIn":return NV;default:return YH(t,!1)}}class WV extends CD{constructor(){super(...arguments),this.type=WV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(t,i,s){const n=super._transformGraphicAttributes(t,i,s),{x:r,x1:a,y:o,y1:l}=n,h=e(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return Lg(t)}}WV.type="rule";const GV=()=>{YR.registerMark(WV.type,WV),Jk(),Nk(),YR.registerGraphicComponent("line",Lg)},YV=Object.assign(Object.assign({},QH),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),$V=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:XV(t.map((t=>t.latestData)).flat(),e.fields,i)}};function XV(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)=>XV(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class KV{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 Pa(e instanceof Ba?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),_I(e,"dimensionTree",$V),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 qV extends iV{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const ZV={rect:sN,symbol:eN,arc:rN,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=eN(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:aN,line:oN,area:oN,rect3d:sN,arc3d:rN,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function JV(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=ZV[t])&&void 0!==i?i:ZV.point;return e.series.type===cR.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=tN(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;_(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!_(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:lN(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function QV(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==cR.sankey){const{formatFunc:t,args:n}=rF(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function tN(t){return d(t)?e=>t(e.data):t}function eN(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=tN(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:iN(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function iN(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function sN(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=tN(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;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:nN(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function nN(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 rN(t){var e;const{labelSpec:i}=t,s=null!==(e=tN(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 aN(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=QV(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),Tg(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 oN(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}))):[{index:0,[SO]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function lN(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class hN extends sV{constructor(){super(...arguments),this.type=cR.waterfall,this.transformerConstructor=qV,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&XO(t,e)}}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 KV(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=DV)}getSeriesKeys(){return this._seriesField===DV?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t,e,i;super.initData(),_I(this._dataSet,"waterfallFillTotal",HV),_I(this._dataSet,"waterfall",FV),(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,calculationMode:null!==(e=this._spec.calculationMode)&&void 0!==e?e:"increase",stackInverse:this.getRegion().getStackInverse()}},!1));const s=wI(this.getViewData(),this._dataSet,{name:`${mO}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",s.reRunAllTransform),this._totalData=new AD(this._option,s),s.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:MO,endAs:TO,total:this._spec.total,calculationMode:null!==(i=this._spec.calculationMode)&&void 0!==i?i:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}},!1),s.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}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=YF(this);this._barMark.setAnimationConfig(IF(null===(i=YR.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),DF("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(IF(null===(s=YR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),DF("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(){super.initMark();const t=this._createMark(hN.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:ne(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:ne(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return aN(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?TR(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):TR(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle();const e="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),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",e?0:1):0,y1:t=>this.totalPositionY(t,"index",e?1:0)},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",e?0:1):0,x1:t=>this.totalPositionX(t,"index",e?1:0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}isVisibleLeaderLine(t){return!u(t.lastIndex)&&wR([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}hN.type=cR.waterfall,hN.mark=YV,hN.builtInTheme={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}}}},hN.transformerConstructor=qV;const cN=()=>{GV(),JH(),YR.registerAnimation("waterfall",((t,e)=>({appear:UV(t,e),enter:YH(t,!1),exit:$H(t,!1),disappear:{duration:FD.disappear.duration}}))),VD(),Cj(),kj(),YR.registerSeries(hN.type,hN)},dN=`${mO}_BOX_PLOT_OUTLIER_VALUE`;var uN;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(uN||(uN={}));const pN=(t,e)=>{const i=[],{outliersField:s,dimensionField:n,seriesField:r}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];y(e)||(e=[e]),i.push(...e.map((e=>{const i={[dN]:e};return n.forEach((e=>{i[e]=t[e]})),p(r)&&(i[r]=t[r]),i})))})),i};class gN extends fF{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===uN.OUTLIER)return this.series.getOutliersField();if(t===uN.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case uN.MIN:return this.series.getMinField();case uN.MAX:return this.series.getMaxField();case uN.MEDIAN:return this.series.getMedianField();case uN.Q1:return this.series.getQ1Field();case uN.Q3:return this.series.getQ3Field();case uN.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===uN.OUTLIER)return e[dN];if(t===uN.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case uN.MIN:return e[this.series.getMinField()];case uN.MAX:return e[this.series.getMaxField()];case uN.MEDIAN:return e[this.series.getMedianField()];case uN.Q1:return e[this.series.getQ1Field()];case uN.Q3:return e[this.series.getQ3Field()];case uN.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,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>p(t[dN])}getDefaultContentList(t){return[{key:this.getContentKey(uN.OUTLIER),value:this.getContentValue(uN.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(uN.MAX),value:this.getContentValue(uN.MAX)},{key:this.getContentKey(uN.Q3),value:this.getContentValue(uN.Q3)},{key:this.getContentKey(uN.MEDIAN),value:this.getContentValue(uN.MEDIAN)},{key:this.getContentKey(uN.Q1),value:this.getContentValue(uN.Q1)},{key:this.getContentKey(uN.MIN),value:this.getContentValue(uN.MIN)},{key:this.getContentKey(uN.SERIES_FIELD),value:this.getContentValue(uN.SERIES_FIELD)}]}}class fN extends CD{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==ZI.enter&&t.context.diffState!==ZI.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;return this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?j(r,i):i}})),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=zg(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=YR.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const mN=()=>{YR.registerGraphicComponent("glyph",zg),Jk(),Dk()},vN=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],_N=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class yN extends fN{constructor(){super(...arguments),this.type=yN.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=vN,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=_N,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}yN.type="boxPlot";const bN=Object.assign(Object.assign({},wF),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),xN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},SN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},AN=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),kN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,M;if(i&&k(i.center))return i.center;let T,w,C,E,B;if("horizontal"===e){T=null===(r=null===(n=(null===(s=AN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,w=null===(h=null===(l=null===(o=null===(a=AN(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,C=null===(p=null===(u=null===(d=null===(c=AN(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=AN(t,"box").attribute.width,i=AN(t,"box").attribute.x;E=i,B=i+e}else{T=null===(m=null===(f=(null===(g=AN(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,w=null===(b=null===(y=null===(_=null===(v=AN(t,"max"))||void 0===v?void 0:v.attribute)||void 0===_?void 0:_.points)||void 0===y?void 0:y[0])||void 0===b?void 0:b.y,C=null===(M=null===(A=null===(S=null===(x=AN(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===M?void 0:M.y;const e=AN(t,"box").attribute.height,i=AN(t,"box").attribute.y;E=i,B=i+e}return k(T)?T:k(E)&&k(B)?(E+B)/2:k(w)&&k(C)?(w+C)/2:k(C)?C:k(w)?w:NaN},MN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,_,y,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=AN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=AN(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=AN(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;y=i,_=i+e;const c=(null===(l=AN(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=AN(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=AN(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=AN(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=AN(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;y=i,_=i+e;const s=(null===(f=AN(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=AN(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(_)&&k(y)?(_+y)/2:k(y)?y:k(_)?_:NaN};class TN extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return xN(kN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class wN extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return SN(kN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class CN extends TN{computeAttribute(){return xN(MN)(this.target,this.params,this.params.options)}}class EN extends wN{computeAttribute(){return SN(MN)(this.target,this.params,this.params.options)}}class BN extends UF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}class PN extends $F{constructor(){super(...arguments),this.type=cR.boxPlot,this.transformerConstructor=BN,this._bandPosition=0}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,r,a;super.setAttrFromSpec();const o=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=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(PN.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(PN.mark.outlier,{key:bO,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var e,i,s,n,r,a;const o=this._boxPlotMark;if(o){const s={lineWidth:this._lineWidth,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"!==this._shaftShape?"#000":this.getColorAttribute()};o.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const n="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return FR(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return FR(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return FR(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return FR(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return FR(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return FR(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return FR(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return FR(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(o,s,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(o,n,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Built_In)}const l=this._outlierMark;l&&this.setMarkStyle(l,{fill:null!==(r=null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this._boxFillColor)&&void 0!==r?r:this.getColorAttribute(),stroke:this.getColorAttribute(),size:S(null===(a=this._outliersStyle)||void 0===a?void 0:a.size)?this._outliersStyle.size:10},t.STATE_VALUE_ENUM.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=>TR(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>TR(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>TR(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>TR(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>TR(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},t.STATE_VALUE_ENUM.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:t=>this._getPosition(this.direction,t),x:t=>TR(e(this.getDatumPositionValues(t,dN),{bandPosition:this._bandPosition}),s)}:{x:t=>this._getPosition(this.direction,t),y:t=>TR(e(this.getDatumPositionValues(t,dN),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;_I(this._dataSet,"foldOutlierData",pN),_I(this._dataSet,"addVChartProperty",lF);const t=new Pa(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${mO}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField}}),t.transform({type:"addVChartProperty",options:{beforeCall:AF.bind(this),call:kF}},!1),this._outlierData=new AD(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t;if(this._autoBoxWidth)return this._autoBoxWidth;const e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,i=this._groups?this._groups.fields.length:1,s=null===(t=e.getBandwidth)||void 0===t?void 0:t.call(e,i-1);let n=s;return p(this._spec.boxWidth)&&(n=FR(this._spec.boxWidth,s)),p(this._spec.boxMinWidth)&&(n=Math.max(n,FR(this._spec.boxMinWidth,s))),p(this._spec.boxMaxWidth)&&(n=Math.min(n,FR(this._spec.boxMaxWidth,s))),this._autoBoxWidth=n,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r;let a,o,l;"horizontal"===t?(a=this.getYAxisHelper(),o="boxHeight",l=this.dataToPositionY.bind(this)):(a=this.getXAxisHelper(),o="boxWidth",l=this.dataToPositionX.bind(this));const h=a.getScale(0),c=this._groups?this._groups.fields.length:1,d=null===(i=a.getBandwidth)||void 0===i?void 0:i.call(a,c-1),u=this._boxPlotMark.getAttribute(o,e);if(c>1&&p(this._spec.boxGapInGroup)){const t=this._groups.fields,i=Y(this._spec.boxGapInGroup);let o=0,l=0;for(let h=t.length-1;h>=1;h--){const c=t[h],p=null!==(n=null===(s=a.getScale(h))||void 0===s?void 0:s.domain())&&void 0!==n?n:[],g=p.length,f=FR(null!==(r=i[h-1])&&void 0!==r?r:$(i),d),m=p.indexOf(e[c]);h===t.length-1?(o+=g*u+(g-1)*f,l+=m*(u+f)):(l+=m*(o+f),o+=o+(g-1)*f)}return h.scale(e[t[0]])+a.getBandwidth(0)/2-o/2+l+u/2}const g=VC(h.type||"band");return l(e)+.5*d+(g?-d/2:0)}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=j({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=YF(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=YR.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(DF("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(IF(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(IF(null===(a=YR.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new gN(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}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}PN.type=cR.boxPlot,PN.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},PN.mark=bN,PN.transformerConstructor=BN;const LN=()=>{mN(),Nk(),Xk(),YR.registerGraphicComponent("line",(t=>Lg(t))),YR.registerGraphicComponent("rect",(t=>Dg(t))),YR.registerMark(yN.type,yN),yz(),HD(),Cj(),kj(),pw.registerBuiltInAnimate("boxplotScaleIn",TN),pw.registerBuiltInAnimate("boxplotScaleOut",wN),pw.registerBuiltInAnimate("barBoxplotScaleIn",CN),pw.registerBuiltInAnimate("barBoxplotScaleOut",EN),YR.registerSeries(PN.type,PN)};class RN extends CD{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=RN.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?Zg(t):Tg(t)}}RN.type="text";const ON=()=>{YR.registerMark(RN.type,RN),Jk(),iM(),qk(),YR.registerGraphicComponent("text",Tg),YR.registerGraphicComponent("richtext",Zg)};class IN extends fF{constructor(){super(...arguments),this._getMeasureData=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]]}}const DN=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),FN={type:"fadeIn"},zN=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function jN(t,e){return"fadeIn"===e?FN:DN(t)}const HN=Object.assign(Object.assign({},QH),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class VN extends iV{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 NN extends sV{constructor(){super(...arguments),this.type=cR.rangeColumn,this._barMarkType="rect",this._barName=cR.bar,this.transformerConstructor=VN}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(NN.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:jF(this._spec,NN.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(NN.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(NN.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(e,i,s,n){var r,a,o,l;if(e){this.setMarkStyle(e,{fill:null!==(a=null===(r=null==i?void 0:i.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[s]]:t[this._spec.yField[s]];return(null==i?void 0:i.formatMethod)?i.formatMethod(e,t):e}});!function(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)}(this,e,null!==(o=null==i?void 0:i.position)&&void 0!==o?o:n,null!==(l=null==i?void 0:i.offset)&&void 0!==l?l:"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=YF(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(IF(null===(i=YR.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),DF("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(IF(null===(s=YR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),DF("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(IF(null===(n=YR.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),DF("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new IN(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)}}NN.type=cR.rangeColumn,NN.mark=HN,NN.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},NN.transformerConstructor=VN;const UN=()=>{JH(),ON(),YR.registerAnimation("rangeColumn",((t,e)=>({appear:jN(t,e),enter:DN(t),exit:zN(t),disappear:{duration:FD.disappear.duration}}))),VD(),Cj(),kj(),YR.registerSeries(NN.type,NN)};var WN,GN;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(WN||(WN={})),function(t){t.middle="middle",t.start="start",t.end="end"}(GN||(GN={}));class YN extends fF{constructor(){super(...arguments),this._getMeasureData=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]]}}const $N=Object.assign({},jH);class XN extends NH{constructor(){super(...arguments),this.type=cR.rangeArea}initMark(){this._areaMark=this._createMark(XN.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}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 YN(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}XN.type=cR.rangeArea,XN.mark=$N;class KN extends WF{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=Xz,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.radiusAxisHelper.dataToPosition(Y(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(Y(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}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:[]};VC(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:[]};VC(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)&&GF(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}}function qN(t){return Zy(t)?Number.parseFloat(t):0}const ZN=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&JN(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=fe(e+a/2)};let _=0,y=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,M=0;const T=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))}(x);if(m.forEach(((t,e)=>{const i=t[zz],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/M;A=p,m.forEach((e=>{const i=e[r]===f?f:e[zz]*t;v(e,A,i),A+=i}))}if(0!==_&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},JN=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===qN(t[e])))||!i&&0===t.reduce(((t,i)=>t+qN(i[e])),0)));function QN(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const tU=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:QN(t,!0,PI.appear)}),eU={type:"fadeIn"},iU=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:QN(t,!0,PI.enter)}),sU=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:QN(t,!0,PI.exit)});function nU(t,e){if(!1===e)return{};switch(e){case"fadeIn":return eU;case"growRadius":return tU(Object.assign(Object.assign({},t),{growField:"radius"}));default:return tU(Object.assign(Object.assign({},t),{growField:"angle"}))}}class rU extends CD{constructor(t,e){super(t,e),this.type=aU.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>ce({x:0,y:0},this.getAttribute("centerOffset",e,i),e[Uz])[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 aU extends rU{constructor(){super(...arguments),this.type=aU.type}}aU.type="arc";const oU=()=>{Jk(),Bk(),xB("arc",LB),pw.registerBuiltInAnimate("growRadiusIn",yC),pw.registerBuiltInAnimate("growRadiusOut",bC),pw.registerBuiltInAnimate("growAngleIn",tC),pw.registerBuiltInAnimate("growAngleOut",eC),YR.registerGraphicComponent("arc",of),YR.registerMark(aU.type,aU)},lU=Object.assign(Object.assign({},wF),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class hU extends UF{_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=GR({},this._theme,i,t);const n=(t,e)=>GR({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);y(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const cU=`${mO}_LABEL_VISIBLE`;class dU extends KN{constructor(){super(...arguments),this.transformerConstructor=hU,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:LR(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:LR(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=Yz,this._endAngle=$z,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[Uz];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return ce(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;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 a=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)?oe(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?oe(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?oe(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=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;_I(this._dataSet,"pie",ZN),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?oe(this._spec.minAngle):0,asStartAngle:Hz,asEndAngle:Vz,asRatio:jz,asMiddleAngle:Uz,asRadian:Gz,asQuadrant:Wz,asK:Nz,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new Pa(this._dataSet,{name:`${mO}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new AD(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},dU.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:xO,groupKey:this._seriesField,isSeriesMark:!0},{morph:jF(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return oR(Hz)(t)}endAngleScale(t){return oR(Vz)(t)}_computeLayoutRadius(){return Kz((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:CR(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:CR(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},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),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)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:oR(cU).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(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[Uz];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return ce(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===PI.appear)return this._startAngle;if(i===PI.disappear)return this._endAngle;const r=[PI.disappear,PI.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[bO];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[bO]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[bO])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[bO])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[Uz]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[Uz]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+ce({x:0,y:0},a,e[Uz]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+ce({x:0,y:0},a,e[Uz]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=IF(null===(i=YR.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}dU.transformerConstructor=hU,dU.mark=lU,dU.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class uU extends dU{constructor(){super(...arguments),this.type=cR.pie}}uU.type=cR.pie;const pU=()=>{oU(),YR.registerAnimation("pie",((t,e)=>({appear:nU(t,e),enter:iU(t),exit:sU(t),disappear:{duration:FD.disappear.duration}}))),YR.registerAnimation("emptyCircle",((t,e)=>({appear:nU(t,e)}))),YR.registerSeries(uU.type,uU)};function gU(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const fU=t=>({type:gU(t.growField),options:{overall:!0}}),mU={type:"fadeIn"},vU=t=>({type:gU(t.growField)}),_U=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function yU(t,e){if(!1===e)return{};switch(e){case"fadeIn":return mU;case"growAngle":return fU(Object.assign(Object.assign({},t),{growField:"angle"}));default:return fU(Object.assign(Object.assign({},t),{growField:"radius"}))}}class bU extends KN{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(TO),this.setInnerRadiusField(MO)}setValueFieldToPercent(){this.setRadiusField(CO),this.setInnerRadiusField(wO)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const xU=Object.assign(Object.assign({},wF),{rose:{name:"rose",type:"arc"}});class SU extends UF{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class AU extends aj{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=y(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let n,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:u,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((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:-90,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.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=u,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const _={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(_),"radius"===i.orient?(o.push(_),a=h):(l.push(_),n=h)})),o.forEach((t=>{t.angleAxisIndex=n})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=YR.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=Yz,this._endAngle=$z,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),nR(this._regions,(t=>{"radius"===this.getOrient()?Dz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):Dz(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(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.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:LR(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:LR(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this._specVisible&&(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=oe(this._spec.startAngle),this._endAngle=oe(this._spec.endAngle),this._inverse=this._spec.inverse}_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:Pz(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}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(){nR(this._regions,(t=>{"radius"===this.getOrient()?Dz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):Dz(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(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 VC(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:VC(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 ce(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return de(t,this.getCenter(),this._startAngle,this._endAngle)}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=>Iz(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_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=ae.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",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return Kz((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=Xz,e=0;const i=this.getChart().getSpec();return nR(this.getRegions(),(s=>{const n=s;if(r=n.type,[cR.rose,cR.radar,cR.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.getComponent().setAttributes(GR({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(GR({},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)}}AU.type=r.polarAxis,AU.specKey="axes";const kU={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},MU={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class TU extends AU{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new PE}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}registerTicksTransform(){const t=`${this.type}-ticks`;return _I(this._option.dataSet,t,HE),t}}TU.type=r.polarLinearAxis,TU.specKey="axes",TU.builtInTheme={axis:Sj,axisLinear:yj,axisAngle:MU,axisRadius:kU},G(TU,_j);const wU=()=>{YR.registerGraphicComponent(ej.lineAxis,((t,e)=>new CC(t,e))),YR.registerGraphicComponent(ij.lineAxisGrid,((t,e)=>new zB(t,e))),YR.registerGraphicComponent(ej.circleAxis,((t,e)=>new OC(t,e))),YR.registerGraphicComponent(ij.circleAxisGrid,((t,e)=>new UB(t,e))),oj(),YR.registerComponent(TU.type,TU)};class CU extends AU{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new cE}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)}registerTicksTransform(){const t=`${this.type}-ticks`;return _I(this._option.dataSet,t,XE),t}transformScaleDomain(){}}CU.type=r.polarBandAxis,CU.specKey="axes",CU.builtInTheme={axis:Sj,axisBand:Tj,axisAngle:MU,axisRadius:kU},G(CU,Mj);const EU=()=>{YR.registerGraphicComponent(ej.lineAxis,((t,e)=>new CC(t,e))),YR.registerGraphicComponent(ij.lineAxisGrid,((t,e)=>new zB(t,e))),YR.registerGraphicComponent(ej.circleAxis,((t,e)=>new OC(t,e))),YR.registerGraphicComponent(ij.circleAxisGrid,((t,e)=>new UB(t,e))),oj(),YR.registerComponent(CU.type,CU)};class BU extends bU{constructor(){super(...arguments),this.type=cR.rose,this.transformerConstructor=SU,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(){this._roseMark=this._createMark(BU.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:jF(this._spec,BU.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}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=>TR(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=TR(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(IF(null===(i=YR.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),DF("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}BU.type=cR.rose,BU.mark=xU,BU.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},BU.transformerConstructor=SU;const PU=()=>{YR.registerSeries(BU.type,BU),oU(),YR.registerAnimation("rose",((t,e)=>({appear:yU(t,e),enter:vU(t),exit:_U(t),disappear:{duration:FD.disappear.duration}}))),EU(),wU()};class LU extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:ce(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=de(this.from,this._prevCenter),{angle:i,radius:s}=de(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,KL(this._fromAngle,this._toAngle)&&KL(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class RU extends $w{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!sR(t)&&!sR(e))return e;const s=de(t,this._prevCenter),n=de(e,this._center);let r=pe(s.angle),a=pe(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return ce({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new re(s,n,r,a);return o.defined=e.defined,o}}const OU=t=>({type:"in"===t?"fadeIn":"fadeOut"});function IU(t,e,i){return"fadeIn"===e?OU(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function DU(t,e,i){return"fadeIn"===e?OU(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 FU=(t,e)=>({custom:Gw,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),zU=Object.assign(Object.assign(Object.assign({},wF),cz),{area:{name:"area",type:"area"}});class jU extends bU{constructor(){super(...arguments),this.type=cR.radar,this.transformerConstructor=bz,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!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),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(jU.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}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:iF,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{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.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)?oe(this._spec.startAngle):Yz},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(IF(null===(s=YR.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),DF("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=YR.getAnimationInKey(e);t.setAnimationConfig(IF(null==i?void 0:i(n,r),DF(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}}}jU.type=cR.radar,jU.mark=zU,jU.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},jU.transformerConstructor=bz,G(jU,dz);const HU=()=>{YR.registerSeries(jU.type,jU),FH(),vz(),yz(),YR.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:IU(t,e,"in"),enter:IU(t,e,"in"),exit:IU(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:FD.disappear.duration},update:[{channel:["points","center"],custom:RU,customParameters:t,duration:FD.update.duration,easing:FD.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),YR.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:DU(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:FD.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:LU,customParameters:t,duration:FD.update.duration,easing:FD.update.easing}]}))),YR.registerAnimation("radarGroup",((t,e)=>({appear:FU(t,"in"),disappear:{duration:FD.disappear.duration}}))),Bk(),EU(),wU()};class VU extends fF{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>mi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const NU=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(mO)||(i[n]=t[n],s=p(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[bO]:r,[xO]:`${s}_${e}`})),r++}))})),n},UU={fill:"#bbb",fillOpacity:.2},WU=Object.assign(Object.assign({},wF),{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"}});class GU extends $F{constructor(){super(...arguments),this.type=cR.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 e;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),_I(this._option.dataSet,"objFlat",NU),_I(this._option.dataSet,"copyDataView",TI),yI(this._option.dataSet,"dataview",wa),null===(e=this.getViewData())||void 0===e||e.transform({type:"objFlat",options:"dots",level:t.TransformLevel.dotObjFlat},!1)}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(GR(UU,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(GU.mark.group),this._containerMark=this._createMark(GU.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(GU.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(GU.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(GU.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(GU.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(GU.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(GU.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var e;const i=this._clipMark;i&&(this.setMarkStyle(i,{x:-(null!==(e=this._spec.leftAppendPadding)&&void 0!==e?e:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",t.AttributeLevel.Series),i.setMarkConfig({interactive:!1,clip:!0}));const s=this._containerMark;s&&(this.setMarkStyle(s,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),s.setMarkConfig({interactive:!1}));const n=this._gridBackgroundMark;n&&this.setMarkStyle(n,{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 r=this._gridMark;r&&this.setMarkStyle(r,{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 a=this._dotMark;a&&this.setMarkStyle(a,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const o=this._titleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._subTitleMark;l&&this.setMarkStyle(l,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const h=this._symbolMark;h&&this.setMarkStyle(h,{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(){var e,i;super.onLayoutEnd();const s=null!==(i=null===(e=this._spec)||void 0===e?void 0:e.leftAppendPadding)&&void 0!==i?i:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+s},"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:SO}}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 AR).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:SO}}initTooltip(){this._tooltipHelper=new VU(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}GU.type=cR.dot,GU.mark=WU,GU.builtInTheme={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"}}}}};class YU extends fF{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>mi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const $U=Object.assign(Object.assign({},wF),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),XU=(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 KU extends $F{constructor(){super(...arguments),this.type=cR.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 e;super.initData(),_I(this._option.dataSet,"linkDotInfo",XU),null===(e=this.getViewData())||void 0===e||e.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:t.TransformLevel.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(KU.mark.group),this._containerMark=this._createMark(KU.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(KU.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(KU.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},"normal",t.AttributeLevel.Series),r.setMarkConfig({interactive:!1,clip:!0}));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setMarkConfig({interactive:!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:SO}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new YU(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}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]}}KU.type=cR.link,KU.mark=$U,KU.builtInTheme={link:{arrow:{style:{size:10}}}};const qU=Object.assign(Object.assign({},wF),{group:{name:"group",type:"group"}});class ZU extends KN{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()?MO:jO],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle);let o;if(p(s)){const t=ht(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()?TO:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=oe(i.offsetAngle),o=ht(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)?oe(n):Yz;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?oe(r):$z,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=TR(this.angleAxisHelper.dataToPosition([t[MO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=TR(this.angleAxisHelper.dataToPosition([t[TO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?TR(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(ZU.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+oe(a),o=oe(r)/2;return of(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[Dg({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_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 eW=()=>{YR.registerAnimation("circularProgress",((t,e)=>({appear:tW(t,e),enter:{type:"growAngleIn"},disappear:{duration:FD.disappear.duration}})))};class iW extends UF{constructor(){super(...arguments),this._supportStack=!0}}class sW extends ZU{constructor(){super(...arguments),this.type=cR.circularProgress,this.transformerConstructor=iW,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(){return this._progressMark=this._createMark(sW.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:jF(this._spec,"progress")}),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)}getInteractionTriggers(){const t=[];return 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(){return this._trackMark=this._createMark(sW.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),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()?MO:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?TO: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(IF(null===(i=YR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),DF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(IF(null===(s=YR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),DF("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}sW.type=cR.circularProgress,sW.mark=JU,sW.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},sW.transformerConstructor=iW;const nW=()=>{YR.registerSeries(sW.type,sW),oU(),eW(),VD(),EU(),wU()};function rW(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const aW={type:"fadeIn"};function oW(t,e="grow"){return!1===e?{}:"fadeIn"===e?aW:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:rW(t)}))(t)}class lW extends fF{enableByType(t){return"dimension"!==t}}const hW=Object.assign(Object.assign({},wF),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class cW extends $F{constructor(){super(...arguments),this.type=cR.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=p(e.width)?e.width:e.x1-e.x,o=p(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(cW.mark.progress,{isSeriesMark:!0}),u(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n;const r=this._progressMark;if(r)if("vertical"===this._spec.direction){const s=this._spec.progress||{},n=null!==(e=s.leftPadding)&&void 0!==e?e:0,a=null!==(i=s.rightPadding)&&void 0!==i?i:0;this.setMarkStyle(r,{x:t=>{var e,i;return TR(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),!0)-this._spec.bandWidth/2+n},y1:t=>{var e,i;return TR(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))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?TR(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-n-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=this._spec.progress||{},i=null!==(s=e.topPadding)&&void 0!==s?s:0,a=null!==(n=e.bottomPadding)&&void 0!==n?n:0;this.setMarkStyle(r,{x1:t=>{var e,i;return TR(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))},y:t=>{var e,s;return TR(this.dataToPositionY(t),null===(s=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===s?void 0:s.call(e,0),!0)-this._spec.bandWidth/2+i},height:this._spec.bandWidth-i-a,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?TR(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){return this._trackMark=this._createMark(cW.mark.track),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return TR(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),!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 TR(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),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series))}getInteractionTriggers(){const t=[];return 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(IF(null===(i=YR.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),DF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(IF(null===(s=YR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),DF("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new lW(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}cW.type=cR.linearProgress,cW.mark=hW,cW.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const dW=()=>{JH(),YR.registerAnimation("linearProgress",((t,e)=>({appear:oW(t,e),enter:oW(t),disappear:{duration:FD.disappear.duration}}))),VD(),YR.registerSeries(cW.type,cW)},uW=[0],pW=[20,40],gW=[200,500],fW={shrink:!1,enlarge:!1,fontSizeLimitMin:0},mW=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class vW{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const _W=`${mO}_WORD_CLOUD_TEXT`,yW=Object.assign(Object.assign({},wF),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),bW={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic",scaleX:1,scaleY:1}}};class xW extends WF{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},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._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=pW}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,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:gW,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:uW,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?_W:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:fW},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||Yy(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:uW,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!mW.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new vW(1e3))}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",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var e;this._wordMark=this._createMark(xW.mark.word,{key:xO,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(e=this._spec.wordMask)||void 0===e?void 0:e.visible)&&(this._maskMark=this._createMark(xW.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",t.AttributeLevel.Series)}initMarkStyleOfWord(e,i,s,n,r){var a,o;e&&(this.setMarkStyle(e,{text:(null==i?void 0:i.formatMethod)?t=>i.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{fill:null!==(o=null===(a=null==i?void 0:i.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(IF(YR.getAnimationInKey("wordCloud")(n,s),DF("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 AR).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:SO])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new PE).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new PE).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[bO])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(e=this._spec.word)&&void 0!==e?e:{},h=null!==(i=l.style)&&void 0!==i?i:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const e=()=>{var i,s,n,r;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((t=>t.fn!==e)),null===(s=(i=this._option).dispatchEvent)||void 0===s||s.call(i,t.ChartEvent.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(r=null===(n=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===n?void 0:n.afterWordcloudShapeDraw)||void 0===r||r.call(n,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:e})},dataIndexKey:xO,text:l.formatMethod?t=>l.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(n=null===(s=this._spec.word)||void 0===s?void 0:s.padding)&&void 0!==n?n:1,fontFamily:p(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(r=h.fontFamily)&&void 0!==r?r:this._defaultFontFamily,fontWeight:p(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:p(h.fontWeight)?h.fontWeight:p(this._valueField)?this._calculateFontWeight:"normal",fontStyle:p(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:h.fontStyle,createCanvas:k_.createCanvas.bind(k_),getTextBounds:mf}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,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,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:Wg,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:p(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:p(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:p(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}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(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}xW.mark=yW,xW.builtInTheme={wordCloud:bW};function SW(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||FD.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,d;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(d=t.children)||void 0===d?void 0:d.length){p.children=[],p.isLeaf=!1;const e=AW(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Tt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Tt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},kW=(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=kW(t.children,e,t,n))})),s},MW=(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=MW(t.children,e,t,n)),n=e(t,s,i,n)})),n},TW=(t,e=[],i)=>{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):TW(t.children,e,i)))})),e};function wW(t,e){let i,s;if(BW(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function BW(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 OW(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 IW(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 DW(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 FW(t){return{_:t,next:null,prev:null}}function zW(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];OW(n,s,r);let a,o,l,h,c,d,u,p=FW(s),g=FW(n),f=FW(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.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,this._valueField=null!==(e=null==t?void 0:t.valueField)&&void 0!==e?e:"value"}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=AW(t,n,0,-1,null,this._getNodeKey,this._valueField);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%Ct)/Ct}(),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:NW.defaultOpionts.nodeSort;kW([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)kW([o],jW(h)),MW([o],HW(this._getPadding,.5,a)),kW([o],VW(1,this._maxDepth));else{const t=Math.min(s.width,s.height);kW([o],jW(NW.defaultOpionts.setRadius)),MW([o],HW(Rt,1,a)),c&&MW([o],HW(this._getPadding,o.radius/t,a)),kW([o],VW(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}NW.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const UW=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=UW(t.children):t.value=0),e+=Math.abs(t.value)})),e};function WW(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){UW(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=u(t.value)?0:Tt(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=H(t,["parents"]);if(a.parents=t.parents.map((t=>H(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=Tt(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function GW(t){return t.depth}function YW(t,e){return e-1-t.endDepth}const $W=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),XW=(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},KW={left:GW,right:YW,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?K(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:GW,end:YW},qW=bt(0,1);class ZW{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({},ZW.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._logger=ot.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):KW[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)};"vertical"===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<=0)return null;const a=this.computeNodeBreadths(n);if(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))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;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}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return 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){return WW(t,this._getNodeKey)}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=[XW(s[t.source]),XW(s[t.target],!0)].filter((t=>!u(t)));e.length&&(t.value=K(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){return function(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))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=d(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}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=_t(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;ea)&&(o=a);let l=0,h=null,c=null;if(d(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)c=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:c>0?t=>c:t=>Math.max(t.value*l,0),m=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*qW(t.value/e.value):0,n,0),o);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;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,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{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];JW(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),QW);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({},tG.defaultOpionts,t):Object.assign({},tG.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?Pt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Lt(this.options.center[0],t.width),s=t.y0+Lt(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=>Lt(t,n))):Lt(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>Lt(t,n))):Lt(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=Lt(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=AW(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=ce({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)}}}function eG(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(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,f,m,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,_=Math.max(v/x,x/m),_>y){f-=h;break}y=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{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*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:JW,slice:eG,sliceDice:function(t,e,i,s,n){(t.depth%2==1?eG:JW)(t,e,i,s,n)}};class nG{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({},nG.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?Pt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?iG(this.options.aspectRatio):null!==(e=sG[this.options.splitType])&&void 0!==e?e:sG.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=AW(t,n,0,-1,null,this._getNodeKey,this.options.valueField);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)}))}}function rG(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+ci?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return ot.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=rG(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=Ci(o.map(Ci))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rwt(e)));u=Ri(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=aG(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&ot.getInstance().error("Area "+r+" not represented on screen")}return i}function pG(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Pi((function(i){return-1*gG({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},mG=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=Y(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!P(Y(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:Y(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||lG,s=e.lossFunction||oG,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=Y(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];di(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rae.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:fG(f),arcs:f})}))},vG={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:_G,triangle:_G,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.955)%(2*Math.PI/5)-2*Math.PI/10>=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 _G(){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 yG(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*.4),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"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const bG=t=>vG[t]?vG[t]():vG.circle(),xG=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function SG(t){return d(t)?t:function(){return t}}class AG{constructor(t){var e,i;switch(this.options=j({},AG.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=bG(this.options.shape),this.getText=null!==(e=SG(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=SG(this.options.fontWeight),this.getTextFontSize=SG(this.options.fontSize),this.getTextFontStyle=SG(this.options.fontStyle),this.getTextFontFamily=SG(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>xG(10,50);break;case"random-light":this.getTextColor=()=>xG(50,90);break;default:this.getTextColor=SG(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 oe(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():wt(e);return oe(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+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:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1: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 MG extends AG{constructor(t){var e;super(j({},MG.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<=MG.defaultOptions.minFontSize&&(this.options.minFontSize=MG.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=kG[this.options.spiral])&&void 0!==e?e:kG.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=SG(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}=yG(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,f,m;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,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,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._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=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(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=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}));if(this.originalData=s,this.data=s,this.progressiveRun(),!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._originSize[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],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});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 f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);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*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(EG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(CG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}EG(p,this._size)&&(p=BG(p,this._size))}else if(EG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||wG(p,i))&&(!i||!TG(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 TG(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 wG(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,EG=(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 BG(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{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const u=n.measureText(h),g="normal"!==o?1.1:1,f=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(u.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},LG=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>ce(t,e,i+r*n)))},RG=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},OG=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=yG(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=bG("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return ce(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)RG(n,LG({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)RG(n,LG({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)RG(n,LG({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)RG(n,LG({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)RG(n,LG({x:l,y:h},o,0,3));else if("star"===t.shape){const t=LG({x:l,y:h},o,-Math.PI/2,5),e=LG({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);RG(n,i)}else n.fillRect(0,0,i,s)}; /*! * wordcloud2.js * http://timdream.org/wordcloud2.js/ @@ -20,4 +20,4 @@ * Copyright 2011 - 2019 Tim Guan-tin Chien and contributors. * Released under the MIT license */ -let wG=class t extends fG{constructor(e){super(j({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{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,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize: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=this.options.createCanvas({width:1,height:1}),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 f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),_=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*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],B=(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--;)B(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}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=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,e=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){this.grid=[];const e=this.options.shape;if(g(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?AG(t,o,l.width,l.height,h):"geometric"===t.type&&TG(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!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)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,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}=dG(this.options.shape,[e.width,e.height]);return 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),this.result=[],this.progressiveRun()}};wG.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class CG extends fG{constructor(t){super(j({},CG.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,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)}CG.defaultOptions={enlarge:!1};const BG={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},PG=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return ot.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?LG(t.fontFamily):"sans-serif",d=t.fontStyle?LG(t.fontStyle):"normal",u=t.fontWeight?LG(t.fontWeight):"normal",p=t.rotate?LG(t.rotate):0,g=LG(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?LG(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?Object.assign(Object.assign({},BG),t.as):BG,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?LG(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=OG(IG(t,l),C);w=i=>e(t(i))}let E=vG;"fast"===t.layoutType?E=CG:"grid"===t.layoutType&&(E=wG);const B=new E(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:w,shrink:_,clip:b,enlarge:y,minFontSize:x,random:A,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:B}:B.output()},LG=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],RG=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),OG=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=RG(t[0]),n=RG(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(RG(t)-r)/(a-r)*(e[1]-e[0])+e[0]},IG=(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 DG(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{zR.registerGrammarTransform("wordcloud",{transform:PG}),TV(),zR.registerAnimation("wordCloud",((t,e)=>({appear:gW(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:ED.disappear.duration}}))),zR.registerSeries(FG.type,FG)},jG=(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:f=!1,isCone:m=!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===f?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?m?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},HG=(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},NG=`${lO}_FUNNEL_TRANSFORM_RATIO`,VG=`${lO}_FUNNEL_REACH_RATIO`,UG=`${lO}_FUNNEL_HEIGHT_RATIO`,WG=`${lO}_FUNNEL_VALUE_RATIO`,GG=`${lO}_FUNNEL_LAST_VALUE_RATIO`,YG=`${lO}_FUNNEL_NEXT_VALUE_RATIO`,$G=`${lO}_FUNNEL_LAST_VALUE`,XG=`${lO}_FUNNEL_CURRENT_VALUE`,KG=`${lO}_FUNNEL_NEXT_VALUE`,qG=`${lO}_FUNNEL_TRANSFORM_LEVEL`;class ZG extends oF{constructor(t){var e,i;super(t),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)?this._transformRatioText: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[VG])).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 this._transformRatioText;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]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class JG extends bD{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class QG extends JG{constructor(){super(...arguments),this.type=QG.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}QG.type="polygon";const tY=()=>{zR.registerMark(QG.type,QG),Jk(),Yk(),pw.registerBuiltInAnimate("growPointsOut",cC),zR.registerGraphicComponent("polygon",cf)},eY=Object.assign(Object.assign({},yF),{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"}});class iY extends IF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class sY extends DF{constructor(){super(...arguments),this.type=iR.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=iY,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,i,s,n;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._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;cI(this._dataSet,"funnel",jG),cI(this._dataSet,"funnelTransform",HG);const t=new Pa(this._dataSet,{name:`${lO}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new fD(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}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:XG,asTransformRatio:NG,asReachRatio:VG,asHeightRatio:UG,asValueRatio:WG,asNextValueRatio:YG,asLastValueRatio:GG,asLastValue:$G,asNextValue:KG,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:qG}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},sY.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:PF(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},sY.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),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(sY.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(sY.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new ZG(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(){var e,i,s,n;const r=this._funnelMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const a=this._funnelTransformMark;a&&this.setMarkStyle(a,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const o=this._funnelOuterLabelMark.label;o&&(this.setMarkStyle(o,{text:t=>`${t[this.getCategoryField()]}`,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),width:0,height:0},"normal",t.AttributeLevel.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(o,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",t.AttributeLevel.User_Mark));const l=this._funnelOuterLabelMark.line;if(l&&o){this.setMarkStyle(l,{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);const r=null!==(s=null===(i=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.line)||void 0===i?void 0:i.visible)&&void 0!==s?s:null===(n=this._spec.outerLabel)||void 0===n?void 0:n.visible;p(r)&&l.setVisible(r)}}initLabelMarkStyle(e){var i;if(!e)return;const s=e.getTarget(),n=e.getComponent();if(s===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);const s=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&jy(s,this._funnelOuterLabelMark.label,n),this._funnelOuterLabelMark.line&&jy(s,this._funnelOuterLabelMark.line,null!==(i=this._funnelOuterLabelMark.label)&&void 0!==i?i:n)}else this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*QL(VG).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(wF(null===(s=zR.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.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),CF("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(wF(zR.getAnimationInKey("fadeInOut")(),CF(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(wF(zR.getAnimationInKey("funnel")({},o),CF(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(wF(null===(a=zR.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),CF("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[GG])/2:this._getSecondaryAxisLength(t[WG])/2,n=this._getSecondaryAxisLength(t[WG])/2):(s=this._getSecondaryAxisLength(t[WG])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[YG])/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[qG])}_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[pO]===t[pO]));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,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,_,y;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h: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!==f.alignLabel?(null==u?void 0:u.y2)+e:_-e,m=this._getPolygonCenter(i).x,_-y{tY(),TV(),FN(),zR.registerSeries(sY.type,sY),zR.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},PD))),zR.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Yw,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),RD()},rY=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},aY=t=>{const e=t.filter((t=>t.context.diffState===UI.update)),i=K(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},oY=(t,e,i)=>{if(P(t))return[e,i];const s=K(t.map((t=>1*t.getFinalAttribute().startAngle))),n=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},lY=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=aY(i.parent.children),a=oY(r,s,n);return rY(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=aY(i.parent.children),a=oY(r,s,n);return rY(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),hY=t=>{const e=K(t.map((t=>1*t.getFinalAttribute().startAngle))),i=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},cY=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=aY(i.parent.children),a=hY(r);return rY(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=aY(i.parent.children),a=hY(r);return rY(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),dY=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},uY=(t,e={})=>{if(!t)return[];const i=[];return _W(t,i,e),i},pY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new YW(i).layout(t,{width:s,height:n})};class gY extends oF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var fY;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(fY||(fY={}));const mY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===fY.DrillDown){return Y(WO(t,n,s,"children"))}if(i.type===fY.DrillUp){const e=GO(t,n,s,"children");if(e)return Y(e)}return t};class vY{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=bN(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;cI(t,"drillFilter",mY),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)||P(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:fY.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:fY.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)||P(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:fY.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:fY.DrillUp},model:this}),r}}const _Y=Object.assign(Object.assign({},yF),{sunburst:{name:"sunburst",type:"arc"}}),yY=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:uF,operations:["max","min","values"]}),t.push({key:pF,operations:["values"]}),t),bY={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,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"}}}};class xY extends NV{constructor(){super(...arguments),this.type=iR.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:pF),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:pO},getRawData:()=>this.getRawData()}),this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(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),cI(this._dataSet,"sunburstLayout",pY),cI(this._dataSet,"flatten",uY),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 yY(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(cI(t.dataSet,"addVChartProperty",tF),t.transform({type:"addVChartProperty",options:{beforeCall:vF.bind(this),call:_F}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(xY.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_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()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(xY.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new gY(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(wF(null===(e=zR.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),CF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(wF(null===(e=zR.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),CF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),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]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}xY.type=iR.sunburst,xY.mark=_Y,xY.builtInTheme={sunburst:bY},G(xY,vY);const SY=()=>{zR.registerSeries(xY.type,xY),QV(),TV(),RD(),zR.registerAnimation("sunburst",((t,e)=>({appear:dY(0,e),enter:lY(t),exit:cY(t),disappear:{duration:ED.disappear.duration}})))},AY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new OW(i).layout(t,{width:s,height:n})};class kY extends oF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const MY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},TY=Object.assign(Object.assign({},yF),{circlePacking:{name:"circlePacking",type:"arc"}});class wY extends jF{constructor(){super(...arguments),this.type=iR.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:pF),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:pO},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),cI(this._dataSet,"circlePackingLayout",AY),cI(this._dataSet,"flatten",uY),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)||(cI(t.dataSet,"addVChartProperty",tF),t.transform({type:"addVChartProperty",options:{beforeCall:vF.bind(this),call:_F}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(wY.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_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},t.STATE_VALUE_ENUM.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(wY.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"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return yY(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new kY(this),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(wF(null===(i=zR.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),CF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(wF(null===(e=zR.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),CF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}wY.type=iR.circlePacking,wY.mark=TY,wY.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,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"}}}}},G(wY,vY);const CY=()=>{zR.registerSeries(wY.type,wY),QV(),TV(),LD(),zR.registerAnimation("circlePacking",((t,e)=>({appear:MY(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:ED.disappear.duration}})))},EY=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&EY(t,e.children,i)}))},BY=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},PY=(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 UW(e),r=[];return r.push(n.layout(s,i)),r},LY=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:[]},RY=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 OY extends oF{constructor(){super(...arguments),this._getDimensionData=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},this.markTooltipValueCallback=t=>t.value}}const IY=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),DY=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:IY(t),FY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class zY extends kw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class jY extends kw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const HY=(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,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=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}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},NY=(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,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=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}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class VY extends oV{constructor(){super(...arguments),this.type=VY.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?NY:HY,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}VY.type="linkPath";const UY=Object.assign(Object.assign({},yF),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class WY extends IF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const GY=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&t.removeState(e),t.addState(e,s,n)};class YY extends jF{constructor(){super(...arguments),this.type=iR.sankey,this.transformerConstructor=WY,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new Ne,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;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(p(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var e,i;if(!this._needClear)return;const s=null===(e=this._nodeMark)||void 0===e?void 0:e.getGraphics();if(!s||!s.length)return;const n=null===(i=this._linkMark)||void 0===i?void 0:i.getGraphics();n&&n.length&&(s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),n.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._needClear=!1)},this._handleNodeAdjacencyClick=e=>{const i=JO(e),s=[i.key];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,n)=>{const r=JO(e);r.source===i.key?(s.includes(r.target)||s.push(r.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):r.target===i.key?(s.includes(r.source)||s.push(r.source),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleLinkAdjacencyClick=e=>{const i=JO(e),s=[i.source,i.target];if(this._linkMark){const i=this._linkMark.getGraphics();if(!i||!i.length)return;i.forEach((i=>{i===e?(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),GY(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1})):(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),i.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleNodeRelatedClick=e=>{var i;const s=JO(e),n=this._nodeMark.getGraphics();if(!n||!n.length)return;const r=this._linkMark.getGraphics();if(!r||!r.length)return;const a=(null===(i=JO(r[0]))||void 0===i?void 0:i.parents)?"parents":"source";if("source"===a){const e=[s.key],i=[];if(r.forEach(((t,r)=>{var a,o,l,h;const c=JO(t),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(s.key)){if(i.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||i.push(null!==(o=c.key)&&void 0!==o?o:c.index),e.includes(c.source)||e.push(c.source),!e.includes(c.target)){e.push(c.target);let t=n.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.target))){e.push(t.target);const i=n.find((e=>e.data[0].key===t.target));s.push(i.data[0].targetLinks)}})),void(t=s)}}}else if(c.target===s.key&&(i.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||i.push(null!==(h=c.key)&&void 0!==h?h:c.index),!e.includes(c.source))){e.push(c.source);let t=n.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.source))){e.push(t.source);const i=n.find((e=>e.data[0].key===t.source));s.push(i.data[0].targetLinks)}})),void(t=s)}}})),this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,s)=>{var n;const r=JO(e);i.includes(null!==(n=r.key)&&void 0!==n?n:r.index)?(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}else{const e=[s.key],i=s.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const i=e.parents,n=i.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);r.forEach(((n,r)=>{const o=JO(n),l=o.datum,h=l?l.filter((t=>t[a].some((t=>t.key===s.key)))):null,c=i.find((t=>t.source===o.source&&t.target===o.target));if(h&&h.length){e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target);const i=h.reduce(((t,e)=>t+e.value),0),s=i/o.value;return n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void GY(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:s})}if(c)return e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target),n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void GY(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:c.value/o.value});n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),n.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}this._needClear=!0},this._handleLinkRelatedClick=e=>{const i=this._nodeMark.getGraphics();if(!i||!i.length)return;const s=this._linkMark.getGraphics();if(!s||!s.length)return;if("source"===(JO(e)?"parents":"source"))this._linkMark&&s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&i.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)}));else{const n=JO(e),r=[n.source,n.target],a=[];Y(n.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));a.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=r:a.push({source:i,target:n,value:r})}})),s.forEach((e=>{const i=JO(e),s=i.datum;if(i.source===n.source&&i.target===n.target)return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void GY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1});const o=s?s.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(n.source)&&e.includes(n.target)})):null;if(o&&o.length){r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target);const s=o.filter((t=>t.parents.some(((e,i)=>{var s;return e.key===n.source&&(null===(s=t.parents[i+1])||void 0===s?void 0:s.key)===n.target})))).reduce(((t,e)=>t+e.value),0),a=s/i.value;return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void GY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:a})}const l=a.find((t=>t.source===i.source&&t.target===i.target));if(l)return r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void GY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:l.value/i.value});e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(i,r)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}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:this._spec.categoryField)}initData(){var e,i,s,n;super.initData();const r=this.getViewData(),a=this.getRawData();if(a&&r){cI(this._dataSet,"sankeyLayout",PY),cI(this._dataSet,"sankeyFormat",BY),a.transform({type:"sankeyFormat"},!1),r.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.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(e=this._spec.nodeAlign)&&void 0!==e?e:"justify",nodeGap:null!==(i=this._spec.nodeGap)&&void 0!==i?i:8,nodeWidth:null!==(s=this._spec.nodeWidth)&&void 0!==s?s:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(n=this._spec.minNodeHeight)&&void 0!==n?n:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,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,inverse:this._spec.inverse},level:t.TransformLevel.sankeyLayout});const{dataSet:o}=this._option;cI(o,"sankeyNodes",LY),cI(o,"flatten",uY);const l=new Pa(o,{name:`sankey-node-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyNodes"}),l.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),l.transform({type:"addVChartProperty",options:{beforeCall:fF.bind(this),call:mF}},!1),this._nodesSeriesData=l,cI(o,"sankeyLinks",RY);const h=new Pa(o,{name:`sankey-link-${this.id}-data`});h.parse([this.getViewData()],{type:"dataview"}),h.transform({type:"sankeyLinks"}),h.transform({type:"addVChartProperty",options:{beforeCall:fF.bind(this),call:mF}},!1),this._linksSeriesData=h}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(YY.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(YY.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,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()}_initNodeMarkStyle(){var e,i;const s=this._nodeMark;s&&(this.setMarkStyle(s,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Mark),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.node.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByNode},"normal",t.AttributeLevel.User_Mark))}_initLinkMarkStyle(){var e,i;const s=this._linkMark;s&&(s.setGlyphConfig({direction:this.direction}),this.setMarkStyle(s,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.link.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByLink},"normal",t.AttributeLevel.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=ZD(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={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;this._nodeMark&&this._nodeMark.setAnimationConfig(wF(null===(i=zR.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),CF("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(wF(null===(s=zR.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),CF("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:rI.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(e,i){e&&e.length&&e.forEach((e=>{e.removeState([t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]),i.includes(JO(e).key)?e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0):e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new OY(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_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&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new fR;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_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 EY(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),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]}getMarkData(t){return t.datum?y(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}YY.type=iR.sankey,YY.transformerConstructor=WY,YY.mark=UY,YY.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const $Y=()=>{WH(),lV(),Wk(),zR.registerGraphicComponent("path",(t=>tf(t))),zR.registerMark(VY.type,VY),TV(),zR.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:DY(t,e)},PD))),zR.registerAnimation("sankeyLinkPath",((t,e)=>({appear:FY(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:ED.disappear.duration}}))),pw.registerBuiltInAnimate("linkPathGrowOut",jY),pw.registerBuiltInAnimate("linkPathGrowIn",zY),RD(),zR.registerSeries(YY.type,YY)},XY=(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=uY(n);return i=hF([{latestData:r}],e),i};class KY extends oF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const qY=Object.assign(Object.assign({},yF),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),ZY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class JY extends IF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const QY=(t,e)=>{if(e.getViewBox()){const i=new qW(e).layout(t,e.getViewBox()),s=[];return _W(i,s,{maxDepth:null==e?void 0:e.maxDepth}),s.forEach(((t,i)=>{t&&[pF,"name"].forEach((i=>{t[i]=t.datum[t.depth][e.nameField]}))})),s}return[]};class t$ extends jF{constructor(){super(...arguments),this.type=iR.treemap,this.transformerConstructor=JY,this._categoryField="name",this._valueField="value",this._viewBox=new Ne,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:pF),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new We),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:pO},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,s,n;super.initData(),cI(this._dataSet,"treemap",QY),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{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}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(cI(this._rawData.dataSet,"addVChartProperty",tF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:vF.bind(this),call:_F}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=XY([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=j(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){cI(this._dataSet,"hierarchyDimensionStatistics",XY),cI(this._dataSet,"flatten",uY);const i=new Pa(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 yY(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(t$.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(t$.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}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()},t.STATE_VALUE_ENUM.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()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRichStyleOfLabelMark(e){"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(wF(null===(e=zR.getAnimationInKey("treemap"))||void 0===e?void 0:e(),CF(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 KY(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(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(eI.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(eI.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}t$.type=iR.treemap,t$.mark=qY,t$.builtInTheme={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"}}}},t$.transformerConstructor=JY,G(t$,vY),G(t$,SN);const e$=()=>{zR.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),zR.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),WH(),TV(),zR.registerAnimation("treemap",((t,e)=>({appear:ZY(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:ED.disappear.duration}}))),RD(),zR.registerSeries(t$.type,t$)},i$=Object.assign(Object.assign({},VU),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),s$=Object.assign(Object.assign({},yF),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),n$={type:"fadeIn"};function r$(t,e){return"fadeIn"===e?n$:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class a$ extends IF{constructor(){super(...arguments),this._supportStack=!1}}class o$ extends oF{enableByType(t){return"dimension"!==t}}const l$="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",h$={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:l$,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:l$,fill:"#ddd"}}};class c$ extends UU{constructor(){super(...arguments),this.type=iR.gaugePointer,this.transformerConstructor=a$,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(c$.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},c$.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(c$.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(){this._tooltipHelper=new o$(this),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=K(e),n=_t(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})}getInteractionTriggers(){return 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(wF(null===(i=zR.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),CF("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}c$.type=iR.gaugePointer,c$.mark=s$,c$.builtInTheme={gaugePointer:h$},c$.transformerConstructor=a$;const d$=()=>{zR.registerSeries(c$.type,c$),fN(),WH(),zR.registerAnimation("gaugePointer",((t,e)=>{const i=r$(t,e);return{appear:i,enter:i,disappear:{duration:ED.disappear.duration}}})),xU(),yU()};class u$ extends IF{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class p$ extends UU{constructor(){super(...arguments),this.type=iR.gauge,this.transformerConstructor=u$,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=oe(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();cI(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[LO]=t[this._angleField[0]],t[PO]=e>0?i[e-1][LO]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(p$.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(p$.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})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e&&"segment"===e.name){const i=this.getSpec().segment;if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}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),s=bt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?_R(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?_R(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return p(t[PO])?this.angleAxisHelper.dataToPosition([t[PO]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[LO]])}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(wF(null===(i=zR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),CF("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}p$.type=iR.gauge,p$.mark=i$,p$.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},p$.transformerConstructor=u$;class g$ extends bD{constructor(){super(...arguments),this.type=g$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Eg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="rect":a.symbolType=o,a}}g$.type="cell";function f$(t){return!1===t?{}:{type:"fadeIn"}}class m$ extends oF{enableByType(t){return"dimension"!==t}}const v$=Object.assign(Object.assign({},yF),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class _$ extends IF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class y$ extends jF{constructor(){super(...arguments),this.type=iR.heatmap,this.transformerConstructor=_$}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(y$.mark.cell,{isSeriesMark:!0},{morph:PF(this._spec,y$.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(y$.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){var e,i,s;t&&this.setMarkStyle(t,{fill:null!==(s=null===(i=null===(e=this._spec.cell)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s: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=ai(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]}}getInteractionTriggers(){return 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=zF(this);this._cellMark.setAnimationConfig(wF(null===(i=zR.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),CF("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 m$(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}y$.type=iR.heatmap,y$.mark=v$,y$.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1},label:{style:{lineWidth:2}}}},y$.transformerConstructor=_$;const b$=()=>{TV(),zR.registerMark(g$.type,g$),zR.registerGraphicComponent("symbol",Eg),Jk(),tM(),kB(),zR.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},PD),{appear:f$(e)}))),bj(),mj(),zR.registerSeries(y$.type,y$)},x$=Object.assign(Object.assign({},yF),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),S$=`${lO}_CORRELATION_X`,A$=`${lO}_CORRELATION_Y`,k$=`${lO}_CORRELATION_SIZE`,M$=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,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=oe(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=oe(null!==(s=e.endAngle)&&void 0!==s?s:270),A=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),k=Lt(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=Lt(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+Lt(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+Lt(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=Pt(e.field),C=t.map(w),[E,B]=Ot(C),P=E===B?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(B-E),L=u(e.radiusField)?w:Pt(e.radiusField),R=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=>R;if(L){const[i,s]=L!==w?Ot(t.map(L)):[E,B],n=null!==(f=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==f?f:5,r=null!==(v=null===(m=e.radiusRange)||void 0===m?void 0:m[1])&&void 0!==v?v:5;i!==s&&(O=t=>n+(r-n)*(L(t)-i)/(s-i))}const I=Math.min(b,x),D=Math.max(b,x),F=T$(I,D,t.length),z=[],j=(D-I)/60;return t.forEach(((t,e)=>{const i=P(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),w$({x:n,y:r,size:s},z)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=j,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},w$=(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,[uO]:null==n?void 0:n[uO],[gO]:null==n?void 0:n[gO]}};class E$ extends oV{constructor(){super(...arguments),this.type=E$.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=_t(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}E$.type="ripple";const B$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class P$ extends IF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class L$ extends NV{constructor(){super(...arguments),this.type=iR.correlation,this.transformerConstructor=P$,this._viewBox=new Ne}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;cI(this._dataSet,"correlation",M$);const s=new Ba;dI(s,"dataview",wa),cI(s,"correlationCenter",C$);const n=new Pa(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 fD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_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(){const e=this._createMark(L$.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:uO});e&&(e.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._nodePointMark=e);const i=this._createMark(L$.mark.ripplePoint,{key:uO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(this._ripplePointMark=i);const s=this._createMark(L$.mark.centerPoint,{key:uO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});s&&(s.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._centerPointMark=s)}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[S$],y:t=>t[A$],size:t=>t[k$],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.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)},t.STATE_VALUE_ENUM.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(wF(null===(e=zR.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),CF("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(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}L$.type=iR.correlation,L$.mark=x$,L$.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},L$.transformerConstructor=P$;const R$=()=>{dz(),lV(),tM(),zR.registerMark(E$.type,E$),zR.registerGraphicComponent("symbol",(t=>Eg(t))),zR.registerSeries(L$.type,L$),zR.registerAnimation("correlation",((t,e)=>Object.assign({appear:B$(0,e)},BD)))},O$=Object.assign(Object.assign({},yF),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class I$ extends oV{constructor(){super(...arguments),this.type=I$.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}I$.type="liquid";const D$=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class F$ extends oF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class z$ extends DF{constructor(){super(...arguments),this.type=iR.liquid,this.transformerConstructor=uz,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Dg({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Eg({x:s,y:n,size:r,symbolType:D$(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=wR(this._spec.outlineMargin),this._paddingSpec=wR(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Yt(...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(z$.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(z$.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(z$.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(z$.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.created(),this.setMarkStyle(e,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new F$(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(wF(null===(i=zR.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),CF("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(wF(null===(s=zR.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),CF("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=kM(t.attribute.fill,n.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]}}z$.type=iR.liquid,z$.mark=O$,z$.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},z$.transformerConstructor=uz;const j$=t=>Y(t).join(",");class H$ extends oF{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>j$(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>j$(null==t?void 0:t[this.series.getDimensionField()[0]])}}const N$=Object.assign(Object.assign({},yF),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class V$ extends IF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const U$=(t,e)=>{const i=e.getViewBox();return i&&(null==t?void 0:t.length)?lG(Object.assign({setField:e.setField,valueField:e.valueField},i),t):[]};class W$ extends DF{constructor(){super(...arguments),this.type=iR.venn,this.transformerConstructor=V$,this._viewBox=new Ne}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:pO)}initData(){var t;super.initData(),cI(this._dataSet,"venn",U$),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:{getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField}})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(W$.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(W$.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()},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},t.STATE_VALUE_ENUM.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=>j$(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)}},t.STATE_VALUE_ENUM.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=>j$(t.sets)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new H$(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(){super.onLayoutEnd(),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:j$(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return j$(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[j$(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(j$(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(wF(null===(e=zR.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),CF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(wF(null===(e=zR.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),CF(t.name,this._spec,this._markAttributeContext)))}))}}W$.type=iR.venn,W$.mark=N$,W$.builtInTheme={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"}}}}},W$.transformerConstructor=V$;class G$ extends KH{constructor(){super(...arguments),this.type=iR.mosaic,this.transformerConstructor=XH}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(CO),this.setFieldX2(wO)),this.setFieldY(BO),this.setFieldY2(EO)):(t&&(this.setFieldY(CO),this.setFieldY2(wO)),this.setFieldX(BO),this.setFieldX2(EO)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&u(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];u(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}G$.type=iR.mosaic,G$.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},G$.transformerConstructor=XH;class Y$ extends Uj{_isValidSeries(t){return t===iR.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class $$ extends Nj{constructor(){super(...arguments),this.transformerConstructor=Y$,this.type="map",this.seriesType=iR.map}}$$.type="map",$$.seriesType=iR.map,$$.transformerConstructor=Y$;class X$ extends Uj{_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,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],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 K$ extends X${needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_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=kz(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,FR({},s,l)),n&&Object.assign(o,FR({},n,o))}}class q$ extends X${needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}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 Z$ extends X${needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class J$ extends Nj{constructor(){super(...arguments),this.transformerConstructor=Z$}}J$.transformerConstructor=Z$;class Q$ extends J${constructor(){super(...arguments),this.transformerConstructor=Z$,this.type="pie",this.seriesType=iR.pie}}Q$.type="pie",Q$.seriesType=iR.pie,Q$.transformerConstructor=Z$;class tX extends q${_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return n.radius=null!==(e=t.radius)&&void 0!==e?e:Hz,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:Hz,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}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=>FR({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const eX=(t,e)=>{if(!t)return null;const i=QF(t,(t=>"angle"===t.getOrient()),e),s=QF(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&UC(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=$L({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=K(e),n=X(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=XL(d),f=null===(e=s[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 _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=ZF(v,t,"polar",r);n.push({index:_,value:v,position:i.scale(v),axis:t,data:y})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&UC(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=$L({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=XL(c),g=null===(e=i[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=s.invert(p);if(u(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const _=ZF(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:_})}})),n.length?n:null};class iX extends Nj{constructor(){super(...arguments),this.transformerConstructor=tX,this.type="rose",this.seriesType=iR.rose}_setModelOption(){this._modelOption.getDimensionInfo=eX}}iX.type="rose",iX.seriesType=iR.rose,iX.transformerConstructor=tX,G(iX,Xj);class sX extends q${_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t);return i.line=t.line,i.point=t.point,i.stack=t.stack,i.percent=t.percent,i.area=FR({visible:!1},t.area),i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"area",i.activePoint=t.activePoint,i.pointDis=t.pointDis,i.pointDisMul=t.pointDisMul,i.markOverlap=t.markOverlap,i}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=>FR({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class nX extends Nj{constructor(){super(...arguments),this.transformerConstructor=sX,this.type="radar",this.seriesType=iR.radar}_setModelOption(){this._modelOption.getDimensionInfo=eX}}nX.type="radar",nX.seriesType=iR.radar,nX.transformerConstructor=sX,G(nX,Xj);class rX extends Uj{_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=>{L(e,"trimPadding")&&FR(e,jI(this.type,t))})),this._transformAxisSpec(t)}}class aX extends Nj{constructor(){super(...arguments),this.transformerConstructor=rX,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=nH(t,e,i))&&void 0!==s?s:[],...null!==(n=eX(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=aH,this._modelOption.getRectByDimensionData=uH}}aX.type="common",aX.transformerConstructor=rX,G(aX,Xj);class oX extends Wj{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class lX extends Nj{constructor(){super(...arguments),this.transformerConstructor=oX}}lX.transformerConstructor=oX,G(lX,Xj);class hX extends oX{transformSpec(t){super.transformSpec(t),DI(t)}}class cX extends lX{constructor(){super(...arguments),this.transformerConstructor=hX,this.type="histogram",this.seriesType=iR.bar}_setModelOption(){this._modelOption.getDimensionInfo=nH,this._modelOption.getDimensionInfoByValue=aH,this._modelOption.getRectByDimensionData=uH}}cX.type="histogram",cX.seriesType=iR.bar,cX.transformerConstructor=hX;class dX extends K${_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class uX extends Nj{constructor(){super(...arguments),this.transformerConstructor=dX,this.type="circularProgress",this.seriesType=iR.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=eX}}uX.type="circularProgress",uX.seriesType=iR.circularProgress,uX.transformerConstructor=dX,G(uX,Xj);class pX extends K${_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=iR.circularProgress,e}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===iR.gauge||t.type===iR.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===iR.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 gX extends Nj{constructor(){super(...arguments),this.transformerConstructor=pX,this.type="gauge",this.seriesType=iR.gaugePointer}}gX.type="gauge",gX.seriesType=iR.gaugePointer,gX.transformerConstructor=pX;class fX extends Uj{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class mX extends Nj{constructor(){super(...arguments),this.transformerConstructor=fX,this.type="wordCloud",this.seriesType=iR.wordCloud}}mX.transformerConstructor=fX;class vX extends mX{constructor(){super(...arguments),this.transformerConstructor=fX,this.type="wordCloud",this.seriesType=iR.wordCloud}}vX.type="wordCloud",vX.seriesType=iR.wordCloud,vX.transformerConstructor=fX;class _X extends Uj{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class yX extends Nj{constructor(){super(...arguments),this.transformerConstructor=_X,this.type="funnel",this.seriesType=iR.funnel}}yX.type="funnel",yX.seriesType=iR.funnel,yX.transformerConstructor=_X;class bX extends Wj{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}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=kz(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=kz(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class xX extends Nj{constructor(){super(...arguments),this.transformerConstructor=bX,this.type="linearProgress",this.seriesType=iR.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=nH,this._modelOption.getDimensionInfoByValue=aH,this._modelOption.getRectByDimensionData=uH}}xX.type="linearProgress",xX.seriesType=iR.linearProgress,xX.transformerConstructor=bX,G(xX,Xj);class SX extends Wj{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"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),DI(t)}}class AX extends Nj{constructor(){super(...arguments),this.transformerConstructor=SX,this.type="rangeColumn",this.seriesType=iR.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=nH,this._modelOption.getDimensionInfoByValue=aH,this._modelOption.getRectByDimensionData=uH}}AX.type="rangeColumn",AX.seriesType=iR.rangeColumn,AX.transformerConstructor=SX;class kX extends Uj{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+le(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class MX extends Nj{constructor(){super(...arguments),this.transformerConstructor=kX,this.type="sunburst",this.seriesType=iR.sunburst}}MX.type="sunburst",MX.seriesType=iR.sunburst,MX.transformerConstructor=kX;class TX extends Uj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class wX extends Nj{constructor(){super(...arguments),this.transformerConstructor=TX,this.type="circlePacking",this.seriesType=iR.circlePacking}}wX.type="circlePacking",wX.seriesType=iR.circlePacking,wX.transformerConstructor=TX;class CX extends Uj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class EX extends Nj{constructor(){super(...arguments),this.transformerConstructor=CX,this.type="treemap",this.seriesType=iR.treemap}}EX.type="treemap",EX.seriesType=iR.treemap,EX.transformerConstructor=CX;class BX extends ZH{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),DI(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class PX extends JH{constructor(){super(...arguments),this.transformerConstructor=BX,this.type="waterfall",this.seriesType=iR.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=nH,this._modelOption.getDimensionInfoByValue=aH,this._modelOption.getRectByDimensionData=uH}}PX.type="waterfall",PX.seriesType=iR.waterfall,PX.transformerConstructor=BX;class LX extends Wj{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),DI(t)}}class RX extends Nj{constructor(){super(...arguments),this.transformerConstructor=LX,this.type="boxPlot",this.seriesType=iR.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=nH,this._modelOption.getDimensionInfoByValue=aH,this._modelOption.getRectByDimensionData=uH}}RX.type="boxPlot",RX.seriesType=iR.boxPlot,RX.transformerConstructor=LX;class OX extends Uj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class IX extends Nj{constructor(){super(...arguments),this.transformerConstructor=OX,this.type="sankey",this.seriesType=iR.sankey}_setStateInDatum(t,e,i,s){const n=y(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=JO(t))||void 0===e?void 0:e.datum;return y(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}IX.type="sankey",IX.seriesType=iR.sankey,IX.transformerConstructor=OX;class DX extends Wj{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.area=t.area,s.point=t.point,s.line=t.line,"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),DI(t)}}class FX extends Nj{constructor(){super(...arguments),this.transformerConstructor=DX,this.type="rangeArea",this.seriesType=iR.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=nH,this._modelOption.getDimensionInfoByValue=aH,this._modelOption.getRectByDimensionData=uH}}FX.type="rangeArea",FX.seriesType=iR.rangeArea,FX.transformerConstructor=DX;class zX extends Wj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class jX extends Nj{constructor(){super(...arguments),this.transformerConstructor=zX,this.type="heatmap",this.seriesType=iR.heatmap}}jX.type="heatmap",jX.seriesType=iR.heatmap,jX.transformerConstructor=zX;class HX extends Uj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class NX extends Nj{constructor(){super(...arguments),this.transformerConstructor=HX,this.type="correlation",this.seriesType=iR.correlation}}NX.type="correlation",NX.seriesType=iR.correlation,NX.transformerConstructor=HX;function VX(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=qO(t.style)),P(t.textStyle)||FR(s.textStyle,qO(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&qO(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&qO(s.background.style),s}const UX=(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},WX=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const u={};c.forEach((t=>{u[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:gO;return h?h(t,c,g):(y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===u[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===u[t.source]&&!0===u[t.target])))):p(g)&&(t=t.filter((t=>!0===u[r.getSeriesFieldValue(t,g)]))),t)};class GX extends Yz{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:()=>{qL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),qL(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=xR(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()}_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):(U(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new fD(this._option,e),this._initSelectedData(),qL(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(qL(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)U(s,this._cacheAttrs)||this._legendComponent.setAttributes(FR({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(FR({},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;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());U(t,this._cacheAttrs)||this._legendComponent.setAttributes(FR({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}GX.specKey="legends";class YX extends GX{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return JD(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),qL(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){cI(this._option.dataSet,"discreteLegendFilter",WX),cI(this._option.dataSet,"discreteLegendDataMake",UX);const t=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return qL(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(!Jy(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=FO(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 s=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:n={},item:r={},pager:a={},background:o={}}=t;n=I(n),r=I(r),a=I(a),o=I(o);const l=s;return n.visible?l.title=VX(n):l.title={visible:!1},P(r.focusIconStyle)||qO(r.focusIconStyle),r.shape&&(r.shape=$O(r.shape)),r.label&&(r.label=$O(r.label)),r.value&&(r.value=$O(r.value)),r.background&&(r.background=$O(r.background)),SR(r.maxWidth)&&(r.maxWidth=Number(r.maxWidth.substring(0,r.maxWidth.length-1))*i.width/100),SR(r.width)&&(r.width=Number(r.width.substring(0,r.width.length-1))*i.width/100),SR(r.height)&&(r.height=Number(r.height.substring(0,r.height.length-1))*i.width/100),l.item=r,"scrollbar"===a.type?(P(a.railStyle)||qO(a.railStyle),P(a.sliderStyle)||qO(a.sliderStyle)):(P(a.textStyle)||qO(a.textStyle),a.handler&&$O(a.handler)),l.pager=a,o.visible&&!P(o.style)&&(FR(l,o.style),p(o.padding)&&(l.padding=o.padding)),l}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return nL}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(ZP.legendItemClick,(i=>{const s=L(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(ZP.legendItemHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(ZP.legendItemUnHover,(e=>{const i=L(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}=ZD(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=ZD(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}YX.specKey="legends",YX.builtInTheme={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}},YX.type=r.discreteLegend;const $X=(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[]},XX=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=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(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?YO(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};const KX={color:hL,size:dL},qX={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}},ZX=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},qX),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},JX={horizontal:ZX(!0),vertical:ZX(!1)},QX=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},qX),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},tK={horizontal:QX(!0),vertical:QX(!1)},eK=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],iK=[2,10];class sK extends GX{static getSpecInfo(t){const e=JD(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}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(e){super.init(e),qL(this._regions,(e=>{e.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:e.isHierarchyData,customFilter:this._spec.customFilter},level:t.TransformLevel.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(){cI(this._option.dataSet,"continuousLegendFilter",XX),cI(this._option.dataSet,"continuousLegendDataMake",$X);const t=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>ZL(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=FO(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!Jy(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=FO(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()),P(a)&&(a="color"===this._legendType?eK:iK);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=FR({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:d={},type:u,id:g,visible:f,orient:m,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=VX(s):w.title={visible:!1},w.showHandler=!1!==n.visible,P(n.style)||(w.handlerStyle=qO(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),P(r.style)||(w.railStyle=qO(r.style)),P(a.style)||(w.trackStyle=qO(a.style)),w.startText=$O(o),w.endText=$O(l),w.handlerText=$O(h),P(c)||(w.sizeBackground=qO(c)),d.visible&&!P(d.style)&&(FR(w,d.style),p(d.padding)&&(w.padding=d.padding)),w}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return KX[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",St((i=>{const s=L(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}sK.specKey="legends",sK.builtInTheme={colorLegend:JX,sizeLegend:tK},sK.type=r.continuousLegend;const nK=(t,e)=>p(e)?t.map((t=>e[t])):void 0,rK=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),aK=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function oK(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),d=i.getOption(),g=d.getRegionsInUserIdOrIndex(p(c.regionId)?[c.regionId]:void 0,p(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=lK(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),_=g.getLayoutRect(),y=d.globalInstance.getContainer(),b=Object.assign({x:0,y:0},y?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(y):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>rK(i,s)(t)&&rK(n,r)(t)&&(u(a)||rK([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),A=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),_.width),y:Math.min(Math.max(t.y,0),_.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.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 l=[{value:t[e.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=>x(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=d.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:nI.chart,event:A({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=d.globalInstance;return YD.globalConfig.uniqueTooltip&&YD.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=d.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:nI.chart,event:A(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=d.globalInstance;return YD.globalConfig.uniqueTooltip&&YD.hideTooltip(a.id),m}return"none"}const lK=(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(),f=p(g)?t[g]:void 0,m=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=nK(c,t);let _=nK(d,t);const y=aK(_),b=!y&&p(g)&&u(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(rK(c,v));if(!y&&(_=nK(d,i),!aK(_)))return;const n=e.type===iR.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:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=UC(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(rK(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=nK(d,o),!aK(_))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(rK(c,n));if(!y&&(_=nK(d,r),!aK(_)))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:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===iR.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(rK(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(_=nK(d,i),!aK(_))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&&(()=>{var i,n,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(rK(c,v));const o=e.getNameMap(),l=null===(r=null===(n=e.getMapViewData)||void 0===n?void 0:n.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=_;if(l&&!a&&(a=Object.assign({},t)),!y){if(_=nK(d,a),h=_,!aK(_)&&!a)return;aK(_)||(_=[null])}const p=e.dataToPosition(a);u(p)||isNaN(p.x)||isNaN(p.y)||s.push({pos:p,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:h,hasMeasureData:y,groupField:g,groupData:f,originDatum:a},series:e})})()})),s},hK=t=>p(t)&&!y(t),cK=t=>p(t)&&y(t);class dK extends Gz{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i,s,n;const{spec:r,theme:a}=super._initTheme(t,e);return r.style=FR({},this._theme,r.style),r.offset=FR({},a.offset,t.offset),r.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:a.transitionDuration,r.trigger=null!==(s=t.trigger)&&void 0!==s?s:a.trigger,r.triggerOff=null!==(n=t.triggerOff)&&void 0!==n?n:a.triggerOff,{spec:r,theme:a}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(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]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:Xy(this._option.mode)||!Yy(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.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?_(t.parentElement)&&(t.parentElement=k_.getElementById(t.parentElement)):Yy(this._option.mode)&&(t.parentElement=null==Gy?void 0:Gy.body)}}const uK={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}};class pK extends Yz{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=dK,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=Yy(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&hK(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!u(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&YD.globalConfig.uniqueTooltip&&l&&YD.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;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;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:nI.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(null==r?void 0:r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:nI.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),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,this._enterable=!1;else{const t="canvas"===s?mH.canvas:mH.dom,n=zR.getComponentPluginInType(t);n||Vy("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,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=zR.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=Y(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),($y(s)||Xy(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,At(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===s||s.call(i)}else 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=oK(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_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(cK(t)){if(hK(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>KF(t,e[i])))}if(cK(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.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: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}getVisible(){return!1!==this._spec.visible}}pK.type=r.tooltip,pK.transformerConstructor=dK,pK.builtInTheme={tooltip:uK},pK.specKey="tooltip";var gK,fK;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(gK||(gK={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(fK||(fK={}));const mK={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class vK extends Yz{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=At((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},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.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{UC(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_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}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(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(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:rI.chart}:{source:nI.chart};y(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,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)}onBeforeRender(){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"}:$y(e)||Xy(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:nI.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:nI.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:nI.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=L(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{mK[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=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const u=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+u.left),o=Math.min(o,i-d+u.top),l=Math.max(l,e+t.getLayoutRect().width-c-u.right),h=Math.max(h,i+t.getLayoutRect().height-d-u.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_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)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_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 i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=L(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=L(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:d}=n,u=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:L(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{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||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}vK.specKey="crosshair";const _K={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}}}}};class yK extends vK{static getSpecInfo(t){return JD(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_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)}}_getDatumAtPoint(t,e){const i=HF(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){HF(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:NF(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();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 o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=JL(this._regions,"cartesian");e&&(oH(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=cH(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new lT(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new hT(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}yK.specKey="crosshair",yK.builtInTheme={crosshair:_K},yK.type=r.cartesianCrosshair;class bK extends vK{static getSpecInfo(t){return JD(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_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)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_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}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=JL(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&p(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=Az(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=ZD(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:ce(d,a.getInnerRadius(),o),end:ce(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=ue(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=ce(t,o,r),d=ce(t,o,h),m=_e([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=_t(ae.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new lT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new dT(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new uT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new cT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=pe(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}}(u):function(t){let e="center",i="middle";return e=(t=pe(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}}(g.startAngle),a="angle"===l?ce(e,p[1]+m.offset,u):ce(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}bK.specKey="crosshair",bK.builtInTheme={crosshair:_K},bK.type=r.polarCrosshair;const xK=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(u(o)||u(a))return t;const l=r(),h=y(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},SK=(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=>{let e=!1;return Y(r).every((i=>{t[i]>=a[0]&&t[i]<=$(a)&&(e=!0)})),e}:t=>{let e=!1;return Y(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},AK=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],d=[],g=[];let f=!1,m=!1;n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);p(null==t?void 0:t.max)&&p(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{u(h[t])&&(g.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(h[t[i]])&&(g.push(t[i]),h[t[i]]=0,c.push(t[i])),u(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const v=f?g:!1===r||m?g.sort(((t,e)=>t-e)):c;return v.forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),d.push(e)})),d},kK=(t,e,i)=>{const s=e.domain();if(NC(e.type))return i?s[0]+($(s)-s[0])*(1-t):s[0]+($(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+($(n)-n[0])*t;return e.invert(r)},MK=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&NC(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/($(n)-n[0])))},TK=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},wK=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}},CK=(t,e,i)=>"start"===t?"percent"===e&&p(i.start)||"value"===e&&p(i.startValue):"percent"===e&&p(i.end)||"value"===e&&p(i.endValue),EK=(t,e,i)=>{if(NC(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class BK{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})}constructor(t,e,i,s,n,r,a,o){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.initZoomEvent=()=>{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,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),d=Math.abs(this.getState().start-this.getState().end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=_t(this.getState().start+f,0,1),_=_t(this.getState().end-m,0,1);this._handleChange(Math.min(v,_),Math.max(v,_),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Ut(s/n)>=.5:Ut(n/s)>=.5;if(this._scrollAttr.reverse||(r=-r),a){const t=this._spec.scrollStep;if(k(t)){r=(r>0?1:-1)*(t*(this.getState().end-this.getState().start)/1)}this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1)}const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))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.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===WF(UF(e))}setEventAttrFromSpec(){!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=j({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=j({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=j({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,c(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&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.getEvent(),this._option.mode)}}G(BK,SN);class PK extends Yz{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:MK(t,this._stateScale,this._isHorizontal),a="percent"===n?e:MK(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var e;this._dataFilterEvent.initZoomEvent(),null===(e=this._relatedAxisComponent)||void 0===e||e.event.on(t.ChartEvent.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_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)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=TK(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[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._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._currentDataCollection=[],this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=EK(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!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&&wK(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({value:"force"})}else qL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),qL(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=UF(t),this._isHorizontal="horizontal"===WF(this._orient),this._dataFilterEvent=new BK(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){this._handleDataCollectionChangeBound=this._handleDataCollectionChange.bind(this),super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(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])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(NC(n.type)){const r=n.domain(),a=r[0],o=$(r)-a,l=p(t)?a+o*t:+e,h=p(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=p(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=p(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}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}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_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=>WF(t._orient)===WF(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!NC(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;}_collectDataInfo(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};qL(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l,u=NC(d.getScale(0).type),p=NC(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?Y(g.xField):Y(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?Y(g.yField):Y(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:d===l?f:m;u&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else qL(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});return{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}}_initData(){const{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}=this._collectDataInfo(),{dataSet:r}=this._option;dI(r,"dataview",wa),cI(r,"dataFilterComputeDomain",AK);const a=new Pa(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new fD(this._option,a),a.reRunAllTransform(),this._currentDataCollection=t,r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChangeBound)}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(cI(this._option.dataSet,"dataFilterWithNewDomain",SK),cI(this._option.dataSet,"lockStatisticsFilter",xK),qL(this._regions,(e=>{e.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>e.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>NC(this._stateScale.type)},level:1},!1),e.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>NC(this._stateScale.type)},level:t.TransformLevel.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r}=this._collectDataInfo();if(this._currentDataCollection.length!==e.length||this._currentDataCollection.some(((t,i)=>t!==e[i]))){this._currentDataCollection.forEach((t=>{var e;null===(e=null==t?void 0:t.target)||void 0===e||e.removeListener("change",this._handleDataCollectionChangeBound)})),this._currentDataCollection=e;const{dataSet:t}=this._option;t.multipleDataViewAddListener(this._currentDataCollection,"change",this._handleDataCollectionChangeBound)}this._data.getDataView().transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data.getDataView().reRunAllTransform();const a=this._computeDomainOfStateScale(NC(this._stateScale.type));this._stateScale.domain(a,!1),(p(this._spec.start)||p(this._spec.end))&&this._setStateFromSpec(),this._handleChange(this._start,this._end,!0),this._spec.auto&&!U(this._domainCache,a)&&(this._domainCache=a,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;CK("start",i,this._spec)&&CK("end",s,this._spec)&&(t="percent"===i?this._spec.start:MK(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:MK(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?MK(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?MK(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=kK(this._start,this._stateScale,TK(i,this._isHorizontal)),this._endValue=kK(this._end,this._stateScale,TK(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,NC(this._stateScale.type)&&this._stateScale.domain()[0]!==$(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=EK(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&qL(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);k(null==i?void 0:i.min)&&k(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new PE:new cE,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_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?[K(t),X(t)]:[-1/0,1/0]}return e}_autoVisible(e){if(!this._auto)return;e?this.show():this.hide();const i=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[i]:e?this[`_${i}`]:0},{[i]:t.AttributeLevel.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_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=wK(h);if(!this._dataUpdating&&UC(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,UC(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),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}G(PK,SN);class LK extends Gz{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=FR({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}}}const RK=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),OK={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:RK(!1),startHandler:{style:{symbolType:"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;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"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;",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:RK(!0)};class IK extends PK{constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=LK,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=this._isHorizontal?0:this._middleHandlerSize,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=this._isHorizontal?0:this._middleHandlerSize,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._getPreviewStateScale(),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._getPreviewStateScale(),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"}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange)if(s&&this._component)this._component.setStartAndEnd(e,i);else{const s=this._relatedAxisComponent,r=kK(e,this._stateScale,TK(s,this._isHorizontal)),a=kK(i,this._stateScale,TK(s,this._isHorizontal));if(!p(r)||!p(a))return;this._start=e,this._end=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(){this._data.getDataView().reRunAllTransform();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new PE),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(TK(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=TK(t,this._isHorizontal),this.effect.onZoomChange())}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,d=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+d,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+d),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);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(),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=isNaN(c)?this._backgroundSize:c-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=isNaN(c)?this._backgroundSize:c-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,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new PE;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(TK(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[K(e),X(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!NC(t.type)||e[0]!==$(e))&&(!UC(t.type)||1!==(i=e,i&&y(i)?Array.from(new Set(Y(i))):i).length);var i}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_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:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_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._computeWidth(),height:this._computeHeight()},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,isReverse:TK(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=this._isHorizontal?this._stateScale:this._valueScale,i=this._isHorizontal?this._valueScale:this._stateScale,s=this._isScaleValid(e)&&this._isScaleValid(i)&&!1!==this._spec.showBackgroundChart,n=this._getAttrs(s),r=this._relatedAxisComponent;if(this._component)this._component.setAttributes(n),t&&(this._component.setPreviewData(this._data.getDataView().latestData),s&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>kK(t,this._stateScale,TK(r,this._isHorizontal))))));else{const t=this.getContainer();this._component=new JB(n),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?s&&this._component.setPreviewPointsY1(this._dataToPositionY2):s&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>kK(t,this._stateScale,TK(r,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:qO(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:qO(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:qO(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:qO(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:qO(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:qO(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:qO(g.style)},selectedBackgroundStyle:qO(this._spec.selectedBackground.style),dragMaskStyle:qO(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:FR(qO(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},qO(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:FR(qO(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},qO(null===(d=m.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}=ZD(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(TK(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}}IK.type=r.dataZoom,IK.transformerConstructor=LK,IK.builtInTheme={dataZoom:OK},IK.specKey="dataZoom";const DK={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}};class FK extends PK{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"}_handleChange(e,i,s){super._handleChange(e,i,s);const n=NL(this._start,e)&&NL(this._end,i);if(this._shouldChange&&(!n||!1===this._spec.realTime)){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=kK(e,this._stateScale,!1),r=kK(i,this._stateScale,!1);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,n,r):this._handleStateChange(n,r))&&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(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r,a;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,minSliderSize:null===(a=this._spec)||void 0===a?void 0:a.minSliderSize},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new pM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=qO(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=qO(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}FK.type=r.scrollBar,FK.builtInTheme={scrollBar:DK},FK.specKey="scrollBar";const zK=(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},jK=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),HK={title:{visible:!0,autoLimit:!1,autoFit:!1,style:jK("l1FontSize","primaryFontColor")},content:{visible:!0,style:jK("l2FontSize","tertiaryFontColor")}};class NK extends Yz{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){return JD(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}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))}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(JO(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(JO(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){cI(this._option.dataSet,"indicatorFilter",zK);const t=new Pa(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 fD(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:i,height:s}=t.getLayoutRect(),{x:n,y:r}=t.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,u=e(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return Y(o).forEach((t=>{const e=FR({},this._theme.content,t);g.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({},KO(H(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?ER(l,this._computeLayoutRadius()):0,dy:h?ER(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!p(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},KO(H(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},u)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)U(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new gL(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_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.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}NK.type=r.indicator,NK.builtInTheme={indicator:HK},NK.specKey="indicator";const VK=["sum","average","min","max","variance","standardDeviation","median"];function UK(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=K(s),r=X(s);return er}function WK(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&UK(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=SR(t.x)?XK(t.x,n)+r.x:KK(l.getXAxisHelper(),[t.x])+r.x,h}function GK(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&UK(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=SR(t.y)?XK(t.y,n)+r.y:KK(l.getYAxisHelper(),[t.y])+r.y,h}function YK(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&UK(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)),KK(a.angleAxisHelper,[t.angle])}function $K(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&UK(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)),KK(a.radiusAxisHelper,[t.radius])}function XK(t,e){return Number(t.substring(0,t.length-1))*e/100}function KK(t,e){const i=t.getScale(0);return NC(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function qK(t){return VK.includes(t)}function ZK(t,e,i,s,n,r=!1){const a=e.getRegion(),o=a.getLayoutStartPoint(),l=i.getRegion(),h=l.getLayoutStartPoint(),c=Math.abs(Math.min(o.x,h.x)-Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width)),d=Math.abs(Math.min(o.y,h.y)-Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height)),u={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},g=[],f=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper(),v=s.getYAxisHelper(),_=m.getScale(0).domain(),y=v.getScale(0).domain(),b=r&&!m.isContinuous&&!!m.getBandwidth,x=r&&!v.isContinuous&&!!v.getBandwidth,S={min:null,max:null},A={min:null,max:null};return f.forEach((t=>{const e=p(t.x),i=p(t.y);let s,r;if(e&&i)s=WK(t,_,n,u,c,o),r=GK(t,y,n,u,d,o),JK(s,b,S,g.length),JK(r,x,A,g.length),g.push([{x:s,y:r}]);else if(e){s=WK(t,_,n,u,c,o),r=Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height);const e=Math.min(o.y,h.y);JK(s,b,S,g.length),g.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(o.x,h.x),r=GK(t,y,n,u,d,o);const e=Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width);JK(r,x,A,g.length),g.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(g,m,v,S,A),g}function JK(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=YK(t,l,n,r),i=$K(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=YK(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=$K(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function tq(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:f}=u.getLayoutRect();let m=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(m=SR(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=SR(i)?Number(i.substring(0,i.length-1))*f/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])&&UK(_,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])&&UK(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:KK(d.getXAxisHelper(),b)+p.x+m,y:KK(d.getYAxisHelper(),x)+p.y+v})})),n}function eq(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])&&UK(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])&&UK(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:KK(l.angleAxisHelper,d),radius:KK(l.radiusAxisHelper,u)})})),s}function iq(t,e,i){let{x:s,y:n}=t;return SR(s)&&(s=XK(s,e)),SR(n)&&(n=XK(n,i)),{x:s,y:n}}function sq(t,e,i){let s;if(s=d(t)?Y(t(e.getData().getLatestData(),e)):Y(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=iq(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>iq(t,n,r)))}function nq(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 rq(t,i,s){const{labelBackground:n={},style:r,shape:a}=t,o=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},qO(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},oq(qO(n.style),i,s)),p(n.padding)&&(t.padding=ai(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=oq(qO(r),i,s)),t}return{visible:!1}}function aq(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function oq(t,e,i){return d(t)?t(e,i):t}function lq(t,e){return d(t)?t(e):t}function hq(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 cq(t){return{isXProcess:p(t.x),isYProcess:p(t.y),isX1Process:p(t.x1),isY1Process:p(t.y1),isAngleProcess:p(t.angle),isRadiusProcess:p(t.radius),isAngle1Process:p(t.angle1),isRadius1Process:p(t.radius1),isCoordinatesProcess:p(t.coordinates),isValidProcess:p(t.process)}}function dq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=cq(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:h&&(!c||"process"in t&&"xy"in t.process)}}function uq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=cq(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function pq(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function gq(t,i){let s;if(i.coordinates){const t=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=t,o=e(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(d(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=Y(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;p(r)&&(c=Y(i)[r]),n&&Y(i).includes(n)&&(c=n);let d=s;p(l)&&(d=Y(s)[l]),a&&Y(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),_(t[c])&&qK(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),_(t[d])&&qK(t[d])?h.y={field:d,aggrType:t[d]}:h.y=Y(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;p(r)&&(a=Y(s)[r]),n&&Y(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),_(t[a])&&qK(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),_(t[l])&&qK(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=Y(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const s=e.x;y(s)?i.x=s.map((i=>mq(i,t,e))):i.x=mq(s,t,e)}if(p(e.y)){const s=e.y;y(s)?i.y=s.map((i=>mq(i,t,e))):i.y=mq(s,t,e)}if(p(e.angle)){const s=e.angle;y(s)?i.angle=s.map((i=>mq(i,t,e))):i.angle=mq(s,t,e)}if(p(e.radius)){const s=e.radius;y(s)?i.radius=s.map((i=>mq(i,t,e))):i.radius=mq(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=mq(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const fq={min:(t,e)=>VL(t[0].latestData,e.field),max:(t,e)=>UL(t[0].latestData,e.field),sum:function(t,e){return WL(t[0].latestData,e.field)},average:function(t,e){return GL(t[0].latestData,e.field)},variance:function(t,e){return YL(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(YL(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return dt(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function mq(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(m(t)){const{aggrType:i,field:s}=t;return fq[i](e,{field:s})}return t}function vq(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 _q extends Yz{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){return JD(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_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)&&qK(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){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Ba;return e.registerParser("array",s),new Pa(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)))}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=JL(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){u(this._spec.offsetX)||(this._layoutOffsetX=kR(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=kR(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();cI(this._option.dataSet,"markerAggregation",gq),cI(this._option.dataSet,"markerFilter",vq);const i=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),i.target.on("change",(()=>{this._markerLayout()})),this._markerData=i}}function yq(t,e){return function(t,e,i){const{predict:s}=Ft(t,(t=>t[e]),(t=>t[i])),n=VL(t,e),r=UL(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class bq extends _q{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}=dq(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;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={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},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:oq(qO(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>rq(t,this._markerData,this._markAttributeContext))),state:{line:aq(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:aq(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:aq(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return aq(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return aq(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:oq(qO(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:oq(qO(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||Y(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=nq([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=Y(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,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}=dq(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;cI(this._option.dataSet,"markerAggregation",gq),cI(this._option.dataSet,"markerRegression",yq),cI(this._option.dataSet,"markerFilter",vq);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new Pa(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",(()=>{this._markerLayout()})),this._markerData=m}}bq.specKey="markLine";const xq=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),Sq={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"}}},refY:5},Aq={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:xq(!1),endSymbol:xq(!0),label:Sq};class kq extends bq{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new FP(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:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:_}=dq(e);let y=[];if(u||f||g||m||v||a&&l||a&&h){const t=ZK(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=tq(i,r,d,e.coordinatesOffset):c&&(y=sq(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n;const r=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const n=this._startRelativeSeries,a=this._endRelativeSeries,{multiSegment:o,mainSegmentIndex:l}=this._spec.line||{},{connectDirection:h,expandDistance:c=0}=this._spec;let d;if(SR(c)){const t=n.getRegion(),e=t.getLayoutStartPoint(),i=a.getRegion(),s=i.getLayoutStartPoint();if("bottom"===h||"top"===h){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));d=Number(c.substring(0,c.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));d=Number(c.substring(0,c.length-1))*n/100}}else d=c;const{points:u,limitRect:g}=r;if(!u||u.length<2)return void(null===(t=this._markerComponent)||void 0===t||t.setAttributes(r));const f=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}(u[0],u[1],h,d);let m;m=o&&p(l)?{position:"middle",autoRotate:!1}: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)}:{}}(u[0],u[1],h,d));const v=Y((null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{}).label),_=Y(r.label),y=Y(this._spec.label);null===(s=this._markerComponent)||void 0===s||s.setAttributes({points:o?[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]]]:f,label:_.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=m.dx)&&void 0!==i?i:0,h=null!==(s=m.dy)&&void 0!==s?s:0;const c=null!==(n=y[e])&&void 0!==n?n:y[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),m),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=v[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:g,multiSegment:o,mainSegmentIndex:l,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(n=this._markerComponent)||void 0===n||n.setAttributes(r)}_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}=dq(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 Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&p(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&p(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&p(n.process.xy)){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}}}kq.type=r.markLine,kq.coordinateType="cartesian",kq.builtInTheme={markLine:Aq};class Mq extends bq{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=dq(this._spec);return e||i?new HP(t):new FP(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}=dq(e);let p=[],g={};const f={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=QK(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:f}:{points:p.map((t=>ce(f,t.radius,t.angle)))}}else u&&(p=eq(i,r,a),g={points:p.map((t=>ce(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=dq(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}}}Mq.type=r.polarMarkLine,Mq.coordinateType="polar",Mq.builtInTheme={polarMarkLine:Aq};class Tq extends Yz{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=xR(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return JD(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}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;if(!1===this._spec.visible)return{visible:!1};const a=this.getLayoutRect(),o=kR(this._spec.width,a.width,null,a.width),l=kR(this._spec.maxWidth,a.width,null,a.width),h=Math.max(Math.min(o,l,a.width),0),c=p(this._spec.text)&&""!==this._spec.text,d=p(this._spec.subtext)&&""!==this._spec.subtext,u=Object.assign(Object.assign({},H(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:c?this._spec.text:void 0,subtextType:null!==(e=this._spec.subtextType)&&void 0!==e?e:"text",subtext:d?this._spec.subtext:void 0,x:null!==(i=this._spec.x)&&void 0!==i?i:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:h,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(n=this._spec.align)&&void 0!==n?n:"left",verticalAlign:null!==(r=this._spec.verticalAlign)&&void 0!==r?r:"top",textStyle:Object.assign({maxLineWidth:h},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:h},this._spec.subtextStyle)});if(c&&(u.textStyle.width=h),d&&(u.subtextStyle.width=h),p(this._spec.width)){const t=Math.max(Math.min(o,a.width),0);c?u.textStyle.width=t:delete u.textStyle.width,d&&(u.subtextStyle.width=t)}return u}_createOrUpdateTitleComponent(t){if(this._titleComponent)U(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new uL(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}Tq.type=r.title,Tq.specKey=r.title,Tq.builtInTheme={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"}}}};class wq extends _q{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=uq(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={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:oq(qO(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>rq(t,this._markerData,this._markAttributeContext))),state:{area:aq(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>aq(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return aq(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||Y(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=nq([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=Y(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=Y(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,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}=uq(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}wq.specKey="markArea";const Cq={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"}}}}};class Eq extends wq{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new jP(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=uq(i),d=p(i.positions),u=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=ZK(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=ZK(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=tq(s,a,u,i.coordinatesOffset):d&&(f=sq(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=uq(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}Eq.type=r.markArea,Eq.coordinateType="cartesian",Eq.builtInTheme={markArea:Cq};class Bq extends wq{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=uq(this._spec);return i||e||s?new NP(t):new jP(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}=uq(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=QK(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=eq(i,r,c),u={points:d.map((t=>ce(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=uq(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}}}Bq.type=r.polarMarkArea,Bq.coordinateType="polar",Bq.builtInTheme={polarMarkArea:Cq};const Pq=t=>qO(Object.assign({},t)),Lq=t=>Object.assign(Object.assign({},t),{style:Object.assign({},qO(t.style))}),Rq=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=Pq(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=Pq(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:{},qO(Object.assign({},y)));var y;const b=Lq(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=Lq(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=Lq(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=Lq(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!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:A})});return t.visible||(k.controller.visible=!1,k.slider.visible=!1),k},Oq=t=>"left"===t||"right"===t,Iq=t=>"top"===t||"bottom"===t,Dq={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:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,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:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class Fq extends Yz{constructor(){super(...arguments),this.layoutZIndex=t.LayoutZIndex.Player,this.layoutLevel=t.LayoutLevel.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},Rq(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},Rq(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?U(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new CL(t):this._playerComponent=new PL(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...Y(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...Y(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...Y(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...Y(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=Oq(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=Oq(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this.autoPlayCallback=()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback),this._option.globalInstance.on(t.ChartEvent.rendered,this.autoPlayCallback),this._playerComponent.addEventListener(SL.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(SL.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(SL.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(SL.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(SL.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(SL.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}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),k(t.x)){const e=Oq(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=Iq(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}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):Oq(this._orient)?this._maxSize():t.width}_computeHeight(t){return S(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):Iq(this._orient)?this._maxSize():t.height}_computeDx(t){return Oq(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return Iq(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(e){const i=this._specs[e];this._option.globalInstance.updateFullData(i.data),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})}release(){this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback)}}Fq.builtInTheme={player:Dq},Fq.specKey="player",Fq.type=r.player;class zq extends Yz{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,U(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=cR({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:Y(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==UI.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&u(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}zq.type=r.label;class jq extends MV{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}render(){}}jq.type="text",jq.constructorType="label";const Hq=()=>{TV(),zR.registerMark(jq.constructorType,jq)};class Nq extends Gz{_initTheme(t,e){return{spec:t,theme:this._theme}}}class Vq extends zq{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.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(eI.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(eI.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),qL(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{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),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,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=FR({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},WN(h,r),Object.assign(Object.assign(Object.assign({},H(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[TO])):t=>t.filter((t=>t.data[MO]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?GN(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=y(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=Y(i())[t])}))}return e}}Vq.type=r.label,Vq.specKey="label",Vq.transformerConstructor=Nq;class Uq extends zq{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()}reInit(t){super.reInit(t),this._initTextMark()}_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[AO]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return FR({textStyle:{pickable:!0===this._spec.interactive},position:Wq(t,this._baseMark.type,a),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=>"bottom"===a?t.data[TO]:t.data[MO]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>GN({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function Wq(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}Uq.type=r.totalLabel,Uq.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},Uq.specKey="totalLabel";class Gq extends _q{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=pq(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,f,m,v,_,y,b,x,S,A,k,M,T,w,C,E,B,P,L,R,O;const{itemContent:I={},itemLine:D={},targetSymbol:F={}}=this._spec,z=I,{type:H="text",text:N,symbol:V,image:U,richText:W,customMark:G,textStyle:Y,symbolStyle:$,imageStyle:X,richTextStyle:K,customMarkStyle:q,style:Z={},state:J={}}=z,Q=e(z,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let tt=null,et=null,it={};"text"===H?(tt=null!==(t=null==N?void 0:N.state)&&void 0!==t?t:J,it={dx:0,dy:0},et=rq(Object.assign(Object.assign({},N),{style:j(it,null!==(n=null!==(s=null!==(i=null==N?void 0:N.style)&&void 0!==i?i:null==N?void 0:N.textStyle)&&void 0!==s?s:Y)&&void 0!==n?n:Z)}),this._markerData,this._markAttributeContext)):"richText"===H?(tt=null!==(r=null==W?void 0:W.state)&&void 0!==r?r:J,it={width:100,height:100},et=oq(j(it,null!==(o=null!==(a=null==W?void 0:W.style)&&void 0!==a?a:K)&&void 0!==o?o:Z),this._markerData,this._markAttributeContext)):"symbol"===H?(tt=null!==(l=null==V?void 0:V.state)&&void 0!==l?l:J,it={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},et=qO(oq(j(it,null!==(c=null!==(h=null==V?void 0:V.style)&&void 0!==h?h:$)&&void 0!==c?c:Z),this._markerData,this._markAttributeContext))):"image"===H?(tt=null!==(d=null==U?void 0:U.state)&&void 0!==d?d:J,it={width:80,height:80},et=oq(j(it,null!==(p=null!==(u=null==U?void 0:U.style)&&void 0!==u?u:X)&&void 0!==p?p:Z),this._markerData,this._markAttributeContext)):"custom"===H&&(tt=null!==(g=null==G?void 0:G.state)&&void 0!==g?g:J,et=oq(null!==(m=null!==(f=null==G?void 0:G.style)&&void 0!==f?f:q)&&void 0!==m?m:Z,this._markerData,this._markAttributeContext));const st={zIndex:this.layoutZIndex,interactive:null===(v=this._spec.interactive)||void 0===v||v,hover:null===(_=this._spec.interactive)||void 0===_||_,select:null===(y=this._spec.interactive)||void 0===y||y,position:{x:0,y:0},clipInRange:null!==(b=this._spec.clip)&&void 0!==b&&b,itemContent:Object.assign(Object.assign({type:H,offsetX:lq(I.offsetX,this._relativeSeries.getRegion()),offsetY:lq(I.offsetX,this._relativeSeries.getRegion())},Q),{style:oq(et,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(x=F.offset)&&void 0!==x?x:0,visible:null!==(S=F.visible)&&void 0!==S&&S,size:null!==(A=F.size)&&void 0!==A?A:20,style:oq(F.style,this._markerData,this._markAttributeContext)},state:{line:aq(null!==(M=null===(k=this._spec.itemLine.line)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),lineStartSymbol:aq(null!==(w=null===(T=this._spec.itemLine.startSymbol)||void 0===T?void 0:T.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),lineEndSymbol:aq(null!==(E=null===(C=this._spec.itemLine.endSymbol)||void 0===C?void 0:C.state)&&void 0!==E?E:{},this._markerData,this._markAttributeContext),itemContent:aq(tt,this._markerData,this._markAttributeContext),textBackground:aq(null===(P=null===(B=this._spec.itemContent.text)||void 0===B?void 0:B.labelBackground)||void 0===P?void 0:P.state,this._markerData,this._markAttributeContext),targetItem:aq(null!==(R=null===(L=this._spec.targetSymbol)||void 0===L?void 0:L.state)&&void 0!==R?R:{},this._markerData,this._markAttributeContext)},animation:null!==(O=this._spec.animation)&&void 0!==O&&O,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:nt,line:rt={}}=D,at=e(D,["visible","line"]);st.itemLine=!1!==nt?Object.assign(Object.assign({},at),{visible:!0,lineStyle:qO(rt.style)}):{visible:!1};return new UP(st)}_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}=nq([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:hq(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:hq(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}=pq(t);(p(t.coordinate)||e||i||s)&&this._initCommonDataView()}}Gq.specKey="markPoint";const Yq={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}};class $q extends Gq{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=p(s.x)&&p(s.y),o=p(s.coordinate),l=p(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=ZK(n,r,r,r,h))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=tq(n,r,h,s.coordinatesOffset)[0]:l&&(c=sq(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=pq(t),i=p(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}$q.type=r.markPoint,$q.coordinateType="cartesian",$q.builtInTheme={markPoint:Yq};class Xq extends Gq{constructor(){super(...arguments),this.type=r.polarMarkPoint,this.name=r.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=QK(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:ce({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}])]}}}Xq.type=r.polarMarkPoint,Xq.coordinateType="polar",Xq.builtInTheme={polarMarkPoint:Yq};class Kq extends Gq{constructor(){super(...arguments),this.type=r.geoMarkPoint,this.name=r.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){const t=function(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{p(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}(this._markerData,this._relativeSeries)[0][0];return{point:t}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}Kq.type=r.geoMarkPoint,Kq.coordinateType="geo",Kq.builtInTheme={geoMarkPoint:Yq};const qq="inBrush",Zq="outOfBrush";class Jq extends Yz{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._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return JD(t,this.specKey,this.type,(t=>!1!==t.visible))}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),qq,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),Zq,t.AttributeLevel.Series))}))}))}_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()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){p(this._spec.regionId)||p(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_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)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild()}_shouldEnableInteractive(){return!1!==this.getOption().getCompiler().getOption().interactive}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new IL(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:qO(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),this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(EL.brushActive,(s=>{this._initMarkBrushState(i,Zq),this._emitEvent(t.ChartEvent.brushActive,e,s)})),a.addEventListener(EL.drawStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener(EL.moveStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener(EL.drawing,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener(EL.moving,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener(EL.brushClear,(s=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)})),a.addEventListener(EL.drawEnd,(s=>{var n;this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:r}=s.detail,{updateElementsState:a=!0}=this._spec;if(null===(n=this._spec)||void 0===n?void 0:n.onBrushEnd)!0===this._spec.onBrushEnd(s)?(this.clearGraphic(),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)):(this._spec.onBrushEnd(s),this._emitEvent(t.ChartEvent.brushEnd,e,s));else{const i=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&i.length>0||!a)&&this._setAxisAndDataZoom(r,e),this._emitEvent(t.ChartEvent.brushEnd,e,s)}})),a.addEventListener(EL.moveEnd,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:s}=i.detail,{updateElementsState:n=!0}=this._spec,r=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&r.length>0||n)&&this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e,i)}))}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a],interactive:this._shouldEnableInteractive()}}_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({},qO(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail;this._operateMask=i;const{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e,i){var s;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},vchart:null===(s=this._option)||void 0===s?void 0:s.globalInstance,event:i})}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(i.addState(qq,!0),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(i.removeState(qq),i.addState(Zq,!0),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:_=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(_.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(i.addState(qq,!0),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(i.removeState(qq),i.addState(Zq,!0),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Pe(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;s.removeState(qq),s.removeState(Zq),i&&s.addState(i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_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?"width":"height",p=r?o:h,g=r?l:c;if(this._axisDataZoomMap[t.id]){const i=this._axisDataZoomMap[t.id],s=(p-e.getLayoutStartPoint()[d])/e.getLayoutRect()[u],n=(g-e.getLayoutStartPoint()[d])/e.getLayoutRect()[u],r=this._stateClamp(s-a),o=this._stateClamp(n+a);i.setStartAndEnd(Math.min(r,o),Math.max(r,o),["percent","percent"]),this._zoomRecord.push({operateComponent:i,start:r,end:o,startValue:kK(r,i.stateScale,TK(i.relatedAxisComponent,i.isHorizontal)),endValue:kK(o,i.stateScale,TK(i.relatedAxisComponent,i.isHorizontal))})}else{const i=t.getScale().range(),s=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],r=$(i){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}clearBrushStateAndMask(){this._relativeRegions.forEach(((t,e)=>{this._initMarkBrushState(e,""),this._brushComponents[e].children[0].removeAllChild()}))}}Jq.type=r.brush,Jq.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},Jq.specKey="brush";class Qq extends Yz{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}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;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${lO}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=wF({},CF(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(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)}))),p(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,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 Ne).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Ne;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),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}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}Qq.type=r.customMark,Qq.specKey="customMark";class tZ{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._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=>{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=>eZ(t))),a=n.filter((t=>!eZ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>eZ(t))),h=o.filter((t=>!eZ(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 eZ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}tZ.type="grid";const iZ="vchart-tooltip",sZ=`${iZ}-container`,nZ=`${iZ}-title`,rZ=`${iZ}-content-box`,aZ={offsetX:10,offsetY:10},oZ="99999999999999";function lZ(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const hZ=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,cZ=t=>_(t)&&""!==(null==t?void 0:t.trim())||S(t)?lZ(t):"",dZ=(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},uZ={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},pZ=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=uZ[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class gZ extends bz{constructor(){super(...arguments),this._visible=!0,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._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const _=e.event,{activeType:y,data:b}=t,x="dimension"===y?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:M}=this._option,T=m[y],w=iF(null==T?void 0:T.position,b,e),C=null!==(r=iF(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===y?"mark":"pointer",{width:E=0,height:B=0}=null!=i?i:{},P="canvas"===m.renderMode,L=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==L?void 0:L.width)&&void 0!==o?o:hO,O=null!==(l=null==L?void 0:L.height)&&void 0!==l?l:cO;let I=!1;const D={width:0,height:0};let F,z={x:0,y:0},j={x:0,y:0},H=1,N=1;const V=Yy(this._env);if(V&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=R,D.height=O),V&&!P){const t=this._getParentElement(m);j=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-j.x,y:F.y-j.y},H=hZ(e,F),N=hZ(t,j)}const U=N/H,W={},G={x:w,y:w},Y={x:["left","right"],y:["top","bottom"]},$=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?A:M;if("mark"===i){I=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){I=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(I){const e=Y[n][0],i="x"===n?E:B;switch(pZ(t,n)){case-2:W[e]=a-i*U-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*U/2;break;case-1:W[e]=(a+o)/2-i*U-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*U-c;break;case 2:W[e]=o+c}}},X=["x","y"];if(g(w))if(g(K=w)&&(p(K.left)||p(K.right)||p(K.top)||p(K.bottom))){const{left:t,right:e,top:i,bottom:s}=w;W.left=dZ(t,_),W.top=dZ(i,_),W.right=dZ(e,_),W.bottom=dZ(s,_)}else(t=>g(t)&&(p(t.x)||p(t.y)))(w)&&X.forEach((t=>{const e=w[t];S(e)||d(e)?W[Y[t][0]]=dZ(e,_):$(e,t)}));else p(w)&&($({orient:w,mode:C},"x"),$({orient:w,mode:C},"y"));var K;const q={x:null,y:null};return X.forEach((t=>{var e;const i="x"===t?E:B,s="x"===t?R:O,n="x"===t?A:M,r=pZ(G[t],t);if(k(W[Y[t][0]]))q[t]=W[Y[t][0]];else if(k(W[Y[t][1]]))q[t]=s-i*U-W[Y[t][1]];else{const e="x"===t?_.canvasX:_.canvasY;q[t]=r>0?e+n:0===r?e-i*U/2:e-i*U-n}q[t]*=H,V&&(q[t]+=z[t]),q[t]/=N;const a="x"===t?D.width:D.height,o=m.confine?-(j[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/H)/N:-j[t]/N,l=a/N+o-i;2!==r&&q[t]l&&(q[t]=l)):-2!==r&&q[t]>l&&(I?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",mZ=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=fZ(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=fZ(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},vZ=(t={})=>{const{lineHeight:e}=t;return t.fontSize?kR(e,t.fontSize):0},_Z=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),p(r)&&(o=ai(r),a.padding=fZ(o)),{panelStyle:a,panelPadding:o}};function yZ(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}class bZ extends gZ{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(bZ.type),this.type=mH.dom,this._tooltipContainer=null==Gy?void 0:Gy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(Gy&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:d,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=_Z(l),_={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(_.marginBottom=`${g}px`);const y={width:fZ(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=mZ(h),x=mZ(d),S=mZ(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),u(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),u(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),u(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),y[A]=fZ(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=fZ(null!==(s=d.spacing)&&void 0!==s?s:26),S[A]=fZ(null!==(n=p.spacing)&&void 0!==n?n:0);const M=Math.max(vZ(p),vZ(d));return _.lineHeight=M>0?`${M}px`:"20px",{panelPadding:v,row:_,panel:m,title:b,shape:y,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(nZ))),l=a.find((t=>t.className.includes(rZ)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(nZ),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(yZ(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${iZ}-column`),e.classList.add(`${iZ}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(rZ),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];yZ(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));yZ(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${iZ}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=cZ(e.key),e.keyStyle&&mZ(e.keyStyle,l)):"value"===i?(o.innerHTML=cZ(e.value),e.valueStyle&&mZ(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?lZ(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?lZ(c):m,y=p,b=t=>new Cg({symbolType:t,size:y,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new Ne));let M=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const T=vh.IsGradientStr(u);if(!u||_(u)&&!T||d)return m=d?"none":u?lZ(u):"currentColor",`\n \n \n \n `;const w=T?vh.Parse(u):g(u)?u:null;if(w){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=w.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===w.gradient?t=`\n ${i}\n `:"linear"===w.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),yZ(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(rZ))),h=[...o.children].find((t=>t.className.includes(nZ)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(nZ)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=kR(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,yZ(l,c))}const u=l.children,g=[];if(u){for(let i=0;i{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},ff||(ff=pf.CreateGraphic("richtext",{})),ff.setAttributes(a),ff.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function AZ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:xZ),{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:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const kZ=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};class MZ extends gZ{constructor(){super(MZ.type),this.type=mH.canvas,this._attributes=null}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 HL({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}_getTooltipBoxSize(t,e){var i,s;if(!e||u(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");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:f,valueLabel:m,spaceRow:v,align:_}=l,y=ai(d.padding),b=wR(d.padding),x=AZ(Object.assign({textAlign:"right"===_?"right":"left"},u),i),S=AZ(Object.assign({textAlign:"right"===_?"right":"left"},f),i),A=AZ(m,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:kZ(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,enterable:h,transitionDuration:c,align:_},{title:T={},content:w=[]}=t;let C=b.left+b.right,E=b.top+b.bottom,B=0;const P=!!w.length;let L=0,R=0,O=0,I=0;if(P){const t=[],e=[],i=[],s=[];let n=0;M.content=w.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:M}=r,T={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=FR({},S,AZ(b,void 0,{})),{width:s,height:n,text:r}=SZ(h,i);T.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(m)){const t=FR({},A,AZ(x,void 0,{})),{width:e,height:s,text:n}=SZ(m,t);T.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};M?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,T.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else T.shape={visible:!1};return T.height=o,n+=o,aU.autoWidth&&!1!==U.multiLine;if(j){U=FR({},x,AZ(N,void 0,{})),W()&&(U.multiLine=null===(r=U.multiLine)||void 0===r||r,U.maxWidth=null!==(a=U.maxWidth)&&void 0!==a?a:P?Math.ceil(B):void 0);const{text:t,width:e,height:i}=SZ(H,U);M.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=U.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},U),{text:t}),D=M.title.value.width,F=M.title.value.height,z=F+(P?M.title.spaceRow:0)}return E+=z,M.title.width=D,M.title.height=F,W()?C+=B||D:C+=Math.max(D,B),P&&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-I-L-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})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_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{activeTooltipSpec: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()}}MZ.type=mH.canvas;const TZ=/\{([^}]+)\}/,wZ=/\{([^}]+)\}/g,CZ=/:/;class EZ extends bz{constructor(){super(EZ.type),this.type="formatterPlugin",this._timeModeFormat={utc:mi.getInstance().timeUTCFormat,local:mi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=ki.getInstance().format,this._numericSpecifier=ki.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[EZ.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)),zR.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=TZ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(wZ,((t,i)=>{if(!CZ.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(xi.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):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}EZ.pluginType="chart",EZ.specKey="formatter",EZ.type="formatterPlugin";YD.useRegisters([()=>{xH(),AH(),MH(),Jj(),Zj(),Dj(),wj(),hz(),dz(),ID(),LD(),bj(),mj(),zR.registerSeries(Fj.type,Fj),zR.registerChart(TH.type,TH)},()=>{xH(),AH(),MH(),Zj(),Dj(),wj(),hz(),EH(),dz(),LH(),bj(),mj(),zR.registerSeries(OH.type,OH),Jj(),zR.registerChart(DH.type,DH)},()=>{xH(),AH(),MH(),Zj(),qH(),Jj(),zR.registerChart(JH.type,JH)},()=>{xH(),AH(),Jj(),Zj(),lN(),zR.registerChart(cN.type,cN)},()=>{AH(),rU(),zR.registerChart(Q$.type,Q$)},()=>{xH(),AH(),Jj(),Zj(),AU(),zR.registerChart(iX.type,iX)},()=>{xH(),AH(),MH(),Jj(),Zj(),LU(),zR.registerChart(nX.type,nX)},()=>{xH(),AH(),MH(),Jj(),Zj(),qH(),zR.registerTransform("bin",Kr),zR.registerChart(cX.type,cX)},()=>{AH(),MN(),fN(),zR.registerSeries(wN.type,wN),zR.registerImplement("registerMap",fI),zR.registerImplement("unregisterMap",mI),RD(),zR.registerChart($$.type,$$)},()=>{AH(),d$(),zR.registerSeries(p$.type,p$),QV(),$U(),yU(),qU(),zR.registerChart(gX.type,gX)},()=>{AH(),zG(),zR.registerChart(vX.type,vX)},()=>{AH(),nY(),zR.registerChart(yX.type,yX)},()=>{xH(),AH(),MH(),Jj(),Zj(),iV(),zR.registerChart(PX.type,PX)},()=>{xH(),AH(),Jj(),Zj(),kV(),zR.registerTransform("boxplot",qr),zR.registerChart(RX.type,RX)},()=>{xH(),AH(),Jj(),Zj(),qU(),zR.registerChart(uX.type,uX)},()=>{xH(),AH(),Jj(),Zj(),sW(),zR.registerChart(xX.type,xX)},()=>{xH(),AH(),Jj(),Zj(),IV(),zR.registerChart(AX.type,AX)},()=>{xH(),AH(),MH(),Jj(),Zj(),EH(),bj(),mj(),zR.registerSeries(HV.type,HV),zR.registerChart(FX.type,FX)},()=>{AH(),SY(),zR.registerChart(MX.type,MX)},()=>{AH(),CY(),zR.registerChart(wX.type,wX)},()=>{AH(),e$(),zR.registerChart(EX.type,EX)},()=>{AH(),xo.load(vM),$Y(),zR.registerChart(IX.type,IX)},()=>{AH(),b$(),zR.registerChart(jX.type,jX)},()=>{AH(),R$(),zR.registerChart(NX.type,NX)},()=>{xH(),AH(),MH(),Jj(),zR.registerChart(aX.type,aX),Zj()},mj,bj,()=>{zR.registerGraphicComponent($z.lineAxis,((t,e)=>new CC(t,e))),zR.registerGraphicComponent(Xz.lineAxisGrid,((t,e)=>new zB(t,e))),Qz(),zR.registerComponent(xj.type,xj)},()=>{zR.registerGraphicComponent($z.lineAxis,((t,e)=>new CC(t,e))),zR.registerGraphicComponent(Xz.lineAxisGrid,((t,e)=>new zB(t,e))),Qz(),zR.registerComponent(Sj.type,Sj)},()=>{zR.registerGraphicComponent($z.lineAxis,((t,e)=>new CC(t,e))),zR.registerGraphicComponent(Xz.lineAxisGrid,((t,e)=>new zB(t,e))),Qz(),zR.registerComponent(Aj.type,Aj)},xU,yU,()=>{zR.registerComponent(YX.type,YX)},()=>{zR.registerComponent(sK.type,sK)},()=>{zR.registerComponent(pK.type,pK)},()=>{zR.registerComponent(yK.type,yK)},()=>{zR.registerComponent(bK.type,bK)},()=>{zR.registerComponent(IK.type,IK)},()=>{zR.registerComponent(FK.type,FK)},()=>{zR.registerComponent(NK.type,NK)},MN,()=>{zR.registerComponent(kq.type,kq),DP()},()=>{zR.registerComponent(Eq.type,Eq),zP()},()=>{zR.registerComponent($q.type,$q),VP()},()=>{zR.registerComponent(Mq.type,Mq),HP._animate=vP,DP()},()=>{zR.registerComponent(Bq.type,Bq),NP._animate=yP,zP()},()=>{zR.registerComponent(Xq.type,Xq),VP()},()=>{zR.registerComponent(Kq.type,Kq),VP()},()=>{zR.registerComponent(Tq.type,Tq)},()=>{zR.registerComponent(Fq.type,Fq)},()=>{zR.registerGraphicComponent(Vq.type,(t=>new OB(t))),Hq(),qz(),zR.registerComponent(Vq.type,Vq,!0,1/0)},()=>{zR.registerGraphicComponent(Uq.type,(t=>new OB(t))),Hq(),qz(),zR.registerComponent(Uq.type,Uq,!0)},()=>{zR.registerComponent(Jq.type,Jq)},()=>{zR.registerComponent(Qq.type,Qq)},()=>{xo.load(aT)},()=>{zR.registerLayout(tZ.type,tZ)},()=>{var t;t=MZ,zR.registerComponentPlugin(t.type,t)},()=>{var t;t=EZ,zR.registerChartPlugin(t.type,t)},ND,WD]),YD.useRegisters([()=>{GS(xo)}]),t.DEFAULT_CHART_HEIGHT=cO,t.DEFAULT_CHART_WIDTH=hO,t.DEFAULT_CLOSE_STROKE_JOIN=KD,t.DEFAULT_DATA_INDEX=uO,t.DEFAULT_DATA_KEY=pO,t.DEFAULT_DATA_SERIES_FIELD=gO,t.DEFAULT_KEY=RO,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=XD,t.DEFAULT_MAP_LOOK_UP_KEY=OO,t.DEFAULT_MEASURE_CANVAS_ID=dO,t.DEFAULT_SERIES_STYLE_NAME=fO,t.DEFAULT_SMOOTH_INTERPOLATE=$D,t.Factory=zR,t.MOSAIC_CAT_END_PERCENT=BO,t.MOSAIC_CAT_START_PERCENT=EO,t.MOSAIC_VALUE_END_PERCENT=CO,t.MOSAIC_VALUE_START_PERCENT=wO,t.ManualTicker=class extends hw{constructor(t){super(t),this.lastFrameTime=0,this.status=Ro.RUNNING}setupTickHandler(){const t=new cw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===Ro.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Ro.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Ro.RUNNING,!0}},t.PREFIX=lO,t.SEGMENT_FIELD_END=LO,t.SEGMENT_FIELD_START=PO,t.STACK_FIELD_END=_O,t.STACK_FIELD_END_OffsetSilhouette=SO,t.STACK_FIELD_END_PERCENT=bO,t.STACK_FIELD_KEY=mO,t.STACK_FIELD_START=vO,t.STACK_FIELD_START_OffsetSilhouette=xO,t.STACK_FIELD_START_PERCENT=yO,t.STACK_FIELD_TOTAL=AO,t.STACK_FIELD_TOTAL_BOTTOM=TO,t.STACK_FIELD_TOTAL_PERCENT=kO,t.STACK_FIELD_TOTAL_TOP=MO,t.StreamLight=class extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=Ao.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Wl,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=Ao.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_;const y=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(y){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:qo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(_=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==_?_:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:qo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=cl(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=cl(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;e{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,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize: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=this.options.createCanvas({width:1,height:1}),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 f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),_=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*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],B=(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--;)B(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}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=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,e=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){this.grid=[];const e=this.options.shape;if(g(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?PG(t,o,l.width,l.height,h):"geometric"===t.type&&OG(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!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)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,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}=yG(this.options.shape,[e.width,e.height]);return 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),this.result=[],this.progressiveRun()}};IG.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class DG extends AG{constructor(t){super(j({},DG.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,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)}DG.defaultOptions={enlarge:!1};const zG={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},jG=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return ot.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?HG(t.fontFamily):"sans-serif",d=t.fontStyle?HG(t.fontStyle):"normal",u=t.fontWeight?HG(t.fontWeight):"normal",p=t.rotate?HG(t.rotate):0,g=HG(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?HG(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?Object.assign(Object.assign({},zG),t.as):zG,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?HG(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=NG(UG(t,l),C);w=i=>e(t(i))}let E=MG;"fast"===t.layoutType?E=DG:"grid"===t.layoutType&&(E=IG);const B=new E(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:w,shrink:_,clip:b,enlarge:y,minFontSize:x,random:A,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:B}:B.output()},HG=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],VG=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),NG=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=VG(t[0]),n=VG(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(VG(t)-r)/(a-r)*(e[1]-e[0])+e[0]},UG=(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 WG(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{YR.registerGrammarTransform("wordcloud",{transform:jG}),ON(),YR.registerAnimation("wordCloud",((t,e)=>({appear:SW(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:FD.disappear.duration}}))),YR.registerSeries(GG.type,GG)},$G=(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:f=!1,isCone:m=!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===f?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?m?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},XG=(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},KG=`${mO}_FUNNEL_TRANSFORM_RATIO`,qG=`${mO}_FUNNEL_REACH_RATIO`,ZG=`${mO}_FUNNEL_HEIGHT_RATIO`,JG=`${mO}_FUNNEL_VALUE_RATIO`,QG=`${mO}_FUNNEL_LAST_VALUE_RATIO`,tY=`${mO}_FUNNEL_NEXT_VALUE_RATIO`,eY=`${mO}_FUNNEL_LAST_VALUE`,iY=`${mO}_FUNNEL_CURRENT_VALUE`,sY=`${mO}_FUNNEL_NEXT_VALUE`,nY=`${mO}_FUNNEL_TRANSFORM_LEVEL`;class rY extends fF{constructor(t){var e,i;super(t),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)?this._transformRatioText: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[qG])).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 this._transformRatioText;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]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class aY extends CD{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class oY extends aY{constructor(){super(...arguments),this.type=oY.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}oY.type="polygon";const lY=()=>{YR.registerMark(oY.type,oY),Jk(),Yk(),pw.registerBuiltInAnimate("growPointsOut",cC),YR.registerGraphicComponent("polygon",cf)},hY=Object.assign(Object.assign({},wF),{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"}});class cY extends UF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class dY extends WF{constructor(){super(...arguments),this.type=cR.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=cY,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,i,s,n;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._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;_I(this._dataSet,"funnel",$G),_I(this._dataSet,"funnelTransform",XG);const t=new Pa(this._dataSet,{name:`${mO}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new AD(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}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:iY,asTransformRatio:KG,asReachRatio:qG,asHeightRatio:ZG,asValueRatio:JG,asNextValueRatio:tY,asLastValueRatio:QG,asLastValue:eY,asNextValue:sY,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:nY}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},dY.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:jF(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},dY.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),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(dY.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(dY.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new rY(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(){var e,i,s,n;const r=this._funnelMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const a=this._funnelTransformMark;a&&this.setMarkStyle(a,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const o=this._funnelOuterLabelMark.label;o&&(this.setMarkStyle(o,{text:t=>`${t[this.getCategoryField()]}`,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),width:0,height:0},"normal",t.AttributeLevel.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(o,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",t.AttributeLevel.User_Mark));const l=this._funnelOuterLabelMark.line;if(l&&o){this.setMarkStyle(l,{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);const r=null!==(s=null===(i=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.line)||void 0===i?void 0:i.visible)&&void 0!==s?s:null===(n=this._spec.outerLabel)||void 0===n?void 0:n.visible;p(r)&&l.setVisible(r)}}initLabelMarkStyle(e){var i;if(!e)return;const s=e.getTarget(),n=e.getComponent();if(s===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);const s=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&jy(s,this._funnelOuterLabelMark.label,n),this._funnelOuterLabelMark.line&&jy(s,this._funnelOuterLabelMark.line,null!==(i=this._funnelOuterLabelMark.label)&&void 0!==i?i:n)}else this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*oR(qG).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(IF(null===(s=YR.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.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),DF("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(IF(YR.getAnimationInKey("fadeInOut")(),DF(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(IF(YR.getAnimationInKey("funnel")({},o),DF(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(IF(null===(a=YR.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),DF("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[QG])/2:this._getSecondaryAxisLength(t[JG])/2,n=this._getSecondaryAxisLength(t[JG])/2):(s=this._getSecondaryAxisLength(t[JG])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[tY])/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[nY])}_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[xO]===t[xO]));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,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,_,y;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h: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!==f.alignLabel?(null==u?void 0:u.y2)+e:_-e,m=this._getPolygonCenter(i).x,_-y{lY(),ON(),GV(),YR.registerSeries(dY.type,dY),YR.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},jD))),YR.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Yw,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),VD()},pY=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},gY=t=>{const e=t.filter((t=>t.context.diffState===ZI.update)),i=K(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},fY=(t,e,i)=>{if(P(t))return[e,i];const s=K(t.map((t=>1*t.getFinalAttribute().startAngle))),n=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},mY=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=gY(i.parent.children),a=fY(r,s,n);return pY(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=gY(i.parent.children),a=fY(r,s,n);return pY(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),vY=t=>{const e=K(t.map((t=>1*t.getFinalAttribute().startAngle))),i=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},_Y=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=gY(i.parent.children),a=vY(r);return pY(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=gY(i.parent.children),a=vY(r);return pY(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),yY=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},bY=(t,e={})=>{if(!t)return[];const i=[];return TW(t,i,e),i},xY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new tG(i).layout(t,{width:s,height:n})};class SY extends fF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var AY;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(AY||(AY={}));const kY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===AY.DrillDown){return Y(JO(t,n,s,"children"))}if(i.type===AY.DrillUp){const e=QO(t,n,s,"children");if(e)return Y(e)}return t};class MY{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=CV(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;_I(t,"drillFilter",kY),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)||P(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:AY.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:AY.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)||P(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:AY.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:AY.DrillUp},model:this}),r}}const TY=Object.assign(Object.assign({},wF),{sunburst:{name:"sunburst",type:"arc"}}),wY=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:bF,operations:["max","min","values"]}),t.push({key:xF,operations:["values"]}),t),CY={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,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"}}}};class EY extends KN{constructor(){super(...arguments),this.type=cR.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:xF),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:xO},getRawData:()=>this.getRawData()}),this._startAngle=oe(this._spec.startAngle),this._endAngle=oe(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),_I(this._dataSet,"sunburstLayout",xY),_I(this._dataSet,"flatten",bY),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 wY(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(_I(t.dataSet,"addVChartProperty",lF),t.transform({type:"addVChartProperty",options:{beforeCall:MF.bind(this),call:TF}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(EY.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_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()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(EY.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new SY(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(IF(null===(e=YR.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),DF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(IF(null===(e=YR.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),DF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),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]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}EY.type=cR.sunburst,EY.mark=TY,EY.builtInTheme={sunburst:CY},G(EY,MY);const BY=()=>{YR.registerSeries(EY.type,EY),oU(),ON(),VD(),YR.registerAnimation("sunburst",((t,e)=>({appear:yY(0,e),enter:mY(t),exit:_Y(t),disappear:{duration:FD.disappear.duration}})))},PY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new NW(i).layout(t,{width:s,height:n})};class LY extends fF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const RY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},OY=Object.assign(Object.assign({},wF),{circlePacking:{name:"circlePacking",type:"arc"}});class IY extends $F{constructor(){super(...arguments),this.type=cR.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:xF),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:xO},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),_I(this._dataSet,"circlePackingLayout",PY),_I(this._dataSet,"flatten",bY),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,valueField:this._valueField,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)||(_I(t.dataSet,"addVChartProperty",lF),t.transform({type:"addVChartProperty",options:{beforeCall:MF.bind(this),call:TF}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(IY.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_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},t.STATE_VALUE_ENUM.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(IY.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"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return wY(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new LY(this),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(IF(null===(i=YR.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),DF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(IF(null===(e=YR.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),DF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}IY.type=cR.circlePacking,IY.mark=OY,IY.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,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"}}}}},G(IY,MY);const DY=()=>{YR.registerSeries(IY.type,IY),oU(),ON(),HD(),YR.registerAnimation("circlePacking",((t,e)=>({appear:RY(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:FD.disappear.duration}})))},FY=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&FY(t,e.children,i)}))},zY=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},jY=(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 ZW(e),r=[];return r.push(n.layout(s,i)),r},HY=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:[]},VY=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 NY extends fF{constructor(){super(...arguments),this._getDimensionData=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},this.markTooltipValueCallback=t=>t.value}}const UY=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),WY=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:UY(t),GY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class YY extends kw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class $Y extends kw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const XY=(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,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=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}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},KY=(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,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=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}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class qY extends fN{constructor(){super(...arguments),this.type=qY.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?KY:XY,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}qY.type="linkPath";const ZY=Object.assign(Object.assign({},wF),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class JY extends UF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const QY=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&t.removeState(e),t.addState(e,s,n)};class t$ extends $F{constructor(){super(...arguments),this.type=cR.sankey,this.transformerConstructor=JY,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new Ve,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;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(p(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var e,i;if(!this._needClear)return;const s=null===(e=this._nodeMark)||void 0===e?void 0:e.getGraphics();if(!s||!s.length)return;const n=null===(i=this._linkMark)||void 0===i?void 0:i.getGraphics();n&&n.length&&(s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),n.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._needClear=!1)},this._handleNodeAdjacencyClick=e=>{const i=aI(e),s=[i.key];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,n)=>{const r=aI(e);r.source===i.key?(s.includes(r.target)||s.push(r.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):r.target===i.key?(s.includes(r.source)||s.push(r.source),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleLinkAdjacencyClick=e=>{const i=aI(e),s=[i.source,i.target];if(this._linkMark){const i=this._linkMark.getGraphics();if(!i||!i.length)return;i.forEach((i=>{i===e?(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),QY(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1})):(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),i.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleNodeRelatedClick=e=>{var i;const s=aI(e),n=this._nodeMark.getGraphics();if(!n||!n.length)return;const r=this._linkMark.getGraphics();if(!r||!r.length)return;const a=(null===(i=aI(r[0]))||void 0===i?void 0:i.parents)?"parents":"source";if("source"===a){const e=[s.key],i=[];if(r.forEach(((t,r)=>{var a,o,l,h;const c=aI(t),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(s.key)){if(i.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||i.push(null!==(o=c.key)&&void 0!==o?o:c.index),e.includes(c.source)||e.push(c.source),!e.includes(c.target)){e.push(c.target);let t=n.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.target))){e.push(t.target);const i=n.find((e=>e.data[0].key===t.target));s.push(i.data[0].targetLinks)}})),void(t=s)}}}else if(c.target===s.key&&(i.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||i.push(null!==(h=c.key)&&void 0!==h?h:c.index),!e.includes(c.source))){e.push(c.source);let t=n.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.source))){e.push(t.source);const i=n.find((e=>e.data[0].key===t.source));s.push(i.data[0].targetLinks)}})),void(t=s)}}})),this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,s)=>{var n;const r=aI(e);i.includes(null!==(n=r.key)&&void 0!==n?n:r.index)?(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}else{const e=[s.key],i=s.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const i=e.parents,n=i.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);r.forEach(((n,r)=>{const o=aI(n),l=o.datum,h=l?l.filter((t=>t[a].some((t=>t.key===s.key)))):null,c=i.find((t=>t.source===o.source&&t.target===o.target));if(h&&h.length){e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target);const i=h.reduce(((t,e)=>t+e.value),0),s=i/o.value;return n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void QY(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:s})}if(c)return e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target),n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void QY(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:c.value/o.value});n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),n.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}this._needClear=!0},this._handleLinkRelatedClick=e=>{const i=this._nodeMark.getGraphics();if(!i||!i.length)return;const s=this._linkMark.getGraphics();if(!s||!s.length)return;if("source"===(aI(e)?"parents":"source"))this._linkMark&&s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&i.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)}));else{const n=aI(e),r=[n.source,n.target],a=[];Y(n.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));a.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=r:a.push({source:i,target:n,value:r})}})),s.forEach((e=>{const i=aI(e),s=i.datum;if(i.source===n.source&&i.target===n.target)return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void QY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1});const o=s?s.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(n.source)&&e.includes(n.target)})):null;if(o&&o.length){r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target);const s=o.filter((t=>t.parents.some(((e,i)=>{var s;return e.key===n.source&&(null===(s=t.parents[i+1])||void 0===s?void 0:s.key)===n.target})))).reduce(((t,e)=>t+e.value),0),a=s/i.value;return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void QY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:a})}const l=a.find((t=>t.source===i.source&&t.target===i.target));if(l)return r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void QY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:l.value/i.value});e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(i,r)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}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:this._spec.categoryField)}initData(){var e,i,s,n;super.initData();const r=this.getViewData(),a=this.getRawData();if(a&&r){_I(this._dataSet,"sankeyLayout",jY),_I(this._dataSet,"sankeyFormat",zY),a.transform({type:"sankeyFormat"},!1),r.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.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(e=this._spec.nodeAlign)&&void 0!==e?e:"justify",nodeGap:null!==(i=this._spec.nodeGap)&&void 0!==i?i:8,nodeWidth:null!==(s=this._spec.nodeWidth)&&void 0!==s?s:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(n=this._spec.minNodeHeight)&&void 0!==n?n:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,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,inverse:this._spec.inverse},level:t.TransformLevel.sankeyLayout});const{dataSet:o}=this._option;_I(o,"sankeyNodes",HY),_I(o,"flatten",bY);const l=new Pa(o,{name:`sankey-node-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyNodes"}),l.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),l.transform({type:"addVChartProperty",options:{beforeCall:AF.bind(this),call:kF}},!1),this._nodesSeriesData=l,_I(o,"sankeyLinks",VY);const h=new Pa(o,{name:`sankey-link-${this.id}-data`});h.parse([this.getViewData()],{type:"dataview"}),h.transform({type:"sankeyLinks"}),h.transform({type:"addVChartProperty",options:{beforeCall:AF.bind(this),call:kF}},!1),this._linksSeriesData=h}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(t$.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(t$.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,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()}_initNodeMarkStyle(){var e,i;const s=this._nodeMark;s&&(this.setMarkStyle(s,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Mark),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.node.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByNode},"normal",t.AttributeLevel.User_Mark))}_initLinkMarkStyle(){var e,i;const s=this._linkMark;s&&(s.setGlyphConfig({direction:this.direction}),this.setMarkStyle(s,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.link.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByLink},"normal",t.AttributeLevel.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=rF(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={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;this._nodeMark&&this._nodeMark.setAnimationConfig(IF(null===(i=YR.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),DF("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(IF(null===(s=YR.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),DF("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:pI.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(e,i){e&&e.length&&e.forEach((e=>{e.removeState([t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]),i.includes(aI(e).key)?e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0):e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new NY(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_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&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new AR;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_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 FY(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),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]}getMarkData(t){return t.datum?y(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}t$.type=cR.sankey,t$.transformerConstructor=JY,t$.mark=ZY,t$.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const e$=()=>{JH(),mN(),Wk(),YR.registerGraphicComponent("path",(t=>tf(t))),YR.registerMark(qY.type,qY),ON(),YR.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:WY(t,e)},jD))),YR.registerAnimation("sankeyLinkPath",((t,e)=>({appear:GY(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:FD.disappear.duration}}))),pw.registerBuiltInAnimate("linkPathGrowOut",$Y),pw.registerBuiltInAnimate("linkPathGrowIn",YY),VD(),YR.registerSeries(t$.type,t$)},i$=(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=bY(n);return i=vF([{latestData:r}],e),i};class s$ extends fF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const n$=Object.assign(Object.assign({},wF),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),r$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class a$ extends UF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const o$=(t,e)=>{if(e.getViewBox()){const i=new nG(e).layout(t,e.getViewBox()),s=[];return TW(i,s,{maxDepth:null==e?void 0:e.maxDepth}),s.forEach(((t,i)=>{t&&[xF,"name"].forEach((i=>{t[i]=t.datum[t.depth][e.nameField]}))})),s}return[]};class l$ extends $F{constructor(){super(...arguments),this.type=cR.treemap,this.transformerConstructor=a$,this._categoryField="name",this._valueField="value",this._viewBox=new Ve,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:xF),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new We),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:xO},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,s,n;super.initData(),_I(this._dataSet,"treemap",o$),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{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}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(_I(this._rawData.dataSet,"addVChartProperty",lF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:MF.bind(this),call:TF}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=i$([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=j(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){_I(this._dataSet,"hierarchyDimensionStatistics",i$),_I(this._dataSet,"flatten",bY);const i=new Pa(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 wY(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(l$.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(l$.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}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()},t.STATE_VALUE_ENUM.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()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRichStyleOfLabelMark(e){"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(IF(null===(e=YR.getAnimationInKey("treemap"))||void 0===e?void 0:e(),DF(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 s$(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(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(hI.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(hI.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}l$.type=cR.treemap,l$.mark=n$,l$.builtInTheme={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"}}}},l$.transformerConstructor=a$,G(l$,MY),G(l$,BV);const h$=()=>{YR.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),YR.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),JH(),ON(),YR.registerAnimation("treemap",((t,e)=>({appear:r$(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:FD.disappear.duration}}))),VD(),YR.registerSeries(l$.type,l$)},c$=Object.assign(Object.assign({},qU),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),d$=Object.assign(Object.assign({},wF),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),u$={type:"fadeIn"};function p$(t,e){return"fadeIn"===e?u$:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class g$ extends UF{constructor(){super(...arguments),this._supportStack=!1}}class f$ extends fF{enableByType(t){return"dimension"!==t}}const m$="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",v$={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:m$,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:m$,fill:"#ddd"}}};class _$ extends ZU{constructor(){super(...arguments),this.type=cR.gaugePointer,this.transformerConstructor=g$,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(_$.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},_$.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(_$.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(){this._tooltipHelper=new f$(this),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=K(e),n=_t(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})}getInteractionTriggers(){return 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(IF(null===(i=YR.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),DF("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}_$.type=cR.gaugePointer,_$.mark=d$,_$.builtInTheme={gaugePointer:v$},_$.transformerConstructor=g$;const y$=()=>{YR.registerSeries(_$.type,_$),AV(),JH(),YR.registerAnimation("gaugePointer",((t,e)=>{const i=p$(t,e);return{appear:i,enter:i,disappear:{duration:FD.disappear.duration}}})),EU(),wU()};class b$ extends UF{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class x$ extends ZU{constructor(){super(...arguments),this.type=cR.gauge,this.transformerConstructor=b$,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=oe(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();_I(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[HO]=t[this._angleField[0]],t[jO]=e>0?i[e-1][HO]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(x$.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(x$.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})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e&&"segment"===e.name){const i=this.getSpec().segment;if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}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),s=bt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?TR(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=bt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?TR(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return p(t[jO])?this.angleAxisHelper.dataToPosition([t[jO]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[HO]])}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(IF(null===(i=YR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),DF("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}x$.type=cR.gauge,x$.mark=c$,x$.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},x$.transformerConstructor=b$;class S$ extends CD{constructor(){super(...arguments),this.type=S$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Eg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="rect":a.symbolType=o,a}}S$.type="cell";function A$(t){return!1===t?{}:{type:"fadeIn"}}class k$ extends fF{enableByType(t){return"dimension"!==t}}const M$=Object.assign(Object.assign({},wF),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class T$ extends UF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class w$ extends $F{constructor(){super(...arguments),this.type=cR.heatmap,this.transformerConstructor=T$}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(w$.mark.cell,{isSeriesMark:!0},{morph:jF(this._spec,w$.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(w$.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){var e,i,s;t&&this.setMarkStyle(t,{fill:null!==(s=null===(i=null===(e=this._spec.cell)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s: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=ai(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]}}getInteractionTriggers(){return 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=YF(this);this._cellMark.setAnimationConfig(IF(null===(i=YR.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),DF("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 k$(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}w$.type=cR.heatmap,w$.mark=M$,w$.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1},label:{style:{lineWidth:2}}}},w$.transformerConstructor=T$;const C$=()=>{ON(),YR.registerMark(S$.type,S$),YR.registerGraphicComponent("symbol",Eg),Jk(),tM(),kB(),YR.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},jD),{appear:A$(e)}))),Cj(),kj(),YR.registerSeries(w$.type,w$)},E$=Object.assign(Object.assign({},wF),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),B$=`${mO}_CORRELATION_X`,P$=`${mO}_CORRELATION_Y`,L$=`${mO}_CORRELATION_SIZE`,R$=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,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=oe(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=oe(null!==(s=e.endAngle)&&void 0!==s?s:270),A=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),k=Lt(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=Lt(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+Lt(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+Lt(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=Pt(e.field),C=t.map(w),[E,B]=Ot(C),P=E===B?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(B-E),L=u(e.radiusField)?w:Pt(e.radiusField),R=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=>R;if(L){const[i,s]=L!==w?Ot(t.map(L)):[E,B],n=null!==(f=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==f?f:5,r=null!==(v=null===(m=e.radiusRange)||void 0===m?void 0:m[1])&&void 0!==v?v:5;i!==s&&(O=t=>n+(r-n)*(L(t)-i)/(s-i))}const I=Math.min(b,x),D=Math.max(b,x),F=O$(I,D,t.length),z=[],j=(D-I)/60;return t.forEach(((t,e)=>{const i=P(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),I$({x:n,y:r,size:s},z)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=j,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},I$=(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,[bO]:null==n?void 0:n[bO],[SO]:null==n?void 0:n[SO]}};class F$ extends fN{constructor(){super(...arguments),this.type=F$.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=_t(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}F$.type="ripple";const z$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class j$ extends UF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class H$ extends KN{constructor(){super(...arguments),this.type=cR.correlation,this.transformerConstructor=j$,this._viewBox=new Ve}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;_I(this._dataSet,"correlation",R$);const s=new Ba;yI(s,"dataview",wa),_I(s,"correlationCenter",D$);const n=new Pa(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 AD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_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(){const e=this._createMark(H$.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:bO});e&&(e.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._nodePointMark=e);const i=this._createMark(H$.mark.ripplePoint,{key:bO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(this._ripplePointMark=i);const s=this._createMark(H$.mark.centerPoint,{key:bO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});s&&(s.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._centerPointMark=s)}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[B$],y:t=>t[P$],size:t=>t[L$],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.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)},t.STATE_VALUE_ENUM.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(IF(null===(e=YR.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),DF("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(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}H$.type=cR.correlation,H$.mark=E$,H$.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},H$.transformerConstructor=j$;const V$=()=>{yz(),mN(),tM(),YR.registerMark(F$.type,F$),YR.registerGraphicComponent("symbol",(t=>Eg(t))),YR.registerSeries(H$.type,H$),YR.registerAnimation("correlation",((t,e)=>Object.assign({appear:z$(0,e)},zD)))},N$=Object.assign(Object.assign({},wF),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class U$ extends fN{constructor(){super(...arguments),this.type=U$.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}U$.type="liquid";const W$=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class G$ extends fF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class Y$ extends WF{constructor(){super(...arguments),this.type=cR.liquid,this.transformerConstructor=bz,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Dg({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Eg({x:s,y:n,size:r,symbolType:W$(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=IR(this._spec.outlineMargin),this._paddingSpec=IR(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Yt(...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(Y$.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(Y$.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(Y$.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(Y$.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.created(),this.setMarkStyle(e,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new G$(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(IF(null===(i=YR.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),DF("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(IF(null===(s=YR.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),DF("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=kM(t.attribute.fill,n.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]}}Y$.type=cR.liquid,Y$.mark=N$,Y$.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},Y$.transformerConstructor=bz;const $$=t=>Y(t).join(",");class X$ extends fF{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>$$(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>$$(null==t?void 0:t[this.series.getDimensionField()[0]])}}const K$=Object.assign(Object.assign({},wF),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class q$ extends UF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const Z$=(t,e)=>{const i=e.getViewBox();return i&&(null==t?void 0:t.length)?mG(Object.assign({setField:e.setField,valueField:e.valueField},i),t):[]};class J$ extends WF{constructor(){super(...arguments),this.type=cR.venn,this.transformerConstructor=q$,this._viewBox=new Ve}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:xO)}initData(){var t;super.initData(),_I(this._dataSet,"venn",Z$),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:{getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField}})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(J$.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(J$.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()},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},t.STATE_VALUE_ENUM.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=>$$(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)}},t.STATE_VALUE_ENUM.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=>$$(t.sets)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new X$(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(){super.onLayoutEnd(),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:$$(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return $$(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[$$(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($$(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(IF(null===(e=YR.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),DF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(IF(null===(e=YR.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),DF(t.name,this._spec,this._markAttributeContext)))}))}}J$.type=cR.venn,J$.mark=K$,J$.builtInTheme={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"}}}}},J$.transformerConstructor=q$;class Q$ extends sV{constructor(){super(...arguments),this.type=cR.mosaic,this.transformerConstructor=iV}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(DO),this.setFieldX2(IO)),this.setFieldY(zO),this.setFieldY2(FO)):(t&&(this.setFieldY(DO),this.setFieldY2(IO)),this.setFieldX(zO),this.setFieldX2(FO)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&u(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];u(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}Q$.type=cR.mosaic,Q$.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},Q$.transformerConstructor=iV;class tX extends Zj{_isValidSeries(t){return t===cR.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class eX extends Kj{constructor(){super(...arguments),this.transformerConstructor=tX,this.type="map",this.seriesType=cR.map}}eX.type="map",eX.seriesType=cR.map,eX.transformerConstructor=tX;class iX extends Zj{_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,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],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 sX extends iX{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_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=Lz(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,GR({},s,l)),n&&Object.assign(o,GR({},n,o))}}class nX extends iX{needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}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 rX extends iX{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class aX extends Kj{constructor(){super(...arguments),this.transformerConstructor=rX}}aX.transformerConstructor=rX;class oX extends aX{constructor(){super(...arguments),this.transformerConstructor=rX,this.type="pie",this.seriesType=cR.pie}}oX.type="pie",oX.seriesType=cR.pie,oX.transformerConstructor=rX;class lX extends nX{_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return n.radius=null!==(e=t.radius)&&void 0!==e?e:Xz,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:Xz,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}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=>GR({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const hX=(t,e)=>{if(!t)return null;const i=oz(t,(t=>"angle"===t.getOrient()),e),s=oz(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&UC(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=eR({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=K(e),n=X(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=iR(d),f=null===(e=s[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 _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=rz(v,t,"polar",r);n.push({index:_,value:v,position:i.scale(v),axis:t,data:y})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&UC(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=eR({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=iR(c),g=null===(e=i[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=s.invert(p);if(u(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const _=rz(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:_})}})),n.length?n:null};class cX extends Kj{constructor(){super(...arguments),this.transformerConstructor=lX,this.type="rose",this.seriesType=cR.rose}_setModelOption(){this._modelOption.getDimensionInfo=hX}}cX.type="rose",cX.seriesType=cR.rose,cX.transformerConstructor=lX,G(cX,iH);class dX extends nX{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t);return i.line=t.line,i.point=t.point,i.stack=t.stack,i.percent=t.percent,i.area=GR({visible:!1},t.area),i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"area",i.activePoint=t.activePoint,i.pointDis=t.pointDis,i.pointDisMul=t.pointDisMul,i.markOverlap=t.markOverlap,i}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=>GR({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class uX extends Kj{constructor(){super(...arguments),this.transformerConstructor=dX,this.type="radar",this.seriesType=cR.radar}_setModelOption(){this._modelOption.getDimensionInfo=hX}}uX.type="radar",uX.seriesType=cR.radar,uX.transformerConstructor=dX,G(uX,iH);class pX extends Zj{_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=>{L(e,"trimPadding")&&GR(e,$I(this.type,t))})),this._transformAxisSpec(t)}}class gX extends Kj{constructor(){super(...arguments),this.transformerConstructor=pX,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=uH(t,e,i))&&void 0!==s?s:[],...null!==(n=hX(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=gH,this._modelOption.getRectByDimensionData=bH}}gX.type="common",gX.transformerConstructor=pX,G(gX,iH);class fX extends Jj{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class mX extends Kj{constructor(){super(...arguments),this.transformerConstructor=fX}}mX.transformerConstructor=fX,G(mX,iH);class vX extends fX{transformSpec(t){super.transformSpec(t),WI(t)}}class _X extends mX{constructor(){super(...arguments),this.transformerConstructor=vX,this.type="histogram",this.seriesType=cR.bar}_setModelOption(){this._modelOption.getDimensionInfo=uH,this._modelOption.getDimensionInfoByValue=gH,this._modelOption.getRectByDimensionData=bH}}_X.type="histogram",_X.seriesType=cR.bar,_X.transformerConstructor=vX;class yX extends sX{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class bX extends Kj{constructor(){super(...arguments),this.transformerConstructor=yX,this.type="circularProgress",this.seriesType=cR.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=hX}}bX.type="circularProgress",bX.seriesType=cR.circularProgress,bX.transformerConstructor=yX,G(bX,iH);class xX extends sX{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=cR.circularProgress,e}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===cR.gauge||t.type===cR.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===cR.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 SX extends Kj{constructor(){super(...arguments),this.transformerConstructor=xX,this.type="gauge",this.seriesType=cR.gaugePointer}}SX.type="gauge",SX.seriesType=cR.gaugePointer,SX.transformerConstructor=xX;class AX extends Zj{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class kX extends Kj{constructor(){super(...arguments),this.transformerConstructor=AX,this.type="wordCloud",this.seriesType=cR.wordCloud}}kX.transformerConstructor=AX;class MX extends kX{constructor(){super(...arguments),this.transformerConstructor=AX,this.type="wordCloud",this.seriesType=cR.wordCloud}}MX.type="wordCloud",MX.seriesType=cR.wordCloud,MX.transformerConstructor=AX;class TX extends Zj{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class wX extends Kj{constructor(){super(...arguments),this.transformerConstructor=TX,this.type="funnel",this.seriesType=cR.funnel}}wX.type="funnel",wX.seriesType=cR.funnel,wX.transformerConstructor=TX;class CX extends Jj{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}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=Lz(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=Lz(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class EX extends Kj{constructor(){super(...arguments),this.transformerConstructor=CX,this.type="linearProgress",this.seriesType=cR.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=uH,this._modelOption.getDimensionInfoByValue=gH,this._modelOption.getRectByDimensionData=bH}}EX.type="linearProgress",EX.seriesType=cR.linearProgress,EX.transformerConstructor=CX,G(EX,iH);class BX extends Jj{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"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),WI(t)}}class PX extends Kj{constructor(){super(...arguments),this.transformerConstructor=BX,this.type="rangeColumn",this.seriesType=cR.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=uH,this._modelOption.getDimensionInfoByValue=gH,this._modelOption.getRectByDimensionData=bH}}PX.type="rangeColumn",PX.seriesType=cR.rangeColumn,PX.transformerConstructor=BX;class LX extends Zj{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+le(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class RX extends Kj{constructor(){super(...arguments),this.transformerConstructor=LX,this.type="sunburst",this.seriesType=cR.sunburst}}RX.type="sunburst",RX.seriesType=cR.sunburst,RX.transformerConstructor=LX;class OX extends Zj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class IX extends Kj{constructor(){super(...arguments),this.transformerConstructor=OX,this.type="circlePacking",this.seriesType=cR.circlePacking}}IX.type="circlePacking",IX.seriesType=cR.circlePacking,IX.transformerConstructor=OX;class DX extends Zj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class FX extends Kj{constructor(){super(...arguments),this.transformerConstructor=DX,this.type="treemap",this.seriesType=cR.treemap}}FX.type="treemap",FX.seriesType=cR.treemap,FX.transformerConstructor=DX;class zX extends rV{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),WI(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class jX extends aV{constructor(){super(...arguments),this.transformerConstructor=zX,this.type="waterfall",this.seriesType=cR.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=uH,this._modelOption.getDimensionInfoByValue=gH,this._modelOption.getRectByDimensionData=bH}}jX.type="waterfall",jX.seriesType=cR.waterfall,jX.transformerConstructor=zX;class HX extends Jj{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),WI(t)}}class VX extends Kj{constructor(){super(...arguments),this.transformerConstructor=HX,this.type="boxPlot",this.seriesType=cR.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=uH,this._modelOption.getDimensionInfoByValue=gH,this._modelOption.getRectByDimensionData=bH}}VX.type="boxPlot",VX.seriesType=cR.boxPlot,VX.transformerConstructor=HX;class NX extends Zj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class UX extends Kj{constructor(){super(...arguments),this.transformerConstructor=NX,this.type="sankey",this.seriesType=cR.sankey}_setStateInDatum(t,e,i,s){const n=y(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=aI(t))||void 0===e?void 0:e.datum;return y(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}UX.type="sankey",UX.seriesType=cR.sankey,UX.transformerConstructor=NX;class WX extends Jj{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.area=t.area,s.point=t.point,s.line=t.line,"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),WI(t)}}class GX extends Kj{constructor(){super(...arguments),this.transformerConstructor=WX,this.type="rangeArea",this.seriesType=cR.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=uH,this._modelOption.getDimensionInfoByValue=gH,this._modelOption.getRectByDimensionData=bH}}GX.type="rangeArea",GX.seriesType=cR.rangeArea,GX.transformerConstructor=WX;class YX extends Jj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class $X extends Kj{constructor(){super(...arguments),this.transformerConstructor=YX,this.type="heatmap",this.seriesType=cR.heatmap}}$X.type="heatmap",$X.seriesType=cR.heatmap,$X.transformerConstructor=YX;class XX extends Zj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class KX extends Kj{constructor(){super(...arguments),this.transformerConstructor=XX,this.type="correlation",this.seriesType=cR.correlation}}KX.type="correlation",KX.seriesType=cR.correlation,KX.transformerConstructor=XX;function qX(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=nI(t.style)),P(t.textStyle)||GR(s.textStyle,nI(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&nI(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&nI(s.background.style),s}const ZX=(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},JX=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const u={};c.forEach((t=>{u[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:SO;return h?h(t,c,g):(y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===u[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===u[t.source]&&!0===u[t.target])))):p(g)&&(t=t.filter((t=>!0===u[r.getSeriesFieldValue(t,g)]))),t)};class QX extends tj{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:()=>{nR(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),nR(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=ER(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()}_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):(U(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new AD(this._option,e),this._initSelectedData(),nR(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(nR(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)U(s,this._cacheAttrs)||this._legendComponent.setAttributes(GR({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(GR({},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;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());U(t,this._cacheAttrs)||this._legendComponent.setAttributes(GR({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}QX.specKey="legends";class tK extends QX{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return aF(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),nR(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){_I(this._option.dataSet,"discreteLegendFilter",JX),_I(this._option.dataSet,"discreteLegendDataMake",ZX);const t=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return nR(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(!Jy(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=GO(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 s=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:n={},item:r={},pager:a={},background:o={}}=t;n=I(n),r=I(r),a=I(a),o=I(o);const l=s;return n.visible?l.title=qX(n):l.title={visible:!1},P(r.focusIconStyle)||nI(r.focusIconStyle),r.shape&&(r.shape=eI(r.shape)),r.label&&(r.label=eI(r.label)),r.value&&(r.value=eI(r.value)),r.background&&(r.background=eI(r.background)),BR(r.maxWidth)&&(r.maxWidth=Number(r.maxWidth.substring(0,r.maxWidth.length-1))*i.width/100),BR(r.width)&&(r.width=Number(r.width.substring(0,r.width.length-1))*i.width/100),BR(r.height)&&(r.height=Number(r.height.substring(0,r.height.length-1))*i.width/100),l.item=r,"scrollbar"===a.type?(P(a.railStyle)||nI(a.railStyle),P(a.sliderStyle)||nI(a.sliderStyle)):(P(a.textStyle)||nI(a.textStyle),a.handler&&eI(a.handler)),l.pager=a,o.visible&&!P(o.style)&&(GR(l,o.style),p(o.padding)&&(l.padding=o.padding)),l}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return uL}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(rL.legendItemClick,(i=>{const s=L(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(rL.legendItemHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(rL.legendItemUnHover,(e=>{const i=L(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}=rF(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=rF(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}tK.specKey="legends",tK.builtInTheme={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}},tK.type=r.discreteLegend;const eK=(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[]},iK=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=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(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?tI(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};function sK(t){const i=GR({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:u={},type:g,id:f,visible:m,orient:v,position:_,data:y,defaultSelected:b,field:x,filter:S,regionId:A,regionIndex:k,seriesIndex:M,seriesId:T,padding:w}=i,C=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?C.title=qX(s):C.title={visible:!1},C.showHandler=!1!==n.visible,P(n.style)||(C.handlerStyle=nI(n.style)),p(r.width)&&(C.railWidth=r.width),p(r.height)&&(C.railHeight=r.height),P(r.style)||(C.railStyle=nI(r.style)),P(a.style)||(C.trackStyle=nI(a.style)),C.startText=eI(o),C.endText=eI(l),C.handlerText=function(t){if(!t)return t;const e=Object.assign({},t),i=t.style;return d(i)?e.style=(t,e,s)=>nI(i(t,e,s)):P(i)||(e.style=nI(i)),e}(h),P(c)||(C.sizeBackground=nI(c)),u.visible&&!P(u.style)&&(GR(C,u.style),p(u.padding)&&(C.padding=u.padding)),C}const nK={color:vL,size:yL},rK={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}},aK=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},rK),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},oK={horizontal:aK(!0),vertical:aK(!1)},lK=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},rK),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},hK={horizontal:lK(!0),vertical:lK(!1)},cK=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],dK=[2,10];class uK extends QX{static getSpecInfo(t){const e=aF(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}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(e){super.init(e),nR(this._regions,(e=>{e.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:e.isHierarchyData,customFilter:this._spec.customFilter},level:t.TransformLevel.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(){_I(this._option.dataSet,"continuousLegendFilter",iK),_I(this._option.dataSet,"continuousLegendDataMake",eK);const t=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>rR(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=GO(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!Jy(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=GO(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var e,i;const s="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",n="horizontal"===s?"bottom":this.layoutOrient;let r=[];const a=this._getScaleInGlobal();a&&"linear"===a.type&&(r=a.range()),P(r)&&(r="color"===this._legendType?cK:dK);let o=null!==(e=this._legendData.getLatestData()[0])&&void 0!==e?e:0,l=null!==(i=this._legendData.getLatestData()[1])&&void 0!==i?i:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(o=Math.min(0,this._legendData.getLatestData()[0]),l=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const h=Object.assign({layout:s,align:n,zIndex:this.layoutZIndex,min:o,max:l,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:r},sK(this._spec));return this._addDefaultTitleText(h),h}_getLegendConstructor(){return nK[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",St((i=>{const s=L(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}uK.specKey="legends",uK.builtInTheme={colorLegend:oK,sizeLegend:hK},uK.type=r.continuousLegend;const pK=(t,e)=>p(e)?t.map((t=>e[t])):void 0,gK=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),fK=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function mK(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),d=i.getOption(),g=d.getRegionsInUserIdOrIndex(p(c.regionId)?[c.regionId]:void 0,p(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=vK(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),_=g.getLayoutRect(),y=d.globalInstance.getContainer(),b=Object.assign({x:0,y:0},y?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(y):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>gK(i,s)(t)&&gK(n,r)(t)&&(u(a)||gK([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),A=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),_.width),y:Math.min(Math.max(t.y,0),_.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.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 l=[{value:t[e.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=>x(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=d.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:uI.chart,event:A({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=d.globalInstance;return tF.globalConfig.uniqueTooltip&&tF.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=d.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:uI.chart,event:A(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=d.globalInstance;return tF.globalConfig.uniqueTooltip&&tF.hideTooltip(a.id),m}return"none"}const vK=(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(),f=p(g)?t[g]:void 0,m=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=pK(c,t);let _=pK(d,t);const y=fK(_),b=!y&&p(g)&&u(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(gK(c,v));if(!y&&(_=pK(d,i),!fK(_)))return;const n=e.type===cR.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:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=UC(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(gK(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=pK(d,o),!fK(_))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(gK(c,n));if(!y&&(_=pK(d,r),!fK(_)))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:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===cR.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(gK(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(_=pK(d,i),!fK(_))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&&(()=>{var i,n,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(gK(c,v));const o=e.getNameMap(),l=null===(r=null===(n=e.getMapViewData)||void 0===n?void 0:n.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=_;if(l&&!a&&(a=Object.assign({},t)),!y){if(_=pK(d,a),h=_,!fK(_)&&!a)return;fK(_)||(_=[null])}const p=e.dataToPosition(a);u(p)||isNaN(p.x)||isNaN(p.y)||s.push({pos:p,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:h,hasMeasureData:y,groupField:g,groupData:f,originDatum:a},series:e})})()})),s},_K=t=>p(t)&&!y(t),yK=t=>p(t)&&y(t);class bK extends Qz{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i,s,n;const{spec:r,theme:a}=super._initTheme(t,e);return r.style=GR({},this._theme,r.style),r.offset=GR({},a.offset,t.offset),r.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:a.transitionDuration,r.trigger=null!==(s=t.trigger)&&void 0!==s?s:a.trigger,r.triggerOff=null!==(n=t.triggerOff)&&void 0!==n?n:a.triggerOff,{spec:r,theme:a}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(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]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:Xy(this._option.mode)||!Yy(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.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?_(t.parentElement)&&(t.parentElement=k_.getElementById(t.parentElement)):Yy(this._option.mode)&&(t.parentElement=null==Gy?void 0:Gy.body)}}const xK={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}};class SK extends tj{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=bK,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=Yy(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&_K(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!u(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&tF.globalConfig.uniqueTooltip&&l&&tF.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;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;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:uI.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(null==r?void 0:r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:uI.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),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,this._enterable=!1;else{const t="canvas"===s?kH.canvas:kH.dom,n=YR.getComponentPluginInType(t);n||Ny("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,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=YR.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=Y(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),($y(s)||Xy(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,At(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===s||s.call(i)}else 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=mK(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_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(yK(t)){if(_K(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>sz(t,e[i])))}if(yK(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.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: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}getVisible(){return!1!==this._spec.visible}}SK.type=r.tooltip,SK.transformerConstructor=bK,SK.builtInTheme={tooltip:xK},SK.specKey="tooltip";var AK,kK;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(AK||(AK={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(kK||(kK={}));const MK={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class TK extends tj{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=At((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},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.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{UC(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_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}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(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(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:pI.chart}:{source:uI.chart};y(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,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)}onBeforeRender(){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"}:$y(e)||Xy(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:uI.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:uI.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:uI.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=L(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{MK[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=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const u=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+u.left),o=Math.min(o,i-d+u.top),l=Math.max(l,e+t.getLayoutRect().width-c-u.right),h=Math.max(h,i+t.getLayoutRect().height-d-u.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_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)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_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 i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=L(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=L(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:d}=n,u=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:L(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{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||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}TK.specKey="crosshair";const wK={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}}}}};class CK extends TK{static getSpecInfo(t){return aF(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_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)}}_getDatumAtPoint(t,e){const i=XF(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){XF(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:KF(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();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 o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=aR(this._regions,"cartesian");e&&(fH(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=_H(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new lT(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new hT(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}CK.specKey="crosshair",CK.builtInTheme={crosshair:wK},CK.type=r.cartesianCrosshair;class EK extends TK{static getSpecInfo(t){return aF(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_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)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_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}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=aR(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&p(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=Pz(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=rF(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:ce(d,a.getInnerRadius(),o),end:ce(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=ue(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=ce(t,o,r),d=ce(t,o,h),m=_e([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=_t(ae.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new lT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new dT(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new uT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new cT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=pe(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}}(u):function(t){let e="center",i="middle";return e=(t=pe(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}}(g.startAngle),a="angle"===l?ce(e,p[1]+m.offset,u):ce(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}EK.specKey="crosshair",EK.builtInTheme={crosshair:wK},EK.type=r.polarCrosshair;const BK=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(u(o)||u(a))return t;const l=r(),h=y(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},PK=(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=>{let e=!1;return Y(r).every((i=>{t[i]>=a[0]&&t[i]<=$(a)&&(e=!0)})),e}:t=>{let e=!1;return Y(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},LK=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],d=[],g=[];let f=!1,m=!1;n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);p(null==t?void 0:t.max)&&p(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{u(h[t])&&(g.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(h[t[i]])&&(g.push(t[i]),h[t[i]]=0,c.push(t[i])),u(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const v=f?g:!1===r||m?g.sort(((t,e)=>t-e)):c;return v.forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),d.push(e)})),d},RK=(t,e,i)=>{const s=e.domain();if(VC(e.type))return i?s[0]+($(s)-s[0])*(1-t):s[0]+($(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+($(n)-n[0])*t;return e.invert(r)},OK=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&VC(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/($(n)-n[0])))},IK=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},DK=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}},FK=(t,e,i)=>"start"===t?"percent"===e&&p(i.start)||"value"===e&&p(i.startValue):"percent"===e&&p(i.end)||"value"===e&&p(i.endValue),zK=(t,e,i)=>{if(VC(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class jK{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})}constructor(t,e,i,s,n,r,a,o){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.initZoomEvent=()=>{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,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),d=Math.abs(this.getState().start-this.getState().end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=_t(this.getState().start+f,0,1),_=_t(this.getState().end-m,0,1);this._handleChange(Math.min(v,_),Math.max(v,_),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Ut(s/n)>=.5:Ut(n/s)>=.5;if(this._scrollAttr.reverse||(r=-r),a){const t=this._spec.scrollStep;if(k(t)){r=(r>0?1:-1)*(t*(this.getState().end-this.getState().start)/1)}this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1)}const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))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.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===JF(ZF(e))}setEventAttrFromSpec(){!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=j({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=j({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=j({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,c(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&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.getEvent(),this._option.mode)}}G(jK,BV);class HK extends tj{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:OK(t,this._stateScale,this._isHorizontal),a="percent"===n?e:OK(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var e;this._dataFilterEvent.initZoomEvent(),null===(e=this._relatedAxisComponent)||void 0===e||e.event.on(t.ChartEvent.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_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)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=IK(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[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._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._currentDataCollection=[],this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=zK(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!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&&DK(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({value:"force"})}else nR(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),nR(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=ZF(t),this._isHorizontal="horizontal"===JF(this._orient),this._dataFilterEvent=new jK(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){this._handleDataCollectionChangeBound=this._handleDataCollectionChange.bind(this),super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(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])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(VC(n.type)){const r=n.domain(),a=r[0],o=$(r)-a,l=p(t)?a+o*t:+e,h=p(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=p(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=p(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}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}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_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=>JF(t._orient)===JF(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!VC(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;}_collectDataInfo(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};nR(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l,u=VC(d.getScale(0).type),p=VC(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?Y(g.xField):Y(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?Y(g.yField):Y(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:d===l?f:m;u&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else nR(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});return{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}}_initData(){const{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}=this._collectDataInfo(),{dataSet:r}=this._option;yI(r,"dataview",wa),_I(r,"dataFilterComputeDomain",LK);const a=new Pa(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new AD(this._option,a),a.reRunAllTransform(),this._currentDataCollection=t,r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChangeBound)}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(_I(this._option.dataSet,"dataFilterWithNewDomain",PK),_I(this._option.dataSet,"lockStatisticsFilter",BK),nR(this._regions,(e=>{e.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>e.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>VC(this._stateScale.type)},level:1},!1),e.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>VC(this._stateScale.type)},level:t.TransformLevel.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r}=this._collectDataInfo();if(this._currentDataCollection.length!==e.length||this._currentDataCollection.some(((t,i)=>t!==e[i]))){this._currentDataCollection.forEach((t=>{var e;null===(e=null==t?void 0:t.target)||void 0===e||e.removeListener("change",this._handleDataCollectionChangeBound)})),this._currentDataCollection=e;const{dataSet:t}=this._option;t.multipleDataViewAddListener(this._currentDataCollection,"change",this._handleDataCollectionChangeBound)}this._data.getDataView().transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data.getDataView().reRunAllTransform();const a=this._computeDomainOfStateScale(VC(this._stateScale.type));this._stateScale.domain(a,!1),(p(this._spec.start)||p(this._spec.end))&&this._setStateFromSpec(),this._handleChange(this._start,this._end,!0),this._spec.auto&&!U(this._domainCache,a)&&(this._domainCache=a,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;FK("start",i,this._spec)&&FK("end",s,this._spec)&&(t="percent"===i?this._spec.start:OK(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:OK(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?OK(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?OK(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=RK(this._start,this._stateScale,IK(i,this._isHorizontal)),this._endValue=RK(this._end,this._stateScale,IK(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,VC(this._stateScale.type)&&this._stateScale.domain()[0]!==$(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=zK(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&nR(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);k(null==i?void 0:i.min)&&k(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new PE:new cE,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_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?[K(t),X(t)]:[-1/0,1/0]}return e}_autoVisible(e){if(!this._auto)return;e?this.show():this.hide();const i=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[i]:e?this[`_${i}`]:0},{[i]:t.AttributeLevel.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_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=DK(h);if(!this._dataUpdating&&UC(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,UC(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),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}G(HK,BV);class VK extends Qz{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=GR({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}}}const NK=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),UK={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:NK(!1),startHandler:{style:{symbolType:"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;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"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;",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:NK(!0)};class WK extends HK{constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=VK,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=this._isHorizontal?0:this._middleHandlerSize,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=this._isHorizontal?0:this._middleHandlerSize,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._getPreviewStateScale(),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._getPreviewStateScale(),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"}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange)if(s&&this._component)this._component.setStartAndEnd(e,i);else{const s=this._relatedAxisComponent,r=RK(e,this._stateScale,IK(s,this._isHorizontal)),a=RK(i,this._stateScale,IK(s,this._isHorizontal));if(!p(r)||!p(a))return;this._start=e,this._end=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(){this._data.getDataView().reRunAllTransform(),this._initAfterLayout();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new PE),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(IK(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=IK(t,this._isHorizontal),this.effect.onZoomChange())}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,d=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+d,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+d),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);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(),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=isNaN(c)?this._backgroundSize:c-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=isNaN(c)?this._backgroundSize:c-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,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new PE;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(IK(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[K(e),X(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!VC(t.type)||e[0]!==$(e))&&(!UC(t.type)||1!==(i=e,i&&y(i)?Array.from(new Set(Y(i))):i).length);var i}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_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:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_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._computeWidth(),height:this._computeHeight()},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,isReverse:IK(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=!1!==this._spec.showBackgroundChart,i=this._getAttrs(e),s=this._relatedAxisComponent;if(this._component)this._component.setAttributes(i),t&&(this._component.setPreviewData(this._data.getDataView().latestData),e&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>RK(t,this._stateScale,IK(s,this._isHorizontal))))));else{const t=this.getContainer();this._component=new aP(i),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?e&&this._component.setPreviewPointsY1(this._dataToPositionY2):e&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>RK(t,this._stateScale,IK(s,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:nI(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:nI(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:nI(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:nI(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:nI(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:nI(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:nI(g.style)},selectedBackgroundStyle:nI(this._spec.selectedBackground.style),dragMaskStyle:nI(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:GR(nI(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},nI(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:GR(nI(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},nI(null===(d=m.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}=rF(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(IK(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}}WK.type=r.dataZoom,WK.transformerConstructor=VK,WK.builtInTheme={dataZoom:UK},WK.specKey="dataZoom";const GK={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}};class YK extends HK{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"}_handleChange(e,i,s){super._handleChange(e,i,s);const n=KL(this._start,e)&&KL(this._end,i);if(this._shouldChange&&(!n||!1===this._spec.realTime)){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this._relatedAxisComponent,r=IK(n,this._isHorizontal),a=RK(e,this._stateScale,r),o=RK(i,this._stateScale,r);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,a,o):this._handleStateChange(a,o))&&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(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r,a;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,minSliderSize:null===(a=this._spec)||void 0===a?void 0:a.minSliderSize},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new pM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=nI(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=nI(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}YK.type=r.scrollBar,YK.builtInTheme={scrollBar:GK},YK.specKey="scrollBar";const $K=(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},XK=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),KK={title:{visible:!0,autoLimit:!1,autoFit:!1,style:XK("l1FontSize","primaryFontColor")},content:{visible:!0,style:XK("l2FontSize","tertiaryFontColor")}};class qK extends tj{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){return aF(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}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))}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(aI(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(aI(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){_I(this._option.dataSet,"indicatorFilter",$K);const t=new Pa(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 AD(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:i,height:s}=t.getLayoutRect(),{x:n,y:r}=t.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,u=e(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return Y(o).forEach((t=>{const e=GR({},this._theme.content,t);g.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({},sI(H(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?FR(l,this._computeLayoutRadius()):0,dy:h?FR(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!p(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},sI(H(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},u)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)U(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new SL(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_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.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}qK.type=r.indicator,qK.builtInTheme={indicator:KK},qK.specKey="indicator";const ZK=["sum","average","min","max","variance","standardDeviation","median"];function JK(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=K(s),r=X(s);return er}function QK(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&JK(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=BR(t.x)?sq(t.x,n)+r.x:nq(l.getXAxisHelper(),[t.x])+r.x,h}function tq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&JK(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=BR(t.y)?sq(t.y,n)+r.y:nq(l.getYAxisHelper(),[t.y])+r.y,h}function eq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&JK(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)),nq(a.angleAxisHelper,[t.angle])}function iq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&JK(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)),nq(a.radiusAxisHelper,[t.radius])}function sq(t,e){return Number(t.substring(0,t.length-1))*e/100}function nq(t,e){const i=t.getScale(0);return VC(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function rq(t){return ZK.includes(t)}function aq(t,e,i,s,n,r=!1){const a=e.getRegion(),o=a.getLayoutStartPoint(),l=i.getRegion(),h=l.getLayoutStartPoint(),c=Math.abs(Math.min(o.x,h.x)-Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width)),d=Math.abs(Math.min(o.y,h.y)-Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height)),u={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},g=[],f=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper(),v=s.getYAxisHelper(),_=m.getScale(0).domain(),y=v.getScale(0).domain(),b=r&&!m.isContinuous&&!!m.getBandwidth,x=r&&!v.isContinuous&&!!v.getBandwidth,S={min:null,max:null},A={min:null,max:null};return f.forEach((t=>{const e=p(t.x),i=p(t.y);let s,r;if(e&&i)s=QK(t,_,n,u,c,o),r=tq(t,y,n,u,d,o),oq(s,b,S,g.length),oq(r,x,A,g.length),g.push([{x:s,y:r}]);else if(e){s=QK(t,_,n,u,c,o),r=Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height);const e=Math.min(o.y,h.y);oq(s,b,S,g.length),g.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(o.x,h.x),r=tq(t,y,n,u,d,o);const e=Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width);oq(r,x,A,g.length),g.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(g,m,v,S,A),g}function oq(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=eq(t,l,n,r),i=iq(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=eq(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=iq(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function hq(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:f}=u.getLayoutRect();let m=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(m=BR(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=BR(i)?Number(i.substring(0,i.length-1))*f/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])&&JK(_,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])&&JK(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:nq(d.getXAxisHelper(),b)+p.x+m,y:nq(d.getYAxisHelper(),x)+p.y+v})})),n}function cq(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])&&JK(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])&&JK(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:nq(l.angleAxisHelper,d),radius:nq(l.radiusAxisHelper,u)})})),s}function dq(t,e,i){let{x:s,y:n}=t;return BR(s)&&(s=sq(s,e)),BR(n)&&(n=sq(n,i)),{x:s,y:n}}function uq(t,e,i){let s;if(s=d(t)?Y(t(e.getData().getLatestData(),e)):Y(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=dq(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>dq(t,n,r)))}function pq(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 gq(t,i,s){const{labelBackground:n={},style:r,shape:a}=t,o=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},nI(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},mq(nI(n.style),i,s)),p(n.padding)&&(t.padding=ai(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=mq(nI(r),i,s)),t}return{visible:!1}}function fq(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function mq(t,e,i){return d(t)?t(e,i):t}function vq(t,e){return d(t)?t(e):t}function _q(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 yq(t){return{isXProcess:p(t.x),isYProcess:p(t.y),isX1Process:p(t.x1),isY1Process:p(t.y1),isAngleProcess:p(t.angle),isRadiusProcess:p(t.radius),isAngle1Process:p(t.angle1),isRadius1Process:p(t.radius1),isCoordinatesProcess:p(t.coordinates),isValidProcess:p(t.process)}}function bq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=yq(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:h&&(!c||"process"in t&&"xy"in t.process)}}function xq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=yq(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function Sq(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function Aq(t,i){let s;if(i.coordinates){const t=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=t,o=e(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(d(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=Y(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;p(r)&&(c=Y(i)[r]),n&&Y(i).includes(n)&&(c=n);let d=s;p(l)&&(d=Y(s)[l]),a&&Y(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),_(t[c])&&rq(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),_(t[d])&&rq(t[d])?h.y={field:d,aggrType:t[d]}:h.y=Y(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;p(r)&&(a=Y(s)[r]),n&&Y(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),_(t[a])&&rq(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),_(t[l])&&rq(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=Y(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const s=e.x;y(s)?i.x=s.map((i=>Mq(i,t,e))):i.x=Mq(s,t,e)}if(p(e.y)){const s=e.y;y(s)?i.y=s.map((i=>Mq(i,t,e))):i.y=Mq(s,t,e)}if(p(e.angle)){const s=e.angle;y(s)?i.angle=s.map((i=>Mq(i,t,e))):i.angle=Mq(s,t,e)}if(p(e.radius)){const s=e.radius;y(s)?i.radius=s.map((i=>Mq(i,t,e))):i.radius=Mq(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=Mq(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const kq={min:(t,e)=>qL(t[0].latestData,e.field),max:(t,e)=>ZL(t[0].latestData,e.field),sum:function(t,e){return JL(t[0].latestData,e.field)},average:function(t,e){return QL(t[0].latestData,e.field)},variance:function(t,e){return tR(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(tR(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return dt(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function Mq(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(m(t)){const{aggrType:i,field:s}=t;return kq[i](e,{field:s})}return t}function Tq(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 wq extends tj{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){return aF(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_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)&&rq(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){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Ba;return e.registerParser("array",s),new Pa(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)))}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=aR(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){u(this._spec.offsetX)||(this._layoutOffsetX=LR(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=LR(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();_I(this._option.dataSet,"markerAggregation",Aq),_I(this._option.dataSet,"markerFilter",Tq);const i=new Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),i.target.on("change",(()=>{this._markerLayout()})),this._markerData=i}}function Cq(t,e){return function(t,e,i){const{predict:s}=Ft(t,(t=>t[e]),(t=>t[i])),n=qL(t,e),r=ZL(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class Eq extends wq{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}=bq(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;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={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},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:mq(nI(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>gq(t,this._markerData,this._markAttributeContext))),state:{line:fq(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:fq(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:fq(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return fq(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return fq(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:mq(nI(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:mq(nI(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||Y(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=pq([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=Y(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,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}=bq(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;_I(this._option.dataSet,"markerAggregation",Aq),_I(this._option.dataSet,"markerRegression",Cq),_I(this._option.dataSet,"markerFilter",Tq);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new Pa(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",(()=>{this._markerLayout()})),this._markerData=m}}Eq.specKey="markLine";const Bq=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),Pq={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"}}},refY:5},Lq={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:Bq(!1),endSymbol:Bq(!0),label:Pq};class Rq extends Eq{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new GP(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:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:_}=bq(e);let y=[];if(u||f||g||m||v||a&&l||a&&h){const t=aq(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=hq(i,r,d,e.coordinatesOffset):c&&(y=uq(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n;const r=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const n=this._startRelativeSeries,a=this._endRelativeSeries,{multiSegment:o,mainSegmentIndex:l}=this._spec.line||{},{connectDirection:h,expandDistance:c=0}=this._spec;let d;if(BR(c)){const t=n.getRegion(),e=t.getLayoutStartPoint(),i=a.getRegion(),s=i.getLayoutStartPoint();if("bottom"===h||"top"===h){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));d=Number(c.substring(0,c.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));d=Number(c.substring(0,c.length-1))*n/100}}else d=c;const{points:u,limitRect:g}=r;if(!u||u.length<2)return void(null===(t=this._markerComponent)||void 0===t||t.setAttributes(r));const f=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}(u[0],u[1],h,d);let m;m=o&&p(l)?{position:"middle",autoRotate:!1}: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)}:{}}(u[0],u[1],h,d));const v=Y((null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{}).label),_=Y(r.label),y=Y(this._spec.label);null===(s=this._markerComponent)||void 0===s||s.setAttributes({points:o?[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]]]:f,label:_.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=m.dx)&&void 0!==i?i:0,h=null!==(s=m.dy)&&void 0!==s?s:0;const c=null!==(n=y[e])&&void 0!==n?n:y[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),m),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=v[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:g,multiSegment:o,mainSegmentIndex:l,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(n=this._markerComponent)||void 0===n||n.setAttributes(r)}_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}=bq(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 Pa(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&p(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&p(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&p(n.process.xy)){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}}}Rq.type=r.markLine,Rq.coordinateType="cartesian",Rq.builtInTheme={markLine:Lq};class Oq extends Eq{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=bq(this._spec);return e||i?new XP(t):new GP(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}=bq(e);let p=[],g={};const f={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=lq(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:f}:{points:p.map((t=>ce(f,t.radius,t.angle)))}}else u&&(p=cq(i,r,a),g={points:p.map((t=>ce(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=bq(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}}}Oq.type=r.polarMarkLine,Oq.coordinateType="polar",Oq.builtInTheme={polarMarkLine:Lq};class Iq extends tj{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=ER(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return aF(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}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;if(!1===this._spec.visible)return{visible:!1};const a=this.getLayoutRect(),o=LR(this._spec.width,a.width,null,a.width),l=LR(this._spec.maxWidth,a.width,null,a.width),h=Math.max(Math.min(o,l,a.width),0),c=p(this._spec.text)&&""!==this._spec.text,d=p(this._spec.subtext)&&""!==this._spec.subtext,u=Object.assign(Object.assign({},H(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:c?this._spec.text:void 0,subtextType:null!==(e=this._spec.subtextType)&&void 0!==e?e:"text",subtext:d?this._spec.subtext:void 0,x:null!==(i=this._spec.x)&&void 0!==i?i:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:h,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(n=this._spec.align)&&void 0!==n?n:"left",verticalAlign:null!==(r=this._spec.verticalAlign)&&void 0!==r?r:"top",textStyle:Object.assign({maxLineWidth:h},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:h},this._spec.subtextStyle)});if(c&&(u.textStyle.width=h),d&&(u.subtextStyle.width=h),p(this._spec.width)){const t=Math.max(Math.min(o,a.width),0);c?u.textStyle.width=t:delete u.textStyle.width,d&&(u.subtextStyle.width=t)}return u}_createOrUpdateTitleComponent(t){if(this._titleComponent)U(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new bL(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}}Iq.type=r.title,Iq.specKey=r.title,Iq.builtInTheme={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"}}}};class Dq extends wq{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=xq(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={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:mq(nI(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>gq(t,this._markerData,this._markAttributeContext))),state:{area:fq(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>fq(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return fq(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||Y(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=pq([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=Y(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=Y(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,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}=xq(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}Dq.specKey="markArea";const Fq={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"}}}}};class zq extends Dq{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new $P(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=xq(i),d=p(i.positions),u=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=aq(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=aq(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=hq(s,a,u,i.coordinatesOffset):d&&(f=uq(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=xq(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}}}zq.type=r.markArea,zq.coordinateType="cartesian",zq.builtInTheme={markArea:Fq};class jq extends Dq{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=xq(this._spec);return i||e||s?new KP(t):new $P(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}=xq(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=lq(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=cq(i,r,c),u={points:d.map((t=>ce(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=xq(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}}}jq.type=r.polarMarkArea,jq.coordinateType="polar",jq.builtInTheme={polarMarkArea:Fq};const Hq=t=>nI(Object.assign({},t)),Vq=t=>Object.assign(Object.assign({},t),{style:Object.assign({},nI(t.style))}),Nq=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=Hq(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=Hq(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:{},nI(Object.assign({},y)));var y;const b=Vq(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=Vq(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=Vq(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=Vq(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!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,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},Uq=t=>"left"===t||"right"===t,Wq=t=>"top"===t||"bottom"===t,Gq={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:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,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:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class Yq extends tj{constructor(){super(...arguments),this.layoutZIndex=t.LayoutZIndex.Player,this.layoutLevel=t.LayoutLevel.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},Nq(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},Nq(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?U(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new DL(t):this._playerComponent=new jL(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=Uq(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=Uq(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.autoPlayCallback=()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback),this._option.globalInstance.on(t.ChartEvent.rendered,this.autoPlayCallback),this._playerComponent.addEventListener(BL.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(BL.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(BL.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(BL.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(BL.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(BL.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}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=Uq(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=Wq(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}_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)):Uq(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))):Wq(this._orient)?this._maxSize():t.height}_computeDx(t){return Uq(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return Wq(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(e){const i=this._specs[e];this._option.globalInstance.updateFullData(i.data),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})}release(){this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback)}}Yq.builtInTheme={player:Gq},Yq.specKey="player",Yq.type=r.player;class $q extends tj{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,U(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=_R({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:Y(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==ZI.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&u(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}$q.type=r.label;class Xq extends RN{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}render(){}}Xq.type="text",Xq.constructorType="label";const Kq=()=>{ON(),YR.registerMark(Xq.constructorType,Xq)};class qq extends Qz{_initTheme(t,e){return{spec:t,theme:this._theme}}}class Zq extends $q{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=qq,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.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(hI.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(hI.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),nR(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{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),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,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=GR({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},JV(h,r),Object.assign(Object.assign(Object.assign({},H(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[OO])):t=>t.filter((t=>t.data[RO]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?QV(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=y(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=Y(i())[t])}))}return e}}Zq.type=r.label,Zq.specKey="label",Zq.transformerConstructor=qq;class Jq extends $q{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()}reInit(t){super.reInit(t),this._initTextMark()}_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[PO]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return GR({textStyle:{pickable:!0===this._spec.interactive},position:Qq(t,this._baseMark.type,a),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=>"bottom"===a?t.data[OO]:t.data[RO]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>QV({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function Qq(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}Jq.type=r.totalLabel,Jq.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},Jq.specKey="totalLabel";class tZ extends wq{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=Sq(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,f,m,v,_,y,b,x,S,A,k,M,T,w,C,E,B,P,L,R,O;const{itemContent:I={},itemLine:D={},targetSymbol:F={}}=this._spec,z=I,{type:H="text",text:V,symbol:N,image:U,richText:W,customMark:G,textStyle:Y,symbolStyle:$,imageStyle:X,richTextStyle:K,customMarkStyle:q,style:Z={},state:J={}}=z,Q=e(z,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let tt=null,et=null,it={};"text"===H?(tt=null!==(t=null==V?void 0:V.state)&&void 0!==t?t:J,it={dx:0,dy:0},et=gq(Object.assign(Object.assign({},V),{style:j(it,null!==(n=null!==(s=null!==(i=null==V?void 0:V.style)&&void 0!==i?i:null==V?void 0:V.textStyle)&&void 0!==s?s:Y)&&void 0!==n?n:Z)}),this._markerData,this._markAttributeContext)):"richText"===H?(tt=null!==(r=null==W?void 0:W.state)&&void 0!==r?r:J,it={width:100,height:100},et=mq(j(it,null!==(o=null!==(a=null==W?void 0:W.style)&&void 0!==a?a:K)&&void 0!==o?o:Z),this._markerData,this._markAttributeContext)):"symbol"===H?(tt=null!==(l=null==N?void 0:N.state)&&void 0!==l?l:J,it={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},et=nI(mq(j(it,null!==(c=null!==(h=null==N?void 0:N.style)&&void 0!==h?h:$)&&void 0!==c?c:Z),this._markerData,this._markAttributeContext))):"image"===H?(tt=null!==(d=null==U?void 0:U.state)&&void 0!==d?d:J,it={width:80,height:80},et=mq(j(it,null!==(p=null!==(u=null==U?void 0:U.style)&&void 0!==u?u:X)&&void 0!==p?p:Z),this._markerData,this._markAttributeContext)):"custom"===H&&(tt=null!==(g=null==G?void 0:G.state)&&void 0!==g?g:J,et=mq(null!==(m=null!==(f=null==G?void 0:G.style)&&void 0!==f?f:q)&&void 0!==m?m:Z,this._markerData,this._markAttributeContext));const st={zIndex:this.layoutZIndex,interactive:null===(v=this._spec.interactive)||void 0===v||v,hover:null===(_=this._spec.interactive)||void 0===_||_,select:null===(y=this._spec.interactive)||void 0===y||y,position:{x:0,y:0},clipInRange:null!==(b=this._spec.clip)&&void 0!==b&&b,itemContent:Object.assign(Object.assign({type:H,offsetX:vq(I.offsetX,this._relativeSeries.getRegion()),offsetY:vq(I.offsetX,this._relativeSeries.getRegion())},Q),{style:mq(et,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(x=F.offset)&&void 0!==x?x:0,visible:null!==(S=F.visible)&&void 0!==S&&S,size:null!==(A=F.size)&&void 0!==A?A:20,style:mq(F.style,this._markerData,this._markAttributeContext)},state:{line:fq(null!==(M=null===(k=this._spec.itemLine.line)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),lineStartSymbol:fq(null!==(w=null===(T=this._spec.itemLine.startSymbol)||void 0===T?void 0:T.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),lineEndSymbol:fq(null!==(E=null===(C=this._spec.itemLine.endSymbol)||void 0===C?void 0:C.state)&&void 0!==E?E:{},this._markerData,this._markAttributeContext),itemContent:fq(tt,this._markerData,this._markAttributeContext),textBackground:fq(null===(P=null===(B=this._spec.itemContent.text)||void 0===B?void 0:B.labelBackground)||void 0===P?void 0:P.state,this._markerData,this._markAttributeContext),targetItem:fq(null!==(R=null===(L=this._spec.targetSymbol)||void 0===L?void 0:L.state)&&void 0!==R?R:{},this._markerData,this._markAttributeContext)},animation:null!==(O=this._spec.animation)&&void 0!==O&&O,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:nt,line:rt={}}=D,at=e(D,["visible","line"]);st.itemLine=!1!==nt?Object.assign(Object.assign({},at),{visible:!0,lineStyle:nI(rt.style)}):{visible:!1};return new ZP(st)}_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}=pq([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:_q(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:_q(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}=Sq(t);(p(t.coordinate)||e||i||s)&&this._initCommonDataView()}}tZ.specKey="markPoint";const eZ={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}};class iZ extends tZ{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=p(s.x)&&p(s.y),o=p(s.coordinate),l=p(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=aq(n,r,r,r,h))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=hq(n,r,h,s.coordinatesOffset)[0]:l&&(c=uq(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=Sq(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}}}iZ.type=r.markPoint,iZ.coordinateType="cartesian",iZ.builtInTheme={markPoint:eZ};class sZ extends tZ{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=lq(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:ce({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}])]}}}sZ.type=r.polarMarkPoint,sZ.coordinateType="polar",sZ.builtInTheme={polarMarkPoint:eZ};class nZ extends tZ{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}])]}}}nZ.type=r.geoMarkPoint,nZ.coordinateType="geo",nZ.builtInTheme={geoMarkPoint:eZ};const rZ="inBrush",aZ="outOfBrush";class oZ extends tj{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._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return aF(t,this.specKey,this.type,(t=>!1!==t.visible))}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),rZ,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),aZ,t.AttributeLevel.Series))}))}))}_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()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){p(this._spec.regionId)||p(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_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)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild()}_shouldEnableInteractive(){return!1!==this.getOption().getCompiler().getOption().interactive}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new UL(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:nI(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),this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(FL.brushActive,(s=>{this._initMarkBrushState(i,aZ),this._emitEvent(t.ChartEvent.brushActive,e,s)})),a.addEventListener(FL.drawStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener(FL.moveStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener(FL.drawing,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener(FL.moving,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener(FL.brushClear,(s=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)})),a.addEventListener(FL.drawEnd,(s=>{var n;this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:r}=s.detail,{updateElementsState:a=!0}=this._spec;if(null===(n=this._spec)||void 0===n?void 0:n.onBrushEnd)!0===this._spec.onBrushEnd(s)?(this.clearGraphic(),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)):(this._spec.onBrushEnd(s),this._emitEvent(t.ChartEvent.brushEnd,e,s));else{const i=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&i.length>0||!a)&&this._setAxisAndDataZoom(r,e),this._emitEvent(t.ChartEvent.brushEnd,e,s)}})),a.addEventListener(FL.moveEnd,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:s}=i.detail,{updateElementsState:n=!0}=this._spec,r=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&r.length>0||n)&&this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e,i)}))}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a],interactive:this._shouldEnableInteractive()}}_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({},nI(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail;this._operateMask=i;const{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e,i){var s;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},vchart:null===(s=this._option)||void 0===s?void 0:s.globalInstance,event:i})}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(i.addState(rZ,!0),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(i.removeState(rZ),i.addState(aZ,!0),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:_=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(_.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(i.addState(rZ,!0),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(i.removeState(rZ),i.addState(aZ,!0),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Pe(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;s.removeState(rZ),s.removeState(aZ),i&&s.addState(i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_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,g=t.getScale().range(),f=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],m=$(g){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}clearBrushStateAndMask(){this._relativeRegions.forEach(((t,e)=>{this._initMarkBrushState(e,""),this._brushComponents[e].children[0].removeAllChild()}))}}oZ.type=r.brush,oZ.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},oZ.specKey="brush";class lZ extends tj{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}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;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${mO}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=IF({},DF(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(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)}))),p(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,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 Ve).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Ve;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),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}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}lZ.type=r.customMark,lZ.specKey="customMark";class hZ{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._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=>{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=>cZ(t))),a=n.filter((t=>!cZ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>cZ(t))),h=o.filter((t=>!cZ(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 cZ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}hZ.type="grid";const dZ="vchart-tooltip",uZ=`${dZ}-container`,pZ=`${dZ}-title`,gZ=`${dZ}-content-box`,fZ={offsetX:10,offsetY:10},mZ="99999999999999";function vZ(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const _Z=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,yZ=t=>_(t)&&""!==(null==t?void 0:t.trim())||S(t)?vZ(t):"",bZ=(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},xZ={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},SZ=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=xZ[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class AZ extends Cz{constructor(){super(...arguments),this._visible=!0,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._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const _=e.event,{activeType:y,data:b}=t,x="dimension"===y?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:M}=this._option,T=m[y],w=cF(null==T?void 0:T.position,b,e),C=null!==(r=cF(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===y?"mark":"pointer",{width:E=0,height:B=0}=null!=i?i:{},P="canvas"===m.renderMode,L=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==L?void 0:L.width)&&void 0!==o?o:vO,O=null!==(l=null==L?void 0:L.height)&&void 0!==l?l:_O;let I=!1;const D={width:0,height:0};let F,z={x:0,y:0},j={x:0,y:0},H=1,V=1;const N=Yy(this._env);if(N&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=R,D.height=O),N&&!P){const t=this._getParentElement(m);j=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-j.x,y:F.y-j.y},H=_Z(e,F),V=_Z(t,j)}const U=V/H,W={},G={x:w,y:w},Y={x:["left","right"],y:["top","bottom"]},$=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?A:M;if("mark"===i){I=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){I=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(I){const e=Y[n][0],i="x"===n?E:B;switch(SZ(t,n)){case-2:W[e]=a-i*U-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*U/2;break;case-1:W[e]=(a+o)/2-i*U-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*U-c;break;case 2:W[e]=o+c}}},X=["x","y"];if(g(w))if(g(K=w)&&(p(K.left)||p(K.right)||p(K.top)||p(K.bottom))){const{left:t,right:e,top:i,bottom:s}=w;W.left=bZ(t,_),W.top=bZ(i,_),W.right=bZ(e,_),W.bottom=bZ(s,_)}else(t=>g(t)&&(p(t.x)||p(t.y)))(w)&&X.forEach((t=>{const e=w[t];S(e)||d(e)?W[Y[t][0]]=bZ(e,_):$(e,t)}));else p(w)&&($({orient:w,mode:C},"x"),$({orient:w,mode:C},"y"));var K;const q={x:null,y:null};return X.forEach((t=>{var e;const i="x"===t?E:B,s="x"===t?R:O,n="x"===t?A:M,r=SZ(G[t],t);if(k(W[Y[t][0]]))q[t]=W[Y[t][0]];else if(k(W[Y[t][1]]))q[t]=s-i*U-W[Y[t][1]];else{const e="x"===t?_.canvasX:_.canvasY;q[t]=r>0?e+n:0===r?e-i*U/2:e-i*U-n}q[t]*=H,N&&(q[t]+=z[t]),q[t]/=V;const a="x"===t?D.width:D.height,o=m.confine?-(j[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/H)/V:-j[t]/V,l=a/V+o-i;2!==r&&q[t]l&&(q[t]=l)):-2!==r&&q[t]>l&&(I?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",MZ=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=kZ(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=kZ(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},TZ=(t={})=>{const{lineHeight:e}=t;return t.fontSize?LR(e,t.fontSize):0},wZ=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),p(r)&&(o=ai(r),a.padding=kZ(o)),{panelStyle:a,panelPadding:o}};function CZ(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}class EZ extends AZ{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(EZ.type),this.type=kH.dom,this._tooltipContainer=null==Gy?void 0:Gy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(Gy&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:d,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=wZ(l),_={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(_.marginBottom=`${g}px`);const y={width:kZ(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=MZ(h),x=MZ(d),S=MZ(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),u(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),u(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),u(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),y[A]=kZ(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=kZ(null!==(s=d.spacing)&&void 0!==s?s:26),S[A]=kZ(null!==(n=p.spacing)&&void 0!==n?n:0);const M=Math.max(TZ(p),TZ(d));return _.lineHeight=M>0?`${M}px`:"20px",{panelPadding:v,row:_,panel:m,title:b,shape:y,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(pZ))),l=a.find((t=>t.className.includes(gZ)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(pZ),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(CZ(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${dZ}-column`),e.classList.add(`${dZ}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(gZ),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];CZ(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));CZ(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${dZ}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=yZ(e.key),e.keyStyle&&MZ(e.keyStyle,l)):"value"===i?(o.innerHTML=yZ(e.value),e.valueStyle&&MZ(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?vZ(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?vZ(c):m,y=p,b=t=>new Cg({symbolType:t,size:y,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new Ve));let M=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const T=vh.IsGradientStr(u);if(!u||_(u)&&!T||d)return m=d?"none":u?vZ(u):"currentColor",`\n \n \n \n `;const w=T?vh.Parse(u):g(u)?u:null;if(w){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=w.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===w.gradient?t=`\n ${i}\n `:"linear"===w.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),CZ(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(gZ))),h=[...o.children].find((t=>t.className.includes(pZ)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(pZ)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=LR(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,CZ(l,c))}const u=l.children,g=[];if(u){for(let i=0;i{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},ff||(ff=pf.CreateGraphic("richtext",{})),ff.setAttributes(a),ff.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function LZ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:BZ),{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:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const RZ=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};class OZ extends AZ{constructor(){super(OZ.type),this.type=kH.canvas,this._attributes=null}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 XL({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}_getTooltipBoxSize(t,e){var i,s;if(!e||u(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");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:f,valueLabel:m,spaceRow:v,align:_}=l,y=ai(d.padding),b=IR(d.padding),x=LZ(Object.assign({textAlign:"right"===_?"right":"left"},u),i),S=LZ(Object.assign({textAlign:"right"===_?"right":"left"},f),i),A=LZ(m,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:RZ(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,enterable:h,transitionDuration:c,align:_},{title:T={},content:w=[]}=t;let C=b.left+b.right,E=b.top+b.bottom,B=0;const P=!!w.length;let L=0,R=0,O=0,I=0;if(P){const t=[],e=[],i=[],s=[];let n=0;M.content=w.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:M}=r,T={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=GR({},S,LZ(b,void 0,{})),{width:s,height:n,text:r}=PZ(h,i);T.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(m)){const t=GR({},A,LZ(x,void 0,{})),{width:e,height:s,text:n}=PZ(m,t);T.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};M?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,T.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else T.shape={visible:!1};return T.height=o,n+=o,aU.autoWidth&&!1!==U.multiLine;if(j){U=GR({},x,LZ(V,void 0,{})),W()&&(U.multiLine=null===(r=U.multiLine)||void 0===r||r,U.maxWidth=null!==(a=U.maxWidth)&&void 0!==a?a:P?Math.ceil(B):void 0);const{text:t,width:e,height:i}=PZ(H,U);M.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=U.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},U),{text:t}),D=M.title.value.width,F=M.title.value.height,z=F+(P?M.title.spaceRow:0)}return E+=z,M.title.width=D,M.title.height=F,W()?C+=B||D:C+=Math.max(D,B),P&&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-I-L-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})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_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{activeTooltipSpec: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()}}OZ.type=kH.canvas;const IZ=/\{([^}]+)\}/,DZ=/\{([^}]+)\}/g,FZ=/:/;class zZ extends Cz{constructor(){super(zZ.type),this.type="formatterPlugin",this._timeModeFormat={utc:mi.getInstance().timeUTCFormat,local:mi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=ki.getInstance().format,this._numericSpecifier=ki.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[zZ.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)),YR.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=IZ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(DZ,((t,i)=>{if(!FZ.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(xi.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):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}zZ.pluginType="chart",zZ.specKey="formatter",zZ.type="formatterPlugin";tF.useRegisters([()=>{EH(),PH(),RH(),aH(),rH(),Wj(),Ij(),vz(),yz(),UD(),HD(),Cj(),kj(),YR.registerSeries(Gj.type,Gj),YR.registerChart(OH.type,OH)},()=>{EH(),PH(),RH(),rH(),Wj(),Ij(),vz(),FH(),yz(),HH(),Cj(),kj(),YR.registerSeries(NH.type,NH),aH(),YR.registerChart(WH.type,WH)},()=>{EH(),PH(),RH(),rH(),nV(),aH(),YR.registerChart(aV.type,aV)},()=>{EH(),PH(),aH(),rH(),mV(),YR.registerChart(_V.type,_V)},()=>{PH(),pU(),YR.registerChart(oX.type,oX)},()=>{EH(),PH(),aH(),rH(),PU(),YR.registerChart(cX.type,cX)},()=>{EH(),PH(),RH(),aH(),rH(),HU(),YR.registerChart(uX.type,uX)},()=>{EH(),PH(),RH(),aH(),rH(),nV(),YR.registerTransform("bin",Kr),YR.registerChart(_X.type,_X)},()=>{PH(),RV(),AV(),YR.registerSeries(IV.type,IV),YR.registerImplement("registerMap",AI),YR.registerImplement("unregisterMap",kI),VD(),YR.registerChart(eX.type,eX)},()=>{PH(),y$(),YR.registerSeries(x$.type,x$),oU(),eW(),wU(),nW(),YR.registerChart(SX.type,SX)},()=>{PH(),YG(),YR.registerChart(MX.type,MX)},()=>{PH(),uY(),YR.registerChart(wX.type,wX)},()=>{EH(),PH(),RH(),aH(),rH(),cN(),YR.registerChart(jX.type,jX)},()=>{EH(),PH(),aH(),rH(),LN(),YR.registerTransform("boxplot",qr),YR.registerChart(VX.type,VX)},()=>{EH(),PH(),aH(),rH(),nW(),YR.registerChart(bX.type,bX)},()=>{EH(),PH(),aH(),rH(),dW(),YR.registerChart(EX.type,EX)},()=>{EH(),PH(),aH(),rH(),UN(),YR.registerChart(PX.type,PX)},()=>{EH(),PH(),RH(),aH(),rH(),FH(),Cj(),kj(),YR.registerSeries(XN.type,XN),YR.registerChart(GX.type,GX)},()=>{PH(),BY(),YR.registerChart(RX.type,RX)},()=>{PH(),DY(),YR.registerChart(IX.type,IX)},()=>{PH(),h$(),YR.registerChart(FX.type,FX)},()=>{PH(),xo.load(vM),e$(),YR.registerChart(UX.type,UX)},()=>{PH(),C$(),YR.registerChart($X.type,$X)},()=>{PH(),V$(),YR.registerChart(KX.type,KX)},()=>{EH(),PH(),RH(),aH(),YR.registerChart(gX.type,gX),rH()},kj,Cj,()=>{YR.registerGraphicComponent(ej.lineAxis,((t,e)=>new CC(t,e))),YR.registerGraphicComponent(ij.lineAxisGrid,((t,e)=>new zB(t,e))),oj(),YR.registerComponent(Ej.type,Ej)},()=>{YR.registerGraphicComponent(ej.lineAxis,((t,e)=>new CC(t,e))),YR.registerGraphicComponent(ij.lineAxisGrid,((t,e)=>new zB(t,e))),oj(),YR.registerComponent(Bj.type,Bj)},()=>{YR.registerGraphicComponent(ej.lineAxis,((t,e)=>new CC(t,e))),YR.registerGraphicComponent(ij.lineAxisGrid,((t,e)=>new zB(t,e))),oj(),YR.registerComponent(Pj.type,Pj)},EU,wU,()=>{YR.registerComponent(tK.type,tK)},()=>{YR.registerComponent(uK.type,uK)},()=>{YR.registerComponent(SK.type,SK)},()=>{YR.registerComponent(CK.type,CK)},()=>{YR.registerComponent(EK.type,EK)},()=>{YR.registerComponent(WK.type,WK)},()=>{YR.registerComponent(YK.type,YK)},()=>{YR.registerComponent(qK.type,qK)},RV,()=>{YR.registerComponent(Rq.type,Rq),WP()},()=>{YR.registerComponent(zq.type,zq),YP()},()=>{YR.registerComponent(iZ.type,iZ),qP()},()=>{YR.registerComponent(Oq.type,Oq),XP._animate=MP,WP()},()=>{YR.registerComponent(jq.type,jq),KP._animate=wP,YP()},()=>{YR.registerComponent(sZ.type,sZ),qP()},()=>{YR.registerComponent(nZ.type,nZ),qP()},()=>{YR.registerComponent(Iq.type,Iq)},()=>{YR.registerComponent(Yq.type,Yq)},()=>{YR.registerGraphicComponent(Zq.type,(t=>new OB(t))),Kq(),nj(),YR.registerComponent(Zq.type,Zq,!0,1/0)},()=>{YR.registerGraphicComponent(Jq.type,(t=>new OB(t))),Kq(),nj(),YR.registerComponent(Jq.type,Jq,!0)},()=>{YR.registerComponent(oZ.type,oZ)},()=>{YR.registerComponent(lZ.type,lZ)},()=>{xo.load(aT)},()=>{YR.registerLayout(hZ.type,hZ)},()=>{var t;t=OZ,YR.registerComponentPlugin(t.type,t)},()=>{var t;t=zZ,YR.registerChartPlugin(t.type,t)},KD,JD]),tF.useRegisters([()=>{GS(xo)}]),t.DEFAULT_CHART_HEIGHT=_O,t.DEFAULT_CHART_WIDTH=vO,t.DEFAULT_CLOSE_STROKE_JOIN=sF,t.DEFAULT_DATA_INDEX=bO,t.DEFAULT_DATA_KEY=xO,t.DEFAULT_DATA_SERIES_FIELD=SO,t.DEFAULT_KEY=VO,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=iF,t.DEFAULT_MAP_LOOK_UP_KEY=NO,t.DEFAULT_MEASURE_CANVAS_ID=yO,t.DEFAULT_SERIES_STYLE_NAME=AO,t.DEFAULT_SMOOTH_INTERPOLATE=eF,t.Factory=YR,t.MOSAIC_CAT_END_PERCENT=zO,t.MOSAIC_CAT_START_PERCENT=FO,t.MOSAIC_VALUE_END_PERCENT=DO,t.MOSAIC_VALUE_START_PERCENT=IO,t.ManualTicker=class extends hw{constructor(t){super(t),this.lastFrameTime=0,this.status=Ro.RUNNING}setupTickHandler(){const t=new cw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===Ro.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Ro.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Ro.RUNNING,!0}},t.PREFIX=mO,t.SEGMENT_FIELD_END=HO,t.SEGMENT_FIELD_START=jO,t.STACK_FIELD_END=TO,t.STACK_FIELD_END_OffsetSilhouette=BO,t.STACK_FIELD_END_PERCENT=CO,t.STACK_FIELD_KEY=kO,t.STACK_FIELD_START=MO,t.STACK_FIELD_START_OffsetSilhouette=EO,t.STACK_FIELD_START_PERCENT=wO,t.STACK_FIELD_TOTAL=PO,t.STACK_FIELD_TOTAL_BOTTOM=OO,t.STACK_FIELD_TOTAL_PERCENT=LO,t.STACK_FIELD_TOTAL_TOP=RO,t.StreamLight=class extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=Ao.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Wl,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=Ao.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_;const y=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(y){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:qo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(_=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==_?_:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:qo.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=cl(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=cl(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(ae.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;evoid>": { "properties": { - "__@toStringTag@12595": { + "__@toStringTag@12608": { "type": "string" }, "size": { @@ -81476,14 +81476,14 @@ } }, "required": [ - "__@toStringTag@12595", + "__@toStringTag@12608", "size" ], "type": "object" }, "Map": { "properties": { - "__@toStringTag@12595": { + "__@toStringTag@12608": { "type": "string" }, "size": { @@ -81491,14 +81491,14 @@ } }, "required": [ - "__@toStringTag@12595", + "__@toStringTag@12608", "size" ], "type": "object" }, "Map": { "properties": { - "__@toStringTag@12595": { + "__@toStringTag@12608": { "type": "string" }, "size": { @@ -81506,14 +81506,14 @@ } }, "required": [ - "__@toStringTag@12595", + "__@toStringTag@12608", "size" ], "type": "object" }, "Map>": { "properties": { - "__@toStringTag@12595": { + "__@toStringTag@12608": { "type": "string" }, "size": { @@ -81521,14 +81521,14 @@ } }, "required": [ - "__@toStringTag@12595", + "__@toStringTag@12608", "size" ], "type": "object" }, "Map": { "properties": { - "__@toStringTag@12595": { + "__@toStringTag@12608": { "type": "string" }, "size": { @@ -81536,14 +81536,14 @@ } }, "required": [ - "__@toStringTag@12595", + "__@toStringTag@12608", "size" ], "type": "object" }, "Map": { "properties": { - "__@toStringTag@12595": { + "__@toStringTag@12608": { "type": "string" }, "size": { @@ -81551,14 +81551,14 @@ } }, "required": [ - "__@toStringTag@12595", + "__@toStringTag@12608", "size" ], "type": "object" }, "Map": { "properties": { - "__@toStringTag@12595": { + "__@toStringTag@12608": { "type": "string" }, "size": { @@ -81566,7 +81566,7 @@ } }, "required": [ - "__@toStringTag@12595", + "__@toStringTag@12608", "size" ], "type": "object" @@ -82832,6 +82832,12 @@ "$ref": "#/definitions/ILayoutNumber", "description": "模块的布局大小:高度" }, + "hideWhenEmpty": { + "default": false, + "description": "当轴关联的系列没有收集到任何轴数据时,是否自动隐藏该轴。\n仅在 `visible !== false` 时生效。", + "since": "2.0.20", + "type": "boolean" + }, "hover": { "default": false, "description": "是否开启 hover 悬浮交互,默认关闭", @@ -103269,34 +103275,34 @@ }, "Promise": { "properties": { - "__@toStringTag@12595": { + "__@toStringTag@12608": { "type": "string" } }, "required": [ - "__@toStringTag@12595" + "__@toStringTag@12608" ], "type": "object" }, "Promise": { "properties": { - "__@toStringTag@12595": { + "__@toStringTag@12608": { "type": "string" } }, "required": [ - "__@toStringTag@12595" + "__@toStringTag@12608" ], "type": "object" }, "Promise": { "properties": { - "__@toStringTag@12595": { + "__@toStringTag@12608": { "type": "string" } }, "required": [ - "__@toStringTag@12595" + "__@toStringTag@12608" ], "type": "object" }, @@ -117443,6 +117449,7 @@ }, "interactInvertType": { "enum": [ + "background", "inside", "none", "stroked" diff --git a/packages/vchart-types/package.json b/packages/vchart-types/package.json index 96dd3b8737..025326e4d0 100644 --- a/packages/vchart-types/package.json +++ b/packages/vchart-types/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vchart-types", - "version": "2.0.19", + "version": "2.0.20", "description": "Provide the type declarations of VChart.", "sideEffects": false, "main": "types/index.d.ts", diff --git a/packages/vchart-types/types/compile/mark/interface.d.ts b/packages/vchart-types/types/compile/mark/interface.d.ts index 3b96d86b5b..f6603b995a 100644 --- a/packages/vchart-types/types/compile/mark/interface.d.ts +++ b/packages/vchart-types/types/compile/mark/interface.d.ts @@ -32,6 +32,7 @@ export interface IMarkStateManager { addStateInfo: (stateInfo: IStateInfo) => void; changeStateInfo: (stateInfo: Partial) => void; clearStateInfo: (stateValues: StateValue[]) => void; + clearAllStateInfo: () => void; checkOneState: (renderNode: IMarkGraphic, datum: Datum[], state: IStateInfo) => 'in' | 'out' | 'skip'; checkState: (renderNode: IMarkGraphic, datum: Datum[]) => StateValue[]; getStateMap: () => StateValueMap; diff --git a/packages/vchart-types/types/compile/mark/mark-state-manager.d.ts b/packages/vchart-types/types/compile/mark/mark-state-manager.d.ts index e05bed7b66..309e92c95d 100644 --- a/packages/vchart-types/types/compile/mark/mark-state-manager.d.ts +++ b/packages/vchart-types/types/compile/mark/mark-state-manager.d.ts @@ -14,6 +14,7 @@ export declare class MarkStateManager extends StateManager implements IMarkState private _clearStateBeforeSet; changeStateInfo(stateInfo: Partial): void; clearStateInfo(stateValues: StateValue[]): void; + clearAllStateInfo(): void; protected _isMultiMark(): boolean; checkOneState(renderNode: IMarkGraphic, datum: Datum[], state: IStateInfo): 'in' | 'out' | 'skip'; checkState(renderNode: IMarkGraphic, datum: Datum[]): StateValue[]; diff --git a/packages/vchart-types/types/component/axis/base-axis.d.ts b/packages/vchart-types/types/component/axis/base-axis.d.ts index 9190a0e13e..2c0bdfe499 100644 --- a/packages/vchart-types/types/component/axis/base-axis.d.ts +++ b/packages/vchart-types/types/component/axis/base-axis.d.ts @@ -1,3 +1,4 @@ +import type { IGroup } from '@visactor/vrender-core'; import type { ITickDataOpt } from '@visactor/vrender-components'; import type { IBaseScale } from '@visactor/vscale'; import type { IGraphic } from '@visactor/vrender-core'; @@ -28,7 +29,10 @@ export declare abstract class AxisComponent void; @@ -69,6 +74,9 @@ export declare abstract class AxisComponent number; _onTickDataChange: (compilableData: CompilableData) => void; registerTicksTransform: () => string; + _refreshVisibilityByData: () => boolean; } export declare class BandAxisMixin { private _tickDataMap; diff --git a/packages/vchart-types/types/component/axis/mixin/linear-axis-mixin.d.ts b/packages/vchart-types/types/component/axis/mixin/linear-axis-mixin.d.ts index b921ce2192..e58132507b 100644 --- a/packages/vchart-types/types/component/axis/mixin/linear-axis-mixin.d.ts +++ b/packages/vchart-types/types/component/axis/mixin/linear-axis-mixin.d.ts @@ -42,6 +42,7 @@ export interface LinearAxisMixin { _orient: IOrientType; _option: IComponentOption; niceLabelFormatter: (value: StringOrNumber) => StringOrNumber; + _refreshVisibilityByData: () => boolean; } export declare class LinearAxisMixin { protected _extend: { diff --git a/packages/vchart-types/types/component/legend/continuous/interface.d.ts b/packages/vchart-types/types/component/legend/continuous/interface.d.ts index 5fdb4df9a8..92833e393b 100644 --- a/packages/vchart-types/types/component/legend/continuous/interface.d.ts +++ b/packages/vchart-types/types/component/legend/continuous/interface.d.ts @@ -1,19 +1,22 @@ import type { IRectMarkSpec, ISymbolMarkSpec, ITextMarkSpec, StringOrNumber } from '../../../typings'; import type { ComponentThemeWithDirection } from '../../interface'; import type { ILegendCommonSpec, NoVisibleMarkStyle } from '../interface'; +import type { HandlerTextStyleContext } from '@visactor/vrender-components'; type Text = StringOrNumber; +type ContinuousLegendTextStyle = Omit, 'text'>; +type ContinuousLegendTextStyleCallback = (value: Text, position: 'start' | 'end', context: HandlerTextStyleContext) => ContinuousLegendTextStyle | undefined; export type TextAttribute = { visible?: boolean; text?: Text; space?: number; - style?: Omit, 'text'>; + style?: ContinuousLegendTextStyle; }; export type HandlerTextAttribute = { visible?: boolean; precision?: number; formatter?: (text: Text) => Text; space?: number; - style?: Omit, 'text'>; + style?: ContinuousLegendTextStyle | ContinuousLegendTextStyleCallback; }; export type IContinuousLegendSpec = ILegendCommonSpec & { inverse?: boolean; diff --git a/packages/vchart-types/types/data/transforms/circle-packing.d.ts b/packages/vchart-types/types/data/transforms/circle-packing.d.ts index 617e469e08..fb8944bf75 100644 --- a/packages/vchart-types/types/data/transforms/circle-packing.d.ts +++ b/packages/vchart-types/types/data/transforms/circle-packing.d.ts @@ -3,5 +3,6 @@ import type { CirclePackingOptions } from '@visactor/vlayouts'; export interface ICirclePackingOpt extends CirclePackingOptions { width: number; height: number; + valueField?: string; } export declare const circlePackingLayout: (data: Array, op: () => ICirclePackingOpt) => Datum[]; diff --git a/packages/vchart-types/types/mark/base/base-mark.d.ts b/packages/vchart-types/types/mark/base/base-mark.d.ts index cc967cb8d1..466387422a 100644 --- a/packages/vchart-types/types/mark/base/base-mark.d.ts +++ b/packages/vchart-types/types/mark/base/base-mark.d.ts @@ -188,4 +188,5 @@ export declare class BaseMark extends GrammarItem impleme hasAnimationByState(state: AnimationStateValues): boolean; hasAnimation(): boolean; runAnimation(): void; + clearBeforeReInit(): void; } diff --git a/packages/vchart-types/types/mark/interface/common.d.ts b/packages/vchart-types/types/mark/interface/common.d.ts index 76881fcf34..479c1e2b6f 100644 --- a/packages/vchart-types/types/mark/interface/common.d.ts +++ b/packages/vchart-types/types/mark/interface/common.d.ts @@ -99,6 +99,7 @@ export interface IMarkRaw extends ICompilableMark { needClear?: boolean; disableAnimationByState: (state: string | string[]) => void; enableAnimationByState: (state: string | string[]) => void; + clearBeforeReInit: () => void; } export type IMark = IMarkRaw; export interface ICompileMarkConfig extends IMarkConfig { diff --git a/packages/vchart/CHANGELOG.json b/packages/vchart/CHANGELOG.json index 0fad6eadd2..7869ac15f6 100644 --- a/packages/vchart/CHANGELOG.json +++ b/packages/vchart/CHANGELOG.json @@ -1,6 +1,39 @@ { "name": "@visactor/vchart", "entries": [ + { + "version": "2.0.19", + "tag": "@visactor/vchart_v2.0.19", + "date": "Thu, 26 Mar 2026 08:32:46 GMT", + "comments": { + "none": [ + { + "comment": "update changes for 008-fix-size-legend-handler-text: Allow size legend handlerText.style to accept function-based values in the same way other legend style hooks already do, and add regression coverage proving the style callback is preserved through continuous legend attribute transformation." + }, + { + "comment": "update changes for 009-fix-heatmap-scrollbar-axis-direction: Align ScrollBar with DataZoom by using the shared reverse-axis detection when converting scrollbar state percentages back into domain values." + }, + { + "comment": "update changes for 009-fix-issue-of-mark-state-when-updateSpec: Fix an issue where mark states were not properly cleared when updateSpec was called, causing incorrect state persistence." + }, + { + "comment": "update changes for 010-hide-empty-axes: Add an opt-in hideWhenEmpty axis option for cartesian axes." + }, + { + "comment": "fix: fix theme config of spec and option\n\n" + }, + { + "comment": "update changes for 009-fix-issue-of-mark-state-when-updateSpec: Fix an issue where mark states were not properly cleared when updateSpec was called, causing incorrect state persistence." + }, + { + "comment": "fix: datazoom update domain after data change. fix#4186" + }, + { + "comment": "chore: upgrade vutils, vdataset, vscale, vlayouts to ~1.0.23" + } + ] + } + }, { "version": "2.0.18", "tag": "@visactor/vchart_v2.0.18", diff --git a/packages/vchart/CHANGELOG.md b/packages/vchart/CHANGELOG.md index 1346dd186d..2ef0e4ea9b 100644 --- a/packages/vchart/CHANGELOG.md +++ b/packages/vchart/CHANGELOG.md @@ -1,6 +1,22 @@ # Change Log - @visactor/vchart -This log was last generated on Fri, 06 Mar 2026 11:34:27 GMT and should not be manually modified. +This log was last generated on Thu, 26 Mar 2026 08:32:46 GMT and should not be manually modified. + +## 2.0.19 +Thu, 26 Mar 2026 08:32:46 GMT + +### Updates + +- update changes for 008-fix-size-legend-handler-text: Allow size legend handlerText.style to accept function-based values in the same way other legend style hooks already do, and add regression coverage proving the style callback is preserved through continuous legend attribute transformation. +- update changes for 009-fix-heatmap-scrollbar-axis-direction: Align ScrollBar with DataZoom by using the shared reverse-axis detection when converting scrollbar state percentages back into domain values. +- update changes for 009-fix-issue-of-mark-state-when-updateSpec: Fix an issue where mark states were not properly cleared when updateSpec was called, causing incorrect state persistence. +- update changes for 010-hide-empty-axes: Add an opt-in hideWhenEmpty axis option for cartesian axes. +- fix: fix theme config of spec and option + + +- update changes for 009-fix-issue-of-mark-state-when-updateSpec: Fix an issue where mark states were not properly cleared when updateSpec was called, causing incorrect state persistence. +- fix: datazoom update domain after data change. fix#4186 +- chore: upgrade vutils, vdataset, vscale, vlayouts to ~1.0.23 ## 2.0.18 Fri, 06 Mar 2026 11:34:27 GMT diff --git a/packages/vchart/__tests__/unit/component/cartesian/axis/hide-when-empty.test.ts b/packages/vchart/__tests__/unit/component/cartesian/axis/hide-when-empty.test.ts new file mode 100644 index 0000000000..ce4553e524 --- /dev/null +++ b/packages/vchart/__tests__/unit/component/cartesian/axis/hide-when-empty.test.ts @@ -0,0 +1,123 @@ +import { default as VChartConstructor } from '../../../../../src'; +import { createCanvas, removeDom } from '../../../../util/dom'; + +describe('cartesian axis hideWhenEmpty', () => { + let canvasDom: HTMLCanvasElement; + let vchart: any; + + beforeEach(() => { + canvasDom = createCanvas(); + canvasDom.style.position = 'relative'; + canvasDom.style.width = '500px'; + canvasDom.style.height = '500px'; + canvasDom.width = 500; + canvasDom.height = 500; + }); + + afterEach(() => { + removeDom(canvasDom); + vchart?.release(); + }); + + const getAxis = (orient: string) => + vchart.getComponents().find((com: any) => com.layout?.layoutOrient === orient) as any; + + test('should hide axis on initial render when bound series has no collected data', () => { + vchart = new VChartConstructor( + { + type: 'line', + width: 400, + height: 300, + data: [{ id: 'lineData', values: [] }], + axes: [ + { id: 'axis-left', orient: 'left', hideWhenEmpty: true }, + { id: 'axis-bottom', orient: 'bottom', type: 'band' } + ], + series: [{ type: 'line', dataId: 'lineData', xField: 'x', yField: 'y' }] + } as any, + { + renderCanvas: canvasDom, + animation: false + } + ); + + vchart.renderSync(); + + const leftAxis = getAxis('left'); + expect(leftAxis.getVisible()).toBe(false); + expect(leftAxis.getLayoutRect().width).toBe(0); + }); + + test('should keep default behavior when hideWhenEmpty is not enabled', () => { + vchart = new VChartConstructor( + { + type: 'line', + width: 400, + height: 300, + data: [{ id: 'lineData', values: [] }], + axes: [ + { id: 'axis-left', orient: 'left' }, + { id: 'axis-bottom', orient: 'bottom', type: 'band' } + ], + series: [{ type: 'line', dataId: 'lineData', xField: 'x', yField: 'y' }] + } as any, + { + renderCanvas: canvasDom, + animation: false + } + ); + + vchart.renderSync(); + + const leftAxis = getAxis('left'); + expect(leftAxis.getVisible()).toBe(true); + }); + + test('should only hide empty bound axes and show them again after data updates', async () => { + vchart = new VChartConstructor( + { + type: 'common', + width: 400, + height: 300, + data: [ + { id: 'emptyLine', values: [] }, + { + id: 'activeLine', + values: [ + { x: 'Mon', y: 10 }, + { x: 'Tue', y: 20 } + ] + } + ], + axes: [ + { id: 'axis-left', orient: 'left', seriesIndex: [0], hideWhenEmpty: true }, + { id: 'axis-right', orient: 'right', seriesIndex: [1], hideWhenEmpty: true }, + { id: 'axis-bottom', orient: 'bottom', type: 'band' } + ], + series: [ + { type: 'line', dataId: 'emptyLine', xField: 'x', yField: 'y' }, + { type: 'line', dataId: 'activeLine', xField: 'x', yField: 'y' } + ] + } as any, + { + renderCanvas: canvasDom, + animation: false + } + ); + + vchart.renderSync(); + + const leftAxis = getAxis('left'); + const rightAxis = getAxis('right'); + expect(leftAxis.getVisible()).toBe(false); + expect(rightAxis.getVisible()).toBe(true); + + await vchart.updateData('emptyLine', [ + { x: 'Mon', y: 5 }, + { x: 'Tue', y: 15 } + ]); + + expect(leftAxis.getVisible()).toBe(true); + expect(leftAxis.getLayoutRect().width).toBeGreaterThan(0); + }); +}); diff --git a/packages/vchart/__tests__/unit/component/data-zoom/scroll-bar/scroll-bar.test.ts b/packages/vchart/__tests__/unit/component/data-zoom/scroll-bar/scroll-bar.test.ts index 6a7653b31d..448e6108a8 100644 --- a/packages/vchart/__tests__/unit/component/data-zoom/scroll-bar/scroll-bar.test.ts +++ b/packages/vchart/__tests__/unit/component/data-zoom/scroll-bar/scroll-bar.test.ts @@ -76,4 +76,48 @@ describe('ScrollBar', () => { expect(attrs.range[0]).toBeCloseTo(0.98); expect(attrs.range[1]).toBeCloseTo(1); }); + + it('should map reversed vertical axis state to top-first domain values', () => { + const spec: any = { + orient: 'right' + }; + + scrollBar = new ScrollBar(spec, option); + + const handleStateChange = jest.fn().mockReturnValue(true); + const emit = jest.fn(); + + (scrollBar as any)._handleStateChange = handleStateChange; + (scrollBar as any)._stateScale = { + type: 'band', + range: () => [100, 0], + domain: () => ['A', 'B', 'C', 'D'], + invert: (value: number) => { + if (value < 25) { + return 'A'; + } + if (value < 50) { + return 'B'; + } + if (value < 75) { + return 'C'; + } + return 'D'; + } + }; + (scrollBar as any)._relatedAxisComponent = { + getScale: () => ({ + range: () => [100, 0] + }), + getInverse: () => false + }; + (scrollBar as any).event = { emit }; + (scrollBar as any)._start = 0; + (scrollBar as any)._end = 1; + + (scrollBar as any)._handleChange(0, 0.5); + + expect(handleStateChange).toHaveBeenCalledWith('A', 'C'); + expect(emit).toHaveBeenCalled(); + }); }); diff --git a/packages/vchart/__tests__/unit/component/legend/continuous-legend.test.ts b/packages/vchart/__tests__/unit/component/legend/continuous-legend.test.ts new file mode 100644 index 0000000000..bb1d168559 --- /dev/null +++ b/packages/vchart/__tests__/unit/component/legend/continuous-legend.test.ts @@ -0,0 +1,36 @@ +import { getContinuousLegendAttributes } from '../../../../src/component/legend/continuous/util'; + +describe('Continuous legend handlerText', () => { + test('should transform static handlerText style', () => { + const attrs = getContinuousLegendAttributes({ + type: 'size', + handlerText: { + style: { + angle: 90, + dx: 8 + } + } + } as any); + + expect(attrs.handlerText.style.dx).toBe(8); + expect(attrs.handlerText.style.angle).toBe(Math.PI / 2); + }); + + test('should preserve callback-based handlerText style', () => { + const attrs = getContinuousLegendAttributes({ + type: 'size', + handlerText: { + style: (value: number, position: 'start' | 'end') => ({ + angle: 180, + dx: value + (position === 'start' ? 1 : 2) + }) + } + } as any); + + const style = attrs.handlerText.style(2, 'start', {}); + + expect(typeof attrs.handlerText.style).toBe('function'); + expect(style.dx).toBe(3); + expect(style.angle).toBe(Math.PI); + }); +}); diff --git a/packages/vchart/dist/index-wx-simple.min.js b/packages/vchart/dist/index-wx-simple.min.js index 5352129de5..cab7fea29c 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 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.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=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean");var u=t=>"function"==typeof t;var d=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=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||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=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||h(t,"Number")};var A=t=>S(t)&&Number.isFinite(t);var w=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 k=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const C=Object.prototype;var M=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||C)};const B=Object.prototype.hasOwnProperty;function E(t){if(d(t))return!0;if(b(t))return!t.length;const e=k(t);if("Map"===e||"Set"===e)return!t.size;if(M(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var R=(t,e,i)=>{const s=y(e)?e.split("."):e;for(let e=0;enull!=t&&O.call(t,e);function I(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=_(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||y(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=I(r,e,i)}return s}function L(t,e,i=!1,s=!1){if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&_(t[a])?F(t,a,n[a]):D(t,e,a,i,s)}}}}function D(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(_(a)){if(s)o=[];else if(_(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(y(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function U(t){return Object.prototype.toString.call(t)}function H(t){return Object.keys(t)}function z(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(U(t)!==U(e))return!1;if(u(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 s=t.length-1;s>=0;s--)if(!z(t[s],e[s],i))return!1;return!0}if(!m(t))return!1;const s=H(t),n=H(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(!z(t[r],e[r],i))return!1}return!0}function V(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;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;ne?1:t>=e?0:NaN}function J(t){return Number(t)}const Q="undefined"!=typeof console;function tt(t,e,i){const s=[e].concat([].slice.call(i));Q&&console[t].apply(console,s)}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(t=et.None,e){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(...t){this._onErrorHandler.forEach((e=>e(...t)))}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(...t){var e;return this._level>=et.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):tt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=et.Warn&&tt(this._method||"warn","WARN",t),this}info(...t){return this._level>=et.Info&&tt(this._method||"log","INFO",t),this}debug(...t){return this._level>=et.Debug&&tt(this._method||"log","DEBUG",t),this}}function st(t,e,i=0,s){for(d(s)&&(s=t.length);i>>1;Z(t[n],e)>0?s=n:i=n+1}return i}it._instance=null;const nt=1e-10,rt=1e-10;function at(t,e,i=rt,s=nt){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function ot(t,e,i,s){return t>e&&!at(t,e,i,s)}function lt(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var ct=function(t,e,i){return ti?i:t};var ut=(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 dt(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 s,n,r,a,o,l,h=0,c=!1,u=!1,d=!0;const p=!e&&0!==e&&pt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=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||u&&t-h>=r}function y(){const t=Date.now();if(v(t))return _(t);o=m(y,function(t){const i=t-h,s=e-(t-l);return u?Math.min(s,r-i):s}(t))}function _(t){return o=void 0,d&&s?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(y,e),c?f(t):a}(l);if(u)return o=m(y,e),f(l)}return void 0===o&&(o=m(y,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,u="maxWait"in i,u&&(r=Math.max(A(i.maxWait)?i.maxWait:0,e)),d="trailing"in i?!!i.trailing:d),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:_(Date.now())},b.pending=function(){return void 0!==o},b}function ft(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),gt(t,e,{leading:s,trailing:n,maxWait:e})}function mt(t,e){return i=>t*(1-i)+e*i}function vt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}pt=!1;const yt=1e-12,_t=Math.PI,bt=_t/2,xt=2*_t,St=2*Math.PI,At=Math.abs,wt=Math.atan2,Tt=Math.cos,kt=Math.max,Ct=Math.min,Mt=Math.sin,Bt=Math.sqrt,Et=Math.pow;function Rt(t){return t>=1?bt:t<=-1?-bt:Math.asin(t)}function Ot(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Pt(t,e){return t[0]*e[1]-t[1]*e[0]}function It(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}function Lt(t,e){return function(t,e=10){return Math.round(t*e)/e}(t-e,10**Math.max(It(t),It(e)))}class Dt{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new Dt(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 Ft{static distancePP(t,e){return Bt(Et(t.x-e.x,2)+Et(t.y-e.y,2))}static distanceNN(t,e,i,s){return Bt(Et(t-i,2)+Et(e-s,2))}static distancePN(t,e,i){return Bt(Et(e-t.x,2)+Et(i-t.y,2))}static pointAtPP(t,e,i){return new Dt((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function jt(t){return t*(Math.PI/180)}const Nt=(t=0)=>{if(t<0)for(;t<-xt;)t+=xt;else if(t>0)for(;t>xt;)t-=xt;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 Ht(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function zt(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=Ht(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)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function Vt(t){return(t=Ht(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 Wt(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function Gt(t,e,i,s){if(!function(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&h<=1&&[t[0]+n[0]*h,t[1]+n[1]*h]}var Yt;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(Yt||(Yt={}));const Xt=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function $t(t,e,i){if(t&&e){if(!i)return!(t.x1>e.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function qt(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Zt({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Jt(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Qt(t,e){const i=e?jt(t.angle):t.angle,s=Jt(t);return[Zt({x:t.x1,y:t.y1},i,s),Zt({x:t.x2,y:t.y1},i,s),Zt({x:t.x2,y:t.y2},i,s),Zt({x:t.x1,y:t.y2},i,s)]}function te(t,e,i=!1){const s=Qt(t,i),n=Qt(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Jt(t),Jt(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),u=i?jt(t.angle):t.angle;let d=i?jt(90-t.angle):t.angle+bt;const p=i?jt(e.angle):e.angle;let g=i?jt(90-e.angle):e.angle+bt;d>St&&(d-=St),g>St&&(g-=St);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(qt(n,i)+qt(n,s))/2>qt(n,a)};return f((t.x2-t.x1)/2,u,h,c)&&f((t.y2-t.y1)/2,d,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}function ee(t,e,i,s,n,r){if(r>e&&r>s||rn?o:0}const ie=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"};function se(t,e={},i){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")}class ne{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(d(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),d(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),d(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=se(this.textSpec),this._contextSaved=!0,this._context=t)}return!d(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:u,textBaseline:d=(null!=u?u:"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:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:d,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(d(t))return{width:0,height:0};if(d(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,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}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(d(this._numberCharSize)){const t=this._standardMethod(ne.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/ne.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return d(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(ne.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(d(this._letterCharSize)){const t=this._standardMethod(ne.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/ne.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}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)}}ne.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",ne.NUMBERS_CHAR_SET="0123456789",ne.FULL_SIZE_CHAR="字";const re=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),ae=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=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(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=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(t=0,e=0,i=0,s=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(t=0,e=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(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return oe(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 he extends le{}class ce extends le{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return te(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new ce(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Zt({x:this.x1,y:this.y1},this.angle,t),Zt({x:this.x2,y:this.y1},this.angle,t),Zt({x:this.x1,y:this.y2},this.angle,t),Zt({x:this.x2,y:this.y2},this.angle,t)]}}class ue{constructor(t=1,e=0,i=0,s=1,n=0,r=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 ue,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,u=s*this.e-n*this.f+r,d=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=u,this.f=d,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,u=o*t+h*e,d=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,f=o*n+h*r+this.f;return this.a=c,this.b=u,this.c=d,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new ue;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,u=-n/l,d=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:f,y:m}=t;e.x=f*h+m*u+p,e.y=f*c+m*d+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new ue(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=180*r.rotateDeg/Math.PI,r}}class de{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 pe(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 ge(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 fe=/^#([0-9a-f]{3,8})$/,me={transparent:4294967040},ve={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 ye(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function _e(t){return S(t)?new we(t>>16,t>>8&255,255&t,1):_(t)?new we(t[0],t[1],t[2]):new we(255,255,255)}function be(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function xe(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const Se=(t,e)=>{const i=fe.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new we((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?_e(t):8===e?new we(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class Ae{static Brighter(t,e=1){return 1===e?t:new Ae(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new Ae(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof Ae?t:new Ae(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(me[t]))return function(t){return S(t)?new we(t>>>24,t>>>16&255,t>>>8&255,255&t):_(t)?new we(t[0],t[1],t[2],t[3]):new we(255,255,255,1)}(me[t]);if(p(ve[t]))return _e(ve[t]);const e=`${t}`.trim().toLowerCase(),i=Se(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new we(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=pe(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new we(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=Ae.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new we(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=ge(this.color.r,this.color.g,this.color.b),r=pe(d(t)?n.h:ct(t,0,360),d(e)?n.s:e>=0&&e<=1?100*e:e,d(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new we(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!d(t)&&(this.color.r=t),!d(e)&&(this.color.g=e),!d(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=Se(e,!0);return null!=i?i:this}setColorName(t){const e=ve[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(t=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}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new Ae(this.color.toString())}copyGammaToLinear(t,e=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,e=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=be(t.color.r),this.color.g=be(t.color.g),this.color.b=be(t.color.b),this}copyLinearToSRGB(t){return this.color.r=xe(t.color.r),this.color.g=xe(t.color.g),this.color.b=xe(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class we{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`#${ye(this.r)+ye(this.g)+ye(this.b)+(1===this.opacity?"":ye(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}=ge(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function Te(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),u=Math.round(a*(1-t)+o*t);return new we(e,c,u,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:ge});function Ce(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,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 Me(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=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:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}class Be{static getInstance(){return Be.instance||(Be.instance=new Be),Be.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 Re;function Oe(t,e){const i=Ee(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 Pe{constructor(t={}){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 Ie=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Le(t){let e;if(e=Ie.exec(t))return new Pe({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 De=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Fe{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 Fe.instance||(Fe.instance=new Fe),Fe.instance}newFormat(t){const e=Le(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,u=e.type;"n"===u?(l=!0,u="g"):je[u]||(void 0===h&&(h=12),c=!0,u="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const d="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(u)?"0"+u.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(u)?this.percent:"",g=je[u],f=/[defgprstz%]/.test(u);h=void 0===h?6:/[gprs]/.test(u)?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=d,A=p,w=t;if("c"===u)A=g(w)+A,w="";else{w=+w;let t=w<0||1/w<0;if(w=isNaN(w)?m:g(Math.abs(w),h),c&&(w=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}(w)),t&&0==+w&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,A=("s"===u?De[8+Re/3]:"")+A+(t&&"("===n?")":""),f)for(e=-1,r=w.length;++ex||x>57){A=(46===x?y+w.slice(e+1):w.slice(e))+A,w=w.slice(0,e);break}}l&&!a&&(w=_(w,1/0));let T=S.length+w.length+A.length,k=T>1)+S+w+A+k.slice(T);break;default:w=k+S+w+A}return b(w)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=Le(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=Ee(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=De[8+n/3];return function(t){return s(r*t)+a}}}const je={"%":(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)=>Oe(100*t,e),r:Oe,s:function(t,e){const i=Ee(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(Re=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")+Ee(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 Ne=function(t,...e){return function(t,...e){t||(t={});let i=-1;const s=e.length;for(;++i{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.sort&&(A(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!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?"+"+$e(e,6):$e(e,4))+"-"+$e(t.getUTCMonth()+1,2)+"-"+$e(t.getUTCDate(),2)+(r?"T"+$e(i,2)+":"+$e(s,2)+":"+$e(n,2)+"."+$e(r,3)+"Z":n?"T"+$e(i,2)+":"+$e(s,2)+":"+$e(n,2)+"Z":s||i?"T"+$e(i,2)+":"+$e(s,2)+"Z":"")}function qe(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 Ge;if(h)return h=!1,We;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(;a{const s=!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))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let ei=0;function ii(t="dataset"){return ei>1e8&&(ei=0),t+"_"+ei++}class si{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:ii("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 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()}}class ni{constructor(t,e){let i;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=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&z(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:ii("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){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,e=!0){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)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}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,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&z(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof ni||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?j({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!d(this._fields)&&d(i)?(this.dataSet.registerTransform("fields",Ve),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}class ri{static GenAutoIncrementId(){return ri.auto_increment_id++}}ri.auto_increment_id=0;class ai{constructor(t){this.id=ri.GenAutoIncrementId(),this.registry=t}}const oi="named",li="inject",hi="multi_inject",ci="inversify:tagged",ui="inversify:paramtypes";class di{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===oi?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var pi=function(t){var e;return function(t){const e="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),s=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),n=new WeakMap;function r(t,e,i){let r=n.get(t);if(h(r)){if(!i)return;r=new s,n.set(t,r)}let a=r.get(e);if(h(a)){if(!i)return;a=new s,r.set(e,a)}return a}function a(t,e,i){if(o(t,e,i))return!0;const s=f(e);return!c(s)&&a(t,s,i)}function o(t,e,i){const s=r(e,i,!1);return!h(s)&&!!s.has(t)}function l(t,e,i){if(o(t,e,i))return function(t,e,i){const s=r(e,i,!1);if(!h(s))return s.get(t)}(t,e,i);const s=f(e);return c(s)?void 0:l(t,s,i)}function h(t){return void 0===t}function c(t){return null===t}function u(t){return"object"==typeof t?null!==t:"function"==typeof t}function d(t,i){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const s=3===i?"string":5===i?"number":"default",n=function(t,e){const i=t[e];if(null!=i){if(!g(i))throw new TypeError;return i}}(t,e);if(void 0!==n){const e=n.call(t,s);if(u(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(g(e)){const i=e.call(t);if(!u(i))return i}const i=t.valueOf;if(g(i)){const e=i.call(t);if(!u(e))return e}}else{const e=t.valueOf;if(g(e)){const i=e.call(t);if(!u(i))return i}const i=t.toString;if(g(i)){const e=i.call(t);if(!u(e))return e}}throw new TypeError}(t,"default"===s?"number":s)}function p(t){const e=d(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function g(t){return"function"==typeof t}function f(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const s=t.prototype,n=s&&Object.getPrototypeOf(s);if(null==n||n===Object.prototype)return e;const r=n.constructor;return"function"!=typeof r||r===t?e:r}t("defineMetadata",(function(t,e,i,s){if(!u(i))throw new TypeError;return n=t,a=e,void r(i,s,!0).set(n,a);var n,a})),t("hasMetadata",(function(t,e,i){if(!u(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!u(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!u(e))throw new TypeError;return h(i)||(i=p(i)),l(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function gi(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};pi.hasOwnMetadata(t,e)&&(r=pi.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,pi.defineMetadata(t,r,e)}(ci,t,i.toString(),s)}function fi(t){return(e,i,s)=>{gi(e,0,s,t)}}function mi(t){return e=>(i,s,n)=>fi(new di(t,e))(i,s,n)}const vi=mi(li),yi=mi(hi);function _i(){return function(t){return pi.defineMetadata(ui,null,t),t}}function bi(t){return fi(new di(oi,t))}const xi="Singleton",Si="Transient",Ai="ConstantValue",wi="DynamicValue",Ti="Factory",ki="Function",Ci="Instance",Mi="Invalid";class Bi{constructor(t,e){this.id=ri.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=Mi,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new Bi(this.serviceIdentifier,this.scope);return t.activated=t.scope===xi&&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 Ei{getConstructorMetadata(t){return{compilerGeneratedMetadata:pi.getMetadata(ui,t),userGeneratedMetadata:pi.getMetadata(ci,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const Ri=(Oi=oi,t=>{const e=e=>{if(null==e)return!1;if(e.key===Oi&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const Li=Symbol("ContributionProvider");class Di{constructor(t,e){this.serviceIdentifier=t,this.container=e,ji.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function Fi(t,e){t(Li).toDynamicValue((({container:t})=>new Di(e,t))).inSingletonScope().whenTargetNamed(e)}class ji{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}ji.store=new Map;class Ni{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 Ui extends Ni{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const Hi=Symbol.for("EnvContribution"),zi=Symbol.for("VGlobal"),Vi=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Si,this.options=e,this.id=ri.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new Ei}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,oi,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new Bi(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new Ii(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[li],multiInject:s[hi]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:a,metadata:e,bindings:l};n.push(t)}}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case Ai:case ki:e=t.cache;break;case Ci: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===xi&&(t.cache=e,t.activated=!0)}},Wi=Symbol.for("RenderService");const Gi=new class{get renderService(){return this._renderService||(this._renderService=Vi.get(Wi)),this._renderService}};let Yi=0;class Xi{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=Gi.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++Yi,t),this.tryRunAnimationFrameNextFrame(),Yi}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class $i{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var Ki=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qi=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zi=function(t,e){return function(i,s){e(i,s,t)}},Ji=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 Qi=class extends $i{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}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){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=ri.GenAutoIncrementId(),this.hooks={onSetEnv:new Ui(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}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)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new Xi);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}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)}loadFont(t,e,i){return Ji(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}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,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var ts,es,is,ss;Qi=Ki([_i(),Zi(0,vi(Li)),Zi(0,bi(Hi)),qi("design:paramtypes",[Object])],Qi),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(ts||(ts={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(es||(es={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(is||(is={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(ss||(ss={}));const ns=xt-1e-8;class rs{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>ns)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,u=-1/0,d=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),lu&&(u=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=xt)<0&&(s+=xt),(n%=xt)<0&&(n+=xt),nn;++o,a-=bt)g(a);else for(a=s-s%bt+bt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const os=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,ls={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},hs={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let cs,us,ds,ps,gs,fs;var ms,vs,ys,_s,bs,xs;function Ss(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,u=o*r,d=l*a,p=Math.cos(s),g=Math.sin(s),f=Math.cos(n),m=Math.sin(n),v=.5*(n-s),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,w=S+_*m,T=A-_*f;return[h*b+c*x,u*b+d*x,h*w+c*T,u*w+d*T,h*S+c*A,u*S+d*A]}function As(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=jt(a),c=Math.sin(h),u=Math.cos(h),d=u*(o-t)*.5+c*(l-e)*.5,p=u*(l-e)*.5-c*(o-t)*.5;let g=d*d/((i=Math.abs(i))*i)+p*p/((s=Math.abs(s))*s);g>1&&(g=Math.sqrt(g),i*=g,s*=g);const f=u/i,m=c/i,v=-c/s,y=u/s,_=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 w=Math.sqrt(A);r===n&&(w=-w);const T=.5*(_+x)-w*(S-b),k=.5*(b+S)+w*(x-_),C=Math.atan2(b-k,_-T);let M=Math.atan2(S-k,x-T)-C;M<0&&1===r?M+=xt:M>0&&0===r&&(M-=xt);const B=Math.ceil(Math.abs(M/(bt+.001))),E=[];for(let t=0;te.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 Ts(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=Os(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Ct(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=kt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Ct(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(kt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function Is(t,e){const{p0:i,p1:s}=t,n=Ft.pointAtPP(i,s,e);return[new Ls(i,n),new Ls(n,s)]}class Ls extends ks{constructor(t,e){super(),this.type=bs.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return Ft.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=wt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?Ft.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===_s.ROW?At(this.p0.x-this.p1.x):t===_s.COLUMN?At(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class Ds{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new Ps(new Dt(this._lastX,this._lastY),new Dt(t,e),new Dt(i,s),new Dt(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new Ls(new Dt(this._lastX,this._lastY),new Dt(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===_s.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return At(t.p0.y-s.y)}if(t===_s.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return At(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class Fs extends Ds{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 js(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function Ns(t,e,i){const s=null!=e?e:At(i[i.length-1].x-i[0].x)>At(i[i.length-1].y-i[0].y)?_s.ROW:_s.COLUMN;return"monotoneY"===t?new Fs(t,s):new Ds(t,s)}class Us{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 Hs(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Ns("linear",i,t);return function(t,e){js(t,e,1)}(new Us(n,s),t),n}function zs(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 Vs{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&&zs(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:zs(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 Ws(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Hs(t,e);const n=Ns("basis",i,t);return function(t,e){js(t,e,2)}(new Vs(n,s),t),n}function Gs(t){return t<0?-1:1}function Ys(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(Gs(r)+Gs(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Xs(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function $s(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 Ks{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:$s(this,this._t0,Xs(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,$s(this,Xs(this,e=Ys(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:$s(this,this._t0,e=Ys(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 qs extends Ks{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Zs(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Hs(t,e);const n=Ns("monotoneX",i,t);return function(t,e){js(t,e,2)}(new Ks(n,s),t),n}function Js(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Hs(t,e);const n=Ns("monotoneY",i,t);return function(t,e){js(t,e,2)}(new qs(n,s),t),n}let Qs=class{constructor(t,e=.5,i){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;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):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()}};class tn extends Qs{lineEnd(){this.context.closePath()}}function en(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Ds("step",null!=s?s:At(t[t.length-1].x-t[0].x)>At(t[t.length-1].y-t[0].y)?_s.ROW:_s.COLUMN);return sn(new Qs(r,e,n),t),r}function sn(t,e){return js(t,e,1)}class nn extends Us{lineEnd(){this.context.closePath()}}function rn(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Ns("linear",i,t);return function(t,e){js(t,e,1)}(new nn(n,s),t),n}function an(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>yt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>yt){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function on(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return Hs(i,n);const o=Ns(t,r,i);return js(new e(o,s,a),i,2),o}}const ln=on("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:an(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const hn=on("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:an(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class cn extends ks{constructor(t,e,i){super(),this.type=bs.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return Rs(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,Cs([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===_s.ROW?At(this.p0.x-this.p2.x):t===_s.COLUMN?At(this.p0.y-this.p2.y):0}getAngleAt(t){const e=kt(t-.01,0),i=Ct(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return wt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=Rs(i,s,n,e),a=Ft.pointAtPP(i,s,e),o=Ft.pointAtPP(s,n,e);return[new cn(i,a,r),new cn(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class un{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new Ls(new Dt(this._lastX,this._lastY),new Dt(t,e))}quadraticCurveTo(t,e,i,s){const n=new cn(new Dt(this._lastX,this._lastY),new Dt(t,e),new Dt(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new Ps(new Dt(this._lastX,this._lastY),new Dt(t,e),new Dt(i,s),new Dt(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function dn(t,e,i){var s,n;switch(e){case"linear":default:return Hs(t,i);case"basis":return Ws(t,i);case"monotoneX":return Zs(t,i);case"monotoneY":return Js(t,i);case"step":return en(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Ds("step",null!=s?s:At(t[t.length-1].x-t[0].x)>At(t[t.length-1].y-t[0].y)?_s.ROW:_s.COLUMN);return sn(new tn(r,e,n),t),r}(t,.5,i);case"stepBefore":return en(t,0,i);case"stepAfter":return en(t,1,i);case"catmullRom":return ln(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return hn(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return rn(t,i)}}class pn extends as{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new rs(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([hs.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([hs.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([hs.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([hs.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([hs.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([hs.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([hs.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([hs.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([hs.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()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new un(this);Ts(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[hs.M]=t=>`M${t[1]} ${t[2]}`,t[hs.L]=t=>`L${t[1]} ${t[2]}`,t[hs.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[hs.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[hs.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3];((t,e,i,s,n,r,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,u=(i%l+l)%l;o?(u>=h&&(u-=l),c=u-h):(u<=h&&(u+=l),c=u-h);const d=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/d;for(let e=0;e`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[hs.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;tfs){let t,e=ds;for(let s=1,r=i.length;s{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,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,u=0,d=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),Ts(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===_s.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return At(t.p0.y-e.p1.y)}if(this.direction===_s.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return At(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{it.getInstance().warn("空函数")}}),Rn=Object.assign(Object.assign({},An),{points:[],cornerRadius:0,closePath:!0}),On=Object.assign(Object.assign({},An),{width:100,height:100,spikes:5,thickness:.5}),Pn=Object.assign(Object.assign({},An),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},An),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const In=Object.assign(Object.assign({},An),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),Ln=Object.assign(Object.assign(Object.assign({},An),bn),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Dn=Object.assign(Object.assign(Object.assign({},An),bn),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",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}),Fn=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0,maxWidth:500,maxHeight:500},An),{fill:!0,cornerRadius:0,cornerType:"round"}),jn=Object.assign(Object.assign({},Fn),{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}),Nn=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:d(p)}}();return v(t.endCall)||i("Missing )"),s}}(s)}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,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=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=u();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=u();return t||i("Missing positioning value"),t}}function u(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function d(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=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 s=v(e);if(s)return{type:t,value:s[i]}}function v(t){const i=/^[\n\r\t\s]+/.exec(e);i&&y(i[0].length);const s=t.exec(e);return s&&y(s[0].length),s}function y(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=d(s);return e.length>0&&i("Invalid input not EOF"),t}()}}();class Un{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(Un.IsGradientStr(t))try{const e=Nn(t)[0];if(e){if("linear"===e.type)return Un.ParseLinear(e);if("radial"===e.type)return Un.ParseRadial(e);if("conic"===e.type)return Un.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=_t/2,n=parseFloat(e.value)/180*_t-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+St,stops:Un.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:Un.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=_t/2;let n="angular"===e.type?parseFloat(e.value)/180*_t:0;for(;n<0;)n+=St;for(;n>=St;)n-=St;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,u,d):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,u,d):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,u;const d=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(u=e.r1)&&void 0!==u?u:.5));return e.stops.forEach((t=>{d.addColorStop(t.offset,t.color)})),d}(t,c,p,g,u,d))}return h||"orange"}const Vn={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"}},Wn=!0,Gn=!1,Yn=/\w|\(|\)|-/,Xn=/[.?!,;:/,。?!、;:]/,$n=/\S/,Kn=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function qn(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=Gi.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=Zn(t,a)),a}function Zn(t,e,i=!1){let s=e;for(;Yn.test(t[s-1])&&Yn.test(t[s])||Xn.test(t[s]);)if(s--,s<=0)return i?Jn(t,e):e;return s}function Jn(t,e){let i=e;for(;Yn.test(t[i+1])&&Yn.test(t[i])||Xn.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Qn(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=Gi.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}var tr=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 er=class{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=Ln.fontSize}){let i=0,s=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 a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=Zn(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_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){if(s===n){it.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}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),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);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}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),u=this.measureTextWidth(c,e);return h+u>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,u,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,a=!1){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=Zn(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}};er=tr([_i()],er);var ir=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 sr=Symbol.for("TextMeasureContribution");let nr=class extends er{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}};nr=ir([_i()],nr);const rr=Symbol.for("CanvasFactory"),ar=Symbol.for("Context2dFactory");function or(t){return Vi.getNamed(rr,Gi.global.env)(t)}const lr=1e-4,hr=Math.sqrt(3),cr=1/3;function ur(t){return t>-wr&&twr||t<-wr}const pr=[0,0],gr=[0,0],fr=[0,0];function mr(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function vr(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function yr(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 _r(t){return(t%=St)<0&&(t+=St),t}function br(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+u&&c>s+u&&c>r+u&&c>o+u||ct+u&&h>i+u&&h>n+u&&h>a+u||h=0&&pi||c+hn&&(n+=St);let u=Math.atan2(l,o);return u<0&&(u+=St),u>=s&&u<=n||u+St>=s&&u+St<=n}function Ar(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(ur(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 kr=[-1,-1,-1],Cr=[-1,-1];function Mr(){const t=Cr[0];Cr[0]=Cr[1],Cr[1]=t}function Br(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=u*u-4*c*d;if(ur(t)){const t=u/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*(-u+e),s=c*o+1.5*a*(-u-e);i=i<0?-Math.pow(-i,cr):Math.pow(i,cr),s=s<0?-Math.pow(-s,cr):Math.pow(s,cr);const n=(-o-(i+s))/(3*a);n>=0&&n<=1&&(r[p++]=n)}else{const t=(2*c*o-3*a*u)/(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+hr*Math.sin(e)))/(3*a),h=(-o+i*(s-hr*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,kr);if(0===c)return 0;let u=0,d=-1,p=0,g=0;for(let h=0;h1&&Mr(),p=yr(e,s,r,o,Cr[0]),d>1&&(g=yr(e,s,r,o,Cr[1]))),2===d?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(ur(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,kr);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=vr(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);kr[0]=-l,kr[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=St-1e-4){s=0,n=St;const e=r?1:-1;return a>=kr[0]+t&&a<=kr[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=St,n+=St);let c=0;for(let e=0;e<2;e++){const i=kr[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=St+t),(t>=s&&t<=n||t+St>=s&&t+St<=n)&&(t>_t/2&&t<1.5*_t&&(e=-e),c+=e)}}return c}function Or(t){return Math.round(t/_t*1e8)/1e8%2*_t}function Pr(t,e){let i=Or(t[0]);i<0&&(i+=St);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=St?n=i+St:e&&i-n>=St?n=i-St:!e&&i>n?n=i+(St-Or(i-n)):e&&i1&&(i||(h+=ee(c,u,d,p,s,n))),g&&(c=a[1],u=a[2],d=c,p=u);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;Ir[0]=S,Ir[1]=A,Pr(Ir,Boolean(a[6])),S=Ir[0],A=Ir[1];const w=S,T=A-S,k=!!(1-(a[6]?0:1)),C=(s-m)*y/y+m;switch(f){case hs.M:d=m,p=v,c=d,u=p;break;case hs.L:if(i){if(Ar(c,u,m,v,e,s,n))return!0}else h+=ee(c,u,m,v,s,n)||0;c=m,u=v;break;case hs.C:if(i){if(xr(c,u,m,v,y,_,b,x,e,s,n))return!0}else h+=Br(c,u,m,v,y,_,b,x,s,n)||0;c=b,u=x;break;case hs.Q:if(i){if(br(c,u,m,v,y,_,e,s,n))return!0}else h+=Er(c,u,m,v,y,_,s,n)||0;c=y,u=_;break;case hs.A:if(o=Math.cos(w)*y+m,l=Math.sin(w)*y+v,g?(d=o,p=l):h+=ee(c,u,o,l,s,n),i){if(Sr(m,v,y,w,w+T,k,e,C,n))return!0}else h+=Rr(m,v,y,w,w+T,k,C,n);c=Math.cos(w+T)*y+m,u=Math.sin(w+T)*y+v;break;case hs.R:if(d=c=m,p=u=v,o=d+y,l=p+_,i){if(Ar(d,p,o,p,e,s,n)||Ar(o,p,o,l,e,s,n)||Ar(o,l,d,l,e,s,n)||Ar(d,l,d,p,e,s,n))return!0}else h+=ee(o,p,o,l,s,n),h+=ee(d,l,d,p,s,n);break;case hs.Z:if(i){if(Ar(c,u,d,p,e,s,n))return!0}else h+=ee(c,u,d,p,s,n);c=d,u=p}}return i||(g=u,f=p,Math.abs(g-f)=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jr=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Nr=Symbol.for("VWindow"),Ur=Symbol.for("WindowHandlerContribution");let Hr=class extends $i{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(){super(),this.hooks={onChange:new Ui(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(Vi.getNamed(Ur,t.env).configure(this,t),this.actived=!0)},this._uid=ri.GenAutoIncrementId(),this.global=Gi.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}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.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}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&&at(this.width,t.width())&&at(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)}};Hr=Fr([_i(),jr("design:paramtypes",[])],Hr);var zr=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vr=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wr=function(t,e){return function(i,s){e(i,s,t)}};let Gr=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=Gi.global,this._textMeasureMap=new Map,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}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||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=Dr.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="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:bn.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new ne(Object.assign({defaultFontParams:{fontFamily:bn.fontFamily,fontSize:bn.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+ne.ALPHABET_CHAR_SET+ne.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=Vi.get(Nr),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 Yr;Gr=zr([_i(),Wr(0,vi(Li)),Wr(0,bi(sr)),Vr("design:paramtypes",[Object])],Gr),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Yr||(Yr={}));const Xr=new ue;let $r=class{constructor(){this.matrix=new ue}init(t){return this.mode=Yr.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Yr.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Xr.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(Xr.a,Xr.b,Xr.c,Xr.d,Xr.e,Xr.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Xr.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(Xr.a,Xr.b,Xr.c,Xr.d,Xr.e,Xr.f),this}scale(t,e,i){return this.mode===Yr.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Yr.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Xr.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Xr.a,Xr.b,Xr.c,Xr.d,Xr.e,Xr.f),this}translate(t,e){return this.mode===Yr.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Yr.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};$r=zr([_i(),Vr("design:paramtypes",[])],$r);const Kr={arc:wn,area:Tn,circle:kn,line:Bn,path:En,symbol:In,text:Ln,rect:Pn,polygon:Rn,star:On,richtext:Dn,richtextIcon:jn,image:Fn,group:Cn,glyph:Mn},qr=Object.keys(Kr);function Zr(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Jr={arc:Object.assign({},Kr.arc),area:Object.assign({},Kr.area),circle:Object.assign({},Kr.circle),line:Object.assign({},Kr.line),path:Object.assign({},Kr.path),symbol:Object.assign({},Kr.symbol),text:Object.assign({},Kr.text),rect:Object.assign({},Kr.rect),polygon:Object.assign({},Kr.polygon),star:Object.assign({},Kr.star),richtext:Object.assign({},Kr.richtext),richtextIcon:Object.assign({},Kr.richtextIcon),image:Object.assign({},Kr.image),group:Object.assign({},Kr.group),glyph:Object.assign({},Kr.glyph)};class Qr{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},qr.forEach((t=>{this._defaultTheme[t]=Object.create(Jr[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,i=!1){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,it.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;qr.forEach((s=>{const n=Object.create(Jr[s]);t&&t[s]&&Zr(n,t[s]),i[s]&&Zr(n,i[s]),e[s]&&Zr(n,e[s]),this.combinedTheme[s]=n})),e.common&&qr.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 ta=new Qr;function ea(t,e){return t.glyphHost?ea(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)):ta.getTheme()}return null}(t)||t.attachedThemeGraphic&&ea(t.attachedThemeGraphic)||ta.getTheme()}var ia=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 sa 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=ri.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){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,e=!1){return ia(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,e=!0){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,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)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===t||t===e)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===t)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,e=!1){let 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,e=!1){let 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,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof aa))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(ca(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 aa))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=ca(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 aa))return void it.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=ca(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 aa))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=ca(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 aa))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=ha.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(ca(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(ca(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,ca(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(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 aa))return void it.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"):ca(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 oa))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,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=ha.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.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),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 ua(s,{clickInterval:a,supportsTouchEvents:o}),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 aa,this.rootWheelEvent=new oa,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&&y(t)&&!P(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.addEventListener("pointermove",this.onPointerMove,!0),t.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.addEventListener("mousemove",this.onPointerMove,!0),t.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.removeEventListener("pointermove",this.onPointerMove,!0),t.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.removeEventListener("mousemove",this.onPointerMove,!0),t.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 fa{static GetImage(t,e){var i;const s=fa.cache.get(t);s?"fail"===s.loadState?Gi.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):fa.loadImage(t,e)}static GetSvg(t,e){var i;let s=fa.cache.get(t);s?"fail"===s.loadState?Gi.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"},fa.cache.set(t,s),s.dataPromise=Gi.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.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=fa.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},fa.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Gi.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Gi.global.loadBlob(t):"json"===e&&(i.dataPromise=Gi.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!fa.isLoading&&fa.toLoadAueue.length){fa.isLoading=!0;const t=fa.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(fa.cache.set(i,n),n.dataPromise=Gi.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))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{fa.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),fa.loading()})).catch((t=>{console.error(t),fa.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),fa.loading()}))}}),0)}static loadImage(t,e){const i=ma(t,fa.toLoadAueue);if(-1!==i)return fa.toLoadAueue[i].marks.push(e),void fa.loading();fa.toLoadAueue.push({url:t,marks:[e]}),fa.loading()}static improveImageLoading(t){const e=ma(t,fa.toLoadAueue);if(-1!==e){const t=fa.toLoadAueue.splice(e,1);fa.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function ma(t,e){for(let i=0;it?_(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(_a[0]=t[0],_a[2]=t[0],_a[1]=t[1],_a[3]=t[1],_a):t:t:0,xa=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Sa=[1,2,3,0,1,2,3,0];function Aa(t,e,i,s){for(;t>=St;)t-=St;for(;t<0;)t+=St;for(;t>e;)e+=St;xa[0].x=i,xa[1].y=i,xa[2].x=-i,xa[3].y=-i;const n=Math.ceil(t/bt)%4,r=Math.ceil(e/bt)%4;if(s.add(Tt(t)*i,Mt(t)*i),s.add(Tt(e)*i,Mt(e)*i),n!==r||e-t>_t){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new Dt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new Dt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{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)}}Ca.TimeOut=1e3/60;const Ma=new Ca,Ba=(t,e)=>{const i=((t,e)=>y(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};class Ea{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}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function Ra(t,e,i,s,n){return n?t.arc(i,s,e,0,xt,!1,n):t.arc(i,s,e,0,xt),!1}var Oa=new class extends Ea{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 Ra(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Ra(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(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 Pa=new class extends Ea{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,this.parseSize(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,this.parseSize(e)/6,i,s,n,r)}};function Ia(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 La=new class extends Ea{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 Ia(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return Ia(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Ia(t,this.parseSize(e)/2+n,i,s,r)}};function Da(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Fa=new class extends Ea{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Da(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Da(t,this.parseSize(e)/2+n,i,s)}};function ja(t,e,i,s,n=0){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}class Na extends Ea{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 ja(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return ja(t,this.parseSize(e)/2,i,s,n)}}var Ua=new Na;var Ha=new class extends Na{constructor(){super(...arguments),this.type="triangle"}};const za=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Va=Math.sin(xt/10)*za,Wa=-Math.cos(xt/10)*za;function Ga(t,e,i,s){const n=Va*e,r=Wa*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=xt*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 Ya=new class extends Ea{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 Ga(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ga(t,this.parseSize(e)/2+n,i,s)}};const Xa=Bt(3);function $a(t,e,i,s){const n=e,r=n/Xa,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 Ka=new class extends Ea{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 $a(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return $a(t,this.parseSize(e)/2+n,i,s)}};function qa(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 Za=new class extends Ea{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return qa(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return qa(t,this.parseSize(e)/2+n,i,s)}};function Ja(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Qa=new class extends Ea{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Ja(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ja(t,this.parseSize(e)/2+n,i,s)}};const to=-.5,eo=Bt(3)/2,io=1/Bt(12);function so(t,e,i,s){const n=e/2,r=e*io,a=n,o=e*io+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(to*n-eo*r+i,eo*n+to*r+s),t.lineTo(to*a-eo*o+i,eo*a+to*o+s),t.lineTo(to*l-eo*h+i,eo*l+to*h+s),t.lineTo(to*n+eo*r+i,to*r-eo*n+s),t.lineTo(to*a+eo*o+i,to*o-eo*a+s),t.lineTo(to*l+eo*h+i,to*h-eo*l+s),t.closePath(),!1}var no=new class extends Ea{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 so(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return so(t,this.parseSize(e)/2+n,i,s)}};function ro(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}var ao=new class extends Ea{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 ro(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return ro(t,this.parseSize(e)/2,i,s,n)}};function oo(t,e,i,s,n=0){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}var lo=new class extends Ea{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 oo(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return oo(t,this.parseSize(e)/2,i,s,n)}};function ho(t,e,i,s,n=0){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}var co=new class extends Ea{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 ho(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return ho(t,this.parseSize(e)/2,i,s,n)}};const uo=Bt(3);function po(t,e,i,s){const n=e*uo;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var go=new class extends Ea{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return po(t,this.parseSize(e)/2/uo,i,s)}drawOffset(t,e,i,s,n){return po(t,this.parseSize(e)/2/uo+n,i,s)}};function fo(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 mo=new class extends Ea{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 fo(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return fo(t,this.parseSize(e)/4+n,i,s)}};function vo(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 yo=new class extends Ea{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 vo(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return vo(t,this.parseSize(e)/4+n,i,s)}};function _o(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 bo=new class extends Ea{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 _o(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return _o(t,this.parseSize(e)/4+n,i,s)}};function xo(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 So=new class extends Ea{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 xo(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return xo(t,this.parseSize(e)/4+n,i,s)}};function Ao(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var wo=new class extends Ea{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return Ao(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Ao(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function To(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var ko=new class extends Ea{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return To(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return To(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function Co(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 Mo=new class extends Ea{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 Co(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Co(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function Bo(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function Eo(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var Ro=new class extends Ea{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)?Eo(t,e,i,s):Bo(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?Eo(t,e+2*n,i,s):Bo(t,[e[0]+2*n,e[1]+2*n],i,s)}};const Oo=new he;class Po{constructor(t,e,i=!1){this.pathStr="",this.type=t,_(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Ts(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Ts(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{Oo.x1=i.bounds.x1*t,Oo.y1=i.bounds.y1*t,Oo.x2=i.bounds.x2*t,Oo.y2=i.bounds.y2*t,e.union(Oo)}))}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 Io={};[Oa,Pa,La,Fa,go,Ha,Ya,Ka,Za,Qa,no,ao,lo,Ua,co,mo,yo,bo,So,Ro,wo,ko,Mo].forEach((t=>{Io[t.type]=t}));const Lo={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"};class Do{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 Fo(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function jo(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",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=jo(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Fo(t,"--\x3e",r+4,"Comment is not closed.");else{const a=jo(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 Do(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 Do(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 Ho(t,e){return zo(t)}function zo(t,e){const i={};for(let e=0;eZo.set(t,!0)));const Jo=new Map;function Qo(t){if(Zo.has(t))return!0;if(Jo.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>Jo.set(t,!0)));const tl=Ko(),el=Ko(),il=Ko(),sl=Ko(),nl=Ko(),rl=Ko(),al=Ko(),ol=Ko(),ll=Ko(),hl=Ko();Ko();const cl=Ko();Ko();const ul=Ko();Ko();const dl=Ko(),pl=Ko(),gl=Symbol.for("GraphicService"),fl=Symbol.for("GraphicCreator"),ml={"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"},vl=Object.keys(ml),yl={duration:200,easing:"cubicOut"};function _l(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}function bl(t,e,i){const s=i[0],n=i[1],r=i[2];let a,o,l,h,c,u,d,p,g,f,m,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],u=e[5],d=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]=u,t[6]=d,t[7]=p,t[8]=g,t[9]=f,t[10]=m,t[11]=v,t[12]=a*s+c*n+g*r+e[12],t[13]=o*s+u*n+f*r+e[13],t[14]=l*s+d*n+m*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function xl(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 Sl(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],u=e[8],d=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]=_*s+b*o+x*u+S*f,t[1]=_*n+b*l+x*d+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]=_*s+b*o+x*u+S*f,t[5]=_*n+b*l+x*d+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]=_*s+b*o+x*u+S*f,t[9]=_*n+b*l+x*d+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]=_*s+b*o+x*u+S*f,t[13]=_*n+b*l+x*d+S*m,t[14]=_*r+b*h+x*p+S*v,t[15]=_*a+b*c+x*g+S*y,t}function Al(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 wl{constructor(){this.pools=[]}static identity(t){return _l(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 wl.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},Ml=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Bl=new ue(1,0,0,1,0,0),El={x:0,y:0};let Rl=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ue(1,0,0,1,0,0),this.path=new pn,this._clearMatrix=new ue(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Tl.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new ue(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(Tl.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Tl.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){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,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=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(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){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},El),function(t,e,i){return Lr(t,0,!1,e,i)}(this.path.commandList,El.x,El.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},El);const i=Hn(this,this.lineWidth,this.dpr);return function(t,e,i,s){return Lr(t,e,!0,i,s)}(this.path.commandList,i,El.x,El.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(t=!0,e=this.dpr){this.setTransformFromMatrix(Bl,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Tl.free(t))),this.stack.length=0}};Rl=Cl([_i(),Ml("design:paramtypes",[Object,Number])],Rl);const Ol={WIDTH:500,HEIGHT:500,DPR:1};class Pl{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}set nativeCanvas(t){this._nativeCanvas=t}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=Ol.WIDTH,height:n=Ol.HEIGHT,dpr:r=Ol.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(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var Il;Pl.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Il||(Il={}));class Ll{static Get(t,e=Il.Color1,i=[0,0,0,1]){if(e===Il.Color1){const e=Ll.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=Ae.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];Ll.store1[t]=e,Ll.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=Ll.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=Ae.parseColorString(t);return n&&(Ll.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],Ll.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===Il.Color1){if(Ll.store1[t])return;Ll.store1[t]=i,Ll.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Ll.store255[t])return;Ll.store255[t]=i,Ll.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Dl(t,e=!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 Fl(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)=>{var a,o;return jl(_(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,_(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):jl(t,e,i,s,n)}function jl(t,e,i,s,n){if(!t||!e)return t&&Dl(t)||e&&Dl(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Ll.Get(t,Il.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Ll.Get(e,Il.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:Dl(a)})))});return o?Fl(r,l,i,s,n):Fl(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:zl(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:zl(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:zl(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),Dl(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)}function Nl(t,e,i){return`rgba(${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})`}Ll.store255={},Ll.store1={};const Ul=[0,0,0,0],Hl=[0,0,0,0];function zl(t,e,i){return Ll.Get(t,Il.Color255,Ul),Ll.Get(e,Il.Color255,Hl),`rgba(${Math.round(Ul[0]+(Hl[0]-Ul[0])*i)},${Math.round(Ul[1]+(Hl[1]-Ul[1])*i)},${Math.round(Ul[2]+(Hl[2]-Ul[2])*i)},${Ul[3]+(Hl[3]-Ul[3])*i})`}class Vl{static GetCanvas(){try{return Vl.canvas||(Vl.canvas=Gi.global.createCanvas({})),Vl.canvas}catch(t){return null}}static GetCtx(){if(!Vl.ctx){const t=Vl.GetCanvas();Vl.ctx=t.getContext("2d")}return Vl.ctx}}class Wl extends de{static getInstance(){return Wl._instance||(Wl._instance=new Wl),Wl._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=Vl.GetCanvas(),s=Vl.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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new Wl(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Gl{static GetSize(t){for(let e=0;e=t)return Gl.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Gl.GenKey(t,e,i,s,n),l=Gl.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=Gl.GenKey(t,e,i,s,n);Gl.cache[l]?Gl.cache[l].push({width:a,height:o,pattern:r}):Gl.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}Gl.cache={},Gl.ImageSize=[20,40,80,160,320,640,1280,2560];const Yl=new he,Xl=new ue;new he;const $l=["lineWidth","scaleX","scaleY","angle","anchor","visible"],Kl=["x","y"],ql=["scaleX","scaleY"],Zl=["angle"],Jl=new Dt,Ql={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class th extends sa{static mixin(t){const e=Object.keys(t);for(let i=0;i10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=Io[t];if(e)return e;if(e=th.userSymbolMap[t],e)return e;if(!0===((i=t=Lo[t]||t).startsWith("{const e=(new pn).fromString(t.d),i={};vl.forEach((e=>{t[e]&&(i[ml[e]]=t[e])})),n.push({path:e,attribute:i}),Yl.union(e.bounds)}));const r=Yl.width(),a=Yl.height(),o=1/kt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new Po(t,n,!0);return th.userSymbolMap[t]=l,l}var i;const s=(new pn).fromString(t),n=s.bounds.width(),r=s.bounds.height(),a=1/kt(n,r);s.transform(0,0,a,a);const o=new Po(t,s);return th.userSymbolMap[t]=o,o}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,s=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:n=e.boundsPadding}=i,r=ba(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new rs(t);return Ts(e.commandList,i,0,0),!0}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(t=!0){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(t=!0){return this._transMatrix||(this._transMatrix=new ue),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&ms.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&ms.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&ms.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&ms.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&ms.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&ms.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=ms.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===vs.GLOBAL){const i=new Dt(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){this.setAttributes(t,e,i),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||s)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,i){t&&((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,e=!1,i){const s=Object.keys(t);for(let e=0;e{i[e]?(o||(o={}),o[e]=t[e]):a[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(r=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==r?r:yl;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:a,duration:l.duration,easing:l.easing}}]),o&&this.setAttributesAndPreventAnimate(o,!1,{type:ys.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t)}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:ys.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{type:ys.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(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,i;const s=this.attribute[t];return this.animates&&this.animates.size?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=s?s:null===(i=this.finalAttribute)||void 0===i?void 0:i[t]}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){const i=_(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);s.length!==this.currentStates.length&&this.useStates(s,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;this.stateSort&&(t=t.sort(this.stateSort));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|=ms.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=ms.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=ms.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&ms.UPDATE_SHAPE_AND_BOUNDS)===ms.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=ms.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=ms.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=ms.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=ms.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=ms.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=ms.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=ms.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&ms.UPDATE_LAYOUT)}getAnchor(t,e,i){const s=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=mn.x,y:e=mn.y,scaleX:i=mn.scaleX,scaleY:s=mn.scaleY,angle:n=mn.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(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,u=e.d,d=e.e,p=e.f,g=Tt(a),f=Mt(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const y=m-i,_=v-s,b=l*g+c*f,x=h*g+u*f,S=c*g-l*f,A=u*g-h*f;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*A,t.e=d+l*m+c*v-b*y-S*_,t.f=p+h*m+u*v-x*y-A*_}(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,!0),Gi.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(mn);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Xl.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.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:ys.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Gi.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),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 pn).fromString(t):this.pathProxy=new pn,this.pathProxy}loadImage(t,e=!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(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",this.stopAnimates(),Gi.graphicService.onRelease(this),super.release()}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new la(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)}}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||Gi.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new Rl(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}var eh;th.userSymbolMap={},th.mixin(da),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(eh||(eh={}));class ih extends th{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=rl,this._childUpdateTag=ms.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 Qr),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Qr)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===vs.GLOBAL){const i=new Dt(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&ms.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=mn.x,y:e=mn.y,dx:i=mn.dx,dy:s=mn.dy,scaleX:n=mn.scaleX,scaleY:r=mn.scaleY,angle:a=mn.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()}getGraphicTheme(){return ea(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return Gi.graphicService.updateTempAABBBounds(i),Gi.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=ms.CLEAR_BOUNDS,this._childUpdateTag&=ms.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=ms.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&ms.UPDATE_BOUNDS||(this._childUpdateTag|=ms.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(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().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),this.getGraphicService().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(t=!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&ms.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=Gi.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new ih(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ih.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}}function sh(t){return new ih(t)}ih.NOWORK_ANIMATE_ATTR=Ql;class nh extends ih{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 Qr,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!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=>{Gi.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=>{Gi.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 rh=Symbol.for("TransformUtil"),ah=Symbol.for("GraphicUtil"),oh=Symbol.for("LayerService"),lh=Symbol.for("StaticLayerHandlerContribution"),hh=Symbol.for("DynamicLayerHandlerContribution"),ch=Symbol.for("VirtualLayerHandlerContribution");var uh,dh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)};let gh=uh=class{static GenerateLayerId(){return`${uh.idprefix}_${uh.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Gi.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?Vi.get(lh):"dynamic"===t?Vi.get(hh):Vi.get(ch),e}createLayer(t,e={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 nh(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:uh.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)}};gh.idprefix="visactor_layer",gh.prefix_count=0,gh=uh=dh([_i(),ph("design:paramtypes",[])],gh);var fh=new ai((t=>{t(zi).to(Qi).inSingletonScope(),t(Nr).to(Hr),t(ah).to(Gr).inSingletonScope(),t(rh).to($r).inSingletonScope(),t(oh).to(gh).inSingletonScope()}));function mh(t,e){return!(!t&&!e)}function vh(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function yh(t,e,i){return i&&t*e>0}function _h(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function bh(t,e){return t*e>0}function xh(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Sh(t,e,i,s,n,r,a){const o=t-i,l=e-s,h=(a?r:-r)/Math.sqrt(o*o+l*l),c=h*l,u=-h*o,d=t+c,p=e+u,g=i+c,f=s+u,m=(d+g)/2,v=(p+f)/2,y=g-d,_=f-p,b=y*y+_*_,x=n-r,S=d*f-g*p,A=(_<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let w=(S*_-y*A)/b,T=(-S*y-_*A)/b;const k=(S*_+y*A)/b,C=(-S*y+_*A)/b,M=w-m,B=T-v,E=k-m,R=C-v;return M*M+B*B>E*E+R*R&&(w=k,T=C),{cx:w,cy:T,x01:-c,y01:-u,x11:w*(n/x-1),y11:T*(n/x-1)}}function Ah(t,e,i,s,n){const r=At(i-e),a=t.getParsedCornerRadius(),o=_(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:u,innerEndAngle:d,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,y=Math.max(f,g),b=Math.max(m,v);let x=y,S=b;const A=n*Tt(c),w=n*Mt(c),T=s*Tt(d),k=s*Mt(d);let C,M,B,E;if((b>yt||y>yt)&&(C=n*Tt(u),M=n*Mt(u),B=s*Tt(p),E=s*Mt(p),r<_t)){const t=function(t,e,i,s,n,r,a,o){const l=i-t,h=s-e,c=a-n,u=o-r;let d=u*l-c*h;return d*d1?0:R<-1?_t:Math.acos(R))/2),l=Bt(t[0]*t[0]+t[1]*t[1]);S=Ct(b,(s-l)/(o-1)),x=Ct(y,(n-l)/(o+1))}}var R;return{outerDeltaAngle:l,xors:A,yors:w,xirs:B,yirs:E,xore:C,yore:M,xire:T,yire:k,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:y,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:u,innerDeltaAngle:h,innerEndAngle:d,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function wh(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=At(l-o),c=l>o;let u=!1;if(n=St-yt)e.moveTo(i+n*Tt(o),s+n*Mt(o)),e.arc(i,s,n,o,l,!c),r>yt&&(e.moveTo(i+r*Tt(l),s+r*Mt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:d,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:y,maxOuterCornerRadius:_,xore:b,yore:x,xire:S,yire:A,outerStartAngle:w,outerEndAngle:T,limitedIcr:k,innerDeltaAngle:C,innerEndAngle:M,innerStartAngle:B,innerCornerRadiusStart:E,innerCornerRadiusEnd:R,maxInnerCornerRadius:O}=Ah(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+d,s+p),u=!0;else if(m>yt){const t=Ct(v,m),r=Ct(y,m),o=Sh(g,f,d,p,n,t,Number(c)),l=Sh(b,x,S,A,n,r,Number(c));m<_&&t===r?!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),e.arc(i+o.cx,s+o.cy,m,wt(o.y01,o.x01),wt(l.y01,l.x01),!c)):e.moveTo(i+o.cx+m*Tt(wt(l.y01,l.x01)),s+o.cy+m*Mt(wt(l.y01,l.x01))):!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),t>0&&e.arc(i+o.cx,s+o.cy,t,wt(o.y01,o.x01),wt(o.y11,o.x11),!c),e.arc(i,s,n,wt(o.cy+o.y11,o.cx+o.x11),wt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,wt(l.y11,l.x11),wt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Tt(wt(l.y01,l.x01)),s+l.cy+r*Mt(wt(l.y01,l.x01))):e.moveTo(i+b,s+n*Mt(T))}else!a||a[0]?(e.moveTo(i+d,s+p),e.arc(i,s,n,w,T,!c)):e.moveTo(i+n*Tt(T),s+n*Mt(T));if(!(r>yt)||C<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),u=!0;else if(k>yt){const t=Ct(E,k),n=Ct(R,k),o=Sh(S,A,b,x,r,-n,Number(c)),l=Sh(d,p,g,f,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),k0&&e.arc(i+o.cx,s+o.cy,n,wt(o.y01,o.x01),wt(o.y11,o.x11),!c),e.arc(i,s,r,wt(o.cy+o.y11,o.cx+o.x11),wt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,wt(l.y11,l.x11),wt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Tt(wt(l.y01,l.x01)),s+l.cy+t*Mt(wt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),!a||a[2]?e.arc(i,s,r,M,B,c):e.moveTo(i+r*Tt(B),s+r*Mt(B))}return a?a[3]&&e.lineTo(i+n*Tt(o),s+n*Mt(o)):e.closePath(),u}const Th=Symbol.for("ArcRenderContribution"),kh=Symbol.for("AreaRenderContribution"),Ch=Symbol.for("GroupRenderContribution"),Mh=Symbol.for("PathRenderContribution"),Bh=Symbol.for("PolygonRenderContribution"),Eh=Symbol.for("RectRenderContribution"),Rh=Symbol.for("SymbolRenderContribution"),Oh=Symbol.for("TextRenderContribution"),Ph=Symbol.for("InteractiveSubRenderContribution");function Ih(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function Lh(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}var Dh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Fh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jh=function(t,e){return function(i,s){e(i,s,t)}};function Nh(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:u=i.scaleY,scaleZ:d=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!==(s=m[2])&&void 0!==s?s:0}if(_l(t),bl(t,t,[n+o,r+l,a+h]),bl(t,t,[y[0],y[1],y[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],u=e[10],d=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+u*s,t[7]=l*n+d*s,t[8]=h*n-r*s,t[9]=c*n-a*s,t[10]=u*n-o*s,t[11]=d*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],u=e[10],d=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-u*s,t[3]=l*n-d*s,t[8]=r*s+h*n,t[9]=a*s+c*n,t[10]=o*s+u*n,t[11]=l*s+d*n}(t,t,p),bl(t,t,[-y[0],-y[1],y[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,u,d]),f){const i=kl.allocate(),s=[0,0];if(v){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=m[1]}bl(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],u=e[6],d=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+u*s,t[3]=l*n+d*s,t[4]=h*n-r*s,t[5]=c*n-a*s,t[6]=u*n-o*s,t[7]=d*n-l*s}(i,i,f),bl(i,i,[-s[0],-s[1],0]),Sl(t,t,i)}}let Uh=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new Ui(["graphic"]),onSetStage:new Ui(["graphic","stage"]),onRemove:new Ui(["graphic"]),onRelease:new Ui(["graphic"]),onAddIncremental:new Ui(["graphic","group","stage"]),onClearIncremental:new Ui(["graphic","group","stage"]),beforeUpdateAABBBounds:new Ui(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new Ui(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new Ui(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new he,this.tempAABBBounds2=new he}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)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new rs(t);return Ts(i.commandList,s,0,0),!0}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=Lh(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=Ih(n,e);i.set(s,i.y1,s+e,i.y2)}}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,u=this.tempAABBBounds1,d=this.tempAABBBounds2;if(a&&l){Xo(u,(l+h)/Math.abs(n+r),s,c),e.union(u),u.setValue(d.x1,d.y1,d.x2,d.y2)}if(o){const{shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;Xo(u,o/Math.abs(n+r)*2,!1,c+1),u.translate(s,a),e.union(u)}}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&&oe(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};Uh=Dh([_i(),jh(0,vi(fl)),Fh("design:paramtypes",[Object])],Uh);const Hh=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i};class zh{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=ts.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const u=[],d=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;u.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}d[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:d[0],height:d[1]};return this.LayoutBBox(p,e,i,u),this.layoutWithBBox(p,u,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;a{t+=e.str})),(Array.isArray(r)?r.join(""):r).toString()!==t}return"vertical"===s.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==s.text.toString():null!=this.clipedText&&this.clipedText!==s.text.toString()}get multilineLayout(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=pl,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}getGraphicTheme(){return ea(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new Wh({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Zt(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=Gi.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Xo(n,o/Math.abs(r+a),!0,l),i.union(n)}return Gi.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Gi.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oe(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:u,stroke:d=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:y=s.ignoreBuf,keepCenterInLine:_=s.keepCenterInLine}=n,b=y?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),d&&this._AABBBounds.expand(f/2),this._AABBBounds}const S=Gi.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new zh(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:u,suffixPosition:v,measureMode:g,keepCenterInLine:_}),{bbox:w}=A;return this.cache.layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(w.xOffset,w.yOffset,w.xOffset+w.width,w.yOffset+w.height),d&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:u,stroke:d=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,measureMode:v=r.measureMode,suffixPosition:y=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),w=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),d&&this._AABBBounds.expand(p/2),this._AABBBounds}const T=Gi.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),k={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:w},C=new zh(a,k,T),M=_(t)?t.map((t=>t.toString())):[t.toString()],B=[],E=[0,0];let R=1/0;if(b>0&&(R=Math.max(Math.floor(b/w),1)),x&&(R=Math.min(R,x)),"number"==typeof u&&u!==1/0){if(u>0)for(let t=0;t{t=Math.max(t,e.width)})),E[0]=t}else{let t,e,i=0;for(let s=0,n=M.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=kt(e,a)}));const t=Ih(y,a),e=this.cache.verticalList.length*v,i=Lh(_,e,u);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>function(t){const e=[];let i=0,s="";for(let n=0;n{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:u,fontWeight:d,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:u,fontWeight:d,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===qo.HORIZONTAL?u:r.measureTextWidth(t.text,{fontSize:u,fontWeight:d,fontFamily:c});a+=e,t.width=e}))})),this.cache.verticalList=b,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=kt(e,a)}));const x=Ih(y,a),S=this.cache.verticalList.length*v,A=Lh(_,S,u);return this._AABBBounds.set(A,x,A+S,x+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=Ba(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=Vh){return super.needUpdateTags(t,e)}needUpdateTag(t,e=Vh){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new Wh(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Wh.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return Wh.baselineMapAlign}getAlignMapBaseline(){return Wh.alignMapBaseline}}function Gh(t){return new Wh(t)}Wh.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Ql),Wh.baselineMapAlign={top:"left",bottom:"right",middle:"center"},Wh.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Yh=["symbolType","size",...$l];let Xh=class t extends th{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=dl}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}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{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return ea(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Gi.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Xo(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return Gi.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){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){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,Yh)}needUpdateTag(t){return super.needUpdateTag(t,Yh)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new pn).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new pn).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function $h(t){return new Xh(t)}Xh.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Ql);const Kh=["segments","points","curveType","curveTension",...$l];let qh=class t extends th{constructor(t={}){super(t),this.type="line",this.numberType=ol}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=Ta(i,s,e))}getGraphicTheme(){return ea(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),Gi.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Gi.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Kh)}needUpdateTag(t){return super.needUpdateTag(t,Kh)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new pn;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Zh(t){return new qh(t)}qh.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ql);const Jh=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=d(t.width)?t.x1-t.x:t.width,i=d(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}},Qh=["width","x1","y1","height","cornerRadius",...$l];class tc extends th{constructor(t){super(t),this.type="rect",this.numberType=cl}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return ea(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=Gi.graphicService.updateTempAABBBounds(i);return Hh(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Gi.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Qh)}needUpdateTag(t){return super.needUpdateTag(t,Qh)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=Jh(e);return t=new pn,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new tc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return tc.NOWORK_ANIMATE_ATTR}}function ec(t){return new tc(t)}tc.NOWORK_ANIMATE_ATTR=Ql;class ic{constructor(t,e,i,s,n,r,a,o,l,h,c,u,d,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=Vn[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=u,this.singleLine=d,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}}}function sc(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class nc{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=Ba(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Qn(t,i,this.ascentDescentMode);let u=0,d=0,p=0;this.height>l&&(u=(this.height-l)/2,d=Math.ceil(u),p=Math.floor(u)),"top"===this.textBaseline?(this.ascent=u,this.descent=l-u):"bottom"===this.textBaseline?(this.ascent=l-u,this.descent=u):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+d,this.descent=h+p),this.length=t.length,this.width=c||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,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r: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}=Qn(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=qn(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Qn(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const u=sc(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},u),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let u=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,u="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=qn(h,("vertical"===u?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===u);else{const{width:e}=Qn(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===u&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:d=1}=this.character;if(this.character.stroke&&d&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=sc(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=sc(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=sc(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=sc(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===u&&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=qn(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Qn(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const rc=["width","height","image",...$l];class ac extends th{constructor(t){super(t),this.type="image",this.numberType=al,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}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()})),this.addUpdateBoundTag()}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)}getGraphicTheme(){return ea(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=Gi.graphicService.updateTempAABBBounds(i);return Hh(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Gi.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return Fn[t]}needUpdateTags(t){return super.needUpdateTags(t,rc)}needUpdateTag(t){return super.needUpdateTag(t,rc)}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},Ql);class oc 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=ba(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=ba(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=Fn.width,height:e=Fn.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 lc{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 oc?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=Vn[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof nc){const e=$n.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,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof oc)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Qn(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof oc)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof oc)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||Gn;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,Kn(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||Wn;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?zn(t,s,{AABBBounds:i}):s,Kn(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof oc)break;const{width:n}=Qn(t,s.character,s.ascentDescentMode),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.forEach(((t,e)=>{i+=t instanceof oc?t.width:t.getWidthWithEllips(this.direction)})),i}}class hc{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=Vn[this.direction]}store(t){if(t instanceof oc){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 lc(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,e=!1){t instanceof oc?"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||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=qn(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new nc(i,t.newLine,t.character,t.ascentDescentMode),new nc(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let cc=!1;try{cc=Intl&&"function"==typeof Intl.Segmenter}catch(t){cc=!1}const uc=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...$l];class dc extends th{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=ul,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Dn.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:Dn.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:Dn.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:Dn.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:Dn.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:Dn.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:Dn.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:Dn.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return ea(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&y(t.text)&&dc.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&y(t.text)&&dc.splitText(t.text).length>1)))}static splitText(t){if(cc){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=dc.splitText(t.text.toString());if(y(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(d){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(u){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),Gi.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Gi.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Gi.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,uc)}needUpdateTag(t){return super.needUpdateTag(t,uc)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!dc.AllSingleCharacter(y)&&(y=dc.TransformTextConfig2SingleCharacter(y),this.attribute.textConfig=y);const _=[],b=null!=t?t:y;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,_.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,w="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),T="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),k=new ic(0,0,(w?n:x?i:0)||0,(T?r:A?s:0)||0,a,o,l,h,c,u||"horizontal",!w&&x,!T&&A,d||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),C=new hc(k);if(C.newLine=v,p){let t=0,e=!1;for(let i=0;i<_.length;i++){const s=_[i];e?(s.overflow=!0,s.left=1/0,s.top=1/0,!s.newLine&&k.lines[k.lines.length-1].paragraphs.push(s)):C.deal(s,!0),k.lines.length!==t&&(t=k.lines.length,C.lineBuffer.length=0,s.overflow=!0,s.left=1e3,s.top=1e3,k.lines[k.lines.length-1].paragraphs.push(s),e=!0),s.newLine&&(e=!1,C.lineWidth=0),C.send()}}else for(let t=0;t<_.length;t++)C.deal(_[t]);if(C.send(),!("horizontal"===k.layoutDirection?w:T)){const t=k.getActualSizeWidthEllipsis();let e="horizontal"===k.layoutDirection?t.width:t.height;("horizontal"===k.layoutDirection?x:A)&&(e=Math.min(e,"horizontal"===k.layoutDirection?i:s)),k.lines.forEach((function(t){t.calcOffset(e,!1)}))}v&&k.lines.forEach((t=>{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=k}clone(){return new dc(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(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())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return dc.NOWORK_ANIMATE_ATTR}}function pc(t){return new dc(t)}dc.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Ql);const gc=["path","customPath",...$l];class fc extends th{constructor(t){super(t),this.type="path",this.numberType=ll}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=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof pn?e.path:(d(this.cache)&&this.doUpdatePathShape(),this.cache instanceof pn?this.cache:t.path)}getGraphicTheme(){return ea(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=Gi.graphicService.updateTempAABBBounds(i);Hh(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return Gi.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;y(t.path,!0)?this.cache=(new pn).fromString(t.path):t.customPath&&(this.cache=new pn,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,gc)}needUpdateTag(t){return super.needUpdateTag(t,gc)}toCustomPath(){return(new pn).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new fc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return fc.NOWORK_ANIMATE_ATTR}}function mc(t){return new fc(t)}fc.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Ql);const vc=["segments","points","curveType","curveTension",...$l];class yc extends th{constructor(t){super(t),this.type="area",this.numberType=il}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}getGraphicTheme(){return ea(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),Gi.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return Gi.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),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}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Ta(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,vc)}needUpdateTag(t){return super.needUpdateTag(t,vc)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new pn;const 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 yc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return yc.NOWORK_ANIMATE_ATTR}}function _c(t){return new yc(t)}yc.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ql);const bc=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...$l];class xc extends th{constructor(t){super(t),this.type="arc",this.numberType=tl}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=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(_(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();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=Nt(e),i=e+r,s&&At(r)yt&&o>yt)return{startAngle:e-n*d*r,endAngle:i+n*d*a,sc:n*d*r,ec:n*d*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{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=Bt(a*a+o*o)}=this.attribute,h=At(e-t);let c=t,u=e,d=t,p=e;const g=r/2;let f=h,m=h;if(g>yt&&l>yt){const i=e>t?1:-1;let s=Rt(Number(l)/o*Mt(g)),n=Rt(Number(l)/a*Mt(g));return(f-=2*s)>yt?(s*=i,d+=s,p-=s):(f=0,d=p=(t+e)/2),(m-=2*n)>yt?(n*=i,c+=n,u-=n):(m=0,c=u=(t+e)/2),{outerStartAngle:c,outerEndAngle:u,innerStartAngle:d,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:u,innerStartAngle:d,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}getGraphicTheme(){return ea(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Gi.graphicService.updateTempAABBBounds(i);Hh(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return Gi.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=yt?i.set(0,0,0,0):Math.abs(o-l)>St-yt?i.set(-s,-s,s,s):(Aa(l,o,s,i),Aa(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,bc)}needUpdateTag(t){return super.needUpdateTag(t,bc)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=At(o-a),u=o>a;if(h=St-yt)n.moveTo(0+h*Tt(a),0+h*Mt(a)),n.arc(0,0,h,a,o,!u),l>yt&&(n.moveTo(0+l*Tt(o),0+l*Mt(o)),n.arc(0,0,l,o,a,u));else{const t=h*Tt(a),e=h*Mt(a),i=l*Tt(o),s=l*Mt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!u),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,u),n.closePath()}return n}clone(){return new xc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return xc.NOWORK_ANIMATE_ATTR}}function Sc(t){return new xc(t)}xc.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Ql);const Ac=["points","cornerRadius",...$l];class wc extends th{constructor(t){super(t),this.type="polygon",this.numberType=hl}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return ea(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),Gi.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Gi.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Ta(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Ac)}needUpdateTag(t){return super.needUpdateTag(t,Ac)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new pn,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new wc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return wc.NOWORK_ANIMATE_ATTR}}function Tc(t){return new wc(t)}wc.NOWORK_ANIMATE_ATTR=Ql;class kc extends ih{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!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 Cc(t){return new kc(t)}const Mc=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 Bc,Ec;function Rc(t){return Bc||(Bc=Mc.CreateGraphic("text",{})),Bc.initAttributes(t),Bc.AABBBounds}var Oc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Pc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ic=function(t,e){return function(i,s){e(i,s,t)}};class Lc{constructor(){this.time=xs.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u,d){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,backgroundKeepAspectRatio:_=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip}=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=ea(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:y,backgroundKeepAspectRatio:_,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s){const{backgroundMode:n,backgroundFit:r,backgroundKeepAspectRatio:a,backgroundScale:o=1,backgroundOffsetX:l=0,backgroundOffsetY:h=0}=s,c=i.width(),u=i.height();let d=c,p=u;if("no-repeat"===n)if(r)if(a){const s=Math.max(c/e.width,u/e.height);t.drawImage(e,i.x1+l,i.y1+h,e.width*s*o,e.height*s*o)}else t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const s=e.width*o,n=e.height*o;t.drawImage(e,i.x1+l,i.y1+h,s,n)}else{if(r&&"repeat"!==n&&(e.width||e.height)){const i=e.width,s=e.height;"repeat-x"===n?(d=i*(u/s),p=u):"repeat-y"===n&&(p=s*(c/i),d=c);const r=t.dpr,a=Dr.allocate({width:d,height:p,dpr:r}),o=a.getContext("2d");o&&(o.inuse=!0,o.clearMatrix(),o.setTransformForCurrent(!0),o.clearRect(0,0,d,p),o.drawImage(e,0,0,d,p),e=a.nativeCanvas),Dr.free(a)}const s=t.dpr,a=t.createPattern(e,n);a.setTransform&&a.setTransform(new DOMMatrix([1/s,0,0,1/s,0,0])),t.fillStyle=a,t.translate(i.x1,i.y1),t.fillRect(0,0,c,u),t.translate(-i.x1,-i.y1)}}}const Dc=new Lc;let Fc=class{constructor(t){this.subRenderContribitions=t,this.time=xs.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u,d){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,n,r,a,o,l,h,c,u,d)}))}};Fc=Oc([_i(),Ic(0,vi(Li)),Ic(0,bi(Ph)),Pc("design:paramtypes",[Object])],Fc);const jc=new class{constructor(){this.time=xs.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u,d){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||u),y=t.AABBBounds,_=null!==(p=t.attribute.width)&&void 0!==p?p:y.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:y.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[_,b],i+_/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const Nc=new class{constructor(){this.time=xs.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u,d){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||u||e.restore())}};class Uc{constructor(){this.time=xs.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=Dr.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])),Dr.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,St),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,u,d){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,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h;const{textureRatio:c=r.textureRatio,textureOptions:u=null}=e.attribute;let d=this.textureMap.get(t);if(!d)switch(t){case"circle":d=this.createCirclePattern(o,l,a,i);break;case"diamond":d=this.createDiamondPattern(o,l,a,i);break;case"rect":d=this.createRectPattern(o,l,a,i);break;case"vertical-line":d=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":d=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":d=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":d=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":d=this.createGridPattern(o,l,a,i)}if(u&&u.dynamicTexture){const{gridConfig:d={},useNewCanvas:p}=u,g=e.AABBBounds;s=g.x1,n=g.y1;const f=i;let m;if(p){m=Dr.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=m.getContext("2d");t.clearRect(0,0,g.width(),g.height()),s=0,n=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,s,n,r),f.clip();const v=g.width(),y=g.height(),_=l,b=o,x=d.columns?d.columns:Math.ceil(v/b),S=d.rows?d.rows:Math.ceil(y/b),A=d.gutterColumn?d.gutterColumn:2*_,w=d.gutterRow?d.gutterRow:2*_;this._tempSymbolGraphic||(this._tempSymbolGraphic=$h({}));const T=d.columns?v/d.columns:b,k=d.rows?y/d.rows:b;this._tempSymbolGraphic.setAttributes({size:[T-A,k-w],symbolType:t});const C=this._tempSymbolGraphic.getParsedPath();for(let t=0;t{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=T?o:Hn(e,o,e.dpr),c=o/C,d="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:C+d*h,innerRadius:k-d*h,startAngle:y-d*c,endAngle:_+d*c}),e.beginPath(),wh(t,e,i,s,C+d*h,k-d*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/A,(S-s)/w,l[r]),l[r].opacity=a,e.stroke()}};g&&M(d,"outerBorder"),f&&M(p,"innerBorder"),t.setAttributes({outerRadius:C,innerRadius:k,startAngle:y,endAngle:_})}},Vc=Hc,Wc=Dc;const Gc=new class extends Lc{constructor(){super(...arguments),this.time=xs.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,u){const{background:d,backgroundMode:p=l.backgroundMode,backgroundFit:g=l.backgroundFit,backgroundKeepAspectRatio:f=l.backgroundKeepAspectRatio,backgroundScale:m=l.backgroundScale,backgroundOffsetX:v=l.backgroundOffsetX,backgroundOffsetY:y=l.backgroundOffsetY}=t.attribute;if(d)if(t.backgroundImg&&t.resources){const i=t.resources.get(d);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,{backgroundMode:p,backgroundFit:g,backgroundKeepAspectRatio:f,backgroundScale:m,backgroundOffsetX:v,backgroundOffsetY:y}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=d,e.fill(),e.highPerformanceRestore()}},Yc=_t/2;function Xc(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=At(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=At(t[0]),l=[e,e,e,e];break;case 2:case 3:e=At(t[0]),i=At(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=At(l[0]),l[1]=At(l[1]),l[2]=At(l[2]),l[3]=At(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,u,d]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],y=[c[0],c[1]+g[1]],_=[u[0]-g[2],u[1]],b=[u[0],u[1]-g[2]],x=[d[0]+g[3],d[1]],A=[d[0],d[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!K(v,y)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Yc,0,!1)}if(o&&o[1]?o[1](y[0],y[1],b[0],b[1]):t.lineTo(b[0],b[1]),!K(_,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Yc,!1)}if(o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),!K(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Yc,_t,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!K(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],_t,_t+Yc,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],_[0],_[1]):t.lineTo(_[0],_[1]),o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}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};let Kc=class{constructor(){this.time=xs.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u,d){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(d.doStroke=!1)}};Kc=$c([_i()],Kc);let qc=class{constructor(){this.time=xs.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u){const{x1:d,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:y=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:d-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||_(v)&&v.every((t=>0===t)))){let n,r=0;return Xc(e,i,s,b,x,v,"bevel"!==y,new Array(4).fill(0).map(((a,o)=>(a,h,c,u)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,u),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};qc=$c([_i()],qc);const Zc=new class{constructor(){this.time=xs.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u){const{outerBorder:d,innerBorder:p}=t.attribute,g=d&&!1!==d.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:w,y1:T,keepStrokeScale:k=l.keepStrokeScale}=t.attribute;let{width:C,height:M}=t.attribute;C=(null!=C?C:w-i)||0,M=(null!=M?M:T-s)||0;const B=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=k?h:Hn(e,h,e.dpr),d=i+o*c,p=s+o*c,g=2*c;if(0===m||_(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(d,p,C-o*g,M-o*g)):(e.beginPath(),Xc(e,d,p,C-o*g,M-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&B(d,"outerBorder"),f&&B(p,"innerBorder")}},Jc=Hc,Qc=Dc;const tu=new class{constructor(){this.time=xs.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u){const d=t.getParsedPath();if(!d)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,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,w=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:Hn(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===d.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(_-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&w(p,"outerBorder"),m&&w(g,"innerBorder")}},eu=new class{constructor(){this.time=xs.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u,d){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:y=l.scaleX,scaleY:_=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,d;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(d=r.lineWidth)&&void 0!==d?d:t.attribute.lineWidth,r=e}r.stroke&&(u?u(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/y,(f-s)/_,l),e.stroke()))})),r&&!b.isSvg&&(u?u(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/y,(f-s)/_,l),e.stroke())))}},iu=Hc,su=Dc;const nu={x:0,y:0,z:0,lastModelMatrix:null};class ru{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(jc),this.builtinContributions.push(Nc),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===xs.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===xs.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,u,d){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,u,d)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,u,d){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,u,d)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=ea(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:u=l.opacity,fillOpacity:d=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=yh(u,d,h),_=bh(u,g),b=mh(h),x=vh(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(y||_||a||o))return!0;e.beginPath();return Ts(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),x&&(o?o(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):y&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),!0}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:u=e.visible}=t.attribute,d=yh(o,l,n),p=bh(o,c),g=mh(n,r),f=vh(a,h);return!(!t.valid||!u)&&!(!g&&!f)&&!!(d||p||i||s||r)&&{fVisible:d,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){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,u=i.modelMatrix,d=i.camera;nu.x=n,nu.y=r,nu.z=a,nu.lastModelMatrix=u;const p=d&&(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=kl.allocate(),n=kl.allocate();Nh(n,t,e),Sl(s,u||s,n),nu.x=0,nu.y=0,nu.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),kl.free(n)}if(g&&!u){const s=t.getOffsetXY(e);nu.x+=s.x,nu.y+=s.y,nu.z=a,i.setTransformForCurrent()}else if(p)nu.x=0,nu.y=0,nu.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(d&&i.project){const s=t.getOffsetXY(e);nu.x+=s.x,nu.y+=s.y,this.transformWithoutTranslate(i,nu.x,nu.y,nu.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),nu.x=0,nu.y=0,nu.z=0;return nu}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},u={x:n,y:r};s.camera=null;const d=1/(h.x*(u.y-c.y)-c.x*u.y+u.x*c.y+(c.x-u.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+u.y*o.x+(c.y-u.y)*a.x)*d,g=(c.y*l.y+h.y*(o.y-l.y)-u.y*o.y+(u.y-c.y)*a.y)*d,f=(h.x*(l.x-o.x)-c.x*l.x+u.x*o.x+(c.x-u.x)*a.x)*d,m=-(c.x*l.y+h.x*(o.y-l.y)-u.x*o.y+(u.x-c.x)*a.y)*d,v=(h.x*(u.y*o.x-c.y*l.x)+h.y*(c.x*l.x-u.x*o.x)+(u.x*c.y-c.x*u.y)*a.x)*d,y=(h.x*(u.y*o.y-c.y*l.y)+h.y*(c.x*l.y-u.x*o.y)+(u.x*c.y-c.x*u.y)*a.y)*d;s.setTransform(p,g,f,m,v,y,!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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:u,lastModelMatrix:d}=l;this.z=u,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==d&&kl.free(a.modelMatrix),a.modelMatrix=d),a.highPerformanceRestore()}}var au=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},lu=function(t,e){return function(i,s){e(i,s,t)}};let hu=class extends ru{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=tl,this.builtinContributions=[zc,Wc,Vc],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let u=h.endAngle;u=o;const d=u>c;let p=!1;if(nyt){const t=Ct(b,_),r=Ct(x,_),a=Sh(v,y,f,m,n,t,Number(d)),o=Sh(A,w,T,k,n,r,Number(d));if(_0&&e.arc(i+o.cx,s+o.cy,r,wt(o.y11,o.x11),wt(o.y01,o.x01),!d)}}else e.moveTo(i+f,s+m);if(!(r>yt)||M<.001)e.lineTo(i+T,s+k),p=!0;else if(C>yt){const t=Ct(E,C),n=Ct(R,C),a=Sh(T,k,A,w,r,-n,Number(d)),o=Sh(f,m,v,y,r,-t,Number(d));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),C0&&e.arc(i+a.cx,s+a.cy,n,wt(a.y01,a.x01),wt(a.y11,a.x11),!d);const t=wt(a.cy+a.y11,a.cx+a.x11),o=u-l-.03;e.arc(i,s,r,t,o,d)}}else e.lineTo(i+r*Tt(B),s+r*Mt(B));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:ea(t,null==r?void 0:r.theme).arc;const{fill:h=l.fill,stroke:u=l.stroke,x:d=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:w=l.outerRadius,innerRadius:T=l.innerRadius}=t.attribute;w+=b,T-=x;let k=0;const C=(c(S)&&S||S[0])&&"conical"===h.gradient;if(C){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();At(s-i){var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)ya[s]=t,i&&(i=!(null!==(e=ya[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)ya[e]=!!t[e],i&&(i=!!ya[e]);else ya[0]=!1,ya[1]=!1,ya[2]=!1,ya[3]=!1;return{isFullStroke:i,stroke:ya}})(u);if((y||B)&&(e.beginPath(),wh(t,e,i,s,w,T),M=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o),g?(this._runStroke(t,e,i,s,l,_,B,v,o),this._runFill(t,e,i,s,l,y,m,d,p,a)):(this._runFill(t,e,i,s,l,y,m,d,p,a),this._runStroke(t,e,i,s,l,_,B,v,o))),!B&&_&&(e.beginPath(),wh(t,e,i,s,w,T,E),M||this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o),o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(c(S)&&S||S[1])&&A){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(At(h-r)>=St-yt){e.beginPath();const r=Math.abs(w-T)/2/w,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,u=h;this.drawArcTailCapPath(t,e,i,s,w,T,u,u+r),M||this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const d=()=>{if(y){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+=St;for(;i>St;)i-=St;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),Fl(o.color,l.color,h,!1)}(0,0,h,n);a||yh&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}},p=()=>{_&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};d(),p()}}this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o),C&&(h.startAngle+=k,h.endAngle+=k)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=ea(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}};function cu(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]=Os(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 uu(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:u}=e;let d;if(c&&!1!==c.defined&&!i?d=l:c&&!1!==u.defined&&(d=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=d?d.x:e.p0.x,o=d?d.y:e.p0.y;t.moveTo(i+n,o+r,a)}else d&&(h=!s,t.lineTo(d.x+n,d.y+r,a))}return h}function du(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:u}=e;if(i>=1){if(h){let e,i=!0;u.forEach(((s,n)=>{s.originP1!==s.originP2?(i=uu(t,s,e,i,r,a,o),e=s):e=s}))}else u.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),cu(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let d;"x"===s?d=_s.ROW:"y"===s?d=_s.COLUMN:"auto"===s&&(d=e.direction);const p=i*e.tryUpdateLength(d);let g=0,f=!0,m=null;for(let e=0,i=u.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 gu=class extends ru{constructor(){super(...arguments),this.numberType=ol}draw(t,e,i,s){const n=ea(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,u,d,p,g){var f;if(!e)return;t.beginPath();du(t,e,l,h,{offsetX:c,offsetY:u,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),d.cache&&!_(d.cache)&&d.cache.curves.every((t=>t.defined))&&d.attribute.curveType&&d.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(d,a,o);const{x:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(d,a,m-c,v-u,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(d,a,m-c,v-u,o),t.stroke())),!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,u,d){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"===y)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,u,d,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}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=dn(x(t.points,v),y,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===y){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,u,d,n[g],[l,t.attribute],_,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,u,d,n[m],[l,t.attribute],Ct(y,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,u,d,t.attribute,l,_,b,i,s,t,a,o)}};function fu(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),cu(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),cu(t,l,1,s),o=!1):o=!0}t.closePath()}gu=pu([_i()],gu);const mu=new class extends Uc{constructor(){super(...arguments),this.time=xs.afterFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,u,d){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=d||{},{texture:y=(null!==(p=t.attribute.texture)&&void 0!==p?p:ka(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:ka(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:ka(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:ka(l,"texturePadding"))}=v;y&&this.drawTexture(y,t,e,i,s,l,_,b,x)}},vu=Dc;var yu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_u=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bu=function(t,e){return function(i,s){e(i,s,t)}};let xu=class extends ru{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=il,this.builtinContributions=[mu,vu],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,u,d){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,y=m[0];e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const i=m[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,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,u,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(u?u(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,u,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(_(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}d?d(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,u,d,p;const g=ea(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:y=g.z,strokeOpacity:_=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,w=S.doStroke&&S.sVisible,{clipRange:T=g.clipRange,closePath:k,points:C,segments:M}=t.attribute;let{curveType:B=g.curveType}=t.attribute;function E(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(k&&"linear"===B&&(B="linearClosed"),1===T&&!M&&!C.some((t=>!1===t.defined))&&"linear"===B)return this.drawLinearAreaHighPerformance(t,e,!!f,w,v,_,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(M&&M.length){let e,i;const s=M.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=dn(E(t.points,x),B,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=M.length-1;t>=0;t--){const e=M[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=M[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(u=s.y1)&&void 0!==u?u:s.y})}i.length>1&&(n=dn(E(i,x),"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!C||!C.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=E(C,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(d=e[t].x1)&&void 0!==d?d:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=dn(e,B,{curveTension:b}),n=dn(i,"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===T){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,w,_,r[c],[g,t.attribute],T,i,s,y,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=T*l;let c=0,u=!1;t.cacheArea.forEach(((l,d)=>{if(u)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(u=this.drawSegmentItem(e,l,A,v,w,_,r[d],[g,t.attribute],Ct(f,1),i,s,y,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,w,_,t.attribute,g,T,i,s,y,t,n,a,o)}draw(t,e,i,s){const n=ea(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,u,d,p,g,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,u,d,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,u,d,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=d.attribute;let y,b,x=_s.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],y=t.points[t.points.length-1]}else b=m[0],y=m[m.length-1];const S=At(y.x-b.x),A=At(y.y-b.y);x=null==y.x1?_s.ROW:null==y.y1?_s.COLUMN:Number.isFinite(S+A)?S>A?_s.ROW:_s.COLUMN:_s.ROW,function(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;ou?_s.ROW:_s.COLUMN,Number.isFinite(c)||(o=_s.COLUMN),Number.isFinite(u)||(o=_s.ROW);const d=i*(o===_s.ROW?c:u);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;_(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),du(t,i[0]?e.top:e.bottom,l,x===_s.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:u})),t.setStrokeStyle(d,a,w-h,T-c,o),t.stroke()}})(),!1}};xu=yu([_i(),bu(0,vi(Li)),bu(0,bi(kh)),_u("design:paramtypes",[Object])],xu);const Su=Hc,Au=Dc;var wu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Tu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ku=function(t,e){return function(i,s){e(i,s,t)}};let Cu=class extends ru{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ll,this.builtinContributions=[Au,Su],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const u=null!==(l=this.tempTheme)&&void 0!==l?l:ea(t,null==r?void 0:r.theme).path,{x:d=u.x,y:p=u.y,fillStrokeOrder:g=u.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,u,a,o);if(!m)return;const{fVisible:v,sVisible:y,doFill:_,doStroke:b}=m;if(e.beginPath(),t.pathShape)Ts(t.pathShape.commandList,e,i,s,1,1,f);else{Ts((null!==(c=t.attribute.path)&&void 0!==c?c:u.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,u),this.beforeRenderStep(t,e,i,s,_,b,v,y,u,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,u):y&&(e.setStrokeStyle(t,t.attribute,d-i,p-s,u),e.stroke()))},S=()=>{_&&(a?a(e,t.attribute,u):v&&(e.setCommonStyle(t,t.attribute,d-i,p-s,u),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,_,b,v,y,u,n,a,o)}draw(t,e,i,s){const n=ea(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Cu=wu([_i(),ku(0,vi(Li)),ku(0,bi(Mh)),Tu("design:paramtypes",[Object])],Cu);var Mu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Bu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Eu=function(t,e){return function(i,s){e(i,s,t)}};let Ru=class extends ru{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=cl,this.builtinContributions=[Zc,Qc,Jc],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:ea(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:u=l.stroke,cornerRadius:d=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:y=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:w=l.fillStrokeOrder,drawStrokeWhenZeroWH:T=l.drawStrokeWhenZeroWH}=t.attribute;let{width:k,height:C}=t.attribute;k=(null!=k?k:b-S)||0,C=(null!=C?C:x-A)||0;const M=_h(g,f,k,C,h),B=xh(g,v,k,C,T),E=mh(h,c),R=vh(u,m);if(!t.valid||!y)return;if(!E&&!R)return;if(!(M||B||a||o||c))return;0===d||_(d)&&d.every((t=>0===t))?(e.beginPath(),e.rect(i,s,k,C)):(e.beginPath(),Xc(e,i,s,k,C,d,"bevel"!==p));const O={doFill:E,doStroke:R};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,E,R,M,B,l,n,a,o,O),w?(this._runStroke(t,e,i,s,l,O,B,S,A,o),this._runFill(t,e,i,s,l,O,M,S,A,a)):(this._runFill(t,e,i,s,l,O,M,S,A,a),this._runStroke(t,e,i,s,l,O,B,S,A,o)),this.afterRenderStep(t,e,i,s,E,R,M,B,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=ea(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}};Ru=Mu([_i(),Eu(0,vi(Li)),Eu(0,bi(Eh)),Bu("design:paramtypes",[Object])],Ru);var Ou=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},Iu=function(t,e){return function(i,s){e(i,s,t)}};let Lu=class extends ru{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=dl,this.builtinContributions=[tu,su,iu,eu],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:ea(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:u=l.x,y:d=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:w=l.keepDirIn3d}=t.attribute,T=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let k=i,C=s,M=T;const B=e.camera;if(w&&B&&e.project){const t=e.project(i,s,T);e.camera=null,_(c)&&(c[0],c[1]),k=t.x,C=t.y,M=void 0}!1===A.draw(e,c,k,C,M,((n,r)=>{var h,c,v,y;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(y=r.lineWidth)&&void 0!==y?y:t.attribute.lineWidth,r=e}const _=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,u-i,d-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(u-i)/p,(d-s)/g,l),e.stroke()))};f?(x(),_()):(_(),x())}))&&e.closePath(),e.camera=B,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,y,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,u,d,A,m,p,g,o),this._runFill(t,e,i,s,l,x,y,u,d,A,a)):(this._runFill(t,e,i,s,l,x,y,u,d,A,a),this._runStroke(t,e,i,s,l,S,b,u,d,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,y,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,u,d,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/u,(l-s)/d,n),e.stroke()))}draw(t,e,i,s){const n=ea(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Lu=Ou([_i(),Iu(0,vi(Li)),Iu(0,bi(Rh)),Pu("design:paramtypes",[Object])],Lu);const Du=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new he)}allocate(t,e,i,s){if(!this.pools.length)return(new he).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 he(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(...t){this.pools=[]}};const Fu=new class extends Lc{constructor(){super(...arguments),this.time=xs.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,u){var d,p,f,m,v,y,_,b,x,S;const{backgroundMode:A=l.backgroundMode,backgroundFit:w=l.backgroundFit,backgroundKeepAspectRatio:T=l.backgroundKeepAspectRatio}=t.attribute;let k,{background:C}=t.attribute;if(!C)return;const M=()=>{"richtext"===t.type&&(e.restore(),e.save(),k&&e.setTransformFromMatrix(k,!0,1))};let B;"richtext"===t.type&&(k=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const E=g(C)&&C.background,R=t.transMatrix.onlyTranslate();if(E){const e=t.AABBBounds,i=(null!==(d=C.x)&&void 0!==d?d:e.x1)+(null!==(p=C.dx)&&void 0!==p?p:0),s=(null!==(f=C.y)&&void 0!==f?f:e.y1)+(null!==(m=C.dy)&&void 0!==m?m:0),n=null!==(v=C.width)&&void 0!==v?v:e.width(),r=null!==(y=C.height)&&void 0!==y?y:e.height();if(B=Du.allocate(i,s,i+n,s+r),C=C.background,!R){const t=B.width(),e=B.height();B.set((null!==(_=C.x)&&void 0!==_?_:0)+(null!==(b=C.dx)&&void 0!==b?b:0),(null!==(x=C.y)&&void 0!==x?x:0)+(null!==(S=C.dy)&&void 0!==S?S:0),t,e)}}else B=t.AABBBounds,R||(B=Rc(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(C);if("success"!==n.state||!n.data)return void M();e.highPerformanceSave(),R&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,B,{backgroundMode:A,backgroundFit:w,backgroundKeepAspectRatio:T}),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=C,n?(Xc(e,B.x1,B.y1,B.width(),B.height(),n,!0),e.fill()):e.fillRect(B.x1,B.y1,B.width(),B.height()),e.highPerformanceRestore()}E&&Du.free(B),M()}};var ju=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Uu=function(t,e){return function(i,s){e(i,s,t)}};let Hu=class extends ru{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=pl,this.builtinContributions=[Fu],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const u=ea(t,null==r?void 0:r.theme).text,{text:d,underline:p=u.underline,lineThrough:g=u.lineThrough,keepDirIn3d:f=u.keepDirIn3d,direction:m=u.direction,fontSize:v=u.fontSize,verticalMode:y=u.verticalMode,x:_=u.x,y:b=u.y}=t.attribute,x=null!==(l=Ba(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,u,a,o);if(!S)return;const{fVisible:A,sVisible:w,doFill:T,doStroke:k}=S,C=!f,M=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,u),this.beforeRenderStep(t,e,i,s,T,k,A,w,u,n,a,o),C&&this.transformUseContext2d(t,u,M,e);const B=(n,r,l,h)=>{let c=i+r;const d=s+l;if(h){e.highPerformanceSave(),c+=v;const t=Tl.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,d),e.transformFromMatrix(t,!0),Tl.free(t)}k&&(o?o(e,t.attribute,u):w&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,u),e.strokeText(n,c,d,M))),T&&(a?a(e,t.attribute,u):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,u),e.fillText(n,c,d,M))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,u,M),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;k&&(o?o(e,t.attribute,u):w&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,u),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,M)})))),T&&(a?a(e,t.attribute,u):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,u),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,M),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,M,u,e,{width:n.width})}))))}else{let{textAlign:i=u.textAlign,textBaseline:s=u.textBaseline}=t.attribute;if(!y){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=kt(e,o)}));let l=0,d=0;"bottom"===s?d=-a:"middle"===s&&(d=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;B(i,a-(e+1)*x+d,r,n),r+=s}))}))}C&&this.restoreTransformUseContext2d(t,u,M,e),this.afterRenderStep(t,e,i,s,T,k,A,w,u,n,a,o)}draw(t,e,i,s){const n=ea(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,l,h,c){if(e+t<=0)return;const{textAlign:u=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,y=!d(c),_=y?c.width:i.clipedWidth,b=y?0:Ih(u,_),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+_,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+_,t,o),h.stroke()}}};function zu(t,e,i,s){if(e&&e.length){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},$u=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ku=function(t,e){return function(i,s){e(i,s,t)}};let qu=class extends ru{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=hl,this.builtinContributions=[Yu,Gu],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=ea(t,null==r?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:c=l.cornerRadius,x:u=l.x,y:d=l.y,closePath:p=l.closePath,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:b}=f;e.beginPath(),c<=0||_(c)&&c.every((t=>0===t))?zu(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void zu(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],u=h.x-o.x,d=h.y-o.y,p=h.x-c.x,g=h.y-c.y,f=(Math.atan2(d,u)-Math.atan2(g,p))/2,m=Math.abs(Math.tan(f));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,y=v/m;const _=Vu(u,d),b=Vu(p,g),x=Math.min(_,b);y>x&&(y=x,v=x*m);const S=Wu(h,y,_,u,d),A=Wu(h,y,b,p,g),w=2*h.x-S.x-A.x,T=2*h.y-S.y-A.y,k=Vu(w,T),C=Wu(h,Vu(y,v),k,w,T);let M=Math.atan2(S.y-C.y,S.x-C.x);const B=Math.atan2(A.y-C.y,A.x-C.x);let E=B-M;E<0&&(M=B,E=-E),E>Math.PI&&(E-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),E&&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,y,b,m,v,l,n,a,o);const x=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,d-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,d-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,y,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=ea(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};qu=Xu([_i(),Ku(0,vi(Li)),Ku(0,bi(Bh)),$u("design:paramtypes",[Object])],qu);var Zu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ju=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qu=function(t,e){return function(i,s){e(i,s,t)}};let td=class{constructor(t){this.groupRenderContribitions=t,this.numberType=rl}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Gc)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:u,background:d}=t.attribute;if(!(h||c||u||d))return;l=null!=l?l:ea(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:y=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:w=l.cornerType,x:T=l.x,y:k=l.y}=t.attribute,C=_h(p,m,g,f,c),M=xh(p,v,g,f),B=mh(c,d),E=vh(u,x);if(!t.valid||!S)return;if(!h){if(!B&&!E)return;if(!(C||M||a||o||d))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||_(y)&&y.every((t=>0===t))?(e.beginPath(),e.rect(i,s,g,f)):(e.beginPath(),Xc(e,i,s,g,f,y,"bevel"!==w));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Gc));const R={doFill:B,doStroke:E};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===xs.beforeFillStroke&&r.drawShape(t,e,i,s,B,E,C,M,l,n,a,o,R)})),h&&e.clip();const O=()=>{R.doFill&&(a?a(e,t.attribute,l):C&&(e.setCommonStyle(t,t.attribute,T-i,k-s,l),e.fill()))},P=()=>{R.doStroke&&(o?o(e,t.attribute,l):M&&(e.setStrokeStyle(t,t.attribute,T-i,k-s,l),e.stroke()))};A?(P(),O()):(O(),P()),this._groupRenderContribitions.forEach((r=>{r.time===xs.afterFillStroke&&r.drawShape(t,e,i,s,B,E,C,M,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,u=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=Gi.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const d=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=ea(t,null==s?void 0:s.theme).group,i=kl.allocate(),n=kl.allocate();Nh(n,t,e),Sl(i,p||i,n),a.modelMatrix=i,kl.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&kl.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=d,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=u,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}};td=Zu([_i(),Qu(0,vi(Li)),Qu(0,bi(Ch)),Ju("design:paramtypes",[Object])],td);const ed=Symbol.for("IncrementalDrawContribution"),id=Symbol.for("ArcRender"),sd=Symbol.for("AreaRender"),nd=Symbol.for("CircleRender"),rd=Symbol.for("GraphicRender"),ad=Symbol.for("GroupRender"),od=Symbol.for("LineRender"),ld=Symbol.for("PathRender"),hd=Symbol.for("PolygonRender"),cd=Symbol.for("RectRender"),ud=Symbol.for("SymbolRender"),dd=Symbol.for("TextRender"),pd=Symbol.for("RichTextRender"),gd=Symbol.for("GlyphRender"),fd=Symbol.for("DrawContribution"),md=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===el,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];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+=St;for(;o<0;)o+=St;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};var vd=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yd=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const _d=Symbol.for("DrawItemInterceptor"),bd=new he,xd=new he;class Sd{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){bd.copy(s.dirtyBounds),xd.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,Tl.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(bd),s.backupDirtyBounds.copy(xd)),!0}}class Ad{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 wd=class{constructor(){this.order=1,this.interceptors=[new Sd,new kd,new Td,new Ad]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&kl.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Cd=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Md=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Bd=function(t,e){return function(i,s){e(i,s,t)}};let Ed=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))}reInit(){this.drawContribution.reInit()}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}};Ed=Cd([_i(),Bd(0,vi(fd)),Md("design:paramtypes",[Object])],Ed);var Rd=new ai((t=>{t(Wi).to(Ed)}));const Od=Symbol.for("PickerService"),Pd=Symbol.for("GlobalPickerService"),Id=Symbol.for("PickItemInterceptor"),Ld=Symbol.for("PickServiceInterceptor");var Dd=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Fd=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};Fd=Dd([_i()],Fd);let jd=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=ea(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,u=Tl.allocateByObj(a),d=new Dt(u.a*i.x+u.c*i.y+u.e,u.b*i.x+u.d*i.y+u.f),p=e.pickGroup(c,d,u,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};jd=Dd([_i()],jd);let Nd=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new Dt(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}};Nd=Dd([_i()],Nd);let Ud=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){const a=md(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};Ud=Dd([_i()],Ud);var Hd=new ai(((t,e,i)=>{i(Od)||(t(Pd).toSelf(),t(Od).toService(Pd)),t(Ud).toSelf().inSingletonScope(),t(Id).toService(Ud),t(jd).toSelf().inSingletonScope(),t(Id).toService(jd),t(Nd).toSelf().inSingletonScope(),t(Id).toService(Nd),Fi(t,Id),t(Fd).toSelf().inSingletonScope(),t(Ld).toService(Fd),Fi(t,Ld)})),zd=new ai((t=>{t(gl).to(Uh),t(fl).toConstantValue(Mc)}));const Vd=Symbol.for("AutoEnablePlugins"),Wd=Symbol.for("PluginService");var Gd=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yd=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Xd=function(t,e){return function(i,s){e(i,s,t)}};let $d=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&&Vi.isBound(Vd)&&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(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};$d=Gd([_i(),Xd(0,vi(Li)),Xd(0,bi(Vd)),Yd("design:paramtypes",[Object])],$d);var Kd=new ai((t=>{t(Wd).to($d),function(t,e){t(Li).toDynamicValue((({container:t})=>new Di(e,t))).whenTargetNamed(e)}(t,Vd)})),qd=new ai((t=>{Fi(t,Hi)})),Zd=new ai((t=>{t(sr).to(nr).inSingletonScope(),Fi(t,sr)})),Jd=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qd=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let tp=class{constructor(){this.type="static",this.offscreen=!1,this.global=Gi.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=or({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()}};tp=Jd([_i(),Qd("design:paramtypes",[])],tp);var ep=new ai((t=>{t(tp).toSelf(),t(lh).toService(tp)}));var ip=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 sp(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function np(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=sp(t,e,s);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;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=sp(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var op=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hp=function(t,e){return function(i,s){e(i,s,t)}};let cp=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):np(e,An.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new le,this.backupDirtyBounds=new le,this.global=Gi.global,this.layerService=Gi.layerService,_(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}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){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=function(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=Xt(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.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,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:An.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:An.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Tl.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=ap(e,i,An.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&&!$t(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Du.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Tl.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Du.free(n),Tl.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||Vi.get(ed);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let dp=class extends gu{constructor(){super(...arguments),this.numberType=ol}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=ea(t).line,{fill:c=h.fill,stroke:u=h.stroke,opacity:d=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:f=h.lineWidth,visible:m=h.visible}=t.attribute,v=yh(d,p,c),y=bh(d,g),_=mh(c),b=vh(u,f);if(!t.valid||!m)return;if(!_&&!b)return;if(!(v||y||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())}};dp=up([_i()],dp);var pp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 gp=class extends xu{constructor(){super(...arguments),this.numberType=il}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=ea(t).area,{fill:c=h.fill,fillOpacity:u=h.fillOpacity,opacity:d=h.opacity,visible:p=h.visible}=t.attribute,g=yh(d,u,c),f=mh(c);if(!t.valid||!p)return;if(!f)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())}};gp=pp([_i()],gp);var fp,mp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yp=function(t,e){return function(i,s){e(i,s,t)}},_p=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(fp||(fp={}));let bp=class extends cp{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=fp.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new Ui([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return _p(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:An.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:An.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return _p(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return _p(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>_p(this,void 0,void 0,(function*(){if(2!==t.count)yield rp(t,An.zIndex,((i,s)=>{if(this.status===fp.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return _p(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return _p(this,void 0,void 0,(function*(){this.rendering&&(this.status=fp.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=fp.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return _p(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>_p(this,void 0,void 0,(function*(){yield rp(t,An.zIndex,(t=>_p(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};bp=mp([_i(),yp(0,yi(rd)),yp(1,vi(dp)),yp(2,vi(gp)),yp(3,vi(Li)),yp(3,bi(_d)),vp("design:paramtypes",[Array,Object,Object,Object])],bp);var xp=new ai((t=>{t(Lc).toSelf().inSingletonScope(),t(Uc).toSelf().inSingletonScope(),t(fd).to(cp),t(ed).to(bp),t(ad).to(td).inSingletonScope(),t(rd).toService(ad),Fi(t,Ch),t(Fc).toSelf().inSingletonScope(),Fi(t,Ph),Fi(t,rd),t(wd).toSelf().inSingletonScope(),t(_d).toService(wd),Fi(t,_d)}));function Sp(){Sp.__loaded||(Sp.__loaded=!0,Vi.load(fh),Vi.load(zd),Vi.load(Rd),Vi.load(Hd),Vi.load(Kd),function(t){t.load(qd),t.load(Zd),t.load(ep)}(Vi),function(t){t.load(xp)}(Vi))}Sp.__loaded=!1,Sp();const Ap=Vi.get(zi);Gi.global=Ap;const wp=Vi.get(ah);Gi.graphicUtil=wp;const Tp=Vi.get(rh);Gi.transformUtil=Tp;const kp=Vi.get(gl);Gi.graphicService=kp;const Cp=Vi.get(oh);Gi.layerService=Cp;class Mp{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=ri.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class Bp{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=ri.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=Gi.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=Gi.global.getRequestAnimationFrame();this.rafId=t((()=>{Gi.global.devicePixelRatio!==this.dpr&&(this.dpr=Gi.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=Gi.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class Ep{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=ri.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.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))})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Gi.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())}}const Rp=new he;class Op{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=ri.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()}));const e=this.pluginService.stage;e&&(e.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&&(Rp.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(Rp,t.parent&&t.parent.globalTransMatrix)))})),e.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))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let Pp;function Ip(){!function(){if(null==Pp)try{const t=document.createElement("canvas"),e=t.getContext("2d");Pp=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),Pp&&(Pp=!!document.createElement)}catch(t){Pp=!1}}();const t=Gi.global&&Gi.global.env;return t?"browser"===t:Pp}let Lp=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};Lp._pluginClasses={};const Dp="white";class Fp extends ih{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:Dp}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={}){var e,i;super({}),this.tickedBeforeRender=!0,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._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Qr,this.hooks={beforeRender:new Ui(["stage"]),afterRender:new Ui(["stage"]),afterClearScreen:new Ui(["stage"]),afterClearRect:new Ui(["stage"])},this.global=Gi.global,!this.global.env&&Ip()&&this.global.setEnv("browser"),this.window=Vi.get(Nr),this.renderService=Vi.get(Wi),this.pluginService=Vi.get(Wd),this.layerService=Vi.get(oh),this.graphicService=Vi.get(gl),this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],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:Dp,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(),t.autoRefresh&&this.enableAutoRefresh(),!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),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&y(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(i=t.rafId)&&void 0!==i?i:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new ga(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(t=!1){t&&(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:u,beta:d,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!==(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(u)+y,S=Math.sin(d)+_,A=Math.cos(u)*Math.cos(d)*1);const w=Lp.getPlugin("DirectionalLight");w&&(this.light=new w(f,m,v));const T={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]}};if(this.camera)this.camera.params=T;else{const t=Lp.getPlugin("OrthoCamera");t&&(this.camera=new t(T))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=Lp.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}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 Mp))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new Bp))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new Ep))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new le;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new Op,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=Lp.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=Lp.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=Lp.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();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.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();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===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),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.dirtyBounds&&this.dirtyBounds.clear(),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,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new Dt(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;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.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=Vi.get(Nr),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=Vi.get(Od)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}var jp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Np=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};let Up=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new he}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}}loadFont(t,e,i){return Np(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}};Up=jp([_i()],Up);var Hp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Vp=class{constructor(){this._uid=ri.GenAutoIncrementId(),this.viewBox=new he,this.modelMatrix=new ue(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){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}};Vp=Hp([_i(),zp("design:paramtypes",[])],Vp);var Wp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Gp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Yp=function(t,e){return function(i,s){e(i,s,t)}};let Xp=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=Gi.global}reInit(){this._init()}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.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 he).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 ue(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),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new Dt(e.x,e.y),a=ea(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 Dt(e.x,e.y);l.transformPoint(a,a);const o=ea(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const u=this.pickItem(r,a,i,s);u&&u.graphic&&(n.graphic=u.graphic,n.params=u.params)}return!!n.graphic||!!n.group}),!0,!!r.camera),r.modelMatrix!==a&&kl.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!d||t.stage.camera||(n.group=t),Tl.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function $p(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,u=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=u,r[4]=u,r[5]=c,r[6]=l,r[7]=s}function Kp(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const u=n.filter((t=>t.length>2));return 1===u.length?[u[0]]:u}function eg(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;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}))),ag=(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,u=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)u.push({x:t[e].x,y:t[e].y});u.push({x:c.x,y:c.y});const d=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];d.push({x:i.x,y:i.y})}return d.push({x:h.x,y:h.y}),[u,d]},og=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new le;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 ag(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return ag(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);og(n[0],s,i),og(n[1],e-s,i)}};let lg=!1;const hg=new ai((t=>{lg||(lg=!0,t(hu).toSelf().inSingletonScope(),t(id).to(hu).inSingletonScope(),t(rd).toService(id),t(Th).toService(Fc),Fi(t,Th))}));let cg=!1;const ug=new ai((t=>{cg||(cg=!0,t(Ru).toSelf().inSingletonScope(),t(cd).to(Ru).inSingletonScope(),t(rd).toService(cd),t(qc).toSelf(),t(Kc).toSelf(),t(Eh).toService(qc),t(Eh).toService(Kc),t(Eh).toService(Fc),Fi(t,Eh))}));let dg=!1;const pg=new ai((t=>{dg||(dg=!0,t(gu).toSelf().inSingletonScope(),t(dp).toSelf().inSingletonScope(),t(od).to(gu).inSingletonScope(),t(rd).toService(od))}));let gg=!1;const fg=new ai((t=>{gg||(gg=!0,t(xu).toSelf().inSingletonScope(),t(sd).to(xu).inSingletonScope(),t(rd).toService(sd),t(kh).toService(Fc),Fi(t,kh),t(gp).toSelf().inSingletonScope())}));let mg=!1;const vg=new ai((t=>{mg||(mg=!0,t(Lu).toSelf().inSingletonScope(),t(ud).to(Lu).inSingletonScope(),t(rd).toService(ud),t(Rh).toService(Fc),Fi(t,Rh))}));let yg=!1;const _g=new ai((t=>{yg||(yg=!0,t(dd).to(Hu).inSingletonScope(),t(rd).toService(dd),t(Oh).toService(Fc),Fi(t,Oh))}));let bg=!1;const xg=new ai((t=>{bg||(bg=!0,t(Cu).toSelf().inSingletonScope(),t(ld).to(Cu).inSingletonScope(),t(rd).toService(ld),t(Mh).toService(Fc),Fi(t,Mh))}));let Sg=!1;const Ag=new ai((t=>{Sg||(Sg=!0,t(hd).to(qu).inSingletonScope(),t(rd).toService(hd),t(Bh).toService(Fc),Fi(t,Bh))}));var wg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Tg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let kg=class extends ru{constructor(){super(),this.numberType=ul,this.builtinContributions=[Fu],this.init()}drawShape(t,e,i,s,n){const r=ea(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=yh(o,l,!0),u=yh(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,u,c,u,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,u,c,u,r,n))}drawIcon(t,e,i,s,n){var r;const a=ea(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:u=a.backgroundFill,backgroundFillOpacity:d=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],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(y-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,y)):(e.beginPath(),Xc(e,i-t,s-n,v,y,f,!0)),u&&(e.globalAlpha=d,e.fillStyle=u,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,s,o,l))}draw(t,e,i){const s=ea(t).richtext;this._draw(t,s,!1,i)}};kg=wg([_i(),Tg("design:paramtypes",[])],kg);let Cg=!1;const Mg=new ai((t=>{Cg||(Cg=!0,t(pd).to(kg).inSingletonScope(),t(rd).toService(pd))}));function Bg(t){const e=[];for(let i=0;iit.getInstance().info(`[VChart log]: ${t}`,...e),Rg=(t,e)=>(u(Pg.warnHandler)&&Pg.warnHandler.call(null,t,e),e?it.getInstance().warn(`[VChart warn]: ${t}`,e):it.getInstance().warn(`[VChart warn]: ${t}`)),Og=(t,e,i)=>{if(!u(Pg.errorHandler))throw new Error(t);Pg.errorHandler.call(null,t,e)},Pg={silent:!1,warnHandler:!1,errorHandler:!1},Ig=Ip(),Lg=Ig&&globalThis?globalThis.document:void 0;function Dg(t){return("desktop-browser"===t||"mobile-browser"===t)&&Ig}function Fg(t){return jg(t)||"mobile-browser"===t}function jg(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let Ng=0;function Ug(){return Ng>=9999999&&(Ng=0),Ng++}function Hg(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function zg(t){return!(!t||0===t.length)&&(!d(t[0])&&!d(t[0].dataId)&&_(t[0].fields))}const Vg=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Wg extends ih{constructor(t,e){super(t),this._skipRenderAttributes=Vg,(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,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!u(this.attribute[t])&&!u(e)?j(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.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,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.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){d(e)&&(e=Object.keys(t));for(let i=0;i{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"},mf=(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 vf extends l{constructor(t,e={}){var i,s,n,r,a,o,l,h,c,u;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.startTime=ha.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.pressTimeout=null}),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=ha.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||ff(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,u=mf(l[0],l[1]);s.scale=u/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=ha.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=mf(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=ff(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&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!==(u=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==u?u: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("pointerleave",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("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=ha.now()-i>this.config.press.time&&mf(s[0],t){Gi.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;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){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){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},_f=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const bf=[0,0,0];let xf=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t: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(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},vn),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},_n),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},bn),{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 ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ue(1,0,0,1,0,0),this._clearMatrix=new ue(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&it.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new ue(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&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 Tl.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&&(Tl.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(Tl.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){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,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=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(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){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-=St;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,u=ca);t++){const e=y.getColor(t);u.beginPath(),u.rotate(v),u.moveTo(0,0),u.lineTo(f,-2*_),u.lineTo(f,0),u.fillStyle=e,u.closePath(),u.fill()}const b=u.getImageData(0,0,d,p);return c.width=b.width,c.height=b.height,u.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&Gl.Set(e,i,s,r,a,g,d,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&&(Al(bf,[t,e,i],this.modelMatrix),t=bf[0],e=bf[1],i=bf[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&&(Al(bf,[t,e,i],this.modelMatrix),t=bf[0],e=bf[1],i=bf[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Al(bf,[e,i,s],this.modelMatrix),e=bf[0],i=bf[1],s=bf[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,e=Gi.global.measureTextMethod){var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Gi.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:bn.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:bn.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&&(Al(bf,[e,i,s],this.modelMatrix),e=bf[0],i=bf[1],s=bf[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=zn(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:u=n.lineCap,miterLimit:d=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:Hn(this,a,this.dpr),r.strokeStyle=zn(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=u,r.miterLimit=d}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=se(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?this.font=t.font:this.font=se(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(t=!0,e=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(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>Tl.free(t))),this.stack.length=0}};xf.env="browser",xf=yf([_i(),_f("design:paramtypes",[Object,Number])],xf);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},Af=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let wf=class extends Pl{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Gi.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new xf(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 Tf(t,e){return new ai((i=>{i(rr).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(ar).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}wf.env="browser",wf=Sf([_i(),Af("design:paramtypes",[Object])],wf);const kf=Tf(wf,xf);var Cf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Bf=function(t,e){return function(i,s){e(i,s,t)}};let Ef=class extends Xp{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,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=Dr.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 Of=class{constructor(){this.type="group",this.numberType=rl}contains(t,e,i){return!1}};Of=Rf([_i()],Of);const Pf=new ai(((t,e,i,s)=>{Pf.__vloaded||(Pf.__vloaded=!0,t(pf).to(Of).inSingletonScope(),t(gf).toService(pf),Fi(t,gf))}));Pf.__vloaded=!1;var If=Pf;const Lf=new ai(((t,e,i,s)=>{i(Ef)||t(Ef).toSelf().inSingletonScope(),i(Od)?s(Od).toService(Ef):t(Od).toService(Ef)}));var Df,Ff=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Nf=Df=class extends Vp{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Df.idprefix}_${Df.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Gi.global,this.viewBox=new he,this.modelMatrix=new ue(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:Df.GenerateCanvasId(),canvasControled:!0};this.canvas=new wf(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 wf({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)}};Nf.env="browser",Nf.idprefix="visactor_window",Nf.prefix_count=0,Nf=Df=Ff([_i(),jf("design:paramtypes",[])],Nf);const Uf=new ai((t=>{t(Nf).toSelf(),t(Ur).toDynamicValue((t=>t.container.get(Nf))).whenTargetNamed(Nf.env)}));var Hf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vf=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 Wf{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 Gf(t,e=!1){const i=document.createElement("img");if(Gi.global.isImageAnonymous&&(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 Yf=class extends Up{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)/(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 Wf(t)}return new he}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(y(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=y(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return Gf(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Gf(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:ri.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(...t){}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}}loadFont(t,e,i){return Vf(this,void 0,void 0,(function*(){return new FontFace(t,y(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}};Yf=Hf([_i(),zf("design:paramtypes",[])],Yf);const Xf=new ai((t=>{Xf.isBrowserBound||(Xf.isBrowserBound=!0,t(Yf).toSelf().inSingletonScope(),t(Hi).toService(Yf))}));function $f(t,e=!0){$f.__loaded||($f.__loaded=!0,t.load(Xf),t.load(kf),t.load(Uf),e&&function(t){t.load(If),t.load(Lf)}(t))}Xf.isBrowserBound=!1,$f.__loaded=!1;var Kf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zf=function(t,e){return function(i,s){e(i,s,t)}};let Jf=class extends Xp{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,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 Rl(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}};Jf=Kf([_i(),Zf(0,vi(Li)),Zf(0,bi(Gg)),Zf(1,vi(Li)),Zf(1,bi(Id)),Zf(2,vi(Li)),Zf(2,bi(Ld)),qf("design:paramtypes",[Object,Object,Object])],Jf);const Qf=new ai((t=>{Qf.__vloaded||(Qf.__vloaded=!0,Fi(t,Gg))}));Qf.__vloaded=!1;var tm=Qf;class em{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();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,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:Hn(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}var im=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},nm=function(t,e){return function(i,s){e(i,s,t)}};let rm=class extends em{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=tl}};rm=im([_i(),nm(0,vi(id)),sm("design:paramtypes",[Object])],rm);let am=!1;const om=new ai(((t,e,i,s)=>{am||(am=!0,t(Yg).to(rm).inSingletonScope(),t(Gg).toService(Yg))}));var lm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cm=function(t,e){return function(i,s){e(i,s,t)}};let um=class extends em{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=il}};um=lm([_i(),cm(0,vi(sd)),hm("design:paramtypes",[Object])],um);let dm=!1;const pm=new ai(((t,e,i,s)=>{dm||(dm=!0,t(Xg).to(um).inSingletonScope(),t(Gg).toService(Xg))}));var gm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fm=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)}};let vm=class extends em{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=sl}};vm=gm([_i(),mm(0,vi(nd)),fm("design:paramtypes",[Object])],vm);let ym=!1;const _m=new ai(((t,e,i,s)=>{ym||(ym=!0,t($g).to(vm).inSingletonScope(),t(Gg).toService($g))}));class bm{constructor(){this.type="glyph",this.numberType=nl}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}}var xm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},Am=function(t,e){return function(i,s){e(i,s,t)}};let wm=class extends bm{constructor(t){super(),this.canvasRenderer=t}};wm=xm([_i(),Am(0,vi(gd)),Sm("design:paramtypes",[Object])],wm);let Tm=!1;const km=new ai(((t,e,i,s)=>{Tm||(Tm=!0,t(sf).to(wm).inSingletonScope(),t(wm).toService(sf))}));var Cm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Mm=class{constructor(){this.type="image",this.numberType=al}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Mm=Cm([_i()],Mm);let Bm=!1;const Em=new ai(((t,e,i,s)=>{Bm||(Bm=!0,t(Kg).to(Mm).inSingletonScope(),t(Mm).toService(Kg))}));var Rm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Om=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Pm=function(t,e){return function(i,s){e(i,s,t)}};let Im=class extends em{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=ol}};Im=Rm([_i(),Pm(0,vi(od)),Om("design:paramtypes",[Object])],Im);let Lm=!1;const Dm=new ai(((t,e,i,s)=>{Lm||(Lm=!0,t(qg).to(Im).inSingletonScope(),t(Gg).toService(qg))}));var Fm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Nm=function(t,e){return function(i,s){e(i,s,t)}};let Um=class extends em{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=hl}};Um=Fm([_i(),Nm(0,vi(hd)),jm("design:paramtypes",[Object])],Um);let Hm=!1;const zm=new ai(((t,e,i,s)=>{Hm||(Hm=!0,t(ef).to(Um).inSingletonScope(),t(Gg).toService(ef))}));var Vm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Gm=function(t,e){return function(i,s){e(i,s,t)}};let Ym=class extends em{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=ll}};Ym=Vm([_i(),Gm(0,vi(ld)),Wm("design:paramtypes",[Object])],Ym);let Xm=!1;const $m=new ai(((t,e,i,s)=>{Xm||(Xm=!0,t(Zg).to(Ym).inSingletonScope(),t(Gg).toService(Zg))})),Km=new he;class qm{constructor(){this.type="rect",this.numberType=cl}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=t.getGraphicTheme(),{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||_(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,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:Hn(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;Km.setValue(i.x1,i.y1,i.x2,i.y2),Km.expand(-r/2),h=!Km.containsPoint(e)}}return s.highPerformanceRestore(),h}}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 tv=class extends qm{constructor(t){super(),this.canvasRenderer=t}};tv=Zm([_i(),Qm(0,vi(cd)),Jm("design:paramtypes",[Object])],tv);let ev=!1;const iv=new ai(((t,e,i,s)=>{ev||(ev=!0,t(Jg).to(tv).inSingletonScope(),t(Gg).toService(Jg))}));let sv=!1;const nv=new ai(((t,e,i,s)=>{sv||(sv=!0,t(Kg).to(Mm).inSingletonScope(),t(Mm).toService(Kg))}));var rv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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,s){e(i,s,t)}};let lv=class extends em{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=dl}};lv=rv([_i(),ov(0,vi(ud)),av("design:paramtypes",[Object])],lv);let hv=!1;const cv=new ai(((t,e,i,s)=>{hv||(hv=!0,t(Qg).to(lv).inSingletonScope(),t(Gg).toService(Qg))}));var uv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 dv=class{constructor(){this.type="text",this.numberType=pl}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};dv=uv([_i()],dv);let pv=!1;const gv=new ai(((t,e,i,s)=>{pv||(pv=!0,t(tf).to(dv).inSingletonScope(),t(Gg).toService(tf))})),fv=new ai(((t,e,i,s)=>{i(Jf)||t(Jf).toSelf().inSingletonScope(),i(Od)?s(Od).toService(Jf):t(Od).toService(Jf)}));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},vv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let yv=class extends xf{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 ue(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};yv.env="node",yv=mv([_i(),vv("design:paramtypes",[Object,Number])],yv);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},bv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let xv=class extends Pl{constructor(t){super(t)}init(){this._context=new yv(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&u(this._nativeCanvas.release)&&this._nativeCanvas.release()}};xv.env="node",xv=_v([_i(),bv("design:paramtypes",[Object])],xv);const Sv=Tf(xv,yv);var Av=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tv=function(t,e){return function(i,s){e(i,s,t)}};let kv=class extends Vp{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:ri.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new xv(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new xv({width:n,height:r,dpr:s,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}getImageBuffer(t="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){}};kv.env="node",kv=Av([_i(),Tv(0,vi(zi)),wv("design:paramtypes",[Object])],kv);const Cv=new ai((t=>{t(kv).toSelf(),t(Ur).toDynamicValue((t=>t.container.get(kv))).whenTargetNamed(kv.env)}));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};let Bv=class extends Up{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 Ma.call(t)}}getCancelAnimationFrame(){return t=>{Ma.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};Bv=Mv([_i()],Bv);const Ev=new ai((t=>{Ev.isNodeBound||(Ev.isNodeBound=!0,t(Bv).toSelf().inSingletonScope(),t(Hi).toService(Bv))}));function Rv(t,e=!0){Rv.__loaded||(Rv.__loaded=!0,t.load(Ev),t.load(Sv),t.load(Cv))}Ev.isNodeBound=!1,Rv.__loaded=!1;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};let Pv=class extends xf{draw(){}createPattern(t,e){return null}};Pv.env="wx",Pv=Ov([_i()],Pv);var Iv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Lv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Dv=class extends Pl{constructor(t){super(t)}init(){this._context=new Pv(this,this._dpr)}release(...t){}};Dv.env="wx",Dv=Iv([_i(),Lv("design:paramtypes",[Object])],Dv);const Fv=Tf(Dv,Pv);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},Nv=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)}};class Hv{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 zv=class extends Vp{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new Hv}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:ri.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Dv(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 Dv({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()}};zv.env="wx",zv=jv([_i(),Uv(0,vi(zi)),Nv("design:paramtypes",[Object])],zv);const Vv=new ai((t=>{t(zv).toSelf(),t(Ur).toDynamicValue((t=>t.container.get(zv))).whenTargetNamed(zv.env)}));var Wv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Yv=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 Xv=class extends Up{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,a){return Yv(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let o=0;o{let a=wx.createSelectorQuery();r&&(a=a.in(r)),a.select(`#${l}`).fields({node:!0,size:!0}).exec((r=>{if(!r[0])return;const a=r[0].node,h=r[0].width,c=r[0].height;a.width=h*t,a.height=c*t,i.set(l,a),o>=s&&n.push(a),e(null)}))})))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.component,e.forceUpdate).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 Ma.call(t)}}getCancelAnimationFrame(){return t=>{Ma.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(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};Xv=Wv([_i(),Gv("design:paramtypes",[])],Xv);const $v=new ai((t=>{$v._isWxBound||($v._isWxBound=!0,t(Xv).toSelf().inSingletonScope(),t(Hi).toService(Xv))}));function Kv(t,e=!0){Kv.__loaded||(Kv.__loaded=!0,t.load($v),t.load(Fv),t.load(Vv),e&&function(t){t.load(tm),t.load(fv),t.load(om),t.load(pm),t.load(_m),t.load(km),t.load(Em),t.load(Dm),t.load(zm),t.load($m),t.load(iv),t.load(nv),t.load(cv),t.load(gv)}(t))}$v._isWxBound=!1,Kv.__loaded=!1;var qv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jv=function(t,e){return function(i,s){e(i,s,t)}};let Qv=class extends em{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=tl}};Qv=qv([_i(),Jv(0,vi(id)),Zv("design:paramtypes",[Object])],Qv);let ty=!1;const ey=new ai(((t,e,i,s)=>{ty||(ty=!0,t(nf).to(Qv).inSingletonScope(),t(gf).toService(nf))}));var iy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ny=function(t,e){return function(i,s){e(i,s,t)}};let ry=class extends qm{constructor(t){super(),this.canvasRenderer=t}};ry=iy([_i(),ny(0,vi(cd)),sy("design:paramtypes",[Object])],ry);let ay=!1;const oy=new ai(((t,e,i,s)=>{ay||(ay=!0,t(lf).to(ry).inSingletonScope(),t(gf).toService(lf))}));class ly extends 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;s.highPerformanceSave();const n=t.getGraphicTheme(),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 u=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!u||(u=t.isPointInPath(c.x,c.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:Hn(s,n+r,s.dpr),u=t.isPointInStroke(c.x,c.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==h&&kl.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),u}}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)},uy=function(t,e){return function(i,s){e(i,s,t)}};let dy=class extends ly{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=ol}};dy=hy([_i(),uy(0,vi(od)),cy("design:paramtypes",[Object])],dy);let py=!1;const gy=new ai(((t,e,i,s)=>{py||(py=!0,t(af).to(dy).inSingletonScope(),t(gf).toService(af))}));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},my=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vy=function(t,e){return function(i,s){e(i,s,t)}};let yy=class extends em{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=il}};yy=fy([_i(),vy(0,vi(sd)),my("design:paramtypes",[Object])],yy);let _y=!1;const by=new ai(((t,e,i,s)=>{_y||(_y=!0,t(rf).to(yy).inSingletonScope(),t(gf).toService(rf))}));class xy extends ru{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();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 u=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!u||(u=t.isPointInPath(c.x,c.y),u))),this.canvasRenderer.z=0,s.modelMatrix!==h&&kl.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),u}}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},Ay=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wy=function(t,e){return function(i,s){e(i,s,t)}};let Ty=class extends xy{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=dl}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=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let u=e;if(s.camera){u=e.clone();const i=t.parent.globalTransMatrix;u.x=i.a*e.x+i.c*e.y+i.e,u.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let d=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(u.x,u.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:Hn(s,n+r,s.dpr),d=t.isPointInStroke(u.x,u.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==c&&kl.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),d}};Ty=Sy([_i(),wy(0,vi(ud)),Ay("design:paramtypes",[Object])],Ty);let ky=!1;const Cy=new ai(((t,e,i,s)=>{ky||(ky=!0,t(hf).to(Ty).inSingletonScope(),t(gf).toService(hf))}));var My=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},Ey=function(t,e){return function(i,s){e(i,s,t)}};let Ry=class extends xy{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=pl}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=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:u,lastModelMatrix:d}=l;this.canvasRenderer.z=u;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,d=l.height(),f=l.width(),m=Lh(a,d,n),v=Ih(o,f);return e.rect(v+h,m+c,f,d,u),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,s.modelMatrix!==d&&kl.free(s.modelMatrix),s.modelMatrix=d,s.highPerformanceRestore(),g}};Ry=My([_i(),Ey(0,vi(dd)),By("design:paramtypes",[Object])],Ry);let Oy=!1;const Py=new ai(((t,e,i,s)=>{Oy||(Oy=!0,t(cf).to(Ry).inSingletonScope(),t(gf).toService(cf))}));var Iy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ly=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Dy=function(t,e){return function(i,s){e(i,s,t)}};let Fy=class extends ly{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=ll}};Fy=Iy([_i(),Dy(0,vi(ld)),Ly("design:paramtypes",[Object])],Fy);let jy=!1;const Ny=new ai(((t,e,i,s)=>{jy||(jy=!0,t(of).to(Fy).inSingletonScope(),t(gf).toService(of))}));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},Hy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zy=function(t,e){return function(i,s){e(i,s,t)}};let Vy=class extends em{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=hl}};Vy=Uy([_i(),zy(0,vi(hd)),Hy("design:paramtypes",[Object])],Vy);let Wy=!1;const Gy=new ai(((t,e,i,s)=>{Wy||(Wy=!0,t(uf).to(Vy).inSingletonScope(),t(gf).toService(uf))}));var Yy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Xy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$y=function(t,e){return function(i,s){e(i,s,t)}};let Ky=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=ul}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};Ky=Yy([_i(),$y(0,vi(pd)),Xy("design:paramtypes",[Object])],Ky);let qy=!1;const Zy=new ai(((t,e,i,s)=>{qy||(qy=!0,t(df).to(Ky).inSingletonScope(),t(gf).toService(df))})),Jy=Ip();function Qy(){Qy.__loaded||(Qy.__loaded=!0,Mc.RegisterGraphicCreator("arc",Sc),Vi.load(hg),Vi.load(Jy?ey:om))}Qy.__loaded=!1;const t_=Qy;function e_(){e_.__loaded||(e_.__loaded=!0,Mc.RegisterGraphicCreator("area",_c),Vi.load(fg),Vi.load(Jy?by:pm))}e_.__loaded=!1;const i_=e_;function s_(){s_.__loaded||(s_.__loaded=!0,Mc.RegisterGraphicCreator("group",sh))}s_.__loaded=!1;const n_=s_;function r_(){r_.__loaded||(r_.__loaded=!0,Mc.RegisterGraphicCreator("line",Zh),Vi.load(pg),Vi.load(Jy?gy:Dm))}r_.__loaded=!1;const a_=r_;function o_(){o_.__loaded||(o_.__loaded=!0,Mc.RegisterGraphicCreator("path",mc),Vi.load(xg),Vi.load(Jy?Ny:$m))}o_.__loaded=!1;const l_=o_;function h_(){h_.__loaded||(h_.__loaded=!0,Mc.RegisterGraphicCreator("polygon",Tc),Vi.load(Ag),Vi.load(Jy?Gy:zm))}h_.__loaded=!1;const c_=h_;function u_(){u_.__loaded||(u_.__loaded=!0,Mc.RegisterGraphicCreator("rect",ec),Vi.load(ug),Vi.load(Jy?oy:iv))}u_.__loaded=!1;const d_=u_;function p_(){p_.__loaded||(p_.__loaded=!0,Mc.RegisterGraphicCreator("richtext",pc),Vi.load(Mg),Vi.load(Jy?Zy:nv))}p_.__loaded=!1;const g_=p_;function f_(){f_.__loaded||(f_.__loaded=!0,Mc.RegisterGraphicCreator("shadowRoot",Cc))}f_.__loaded=!1;const m_=f_;function v_(){v_.__loaded||(v_.__loaded=!0,Mc.RegisterGraphicCreator("symbol",$h),Vi.load(vg),Vi.load(Jy?Cy:cv))}v_.__loaded=!1;const y_=v_;function __(){__.__loaded||(__.__loaded=!0,Mc.RegisterGraphicCreator("text",Gh),Vi.load(_g),Vi.load(Jy?Py:gv))}__.__loaded=!1;const b_=__;function x_(){n_(),d_()}const S_=-.5*Math.PI,A_=1.5*Math.PI,w_="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 T_;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(T_||(T_={}));const k_={[T_.selectedReverse]:{},[T_.selected]:{},[T_.hover]:{},[T_.hoverReverse]:{}},C_={container:"",width:30,height:30,style:{}};function M_(){return"browser"===Ap.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const B_={debounce:gt,throttle:ft};x_();class E_ extends Wg{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},E_.defaultAttributes,t)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},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=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/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=>{this._clearDragEvents();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});const r=M_(),a="browser"===Ap.env?Ap:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:u}=this.attribute,d=ct(u[1]-u[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&d<1?a/c*(1-d):0,[n,r]},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:B_[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:ut(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=ut(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",B_[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===Ap.env?Ap:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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(),u=this._getSliderPos(ut(s,n[0],n[1])),d=u[1]-u[0];let p;this._sliderSize=d,p="horizontal"===t?{x:u[0],y:c.y1,width:d,height:c.height}:{x:c.x1,y:u[0],width:c.width,height:d};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:Ce(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,[s,n,r,a]=Ce(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,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=ct(t[0],0,1),c=ct(t[1],0,1),u=ct(c-h,0,1),d=Math.max(u*o,i),p=Math.max(o-d,0),g=l+h/Math.max(1-u,1e-12)*p;return[g,g+d]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=ut(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?ut([a+i*n,a+s*n],a,n-l):ut([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=M_(),e="browser"===Ap.env?Ap:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===Ap.env?Ap:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}}function R_(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&R_(t,e)}))}E_.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,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 O_=t=>!d(t)&&!1!==t.visible;const P_=["#ffffff","#000000"];function I_(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new Ae(t).toHex(),o=new Ae(e).toHex();return L_(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(...P_);for(const n of a)if(t!==n&&L_(n,e,i,s,r))return n}(a,o,i,s,n,r)}function L_(t,e,i,s,n){if("lightness"===n){const i=Ae.getColorBrightness(new Ae(e));return Ae.getColorBrightness(new Ae(t))<.5?i>=.5:i<.5}return s?D_(t,e)>s:"largeText"===i?D_(t,e)>3:D_(t,e)>4.5}function D_(t,e){const i=F_(t),s=F_(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function F_(t){const e=Te(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 j_(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 N_(t){let e=function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}function U_(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=Pt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const H_=(t,e,i,s)=>new ne(Object.assign({defaultFontParams:Object.assign({fontFamily:w_,fontSize:14},s),getTextBounds:i?void 0:Rc,specialCharSet:"-/: .,@%'\"~"+ne.ALPHABET_CHAR_SET+ne.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function z_(t,e,i={}){if(!t)return{width:0,height:0};const s=Rc({text:t,fontFamily:e.fontFamily||i.fontFamily||w_,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 V_(t,e="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 W_(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function G_(t,e="type"){const i=V_(t,e);return"rich"===i?Mc.richtext(W_(t)):("html"===i?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"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),Mc.text(t))}function Y_(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)}function X_(){n_(),d_(),y_(),g_(),b_()}var $_=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]))),w=0,T=0;let U=0;"left"===j||"start"===j?U=1:"right"===j||"end"===j?U=-1:"center"===j&&(U=0),U?U<0?(w-=k,A&&A.setAttribute("x",(A.attribute.x||0)-I),x.setAttribute("x",-b[1]-B)):U>0&&x.setAttribute("x",b[3]):(w-=k/2,A&&A.setAttribute("x",(A.attribute.x||0)-I/2),x.setAttribute("x",-B/2));const H="right"===_||"end"===_,z="left"===_||"start"===_,V=(t,e)=>{"richtext"===P.type?P.setAttributes({x:t,textAlign:e,textConfig:G(P.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):P.setAttributes({x:t,textAlign:e})};if((_?"center"===_:y)&&U){const t=k-b[1]-b[3],e=I+B,i=1===U?(t-e)/2+B+I/2:b[0]+B-(k/2+e/2-B)+I/2;if(V(i,"center"),A){const t=i-I/2-B+F/2;A.setAttributes({x:t})}}if(z&&1!==U){const t=k-b[1]-b[3],e=0===U?-t/2+B/2:-k+b[3]+b[1]+B;if(V(e+B,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(H&&-1!==U){const t=k-b[1]-b[3],e=0===U?t/2+B/2:t;if(V(e,"right"),A){const t=e-I-B+F/2;A.setAttributes({x:t})}}"middle"===N?(T-=C/2,A&&A.setAttribute("y",0)):"bottom"===N?(T-=C,A&&A.setAttribute("y",-L/2),x.setAttribute("y",-b[2])):"top"===N&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",L/2)),E(null==m?void 0:m.text)||(P.states=m.text);const{visible:W}=a,Y=$_(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},Y),{visible:W&&!!s,width:k,height:C,x:w,y:T}),"rect");if(E(null==m?void 0:m.panel)||(t.states=m.panel),Y.customShape){const e=Y.customShape;t.pathProxy=t=>e(this,t,new pn)}this._bgRect=t}this._textShape=P,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:j({},K_.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,u,d,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(u=this._bgRect)||void 0===u||u.clearStates(),null===(d=this._symbol)||void 0===d||d.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}K_.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const q_={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}},Z_={poptip:j({},q_)};class J_ extends Wg{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}n_(),a_();class Q_ extends J_{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},Q_.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})}}Q_.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},n_(),d_();class tb extends J_{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},tb.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})}}tb.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},n_(),a_(),c_(),y_();class eb extends Wg{getStartAngle(){return Ht(this._startAngle)}getEndAngle(){return Ht(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},eb.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(A(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(q(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=Mc.line(Object.assign(Object.assign({points:t},_(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),E(null==s?void 0:s.line)||(a.states=_(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=Mc.line;G(i)[0].cornerRadius&&(t=Mc.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},G(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),E(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:u=0,refAngle:d=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(A(r)?c*Math.cos(r)+u*Math.cos(r-Math.PI/2):0),y:l.y+(A(r)?c*Math.sin(r)+u*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(A(a)?c*Math.cos(a)+u*Math.cos(a-Math.PI/2):0),y:h.y+(A(a)?c*Math.sin(a)+u*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=Mc.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+d:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),E(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?E(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):E(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?A(i)?t[i]:q(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}}var ib,sb;eb.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.labelHoverOnAxis="axis-label-hover-on-axis",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",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(ib||(ib={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(sb||(sb={}));const nb={[sb.selectedReverse]:{},[sb.selected]:{},[sb.hover]:{},[sb.hoverReverse]:{}},rb={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}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},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}}},ab={size:8,stroke:"#000",lineWidth:1,zIndex:1};const ob=Math.sin(Math.PI/10);function lb(t,e=ob){const i=!d(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function hb(t,e=ob){const i=!d(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function cb(t){const e={};return R_(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function ub(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function db(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 pb(t,e,i){var s;if(hb(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>re(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>re(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>ae(n,r)}function gb(t,e){for(let i,s=1,n=t.length,r=t[0];s{this._lastHover=((t,e,i)=>{const s=t.target;return s!==i&&s.name&&!E(s.states)?(s.addState(T_.hover,!0),R_(e,(t=>{t!==s&&t.name&&!E(t.states)&&t.addState(T_.hoverReverse,!0)})),s):i})(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=((t,e,i)=>i?(R_(e,(t=>{t.name&&!E(t.states)&&(t.removeState(T_.hoverReverse),t.removeState(T_.hover))})),null):i)(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=((t,e,i)=>{const s=t.target;return i===s&&s.hasState(T_.selected)?(R_(e,(t=>{t.name&&!E(t.states)&&(t.removeState(T_.selectedReverse),t.removeState(T_.selected))})),null):s.name&&!E(s.states)?(s.addState(T_.selected,!0),R_(e,(t=>{t!==s&&t.name&&!E(t.states)&&t.addState(T_.selectedReverse,!0)})),s):i})(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=Mc.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._prepare(),this._prevInnerView=this._innerView&&cb(this._innerView),this.removeAllChild(!0),this._innerView=Mc.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation()}_prepare(){this._prepareAnimate(mb)}_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=Mc.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=ib.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=Mc.group({x:0,y:0,pickable:!1});t.name=ib.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",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let u=r.width(),d=r.height();n&&(u=Math.abs(u*Math.cos(n)),d=Math.abs(d*Math.sin(n))),a=Math.max(a,u),o=Math.max(o,d),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=Mc.group({x:0,y:0,pickable:!1});i.name=ib.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=Mc.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=ib.tick,r.id=this._getNodeId(t.id),E(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=k_;else{const t=this.data[s],e=j({},k_,this.attribute.tick.state);Object.keys(e).forEach((i=>{u(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=Mc.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=ib.subTick,r.id=this._getNodeId(`${n}`),E(s.state))r.states=k_;else{const i=j({},k_,s.state);Object.keys(i).forEach((s=>{u(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&&u(s)&&(e=s(e,i));const n=this._transformItems(e),r=Mc.group({x:0,y:0,pickable:!1});return r.name=`${ib.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=G_(this._getLabelAttribute(t,e,n,i));if(a.name=ib.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),E(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=k_;else{const s=j({},k_,this.attribute.label.state);Object.keys(s).forEach((r=>{u(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new K_(Object.assign({},e));i.name=ib.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return ub(t,this.getVerticalVector(e,i,t))}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&&u(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;At(s[0])>At(s[1])?o=_t/2*(l.x>e.x?1:-1):h=_t/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]?d+=(this.axisLabelLayerSize[s-1].height+R(this.attribute,"label.space",4))*s:d+=(this.axisLabelLayerSize[s-1].width+R(this.attribute,"label.space",4))*s);const f=this.getVerticalCoord(t.point,d,o),m=this.getVerticalVector(d||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:y}=this.attribute.label;y=u(y)?j({},rb.label.style,y(t,e,i,s)):y;y=j(this.getLabelAlign(m,o,y.angle),y),u(y.text)&&(y.text=y.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let _=y.react;return u(_)&&(_=_(t,e,i,s)),Object.assign(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),{react:_})}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}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},R_(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(e.setFinalAttributes(e.attribute),r){r.release();const i=r.attribute,a=e.getFinalAttribute(),o=function(t,e,i){const s={};for(const i in e)i in t&&z(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}(i,a);let l=Object.keys(o).length>0;if("opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l){this._newElementAttrMap[e.id]={state:"update",node:e,attrs:e.attribute};const i=r.attribute;e.setAttributes(i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}])}}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const yb={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&&pb(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function _b(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function bb(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;t{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},wb(t,e.attribute.angle)),{angle:Ab(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({},Tb(t,e.attribute.angle)),{angle:Ab(e.attribute.angle)}))}))}(t,e),function(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=Zt({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function Ab(t=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 wb(t,e=0){let 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=Ab(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 Tb(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=Ab(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 kb(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(E(t)||!A(i))return;const o=function(t){return A(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!d(h),u=c?Math.cos(h):1,p=c?Math.sin(h):0,f=hb(h),m=lb(h),v="top"===r||"bottom"===r,y=l.attribute.direction,_=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===y&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==y){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===y||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/u,l=Math.abs(i/p);if(_&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(u);r=Math.min(t,l)}else if(_&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(u);r=Math.min(t,l)}else r=l}else r=Math.abs(i/u);A(t.attribute.maxLineWidth)&&(r=A(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function Cb(t,e,i){let s;return A(e)&&(s=Math.abs(e-t)),A(i)&&(s=A(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class Mb{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,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=N_(this.getRelativeVector());return function(t,e){return[t[0]*e,t[1]*e]}([n[1],-1*n[0]],t*(e?1:-1)*s)}}class Bb{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-Bb.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*Bb.bounceIn(2*t):.5*Bb.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/St*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*St/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/St*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*St/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/St*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*St/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*St/e)*.5+1}}static registerFunc(t,e){Bb[t]=e}}function Eb(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}Bb.quadIn=Bb.getPowIn(2),Bb.quadOut=Bb.getPowOut(2),Bb.quadInOut=Bb.getPowInOut(2),Bb.cubicIn=Bb.getPowIn(3),Bb.cubicOut=Bb.getPowOut(3),Bb.cubicInOut=Bb.getPowInOut(3),Bb.quartIn=Bb.getPowIn(4),Bb.quartOut=Bb.getPowOut(4),Bb.quartInOut=Bb.getPowInOut(4),Bb.quintIn=Bb.getPowIn(5),Bb.quintOut=Bb.getPowOut(5),Bb.quintInOut=Bb.getPowInOut(5),Bb.backIn=Bb.getBackIn(1.7),Bb.backOut=Bb.getBackOut(1.7),Bb.backInOut=Bb.getBackInOut(1.7),Bb.elasticIn=Bb.getElasticIn(1,.3),Bb.elasticOut=Bb.getElasticOut(1,.3),Bb.elasticInOut=Bb.getElasticInOut(1,.3*1.5),Bb.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),Bb.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},Bb.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)Bb[`flicker${t}`]=e=>Eb(e,t);for(let t=2;t<10;t++)Bb[`aIn${t}`]=e=>t*e*e+(1-t)*e;function Rb(t,e,i){return t+(e-t)*i}const Ob=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=Rb(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=Rb(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=Rb(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=Rb(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=Rb(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=Rb(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=Rb(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=Rb(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=Rb(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=Fl(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?Nl(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=Fl(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?Nl(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=Rb(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=Rb(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=Rb(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=Rb(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=Rb(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=Rb(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=Rb(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=Rb(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=Rb(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=Rb(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=Rb(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=Rb(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=Rb(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=Rb(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=Rb(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=Rb(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=Ta(e,i,s),r.addUpdateBoundTag()}}};function Pb(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.setAttributes(this.target.attribute)},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=Bb[s])&&void 0!==n?n:Bb.linear:Bb.linear,"wait"===t&&(this.onUpdate=Ib),this.id=ri.GenAutoIncrementId(),this.syncAttributeUpdate=Ib}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(y(i)&&y(s)){const n=Ll.Get(i,Il.Color255),r=Ll.Get(s,Il.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(Ob["fill"===e?"fillPure":"strokePure"])}else Ob[e]?t.push(Ob[e]):t.push(Pb)}else Ob[e]?t.push(Ob[e]):t.push(Pb)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate;this.target.animates.forEach((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const i=e.getStartProps();this.propKeys.forEach((t=>{null!=i[t]&&e.preventAttr(t)}))}))}deleteSelfAttr(t){var e;delete this.props[t],this.fromProps&&delete this.fromProps[t];const i=this.propKeys.indexOf(t);-1!==i&&(this.propKeys.splice(i,1),null===(e=this.interpolateUpdateFunctions)||void 0===e||e.splice(i,1))}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){this.target.setAttributes(this.props),t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}const Db=new Xi;class Fb{constructor(){this.released=!1}tick(t,e){Db.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class jb extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===es.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=es.INITIAL,Gi.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),Gi.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new Fb;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==es.INITIAL&&(this.status=es.PAUSE,!0)}resume(){return this.status!==es.INITIAL&&(this.status=es.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===es.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===es.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=es.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=es.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===es.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===es.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,Gi.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;_(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:Hb.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=Ub(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let u=0;l&&(u="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=u,o.custom=null!==(s=t.custom)&&void 0!==s?s:Hb.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const d=Ub(o.custom);o.customType=d;const p=e+h+c+u*(this._target.count-2),g=A(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=u*g,o.startTime=a}return o}execute(t){Array.isArray(t)?t.forEach((t=>this._execute(t))):this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,d;const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:y=0,duration:_=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:w=0,options:T,custom:k,customType:C,controlOptions:M}=t,B=e.animate();B.priority=w;const E=u(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,R=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],O=null===(l=e.context)||void 0===l?void 0:l.indexKey;R&&O&&(i=null!==(h=R[O])&&void 0!==h?h:i),B.startAt(b);const P=i*x+E;P>0&&B.wait(P);let I=null,L=t.to,D=t.from;L||(I||(I=this.createPropsFromChannel(g,e)),L=I.props),D||(I||(I=this.createPropsFromChannel(g,e)),D=I.from),I.attrOutChannel&&e.setAttributes(I.attrOutChannel),this._handleRunAnimate(B,k,C,D,L,_,m,f,M,T,p,e);let F=0;x&&(F=x*(s-i-1));const j=u(y)?y(null===(d=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===d?void 0:d[0],e,{}):y;return j>0&&(F+=j),F>0&&B.wait(F),S&&S>0&&B.loop(S),A&&B.bounce(!0),B}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,d){var p,g,f,m,v,y,_,b;if(e&&i){i=Ub(e);let c=this.resolveValue(o,d);"function"==typeof c&&(c=c(null===(g=null===(p=d.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],d,{})),c=Object.assign({width:(null===(f=d.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=d.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},c);const x=u(h)?h.call(null,null!==(y=c&&(null===(v=c.data)||void 0===v?void 0:v[0]))&&void 0!==y?y:null===(b=null===(_=d.context)||void 0===_?void 0:_.data)||void 0===b?void 0:b[0],d,c):h;c.options=x,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;const{timeSlices:l,startTime:h=0,loop:c,bounce:u,oneByOneDelay:d,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*d),c&&c>0&&v.loop(c),u&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),d&&v.wait(d*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:d=0}=t,p=u(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=u(d)?d(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):d;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let u=null,d=t.to,p=t.from;d||(u||(u=this.createPropsFromChannel(a,i)),d=u.props),p||(u||(u=this.createPropsFromChannel(a,i)),p=u.from),u.attrOutChannel&&i.setAttributes(u.attrOutChannel);const g=null!==(n=t.custom)&&void 0!==n?n:Hb.builtInAnimateMap[r],f=t.custom?t.customType:Ub(g);this._handleRunAnimate(e,g,f,p,d,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e){var i;const s={};let n=null;if(!t)return{from:n,props:s,attrOutChannel:null};const r={};let a=!1;const o=null===(i=e.context)||void 0===i?void 0:i.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===o[e]||(t[e]={to:o[e]}),t)),{})),Object.keys(t).forEach((i=>{var r,a,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?s[i]=h.to(null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,{}):s[i]=h.to),void 0!==h.from&&(n||(n={}),"function"==typeof h.from?n[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):n[i]=h.from)})),o)for(const t in o){const e=o[t];void 0!==e&&(s.hasOwnProperty(t)||(r[t]=e,a=!0))}return{from:n,props:s,attrOutChannel:a?r:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}executeItem(t,e,i=0,s=1){return Array.isArray(t)?t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean):[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=ss.END),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}Hb.builtInAnimateMap={};class zb extends Lb{constructor(t,e,i,s,n){super("customAnimate",e,i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class Vb extends zb{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class Wb{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new Hb(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttr(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function Gb(t){return new Wb(t)}class Yb extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",u=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";u=Math.max(u,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";u=Math.max(u,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";u=Math.max(u,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";u=Math.max(u,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";u=Math.max(u,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";u=Math.max(u,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=u)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,this.target.setAttribute("text",n)}}const Xb=1e3,$b="quadInOut",Kb=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],qb=(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=Fl(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Zb=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?tg(t):[],n=tg(e);i&&s&&(i.fromTransform&&eg(s,i.fromTransform.clone().getInverse()),eg(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})))},Qb=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],tx=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Qb.includes(n))return;const r=e[n];if(!d(r)&&!d(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?Ll.Get(t,Il.Color255):t;i.push({from:_(t[n])?t[n].map(e):e(t[n]),to:_(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class ex extends zb{constructor(t,e,i){super({},{},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;Zb(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&qb(this.otherAttrs,i,e),this.target.setAttributes(i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const ix=(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=Jb(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=tx(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const u=new ex({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Xb,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:$b);return c.play(u),c};class sx extends zb{constructor(t,e,i){super({},{},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;Zb(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&&qb(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const nx=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Kb.includes(t))(i)||(e[i]=t[i])})),e},rx=(t,e,i)=>{const s=nx(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),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=Gi.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},ax=(t,e,i)=>{const s=[],n=i?null:nx(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:nx(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=Jh(t.attribute),n=sg(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(Gi.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=sg(o*(r+a)/2,l,e),c=[],u=l/h.length,d=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{s.push(Gi.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=sg(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(Gi.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 ng(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 ng(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(Gi.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:rg(i)}];const s=[];return og(i,e,s),s})(t,e).forEach((t=>{s.push(Gi.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 og(l,e,h),h})(t,e).forEach((t=>{s.push(Gi.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=tg(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(Gi.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(Gi.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&rx(t,s,e),s};class lx extends zb{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){super.onBind();const{points:t,segments:e}=this.target.attribute,{points:i,segments:s}=this.target.getFinalAttribute();this.from={points:t,segments:e},this.to={points:i,segments:s},this.props=this.to;const n=this.getPoints(this.from),r=this.getPoints(this.to,!0);this.fromPoints=n?Array.isArray(n)?n:[n]:[],this.toPoints=r?Array.isArray(r)?r:[r]:[];const a=new Map;this.fromPoints.forEach((t=>{t.context&&a.set(t.context,t)}));let o,l,h=1/0,c=-1/0;for(let t=0;t=0;t-=1)if(a.has(this.toPoints[t].context)){c=t,l=a.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(c)?(this.clipRange=this.toPoints[c][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[c][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),A(this.clipRange)?this.clipRange=ct(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let u=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=a.get(t.context);return i?(u=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ec&&l?[l,t]:[u,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new Dt(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;A(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(t)return Object.keys(this.to).forEach((t=>{this.target.attribute[t]=this.to[t]})),this.target.addUpdatePositionTag(),void this.target.addUpdateShapeAndBoundsTag();if(this.points=this.points.map(((t,i)=>{const s=wa(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));this.target.setAttributes({clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.target.attribute.segments=e}else this.target.attribute.points=this.points;this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class hx extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0}));const o=this.target.getFinalAttribute();o&&this.target.setAttributes(o),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(a)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class cx extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Object.assign(this.target.attribute,i),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class ux extends hx{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class dx extends cx{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}const px=(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.getFinalAttribute();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.getFinalAttribute();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)};class gx extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this._updateFunction=null}updateStartAngle(t){this.target.attribute.startAngle=this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t}updateEndAngle(t){this.target.attribute.endAngle=this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class fx extends gx{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=px(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r),this.determineUpdateFunction()}}class mx extends gx{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class vx extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/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:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class yx extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const _x=(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,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:d(l)?void 0:c,height:d(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class bx extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=_x(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class xx extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:d(o)?void 0:h,height:d(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const Sx=(t,e,i)=>{const s=t.getFinalAttribute().points,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&&(A(e.center.x)&&(n.x=e.center.x),A(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class Ax extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(this.target.attribute.points=r.map(((t,i)=>wa(r[i],a[i],e))),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class Tx extends Ax{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:Sx(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class kx extends Ax{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:Sx(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const Cx=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class Mx extends Ax{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:Cx(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class Bx extends Ax{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:Cx(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const Ex=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class Rx extends Ax{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:Ex(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class Ox extends Ax{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:Ex(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const Px=(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.getFinalAttribute(),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.getFinalAttribute();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)};class Ix extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Lx extends Ix{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=Px(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}}class Dx extends Ix{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const Fx=(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.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:d(a)?void 0:l,width:d(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class jx extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=Fx(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Nx extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Ux extends Vb{onBind(){var t;const e=Gb(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;this.target.setAttributes({x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class Hx extends Vb{onBind(){const t=Gb(this.target);this._animator=t;const e=this.duration,i=this.easing,{config:s,diffAttrs:n}=this.params;t.animate(this.target,{type:"to",to:Object.assign({},n),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},n)}}),this.completeBind(t)}deleteSelfAttr(t){super.deleteSelfAttr(t),this._animator.deleteSelfAttr(t)}tryPreventConflict(){}}function zx(){n_(),a_(),g_(),b_(),Hb.registerBuiltInAnimate("axisEnter",Ux),Hb.registerBuiltInAnimate("axisUpdate",Hx)}var Vx=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{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=Mc.group({zIndex:999});e.name=ib.axisBreak,e.id=this._getNodeId(`${ib.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=j({},ab,s),a=null!==(e=r.size)&&void 0!==e?e:ab.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=Mc.symbol(Object.assign({x:s.x,y:s.y},o));l.name=ib.axisBreakSymbol;const h=Mc.symbol(Object.assign({x:n.x,y:n.y},o));h.name=ib.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=Mc.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=ib.background,n.id=this._getNodeId("background"),n.states=j({},nb,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new K_(Object.assign({},t));e.name=ib.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=Vx(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];E(l)||(c.state={line:j({},nb,l),symbol:j({},nb,l)});const u=new eb(c);u.name=ib.line,u.id=this._getNodeId("line"),t.add(u)}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}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:u}=s,p=Vx(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),y=this.getRelativeVector();let _=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+R(this.attribute,"label.space",4);_+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===y[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?_+=i+(e-1)*t:_=0}else if(0===y[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;_+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{_+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}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.getActualOffset(x),w=this.getVerticalCoord(v,S,!1),T=this.getVerticalVector(S,!1,{x:0,y:0});let k,C,{angle:M}=p;if(k="start"===n?"start":"end"===n?"end":"center",d(M)&&o){M=U_(y,[1,0],!0);const{verticalFactor:t=1}=this.attribute;C=1==-1*t?"bottom":"top"}else k=this.getTextAlign(T),C=this.getTextBaseline(T,!1);let B=u;if(d(B)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(A(s))if("bottom"===i||"top"===i)if(M!==Math.PI/2){const t=Math.abs(Math.cos(null!=M?M:0));B=t<1e-6?1/0:this.attribute.end.x/t}else B=s-S;else if(M&&0!==M){const t=Math.abs(Math.sin(M));B=t<1e-6?1/0:this.attribute.end.y/t}else B=s-S}const E=Object.assign(Object.assign(Object.assign({},w),p),{maxWidth:B,textStyle:Object.assign({textAlign:k,textBaseline:C},a),state:{text:j({},nb,c.text),shape:j({},nb,c.shape),panel:j({},nb,c.background)}});return E.angle=M,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}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:u}=s,p=Vx(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),y=this.getVerticalVector(m,!1,{x:0,y:0});let _,{angle:b}=p,x="center";if(d(b)&&a){b=U_(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;_=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(y,!1,o.angle);x=t,_=e}const S=u,A=h?h(c):c,w=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:_},o),text:A});return w.angle=b,l&&l.visible&&(w.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),w}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return at(t[1],0)?i=!at(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 wb(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return Tb(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=Y(t),u=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-d}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=u?c:h,e=u?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,d=s.y;rd&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+d-n}):t.setAttributes({y:d,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(E(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:d,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:y,firstVisible:_,autoWrap:b,overflowLimitLength:x}=a;if(u(h))h(t,e,s,this);else{if(c)!function(t,e){if(E(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,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=jt(e)})),Sb(i,t),!xb(t))break}}(t,{labelRotateAngle:d,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(E(t)||!A(i))return;const a=t[0].attribute.angle,o=hb(a),l=lb(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,u,d,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=Cb(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);A(i)&&(c=Ct(c,i))}}else{if(l){const i=Cb(e.attribute.y,null===(u=t[s+1])||void 0===u?void 0:u.attribute.y,null===(d=t[s-1])||void 0===d?void 0:d.attribute.y);A(i)&&(c=Ct(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&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);kb(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&function(t,e){if(E(t))return;const i=t.filter(_b);if(E(i))return;let s;s=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=u(n)?n:yb[n]||yb.parity;if(s.length>=3&&gb(s,r)){do{s=a(s,r)}while(s.length>=3&&gb(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=Y(i);pb(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),bb(l,s,n,(t=>pb(t,l,r))),bb(h,s,o,(t=>pb(t,h,r)||!(!n||t===l)&&pb(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:o,method:m,separation:v,lastVisible:y,firstVisible:_})}}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(A(c)&&(!A(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=Mc.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=ib.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-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(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,u=null!==(i=o.space)&&void 0!==i?i:4;let d=t,p=0,g=0;const f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=z_(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=Ce(l.padding);g=l.space+t[0]+t[2]}return d&&(d=(d-u-g-p-f-m)/e),d}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(){super.release(),this._breaks=null}}Wx.defaultAttributes=rb,W(Wx,Mb);const Gx=t=>t.map(((t,e)=>({index:e,value:t}))),Yx=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let u=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(u+=jt(90));const d=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;d||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=H_(a),y=t.range();let _=[];for(let i=0;i{Kx[t]=!0}));const tS=t=>-Math.log(-t),eS=t=>-Math.exp(-t),iS=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,sS=t=>10===t?iS:t===Math.E?Math.exp:e=>Math.pow(t,e),nS=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),rS=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),aS=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function oS(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 lS(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function hS(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function cS(t,e,i,s){return 1===i&&(i=0),hS(t,i,s)*(e/(1-i))}function uS(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function dS(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=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 gS{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=uS(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 d(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(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 d(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(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=ct(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=d(s)?(l-o)*i:s;let u=Math.exp(e);u=u/(u-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=u*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const fS=Symbol("implicit");class mS extends gS{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=$x.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=fS}clone(){const t=(new mS).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!==fS)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&&a>1;)a-=1,r=Math.floor((e-t)/a);return vS(t,e,r,n)}class _S extends mS{constructor(t){super(),this.type=$x.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=cS(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)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("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),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]}}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=[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(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:yS(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=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(t=10){const e=this.calculateVisibleDomain(this._range);return yS(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=dt(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,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 d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return d(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 _S(!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:bS}=ke;function xS(t,e){const i=typeof e;let s;if(d(e)||"boolean"===i)return()=>e;if("number"===i)return mt(t,e);if("string"===i){if(s=Ae.parseColorString(e)){const e=bS(Ae.parseColorString(t),s);return t=>e(t).formatRgb()}return mt(Number(t),Number(e))}return e instanceof we?bS(t,e):e instanceof Ae?bS(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):mt(Number(t),Number(e))}class SS extends gS{constructor(t=Qx,e=Qx){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Qx,this._piecewise=lS,this._interpolate=xS}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 s=Array.from(t,J);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=vt,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=dt(i[0],i[r-1])),this._piecewise=r>2?dS:lS,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:Qx),this.rescale(i)):this._clamp!==Qx}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=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 d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const AS=Math.sqrt(50),wS=Math.sqrt(10),TS=Math.sqrt(2),kS=[1,2,5,10],CS=(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=RS(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)),function(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(;++sn+t*s))):t>0?BS(0,-(e-1)/s,s):BS((e-1)/s,0,s)},MS=ht(((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 CS(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return CS(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=BS(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=BS(t,e,l);return n&&r.reverse(),r})),RS=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=kS[0];return i>=AS?s=kS[3]:i>=wS?s=kS[2]:i>=TS&&(s=kS[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function OS(t,e,i){const s=(e-t)/Math.max(0,i);return RS(s)}function PS(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;e0;){if(s=OS(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function LS(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 DS=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),FS=ht(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;d<=p;++d)for(c=1;cl)break;g.push(u)}}else for(;d<=p;++d)for(c=s-1;c>=1;--c)if(u=d>0?c/r(-d):c*r(d),!(ul)break;g.push(u)}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})),jS=ht(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=ES(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?DS(t,e,n):DS(t,e,pS(n)),h=DS(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),NS=ht(((t,e,i,s,n)=>PS(s(t),s(e),i).map((t=>pS(n(t))))));class US extends SS{constructor(){super(...arguments),this.type=$x.Linear}clone(){var t;const e=new US;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return MS(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(u(null==e?void 0:e.customTicks))return e.customTicks(this,t);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=ES(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(t=10){const e=this.calculateVisibleDomain(this._range);return PS(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(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r: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}}function zS(t){return e=>-t(-e)}function VS(t=Number.EPSILON){return e=>Math.max(e,t)}class WS extends SS{constructor(){super(nS(10),sS(10)),this.type=$x.Log,this._limit=VS(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new WS).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=nS(this._base),s=sS(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=zS(i),this._pows=zS(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=tS,this.untransformer=eS):(this._logs=i,this._pows=s,this._limit=VS(),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 Qx}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return FS(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return jS(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return NS(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return NS(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{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))))}}}W(WS,HS);class GS extends US{constructor(){super(rS(1),aS(1)),this.type=$x.Symlog,this._const=1}clone(){return(new GS).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).constant(this._const)}constant(t,e){return arguments.length?(this._const=t,this.transformer=rS(t),this.untransformer=aS(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return FS(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return jS(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return NS(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return NS(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}W(GS,HS);class YS{constructor(){this.type=$x.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!d(t)&&A(+t)?this._range[st(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 YS).domain(this._domain).range(this._range).unknown(this._unknown)}}function XS(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function $S(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!qx(t.type))return Gx(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return Gx([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:d=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),y=f&&f()?f().breakDomains:null,m=y&&y.length?v.filter((t=>y.every((e=>te[1])))):v;else if(p(h))m=XS(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=u(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=XS(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:d}):t.d3Ticks(e,{noDecimals:d})))}else{const i=null!==(s=u(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=u(e.tickMode)?e.tickMode:void 0;m=XS(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:d,customTicks:n}):t.ticks(e,{noDecimals:d,customTicks:n})))}var v,y;const _=t.domain();if(e.labelFirstVisible&&_[0]!==m[0]&&!m.includes(_[0])&&m.unshift(_[0]),e.labelLastVisible&&_[_.length-1]!==m[m.length-1]&&!m.includes(_[_.length-1])&&m.push(_[_.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=Xx(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=Xx(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=Y(l),r=f&&f()?qS.greedy:qS.parity;for(;l.length>=3&&gb(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;pb(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),$S(t,l,a,(e=>pb(e,t,i))),$S(n,l,o,(e=>pb(e,n,i)||!(!a||e===t)&&pb(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),Y(h)!==Y(m)&&h.push(Y(m))),m=h}}return Gx(m)},qS={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&pb(i,t,e)||(i=t,0))))}},ZS=(t,e,i,s)=>{const n=Xx(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},JS=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,QS=(t,e)=>t[1]{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),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?Gx([s[s.length-1]]):Gx([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=u(n)?n({axisLength:f,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=$(g),a=X(g);if(s.length<=f/n){const i=ZS(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=eA(s,i,o,e.labelLastVisible,Math.floor(n/l),!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=ZS(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!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])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+s{let s=t,n=e;for(;s=0?n=t:s=t+1}return s})(n,t.length,(t=>c(t)?1:-1));let d=u;do{if(d>u&&!r&&!c(d))d++;else{if(!s){o=d;break}{const s=t.length-1;let n,r=0;n=t.length%d>0?t.length-t.length%d+d:t.length;do{if(n-=d,n!==s&&!JS(e[n],e[s],i))break;r++}while(n>0);if(n===s){o=d,a=r;break}{const i=Math.floor(t.length/d)-r+1;if(i=0?QS(e[n-d],e[n]):t,u=Math.abs(t-c);if(u~~(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:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,u=a;for(;u>=n;--u)if(o=u*t+s,l=u*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&iA[31&o]&sA[1+(31&l)])return!0}else{if(i[h]&iA[31&o])return!0;if(i[c]&sA[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,u;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,iA[31&o]&sA[1+(31&l)]);else for(s(h,iA[31&o]),s(c,sA[1+(31&l)]),u=h+1;u{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,sA[31&a]|iA[1+(31&o)]);else for(n(l,sA[31&a]),n(h,iA[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=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 rA(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=ct(i,-o,t.width+l),u=ct(s,-o,t.width+l),d=ct(n,-a,t.height+h),p=ct(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(u),y1:t.y(d),y2:t.y(p)}}function aA(t,e,i=!1){return i?rA(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function oA(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=aA(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=rA(t,r)),e.getRange(r)))}function lA(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const u=s.filter((t=>p(t))),d=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return lA(t,e,n,o,h,c,l)}return!1}var d;if("moveY"===i.type){const s=(i.offset?u(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return lA(t,e,n,s,h,c)}if("moveX"===i.type){const s=(i.offset?u(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return lA(t,e,n,s,h,c)}return!1}const cA=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],uA=["top","inside-top","inside"];function dA(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:u=0}=s,d=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+u;let y=0,_=0;return d<0-h?y=-d:p>m&&(y=m-p),g<0-l?_=-g:f>v&&(_=v-f),{dx:y,dy:_}}const pA={mode:"same-time",duration:300,easing:"linear"};function gA(t){return 3===t||4===t}function fA(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 mA=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 vA(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)}}var yA=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{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const xA=(t,e)=>Math.ceil(t)>Math.floor(e),SA=([t,e],[i,s])=>s>t&&e>i;function AA(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}var wA=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{const e=t.target;e===this._lastHover||E(e.states)||(e.addState(T_.hover,!0),R_(this,(t=>{t===e||E(t.states)||t.addState(T_.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(R_(this,(t=>{E(t.states)||(t.removeState(T_.hoverReverse),t.removeState(T_.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void R_(this,(t=>{E(t.states)||(t.removeState(T_.selectedReverse),t.removeState(T_.selected))}));E(e.states)||(e.addState(T_.selected,!0),R_(this,(t=>{t===e||E(t.states)||t.addState(T_.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)===ys.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===ys.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if($t(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,u=s+o,d=n+l,p=r+h,g=d-c,f=p-u;return[vA(g,f,c,u,a,o),vA(-g,-f,d,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds)}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=Mc.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new pn)}return e&&e.getAttributes(!0).fill&&s.setAttribute("stroke",e.getAttributes(!0).fill),this.attribute.line&&!E(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),d(this._idToGraphic)||this._isCollectionBase&&d(this._idToPoint))return;const t=[];!1!==this._enableAnimation&&this._baseMarks.forEach((e=>{t.push(e.attribute),e.initAttributes(e.getAttributes(!0))}));const{overlap:e,smartInvert:i,dataFilter:s,customLayoutFunc:n,customOverlapFunc:r}=this.attribute;let a=this.attribute.data;if(u(s)&&(a=s(a)),a&&a.length){const t=new Set;a=a.filter((e=>!t.has(e.id)&&t.add(e.id)))}let o=this._initText(a);o=u(n)?n(a,o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(o);const l=[],h=o;if(!c(e)&&u(null==e?void 0:e.filterBeforeOverlap)){const t=this.getRelatedGraphic.bind(this);o.forEach((i=>{e.filterBeforeOverlap(i,t,this)?h.push(i):l.push(i)}))}u(r)?o=r(h,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(l):!1!==e&&(o=this._overlapping(h).concat(l)),u(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),o&&o.length&&o.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==i&&this._smartInvert(o),this._renderLabels(o),!1!==this._enableAnimation&&this._baseMarks.forEach(((e,i)=>{e.initAttributes(t[i])}))}_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&&!E(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!E(e)&&(t.states=e)}_createLabelText(t){var e,i;return G_(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;const i=[];let s;if(s=u(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),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,u=t=>o.get(t).x,d=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&xA(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&xA(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(at(r,u(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(AA([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:u=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!SA([d(n),p(n)],[d(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),d=o-(t+s);if(di){const e=t-(a-d),i=l(n)-e;Math.abs(i)<=u&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-d),e=l(r)-t;Math.abs(e)<=u&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=u&&Math.abs(h)<=u&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let _=0,b=t.length-1;for(;_<=b;)_===b?y.push(t[_]):(y.push(t[_]),y.push(t[b])),_++,b--;return y}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&s.setRange(aA(i,t.AABBBounds,!0))}))),h.length>0&&h.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&&s.setRange(aA(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(aA(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){var s;if(t){if(!1!==t.attribute.visible){if(null===(s=t.context)||void 0===s?void 0:s.animationState){const e=t.clone();return Object.assign(e.attribute,t.getAttributes(!0)),e.AABBBounds}return t.AABBBounds}const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:n,y:r}=e;return{x1:n,x2:n,y1:r,y2:r}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,u=(null==n?void 0:n.get(c))?"update":"enter";let d;o&&(d=this._createLabelLine(t,h));const p=d?{text:t,labelLine:d}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===u)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===u){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:u,mode:d,interactInvertType:p}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",y=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",_=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{kA[t]=e};var MA=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{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,u=(e.y1+e.y2)/2;let d=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":d=-1;break;case"right":d=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":d=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":d=0,p=0}return{x:c+d*(s+g)+Math.sign(d)*(l/2),y:u+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}BA.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const EA=()=>{CA("symbol",BA),CA("line-data",BA)};var RA=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{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,u=0;switch(e){case"top":case"inside-top":u=-.5;break;case"bottom":case"inside-bottom":u=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,u=-.5;break;case"top-left":c=-.5,u=-.5;break;case"bottom-right":c=.5,u=.5;break;case"bottom-left":c=-.5,u=.5}return l+=c*a,h+=u*o,{x:l,y:h}})(e,i);let d=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")?d=g?1:-1:i.includes("right")&&(d=g?-1:1),i){case"top-right":case"bottom-right":d=-1;break;case"top-left":case"bottom-left":d=1}return{x:c+d*s+d*l/2,y:u+p*s+p*h/2}}}OA.tag="rect-label",OA.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var PA=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{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=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}}(t,e,i,s)}};IA.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const LA=()=>{CA("line",IA),CA("area",IA)};var DA=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);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=u(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=u(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}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),h=l.getAttributes(!0),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!d(s[i])&&!d(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,d=h.endAngle-h.startAngle,p=Vt(h.endAngle-d/2),g=Ut(c,h.outerRadius,o),f=Ut(c,a+e.line.line1MinLength,o),m=new FA(t,g,f,p,d,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=Ut(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(u=m.quadrant)||2===u?this._arcRight.set(m.refDatum,m):gA(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var u}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":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,u=t.innerRadius,d=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(d,h.height))p=0;else{let t;t=c>=Math.PI?u:Math.max(u,h.height/2/Math.tan(c/2)),p=d-t-a}!0!==r.rotate&&(p=d-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?u-l+y:"inside-center"===o?u+(d-u)/2:d+l-y,t.labelPosition=Ut(t.circleCenter,v,t.middleAngle),t.labelLimit=f,ot(f,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.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=gA(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=gA(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.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 c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(lt(t.pointB.x,this._line2MinLength+h)||ot(t.pointB.x,c-this._line2MinLength-h))&&(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(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:u,quadrant:d,pointB:p}=t;A(p.x*p.y)||(t.pointC={x:NaN,y:NaN},u.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=gA(d)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const y=this._getFormatLabelText(t.refDatum,v);t.labelText=y;let _=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-_-c:0+_+c;break;default:m=p.x+f*this._line2MinLength}_=Math.max(this._ellipsisWidth,_);const b=_0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):u.x=m+f*(this._alignOffset+c+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?d(h)||"auto"===h?"edge"===c?gA(t.quadrant)?"left":"right":gA(t.quadrant)?"right":"left":h:d(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,d)}else if(-1!==u&&-1===d){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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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;A(c)?t.pointB={x:s.x+c*(gA(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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),u=this._computeLayoutRadius(h/2,e,i),d=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(at(l/2,d))g=0,f=1,m=-p;else if(at(h/2,p))g=1,f=0,m=-d;else{const t=-1/(p/d);g=t,f=-1,m=p-t*d}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),u=-(e*h+i)/t;return 0===l?[{x:u,y:h}]:[{x:u,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-u,0,u);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.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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;e{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 HA(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=Ft.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 zA(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=db(t,!!n),o=db(r,!!n);const h=Ft.distancePP(s,l),c=Ft.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=HA(e,t,!1,!!n),o=HA(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=db(t,!!n),o=db(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}UA.defaultAttributes={pickable:!1};class VA extends Wg{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&cb(this._innerView),this.removeAllChild(!0),this._innerView=Mc.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 ub(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:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${ib.grid}-sub`:`${ib.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=db(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=HA(t,o,!1,!!a)}const d=Mc.path(Object.assign({path:c,z:l},u(r)?j({},this.skipDefault?null:VA.defaultAttributes.style,r(t,i)):r));d.name=`${h}-line`,d.id=this._getNodeId(`${h}-path-${n}`),e.add(d)})),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,d=n[1].y-n[0].y,p=Math.sqrt(c*c+d*d),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+d*g});const f=db(o,!!a),m=At(o[0].x-o[1].x),v=At(o[0].y-o[1].y),y=Mc.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*_t/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},u(r)?j({},this.skipDefault?null:VA.defaultAttributes.style,r(t,i)):r));y.name=`${h}-line`,y.id=this._getNodeId(`${h}-path-${s}`),e.add(y)})),n.length>1&&o){const t=_(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!at(a.value,0)&&!at(l.value,0),u=!at(a.value,1)&&!at(l.value,1),d=[],p=a.value>l.value;(p&&u||!p&&c)&&d.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{d.push(t.points)})),(p&&c||!p&&u)&&d.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}VA.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},n_(),l_();class WA extends VA{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},VA.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=S_,endAngle:r=A_}=this.attribute;i=function(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n=2){const n=this._getPointsOfSubGrid(s,i);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})}}function GA(){n_(),y_(),b_()}W(WA,Mb);const YA={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};GA();class XA extends Wg{getCurrent(){return this._current}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},XA.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(QA.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(QA.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===QA.focus||"focus"===o){const s=a.hasState(ZA.focus);a.toggleState(ZA.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[ZA.unSelected,ZA.unSelectedHover,ZA.focus],t),this._setLegendItemState(e,ZA.selected,t)})):(this._setLegendItemState(a,ZA.selected,t),this._removeLegendItemState(a,[ZA.unSelected,ZA.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[ZA.selected,ZA.selectedHover,ZA.focus],t),this._setLegendItemState(e,ZA.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(ZA.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(ZA.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(JA.legendItemClick,a,t);i?(this._removeLegendItemState(a,[ZA.selected,ZA.selectedHover],t),this._setLegendItemState(a,ZA.unSelected,t)):(this._setLegendItemState(a,ZA.selected,t),this._removeLegendItemState(a,[ZA.unSelected,ZA.unSelectedHover],t))}else this._setLegendItemState(a,ZA.selected,t),this._removeLegendItemState(a,[ZA.unSelected,ZA.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[ZA.selected,ZA.selectedHover],t),this._setLegendItemState(e,ZA.unSelected,t))}))}this._dispatchLegendEvent(JA.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,ZA.selected),this._removeLegendItemState(e,[ZA.unSelected,ZA.unSelectedHover])):(this._removeLegendItemState(e,[ZA.selected,ZA.selectedHover]),this._setLegendItemState(e,ZA.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=$A,spaceRow:l=KA,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:u,isHorizontal:d,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:d?i:e,v=this._contentMaxHeight;let y,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:w}=this._itemContext,T=0,k=0;const C=[];for(let t=g,e=u.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),y=u[t],y.id||(y.id=y.label),y.index=t;let e=!0;_(n)&&(e=n.includes(y.label));const i=this._renderEachItem(y,e,t,u),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),d?(p(s)&&(f&&a?(w=Math.ceil((S+g)/s),b=w>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||C.forEach((t=>{t.setAttributes({y:t.attribute.y+(k-t.attribute.height)/("middle"===h?2:1)})})),w+=1,S=0,A+=k+l,k=0,C.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,k=Math.max(k,m),C.push(i)):(p(v)&&(f&&a?(w=Math.ceil((A+m)/v),b=w>1):v<=m?(w+=1,b=!0,A=0,t>0&&(S+=T+o)):v{t.setAttributes({y:t.attribute.y+(k-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=w,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=w),r||(this._itemContext.startIndex=u.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||E(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=Mc.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:u,height:d}=t,g=[];p(c)&&g.push(c),p(u)&&g.push(u),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=$(g)),p(d)&&(this._itemHeightByUser=d);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,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(),u=h.width();let d=!1;"labelFirst"===t?u>e?d=!0:s.setAttribute("maxLineWidth",e-u):"valueFirst"===t?c>e?d=!0:i.setAttribute("maxLineWidth",e-c):c+u>e&&(d=!0),d&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-u)),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:u,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,s),A=this._handleStyle(y,t,e,i,s),w=this._handleStyle(b,t,e,i,s),T=this._handleStyle(x,t,e,i,s),k=Ce(c);let C;!1===x.visible?(C=Mc.group({x:0,y:0,cursor:null===(n=T.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(C,QA.item,t,C)):(C=Mc.group(Object.assign({x:0,y:0},T.style)),this._appendDataToShape(C,QA.item,t,C,T.state)),C.id=`${null!=a?a:o}-${i}`,C.addState(e?ZA.selected:ZA.unSelected);const M=Mc.group({x:0,y:0,pickable:!1});C.add(M);let B,E=0,O=0,P=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);O=_(i)?i[0]||0:i,P=R(v,"space",8);const s=Mc.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&&d(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&d(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,QA.itemShape,t,C,S.state),s.addState(e?ZA.selected:ZA.unSelected),M.add(s)}let I=0;if(u){const e=R(g,"size",10);B=Mc.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:k},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(B,QA.focus,t,C),I=e}const L=y.formatMethod?y.formatMethod(o,t,i):o,D=G_(Object.assign(Object.assign({x:O/2+P,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,QA.itemLabel,t,C,A.state),D.addState(e?ZA.selected:ZA.unSelected),M.add(D);const F=R(y,"space",8);if(p(l)){const s=R(b,"space",u?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=G_(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:w.style.fontSize},w.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,QA.itemValue,t,C,w.state),r.addState(e?ZA.selected:ZA.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-k[1]-k[3]-O-P-F-I-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-O/2-k[1]-k[3]-I-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));E=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),M.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-k[1]-k[3]-O-P-I),E=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):E=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);B&&(B.setAttribute("x",E),M.add(B));const j=M.AABBBounds,N=j.width();if("right"===f){const t=j.x2,e=j.x1;M.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===B?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 U=j.height(),H=p(this.attribute.item.width)?this.attribute.item.width:N+k[1]+k[3],z=this._itemHeightByUser||U+k[0]+k[2];return C.attribute.width=H,C.attribute.height=z,B&&B.setAttribute("visible",!1),M.translateTo(-j.x1+k[3],-j.y1+k[0]),C}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new XA(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},j({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new XA(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new E_(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new E_(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?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 i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",ft(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=$A,spaceRow:o=KA}=n,l=this._itemsContainer,{space:h=qA,defaultCurrent:c=1}=r,u=ew(r,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,y=0,_=0,b=0,x=1;if(d){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(u),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v<_+i&&e>0&&(_=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:_,y:b}),_+=a+i})),this._itemContext.startX=_,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(u),this._pagerComponent=g,this._innerView.add(g),y=p-g.AABBBounds.height()-h-t,y<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;y0&&(b=0,_+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:_,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(d?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=Mc.group({x:0,y:t,width:d?v:f,height:d?m:y,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(d?m+o:f+a,d?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=$A,spaceRow:a=KA}=s,o=this._itemsContainer,{space:l=qA,defaultCurrent:h=1}=n,c=ew(n,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,d=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(u)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=d-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(u){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const y=Mc.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return y.add(o),this._innerView.add(y),this._itemContext.clipContainer=y,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(y),this._bindEventsOfPager(u?g:f,u?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=Mc.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];at(ct(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),at(ct(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(ZA.selected)?this._setLegendItemState(t,ZA.selectedHover,e):this._setLegendItemState(t,ZA.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===QA.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(JA.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(ZA.unSelectedHover)||t.hasState(ZA.selectedHover))&&(i=!0),t.removeState(ZA.unSelectedHover),t.removeState(ZA.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(ZA.unSelectedHover)&&!t.hasState(ZA.selectedHover)||(i=!0),t.removeState(ZA.unSelectedHover),t.removeState(ZA.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===QA.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(JA.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(JA.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!==QA.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(JA.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!==QA.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(JA.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(ZA.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=j({},iw,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(ZA.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(u(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]&&(u(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};sw.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:$A,spaceRow:KA,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:qA,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0};const nw=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return j(t,...e,{shape:i.every(d)?void 0:j({},...i),key:s.every(d)?void 0:j({},...s),value:n.every(d)?void 0:j({},...n)})},rw=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:G(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}},aw={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:w_,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:w_,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:w_,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new he).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},ow=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];n_(),d_(),y_(),b_(),g_();let lw=class t extends Wg{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: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 u=Ce(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:u[3],y:u[0]},"group");const d=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",j({symbolType:"circle"},d.shape,{visible:O_(d)&&O_(d.shape)}),"symbol"),"object"!=typeof d.value.text||null===d.value.text||"rich"!==d.value.text.type&&"html"!==d.value.text.type?d.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:O_(d)&&O_(d.value)},rw(d.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=d.value.text)&&void 0!==e?e:"",visible:O_(d)&&O_(d.value)},d.value),"text"):"rich"===d.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:O_(d)&&O_(d.value)},rw(d.value)),"richtext"):"html"===d.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:d.value.text.text},C_),d.value),visible:O_(d)&&O_(d.value),width:d.value.width,height:d.value.height,wordBreak:d.value.wordBreak,textAlign:d.value.textAlign,textBaseline:d.value.textBaseline,singleLine:!1,textConfig:[]},d.value),"richtext"));const g=O_(d.shape)?d.shape.size+d.shape.spacing:0,{textAlign:f,textBaseline:m}=d.value,v=n.width-u[3]-u[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",d.height):"middle"===m?this._tooltipTitle.setAttribute("y",d.height/2):this._tooltipTitle.setAttribute("y",0);const y=O_(d)?d.height+d.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",u[3]),this._tooltipContent.setAttribute("y",u[0]+y);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!O_(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),u=n.shape.size+n.shape.spacing;let d="right"===c?(o?u:0)+(O_(n.key)?r+n.key.spacing:0)+(O_(n.value)?a:0):0;this._createShape("right"===c?d-n.shape.size/2:d+n.shape.size/2,n,h,l),o&&("right"===c?d-=u:d+=u);const g=this._createKey(n,h,l);g&&(Y_(c,g,n.key.textAlign,d,r),g.setAttribute("y",0),"right"===c?d-=r+n.key.spacing:d+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";p(n.value.textAlign)?t=n.value.textAlign:O_(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),Y_(c,f,t,d,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(O_(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Ba(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(O_(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},rw(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},rw(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},C_),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(O_(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},rw(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},rw(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=>ow.includes(t)))?(this._mergeAttributes(e,s),d(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,u=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?u-=i+n:"middle"===l?u-=i/2:u+=n,c+e>h.x2&&(c-=e+s),u+i>h.y2&&(u-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&O_(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:u,value:d,shape:p,spaceRow:g}=i,f=O_(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=H_(u),y=H_(d);let _=0;if(O_(u)){const{width:t,height:e}=v.quickMeasure(u.text);l.push(t),_=Math.max(_,e)}if(O_(d)){const{width:t,height:e}=y.quickMeasure(d.text);h.push(t),_=Math.max(_,e)}f&&Io[m]&&(t=!0,r.push(p.size),_=Math.max(p.size,_)),e.height=_,o+=_,a{t.width=a})),e.hasContentShape=t,e.keyWidth=u,e.valueWidth=d}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return nw({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return nw({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};function hw(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return A(s)&&(t+=s),t}),0)}function cw(t,e){const i=uw(t),s=uw(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 uw(t,e={x:0,y:0}){return Ft.distancePP(t,e)}function dw(t,e,i){let s=!1;if(e&&u(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}lw.defaultAttributes=aw;function pw(t){return function(e){let i;return i=_(t)?t.reduce(((t,e)=>null==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function gw(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&gw(t[i],e)}}var fw,mw,vw;function yw(t){var e,i;const{type:s}=t;return s===mw.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!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.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_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"}(fw||(fw={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",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",t.mosaic="mosaic",t.pictogram="pictogram"}(mw||(mw={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",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.transform="transform",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.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.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(vw||(vw={}));const _w={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},bw={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function xw(t,e){var i;if(!t)return[];const s=Mw(t,e);if(!s||_(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?kw(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>Tw(i)?Aw(t,i,e):i)).filter(p)}))):i.map((i=>Tw(i)?Aw(t,i,e):i)).filter(p):[]}return[]}function Sw(t,e){var i,s;return kw(t)?null!==(s=null===(i=t.find((t=>p(t.isAvailable)?u(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 Aw(t,e,i){var s;const n=Mw(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=_w[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=bw[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(d(e.a)&&d(e.l)||!y(r))return r;let o=new Ae(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=ge(t,i,s),a=pe(n,r,e.l),l=new Ae(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return p(e.a)&&o.setOpacity(e.a),o.toRGBA()}const ww=(t,e)=>{if(e&&Tw(t)){const i=Aw(e,t);if(i)return i}return t};function Tw(t){return t&&"palette"===t.type&&!!t.key}function kw(t){return!(!_(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function Cw(t){return _(t)?{dataScheme:t}:t}function Mw(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||d(n))r=null==t?void 0:t.default;else{const a=yw(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 Bw extends mS{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(!kw(this._range))return void super.range(this._range);const t=Sw(this._range,this._domain);super.range(t)}}const Ew={linear:US,band:_S,point:class extends _S{constructor(t){super(!1),this.type=$x.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:mS,threshold:YS,colorOrdinal:Bw};function Rw(t){const e=Ew[t];return e?new e:null}function Ow(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function Pw(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function Iw(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function Lw(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function Dw(t){return!!y(t)&&(!!t.endsWith("%")&&Hg(t.substring(0,t.length-1)))}function Fw(t){return!!g(t)&&("percent"in t||"offset"in t)}function jw(t,e,i,s=0){var n,r;return S(t)?t:Dw(t)?Number(t.substring(0,t.length-1))*e/100:u(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 Nw(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]=jw(t[s],e.size,i)}))})),o}function Uw(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}}function Hw(t){let e={};return _(t)?(d(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),d(t[1])||(e.left=e.right=t[1]),d(t[2])||(e.bottom=t[2]),d(t[3])||(e.left=t[3]),e):S(t)||Dw(t)||u(t)||Fw(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function zw(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const Vw=(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},Ww=[{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"]}];function Gw(t,e){return t&&e.key in t?t[e.key]:e.default}function Yw(t){return t&&"token"===t.type&&!!t.key}const Xw={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%"},$w={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:Ww,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)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:Xw,component:{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}}},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:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},Kw={name:"dark",colorScheme:{default:{dataScheme:Ww,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",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},qw=(t,e,i)=>{if(d(e))return t;const s=e[0];return d(s)?t:1===e.length?(t[s]=i,t):(d(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),qw(t[s],e.slice(1),i))};function Zw(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=Cw(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}Jw._charts={},Jw._series={},Jw._components={},Jw._graphicComponents={},Jw._marks={},Jw._regions={},Jw._animations={},Jw._implements={},Jw._chartPlugin={},Jw._vChartPlugin={},Jw._componentPlugin={},Jw.transforms={fields:Ve,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}},Jw.dataParser={csv:(t,e={},i)=>(i.type=ze.DSV,Ze(t)),dsv:(t,e={},i)=>{i.type=ze.DSV;const s=Ne(Qe,e),{delimiter:n}=s;if(!y(n))throw new TypeError("Invalid delimiter: must be a string!");return qe(n).parse(t)},tsv:(t,e={},i)=>(i.type=ze.DSV,Je(t))},Jw._layout={},Jw._grammarTransforms={},Jw._stageEventPlugins={},Jw.registerStageEventPlugin=(t,e)=>{Jw._stageEventPlugins[t]=e},Jw.getStageEventPlugin=t=>Jw._stageEventPlugins[t],Jw._interactionTriggers={},Jw.registerInteractionTrigger=(t,e)=>{Jw._interactionTriggers[t]=e},Jw._composedEventMap={},Jw.registerComposedEvent=(t,e)=>{Jw._composedEventMap[t]=e},Jw._tooltipProcessors={},Jw.registerTooltipProcessor=(t,e)=>{Jw._tooltipProcessors[t]=e},Jw.createTooltipProcessor=(t,e)=>{const i=Jw._tooltipProcessors[t];return i?new i(e):null};const eT=t=>{const e={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"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e};eT();const iT={[$w.name]:$w},sT=$w.name,nT=new Map(Object.keys(iT).map((t=>[t,iT[t]]))),rT=new Map,aT=new Map(Object.keys(iT).map((t=>[t,t===sT]))),oT=(t,e)=>{if(!t)return;const i=uT(e);nT.set(t,i),aT.set(t,!0)},lT=(t=sT)=>(aT.has(t)&&!aT.get(t)&&oT(t,nT.get(t)),nT.get(t)),hT=t=>nT.delete(t)&&rT.delete(t)&&aT.delete(t),cT=t=>!!y(t)&&nT.has(t),uT=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:sT;return Qw({},lT(i),t)};class dT{static registerInstance(t){dT.instances.set(t.id,t)}static unregisterInstance(t){dT.instances.delete(t.id)}static getInstance(t){return dT.instances.get(t)}static instanceExist(t){return dT.instances.has(t)}static forEach(t,e=[],i){const s=G(e);return dT.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}dT.instances=new Map;class pT{static registerTheme(t,e){oT(t,e)}static getTheme(t,e=!1){return lT(t)}static removeTheme(t){return hT(t)}static themeExist(t){return cT(t)}static getDefaultTheme(){return pT.themes.get(sT)}static setCurrentTheme(t){pT.themeExist(t)&&(pT._currentThemeName=t,dT.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return pT.getTheme(pT._currentThemeName,t)}static getCurrentThemeName(){return pT._currentThemeName}}function gT(t){return y(t)?pT.themeExist(t)?pT.getTheme(t):{}:g(t)?t:{}}pT.themes=nT,pT._currentThemeName=sT;const fT=["animationThreshold","colorScheme","name","padding"];function mT(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];fT.includes(n)?s[n]=r:m(r)?Tw(r)?s[n]=ww(r,e):Yw(r)?s[n]=Gw(i,r):s[n]=mT(r,e,i):s[n]=r})),s}function vT(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]=vT(t[s],e)}return i}return _(t)?t.map((t=>vT(t,e))):t}function yT(t,e){if(!t)return t;if(m(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(y(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=yT(t[s],e)}return i}return _(t)?t.map((t=>yT(t,e))):t}function _T(t,...e){return u(t)?t(...e):t}const bT=(t,e,i,s)=>((t,e,i)=>H_(t,e,i,{fontFamily:Xw.fontFamily,fontSize:Xw.fontSize}))(e,i,s).measure(t),xT="__VCHART",ST=500,AT=500,wT=`${xT}_MEASURE_CANVAS_ID`,TT=`${xT}_DEFAULT_DATA_INDEX`,kT=`${xT}_DEFAULT_DATA_KEY`,CT=`${xT}_DEFAULT_DATA_SERIES_FIELD`,MT=`${xT}_DEFAULT_SERIES_STYLE_NAME`,BT=`${xT}_STACK_KEY`,ET=`${xT}_STACK_START`,RT=`${xT}_STACK_END`,OT=`${xT}_STACK_START_PERCENT`,PT=`${xT}_STACK_END_PERCENT`,IT=`${xT}_STACK_START_OffsetSilhouette`,LT=`${xT}_STACK_END_OffsetSilhouette`,DT=`${xT}_STACK_TOTAL`,FT=`${xT}_STACK_TOTAL_PERCENT`,jT=`${xT}_STACK_TOTAL_TOP`,NT=`${xT}_STACK_TOTAL_BOTTOM`,UT=`${xT}_MOSAIC_VALUE_START_PERCENT`,HT=`${xT}_MOSAIC_VALUE_END_PERCENT`,zT=`${xT}_MOSAIC_CAT_START_PERCENT`,VT=`${xT}_MOSAIC_CAT_END_PERCENT`,WT=`${xT}_SEGMENT_START`,GT=`${xT}_SEGMENT_END`,YT=`${xT}_KEY`,XT=`${xT}_MAP_LOOK_UP_KEY`;function $T(t,e){for(let i=0;it.key===e))}function qT(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 ZT(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:{groupField:a.groupField,nodes:{}},ik(t,a,n[o],l,e,r))})),s?JT(n):n}function JT(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))):JT(t[e].nodes);return t}function QT(t,e){if("values"in t&&t.values.length){const i=hw(t.values,e),s=function(t,e){const i=[];return t.forEach((t=>{const s=+t[e];A(s)&&i.push(s)})),0===i.length?null:X(i)}(t.values,PT);t.values.forEach((t=>{t[DT]=i,t[FT]=s}))}else for(const i in t.nodes)QT(t.nodes[i],e)}function tk(t){if(!t.values.length)return;const e=t.values[t.values.length-1][RT]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,u=null;const d=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!u||l[n.end]>u[n.end])&&(u=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)ek(t.nodes[r],e,i,s,n)}function ik(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[RT]=function(t){if(A(t))return t;const e=+t;return A(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 l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),ik(t,e.nodes[l],i.nodes[l],s,n,r,h)}}function sk(t={}){const e=Object.assign({},t);if(u(t.style)?e.style=(e,i,s,n)=>rk(t.style(e,i,s,n)):E(t.style)||(e.style=rk(t.style)),!E(t.state)){const i={};Object.keys(t.state).forEach((e=>{u(t.state[e])?i[e]=(i,s,n,r)=>rk(t.state[e](i,s,n,r)):E(t.state[e])||(i[e]=rk(t.state[e]))})),e.state=i}return e}function nk(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{u(t[i])?e[i]=(e,s,n,r)=>rk(t[i](e,s,n,r)):E(t[i])||(e[i]=rk(t[i]))})),e}function rk(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:jt(t.angle)}):t}const ak=t=>"line"===t||"area"===t,ok=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return ak(i)?e:null==e?void 0:e[0]},lk=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let hk=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},n=Jw.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{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(Jw.getComposedEvent(t))if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};var ck;!function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(ck||(ck={}));const uk=["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 dk,pk,gk;t.ChartEvent=void 0,(dk=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",dk.rendered="rendered",dk.renderFinished="renderFinished",dk.animationFinished="animationFinished",dk.regionSeriesDataFilterOver="regionSeriesDataFilterOver",dk.afterInitData="afterInitData",dk.afterInitEvent="afterInitEvent",dk.afterInitMark="afterInitMark",dk.rawDataUpdate="rawDataUpdate",dk.viewDataFilterOver="viewDataFilterOver",dk.viewDataUpdate="viewDataUpdate",dk.viewDataStatisticsUpdate="viewDataStatisticsUpdate",dk.markDeltaYUpdate="markDeltaYUpdate",dk.viewDataLabelUpdate="viewDataLabelUpdate",dk.scaleDomainUpdate="scaleDomainUpdate",dk.scaleRawDomainUpdate="scaleRawDomainUpdate",dk.scaleUpdate="scaleUpdate",dk.dataZoomChange="dataZoomChange",dk.drill="drill",dk.layoutStart="layoutStart",dk.layoutEnd="layoutEnd",dk.layoutRectUpdate="layoutRectUpdate",dk.playerPlay="playerPlay",dk.playerPause="playerPause",dk.playerEnd="playerEnd",dk.playerChange="playerChange",dk.playerForward="playerForward",dk.playerBackward="playerBackward",dk.scrollBarChange="scrollBarChange",dk.brushStart="brushStart",dk.brushChange="brushChange",dk.brushEnd="brushEnd",dk.brushClear="brushClear",dk.brushActive="brushActive",dk.legendSelectedDataChange="legendSelectedDataChange",dk.legendFilter="legendFilter",dk.legendItemClick="legendItemClick",dk.legendItemHover="legendItemHover",dk.legendItemUnHover="legendItemUnHover",dk.tooltipShow="tooltipShow",dk.tooltipHide="tooltipHide",dk.tooltipRelease="tooltipRelease",dk.afterResize="afterResize",dk.afterRender="afterRender",dk.afterLayout="afterLayout",dk.afterMarkLayoutEnd="afterMarkLayoutEnd",dk.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(pk||(pk={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(gk||(gk={}));const fk=[gk.mark,gk.model,gk.chart,gk.vchart];class mk{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(gk.vchart,[]),this._levelNodes.set(gk.chart,[]),this._levelNodes.set(gk.model,[]),this._levelNodes.set(gk.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const vk={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"};class yk{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=R(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>ok(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||pk.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||pk.chart);o.get(t)||o.set(t,new mk);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||pk.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||pk.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||pk.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||pk.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?fk.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[pk.chart,pk.window,pk.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(u(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 vk[a]&&(a=vk[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)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?gk.model:gk.vchart:gk.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=ft(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=gt(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=pk.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==gk.model&&s!==gk.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=gk.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case pk.chart:return this._viewBubbles;case pk.window:return this._windowBubbles;case pk.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case pk.chart:return this._viewListeners;case pk.window:return this._windowListeners;case pk.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return uk.includes(t)||Object.values(ck).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&Jw.hasInteractionTrigger(e)}}function _k(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function bk(t,e,i){t.getParser(e)||t.registerParser(e,i)}const xk=new Map;function Sk(t,e=!1){let i=e;return t.latestData instanceof ni&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const Ak=(t,e)=>0===t.length?[]:1===t.length?Sk(t[0],null==e?void 0:e.deep):t.map((t=>Sk(t,null==e?void 0:e.deep)));function wk(e,i,s){_k(i=i instanceof si?i:e.dataSet,"copyDataView",Ak);const n=new ni(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function Tk(t,e,i=[]){var s;if(t instanceof ni)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(t.fields);let u;h.clone=!(!1===h.clone);const d=i.find((t=>t.name===n));if(d)u=d;else{const t={name:n};if(c&&(t.fields=c),u=new ni(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return Rg(`no data matches fromDataId ${o}`),null;u.parse([t],{type:"dataview"}),u.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return Rg(`no data matches fromDataIndex ${a}`),null;u.parse([t],{type:"dataview"}),u.transform({type:"copyDataView"})}else Array.isArray(r)?u.parse(r,h):!y(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(u.parse([]),Rg("values should be array")):u.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&u.transform(t)}))}return u}function kk(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var Ck,Mk,Bk,Ek;t.TransformLevel=void 0,(Ck=t.TransformLevel||(t.TransformLevel={}))[Ck.copyDataView=-10]="copyDataView",Ck[Ck.treemapFilter=-8]="treemapFilter",Ck[Ck.treemapFlatten=-7]="treemapFlatten",Ck[Ck.dotObjFlat=-7]="dotObjFlat",Ck[Ck.linkDotInfo=-7]="linkDotInfo",Ck[Ck.sankeyLayout=-7]="sankeyLayout",Ck[Ck.dataZoomFilter=-6]="dataZoomFilter",Ck[Ck.legendFilter=-5]="legendFilter",function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(Mk||(Mk={})),function(t){t.data="data",t.mark="mark"}(Bk||(Bk={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(Ek||(Ek={}));const Rk=["line","area","trail"];function Ok(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(YT,i?t.slice().sort(i):t.slice()),{keys:[YT],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const Pk=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function Ik(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{Ik(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function Dk(t,e,i,s){const n=Ok(t,(t=>i(t))),r=Ok(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!d(t)){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}}const Fk=`${xT}_BuiltIn_CallBack_Disappear`;var jk;!function(t){t.render="render",t.disappear="disappear"}(jk||(jk={}));class Nk{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(e,i){this._count=0,this._rootMarks=[],this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{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._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var e,i,s,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:u,autoPreventDefault:d,background:f}=this._option;Ap.setEnv(function(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}(o),null!=l?l:{}),this._stage=null!==(e=this._option.stage)&&void 0!==e?e:new Fp(Object.assign({background:f,width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,canvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:u,autoPreventDefault:d},ReactDOM:this._option.ReactDOM,autoRefresh:p(r)?r:!p(a)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{})),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const m=sh({x:0,y:0,width:this._width,height:this._height});m.name="root",this._stage.defaultLayer.appendChild(m),this._rootGroup=m;const v=(p(h)?h:Fg(o))&&!1!==c&&Jw.getStageEventPlugin("gesture");v&&(this._gestureController=new v(this._stage,g(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=Ek.before}_setCanvasStyle(){if(this._stage&&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")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(Ap.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=Ap.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>Ik(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>Ik(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{Ik(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;this._hasCommitedMark()&&(Eg(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),this._rootMarks.forEach((t=>{t.render()})),this._layoutState===Ek.before&&(this._layoutState=Ek.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=Ek.reevaluate,this._hasCommitedMark()&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),this.findProgressiveMarks(),this.updateStateAnimation(),this._doRender(!0),this.doPreProgressive(),Eg(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=Lk(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=Dk(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=Dk(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=Ok(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=Ok(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}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];_(s)?e[i]="disappear"===i?s.map((t=>{return"function"==typeof(e=t.callBack)&&/^class\s/.test(e.toString())?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:Fk,customParameters:{callBack:t.callBack}});var e})):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{Ik(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===Mk.appear))?Mk.appear:e.every((t=>t===Mk.disappear))?Mk.disappear:Mk.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===pk.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=e;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=i.parent,i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,u=p(l.modelUserId)?l.modelUserId:null,d=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:ok(o),markId:h,modelId:c,markUserId:d,modelUserId:u};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===pk.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===pk.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===pk.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===pk.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===pk.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this.releaseGrammar(!0),this._stage!==(null===(t=this._option)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{Ik(t,(t=>{t.removeProduct()}),null,!0)})):this._cachedMarks=Lk(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return Dg(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&function(t){return Yo(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Gi.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()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{Ik(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=Ap.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){Ap.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function Uk(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:Og)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function Hk(t){t.crosshair=G(t.crosshair||{}).map((e=>Zw({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function zk(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}=Me(l,i.width,i.height);a=t,o=e}else if(h&&Dg(e.mode)){let t;t=y(h)?Ap.getElementById(h):h;const{width:e,height:s}=Me(t,i.width,i.height);a=e,o=s}else if(jg(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 Vk(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function Wk(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}}var Gk,Yk,Xk,$k,Kk,qk;t.LayoutZIndex=void 0,(Gk=t.LayoutZIndex||(t.LayoutZIndex={}))[Gk.SeriesGroup=0]="SeriesGroup",Gk[Gk.Axis_Grid=50]="Axis_Grid",Gk[Gk.CrossHair_Grid=100]="CrossHair_Grid",Gk[Gk.Region=450]="Region",Gk[Gk.Mark=300]="Mark",Gk[Gk.Node=400]="Node",Gk[Gk.Axis=100]="Axis",Gk[Gk.MarkLine=500]="MarkLine",Gk[Gk.MarkArea=100]="MarkArea",Gk[Gk.MarkPoint=500]="MarkPoint",Gk[Gk.DataZoom=500]="DataZoom",Gk[Gk.ScrollBar=500]="ScrollBar",Gk[Gk.Player=500]="Player",Gk[Gk.Legend=500]="Legend",Gk[Gk.CrossHair=500]="CrossHair",Gk[Gk.Indicator=500]="Indicator",Gk[Gk.Title=500]="Title",Gk[Gk.Label=500]="Label",Gk[Gk.Brush=500]="Brush",Gk[Gk.CustomMark=500]="CustomMark",Gk[Gk.Interaction=700]="Interaction",t.LayoutLevel=void 0,(Yk=t.LayoutLevel||(t.LayoutLevel={}))[Yk.Indicator=10]="Indicator",Yk[Yk.Region=20]="Region",Yk[Yk.Axis=30]="Axis",Yk[Yk.DataZoom=40]="DataZoom",Yk[Yk.Player=40]="Player",Yk[Yk.ScrollBar=40]="ScrollBar",Yk[Yk.Legend=50]="Legend",Yk[Yk.Title=70]="Title",Yk[Yk.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(Xk=t.AttributeLevel||(t.AttributeLevel={}))[Xk.Default=0]="Default",Xk[Xk.Theme=1]="Theme",Xk[Xk.Chart=2]="Chart",Xk[Xk.Base_Series=3]="Base_Series",Xk[Xk.Series=4]="Series",Xk[Xk.Mark=5]="Mark",Xk[Xk.User_Chart=6]="User_Chart",Xk[Xk.User_Series=7]="User_Series",Xk[Xk.User_Mark=8]="User_Mark",Xk[Xk.User_SeriesStyle=9]="User_SeriesStyle",Xk[Xk.Built_In=99]="Built_In";class Zk{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){d(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,j({},Zk.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=G(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]))))}}Zk.defaultMarkInfo={};class Jk{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class Qk{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=>Zw({},i,s,t);return _(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 tC extends Jk{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}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=Qk,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new Zk,this._lastLayoutRect=null,this.id=Ug(),this.userId=t.id,this._spec=t,this.effect={},this.event=new hk(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){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}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){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_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){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${xT}_${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,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=Jw.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_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(!d(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}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class eC{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}get lastComputeRect(){return this._lastComputeRect}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}get willLayoutTag(){return this._willLayoutTag}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._willLayoutTag=!0,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){let a=Nw(Hw(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=d(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:jw(t.minHeight,e.height,e),this._maxHeight=d(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:jw(t.maxHeight,e.height,e),this._minWidth=d(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:jw(t.minWidth,e.width,e),this._maxWidth=d(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:jw(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:jw(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:jw(t.height,e.height,e)},{height:9}),d(t.offsetX)||(this.layoutOffsetX=jw(t.offsetX,e.width,e)),d(t.offsetY)||(this.layoutOffsetY=jw(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){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{d(this._spec[i])||(e[i]=jw(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};d(s)||(r.width-=s),d(n)||(r.width-=n),d(e)||(r.height-=e),d(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):(d(s)?d(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,d(e)?d(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 s,n,r,a;A(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),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?(d(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),d(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(d(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),d(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(Uw(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class iC extends tC{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,this._transformLayoutPadding=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 eC(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&z(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.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,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 sC extends Qk{_initTheme(t,e){return{spec:t,theme:this._theme}}}class nC extends iC{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=sC,this.modelType="region",this.specKey="region",this.type=nC.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,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"}_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,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),E(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[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.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex: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()}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,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return z(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||G(t.userId).includes(e.userId))&&(!p(t.specIndex)||G(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})}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=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function rC(t){const e=[],i=[],s=[];return t.forEach((t=>{d(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 aC(t,e,i){e?t.forEach((t=>{const e=Y(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=Y(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 oC(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 lC(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const u=[];let d=[];const p=[];t.forEach((t=>{const{rect:s}=dC(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&d.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),u.push(d),d=[t]):(a=Math.max(a,g),d.push(t))})),p.push(a),u.push(d),oC(u,!0,p,l),s&&aC(u,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function hC(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const u=[];t.forEach((t=>{const{rect:s}=dC(t,e,n),d=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=dC(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&d.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),u.push(d),d=[t]):(l=Math.max(l,n),d.push(t))})),p.push(l),u.push(d),oC(u,!1,p,o),s&&aC(u,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function uC(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const u=[];t.forEach((t=>{const{layoutTag:s,layoutRect:u,rect:d}=dC(t,e,n),p=d.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=d.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-d.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_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){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:u,relativeOverlapItems:d,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,u,d,g,o,l),this._processAutoIndent(c,u,d,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_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,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:u}=this._checkAutoIndent(n,r);(l||h||c||u)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-u,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=dC(t,this,e);"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,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=rC(t);n.length&&lC(n,e,i,!1,"left",s),r.length&&lC(r,e,i,!0,"left",s),a.length&&hC(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=rC(t);n.length&&cC(n,e,i,!1,"top",s),r.length&&cC(r,e,i,!0,"top",s),a.length&&uC(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=rC(t);n.length&&lC(n,e,i,!1,"right",s),r.length&&lC(r,e,i,!0,"right",s),a.length&&hC(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=rC(t);n.length&&cC(n,e,i,!1,"bottom",s),r.length&&cC(r,e,i,!0,"bottom",s),a.length&&uC(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=dC(t,this,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=>{z(i.getLayoutRect(),e.rect)||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{rect:i}=dC(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:u}=this._layoutRegionItem(t,l,h);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+c-l})}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+u-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&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:Og)("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}}}pC.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}($k||($k={})),t.STATE_VALUE_ENUM=void 0,(Kk=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",Kk.STATE_HOVER="hover",Kk.STATE_HOVER_REVERSE="hover_reverse",Kk.STATE_DIMENSION_HOVER="dimension_hover",Kk.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",Kk.STATE_SELECTED="selected",Kk.STATE_SELECTED_REVERSE="selected_reverse",Kk.STATE_SANKEY_EMPHASIS="selected",Kk.STATE_SANKEY_EMPHASIS_REVERSE="blur",Kk.STATE_HIGHLIGHT="highlight",Kk.STATE_BLUR="blur",Kk.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(qk||(qk={}));const gC=["linear","radial","conical"],fC={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const mC={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{mC[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class vC extends Jk{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(j(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class yC extends vC{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:{}})}))}_isMultiMark(){return!this._mark||(t=this._mark.type,Rk.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!mC[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(_(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(xT)));i=t.datums.some((t=>e&&_(null==t?void 0:t.items)?n.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])})):n.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(xT))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(qx(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class _C extends Jk{constructor(){super(...arguments),this.id=Ug(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=Jw.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class bC extends _C{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}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._data=null,this._data=e}removeProduct(){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const xC=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,SC=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=xC(l.delay,n,a,o),u=xC(l.duration,n,a,o),d=xC(l.oneByOne,n,a,o),p=xC(l.splitPath,n,a,o),g=A(d)&&d>0?t=>S(d)?t*d:!0===d?t*u: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)?ax:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:ox)(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);ix(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:u,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)?ax:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:ox)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Jb(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>tx(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:ys.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const u=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),d=e.animate(Object.assign({},i,{onEnd:r}));d.wait(u),d.play(new ex({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Xb,null!==(l=i.easing)&&void 0!==l?l:$b))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:ys.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new sx({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Xb,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:$b))}})(t,e[0],{delay:c,duration:u,easing:h,onEnd:s,individualDelay:g,splitPath:p}):ix(t[0],e[0],{delay:c,duration:u,easing:h,onEnd:s})},AC=(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))))},wC=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}};class TC extends _C{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}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){d(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];_(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=G(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=G(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new bC(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}d(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=sh("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){d(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(){this._product&&this._product.parent&&this._product.parent.removeChild(this._product),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new pn)),i&&(u(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==$k.enter&&t.context.diffState!==$k.update||(t.stateProxy=(e,i)=>{var s;return this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)},t.context.states&&t.useStates(t.context.states,e))},this.name=e,this.model=i.model,this.key=i.key,this.state=new yC(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_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,jt)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];d(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}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){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[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"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&Zw(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(Zx(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=Rw(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),e.clamp&&t.clamp&&t.clamp(e.clamp))}(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=u(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):gC.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):Zx(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=u(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_computeGradientAttr(t){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=t,c=e(t,["gradient","scale","field"]);let d=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(d=t),g||(g=e)}const f=Sw(xw(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},fC[o]),c);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==d?void 0:d.scale(t[g]);return u(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=Ae.SetOpacity(a,s)),{offset:u(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):u(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];u(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)gC.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=Sw(xw(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return Ok(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._graphics=t.getGraphics(),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear)}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return Jw.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=u(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[kT],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=Ok(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===Mk.appear))?Mk.appear:t.every((t=>t===Mk.disappear))?Mk.disappear:t[0];return null!=e?e:Mk.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{wC(t),s.push(...t.getGraphics())})),e.forEach((t=>{wC(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const u=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);SC([],e,i,u,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=AC(e,n),r=AC(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===Mk.exit?Mk.exit:i===Mk.update?Mk.update:Mk.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===$k.exit&&(t.context.reusing=!0,t.animates&&t.animates.forEach((t=>t.stop())))}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===$k.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,u,p,g;let f,m;return d(e)?(f=this._graphicMap.get(t),f&&(m=$k.exit)):d(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=$k.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=$k.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(u=f.context)||void 0===u?void 0:u.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=Mk.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=Mk.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return Pk(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=Pk(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(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||(!!u(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach(((t,e)=>{var i,n;let r=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i.update,t);null===(n=t.currentStates)||void 0===n||n.forEach((e=>{var i;const s=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i[e],t);r=Object.assign(Object.assign({},r),s)})),d(this._markConfig.interactive)||(r.pickable=this._markConfig.interactive);const a=this._transformGraphicAttributes(t,r,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=a}))}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r,a;const o=i.context.finalAttrs,l=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=lk(i,o);i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes({}),i.context.reusing=!1):l||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),!(null===(a=this.renderContext)||void 0===a?void 0:a.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i),e&&i.setFinalAttributes(o)}else{const a=i;i=this._createGraphic(o),e&&(null===(n=i.setFinalAttributes)||void 0===n||n.call(i,o)),i.context=a.context,i.context.diffAttrs=o,i.stateSort=this._stateSort;const l=this._graphics===t?s:s+this._graphics.length-t.length;if(l>=0&&(this._graphics[l]=i),null===(r=this.renderContext)||void 0===r?void 0:r.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,l),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(d(e)||(t.zIndex=e),d(i)||(t.clip=i),!d(s)){const e=_(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return d(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=Jw.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=Jw.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=G(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===Ek.before||(Eg(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{"in"===this.state.checkOneState(i,i.context.data,e)?i.addState(t,!0,this.hasAnimationByState("state")):i.removeState(t,this.hasAnimationByState("state"))}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===$k.exit&&!e.isExiting)if(e.context.animationState===$k.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:$k.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=sh({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}}var kC;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(kC||(kC={}));class CC extends TC{constructor(){super(...arguments),this.type=CC.type,this._marks=[],this._diffState=$k.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(Rg("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?(Rg("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))}getMarkInUserId(t){let e;return Ik(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.diffState===$k.update){const t=this.hasAnimation(),e=lk(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e)),t&&this._product.setFinalAttributes(i)}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=$k.update}render(){this._isCommited&&(Eg(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct()}}CC.type="group";const MC={measureText:bT};class BC{static instance(){return BC.instance_||(BC.instance_=new BC),BC.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 EC{constructor(){this.id=Ug(),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))?Rg("不要重复添加相同的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 RC extends EC{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)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const OC={type:"fadeIn"};function PC(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 OC;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const IC={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"},state:{duration:300,easing:"linear"}},LC={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},DC=()=>{Jw.registerAnimation("scaleInOut",(()=>LC))},FC=(t,e)=>({appear:PC(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:lx,duration:IC.update.duration,easing:IC.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),jC=()=>{Jw.registerAnimation("line",FC)},NC=()=>{Hb.registerBuiltInAnimate("growPointsIn",Tx),Hb.registerBuiltInAnimate("growPointsOut",kx),Hb.registerBuiltInAnimate("growPointsXIn",Mx),Hb.registerBuiltInAnimate("growPointsXOut",Bx),Hb.registerBuiltInAnimate("growPointsYIn",Rx),Hb.registerBuiltInAnimate("growPointsYOut",Ox),Hb.registerBuiltInAnimate("clipIn",ux),Hb.registerBuiltInAnimate("clipOut",dx)},UC=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class HC{constructor(t){this._markSet=new Zk,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){_(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.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 zC={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class VC extends HC{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},zC,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}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}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll(e)}}VC.type="element-highlight",VC.defaultOptions=zC;const WC=()=>{Jw.registerInteractionTrigger(VC.type,VC)},GC={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class YC extends HC{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},GC,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=G(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):y(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&&(_(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),t.addState(i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll(e)}}YC.type="element-select",YC.defaultOptions=GC;const XC=()=>{Jw.registerInteractionTrigger(YC.type,YC)};class $C extends EC{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class KC{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>Jw.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>Jw.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>Jw.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return Jw.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>Jw.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){Jw.registerTransform(t,e)}static registerFunction(t,e){t&&e&&BC.instance().registerFunction(t,e)}static unregisterFunction(t){t&&BC.instance().unregisterFunction(t)}static getFunction(t){return t?BC.instance().getFunction(t):null}static getFunctionList(){return BC.instance().getFunctionNameList()}static registerMap(t,e,i){const s=Jw.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=Jw.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,xk.get(e);var e}static registerSVG(t,e,i){const s=Jw.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=Jw.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){dT.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}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,u,d;this.id=Ug(),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._renderState=jk.render,this._disableDimensionHoverEvent=!1,this._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))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;z(n.theme,this._spec.theme)?z(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=Vk(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?Jw.getSeriesBuiltInTheme(e):Jw.getComponentBuiltInTheme(e);i=i?Zw({},s,i[e]):s}s===t.length-1&&p(i)&&(i=mT({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},gw(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:_,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=Dg(v);if(S?$f(Vi):"node"===v&&Rv(Vi),S&&f&&(this._container=y(f)?Ap.getElementById(f):f),m&&(this._canvas=m),_&&(this._stage=_),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=pT.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[];!1!==b&&A.push("poptipForText"),"sankey"===i.type&&A.push("scrollbar");const w=new it(null!==(a=this._option.logLevel)&&void 0!==a?a:et.Error);it.setInstance(w),(null===(o=this._option)||void 0===o?void 0:o.onError)&&w.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._compiler=new Nk({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:_,pluginList:A},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new yk(this,this._compiler),this._event=new hk(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),dT.registerInstance(this),null===(d=null===(u=this._option.performanceHook)||void 0===u?void 0:u.afterCreateVChart)||void 0===d||d.call(u,this)}_setNewSpec(t,e){return!!t&&(y(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=Zw({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=vT(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;KC.getFunctionList()&&KC.getFunctionList().length&&(t=yT(t,KC)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=Jw.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=Jw.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=Jw.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._chartSpecTransformer),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)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=ft(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.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 zk(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:ST,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:AT})}_initDataSet(t){this._dataSet=t instanceof si?t:new si,bk(this._dataSet,"dataview",ti),bk(this._dataSet,"array",s),_k(this._dataSet,"copyDataView",Ak);for(const t in Jw.transforms)_k(this._dataSet,t,Jw.transforms[t]);for(const t in Jw.dataParser)bk(this._dataSet,t,Jw.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return u(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake?(null===(n=this._compiler)||void 0===n||n.releaseGrammar(),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.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.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),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),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(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"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?Mk.none:Mk.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}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._cachedProcessedTheme=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,dT.unregisterInstance(this)}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):_(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=G(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._reSetRenderState(),d(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=G(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=G(this._spec.data);return G(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof ni?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=Tk(t,this._dataSet,s);_(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(y(e)&&(e=JSON.parse(e)),u(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(_(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?Zw({},t[n][e.index],i):i):t[n]=s?Zw({},t[n],i):i);else if(_(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?Zw({},t[n][r],i):i)}else t.id===e&&(t[n]=s?Zw({},t[n],i):i)}))}(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=Zw({},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),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,this),!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)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=Qw({},e,e.chart[t])),e};let l;if(E(n)&&E(r))l=gT(this._currentThemeName),this._currentTheme=o(a,l);else if(y(n)&&(!r||y(r))||y(r)&&(!n||y(n))){const t=Qw({},gT(this._currentThemeName),gT(n),gT(r));this._currentTheme=o(a,t)}else{const t=Qw({},gT(this._currentThemeName),gT(n),gT(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),j(Z_.poptip,q_,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;d(this._spec.width)?!d(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),d(this._spec.height)?!d(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!Dg(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return gT(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!pT.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),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}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield Uk(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(!Dg(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;this._chart.resetLayoutItemTag(),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)?Ap.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)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(E(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?zw(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||d(t)||E(e))return null;if(!_(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 Rg("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?zw(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Rg("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return BC.instance().getFunction(t)}registerFunction(t,e){t&&e&&BC.instance().registerFunction(t,e)}unregisterFunction(t){t&&BC.instance().unregisterFunction(t)}getFunctionList(){return BC.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=Jw.getChartPlugins();t.length>0&&(this._chartPlugin=new RC(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=Jw.getVChartPlugins();e.length>0&&(this._vChartPlugin=new $C(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_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,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=jk.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){this._renderState=jk.render,this.getStage().eventSystem.resumeTriggerEvent()}}KC.InstanceManager=dT,KC.ThemeManager=pT,KC.globalConfig={uniqueTooltip:!0},KC.Utils=MC,KC.vglobal=Ap;Jw.registerRegion("region",nC),Jw.registerLayout("base",pC),m_(),n_(),Jw.registerMark(CC.type,CC),Jw.registerStageEventPlugin("gesture",vf),WC(),XC(),oT(Kw.name,Kw);const qC="monotone",ZC="linear",JC="bevel";function QC(t,e){return e("component",t)}function tM(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=Jw.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));const eM=(t,e,i,s)=>{if(d(t[e]))return;const n=_(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},iM=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},sM=(t,e,i,s)=>{let n;if(n=u(t)?t(e,i):m(t)&&p(t.field)?R(e,t.field):t,s){const{formatFunc:i,args:r}=tM(void 0,s,t,e);i&&r&&(n=i(...r))}return n},nM=(t,e,i)=>d(t)?t:u(t)?t(e,i):t;const rM=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(_(e.activeType)?e.activeType.includes(t):e.activeType===t)));function aM(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=d(i.key)&&d(i.value)&&!E(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:u,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:y}=l,_=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=lM(sM(h,r,a,c),u,g),o.value=lM(sM(f,r,a,m),v,y),Object.keys(_).forEach((t=>{o[t]=sM(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};_(i)?i.forEach((t=>{o(t)})):o(i)}function oM(t,e,i,s,n,r,a){if(u(e)){aM(t,e(n,a),i,s,r,a)}else e&&aM(t,e,i,s,r,a)}const lM=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=Be.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class hM{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?G(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 G(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.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,u,d,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(u=m.shapeStroke)&&void 0!==u?u:this.shapeStrokeCallback,shapeHollow:null!==(d=m.shapeHollow)&&void 0!==d&&d,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{_(t)?t.forEach((t=>{oM(a,t,e,i,s,n,r)})):u(t)?oM(a,t,e,i,s,n,r):t&&aM(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=u(e)?e(s,n):e;if(r?d(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){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}(s),e={visible:sM(r.visible,t,n),value:lM(sM(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:sM(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=sM(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&rM(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const cM={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}},uM=(t,e)=>{var i,s;let n=e.fields;if(u(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=$T([],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 dM(a,n,o)},dM=(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&&t.forEach((t=>{t&&n.push(t[a])}));const u=n.length;if(h){r.length=0,n.forEach(((t,e)=>{Hg(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===u}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{Hg(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&&!0===o.lockStatisticsByDomain&&!d(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=cM[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},pM=(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=>{Hg(t[e])||(t[e]=0)}))})),t};function gM(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function fM(t,e,i){t&&(i.needDefaultSeriesField&&(t[CT]=i.defaultSeriesField),t[TT]=e,t[kT]=i.getKey(t,e,i))}const mM={label:{name:"label",type:"text"}},vM=`${xT}_rect_x`,yM=`${xT}_rect_x1`,_M=`${xT}_rect_y`,bM=`${xT}_rect_y1`,xM={data:!0},SM={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},AM=[...Object.keys(IC),"normal"];function wM(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=_(a)?a.map(((t,e)=>{var s;let n=t;return BM(n)&&delete n.type,n.oneByOne&&(n=kM(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:CM,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=Zw({},o[e],a);return BM(n)&&delete n.type,n.oneByOne&&(n=kM(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:CM,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function TM(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=I(t,null,i),EM(t,(t=>{var i;if(u(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function kM(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=u(n)?n(t,i,a):A(n)?n:0,h=u(r)?r(t,i,a):A(r)?r:0;let c=u(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=u(n)?n(t,r,o):A(n)?n:0,c=u(a)?a(t,r,o):A(a)?a:0;let d=u(s)?s(t,r,o):s;if(!1===d)return c;return d=!0===d?0:d,c+((i?i():r.parent.count-1)-l)*(h+d)},delete t.oneByOne,t}function CM(t,e){var i;return null!==(i=null==t?void 0:t[TT])&&void 0!==i?i:e.context.graphicIndex}function MM(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 BM(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function EM(t,e,i=[]){if(_(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),EM(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),EM(t[s],e,i))}function RM(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class OM extends Qk{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=G(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=yw(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=Jw.getSeriesMarkMap(o)?function(t,e,i){const s=Jw.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=Zw({},i("mark",G(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return Zw({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_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),d(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;G(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:d=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(u(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&d)&&f,animationExit:!!(v&&f&&p)&&m,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=Zw({},i,s,t),n=i.label;return n&&g(n)&&_(e.label)&&(e.label=e.label.map((t=>Zw({},n,t)))),e};return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class PM extends tC{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)}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:`${xT}_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(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=OM,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=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.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=RM(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),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 d(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)&&(_k(this._rawData.dataSet,"invalidTravel",pM),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;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=Tk(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=wk(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=wk(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new bC(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(d(this._rawStatisticsCache[t].min)||d(this._rawStatisticsCache[t].max))||!e&&d(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=$(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=dM(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=j(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){_k(this._dataSet,"dimensionStatistics",uM);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new ni(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&&$T(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){_k(this._dataSet,"dimensionStatistics",uM);const s=new ni(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=$T(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&$T(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new ni(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 d(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)}`)}:y(t)?e=>e[t]:_(t)&&t.every((t=>y(t)))?e=>t.map((t=>e[t])).join("-"):u(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)&&(_k(this._rawData.dataSet,"addVChartProperty",iM),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:gM.bind(this),call:fM}},!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||d(e)?null:t[e]}getDatumPositionValues(t,e){return!t||d(e)?[]:y(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;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.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(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:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=wM({},TM(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)}))),!d(t.dataId)||!d(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(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:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_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"}}:Fg(s)||jg(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=Zw(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=Zw(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=UC(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=UC(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=UC(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:CT;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:MT,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,MT,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.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()}initTooltip(){this._tooltipHelper=new hM(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||e.visible!==t[i].visible))?i.reMake=!0:!i.reCompile&&e.some(((e,i)=>!z(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!z(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},xM),SM),i),{extensionMark:!0,label:!0,totalLabel:!0});return this._compareExtensionMarksSpec(G(t.extensionMark),G(e.extensionMark),s),!s.reMake&&this._compareLabelSpec(G(t.label),G(e.label),s),!s.reMake&&this._compareLabelSpec(G(t.totalLabel),G(e.totalLabel),s),s.reMake?s:(!s.reCompile&&this._marks.getMarks().some((i=>{var s,n;return r[i.name]=!0,(null===(s=e[i.name])||void 0===s?void 0:s.visible)!==(null===(n=t[i.name])||void 0===n?void 0:n.visible)}))&&(s.reCompile=!0),!s.reCompile&&n.some((i=>SM[i]&&!z(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!z(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof ni||kk(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.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();RM(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),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,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:CT,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new Bw).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return xw(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:CT}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:u={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:y=!1}=e,_=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:y,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(_)){const e=this.getSpec()||{};this._marks.addMark(_,{name:t.name}),v&&(this._seriesMark=_),d(f)?_.setData(this._data):!1!==f&&_.setDataView(f),_.setSkipBeforeLayouted(!1!==c),d(h)||_.setGroupKey(h);const l=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:null!==(s=i.morph)&&void 0!==s&&s,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(n=i.support3d)&&void 0!==n?n:e.support3d||!!e.zField,morphKey:(null===(r=e.morph)||void 0===r?void 0:r.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});_.setMarkConfig(l),this.initMarkStyleWithSpec(_,Zw({},u,g||e[_.name]))}return _}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:kT}_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!==RT&&t!==PT&&t!==ET&&t!==OT||(t=this.getStackValueField()),null!==(e=qT(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>Hg(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:CT]}}function IM(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();qx(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 LM(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}}}PM.mark=mM,PM.transformerConstructor=OM;class DM extends PM{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=G(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=G(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&G(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);qx(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:`${xT}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?G(this._spec.xField)[0]:G(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(RT),this.setFieldX2(ET)):(this.setFieldY(RT),this.setFieldY2(ET))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(PT),this.setFieldX2(OT)):(this.setFieldY(PT),this.setFieldY2(OT))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(LT),this.setFieldX2(IT)):(this.setFieldY(LT),this.setFieldY2(IT))}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=G(this._spec.xField),this._specYField=G(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(G(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(G(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)&&(IM("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)}}function FM(t){return"bottom"===t||"top"===t}function jM(t){return"left"===t||"right"===t}function NM(t){return"z"===t}function UM(t,e){return Lw(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function HM(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?FM(t)?"linear":"band":FM(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const zM=(t,e,i)=>{var s;const n=null!==(s="band"===e?QC("axisBand",i):["linear","log","symlog"].includes(e)?QC("axisLinear",i):{})&&void 0!==s?s:{},r=FM(t)?QC("axisX",i):jM(t)?QC("axisY",i):QC("axisZ",i);return Zw({},QC("axis",i),n,r)};class VM{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:Og)("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:Og)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;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)))),r=n.filter((t=>Jx(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return FM(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class WM extends VM{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(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:pk.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const GM=(t,e)=>{var i,s;return t===e||!d(t)&&!d(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))},YM=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return A(s)?[-s,s]:s},XM=(t,e,i,s)=>{var n;const r=e.getScale(),a=Jx(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=G(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.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))})),o.push({series:h,datum:e,key:$M(h,s)})}else if(p(i[1])){const e=[],s=[];l.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 r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{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("_")}`,KM=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(G(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};class qM extends VM{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!GM(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:pk.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:pk.canvas}),callback:this.onMouseOut}),Fg(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:pk.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Fg(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var ZM;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(ZM||(ZM={}));const JM={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class QM{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",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.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(JM.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),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:JC,curveType:ZC,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===qC?"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){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(JM.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:MM(this._spec,JM.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new ni(this._option.dataSet,{name:`${xT}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),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(ZM.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[JM.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(ZM.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,Zw({},this._spec[JM.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.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=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},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.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const tB=Object.assign(Object.assign({},mM),JM),eB=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(y(t))return!1;if(_(t))return t.length===e.length&&t.every(((t,i)=>eB(t,e[i])));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]))},iB=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class sB extends TC{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return iB}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(d(o)||s.includes(a))return;r&&n.includes(a)&&(Zx(null==o?void 0:o.type)||(null==o?void 0:o.scale)||u(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!d(t)||!d(e))||!d(t)&&!d(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?eB(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,d(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n,r;const a=e.context.data,o=[],l=[],h={},c=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,u=c&&0===c.currentIndex;if(a.forEach(((e,i)=>{var s;l[i]={},o[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?l[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!c?o[i][s]=t[s](e):0!==i||c&&!u||(h[s]=t[s](e))})),l[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),c){const t=null!==(r=null===(n=e.attribute)||void 0===n?void 0:n.segments)&&void 0!==r?r:[];return t.push({points:l}),u?Object.assign(Object.assign({},h),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(o,l);if(t)return Object.assign(Object.assign(Object.assign({},h),o[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},h),o[0]),{points:l,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:$k.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[kT]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}class nB extends sB{constructor(){super(...arguments),this.type=nB.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)===mw.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}nB.type="line";const rB=()=>{Jw.registerMark(nB.type,nB),m_(),a_(),LA(),EA(),NC(),Jw.registerGraphicComponent("line",Zh)};class aB extends TC{constructor(){super(...arguments),this.type=aB.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="circle":a.symbolType=o,a}}aB.type="symbol";const oB=()=>{Jw.registerMark(aB.type,aB),m_(),y_(),EA(),Jw.registerGraphicComponent("symbol",$h)};class lB extends OM{_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)}}function hB(t){return t.length>=2&&A(t[0])&&A(Y(t))&&Y(t)>=t[0]}function cB(t,e){var i;const s=Y(e)-e[0],n=Y(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=Y(e)>0?Y(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!A(o.min),extendable_max:!A(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):Y(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function uB(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:u}=e;if(o>0){if(!h)return!1;let t=s/i;r&&(t=s/Math.max(i,o),a[1]=-a[0]/t),u[0]=-u[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),u[1]=-u[0]*t}return!0}function dB(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 pB(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 gB(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 fB=(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=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const u=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==u?void 0:u.length))return t;const d=o.getScale();if(!d)return t;const p=d.domain(),g=Y(p)-p[0];if(0===g)return t;const f=c.domain(),m=Y(f)-f[0];if(0===g)return t;const v=u.map((t=>function(t,e,i,s,n){const r=Lt(t,e),a=Math.max(It(i),It(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return Gx(v)};class mB{constructor(t){this.id=Ug(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class vB extends mB{constructor(){super(vB.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!qx(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],u=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&u&&hB(c)&&hB(u)))return;const d=cB(t,c),p=cB(e,u);if(!0===d.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:y}=d,{positive:_,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!dB(d,p))return}else if(0===_&&0===b){if(!dB(p,d))return}else if(y||A)if(y&&!A){if(!uB(d,p))return}else if(A&&!y){if(!uB(p,d))return}else{if(f===b)return;if(f>b){if(!pB(d,p))return}else if(!pB(p,d))return}else{if(0===f&&0===_){if(!gB(d,p))return}else if(0===b&&0===g&&!gB(p,d))return;if(0===f&&0===b)if(0===c[0]&&u[0]>0){if(!x)return;u[0]=0}else{if(!(0===u[0]&&c[0]>0))return;if(!m)return;c[0]=0}if(0===g&&0===_)if(0===c[1]&&u[1]>0){if(!S)return;u[1]=0}else{if(!(0===u[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(u)})(n,i)}))}onDidCompile(t,e){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){_k(e.getOption().dataSet,"tickAlign",fB);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}vB.pluginType="component",vB.type="AxisSyncPlugin";const yB={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function _B(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 bB(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const xB=t=>"band"===t||"ordinal"===t||"point"===t;function SB(t,e){return{id:t,label:t,value:e,rawValue:t}}function AB(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class wB extends EC{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const TB=`${xT}_ARC_TRANSFORM_VALUE`,kB=`${xT}_ARC_RATIO`,CB=`${xT}_ARC_START_ANGLE`,MB=`${xT}_ARC_END_ANGLE`,BB=`${xT}_ARC_K`,EB=`${xT}_ARC_MIDDLE_ANGLE`,RB=`${xT}_ARC_QUADRANT`,OB=`${xT}_ARC_RADIAN`,PB=-Math.PI/2,IB=3*Math.PI/2,LB=(t,e,i)=>{var s;const n=null!==(s="band"===e?QC("axisBand",i):"linear"===e?QC("axisLinear",i):{})&&void 0!==s?s:{},r=QC("angle"===t?"axisAngle":"axisRadius",i);return Zw({},QC("axis",i),n,r)};function DB(t,e,i,s){switch(t){case r.cartesianBandAxis:return zM(UM(i,["z"]),"band",e);case r.cartesianLinearAxis:return zM(UM(i,["z"]),"linear",e);case r.cartesianLogAxis:return zM(UM(i,["z"]),"log",e);case r.cartesianSymlogAxis:return zM(UM(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return zM(UM(i),void 0,e);case r.polarBandAxis:return LB(i.orient,"band",e);case r.polarLinearAxis:return LB(i.orient,"linear",e);case r.polarAxis:return LB(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:u}=null!==(s=QC(r.crosshair,t))&&void 0!==s?s:{},d=n.find((t=>FM(t.orient)));let g;g=p(d)?Zw({},xB(d.type)?a:o,l):l;const f=n.find((t=>jM(t.orient)));let m;return m=p(f)?Zw({},Jx(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:u}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:u}=null!==(s=QC(r.crosshair,t))&&void 0!==s?s:{},d=n.find((t=>"angle"===t.orient));let g;g=p(d)?Zw({},xB(d.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?Zw({},Jx(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:u}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return FB(i,QC(t,e));default:return QC(t,e)}}const FB=(t,e)=>{var i;const s=e[function(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}(null!==(i=t.orient)&&void 0!==i?i:e.orient)],n=Zw({},e,s);return delete n.horizontal,delete n.vertical,n};class jB extends Qk{getTheme(t,e){return DB(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({},Hw(e)),{[s]:0}))}}class NB extends iC{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=jB,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof la||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:pk.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}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 wB(this)}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)))}_getNeedClearVRenderComponents(){return[]}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=>!z(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&&(t.release(!0),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=>{e.compile({group:t,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}}getDatum(t){}}var UB,HB;NB.transformerConstructor=jB,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(UB||(UB={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(HB||(HB={}));class zB extends TC{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}clearComponent(){this._component&&(this._component.parent&&this._component.parent.removeChild(this._component),this._component=null)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=Jw.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(ck.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){super.release(),this.removeProduct()}}zB.type="component";const VB=()=>{Jw.registerMark(zB.type,zB)},WB=t=>t;class GB extends NB{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._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,u,d,g,f,m,v,y,_,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?UB.circleAxis:UB.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?HB.circleAxisGrid:HB.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if((null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=wM(null===(h=Jw.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(u=null!==(c=this._spec.animationAppear)&&void 0!==c?c:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(y=null!==(v=this._spec.animationExit)&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==y?y:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b: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()),e=new bC(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return dw(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=_(a)?qx(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!qx(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return dw(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:s}=this._spec;p(t)&&(this._seriesUserId=G(t)),p(i)&&(this._regionUserId=G(i)),p(e)&&(this._seriesIndex=G(e)),p(s)&&(this._regionIndex=G(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=function(t,e){const i=[];for(const s of t)for(const t of s.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()})),dw(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(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&z(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):dw(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(dw(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_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=sk(s=t.domainLine)).startSymbol=sk(s.startSymbol),s.endSymbol=sk(s.endSymbol),s):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=u(t.label.style)?(e,i,s,n)=>{var r;const a=t.label.style(e.rawValue,i,e,s,n);return rk(Zw({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:rk(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{u(t[i])?e[i]=(e,s,n,r)=>rk(t[i](e.rawValue,s,e,n,r)):E(t[i])||(e[i]=rk(t[i]))})),e}(t.label.state)),u(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}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:u(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},t.tick.style&&(i.tick.style=u(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return rk(Zw({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:rk(t.tick.style)),t.tick.state&&(i.tick.state=nk(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=u(t.subTick.style)?(e,i,s,n)=>{var r;const a=t.subTick.style(e,i,s,n);return rk(Zw({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:rk(t.subTick.style)),t.subTick.state&&(i.subTick.state=nk(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 u,p=r;"left"!==t.orient&&"right"!==t.orient||n&&d(p)&&(p="left"===t.orient?-90:90,u=yB[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?jt(p):null,textStyle:Zw({},u,rk(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:rk(h.style)}),h.state&&(i.title.state.shape=nk(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:rk(o.style)}),o.state&&(i.title.state.background=nk(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=nk(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=rk(t.background.style)),t.background.state&&(i.panel.state=nk(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:_T(t.grid.alternateColor),alignWithLabel:t.grid.alignWithLabel,style:u(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 rk(Zw({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:rk(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:_T(t.subGrid.alternateColor),style:rk(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=tM(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){bk(this._option.dataSet,"scale",WB);const i=this.registerTicksTransform();return new ni(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,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)}getDatum(t){var e;return t&&t.name===ib.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}GB.specKey="axes";const YB=()=>{VB(),Jw.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},XB=[vB];class $B extends GB{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}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),dw(this._regions,(t=>{const e=this.getOrient();FM(e)?AB(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):jM(e)?AB(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):NM(e)&&AB(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&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._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=Zw({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(Zw({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=FM(this.getOrient()),n=t=>{var e;return(s?!FM(t.getOrient()):FM(t.getOrient()))&&qx(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&&Y(t.getScale().domain())>=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,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=UM(i,["z"]),NM(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(!_(e)){if(!bB(e))return null;const{axisType:t,componentName:s}=HM(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=>jM(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(!bB(t))return;const{axisType:s,componentName:n}=HM(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=Jw.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}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return FM(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):NM(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):A(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(XB.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){FM(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&&!FM(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!NM(this.getOrient())&&this._spec.innerOffset){const t=this._spec;jM(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=jw(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=jw(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=FM(this.getOrient())?t.fieldX:NM(this.getOrient())?t.fieldZ:t.fieldY,qx(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;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,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:qx(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 t;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(ck.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(FM(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._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=FM(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)}))}collectScale(){const t=[];return dw(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]:FM(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:NM(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();dw(this._regions,(e=>{FM(t)?AB(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):jM(t)?AB(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):NM(t)&&AB(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(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=FM(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 s={skipLayout:!1},n=FM(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)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=Zw(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new le).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=FM(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?ct(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):ct(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-Y(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&d(null===(e=a.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=a.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 o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return SB(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:qx(this._scale.type)?i>=s[0]&&i<=Y(s):s.includes(i)}))]:[]}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 i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}$B.type=r.cartesianAxis,$B.specKey="axes";const KB=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function qB(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,JB=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function QB(t,e,i="count"){const s=JB(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const tE=Math.sqrt(50),eE=Math.sqrt(10),iE=Math.sqrt(2);class sE{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){p(this._spec.nice)&&(this._nice=this._spec.nice),p(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=_B(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(A(i.forceTickCount))e=i.forceTickCount;else if(u(i.tickCount)){const t=this._scale.range();let s=Math.abs(Y(t)-t[0]);if(1===s&&this._option){s=FM(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=A(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return d(s)&&d(n)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&d(n)&&d(this._softMaxValue)?this._scale.niceMax(e):!(!d(s)||!d(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return d(e)&&d(i)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&d(i)&&d(this._softMaxValue)?this._scale.niceMax():!(!d(e)||!d(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=d(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(ZB),e.sort(ZB),{domain:qB(t,e),scope:QB(t,e,i)}}(r,Bg(t),this._spec.breaks[0].scopeType);e=Bg(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=Y(t);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}=_B(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[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=tE?10:n>=eE?5:n>=iE?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(Y(t),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=Y(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}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(Y(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>A(+t)?Math.round(+t*s)/s:t}_updateRawDomain(){const e=this.collectData(0,!0),i=this.computeLinearDomain(e);this._rawDomain=i,this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}const nE={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},rE={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}}},aE={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}}},oE={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}}};class lE extends $B{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new US}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}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)}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!NM(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=FM(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=Dw(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=A(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=Bg(this._break.scope).map((t=>i[0]+(Y(i)-i[0])*t))),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}registerTicksTransform(){const t=`${this.type}-ticks`;return _k(this._option.dataSet,t,KS),t}}lE.type=r.cartesianLinearAxis,lE.specKey="axes",lE.builtInTheme={axis:oE,axisLinear:nE,axisX:rE,axisY:aE},W(lE,sE);const hE=()=>{Jw.registerGraphicComponent(UB.lineAxis,((t,e)=>new Wx(t,e))),Jw.registerGraphicComponent(HB.lineAxisGrid,((t,e)=>new WA(t,e))),YB(),Jw.registerComponent(lE.type,lE)};class cE extends $B{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new _S}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}}registerTicksTransform(){const t=`${this.type}-ticks`;return _k(this._option.dataSet,t,tA),t}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=cS(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(),u=e=>{const i=t===n?a:0;if(d(r)||t1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new bC(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{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._spec.showAllGroupLayers?this._scales:[this._scales[0]]).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=G(e).concat(i);if(n.push(r),o){const e=SB(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=>SB(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const e=this._spec.domain;for(let t=0;tthis._rawDomainIndex[t][e]=i))}this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}});const uE=()=>{Jw.registerGraphicComponent(UB.lineAxis,((t,e)=>new Wx(t,e))),Jw.registerGraphicComponent(HB.lineAxisGrid,((t,e)=>new WA(t,e))),YB(),Jw.registerComponent(cE.type,cE,!1)};class dE extends lE{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),dw(this._regions,(t=>{FM(this.getOrient())?AB(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):AB(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=Zw({},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 ni(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.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 bC(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=Be.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,u=(null===(r=null===(n=this._spec.layers)||void 0===n?void 0:n[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",d="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?d(u,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=>SB(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=>SB(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return _k(this._option.dataSet,t,KS),t}transformScaleDomain(){}}dE.type=r.cartesianTimeAxis,dE.specKey="axes",dE.builtInTheme={axis:oE,axisX:rE,axisY:aE};class pE extends lE{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new WS}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return _k(this._option.dataSet,t,KS),t}transformScaleDomain(){}}pE.type=r.cartesianLogAxis,pE.specKey="axes",pE.builtInTheme={axis:oE,axisLinear:nE,axisX:rE,axisY:aE},W(pE,sE);class gE extends lE{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new GS}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return _k(this._option.dataSet,t,KS),t}transformScaleDomain(){}}gE.type=r.cartesianSymlogAxis,gE.specKey="axes",gE.builtInTheme={axis:oE,axisLinear:nE,axisX:rE,axisY:aE},W(gE,sE);const fE=`${xT}_hide_`;function mE(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const vE=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[fE]&&(mE(t,!0),t[fE]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=d(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[fE]=!0,mE(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=d(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},yE=()=>{Jw.registerGrammarTransform("symbolOverlap",{transform:vE,runType:"afterEncode"})},_E={min:$,max:X,average:function(t,e){let i=0,s=0;return t.forEach((t=>{const n=e?+t[e]:+t;A(n)&&(i+=n,s++)})),i/s},sum:hw};function bE(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,u=0;r[u++]=c;for(let t=1;to&&(o=l,h=t))}r[u++]=h,c=h}r[u-1]!==a-1&&(r[u++]=a-1);return r.map((t=>i?e[t].i:t))}function xE(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 SE(t,e,i,s){return xE(t,e,i,"min",s)}function AE(t,e,i,s){return xE(t,e,i,"max",s)}function wE(t,e,i,s){return xE(t,e,i,"average",s)}function TE(t,e,i,s){return xE(t,e,i,"sum",s)}const kE=(t,e)=>{let i=u(t.size)?t.size():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=bE;if("min"===n?l=SE:"max"===n?l=AE:"average"===n?l=wE:"sum"===n&&(l=TE),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[]},CE=()=>{Jw.registerGrammarTransform("dataSampling",{transform:kE})};class ME extends DM{constructor(){super(...arguments),this.type=mw.line,this.transformerConstructor=lB,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.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(wM(null===(i=Jw.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),TM("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=LM(this);this._symbolMark.setAnimationConfig(wM(null===(s=Jw.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),TM("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),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]}}ME.type=mw.line,ME.mark=tB,ME.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},ME.transformerConstructor=lB,W(ME,QM);class BE{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=G(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{kk(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof ni)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];Rg(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];Rg(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class EE{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)=>{zg(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{$T(e,[{key:t,operations:qx(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&&$T(e,[{key:i.field,operations:qx(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?Rw("colorOrdinal"):Rw(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(zg(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),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(z(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;if(!z(r.specified,s.specified))return e.reMake=!0,e;s.range&&!z(s.range,n.range())&&(n.range(s.range),e.reRender=!0),zg(s.domain)?e.reRender=!0:z(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(!zg(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=qx(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=qx(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(d(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),d(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;qx(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(d(t.changeDomain)||"none"===t.changeDomain||d(t.seriesId))return void(qx(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=qx(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!E(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)));qx(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(d(t.field)||!d(t.changeDomain)&&"none"!==t.changeDomain&&!d(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class RE{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&t.addState(i,!0,l):a&&t.addState(s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&t.addState(i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{t.removeState(i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&t.removeState(e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}class OE extends Jk{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){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=Ug(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:ST,height:AT},this._viewRect={width:ST,height:AT},this._viewBox={x1:0,y1:0,x2:ST,y2:AT},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)=>G(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=Hw(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new hk(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new BE(this._dataSet),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===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new RE;const t=this.getAllSeries(),e=[],i={};t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=`${n}-${t.type}`;i[r]?s.forEach((t=>{i[r].marks.push(t)})):(i[r]=Object.assign(Object.assign({},t),{marks:s}),e.push(i[r]))}))}})),e.forEach((t=>{const e=Jw.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(wM({},TM("stage",this._spec,{}),null))}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.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=N(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=Jw.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({},i),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_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(y(t))return this.getAllModels().find((e=>e.userId===t));if(u(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){const s=Jw.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"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(){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e,this._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof tC)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 TC))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof TC)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}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){G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&kk(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=zk(this._spec,this._option,{width:ST,height:AT})),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(_(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),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=xw(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new EE(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){Vk(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=xw(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0};return Object.keys(t).filter((t=>!e[t])).sort()}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=this._getSpecKeys(this._spec);if(!z(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{Vk(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[r.title]:!0,[r.brush]:!0,[r.indicator]:!0};this._components.forEach((s=>{var n,a;if(s.type===r.label||s.type===r.totalLabel)return;i[s.type]&&(i[s.type]=!1);const o=s.specKey||s.type,l=null!==(n=this._spec[o])&&void 0!==n?n:{};_(l)?(e[o]=e[o]||{specCount:l.length,componentCount:0},e[o].componentCount++,Vk(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):Vk(t,s.updateSpec(l))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}const s=t=>t&&!1!==t.visible;Object.keys(i).forEach((e=>{if(i[e]){const i=this._spec[e];(_(i)?i.some(s):s(i))&&(t.reMake=!0)}}))}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];Vk(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=Nw(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.resetLayoutItemTag(),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(){this._backgroundMark&&this._backgroundMark.compile()}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._option.globalInstance),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,this._option.globalInstance)}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._option.globalInstance),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,this._option.globalInstance)}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._option.globalInstance),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,this._option.globalInstance)}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(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(E(t[s]))continue;const n=t[s];let r={stateValue:s};r=u(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(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(ck.AFTER_MARK_RENDER_END,e)};this._event.on(ck.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?G(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:ok;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||u(e.filter)&&e.filter(o,l))){if(ak(l.type))h.filter((h=>{const c=r(h,l,o,i),u=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));u&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),u=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));u>=0&&(c.splice(u,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===ZM.dimensionHover||s===ZM.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=d(t)||!n||n.every((t=>Jx(t.axis.getScale().type)&&d(t.index))),o=a||n.every((t=>Jx(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(n))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(r.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(r.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),n=[];s.forEach((e=>{const i=t(e);!1!==i&&n.push({axis:e,value:i})})),i.showCrosshair(n)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const PE=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=G(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return G(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)};class IE{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)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),u=Object.assign(Object.assign({},s),c);e?u.theme=h.getTheme(r,t):qw(t,a,c.spec),qw(n,null!=o?o:a,u)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));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=PE(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=PE(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=G(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return G(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,e,i){var s,n,r,a,o;const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,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},h=this.seriesType;return h&&(l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(Jw.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(Jw.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=Jw.getComponents();let h,c,u,d;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=Jw.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=Jw.getComponentInKey(t.type);o.push(e(s,t,i))})))}return u&&!g&&(null===(n=u.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(u,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):eM(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),d&&(null===(a=eM(t,d.specKey,d.type))||void 0===a||a.forEach((t=>{o.push(e(d,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"];return i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(G(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(G(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_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:_(a)?a[a.length-1]:a})}}class LE extends IE{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_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;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{d(i[t])&&(i[t]=n[t])})),R(i,"trimPadding")&&Zw(i,Wk(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class DE extends LE{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),Hk(t)}}const FE=(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&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=ZT(t,!0);for(const e in o)for(const i in o[e].nodes)ek(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)tk(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&QT(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}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 NE{_beforeInit(){this._dataSet&&_k(this._dataSet,"stackSplit",FE)}_initStack(){this._stack=new jE(this),this._stack.init()}}const UE={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:ZM.dimensionHover};class HE extends HC{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},UE,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=ok(i);let n;return n=_(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}HE.type="dimension-hover",HE.defaultOptions=UE;const zE=()=>{Jw.registerInteractionTrigger(HE.type,HE)},VE=()=>{Jw.registerComposedEvent(ZM.dimensionHover,qM),Jw.registerComposedEvent(ZM.dimensionClick,WM)},WE=t=>t.fieldX[0],GE=t=>t.fieldY[0],YE=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},XE=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},$E=(t,e)=>t?e?WE:YE:e?GE:XE,KE=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=KM(t,(t=>FM(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=KM(t,(t=>jM(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,u=new Set;[o,l].forEach((t=>t.forEach((t=>{Jx(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&u.add(t)}))));const d=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(u.size>0){if(u.has(t)){const s=qE(t,i,$E(e,Jx(t.getScale().type)));s&&d.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=qE(t,i,$E(e,s));n&&d.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===d.length&&p("x")):(p("x"),0===d.length&&p("y")),d.length?d:null},qE=(t,e,i)=>{const s=t.positionToData(e,!0);return d(s)?null:ZE(t,s,i)},ZE=(t,e,i)=>{const s=t.getScale();if(d(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=XM(e,t,"cartesian",null!=i?i:FM(t.getOrient())?WE:GE);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},JE=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:u,cacheInfo:d,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,y=0,_=null;if(u.size){const t=Array.from(u.values())[0];y=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,_=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!u.size&&Number.isFinite(y)&&!Number.isNaN(y),x=s&&!b&&p(d),S=x?d:{coordRange:[0,0],sizeRange:[0,0],coord:y,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:_};let A;S&&(S._isCache=x);let w=0;if(f&&u.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,u,d,p;let g=null;const m=t.getScale();if(Jx(m.type))A=m.bandwidth(),0===A&&m.step&&(w=m.step());else if(qx(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,y=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=function(t){let e=0;return R(t,"tick.visible")&&(e+=R(t,"tick.tickSize")),R(t,"label.visible")&&(e+=R(t,"label.space")),e}(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(a=_.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&_&&null!==(o=_.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(l=_.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&_&&null!==(h=_.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(c=_.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&_&&null!==(u=_.attribute.textBaseline)&&void 0!==u?u:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(d=_.attribute.textAlign)&&void 0!==d?d:"center",textBaseline:n&&_&&null!==(p=_.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};tR(t,u),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=y+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=y+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&QE(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=w,t[n].cacheInfo=S})),t),QE=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=tM(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},tR=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},eR=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=iR(i,s,n,e.axis),{coordRange:u}=e;c={visible:!0,start:{[r]:Math.max(o+t,u[0]),[a]:l[0]},end:{[r]:Math.min(o+h,u[1]),[a]:l[1]}}}return c},iR=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},sR=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return JE(c,r,e),c.xField.cacheInfo?eR(c.xField):c.yField.cacheInfo?eR(c.yField):void 0},nR=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],rR=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&nR.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(aR(s).every((t=>{var e;return!rM("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},aR=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},oR={dom:`${xT}_TOOLTIP_HANDLER_DOM`,canvas:`${xT}_TOOLTIP_HANDLER_CANVAS`},lR={key:"其他",value:"..."};var hR;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(hR||(hR={}));class cR{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(d(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(d(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,h=d(null==o?void 0:o.key)&&d(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:h,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}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:u,model:g}=e;if(!u||!this._cacheActiveSpec){const u=this.component.getSpec();if(this._cacheActiveSpec=rR(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){d(this._cacheActiveSpec.handler)&&p(u.handler)&&(this._cacheActiveSpec.handler=u.handler);const g=null!==(i=u[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},lR),t):lR;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!d(e)&&rM(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class uR extends cR{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)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],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(!Jx(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(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}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const dR=()=>{Jw.registerTooltipProcessor("dimension",uR)};class pR extends cR{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,u=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,d=null===(n=null==u?void 0:u.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===d||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==d){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,vs.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(ok(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const gR=()=>{Jw.registerTooltipProcessor("mark",pR)};class fR extends cR{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:G(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?G(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return G(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=G(s)[0][a];return r.filter((t=>t[a]===o))}}const mR=()=>{Jw.registerTooltipProcessor("group",fR)};class vR extends OE{constructor(){super(...arguments),this.transformerConstructor=DE,this.type="line",this.seriesType=mw.line}_setModelOption(){this._modelOption.getDimensionInfo=KE,this._modelOption.getDimensionInfoByValue=ZE,this._modelOption.getRectByDimensionData=sR}}vR.type="line",vR.seriesType=mw.line,vR.transformerConstructor=DE,W(vR,NE);function yR(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 _R=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:yR(t,e)}),bR=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:yR(t,e)}),xR={type:"fadeIn"},SR={type:"growCenterIn"};function AR(t,e){if(!1===e)return{};switch(e){case"fadeIn":return xR;case"scaleIn":return SR;default:return _R(t)}}class wR extends TC{constructor(){super(...arguments),this.type=wR.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}wR.type="rect";const TR=()=>{m_(),d_(),CA("rect",OA),Jw.registerMark(wR.type,wR),Hb.registerBuiltInAnimate("growHeightIn",bx),Hb.registerBuiltInAnimate("growHeightOut",xx),Hb.registerBuiltInAnimate("growWidthIn",jx),Hb.registerBuiltInAnimate("growWidthOut",Nx),Hb.registerBuiltInAnimate("growCenterIn",vx),Hb.registerBuiltInAnimate("growCenterOut",yx),Jw.registerGraphicComponent("rect",ec)},kR=Object.assign(Object.assign({},mM),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function CR(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;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=Vw(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[vM]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):Ow(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[yM]):Ow(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=Ow(this._dataToPosX(t),e,i),n=Ow(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[_M]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):Ow(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[bM]):Ow(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=Ow(this._dataToPosY(t),e,i),n=Ow(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},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(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},ER.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:MM(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(ER.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}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(_k(this._option.dataSet,"addVChartProperty",iM),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=d(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};_k(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new ni(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:gM.bind(this),call:fM}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new bC(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=bM,s=_M,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=yM,s=vM,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=ZT(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)CR(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,u=Ow(this[r](t),l,i),d=Ow(this[a](t),l,i);let p=Math.abs(u-d);p<=0&&!Pw(t[this.getStackValueField()],l)?p=0:pthis._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.setMarkConfig({clip:!0,clipPath:()=>{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[ET],n=t[RT],r=t[OT],h=t[PT];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]),{[ET]:i,[RT]:s}),a?{[OT]:o,[PT]:l}:void 0),c="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)};t.push(ec(Object.assign(Object.assign({},c),{cornerRadius:u(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(c,h,this._markAttributeContext):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=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>Ow(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},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=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>Ow(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),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=d(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;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=$(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=LM(this);this._barMark.setAnimationConfig(wM(null===(e=Jw.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),TM(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=d(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=p(this._spec.barWidth)&&r===n,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=a;return o&&(c=Vw(this._spec.barWidth,a)),l&&(c=Math.max(c,Vw(this._spec.barMinWidth,a))),h&&(c=Math.min(c,Vw(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,u;"horizontal"===t?(h=this.getYAxisHelper(),c="height",u="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",u="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=d(i)?f:Math.min(f,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.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=G(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],u=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],d=u.length,p=Vw(null!==(l=i[r-1])&&void 0!==l?l:Y(i),v),g=u.indexOf(e[c]);r===t.length-1?(s+=d*y+(d-1)*p,n+=g*(y+p)):(n+=g*(s+p),s+=s+(d-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const _=qx(g.type||"band");return u(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(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}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}}ER.type=mw.bar,ER.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},ER.mark=kR,ER.transformerConstructor=BR;const RR=()=>{CE(),TR(),Jw.registerAnimation("bar",((t,e)=>({appear:AR(t,e),enter:_R(t,!1),exit:bR(t,!1),disappear:{duration:IC.disappear.duration}}))),uE(),hE(),Jw.registerSeries(ER.type,ER)};class OR extends LE{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),Hk(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 PR extends OE{constructor(){super(...arguments),this.transformerConstructor=OR,this.type="bar",this.seriesType=mw.bar}_setModelOption(){this._modelOption.getDimensionInfo=KE,this._modelOption.getDimensionInfoByValue=ZE,this._modelOption.getRectByDimensionData=sR}}PR.type="bar",PR.seriesType=mw.bar,PR.transformerConstructor=OR,W(PR,NE);const IR=[...iB,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class LR extends sB{constructor(){super(...arguments),this.type=LR.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return IR}_getIgnoreAttributes(){return[]}}LR.type="area";class DR extends hM{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of G(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 FR=Object.assign(Object.assign(Object.assign({},mM),JM),{area:{name:"area",type:"area"}}),jR=()=>{Jw.registerAnimation("area",FC),jC(),DC()};class NR extends lB{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!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,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,u=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),d=!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,f=h;("line"===c||d&&!u)&&(g=h,f=l),l.style=Zw({},f.style,g.style),l.state=Zw({},f.state,g.state),!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),t.area=l,t.line=h}}class UR extends DM{constructor(){super(...arguments),this.type=mw.area,this.transformerConstructor=NR,this._sortDataByAxis=!1}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(UR.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}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===qC?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return Ow(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),y1: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),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return Ow(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:!!e&&this.getColorAttribute(),stroke:!!i&&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.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[RT]},"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(wM(null===(e=Jw.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),TM("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(wM(null===(i=Jw.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),TM("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=LM(this);this._symbolMark.setAnimationConfig(wM(null===(s=Jw.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),TM("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new DR(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.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(){super.onLayoutEnd(),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&&_(l)?l[0]:l}}}UR.type=mw.area,UR.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},UR.mark=FR,UR.transformerConstructor=NR,W(UR,QM);const HR=()=>{CE(),yE(),rB(),Jw.registerMark(LR.type,LR),m_(),i_(),LA(),EA(),NC(),Jw.registerGraphicComponent("area",_c),oB(),jR(),uE(),hE(),Jw.registerSeries(UR.type,UR)};class zR extends LE{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),Hk(t)}}class VR extends OE{constructor(){super(...arguments),this.transformerConstructor=zR,this.type="area",this.seriesType=mw.area}_setModelOption(){this._modelOption.getDimensionInfo=KE,this._modelOption.getDimensionInfoByValue=ZE,this._modelOption.getRectByDimensionData=sR}}VR.type="area",VR.seriesType=mw.area,VR.transformerConstructor=zR,W(VR,NE);class WR extends PM{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)?G(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?G(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=G(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(d(t)||d(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(G(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(G(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}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:[]};qx(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:[]};qx(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)&&IM(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}}function GR(t){return Hg(t)?Number.parseFloat(t):0}const YR=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:u}=e,d=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&u&&XR(m,d,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=Vt(e+a/2)};let y=0,_=-1/0,b=!0;for(let t=0;tNumber(t[d]))),S=g-p;let A=p,w=S,T=0;const k=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))}(x);if(m.forEach(((t,e)=>{const i=t[TB],s=y?i/y:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=w/T;A=p,m.forEach((e=>{const i=e[r]===f?f:e[TB]*t;v(e,A,i),A+=i}))}if(0!==y&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},XR=(t,e,i)=>!!d(t)||(0===t.length||(!!t.every((t=>0===GR(t[e])))||!i&&0===t.reduce(((t,i)=>t+GR(i[e])),0)));function $R(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const KR=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:$R(t,!0,Mk.appear)}),qR={type:"fadeIn"},ZR=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:$R(t,!0,Mk.enter)}),JR=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:$R(t,!0,Mk.exit)});function QR(t,e){if(!1===e)return{};switch(e){case"fadeIn":return qR;case"growRadius":return KR(Object.assign(Object.assign({},t),{growField:"radius"}));default:return KR(Object.assign(Object.assign({},t),{growField:"angle"}))}}class tO extends TC{constructor(t,e){super(t,e),this.type=eO.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>Ut({x:0,y:0},this.getAttribute("centerOffset",e,i),e[EB])[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 eO extends tO{constructor(){super(...arguments),this.type=eO.type}}eO.type="arc";const iO=()=>{m_(),t_(),CA("arc",jA),Hb.registerBuiltInAnimate("growRadiusIn",Lx),Hb.registerBuiltInAnimate("growRadiusOut",Dx),Hb.registerBuiltInAnimate("growAngleIn",fx),Hb.registerBuiltInAnimate("growAngleOut",mx),Jw.registerGraphicComponent("arc",Sc),Jw.registerMark(eO.type,eO)},sO=Object.assign(Object.assign({},mM),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class nO extends OM{_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=Zw({},this._theme,i,t);const n=(t,e)=>Zw({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);_(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const rO=`${xT}_LABEL_VISIBLE`;class aO extends WR{constructor(){super(...arguments),this.transformerConstructor=nO,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:jw(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:jw(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=PB,this._endAngle=IB,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[EB];if(d(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return Ut(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;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 a=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)?jt(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?jt(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?jt(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=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;_k(this._dataSet,"pie",YR),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?jt(this._spec.minAngle):0,asStartAngle:CB,asEndAngle:MB,asRatio:kB,asMiddleAngle:EB,asRadian:OB,asQuadrant:RB,asK:BB,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new ni(this._dataSet,{name:`${xT}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new bC(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},aO.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:kT,groupKey:this._seriesField,isSeriesMark:!0},{morph:MM(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return pw(CB)(t)}endAngleScale(t){return pw(MB)(t)}_computeLayoutRadius(){return((t,e,i,s)=>{const n=t();if(S(n))return n;if(u(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return zt(r,i(),t,e)}return Math.min(r.width/2,r.height/2)})((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:Iw(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:Iw(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},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),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)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:pw(rO).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(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}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*(d(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[EB];if(d(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return Ut(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===Mk.appear)return this._startAngle;if(i===Mk.disappear)return this._endAngle;const r=[Mk.disappear,Mk.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[TT];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[TT]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[TT])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[TT])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+Ut({x:0,y:0},a,e[EB]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+Ut({x:0,y:0},a,e[EB]).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[EB]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+Ut({x:0,y:0},a,e[EB]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=wM(null===(i=Jw.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}aO.transformerConstructor=nO,aO.mark=sO,aO.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class oO extends aO{constructor(){super(...arguments),this.type=mw.pie}}oO.type=mw.pie;const lO=()=>{iO(),Jw.registerAnimation("pie",((t,e)=>({appear:QR(t,e),enter:ZR(t),exit:JR(t),disappear:{duration:IC.disappear.duration}}))),Jw.registerAnimation("emptyCircle",((t,e)=>({appear:QR(t,e)}))),Jw.registerSeries(oO.type,oO)};class hO extends IE{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=G(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=>{d(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],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 cO extends hO{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class uO extends OE{constructor(){super(...arguments),this.transformerConstructor=cO}}uO.transformerConstructor=cO;class dO extends uO{constructor(){super(...arguments),this.transformerConstructor=cO,this.type="pie",this.seriesType=mw.pie}}dO.type="pie",dO.seriesType=mw.pie,dO.transformerConstructor=cO;class pO extends IE{_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")&&Zw(e,Wk(this.type,t))})),this._transformAxisSpec(t)}}const gO=(t,e)=>{if(!t)return null;const i=KM(t,(t=>"angle"===t.getOrient()),e),s=KM(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&Jx(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),u={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=cw({x:1,y:0},u);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=uw(u),f=null===(e=s[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(d(v))return;let y=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));y<0&&(y=void 0);const _=XM(v,t,"polar",r);n.push({index:y,value:v,position:i.scale(v),axis:t,data:_})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&Jx(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let u=cw({x:1,y:0},c);u<-Math.PI/2&&(u=2*Math.PI+u);const p=uw(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((u-(null==f?void 0:f[0]))*(u-(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=s.invert(p);if(d(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const y=XM(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:y})}})),n.length?n:null};class fO extends OE{constructor(){super(...arguments),this.transformerConstructor=pO,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=KE(t,e,i))&&void 0!==s?s:[],...null!==(n=gO(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=ZE,this._modelOption.getRectByDimensionData=sR}}fO.type="common",fO.transformerConstructor=pO,W(fO,NE);const mO={rect:SO,symbol:bO,arc:wO,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=bO(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:function(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=yO(t,l,n.formatMethod);return h.x=function(t,e,i,s){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")+s:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-s:e.totalPositionX(t,"end")+(t.end>=t.start?s:-s);return e.totalPositionX(t,"index",.5)}(l,s,a,o),h.y=function(t,e,i,s){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")-s;if("min"===i)return e.totalPositionY(t,t.end>=t.start?"start":"end")+s;return 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),Gh(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:[]}}},line:TO,area:TO,rect3d:SO,arc3d:wO,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function vO(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=mO[t])&&void 0!==i?i:mO.point;return e.series.type===mw.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=_O(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;y(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!y(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:kO(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function yO(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==mw.sankey){const{formatFunc:t,args:n}=tM(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function _O(t){return u(t)?e=>t(e.data):t}function bO(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=_O(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:xO(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function xO(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function SO(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=_O(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",u="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 d,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&u||(null==i?void 0:i[t])<0&&!u?1:0;return e[c][s]}return s},d=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:AO(o)};let g=!1;return y(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:d,smartInvert:g}}function AO(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 wO(t){var e;const{labelSpec:i}=t,s=null!==(e=_O(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:y(s)&&s.includes("inside"),{position:n,smartInvert:r}}function TO(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}))):[{index:0,[CT]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function kO(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class CO extends NB{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,z(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=ww({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:G(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==$k.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&d(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}CO.type=r.label;class MO extends TC{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=MO.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?pc(t):Gh(t)}}MO.type="text";class BO extends MO{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}render(){}}BO.type="text",BO.constructorType="label";const EO=()=>{Jw.registerMark(MO.type,MO),m_(),b_(),g_(),Jw.registerGraphicComponent("text",Gh),Jw.registerGraphicComponent("richtext",pc),Jw.registerMark(BO.constructorType,BO)};class RO extends jB{_initTheme(t,e){return{spec:t,theme:this._theme}}}class OO extends CO{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=RO,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.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(ck.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(ck.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),dw(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{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{G(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),u(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();_(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),u=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let d=Zw({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},vO(h,r),Object.assign(Object.assign(Object.assign({},N(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:u}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[NT])):t=>t.filter((t=>t.data[jT]))}:{});return l&&l.parseLabelStyle&&(d=l.parseLabelStyle(d,a,o)),"line"!==h&&"area"!==h||(d.type=h),d},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?yO(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=_(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=G(i())[t])}))}return e}}OO.type=r.label,OO.specKey="label",OO.transformerConstructor=RO;var PO;!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(PO||(PO={}));const IO={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class LO extends NB{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=ft((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},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.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{Jx(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_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}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||z(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(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:gk.chart}:{source:pk.chart};_(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;_(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}onBeforeRender(){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"}:Fg(e)||jg(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=G(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:pk.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:pk.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:pk.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)=>{IO[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:u}=this.getLayoutStartPoint();return n.forEach((t=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const d=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+d.left),o=Math.min(o,i-u+d.top),l=Math.max(l,e+t.getLayoutRect().width-c-d.right),h=Math.max(h,i+t.getLayoutRect().height-u-d.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_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)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_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 i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:u,fillOpacity:d,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?u:d;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=R(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=R(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:u}=n,d=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:R(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},u)},d):{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||on&&(d=n-l),h>r&&(p=r-h),d&&t.setAttribute("dx",d+c),p&&t.setAttribute("dy",p+u)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}LO.specKey="crosshair";const DO={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}}}}};class FO extends LO{static getSpecInfo(t){return eM(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_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)}}_getDatumAtPoint(t,e){const i=FM(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){FM(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:jM(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();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 o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=((t,e)=>{for(let i=0;i{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=eR(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,u,d;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(u=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==u?u:0,textStyle:Object.assign(Object.assign({},null===(d=i.label)||void 0===d?void 0:d.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new Q_(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new tb(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}FO.specKey="crosshair",FO.builtInTheme={crosshair:DO},FO.type=r.cartesianCrosshair;const jO=(t,e)=>p(e)?t.map((t=>e[t])):void 0,NO=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),UO=t=>!d(t)&&(_(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function HO(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),u=i.getOption(),g=u.getRegionsInUserIdOrIndex(p(c.regionId)?[c.regionId]:void 0,p(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=zO(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),y=g.getLayoutRect(),_=u.globalInstance.getContainer(),b=Object.assign({x:0,y:0},_?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(_):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>NO(i,s)(t)&&NO(n,r)(t)&&(d(a)||NO([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),A=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),y.width),y:Math.min(Math.max(t.y,0),y.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.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 l=[{value:t[e.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=>x(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=u.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:pk.chart,event:A({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=u.globalInstance;return KC.globalConfig.uniqueTooltip&&KC.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=u.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:pk.chart,event:A(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=u.globalInstance;return KC.globalConfig.uniqueTooltip&&KC.hideTooltip(a.id),m}return"none"}const zO=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),u=e.getMeasureField(),g=e.getSeriesField(),f=p(g)?t[g]:void 0,m=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=jO(c,t);let y=jO(u,t);const _=UO(y),b=!_&&p(g)&&d(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(NO(c,v));if(!_&&(y=jO(u,i),!UO(y)))return;const n=e.type===mw.pie?e.dataToCentralPosition(i):e.dataToPosition(i);d(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:u,measureData:y,hasMeasureData:_,groupField:g,groupData:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=Jx(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])=>d(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(NO(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(y=jO(u,o),!UO(y))return;const l=t.dataToPosition(o);d(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:u,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(NO(c,n));if(!_&&(y=jO(u,r),!UO(y)))return;const o=t.dataToPosition(r);if(d(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:u,measureData:y,hasMeasureData:_,groupField:g,groupData:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===mw.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(NO(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(y=jO(u,i),!UO(y))return;const r=t.dataToPosition(i);d(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:u,measureData:y,hasMeasureData:_,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&(()=>{var i,n,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(NO(c,v));const o=e.getNameMap(),l=null===(r=null===(n=e.getMapViewData)||void 0===n?void 0:n.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=y;if(l&&!a&&(a=Object.assign({},t)),!_){if(y=jO(u,a),h=y,!UO(y)&&!a)return;UO(y)||(y=[null])}const p=e.dataToPosition(a);d(p)||isNaN(p.x)||isNaN(p.y)||s.push({pos:p,data:{dimensionFields:c,dimensionData:v,measureFields:u,measureData:h,hasMeasureData:_,groupField:g,groupData:f,originDatum:a},series:e})})()})),s},VO=t=>p(t)&&!_(t),WO=t=>p(t)&&_(t);class GO extends jB{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i,s,n;const{spec:r,theme:a}=super._initTheme(t,e);return r.style=Zw({},this._theme,r.style),r.offset=Zw({},a.offset,t.offset),r.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:a.transitionDuration,r.trigger=null!==(s=t.trigger)&&void 0!==s?s:a.trigger,r.triggerOff=null!==(n=t.triggerOff)&&void 0!==n?n:a.triggerOff,{spec:r,theme:a}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(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]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:jg(this._option.mode)||!Dg(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.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?y(t.parentElement)&&(t.parentElement=Ap.getElementById(t.parentElement)):Dg(this._option.mode)&&(t.parentElement=null==Lg?void 0:Lg.body)}}const YO={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}};class XO extends NB{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=GO,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=Dg(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return d(t.mark)&&d(t.model)&&d(t.datum)}(t)&&(n&&VO(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!d(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&KC.globalConfig.uniqueTooltip&&l&&KC.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;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;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:pk.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(null==r?void 0:r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:pk.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),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,this._enterable=!1;else{const t="canvas"===s?oR.canvas:oR.dom,n=Jw.getComponentPluginInType(t);n||Og("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,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=Jw.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=G(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=G(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(Fg(s)||jg(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,ft(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===s||s.call(i)}else 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=HO(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(d(this._cacheInfo)||d(t))return!1;if(WO(t)){if(VO(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>GM(t,e[i])))}if(WO(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!d(n)&&!d(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: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}getVisible(){return!1!==this._spec.visible}}XO.type=r.tooltip,XO.transformerConstructor=GO,XO.builtInTheme={tooltip:YO},XO.specKey="tooltip";function $O(t,i){const s=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:n={},item:r={},pager:a={},background:o={}}=t;n=I(n),r=I(r),a=I(a),o=I(o);const l=s;return n.visible?l.title=function(t){var e,i;const s=Object.assign({},t);return E(t.style)||(s.textStyle=rk(t.style)),E(t.textStyle)||Zw(s.textStyle,rk(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&rk(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&rk(s.background.style),s}(n):l.title={visible:!1},E(r.focusIconStyle)||rk(r.focusIconStyle),r.shape&&(r.shape=sk(r.shape)),r.label&&(r.label=sk(r.label)),r.value&&(r.value=sk(r.value)),r.background&&(r.background=sk(r.background)),Dw(r.maxWidth)&&(r.maxWidth=Number(r.maxWidth.substring(0,r.maxWidth.length-1))*i.width/100),Dw(r.width)&&(r.width=Number(r.width.substring(0,r.width.length-1))*i.width/100),Dw(r.height)&&(r.height=Number(r.height.substring(0,r.height.length-1))*i.width/100),l.item=r,"scrollbar"===a.type?(E(a.railStyle)||rk(a.railStyle),E(a.sliderStyle)||rk(a.sliderStyle)):(E(a.textStyle)||rk(a.textStyle),a.handler&&sk(a.handler)),l.pager=a,o.visible&&!E(o.style)&&(Zw(l,o.style),p(o.padding)&&(l.padding=o.padding)),l}const KO=(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},qO=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),u=l();if(0===c.length&&u.length)return[];if(c.length===u.length)return t;const d={};c.forEach((t=>{d[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:CT;return h?h(t,c,g):(_(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(g)&&(t=t.filter((t=>!0===d[r.getSeriesFieldValue(t,g)]))),t)};class ZO extends NB{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:()=>{dw(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),dw(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=Lw(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=G(s)),p(e)&&(this._regionUserId=G(e)),p(n)&&(this._seriesIndex=G(n)),p(i)&&(this._regionUserIndex=G(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_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):(z(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new bC(this._option,e),this._initSelectedData(),dw(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;d(e)||JSON.stringify(r)===JSON.stringify(e)||(dw(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;A(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)z(s,this._cacheAttrs)||this._legendComponent.setAttributes(Zw({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(Zw({},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;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());z(t,this._cacheAttrs)||this._legendComponent.setAttributes(Zw({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}ZO.specKey="legends";class JO extends ZO{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return eM(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),dw(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){_k(this._option.dataSet,"discreteLegendFilter",qO),_k(this._option.dataSet,"discreteLegendDataMake",KO);const t=new ni(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return dw(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(d(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(!zg(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 u(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)&&d(t.title.text)&&d(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=qT(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},$O(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(i),this._addLegendItemFormatMethods(i),i}_getLegendConstructor(){return sw}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(JA.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(JA.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(JA.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:A(s)?s:1,strokeOpacity:A(n)?n: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 u(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}=tM(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=tM(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}JO.specKey="legends",JO.builtInTheme={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}},JO.type=r.discreteLegend;const QO="vchart-tooltip",tP=`${QO}-container`,eP=`${QO}-title`,iP=`${QO}-content-box`,sP={offsetX:10,offsetY:10},nP="99999999999999";function rP(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const aP=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,oP=t=>y(t)&&""!==(null==t?void 0:t.trim())||S(t)?rP(t):"",lP=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(u(t)){const s=t(e);S(s)&&(i=s)}return i},hP={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},cP=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=hP[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class uP extends mB{constructor(){super(...arguments),this._visible=!0,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._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const u=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,u,e,t))&&void 0!==n?n:0;const d=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[u])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==d?void 0:d.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,d;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const y=e.event,{activeType:_,data:b}=t,x="dimension"===_?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:w,offsetY:T}=this._option,k=m[_],C=nM(null==k?void 0:k.position,b,e),M=null!==(r=nM(null==k?void 0:k.positionMode,b,e))&&void 0!==r?r:"mark"===_?"mark":"pointer",{width:B=0,height:E=0}=null!=i?i:{},R="canvas"===m.renderMode,O=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),P=null!==(o=null==O?void 0:O.width)&&void 0!==o?o:ST,I=null!==(l=null==O?void 0:O.height)&&void 0!==l?l:AT;let L=!1;const D={width:0,height:0};let F,j={x:0,y:0},N={x:0,y:0},U=1,H=1;const z=Dg(this._env);if(z&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=P,D.height=I),z&&!R){const t=this._getParentElement(m);N=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(d=this._compiler.getCanvas())&&void 0!==d?d:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),j={x:F.x-N.x,y:F.y-N.y},U=aP(e,F),H=aP(t,N)}const V=H/U,W={},G={x:C,y:C},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?w:T;if("mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){L=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(L){const e=Y[n][0],i="x"===n?B:E;switch(cP(t,n)){case-2:W[e]=a-i*V-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*V/2;break;case-1:W[e]=(a+o)/2-i*V-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*V-c;break;case 2:W[e]=o+c}}},$=["x","y"];if(g(C))if(g(K=C)&&(p(K.left)||p(K.right)||p(K.top)||p(K.bottom))){const{left:t,right:e,top:i,bottom:s}=C;W.left=lP(t,y),W.top=lP(i,y),W.right=lP(e,y),W.bottom=lP(s,y)}else(t=>g(t)&&(p(t.x)||p(t.y)))(C)&&$.forEach((t=>{const e=C[t];S(e)||u(e)?W[Y[t][0]]=lP(e,y):X(e,t)}));else p(C)&&(X({orient:C,mode:M},"x"),X({orient:C,mode:M},"y"));var K;const q={x:null,y:null};return $.forEach((t=>{var e;const i="x"===t?B:E,s="x"===t?P:I,n="x"===t?w:T,r=cP(G[t],t);if(A(W[Y[t][0]]))q[t]=W[Y[t][0]];else if(A(W[Y[t][1]]))q[t]=s-i*V-W[Y[t][1]];else{const e="x"===t?y.canvasX:y.canvasY;q[t]=r>0?e+n:0===r?e-i*V/2:e-i*V-n}q[t]*=U,z&&(q[t]+=j[t]),q[t]/=H;const a="x"===t?D.width:D.height,o=m.confine?-(N[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/U)/H:-N[t]/H,l=a/H+o-i;2!==r&&q[t]l&&(q[t]=l)):-2!==r&&q[t]>l&&(L?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]p(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",pP=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=dP(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=dP(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},gP=(t={})=>{const{lineHeight:e}=t;return t.fontSize?jw(e,t.fontSize):0},fP=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=A(l)?`${l}px`:`${l}`),p(r)&&(o=Ce(r),a.padding=dP(o)),{panelStyle:a,panelPadding:o}};function mP(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}class vP extends uP{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(vP.type),this.type=oR.dom,this._tooltipContainer=null==Lg?void 0:Lg.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(Lg&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:u,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=fP(l),y={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),A(g)&&(y.marginBottom=`${g}px`);const _={width:dP(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=pP(h),x=pP(u),S=pP(p),w="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),d(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),d(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),d(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),_[w]=dP(null!==(i=c.spacing)&&void 0!==i?i:8),x[w]=dP(null!==(s=u.spacing)&&void 0!==s?s:26),S[w]=dP(null!==(n=p.spacing)&&void 0!==n?n:0);const T=Math.max(gP(p),gP(u));return y.lineHeight=T>0?`${T}px`:"20px",{panelPadding:v,row:y,panel:m,title:b,shape:_,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(eP))),l=a.find((t=>t.className.includes(iP)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(eP),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(mP(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${QO}-column`),e.classList.add(`${QO}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(iP),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];mP(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));mP(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${QO}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=oP(e.key),e.keyStyle&&pP(e.keyStyle,l)):"value"===i?(o.innerHTML=oP(e.value),e.valueStyle&&pP(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:u=!1,shapeFill:d}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?rP(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?rP(c):m,_=p,b=t=>new Xh({symbolType:t,size:_,fill:!0});let x=b(h);const S=x.getParsedPath();let A,w;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;w=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(w=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new le));let T=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=T.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));T=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const k=Un.IsGradientStr(d);if(!d||y(d)&&!k||u)return m=u?"none":d?rP(d):"currentColor",`\n \n \n \n `;const C=k?Un.Parse(d):g(d)?d:null;if(C){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=C.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===C.gradient?t=`\n ${i}\n `:"linear"===C.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),mP(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(iP))),h=[...o.children].find((t=>t.className.includes(eP)));if(l){const o=this._component.getSpec(),c={},u=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(u&&u.autoWidth&&!1!==u.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(eP)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=jw(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,mP(l,c))}const d=l.children,g=[];if(d){for(let i=0;i{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},Ec||(Ec=Mc.CreateGraphic("richtext",{})),Ec.setAttributes(a),Ec.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function bP(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:yP),{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:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const xP=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};class SP extends uP{constructor(){super(SP.type),this.type=oR.canvas,this._attributes=null}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 lw({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}_getTooltipBoxSize(t,e){var i,s;if(!e||d(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:u={},titleLabel:d,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:y}=l,_=Ce(u.padding),b=Hw(u.padding),x=bP(Object.assign({textAlign:"right"===y?"right":"left"},d),i),S=bP(Object.assign({textAlign:"right"===y?"right":"left"},f),i),A=bP(m,i),w={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:xP(u),padding:_,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:w,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:y},{title:k={},content:C=[]}=t;let M=b.left+b.right,B=b.top+b.bottom,E=0;const R=!!C.length;let O=0,P=0,I=0,L=0;if(R){const t=[],e=[],i=[],s=[];let n=0;T.content=C.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:u,shapeStroke:d,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:y,spaceRow:_,keyStyle:b,valueStyle:x,shapeHollow:T}=r,k={height:0,spaceRow:null!=_?_:v};if(p(h)){const i=Zw({},S,bP(b,void 0,{})),{width:s,height:n,text:r}=_P(h,i);k.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),y?e.push(s):t.push(s),o=Math.max(o,n)}if(p(m)){const t=Zw({},A,bP(x,void 0,{})),{width:e,height:s,text:n}=_P(m,t);k.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};T?t.stroke=u:t.fill=u,t.stroke=null!=d?d:u,t.lineWidth=g,k.shape=t;const e=null!=f?f:w.size;o=Math.max(e,o),s.push(e)}else k.shape={visible:!1};return k.height=o,n+=o,aV.autoWidth&&!1!==V.multiLine;if(N){V=Zw({},x,bP(H,void 0,{})),W()&&(V.multiLine=null===(r=V.multiLine)||void 0===r||r,V.maxWidth=null!==(a=V.maxWidth)&&void 0!==a?a:R?Math.ceil(E):void 0);const{text:t,width:e,height:i}=_P(U,V);T.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=V.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},V),{text:t}),D=T.title.value.width,F=T.title.value.height,j=F+(R?T.title.spaceRow:0)}return B+=j,T.title.width=D,T.title.height=F,W()?M+=E||D:M+=Math.max(D,E),R&&T.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=M-b.left-b.right-L-O-S.spacing-A.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})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_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{activeTooltipSpec: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()}}SP.type=oR.canvas;const AP=/\{([^}]+)\}/,wP=/\{([^}]+)\}/g,TP=/:/;class kP extends mB{constructor(){super(kP.type),this.type="formatterPlugin",this._timeModeFormat={utc:Be.getInstance().timeUTCFormat,local:Be.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Fe.getInstance().format,this._numericSpecifier=Fe.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[kP.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;u(r)?this._formatter=r:(this._formatter=this._format.bind(this),u(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),Jw.registerFormatter(this._formatter)}_format(t,e,i){return _(t)?t.map(((t,s)=>{const n=_(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):_(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=AP.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(wP,((t,i)=>{if(!TP.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(Ie.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):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}kP.pluginType="chart",kP.specKey="formatter",kP.type="formatterPlugin";KC.useRegisters([()=>{dR(),gR(),mR(),VE(),zE(),CE(),yE(),rB(),oB(),jC(),DC(),uE(),hE(),Jw.registerSeries(ME.type,ME),Jw.registerChart(vR.type,vR)},()=>{dR(),gR(),mR(),zE(),HR(),VE(),Jw.registerChart(VR.type,VR)},()=>{dR(),gR(),mR(),zE(),RR(),VE(),Jw.registerChart(PR.type,PR)},()=>{gR(),lO(),Jw.registerChart(dO.type,dO)},()=>{dR(),gR(),mR(),VE(),Jw.registerChart(fO.type,fO),zE()},hE,uE,()=>{Jw.registerComponent(JO.type,JO)},()=>{Jw.registerComponent(XO.type,XO)},()=>{Jw.registerComponent(FO.type,FO)},()=>{Jw.registerGraphicComponent(OO.type,(t=>new UA(t))),EO(),VB(),Jw.registerComponent(OO.type,OO,!0,1/0)},()=>{var t;t=SP,Jw.registerComponentPlugin(t.type,t)},()=>{var t;t=kP,Jw.registerChartPlugin(t.type,t)},WC,XC]),KC.useRegisters([()=>{Kv(Vi)}]),t.DEFAULT_CHART_HEIGHT=AT,t.DEFAULT_CHART_WIDTH=ST,t.DEFAULT_CLOSE_STROKE_JOIN=JC,t.DEFAULT_DATA_INDEX=TT,t.DEFAULT_DATA_KEY=kT,t.DEFAULT_DATA_SERIES_FIELD=CT,t.DEFAULT_KEY=YT,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=ZC,t.DEFAULT_MAP_LOOK_UP_KEY=XT,t.DEFAULT_MEASURE_CANVAS_ID=wT,t.DEFAULT_SERIES_STYLE_NAME=MT,t.DEFAULT_SMOOTH_INTERPOLATE=qC,t.Factory=Jw,t.MOSAIC_CAT_END_PERCENT=VT,t.MOSAIC_CAT_START_PERCENT=zT,t.MOSAIC_VALUE_END_PERCENT=HT,t.MOSAIC_VALUE_START_PERCENT=UT,t.ManualTicker=class extends jb{constructor(t){super(t),this.lastFrameTime=0,this.status=es.RUNNING}setupTickHandler(){const t=new Nb;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===es.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===es.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=es.RUNNING,!0}},t.PREFIX=xT,t.SEGMENT_FIELD_END=GT,t.SEGMENT_FIELD_START=WT,t.STACK_FIELD_END=RT,t.STACK_FIELD_END_OffsetSilhouette=LT,t.STACK_FIELD_END_PERCENT=PT,t.STACK_FIELD_KEY=BT,t.STACK_FIELD_START=ET,t.STACK_FIELD_START_OffsetSilhouette=IT,t.STACK_FIELD_START_PERCENT=OT,t.STACK_FIELD_TOTAL=DT,t.STACK_FIELD_TOTAL_BOTTOM=NT,t.STACK_FIELD_TOTAL_PERCENT=FT,t.STACK_FIELD_TOTAL_TOP=jT,t.StreamLight=class extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=Gi.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new pn,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=Gi.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,u,d,p,g,f,m,v,y;const _=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(_){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(u=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==u?u:60,d=-n,p=d+(s-d)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:ys.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(d=b.height)&&void 0!==d?d:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(y=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==y?y:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:ys.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=Os(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(u=(o-a)/c.getLength());const[e]=Os(c||s,u);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(u);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&d.push(Ft.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pu){d.push(Ft.pointAtPP(o[t-1],o[t],1-(p+e-u)/e));break}d.length&&d.push(o[t]),p+=e}if(d.length&&!(d.length<2)){t.clear(),t.moveTo(d[0].x,d[0].y);for(let e=1;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(u(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(d(i))for(let i=0;i(l(t),t)))},t.measureText=bT,t.normalizeLayoutPaddingSpec=Hw,t.queryColorFromColorScheme=Aw,t.queryToken=Gw,t.registerDataSetInstanceParser=bk,t.registerDataSetInstanceTransform=_k,t.registerTheme=oT,t.removeTheme=hT,t.themeExist=cT,t.themes=nT,t.token=Xw,t.transformColorSchemeToStandardStruct=Cw,t.transformToGraphic=rk,t.version="2.0.19",t.vglobal=Ap,t.warn=Rg,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.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=(t,e=!1)=>e?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean");var u=t=>"function"==typeof t;var d=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=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||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=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||h(t,"Number")};var A=t=>S(t)&&Number.isFinite(t);var w=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var k=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 M=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||C)};const B=Object.prototype.hasOwnProperty;function E(t){if(d(t))return!0;if(b(t))return!t.length;const e=T(t);if("Map"===e||"Set"===e)return!t.size;if(M(t))return!Object.keys(t).length;for(const e in t)if(B.call(t,e))return!1;return!0}var R=(t,e,i)=>{const s=y(e)?e.split("."):e;for(let e=0;enull!=t&&O.call(t,e);function I(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=_(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||y(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=I(r,e,i)}return s}function L(t,e,i=!1,s=!1){if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&_(t[a])?F(t,a,n[a]):D(t,e,a,i,s)}}}}function D(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(_(a)){if(s)o=[];else if(_(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(y(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function U(t){return Object.prototype.toString.call(t)}function H(t){return Object.keys(t)}function z(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(U(t)!==U(e))return!1;if(u(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 s=t.length-1;s>=0;s--)if(!z(t[s],e[s],i))return!1;return!0}if(!m(t))return!1;const s=H(t),n=H(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(!z(t[r],e[r],i))return!1}return!0}function V(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;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;ne?1:t>=e?0:NaN}function J(t){return Number(t)}const Q="undefined"!=typeof console;function tt(t,e,i){const s=[e].concat([].slice.call(i));Q&&console[t].apply(console,s)}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(t=et.None,e){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(...t){this._onErrorHandler.forEach((e=>e(...t)))}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(...t){var e;return this._level>=et.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):tt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=et.Warn&&tt(this._method||"warn","WARN",t),this}info(...t){return this._level>=et.Info&&tt(this._method||"log","INFO",t),this}debug(...t){return this._level>=et.Debug&&tt(this._method||"log","DEBUG",t),this}}function st(t,e,i=0,s){for(d(s)&&(s=t.length);i>>1;Z(t[n],e)>0?s=n:i=n+1}return i}it._instance=null;const nt=1e-10,rt=1e-10;function at(t,e,i=rt,s=nt){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function ot(t,e,i,s){return t>e&&!at(t,e,i,s)}function lt(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),i)};var ct=function(t,e,i){return ti?i:t};var ut=(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 dt(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 s,n,r,a,o,l,h=0,c=!1,u=!1,d=!0;const p=!e&&0!==e&&pt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=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||u&&t-h>=r}function y(){const t=Date.now();if(v(t))return _(t);o=m(y,function(t){const i=t-h,s=e-(t-l);return u?Math.min(s,r-i):s}(t))}function _(t){return o=void 0,d&&s?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(y,e),c?f(t):a}(l);if(u)return o=m(y,e),f(l)}return void 0===o&&(o=m(y,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,u="maxWait"in i,u&&(r=Math.max(A(i.maxWait)?i.maxWait:0,e)),d="trailing"in i?!!i.trailing:d),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:_(Date.now())},b.pending=function(){return void 0!==o},b}function ft(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),gt(t,e,{leading:s,trailing:n,maxWait:e})}function mt(t,e){return i=>t*(1-i)+e*i}function vt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}pt=!1;const yt=1e-12,_t=Math.PI,bt=_t/2,xt=2*_t,St=2*Math.PI,At=Math.abs,wt=Math.atan2,kt=Math.cos,Tt=Math.max,Ct=Math.min,Mt=Math.sin,Bt=Math.sqrt,Et=Math.pow;function Rt(t){return t>=1?bt:t<=-1?-bt:Math.asin(t)}function Ot(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Pt(t,e){return t[0]*e[1]-t[1]*e[0]}function It(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}function Lt(t,e){return function(t,e=10){return Math.round(t*e)/e}(t-e,10**Math.max(It(t),It(e)))}class Dt{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new Dt(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 Ft{static distancePP(t,e){return Bt(Et(t.x-e.x,2)+Et(t.y-e.y,2))}static distanceNN(t,e,i,s){return Bt(Et(t-i,2)+Et(e-s,2))}static distancePN(t,e,i){return Bt(Et(e-t.x,2)+Et(i-t.y,2))}static pointAtPP(t,e,i){return new Dt((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function jt(t){return t*(Math.PI/180)}const Nt=(t=0)=>{if(t<0)for(;t<-xt;)t+=xt;else if(t>0)for(;t>xt;)t-=xt;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 Ht(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function zt(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=Ht(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)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function Vt(t){return(t=Ht(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 Wt(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function Gt(t,e,i,s){if(!function(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&h<=1&&[t[0]+n[0]*h,t[1]+n[1]*h]}var Yt;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(Yt||(Yt={}));const Xt=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function $t(t,e,i){if(t&&e){if(!i)return!(t.x1>e.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function qt(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Zt({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Jt(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Qt(t,e){const i=e?jt(t.angle):t.angle,s=Jt(t);return[Zt({x:t.x1,y:t.y1},i,s),Zt({x:t.x2,y:t.y1},i,s),Zt({x:t.x2,y:t.y2},i,s),Zt({x:t.x1,y:t.y2},i,s)]}function te(t,e,i=!1){const s=Qt(t,i),n=Qt(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Jt(t),Jt(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),u=i?jt(t.angle):t.angle;let d=i?jt(90-t.angle):t.angle+bt;const p=i?jt(e.angle):e.angle;let g=i?jt(90-e.angle):e.angle+bt;d>St&&(d-=St),g>St&&(g-=St);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(qt(n,i)+qt(n,s))/2>qt(n,a)};return f((t.x2-t.x1)/2,u,h,c)&&f((t.y2-t.y1)/2,d,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}function ee(t,e,i,s,n,r){if(r>e&&r>s||rn?o:0}const ie=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"};function se(t,e={},i){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")}class ne{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(d(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),d(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),d(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=se(this.textSpec),this._contextSaved=!0,this._context=t)}return!d(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:u,textBaseline:d=(null!=u?u:"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:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:d,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(d(t))return{width:0,height:0};if(d(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,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}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(d(this._numberCharSize)){const t=this._standardMethod(ne.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/ne.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return d(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(ne.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(d(this._letterCharSize)){const t=this._standardMethod(ne.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/ne.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}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)}}ne.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",ne.NUMBERS_CHAR_SET="0123456789",ne.FULL_SIZE_CHAR="字";const re=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),ae=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=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(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=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(t=0,e=0,i=0,s=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(t=0,e=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(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return oe(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 he extends le{}class ce extends le{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return te(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new ce(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Zt({x:this.x1,y:this.y1},this.angle,t),Zt({x:this.x2,y:this.y1},this.angle,t),Zt({x:this.x1,y:this.y2},this.angle,t),Zt({x:this.x2,y:this.y2},this.angle,t)]}}class ue{constructor(t=1,e=0,i=0,s=1,n=0,r=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 ue,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,u=s*this.e-n*this.f+r,d=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=u,this.f=d,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,u=o*t+h*e,d=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,f=o*n+h*r+this.f;return this.a=c,this.b=u,this.c=d,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new ue;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,u=-n/l,d=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:f,y:m}=t;e.x=f*h+m*u+p,e.y=f*c+m*d+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new ue(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=180*r.rotateDeg/Math.PI,r}}class de{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 pe(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 ge(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 fe=/^#([0-9a-f]{3,8})$/,me={transparent:4294967040},ve={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 ye(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function _e(t){return S(t)?new we(t>>16,t>>8&255,255&t,1):_(t)?new we(t[0],t[1],t[2]):new we(255,255,255)}function be(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function xe(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const Se=(t,e)=>{const i=fe.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new we((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?_e(t):8===e?new we(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class Ae{static Brighter(t,e=1){return 1===e?t:new Ae(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new Ae(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof Ae?t:new Ae(t);switch(e){case"hsv":default:return i.getHSVBrightness();case"hsl":return i.getHSLBrightness();case"lum":return i.getLuminance();case"lum2":return i.getLuminance2();case"lum3":return i.getLuminance3();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(me[t]))return function(t){return S(t)?new we(t>>>24,t>>>16&255,t>>>8&255,255&t):_(t)?new we(t[0],t[1],t[2],t[3]):new we(255,255,255,1)}(me[t]);if(p(ve[t]))return _e(ve[t]);const e=`${t}`.trim().toLowerCase(),i=Se(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new we(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=pe(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new we(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=Ae.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new we(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=ge(this.color.r,this.color.g,this.color.b),r=pe(d(t)?n.h:ct(t,0,360),d(e)?n.s:e>=0&&e<=1?100*e:e,d(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new we(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!d(t)&&(this.color.r=t),!d(e)&&(this.color.g=e),!d(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=Se(e,!0);return null!=i?i:this}setColorName(t){const e=ve[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(t=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}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new Ae(this.color.toString())}copyGammaToLinear(t,e=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,e=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=be(t.color.r),this.color.g=be(t.color.g),this.color.b=be(t.color.b),this}copyLinearToSRGB(t){return this.color.r=xe(t.color.r),this.color.g=xe(t.color.g),this.color.b=xe(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class we{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`#${ye(this.r)+ye(this.g)+ye(this.b)+(1===this.opacity?"":ye(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}=ge(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function ke(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),u=Math.round(a*(1-t)+o*t);return new we(e,c,u,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:ge});function Ce(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,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 Me(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=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:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}class Be{static getInstance(){return Be.instance||(Be.instance=new Be),Be.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 Re;function Oe(t,e){const i=Ee(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 Pe{constructor(t={}){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 Ie=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Le(t){let e;if(e=Ie.exec(t))return new Pe({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 De=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Fe{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 Fe.instance||(Fe.instance=new Fe),Fe.instance}newFormat(t){const e=Le(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,u=e.type;"n"===u?(l=!0,u="g"):je[u]||(void 0===h&&(h=12),c=!0,u="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const d="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(u)?"0"+u.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(u)?this.percent:"",g=je[u],f=/[defgprstz%]/.test(u);h=void 0===h?6:/[gprs]/.test(u)?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=d,A=p,w=t;if("c"===u)A=g(w)+A,w="";else{w=+w;let t=w<0||1/w<0;if(w=isNaN(w)?m:g(Math.abs(w),h),c&&(w=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}(w)),t&&0==+w&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,A=("s"===u?De[8+Re/3]:"")+A+(t&&"("===n?")":""),f)for(e=-1,r=w.length;++ex||x>57){A=(46===x?y+w.slice(e+1):w.slice(e))+A,w=w.slice(0,e);break}}l&&!a&&(w=_(w,1/0));let k=S.length+w.length+A.length,T=k>1)+S+w+A+T.slice(k);break;default:w=T+S+w+A}return b(w)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=Le(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=Ee(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=De[8+n/3];return function(t){return s(r*t)+a}}}const je={"%":(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)=>Oe(100*t,e),r:Oe,s:function(t,e){const i=Ee(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(Re=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")+Ee(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 Ne=function(t,...e){return function(t,...e){t||(t={});let i=-1;const s=e.length;for(;++i{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.sort&&(A(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!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?"+"+$e(e,6):$e(e,4))+"-"+$e(t.getUTCMonth()+1,2)+"-"+$e(t.getUTCDate(),2)+(r?"T"+$e(i,2)+":"+$e(s,2)+":"+$e(n,2)+"."+$e(r,3)+"Z":n?"T"+$e(i,2)+":"+$e(s,2)+":"+$e(n,2)+"Z":s||i?"T"+$e(i,2)+":"+$e(s,2)+"Z":"")}function qe(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 Ge;if(h)return h=!1,We;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(;a{const s=!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))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let ei=0;function ii(t="dataset"){return ei>1e8&&(ei=0),t+"_"+ei++}class si{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:ii("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 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()}}class ni{constructor(t,e){let i;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=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&z(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:ii("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){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,e=!0){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)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}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,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&z(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof ni||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!1){this._fields=t&&e?j({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!d(this._fields)&&d(i)?(this.dataSet.registerTransform("fields",Ve),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}class ri{static GenAutoIncrementId(){return ri.auto_increment_id++}}ri.auto_increment_id=0;class ai{constructor(t){this.id=ri.GenAutoIncrementId(),this.registry=t}}const oi="named",li="inject",hi="multi_inject",ci="inversify:tagged",ui="inversify:paramtypes";class di{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===oi?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var pi=function(t){var e;return function(t){const e="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),s=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),n=new WeakMap;function r(t,e,i){let r=n.get(t);if(h(r)){if(!i)return;r=new s,n.set(t,r)}let a=r.get(e);if(h(a)){if(!i)return;a=new s,r.set(e,a)}return a}function a(t,e,i){if(o(t,e,i))return!0;const s=f(e);return!c(s)&&a(t,s,i)}function o(t,e,i){const s=r(e,i,!1);return!h(s)&&!!s.has(t)}function l(t,e,i){if(o(t,e,i))return function(t,e,i){const s=r(e,i,!1);if(!h(s))return s.get(t)}(t,e,i);const s=f(e);return c(s)?void 0:l(t,s,i)}function h(t){return void 0===t}function c(t){return null===t}function u(t){return"object"==typeof t?null!==t:"function"==typeof t}function d(t,i){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const s=3===i?"string":5===i?"number":"default",n=function(t,e){const i=t[e];if(null!=i){if(!g(i))throw new TypeError;return i}}(t,e);if(void 0!==n){const e=n.call(t,s);if(u(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(g(e)){const i=e.call(t);if(!u(i))return i}const i=t.valueOf;if(g(i)){const e=i.call(t);if(!u(e))return e}}else{const e=t.valueOf;if(g(e)){const i=e.call(t);if(!u(i))return i}const i=t.toString;if(g(i)){const e=i.call(t);if(!u(e))return e}}throw new TypeError}(t,"default"===s?"number":s)}function p(t){const e=d(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function g(t){return"function"==typeof t}function f(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const s=t.prototype,n=s&&Object.getPrototypeOf(s);if(null==n||n===Object.prototype)return e;const r=n.constructor;return"function"!=typeof r||r===t?e:r}t("defineMetadata",(function(t,e,i,s){if(!u(i))throw new TypeError;return n=t,a=e,void r(i,s,!0).set(n,a);var n,a})),t("hasMetadata",(function(t,e,i){if(!u(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!u(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!u(e))throw new TypeError;return h(i)||(i=p(i)),l(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function gi(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};pi.hasOwnMetadata(t,e)&&(r=pi.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,pi.defineMetadata(t,r,e)}(ci,t,i.toString(),s)}function fi(t){return(e,i,s)=>{gi(e,0,s,t)}}function mi(t){return e=>(i,s,n)=>fi(new di(t,e))(i,s,n)}const vi=mi(li),yi=mi(hi);function _i(){return function(t){return pi.defineMetadata(ui,null,t),t}}function bi(t){return fi(new di(oi,t))}const xi="Singleton",Si="Transient",Ai="ConstantValue",wi="DynamicValue",ki="Factory",Ti="Function",Ci="Instance",Mi="Invalid";class Bi{constructor(t,e){this.id=ri.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=Mi,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new Bi(this.serviceIdentifier,this.scope);return t.activated=t.scope===xi&&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 Ei{getConstructorMetadata(t){return{compilerGeneratedMetadata:pi.getMetadata(ui,t),userGeneratedMetadata:pi.getMetadata(ci,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const Ri=(Oi=oi,t=>{const e=e=>{if(null==e)return!1;if(e.key===Oi&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const Li=Symbol("ContributionProvider");class Di{constructor(t,e){this.serviceIdentifier=t,this.container=e,ji.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function Fi(t,e){t(Li).toDynamicValue((({container:t})=>new Di(e,t))).inSingletonScope().whenTargetNamed(e)}class ji{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}ji.store=new Map;class Ni{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 Ui extends Ni{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const Hi=Symbol.for("EnvContribution"),zi=Symbol.for("VGlobal"),Vi=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Si,this.options=e,this.id=ri.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new Ei}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,oi,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new Bi(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new Ii(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[li],multiInject:s[hi]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:a,metadata:e,bindings:l};n.push(t)}}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case Ai:case Ti:e=t.cache;break;case Ci: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===xi&&(t.cache=e,t.activated=!0)}},Wi=Symbol.for("RenderService");const Gi=new class{get renderService(){return this._renderService||(this._renderService=Vi.get(Wi)),this._renderService}};let Yi=0;class Xi{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=Gi.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++Yi,t),this.tryRunAnimationFrameNextFrame(),Yi}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class $i{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var Ki=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qi=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zi=function(t,e){return function(i,s){e(i,s,t)}},Ji=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 Qi=class extends $i{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}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){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=ri.GenAutoIncrementId(),this.hooks={onSetEnv:new Ui(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}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)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new Xi);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}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)}loadFont(t,e,i){return Ji(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}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,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var ts,es,is,ss;Qi=Ki([_i(),Zi(0,vi(Li)),Zi(0,bi(Hi)),qi("design:paramtypes",[Object])],Qi),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(ts||(ts={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(es||(es={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(is||(is={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(ss||(ss={}));const ns=xt-1e-8;class rs{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>ns)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,u=-1/0,d=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),lu&&(u=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=xt)<0&&(s+=xt),(n%=xt)<0&&(n+=xt),nn;++o,a-=bt)g(a);else for(a=s-s%bt+bt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const os=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,ls={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},hs={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let cs,us,ds,ps,gs,fs;var ms,vs,ys,_s,bs,xs;function Ss(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,u=o*r,d=l*a,p=Math.cos(s),g=Math.sin(s),f=Math.cos(n),m=Math.sin(n),v=.5*(n-s),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,w=S+_*m,k=A-_*f;return[h*b+c*x,u*b+d*x,h*w+c*k,u*w+d*k,h*S+c*A,u*S+d*A]}function As(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=jt(a),c=Math.sin(h),u=Math.cos(h),d=u*(o-t)*.5+c*(l-e)*.5,p=u*(l-e)*.5-c*(o-t)*.5;let g=d*d/((i=Math.abs(i))*i)+p*p/((s=Math.abs(s))*s);g>1&&(g=Math.sqrt(g),i*=g,s*=g);const f=u/i,m=c/i,v=-c/s,y=u/s,_=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 w=Math.sqrt(A);r===n&&(w=-w);const k=.5*(_+x)-w*(S-b),T=.5*(b+S)+w*(x-_),C=Math.atan2(b-T,_-k);let M=Math.atan2(S-T,x-k)-C;M<0&&1===r?M+=xt:M>0&&0===r&&(M-=xt);const B=Math.ceil(Math.abs(M/(bt+.001))),E=[];for(let t=0;te.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 ks(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=Os(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Ct(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Tt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Ct(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Tt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function Is(t,e){const{p0:i,p1:s}=t,n=Ft.pointAtPP(i,s,e);return[new Ls(i,n),new Ls(n,s)]}class Ls extends Ts{constructor(t,e){super(),this.type=bs.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return Ft.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=wt(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?Ft.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===_s.ROW?At(this.p0.x-this.p1.x):t===_s.COLUMN?At(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class Ds{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new Ps(new Dt(this._lastX,this._lastY),new Dt(t,e),new Dt(i,s),new Dt(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new Ls(new Dt(this._lastX,this._lastY),new Dt(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===_s.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return At(t.p0.y-s.y)}if(t===_s.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return At(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class Fs extends Ds{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 js(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function Ns(t,e,i){const s=null!=e?e:At(i[i.length-1].x-i[0].x)>At(i[i.length-1].y-i[0].y)?_s.ROW:_s.COLUMN;return"monotoneY"===t?new Fs(t,s):new Ds(t,s)}class Us{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 Hs(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Ns("linear",i,t);return function(t,e){js(t,e,1)}(new Us(n,s),t),n}function zs(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 Vs{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&&zs(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:zs(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 Ws(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Hs(t,e);const n=Ns("basis",i,t);return function(t,e){js(t,e,2)}(new Vs(n,s),t),n}function Gs(t){return t<0?-1:1}function Ys(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(Gs(r)+Gs(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Xs(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function $s(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 Ks{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:$s(this,this._t0,Xs(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,$s(this,Xs(this,e=Ys(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:$s(this,this._t0,e=Ys(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 qs extends Ks{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Zs(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Hs(t,e);const n=Ns("monotoneX",i,t);return function(t,e){js(t,e,2)}(new Ks(n,s),t),n}function Js(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Hs(t,e);const n=Ns("monotoneY",i,t);return function(t,e){js(t,e,2)}(new qs(n,s),t),n}let Qs=class{constructor(t,e=.5,i){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;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):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()}};class tn extends Qs{lineEnd(){this.context.closePath()}}function en(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Ds("step",null!=s?s:At(t[t.length-1].x-t[0].x)>At(t[t.length-1].y-t[0].y)?_s.ROW:_s.COLUMN);return sn(new Qs(r,e,n),t),r}function sn(t,e){return js(t,e,1)}class nn extends Us{lineEnd(){this.context.closePath()}}function rn(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Ns("linear",i,t);return function(t,e){js(t,e,1)}(new nn(n,s),t),n}function an(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>yt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>yt){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function on(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return Hs(i,n);const o=Ns(t,r,i);return js(new e(o,s,a),i,2),o}}const ln=on("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:an(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const hn=on("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:an(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class cn extends Ts{constructor(t,e,i){super(),this.type=bs.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return Rs(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,Cs([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===_s.ROW?At(this.p0.x-this.p2.x):t===_s.COLUMN?At(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Tt(t-.01,0),i=Ct(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return wt(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=Rs(i,s,n,e),a=Ft.pointAtPP(i,s,e),o=Ft.pointAtPP(s,n,e);return[new cn(i,a,r),new cn(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class un{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new Ls(new Dt(this._lastX,this._lastY),new Dt(t,e))}quadraticCurveTo(t,e,i,s){const n=new cn(new Dt(this._lastX,this._lastY),new Dt(t,e),new Dt(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new Ps(new Dt(this._lastX,this._lastY),new Dt(t,e),new Dt(i,s),new Dt(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function dn(t,e,i){var s,n;switch(e){case"linear":default:return Hs(t,i);case"basis":return Ws(t,i);case"monotoneX":return Zs(t,i);case"monotoneY":return Js(t,i);case"step":return en(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Ds("step",null!=s?s:At(t[t.length-1].x-t[0].x)>At(t[t.length-1].y-t[0].y)?_s.ROW:_s.COLUMN);return sn(new tn(r,e,n),t),r}(t,.5,i);case"stepBefore":return en(t,0,i);case"stepAfter":return en(t,1,i);case"catmullRom":return ln(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return hn(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return rn(t,i)}}class pn extends as{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new rs(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([hs.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([hs.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([hs.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([hs.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([hs.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([hs.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([hs.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([hs.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([hs.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()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new un(this);ks(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[hs.M]=t=>`M${t[1]} ${t[2]}`,t[hs.L]=t=>`L${t[1]} ${t[2]}`,t[hs.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[hs.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[hs.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3];((t,e,i,s,n,r,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,u=(i%l+l)%l;o?(u>=h&&(u-=l),c=u-h):(u<=h&&(u+=l),c=u-h);const d=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/d;for(let e=0;e`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[hs.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;tfs){let t,e=ds;for(let s=1,r=i.length;s{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,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,u=0,d=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),ks(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===_s.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return At(t.p0.y-e.p1.y)}if(this.direction===_s.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return At(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{it.getInstance().warn("空函数")}}),Rn=Object.assign(Object.assign({},An),{points:[],cornerRadius:0,closePath:!0}),On=Object.assign(Object.assign({},An),{width:100,height:100,spikes:5,thickness:.5}),Pn=Object.assign(Object.assign({},An),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},An),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const In=Object.assign(Object.assign({},An),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),Ln=Object.assign(Object.assign(Object.assign({},An),bn),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Dn=Object.assign(Object.assign(Object.assign({},An),bn),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",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}),Fn=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0,maxWidth:500,maxHeight:500},An),{fill:!0,cornerRadius:0,cornerType:"round"}),jn=Object.assign(Object.assign({},Fn),{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}),Nn=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:d(p)}}();return v(t.endCall)||i("Missing )"),s}}(s)}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,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=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=u();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=u();return t||i("Missing positioning value"),t}}function u(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function d(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=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 s=v(e);if(s)return{type:t,value:s[i]}}function v(t){const i=/^[\n\r\t\s]+/.exec(e);i&&y(i[0].length);const s=t.exec(e);return s&&y(s[0].length),s}function y(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=d(s);return e.length>0&&i("Invalid input not EOF"),t}()}}();class Un{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(Un.IsGradientStr(t))try{const e=Nn(t)[0];if(e){if("linear"===e.type)return Un.ParseLinear(e);if("radial"===e.type)return Un.ParseRadial(e);if("conic"===e.type)return Un.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=_t/2,n=parseFloat(e.value)/180*_t-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+St,stops:Un.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:Un.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=_t/2;let n="angular"===e.type?parseFloat(e.value)/180*_t:0;for(;n<0;)n+=St;for(;n>=St;)n-=St;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,u,d):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,u,d):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,u;const d=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(u=e.r1)&&void 0!==u?u:.5));return e.stops.forEach((t=>{d.addColorStop(t.offset,t.color)})),d}(t,c,p,g,u,d))}return h||"orange"}const Vn={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"}},Wn=!0,Gn=!1,Yn=/\w|\(|\)|-/,Xn=/[.?!,;:/,。?!、;:]/,$n=/\S/,Kn=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function qn(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=Gi.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=Zn(t,a)),a}function Zn(t,e,i=!1){let s=e;for(;Yn.test(t[s-1])&&Yn.test(t[s])||Xn.test(t[s]);)if(s--,s<=0)return i?Jn(t,e):e;return s}function Jn(t,e){let i=e;for(;Yn.test(t[i+1])&&Yn.test(t[i])||Xn.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Qn(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=Gi.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}var tr=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 er=class{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=Ln.fontSize}){let i=0,s=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 a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=Zn(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_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){if(s===n){it.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}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),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);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}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),u=this.measureTextWidth(c,e);return h+u>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,u,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,a=!1){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=Zn(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}};er=tr([_i()],er);var ir=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 sr=Symbol.for("TextMeasureContribution");let nr=class extends er{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}};nr=ir([_i()],nr);const rr=Symbol.for("CanvasFactory"),ar=Symbol.for("Context2dFactory");function or(t){return Vi.getNamed(rr,Gi.global.env)(t)}const lr=1e-4,hr=Math.sqrt(3),cr=1/3;function ur(t){return t>-wr&&twr||t<-wr}const pr=[0,0],gr=[0,0],fr=[0,0];function mr(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function vr(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function yr(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 _r(t){return(t%=St)<0&&(t+=St),t}function br(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+u&&c>s+u&&c>r+u&&c>o+u||ct+u&&h>i+u&&h>n+u&&h>a+u||h=0&&pi||c+hn&&(n+=St);let u=Math.atan2(l,o);return u<0&&(u+=St),u>=s&&u<=n||u+St>=s&&u+St<=n}function Ar(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(ur(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 Tr=[-1,-1,-1],Cr=[-1,-1];function Mr(){const t=Cr[0];Cr[0]=Cr[1],Cr[1]=t}function Br(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=u*u-4*c*d;if(ur(t)){const t=u/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*(-u+e),s=c*o+1.5*a*(-u-e);i=i<0?-Math.pow(-i,cr):Math.pow(i,cr),s=s<0?-Math.pow(-s,cr):Math.pow(s,cr);const n=(-o-(i+s))/(3*a);n>=0&&n<=1&&(r[p++]=n)}else{const t=(2*c*o-3*a*u)/(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+hr*Math.sin(e)))/(3*a),h=(-o+i*(s-hr*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,Tr);if(0===c)return 0;let u=0,d=-1,p=0,g=0;for(let h=0;h1&&Mr(),p=yr(e,s,r,o,Cr[0]),d>1&&(g=yr(e,s,r,o,Cr[1]))),2===d?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(ur(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,Tr);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=vr(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Tr[0]=-l,Tr[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=St-1e-4){s=0,n=St;const e=r?1:-1;return a>=Tr[0]+t&&a<=Tr[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=St,n+=St);let c=0;for(let e=0;e<2;e++){const i=Tr[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=St+t),(t>=s&&t<=n||t+St>=s&&t+St<=n)&&(t>_t/2&&t<1.5*_t&&(e=-e),c+=e)}}return c}function Or(t){return Math.round(t/_t*1e8)/1e8%2*_t}function Pr(t,e){let i=Or(t[0]);i<0&&(i+=St);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=St?n=i+St:e&&i-n>=St?n=i-St:!e&&i>n?n=i+(St-Or(i-n)):e&&i1&&(i||(h+=ee(c,u,d,p,s,n))),g&&(c=a[1],u=a[2],d=c,p=u);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;Ir[0]=S,Ir[1]=A,Pr(Ir,Boolean(a[6])),S=Ir[0],A=Ir[1];const w=S,k=A-S,T=!!(1-(a[6]?0:1)),C=(s-m)*y/y+m;switch(f){case hs.M:d=m,p=v,c=d,u=p;break;case hs.L:if(i){if(Ar(c,u,m,v,e,s,n))return!0}else h+=ee(c,u,m,v,s,n)||0;c=m,u=v;break;case hs.C:if(i){if(xr(c,u,m,v,y,_,b,x,e,s,n))return!0}else h+=Br(c,u,m,v,y,_,b,x,s,n)||0;c=b,u=x;break;case hs.Q:if(i){if(br(c,u,m,v,y,_,e,s,n))return!0}else h+=Er(c,u,m,v,y,_,s,n)||0;c=y,u=_;break;case hs.A:if(o=Math.cos(w)*y+m,l=Math.sin(w)*y+v,g?(d=o,p=l):h+=ee(c,u,o,l,s,n),i){if(Sr(m,v,y,w,w+k,T,e,C,n))return!0}else h+=Rr(m,v,y,w,w+k,T,C,n);c=Math.cos(w+k)*y+m,u=Math.sin(w+k)*y+v;break;case hs.R:if(d=c=m,p=u=v,o=d+y,l=p+_,i){if(Ar(d,p,o,p,e,s,n)||Ar(o,p,o,l,e,s,n)||Ar(o,l,d,l,e,s,n)||Ar(d,l,d,p,e,s,n))return!0}else h+=ee(o,p,o,l,s,n),h+=ee(d,l,d,p,s,n);break;case hs.Z:if(i){if(Ar(c,u,d,p,e,s,n))return!0}else h+=ee(c,u,d,p,s,n);c=d,u=p}}return i||(g=u,f=p,Math.abs(g-f)=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jr=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Nr=Symbol.for("VWindow"),Ur=Symbol.for("WindowHandlerContribution");let Hr=class extends $i{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(){super(),this.hooks={onChange:new Ui(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(Vi.getNamed(Ur,t.env).configure(this,t),this.actived=!0)},this._uid=ri.GenAutoIncrementId(),this.global=Gi.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}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.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}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&&at(this.width,t.width())&&at(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)}};Hr=Fr([_i(),jr("design:paramtypes",[])],Hr);var zr=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vr=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wr=function(t,e){return function(i,s){e(i,s,t)}};let Gr=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=Gi.global,this._textMeasureMap=new Map,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}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||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=Dr.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="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:bn.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new ne(Object.assign({defaultFontParams:{fontFamily:bn.fontFamily,fontSize:bn.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+ne.ALPHABET_CHAR_SET+ne.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=Vi.get(Nr),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 Yr;Gr=zr([_i(),Wr(0,vi(Li)),Wr(0,bi(sr)),Vr("design:paramtypes",[Object])],Gr),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Yr||(Yr={}));const Xr=new ue;let $r=class{constructor(){this.matrix=new ue}init(t){return this.mode=Yr.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Yr.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Xr.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(Xr.a,Xr.b,Xr.c,Xr.d,Xr.e,Xr.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Xr.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(Xr.a,Xr.b,Xr.c,Xr.d,Xr.e,Xr.f),this}scale(t,e,i){return this.mode===Yr.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Yr.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Xr.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Xr.a,Xr.b,Xr.c,Xr.d,Xr.e,Xr.f),this}translate(t,e){return this.mode===Yr.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Yr.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};$r=zr([_i(),Vr("design:paramtypes",[])],$r);const Kr={arc:wn,area:kn,circle:Tn,line:Bn,path:En,symbol:In,text:Ln,rect:Pn,polygon:Rn,star:On,richtext:Dn,richtextIcon:jn,image:Fn,group:Cn,glyph:Mn},qr=Object.keys(Kr);function Zr(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Jr={arc:Object.assign({},Kr.arc),area:Object.assign({},Kr.area),circle:Object.assign({},Kr.circle),line:Object.assign({},Kr.line),path:Object.assign({},Kr.path),symbol:Object.assign({},Kr.symbol),text:Object.assign({},Kr.text),rect:Object.assign({},Kr.rect),polygon:Object.assign({},Kr.polygon),star:Object.assign({},Kr.star),richtext:Object.assign({},Kr.richtext),richtextIcon:Object.assign({},Kr.richtextIcon),image:Object.assign({},Kr.image),group:Object.assign({},Kr.group),glyph:Object.assign({},Kr.glyph)};class Qr{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},qr.forEach((t=>{this._defaultTheme[t]=Object.create(Jr[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,i=!1){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,it.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;qr.forEach((s=>{const n=Object.create(Jr[s]);t&&t[s]&&Zr(n,t[s]),i[s]&&Zr(n,i[s]),e[s]&&Zr(n,e[s]),this.combinedTheme[s]=n})),e.common&&qr.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 ta=new Qr;function ea(t,e){return t.glyphHost?ea(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)):ta.getTheme()}return null}(t)||t.attachedThemeGraphic&&ea(t.attachedThemeGraphic)||ta.getTheme()}var ia=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 sa 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=ri.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){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,e=!1){return ia(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,e=!0){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,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)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===t||t===e)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===t)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,e=!1){let 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,e=!1){let 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,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof aa))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(ca(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 aa))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=ca(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 aa))return void it.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=ca(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 aa))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=ca(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 aa))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=ha.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(ca(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(ca(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,ca(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(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 aa))return void it.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"):ca(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 oa))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,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=ha.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.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),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 ua(s,{clickInterval:a,supportsTouchEvents:o}),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 aa,this.rootWheelEvent=new oa,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&&y(t)&&!P(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.addEventListener("pointermove",this.onPointerMove,!0),t.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.addEventListener("mousemove",this.onPointerMove,!0),t.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.removeEventListener("pointermove",this.onPointerMove,!0),t.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.removeEventListener("mousemove",this.onPointerMove,!0),t.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 fa{static GetImage(t,e){var i;const s=fa.cache.get(t);s?"fail"===s.loadState?Gi.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):fa.loadImage(t,e)}static GetSvg(t,e){var i;let s=fa.cache.get(t);s?"fail"===s.loadState?Gi.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"},fa.cache.set(t,s),s.dataPromise=Gi.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.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=fa.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},fa.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Gi.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Gi.global.loadBlob(t):"json"===e&&(i.dataPromise=Gi.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!fa.isLoading&&fa.toLoadAueue.length){fa.isLoading=!0;const t=fa.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(fa.cache.set(i,n),n.dataPromise=Gi.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))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{fa.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),fa.loading()})).catch((t=>{console.error(t),fa.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),fa.loading()}))}}),0)}static loadImage(t,e){const i=ma(t,fa.toLoadAueue);if(-1!==i)return fa.toLoadAueue[i].marks.push(e),void fa.loading();fa.toLoadAueue.push({url:t,marks:[e]}),fa.loading()}static improveImageLoading(t){const e=ma(t,fa.toLoadAueue);if(-1!==e){const t=fa.toLoadAueue.splice(e,1);fa.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function ma(t,e){for(let i=0;it?_(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(_a[0]=t[0],_a[2]=t[0],_a[1]=t[1],_a[3]=t[1],_a):t:t:0,xa=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Sa=[1,2,3,0,1,2,3,0];function Aa(t,e,i,s){for(;t>=St;)t-=St;for(;t<0;)t+=St;for(;t>e;)e+=St;xa[0].x=i,xa[1].y=i,xa[2].x=-i,xa[3].y=-i;const n=Math.ceil(t/bt)%4,r=Math.ceil(e/bt)%4;if(s.add(kt(t)*i,Mt(t)*i),s.add(kt(e)*i,Mt(e)*i),n!==r||e-t>_t){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new Dt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new Dt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{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)}}Ca.TimeOut=1e3/60;const Ma=new Ca,Ba=(t,e)=>{const i=((t,e)=>y(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};class Ea{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}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function Ra(t,e,i,s,n){return n?t.arc(i,s,e,0,xt,!1,n):t.arc(i,s,e,0,xt),!1}var Oa=new class extends Ea{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 Ra(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Ra(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(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 Pa=new class extends Ea{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,this.parseSize(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,this.parseSize(e)/6,i,s,n,r)}};function Ia(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 La=new class extends Ea{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 Ia(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return Ia(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Ia(t,this.parseSize(e)/2+n,i,s,r)}};function Da(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Fa=new class extends Ea{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Da(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Da(t,this.parseSize(e)/2+n,i,s)}};function ja(t,e,i,s,n=0){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}class Na extends Ea{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 ja(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return ja(t,this.parseSize(e)/2,i,s,n)}}var Ua=new Na;var Ha=new class extends Na{constructor(){super(...arguments),this.type="triangle"}};const za=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Va=Math.sin(xt/10)*za,Wa=-Math.cos(xt/10)*za;function Ga(t,e,i,s){const n=Va*e,r=Wa*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=xt*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 Ya=new class extends Ea{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 Ga(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ga(t,this.parseSize(e)/2+n,i,s)}};const Xa=Bt(3);function $a(t,e,i,s){const n=e,r=n/Xa,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 Ka=new class extends Ea{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 $a(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return $a(t,this.parseSize(e)/2+n,i,s)}};function qa(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 Za=new class extends Ea{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return qa(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return qa(t,this.parseSize(e)/2+n,i,s)}};function Ja(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Qa=new class extends Ea{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Ja(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Ja(t,this.parseSize(e)/2+n,i,s)}};const to=-.5,eo=Bt(3)/2,io=1/Bt(12);function so(t,e,i,s){const n=e/2,r=e*io,a=n,o=e*io+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(to*n-eo*r+i,eo*n+to*r+s),t.lineTo(to*a-eo*o+i,eo*a+to*o+s),t.lineTo(to*l-eo*h+i,eo*l+to*h+s),t.lineTo(to*n+eo*r+i,to*r-eo*n+s),t.lineTo(to*a+eo*o+i,to*o-eo*a+s),t.lineTo(to*l+eo*h+i,to*h-eo*l+s),t.closePath(),!1}var no=new class extends Ea{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 so(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return so(t,this.parseSize(e)/2+n,i,s)}};function ro(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}var ao=new class extends Ea{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 ro(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return ro(t,this.parseSize(e)/2,i,s,n)}};function oo(t,e,i,s,n=0){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}var lo=new class extends Ea{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 oo(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return oo(t,this.parseSize(e)/2,i,s,n)}};function ho(t,e,i,s,n=0){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}var co=new class extends Ea{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 ho(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return ho(t,this.parseSize(e)/2,i,s,n)}};const uo=Bt(3);function po(t,e,i,s){const n=e*uo;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var go=new class extends Ea{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return po(t,this.parseSize(e)/2/uo,i,s)}drawOffset(t,e,i,s,n){return po(t,this.parseSize(e)/2/uo+n,i,s)}};function fo(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 mo=new class extends Ea{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 fo(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return fo(t,this.parseSize(e)/4+n,i,s)}};function vo(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 yo=new class extends Ea{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 vo(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return vo(t,this.parseSize(e)/4+n,i,s)}};function _o(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 bo=new class extends Ea{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 _o(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return _o(t,this.parseSize(e)/4+n,i,s)}};function xo(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 So=new class extends Ea{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 xo(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return xo(t,this.parseSize(e)/4+n,i,s)}};function Ao(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var wo=new class extends Ea{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return Ao(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Ao(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function ko(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var To=new class extends Ea{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return ko(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return ko(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function Co(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 Mo=new class extends Ea{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 Co(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Co(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function Bo(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function Eo(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var Ro=new class extends Ea{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)?Eo(t,e,i,s):Bo(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?Eo(t,e+2*n,i,s):Bo(t,[e[0]+2*n,e[1]+2*n],i,s)}};const Oo=new he;class Po{constructor(t,e,i=!1){this.pathStr="",this.type=t,_(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),ks(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(ks(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{Oo.x1=i.bounds.x1*t,Oo.y1=i.bounds.y1*t,Oo.x2=i.bounds.x2*t,Oo.y2=i.bounds.y2*t,e.union(Oo)}))}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 Io={};[Oa,Pa,La,Fa,go,Ha,Ya,Ka,Za,Qa,no,ao,lo,Ua,co,mo,yo,bo,So,Ro,wo,To,Mo].forEach((t=>{Io[t.type]=t}));const Lo={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"};class Do{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 Fo(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function jo(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",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=jo(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=Fo(t,"--\x3e",r+4,"Comment is not closed.");else{const a=jo(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 Do(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 Do(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 Ho(t,e){return zo(t)}function zo(t,e){const i={};for(let e=0;eZo.set(t,!0)));const Jo=new Map;function Qo(t){if(Zo.has(t))return!0;if(Jo.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>Jo.set(t,!0)));const tl=Ko(),el=Ko(),il=Ko(),sl=Ko(),nl=Ko(),rl=Ko(),al=Ko(),ol=Ko(),ll=Ko(),hl=Ko();Ko();const cl=Ko();Ko();const ul=Ko();Ko();const dl=Ko(),pl=Ko(),gl=Symbol.for("GraphicService"),fl=Symbol.for("GraphicCreator"),ml={"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"},vl=Object.keys(ml),yl={duration:200,easing:"cubicOut"};function _l(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}function bl(t,e,i){const s=i[0],n=i[1],r=i[2];let a,o,l,h,c,u,d,p,g,f,m,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],u=e[5],d=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]=u,t[6]=d,t[7]=p,t[8]=g,t[9]=f,t[10]=m,t[11]=v,t[12]=a*s+c*n+g*r+e[12],t[13]=o*s+u*n+f*r+e[13],t[14]=l*s+d*n+m*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function xl(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 Sl(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],u=e[8],d=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]=_*s+b*o+x*u+S*f,t[1]=_*n+b*l+x*d+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]=_*s+b*o+x*u+S*f,t[5]=_*n+b*l+x*d+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]=_*s+b*o+x*u+S*f,t[9]=_*n+b*l+x*d+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]=_*s+b*o+x*u+S*f,t[13]=_*n+b*l+x*d+S*m,t[14]=_*r+b*h+x*p+S*v,t[15]=_*a+b*c+x*g+S*y,t}function Al(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 wl{constructor(){this.pools=[]}static identity(t){return _l(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 wl.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},Ml=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Bl=new ue(1,0,0,1,0,0),El={x:0,y:0};let Rl=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ue(1,0,0,1,0,0),this.path=new pn,this._clearMatrix=new ue(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return kl.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new ue(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(kl.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(kl.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){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,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=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(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){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},El),function(t,e,i){return Lr(t,0,!1,e,i)}(this.path.commandList,El.x,El.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},El);const i=Hn(this,this.lineWidth,this.dpr);return function(t,e,i,s){return Lr(t,e,!0,i,s)}(this.path.commandList,i,El.x,El.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(t=!0,e=this.dpr){this.setTransformFromMatrix(Bl,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>kl.free(t))),this.stack.length=0}};Rl=Cl([_i(),Ml("design:paramtypes",[Object,Number])],Rl);const Ol={WIDTH:500,HEIGHT:500,DPR:1};class Pl{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}set nativeCanvas(t){this._nativeCanvas=t}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=Ol.WIDTH,height:n=Ol.HEIGHT,dpr:r=Ol.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(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var Il;Pl.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Il||(Il={}));class Ll{static Get(t,e=Il.Color1,i=[0,0,0,1]){if(e===Il.Color1){const e=Ll.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=Ae.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];Ll.store1[t]=e,Ll.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=Ll.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=Ae.parseColorString(t);return n&&(Ll.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],Ll.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===Il.Color1){if(Ll.store1[t])return;Ll.store1[t]=i,Ll.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Ll.store255[t])return;Ll.store255[t]=i,Ll.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Dl(t,e=!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 Fl(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)=>{var a,o;return jl(_(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,_(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):jl(t,e,i,s,n)}function jl(t,e,i,s,n){if(!t||!e)return t&&Dl(t)||e&&Dl(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Ll.Get(t,Il.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Ll.Get(e,Il.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:Dl(a)})))});return o?Fl(r,l,i,s,n):Fl(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:zl(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:zl(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:zl(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),Dl(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)}function Nl(t,e,i){return`rgba(${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})`}Ll.store255={},Ll.store1={};const Ul=[0,0,0,0],Hl=[0,0,0,0];function zl(t,e,i){return Ll.Get(t,Il.Color255,Ul),Ll.Get(e,Il.Color255,Hl),`rgba(${Math.round(Ul[0]+(Hl[0]-Ul[0])*i)},${Math.round(Ul[1]+(Hl[1]-Ul[1])*i)},${Math.round(Ul[2]+(Hl[2]-Ul[2])*i)},${Ul[3]+(Hl[3]-Ul[3])*i})`}class Vl{static GetCanvas(){try{return Vl.canvas||(Vl.canvas=Gi.global.createCanvas({})),Vl.canvas}catch(t){return null}}static GetCtx(){if(!Vl.ctx){const t=Vl.GetCanvas();Vl.ctx=t.getContext("2d")}return Vl.ctx}}class Wl extends de{static getInstance(){return Wl._instance||(Wl._instance=new Wl),Wl._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=Vl.GetCanvas(),s=Vl.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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new Wl(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class Gl{static GetSize(t){for(let e=0;e=t)return Gl.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=Gl.GenKey(t,e,i,s,n),l=Gl.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=Gl.GenKey(t,e,i,s,n);Gl.cache[l]?Gl.cache[l].push({width:a,height:o,pattern:r}):Gl.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}Gl.cache={},Gl.ImageSize=[20,40,80,160,320,640,1280,2560];const Yl=new he,Xl=new ue;new he;const $l=["lineWidth","scaleX","scaleY","angle","anchor","visible"],Kl=["x","y"],ql=["scaleX","scaleY"],Zl=["angle"],Jl=new Dt,Ql={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class th extends sa{static mixin(t){const e=Object.keys(t);for(let i=0;i10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=Io[t];if(e)return e;if(e=th.userSymbolMap[t],e)return e;if(!0===((i=t=Lo[t]||t).startsWith("{const e=(new pn).fromString(t.d),i={};vl.forEach((e=>{t[e]&&(i[ml[e]]=t[e])})),n.push({path:e,attribute:i}),Yl.union(e.bounds)}));const r=Yl.width(),a=Yl.height(),o=1/Tt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new Po(t,n,!0);return th.userSymbolMap[t]=l,l}var i;const s=(new pn).fromString(t),n=s.bounds.width(),r=s.bounds.height(),a=1/Tt(n,r);s.transform(0,0,a,a);const o=new Po(t,s);return th.userSymbolMap[t]=o,o}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,s=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:n=e.boundsPadding}=i,r=ba(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new rs(t);return ks(e.commandList,i,0,0),!0}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(t=!0){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(t=!0){return this._transMatrix||(this._transMatrix=new ue),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&ms.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&ms.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&ms.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&ms.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&ms.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&ms.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=ms.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===vs.GLOBAL){const i=new Dt(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){this.setAttributes(t,e,i),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||s)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,i){t&&((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,e=!1,i){const s=Object.keys(t);for(let e=0;e{i[e]?(o||(o={}),o[e]=t[e]):a[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(r=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==r?r:yl;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:a,duration:l.duration,easing:l.easing}}]),o&&this.setAttributesAndPreventAnimate(o,!1,{type:ys.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t)}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:ys.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{type:ys.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(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,i;const s=this.attribute[t];return this.animates&&this.animates.size?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=s?s:null===(i=this.finalAttribute)||void 0===i?void 0:i[t]}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){const i=_(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);s.length!==this.currentStates.length&&this.useStates(s,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;this.stateSort&&(t=t.sort(this.stateSort));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|=ms.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=ms.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=ms.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&ms.UPDATE_SHAPE_AND_BOUNDS)===ms.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=ms.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=ms.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=ms.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=ms.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=ms.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=ms.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=ms.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&ms.UPDATE_LAYOUT)}getAnchor(t,e,i){const s=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=mn.x,y:e=mn.y,scaleX:i=mn.scaleX,scaleY:s=mn.scaleY,angle:n=mn.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(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,u=e.d,d=e.e,p=e.f,g=kt(a),f=Mt(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const y=m-i,_=v-s,b=l*g+c*f,x=h*g+u*f,S=c*g-l*f,A=u*g-h*f;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*A,t.e=d+l*m+c*v-b*y-S*_,t.f=p+h*m+u*v-x*y-A*_}(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,!0),Gi.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(mn);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Xl.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.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:ys.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Gi.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),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 pn).fromString(t):this.pathProxy=new pn,this.pathProxy}loadImage(t,e=!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(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",this.stopAnimates(),Gi.graphicService.onRelease(this),super.release()}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new la(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)}}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||Gi.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new Rl(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}var eh;th.userSymbolMap={},th.mixin(da),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(eh||(eh={}));class ih extends th{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=rl,this._childUpdateTag=ms.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 Qr),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Qr)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===vs.GLOBAL){const i=new Dt(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&ms.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=mn.x,y:e=mn.y,dx:i=mn.dx,dy:s=mn.dy,scaleX:n=mn.scaleX,scaleY:r=mn.scaleY,angle:a=mn.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()}getGraphicTheme(){return ea(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return Gi.graphicService.updateTempAABBBounds(i),Gi.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=ms.CLEAR_BOUNDS,this._childUpdateTag&=ms.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=ms.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&ms.UPDATE_BOUNDS||(this._childUpdateTag|=ms.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(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().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),this.getGraphicService().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(t=!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&ms.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=Gi.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new ih(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ih.NOWORK_ANIMATE_ATTR}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}}function sh(t){return new ih(t)}ih.NOWORK_ANIMATE_ATTR=Ql;class nh extends ih{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 Qr,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!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=>{Gi.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=>{Gi.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 rh=Symbol.for("TransformUtil"),ah=Symbol.for("GraphicUtil"),oh=Symbol.for("LayerService"),lh=Symbol.for("StaticLayerHandlerContribution"),hh=Symbol.for("DynamicLayerHandlerContribution"),ch=Symbol.for("VirtualLayerHandlerContribution");var uh,dh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)};let gh=uh=class{static GenerateLayerId(){return`${uh.idprefix}_${uh.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Gi.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?Vi.get(lh):"dynamic"===t?Vi.get(hh):Vi.get(ch),e}createLayer(t,e={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 nh(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:uh.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)}};gh.idprefix="visactor_layer",gh.prefix_count=0,gh=uh=dh([_i(),ph("design:paramtypes",[])],gh);var fh=new ai((t=>{t(zi).to(Qi).inSingletonScope(),t(Nr).to(Hr),t(ah).to(Gr).inSingletonScope(),t(rh).to($r).inSingletonScope(),t(oh).to(gh).inSingletonScope()}));function mh(t,e){return!(!t&&!e)}function vh(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function yh(t,e,i){return i&&t*e>0}function _h(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function bh(t,e){return t*e>0}function xh(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Sh(t,e,i,s,n,r,a){const o=t-i,l=e-s,h=(a?r:-r)/Math.sqrt(o*o+l*l),c=h*l,u=-h*o,d=t+c,p=e+u,g=i+c,f=s+u,m=(d+g)/2,v=(p+f)/2,y=g-d,_=f-p,b=y*y+_*_,x=n-r,S=d*f-g*p,A=(_<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let w=(S*_-y*A)/b,k=(-S*y-_*A)/b;const T=(S*_+y*A)/b,C=(-S*y+_*A)/b,M=w-m,B=k-v,E=T-m,R=C-v;return M*M+B*B>E*E+R*R&&(w=T,k=C),{cx:w,cy:k,x01:-c,y01:-u,x11:w*(n/x-1),y11:k*(n/x-1)}}function Ah(t,e,i,s,n){const r=At(i-e),a=t.getParsedCornerRadius(),o=_(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:u,innerEndAngle:d,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,y=Math.max(f,g),b=Math.max(m,v);let x=y,S=b;const A=n*kt(c),w=n*Mt(c),k=s*kt(d),T=s*Mt(d);let C,M,B,E;if((b>yt||y>yt)&&(C=n*kt(u),M=n*Mt(u),B=s*kt(p),E=s*Mt(p),r<_t)){const t=function(t,e,i,s,n,r,a,o){const l=i-t,h=s-e,c=a-n,u=o-r;let d=u*l-c*h;return d*d1?0:R<-1?_t:Math.acos(R))/2),l=Bt(t[0]*t[0]+t[1]*t[1]);S=Ct(b,(s-l)/(o-1)),x=Ct(y,(n-l)/(o+1))}}var R;return{outerDeltaAngle:l,xors:A,yors:w,xirs:B,yirs:E,xore:C,yore:M,xire:k,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:y,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:u,innerDeltaAngle:h,innerEndAngle:d,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function wh(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=At(l-o),c=l>o;let u=!1;if(n=St-yt)e.moveTo(i+n*kt(o),s+n*Mt(o)),e.arc(i,s,n,o,l,!c),r>yt&&(e.moveTo(i+r*kt(l),s+r*Mt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:d,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:y,maxOuterCornerRadius:_,xore:b,yore:x,xire:S,yire:A,outerStartAngle:w,outerEndAngle:k,limitedIcr:T,innerDeltaAngle:C,innerEndAngle:M,innerStartAngle:B,innerCornerRadiusStart:E,innerCornerRadiusEnd:R,maxInnerCornerRadius:O}=Ah(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+d,s+p),u=!0;else if(m>yt){const t=Ct(v,m),r=Ct(y,m),o=Sh(g,f,d,p,n,t,Number(c)),l=Sh(b,x,S,A,n,r,Number(c));m<_&&t===r?!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),e.arc(i+o.cx,s+o.cy,m,wt(o.y01,o.x01),wt(l.y01,l.x01),!c)):e.moveTo(i+o.cx+m*kt(wt(l.y01,l.x01)),s+o.cy+m*Mt(wt(l.y01,l.x01))):!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),t>0&&e.arc(i+o.cx,s+o.cy,t,wt(o.y01,o.x01),wt(o.y11,o.x11),!c),e.arc(i,s,n,wt(o.cy+o.y11,o.cx+o.x11),wt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,wt(l.y11,l.x11),wt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*kt(wt(l.y01,l.x01)),s+l.cy+r*Mt(wt(l.y01,l.x01))):e.moveTo(i+b,s+n*Mt(k))}else!a||a[0]?(e.moveTo(i+d,s+p),e.arc(i,s,n,w,k,!c)):e.moveTo(i+n*kt(k),s+n*Mt(k));if(!(r>yt)||C<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),u=!0;else if(T>yt){const t=Ct(E,T),n=Ct(R,T),o=Sh(S,A,b,x,r,-n,Number(c)),l=Sh(d,p,g,f,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,wt(o.y01,o.x01),wt(o.y11,o.x11),!c),e.arc(i,s,r,wt(o.cy+o.y11,o.cx+o.x11),wt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,wt(l.y11,l.x11),wt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*kt(wt(l.y01,l.x01)),s+l.cy+t*Mt(wt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),!a||a[2]?e.arc(i,s,r,M,B,c):e.moveTo(i+r*kt(B),s+r*Mt(B))}return a?a[3]&&e.lineTo(i+n*kt(o),s+n*Mt(o)):e.closePath(),u}const kh=Symbol.for("ArcRenderContribution"),Th=Symbol.for("AreaRenderContribution"),Ch=Symbol.for("GroupRenderContribution"),Mh=Symbol.for("PathRenderContribution"),Bh=Symbol.for("PolygonRenderContribution"),Eh=Symbol.for("RectRenderContribution"),Rh=Symbol.for("SymbolRenderContribution"),Oh=Symbol.for("TextRenderContribution"),Ph=Symbol.for("InteractiveSubRenderContribution");function Ih(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function Lh(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}var Dh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Fh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jh=function(t,e){return function(i,s){e(i,s,t)}};function Nh(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:u=i.scaleY,scaleZ:d=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!==(s=m[2])&&void 0!==s?s:0}if(_l(t),bl(t,t,[n+o,r+l,a+h]),bl(t,t,[y[0],y[1],y[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],u=e[10],d=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+u*s,t[7]=l*n+d*s,t[8]=h*n-r*s,t[9]=c*n-a*s,t[10]=u*n-o*s,t[11]=d*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],u=e[10],d=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-u*s,t[3]=l*n-d*s,t[8]=r*s+h*n,t[9]=a*s+c*n,t[10]=o*s+u*n,t[11]=l*s+d*n}(t,t,p),bl(t,t,[-y[0],-y[1],y[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,u,d]),f){const i=Tl.allocate(),s=[0,0];if(v){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=m[1]}bl(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],u=e[6],d=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+u*s,t[3]=l*n+d*s,t[4]=h*n-r*s,t[5]=c*n-a*s,t[6]=u*n-o*s,t[7]=d*n-l*s}(i,i,f),bl(i,i,[-s[0],-s[1],0]),Sl(t,t,i)}}let Uh=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new Ui(["graphic"]),onSetStage:new Ui(["graphic","stage"]),onRemove:new Ui(["graphic"]),onRelease:new Ui(["graphic"]),onAddIncremental:new Ui(["graphic","group","stage"]),onClearIncremental:new Ui(["graphic","group","stage"]),beforeUpdateAABBBounds:new Ui(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new Ui(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new Ui(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new he,this.tempAABBBounds2=new he}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)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new rs(t);return ks(i.commandList,s,0,0),!0}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=Lh(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=Ih(n,e);i.set(s,i.y1,s+e,i.y2)}}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,u=this.tempAABBBounds1,d=this.tempAABBBounds2;if(a&&l){Xo(u,(l+h)/Math.abs(n+r),s,c),e.union(u),u.setValue(d.x1,d.y1,d.x2,d.y2)}if(o){const{shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;Xo(u,o/Math.abs(n+r)*2,!1,c+1),u.translate(s,a),e.union(u)}}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&&oe(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};Uh=Dh([_i(),jh(0,vi(fl)),Fh("design:paramtypes",[Object])],Uh);const Hh=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i};class zh{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=ts.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const u=[],d=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;u.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}d[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:d[0],height:d[1]};return this.LayoutBBox(p,e,i,u),this.layoutWithBBox(p,u,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;a{t+=e.str})),(Array.isArray(r)?r.join(""):r).toString()!==t}return"vertical"===s.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==s.text.toString():null!=this.clipedText&&this.clipedText!==s.text.toString()}get multilineLayout(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=pl,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}getGraphicTheme(){return ea(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new Wh({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Zt(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=Gi.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Xo(n,o/Math.abs(r+a),!0,l),i.union(n)}return Gi.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Gi.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,oe(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:u,stroke:d=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:y=s.ignoreBuf,keepCenterInLine:_=s.keepCenterInLine}=n,b=y?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),d&&this._AABBBounds.expand(f/2),this._AABBBounds}const S=Gi.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new zh(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:u,suffixPosition:v,measureMode:g,keepCenterInLine:_}),{bbox:w}=A;return this.cache.layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(w.xOffset,w.yOffset,w.xOffset+w.width,w.yOffset+w.height),d&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:u,stroke:d=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,measureMode:v=r.measureMode,suffixPosition:y=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),w=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),d&&this._AABBBounds.expand(p/2),this._AABBBounds}const k=Gi.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),T={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:w},C=new zh(a,T,k),M=_(t)?t.map((t=>t.toString())):[t.toString()],B=[],E=[0,0];let R=1/0;if(b>0&&(R=Math.max(Math.floor(b/w),1)),x&&(R=Math.min(R,x)),"number"==typeof u&&u!==1/0){if(u>0)for(let t=0;t{t=Math.max(t,e.width)})),E[0]=t}else{let t,e,i=0;for(let s=0,n=M.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Tt(e,a)}));const t=Ih(y,a),e=this.cache.verticalList.length*v,i=Lh(_,e,u);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>function(t){const e=[];let i=0,s="";for(let n=0;n{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:u,fontWeight:d,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:u,fontWeight:d,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===qo.HORIZONTAL?u:r.measureTextWidth(t.text,{fontSize:u,fontWeight:d,fontFamily:c});a+=e,t.width=e}))})),this.cache.verticalList=b,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Tt(e,a)}));const x=Ih(y,a),S=this.cache.verticalList.length*v,A=Lh(_,S,u);return this._AABBBounds.set(A,x,A+S,x+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=Ba(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=Vh){return super.needUpdateTags(t,e)}needUpdateTag(t,e=Vh){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new Wh(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Wh.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return Wh.baselineMapAlign}getAlignMapBaseline(){return Wh.alignMapBaseline}}function Gh(t){return new Wh(t)}Wh.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Ql),Wh.baselineMapAlign={top:"left",bottom:"right",middle:"center"},Wh.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Yh=["symbolType","size",...$l];let Xh=class t extends th{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=dl}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}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{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return ea(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Gi.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Xo(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return Gi.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){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){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,Yh)}needUpdateTag(t){return super.needUpdateTag(t,Yh)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new pn).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new pn).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function $h(t){return new Xh(t)}Xh.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Ql);const Kh=["segments","points","curveType","curveTension",...$l];let qh=class t extends th{constructor(t={}){super(t),this.type="line",this.numberType=ol}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=ka(i,s,e))}getGraphicTheme(){return ea(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),Gi.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Gi.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Kh)}needUpdateTag(t){return super.needUpdateTag(t,Kh)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new pn;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Zh(t){return new qh(t)}qh.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ql);const Jh=t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=d(t.width)?t.x1-t.x:t.width,i=d(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}},Qh=["width","x1","y1","height","cornerRadius",...$l];class tc extends th{constructor(t){super(t),this.type="rect",this.numberType=cl}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return ea(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=Gi.graphicService.updateTempAABBBounds(i);return Hh(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Gi.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Qh)}needUpdateTag(t){return super.needUpdateTag(t,Qh)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=Jh(e);return t=new pn,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new tc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return tc.NOWORK_ANIMATE_ATTR}}function ec(t){return new tc(t)}tc.NOWORK_ANIMATE_ATTR=Ql;class ic{constructor(t,e,i,s,n,r,a,o,l,h,c,u,d,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=Vn[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=u,this.singleLine=d,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}}}function sc(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class nc{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=Ba(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Qn(t,i,this.ascentDescentMode);let u=0,d=0,p=0;this.height>l&&(u=(this.height-l)/2,d=Math.ceil(u),p=Math.floor(u)),"top"===this.textBaseline?(this.ascent=u,this.descent=l-u):"bottom"===this.textBaseline?(this.ascent=l-u,this.descent=u):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+d,this.descent=h+p),this.length=t.length,this.width=c||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,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r: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}=Qn(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=qn(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Qn(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const u=sc(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},u),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let u=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,u="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=qn(h,("vertical"===u?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===u);else{const{width:e}=Qn(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===u&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:d=1}=this.character;if(this.character.stroke&&d&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=sc(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=sc(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=sc(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=sc(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===u&&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=qn(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Qn(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const rc=["width","height","image",...$l];class ac extends th{constructor(t){super(t),this.type="image",this.numberType=al,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}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()})),this.addUpdateBoundTag()}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)}getGraphicTheme(){return ea(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=Gi.graphicService.updateTempAABBBounds(i);return Hh(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Gi.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return Fn[t]}needUpdateTags(t){return super.needUpdateTags(t,rc)}needUpdateTag(t){return super.needUpdateTag(t,rc)}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},Ql);class oc 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=ba(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=ba(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=Fn.width,height:e=Fn.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 lc{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 oc?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=Vn[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof nc){const e=$n.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,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof oc)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Qn(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof oc)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof oc)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||Gn;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,Kn(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||Wn;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?zn(t,s,{AABBBounds:i}):s,Kn(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof oc)break;const{width:n}=Qn(t,s.character,s.ascentDescentMode),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.forEach(((t,e)=>{i+=t instanceof oc?t.width:t.getWidthWithEllips(this.direction)})),i}}class hc{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=Vn[this.direction]}store(t){if(t instanceof oc){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 lc(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,e=!1){t instanceof oc?"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||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=qn(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new nc(i,t.newLine,t.character,t.ascentDescentMode),new nc(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let cc=!1;try{cc=Intl&&"function"==typeof Intl.Segmenter}catch(t){cc=!1}const uc=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...$l];class dc extends th{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=ul,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Dn.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:Dn.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:Dn.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:Dn.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:Dn.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:Dn.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:Dn.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:Dn.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return ea(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&y(t.text)&&dc.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&y(t.text)&&dc.splitText(t.text).length>1)))}static splitText(t){if(cc){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=dc.splitText(t.text.toString());if(y(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(d){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(u){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),Gi.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Gi.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,Gi.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,uc)}needUpdateTag(t){return super.needUpdateTag(t,uc)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!dc.AllSingleCharacter(y)&&(y=dc.TransformTextConfig2SingleCharacter(y),this.attribute.textConfig=y);const _=[],b=null!=t?t:y;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,_.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,w="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),k="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),T=new ic(0,0,(w?n:x?i:0)||0,(k?r:A?s:0)||0,a,o,l,h,c,u||"horizontal",!w&&x,!k&&A,d||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),C=new hc(T);if(C.newLine=v,p){let t=0,e=!1;for(let i=0;i<_.length;i++){const s=_[i];e?(s.overflow=!0,s.left=1/0,s.top=1/0,!s.newLine&&T.lines[T.lines.length-1].paragraphs.push(s)):C.deal(s,!0),T.lines.length!==t&&(t=T.lines.length,C.lineBuffer.length=0,s.overflow=!0,s.left=1e3,s.top=1e3,T.lines[T.lines.length-1].paragraphs.push(s),e=!0),s.newLine&&(e=!1,C.lineWidth=0),C.send()}}else for(let t=0;t<_.length;t++)C.deal(_[t]);if(C.send(),!("horizontal"===T.layoutDirection?w:k)){const t=T.getActualSizeWidthEllipsis();let e="horizontal"===T.layoutDirection?t.width:t.height;("horizontal"===T.layoutDirection?x:A)&&(e=Math.min(e,"horizontal"===T.layoutDirection?i:s)),T.lines.forEach((function(t){t.calcOffset(e,!1)}))}v&&T.lines.forEach((t=>{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new dc(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(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())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return dc.NOWORK_ANIMATE_ATTR}}function pc(t){return new dc(t)}dc.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Ql);const gc=["path","customPath",...$l];class fc extends th{constructor(t){super(t),this.type="path",this.numberType=ll}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=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof pn?e.path:(d(this.cache)&&this.doUpdatePathShape(),this.cache instanceof pn?this.cache:t.path)}getGraphicTheme(){return ea(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=Gi.graphicService.updateTempAABBBounds(i);Hh(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return Gi.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;y(t.path,!0)?this.cache=(new pn).fromString(t.path):t.customPath&&(this.cache=new pn,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,gc)}needUpdateTag(t){return super.needUpdateTag(t,gc)}toCustomPath(){return(new pn).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new fc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return fc.NOWORK_ANIMATE_ATTR}}function mc(t){return new fc(t)}fc.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Ql);const vc=["segments","points","curveType","curveTension",...$l];class yc extends th{constructor(t){super(t),this.type="area",this.numberType=il}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}getGraphicTheme(){return ea(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),Gi.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return Gi.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),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}_interpolate(t,e,i,s,n){"points"===t&&(n.points=ka(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,vc)}needUpdateTag(t){return super.needUpdateTag(t,vc)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new pn;const 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 yc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return yc.NOWORK_ANIMATE_ATTR}}function _c(t){return new yc(t)}yc.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Ql);const bc=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...$l];class xc extends th{constructor(t){super(t),this.type="arc",this.numberType=tl}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=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(_(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();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=Nt(e),i=e+r,s&&At(r)yt&&o>yt)return{startAngle:e-n*d*r,endAngle:i+n*d*a,sc:n*d*r,ec:n*d*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{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=Bt(a*a+o*o)}=this.attribute,h=At(e-t);let c=t,u=e,d=t,p=e;const g=r/2;let f=h,m=h;if(g>yt&&l>yt){const i=e>t?1:-1;let s=Rt(Number(l)/o*Mt(g)),n=Rt(Number(l)/a*Mt(g));return(f-=2*s)>yt?(s*=i,d+=s,p-=s):(f=0,d=p=(t+e)/2),(m-=2*n)>yt?(n*=i,c+=n,u-=n):(m=0,c=u=(t+e)/2),{outerStartAngle:c,outerEndAngle:u,innerStartAngle:d,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:u,innerStartAngle:d,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}getGraphicTheme(){return ea(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Gi.graphicService.updateTempAABBBounds(i);Hh(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return Gi.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=yt?i.set(0,0,0,0):Math.abs(o-l)>St-yt?i.set(-s,-s,s,s):(Aa(l,o,s,i),Aa(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,bc)}needUpdateTag(t){return super.needUpdateTag(t,bc)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=At(o-a),u=o>a;if(h=St-yt)n.moveTo(0+h*kt(a),0+h*Mt(a)),n.arc(0,0,h,a,o,!u),l>yt&&(n.moveTo(0+l*kt(o),0+l*Mt(o)),n.arc(0,0,l,o,a,u));else{const t=h*kt(a),e=h*Mt(a),i=l*kt(o),s=l*Mt(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!u),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,u),n.closePath()}return n}clone(){return new xc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return xc.NOWORK_ANIMATE_ATTR}}function Sc(t){return new xc(t)}xc.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Ql);const Ac=["points","cornerRadius",...$l];class wc extends th{constructor(t){super(t),this.type="polygon",this.numberType=hl}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return ea(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),Gi.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return Gi.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=ka(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Ac)}needUpdateTag(t){return super.needUpdateTag(t,Ac)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new pn,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new wc(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return wc.NOWORK_ANIMATE_ATTR}}function kc(t){return new wc(t)}wc.NOWORK_ANIMATE_ATTR=Ql;class Tc extends ih{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!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 Cc(t){return new Tc(t)}const Mc=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 Bc,Ec;function Rc(t){return Bc||(Bc=Mc.CreateGraphic("text",{})),Bc.initAttributes(t),Bc.AABBBounds}var Oc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Pc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ic=function(t,e){return function(i,s){e(i,s,t)}};class Lc{constructor(){this.time=xs.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u,d){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,backgroundKeepAspectRatio:_=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip}=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=ea(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:y,backgroundKeepAspectRatio:_,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s){const{backgroundMode:n,backgroundFit:r,backgroundKeepAspectRatio:a,backgroundScale:o=1,backgroundOffsetX:l=0,backgroundOffsetY:h=0}=s,c=i.width(),u=i.height();let d=c,p=u;if("no-repeat"===n)if(r)if(a){const s=Math.max(c/e.width,u/e.height);t.drawImage(e,i.x1+l,i.y1+h,e.width*s*o,e.height*s*o)}else t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const s=e.width*o,n=e.height*o;t.drawImage(e,i.x1+l,i.y1+h,s,n)}else{if(r&&"repeat"!==n&&(e.width||e.height)){const i=e.width,s=e.height;"repeat-x"===n?(d=i*(u/s),p=u):"repeat-y"===n&&(p=s*(c/i),d=c);const r=t.dpr,a=Dr.allocate({width:d,height:p,dpr:r}),o=a.getContext("2d");o&&(o.inuse=!0,o.clearMatrix(),o.setTransformForCurrent(!0),o.clearRect(0,0,d,p),o.drawImage(e,0,0,d,p),e=a.nativeCanvas),Dr.free(a)}const s=t.dpr,a=t.createPattern(e,n);a.setTransform&&a.setTransform(new DOMMatrix([1/s,0,0,1/s,0,0])),t.fillStyle=a,t.translate(i.x1,i.y1),t.fillRect(0,0,c,u),t.translate(-i.x1,-i.y1)}}}const Dc=new Lc;let Fc=class{constructor(t){this.subRenderContribitions=t,this.time=xs.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u,d){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,n,r,a,o,l,h,c,u,d)}))}};Fc=Oc([_i(),Ic(0,vi(Li)),Ic(0,bi(Ph)),Pc("design:paramtypes",[Object])],Fc);const jc=new class{constructor(){this.time=xs.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u,d){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||u),y=t.AABBBounds,_=null!==(p=t.attribute.width)&&void 0!==p?p:y.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:y.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[_,b],i+_/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const Nc=new class{constructor(){this.time=xs.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u,d){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||u||e.restore())}};class Uc{constructor(){this.time=xs.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=Dr.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])),Dr.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,St),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,u,d){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,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h;const{textureRatio:c=r.textureRatio,textureOptions:u=null}=e.attribute;let d=this.textureMap.get(t);if(!d)switch(t){case"circle":d=this.createCirclePattern(o,l,a,i);break;case"diamond":d=this.createDiamondPattern(o,l,a,i);break;case"rect":d=this.createRectPattern(o,l,a,i);break;case"vertical-line":d=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":d=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":d=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":d=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":d=this.createGridPattern(o,l,a,i)}if(u&&u.dynamicTexture){const{gridConfig:d={},useNewCanvas:p}=u,g=e.AABBBounds;s=g.x1,n=g.y1;const f=i;let m;if(p){m=Dr.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=m.getContext("2d");t.clearRect(0,0,g.width(),g.height()),s=0,n=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,s,n,r),f.clip();const v=g.width(),y=g.height(),_=l,b=o,x=d.columns?d.columns:Math.ceil(v/b),S=d.rows?d.rows:Math.ceil(y/b),A=d.gutterColumn?d.gutterColumn:2*_,w=d.gutterRow?d.gutterRow:2*_;this._tempSymbolGraphic||(this._tempSymbolGraphic=$h({}));const k=d.columns?v/d.columns:b,T=d.rows?y/d.rows:b;this._tempSymbolGraphic.setAttributes({size:[k-A,T-w],symbolType:t});const C=this._tempSymbolGraphic.getParsedPath();for(let t=0;t{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:Hn(e,o,e.dpr),c=o/C,d="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:C+d*h,innerRadius:T-d*h,startAngle:y-d*c,endAngle:_+d*c}),e.beginPath(),wh(t,e,i,s,C+d*h,T-d*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/A,(S-s)/w,l[r]),l[r].opacity=a,e.stroke()}};g&&M(d,"outerBorder"),f&&M(p,"innerBorder"),t.setAttributes({outerRadius:C,innerRadius:T,startAngle:y,endAngle:_})}},Vc=Hc,Wc=Dc;const Gc=new class extends Lc{constructor(){super(...arguments),this.time=xs.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,u){const{background:d,backgroundMode:p=l.backgroundMode,backgroundFit:g=l.backgroundFit,backgroundKeepAspectRatio:f=l.backgroundKeepAspectRatio,backgroundScale:m=l.backgroundScale,backgroundOffsetX:v=l.backgroundOffsetX,backgroundOffsetY:y=l.backgroundOffsetY}=t.attribute;if(d)if(t.backgroundImg&&t.resources){const i=t.resources.get(d);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,{backgroundMode:p,backgroundFit:g,backgroundKeepAspectRatio:f,backgroundScale:m,backgroundOffsetX:v,backgroundOffsetY:y}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=d,e.fill(),e.highPerformanceRestore()}},Yc=_t/2;function Xc(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=At(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=At(t[0]),l=[e,e,e,e];break;case 2:case 3:e=At(t[0]),i=At(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=At(l[0]),l[1]=At(l[1]),l[2]=At(l[2]),l[3]=At(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,u,d]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],y=[c[0],c[1]+g[1]],_=[u[0]-g[2],u[1]],b=[u[0],u[1]-g[2]],x=[d[0]+g[3],d[1]],A=[d[0],d[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!K(v,y)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Yc,0,!1)}if(o&&o[1]?o[1](y[0],y[1],b[0],b[1]):t.lineTo(b[0],b[1]),!K(_,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Yc,!1)}if(o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),!K(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Yc,_t,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!K(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],_t,_t+Yc,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],_[0],_[1]):t.lineTo(_[0],_[1]),o&&o[2]?o[2](_[0],_[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}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};let Kc=class{constructor(){this.time=xs.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u,d){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(d.doStroke=!1)}};Kc=$c([_i()],Kc);let qc=class{constructor(){this.time=xs.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u){const{x1:d,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:y=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:d-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||_(v)&&v.every((t=>0===t)))){let n,r=0;return Xc(e,i,s,b,x,v,"bevel"!==y,new Array(4).fill(0).map(((a,o)=>(a,h,c,u)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,u),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};qc=$c([_i()],qc);const Zc=new class{constructor(){this.time=xs.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u){const{outerBorder:d,innerBorder:p}=t.attribute,g=d&&!1!==d.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:w,y1:k,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:C,height:M}=t.attribute;C=(null!=C?C:w-i)||0,M=(null!=M?M:k-s)||0;const B=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=T?h:Hn(e,h,e.dpr),d=i+o*c,p=s+o*c,g=2*c;if(0===m||_(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(d,p,C-o*g,M-o*g)):(e.beginPath(),Xc(e,d,p,C-o*g,M-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&B(d,"outerBorder"),f&&B(p,"innerBorder")}},Jc=Hc,Qc=Dc;const tu=new class{constructor(){this.time=xs.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u){const d=t.getParsedPath();if(!d)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,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,w=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:Hn(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===d.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),u)u(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(_-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&w(p,"outerBorder"),m&&w(g,"innerBorder")}},eu=new class{constructor(){this.time=xs.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,u,d){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:y=l.scaleX,scaleY:_=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,d;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(d=r.lineWidth)&&void 0!==d?d:t.attribute.lineWidth,r=e}r.stroke&&(u?u(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/y,(f-s)/_,l),e.stroke()))})),r&&!b.isSvg&&(u?u(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/y,(f-s)/_,l),e.stroke())))}},iu=Hc,su=Dc;const nu={x:0,y:0,z:0,lastModelMatrix:null};class ru{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(jc),this.builtinContributions.push(Nc),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===xs.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===xs.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,u,d){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,u,d)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,u,d){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,u,d)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=ea(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:u=l.opacity,fillOpacity:d=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=yh(u,d,h),_=bh(u,g),b=mh(h),x=vh(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(y||_||a||o))return!0;e.beginPath();return ks(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),x&&(o?o(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):y&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,y,_,l,n,a,o),!0}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:u=e.visible}=t.attribute,d=yh(o,l,n),p=bh(o,c),g=mh(n,r),f=vh(a,h);return!(!t.valid||!u)&&!(!g&&!f)&&!!(d||p||i||s||r)&&{fVisible:d,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){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,u=i.modelMatrix,d=i.camera;nu.x=n,nu.y=r,nu.z=a,nu.lastModelMatrix=u;const p=d&&(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=Tl.allocate(),n=Tl.allocate();Nh(n,t,e),Sl(s,u||s,n),nu.x=0,nu.y=0,nu.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Tl.free(n)}if(g&&!u){const s=t.getOffsetXY(e);nu.x+=s.x,nu.y+=s.y,nu.z=a,i.setTransformForCurrent()}else if(p)nu.x=0,nu.y=0,nu.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(d&&i.project){const s=t.getOffsetXY(e);nu.x+=s.x,nu.y+=s.y,this.transformWithoutTranslate(i,nu.x,nu.y,nu.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),nu.x=0,nu.y=0,nu.z=0;return nu}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},u={x:n,y:r};s.camera=null;const d=1/(h.x*(u.y-c.y)-c.x*u.y+u.x*c.y+(c.x-u.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+u.y*o.x+(c.y-u.y)*a.x)*d,g=(c.y*l.y+h.y*(o.y-l.y)-u.y*o.y+(u.y-c.y)*a.y)*d,f=(h.x*(l.x-o.x)-c.x*l.x+u.x*o.x+(c.x-u.x)*a.x)*d,m=-(c.x*l.y+h.x*(o.y-l.y)-u.x*o.y+(u.x-c.x)*a.y)*d,v=(h.x*(u.y*o.x-c.y*l.x)+h.y*(c.x*l.x-u.x*o.x)+(u.x*c.y-c.x*u.y)*a.x)*d,y=(h.x*(u.y*o.y-c.y*l.y)+h.y*(c.x*l.y-u.x*o.y)+(u.x*c.y-c.x*u.y)*a.y)*d;s.setTransform(p,g,f,m,v,y,!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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:u,lastModelMatrix:d}=l;this.z=u,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==d&&Tl.free(a.modelMatrix),a.modelMatrix=d),a.highPerformanceRestore()}}var au=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},lu=function(t,e){return function(i,s){e(i,s,t)}};let hu=class extends ru{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=tl,this.builtinContributions=[zc,Wc,Vc],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let u=h.endAngle;u=o;const d=u>c;let p=!1;if(nyt){const t=Ct(b,_),r=Ct(x,_),a=Sh(v,y,f,m,n,t,Number(d)),o=Sh(A,w,k,T,n,r,Number(d));if(_0&&e.arc(i+o.cx,s+o.cy,r,wt(o.y11,o.x11),wt(o.y01,o.x01),!d)}}else e.moveTo(i+f,s+m);if(!(r>yt)||M<.001)e.lineTo(i+k,s+T),p=!0;else if(C>yt){const t=Ct(E,C),n=Ct(R,C),a=Sh(k,T,A,w,r,-n,Number(d)),o=Sh(f,m,v,y,r,-t,Number(d));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),C0&&e.arc(i+a.cx,s+a.cy,n,wt(a.y01,a.x01),wt(a.y11,a.x11),!d);const t=wt(a.cy+a.y11,a.cx+a.x11),o=u-l-.03;e.arc(i,s,r,t,o,d)}}else e.lineTo(i+r*kt(B),s+r*Mt(B));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:ea(t,null==r?void 0:r.theme).arc;const{fill:h=l.fill,stroke:u=l.stroke,x:d=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:w=l.outerRadius,innerRadius:k=l.innerRadius}=t.attribute;w+=b,k-=x;let T=0;const C=(c(S)&&S||S[0])&&"conical"===h.gradient;if(C){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();At(s-i){var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)ya[s]=t,i&&(i=!(null!==(e=ya[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)ya[e]=!!t[e],i&&(i=!!ya[e]);else ya[0]=!1,ya[1]=!1,ya[2]=!1,ya[3]=!1;return{isFullStroke:i,stroke:ya}})(u);if((y||B)&&(e.beginPath(),wh(t,e,i,s,w,k),M=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o),g?(this._runStroke(t,e,i,s,l,_,B,v,o),this._runFill(t,e,i,s,l,y,m,d,p,a)):(this._runFill(t,e,i,s,l,y,m,d,p,a),this._runStroke(t,e,i,s,l,_,B,v,o))),!B&&_&&(e.beginPath(),wh(t,e,i,s,w,k,E),M||this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o),o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(c(S)&&S||S[1])&&A){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(At(h-r)>=St-yt){e.beginPath();const r=Math.abs(w-k)/2/w,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,u=h;this.drawArcTailCapPath(t,e,i,s,w,k,u,u+r),M||this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const d=()=>{if(y){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+=St;for(;i>St;)i-=St;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),Fl(o.color,l.color,h,!1)}(0,0,h,n);a||yh&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}},p=()=>{_&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};d(),p()}}this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o),C&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=ea(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}};function cu(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]=Os(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 uu(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:u}=e;let d;if(c&&!1!==c.defined&&!i?d=l:c&&!1!==u.defined&&(d=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=d?d.x:e.p0.x,o=d?d.y:e.p0.y;t.moveTo(i+n,o+r,a)}else d&&(h=!s,t.lineTo(d.x+n,d.y+r,a))}return h}function du(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:u}=e;if(i>=1){if(h){let e,i=!0;u.forEach(((s,n)=>{s.originP1!==s.originP2?(i=uu(t,s,e,i,r,a,o),e=s):e=s}))}else u.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),cu(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let d;"x"===s?d=_s.ROW:"y"===s?d=_s.COLUMN:"auto"===s&&(d=e.direction);const p=i*e.tryUpdateLength(d);let g=0,f=!0,m=null;for(let e=0,i=u.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 gu=class extends ru{constructor(){super(...arguments),this.numberType=ol}draw(t,e,i,s){const n=ea(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,u,d,p,g){var f;if(!e)return;t.beginPath();du(t,e,l,h,{offsetX:c,offsetY:u,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),d.cache&&!_(d.cache)&&d.cache.curves.every((t=>t.defined))&&d.attribute.curveType&&d.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(d,a,o);const{x:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(d,a,m-c,v-u,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(d,a,m-c,v-u,o),t.stroke())),!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,u,d){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"===y)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,u,d,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}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=dn(x(t.points,v),y,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===y){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,u,d,n[g],[l,t.attribute],_,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,u,d,n[m],[l,t.attribute],Ct(y,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,u,d,t.attribute,l,_,b,i,s,t,a,o)}};function fu(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),cu(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),cu(t,l,1,s),o=!1):o=!0}t.closePath()}gu=pu([_i()],gu);const mu=new class extends Uc{constructor(){super(...arguments),this.time=xs.afterFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,u,d){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=d||{},{texture:y=(null!==(p=t.attribute.texture)&&void 0!==p?p:Ta(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Ta(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:Ta(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:Ta(l,"texturePadding"))}=v;y&&this.drawTexture(y,t,e,i,s,l,_,b,x)}},vu=Dc;var yu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_u=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bu=function(t,e){return function(i,s){e(i,s,t)}};let xu=class extends ru{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=il,this.builtinContributions=[mu,vu],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,u,d){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,y=m[0];e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const i=m[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,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,u,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(u?u(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,u,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(_(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}d?d(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,u,d,p;const g=ea(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:y=g.z,strokeOpacity:_=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,w=S.doStroke&&S.sVisible,{clipRange:k=g.clipRange,closePath:T,points:C,segments:M}=t.attribute;let{curveType:B=g.curveType}=t.attribute;function E(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===B&&(B="linearClosed"),1===k&&!M&&!C.some((t=>!1===t.defined))&&"linear"===B)return this.drawLinearAreaHighPerformance(t,e,!!f,w,v,_,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(M&&M.length){let e,i;const s=M.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=dn(E(t.points,x),B,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=M.length-1;t>=0;t--){const e=M[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=M[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(u=s.y1)&&void 0!==u?u:s.y})}i.length>1&&(n=dn(E(i,x),"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!C||!C.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=E(C,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(d=e[t].x1)&&void 0!==d?d:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=dn(e,B,{curveTension:b}),n=dn(i,"stepBefore"===B?"stepAfter":"stepAfter"===B?"stepBefore":B,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===k){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,w,_,r[c],[g,t.attribute],k,i,s,y,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=k*l;let c=0,u=!1;t.cacheArea.forEach(((l,d)=>{if(u)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(u=this.drawSegmentItem(e,l,A,v,w,_,r[d],[g,t.attribute],Ct(f,1),i,s,y,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,w,_,t.attribute,g,k,i,s,y,t,n,a,o)}draw(t,e,i,s){const n=ea(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,u,d,p,g,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,u,d,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,u,d,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=d.attribute;let y,b,x=_s.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],y=t.points[t.points.length-1]}else b=m[0],y=m[m.length-1];const S=At(y.x-b.x),A=At(y.y-b.y);x=null==y.x1?_s.ROW:null==y.y1?_s.COLUMN:Number.isFinite(S+A)?S>A?_s.ROW:_s.COLUMN:_s.ROW,function(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;ou?_s.ROW:_s.COLUMN,Number.isFinite(c)||(o=_s.COLUMN),Number.isFinite(u)||(o=_s.ROW);const d=i*(o===_s.ROW?c:u);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;_(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),du(t,i[0]?e.top:e.bottom,l,x===_s.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:u})),t.setStrokeStyle(d,a,w-h,k-c,o),t.stroke()}})(),!1}};xu=yu([_i(),bu(0,vi(Li)),bu(0,bi(Th)),_u("design:paramtypes",[Object])],xu);const Su=Hc,Au=Dc;var wu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ku=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tu=function(t,e){return function(i,s){e(i,s,t)}};let Cu=class extends ru{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=ll,this.builtinContributions=[Au,Su],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const u=null!==(l=this.tempTheme)&&void 0!==l?l:ea(t,null==r?void 0:r.theme).path,{x:d=u.x,y:p=u.y,fillStrokeOrder:g=u.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,u,a,o);if(!m)return;const{fVisible:v,sVisible:y,doFill:_,doStroke:b}=m;if(e.beginPath(),t.pathShape)ks(t.pathShape.commandList,e,i,s,1,1,f);else{ks((null!==(c=t.attribute.path)&&void 0!==c?c:u.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,u),this.beforeRenderStep(t,e,i,s,_,b,v,y,u,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,u):y&&(e.setStrokeStyle(t,t.attribute,d-i,p-s,u),e.stroke()))},S=()=>{_&&(a?a(e,t.attribute,u):v&&(e.setCommonStyle(t,t.attribute,d-i,p-s,u),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,_,b,v,y,u,n,a,o)}draw(t,e,i,s){const n=ea(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Cu=wu([_i(),Tu(0,vi(Li)),Tu(0,bi(Mh)),ku("design:paramtypes",[Object])],Cu);var Mu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Bu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Eu=function(t,e){return function(i,s){e(i,s,t)}};let Ru=class extends ru{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=cl,this.builtinContributions=[Zc,Qc,Jc],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:ea(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:u=l.stroke,cornerRadius:d=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:y=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:w=l.fillStrokeOrder,drawStrokeWhenZeroWH:k=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:C}=t.attribute;T=(null!=T?T:b-S)||0,C=(null!=C?C:x-A)||0;const M=_h(g,f,T,C,h),B=xh(g,v,T,C,k),E=mh(h,c),R=vh(u,m);if(!t.valid||!y)return;if(!E&&!R)return;if(!(M||B||a||o||c))return;0===d||_(d)&&d.every((t=>0===t))?(e.beginPath(),e.rect(i,s,T,C)):(e.beginPath(),Xc(e,i,s,T,C,d,"bevel"!==p));const O={doFill:E,doStroke:R};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,E,R,M,B,l,n,a,o,O),w?(this._runStroke(t,e,i,s,l,O,B,S,A,o),this._runFill(t,e,i,s,l,O,M,S,A,a)):(this._runFill(t,e,i,s,l,O,M,S,A,a),this._runStroke(t,e,i,s,l,O,B,S,A,o)),this.afterRenderStep(t,e,i,s,E,R,M,B,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=ea(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}};Ru=Mu([_i(),Eu(0,vi(Li)),Eu(0,bi(Eh)),Bu("design:paramtypes",[Object])],Ru);var Ou=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},Iu=function(t,e){return function(i,s){e(i,s,t)}};let Lu=class extends ru{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=dl,this.builtinContributions=[tu,su,iu,eu],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:ea(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:u=l.x,y:d=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:y,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:w=l.keepDirIn3d}=t.attribute,k=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,C=s,M=k;const B=e.camera;if(w&&B&&e.project){const t=e.project(i,s,k);e.camera=null,_(c)&&(c[0],c[1]),T=t.x,C=t.y,M=void 0}!1===A.draw(e,c,T,C,M,((n,r)=>{var h,c,v,y;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(y=r.lineWidth)&&void 0!==y?y:t.attribute.lineWidth,r=e}const _=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,u-i,d-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(u-i)/p,(d-s)/g,l),e.stroke()))};f?(x(),_()):(_(),x())}))&&e.closePath(),e.camera=B,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,y,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,u,d,A,m,p,g,o),this._runFill(t,e,i,s,l,x,y,u,d,A,a)):(this._runFill(t,e,i,s,l,x,y,u,d,A,a),this._runStroke(t,e,i,s,l,S,b,u,d,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,y,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,u,d,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/u,(l-s)/d,n),e.stroke()))}draw(t,e,i,s){const n=ea(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Lu=Ou([_i(),Iu(0,vi(Li)),Iu(0,bi(Rh)),Pu("design:paramtypes",[Object])],Lu);const Du=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new he)}allocate(t,e,i,s){if(!this.pools.length)return(new he).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 he(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(...t){this.pools=[]}};const Fu=new class extends Lc{constructor(){super(...arguments),this.time=xs.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,u){var d,p,f,m,v,y,_,b,x,S;const{backgroundMode:A=l.backgroundMode,backgroundFit:w=l.backgroundFit,backgroundKeepAspectRatio:k=l.backgroundKeepAspectRatio}=t.attribute;let T,{background:C}=t.attribute;if(!C)return;const M=()=>{"richtext"===t.type&&(e.restore(),e.save(),T&&e.setTransformFromMatrix(T,!0,1))};let B;"richtext"===t.type&&(T=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const E=g(C)&&C.background,R=t.transMatrix.onlyTranslate();if(E){const e=t.AABBBounds,i=(null!==(d=C.x)&&void 0!==d?d:e.x1)+(null!==(p=C.dx)&&void 0!==p?p:0),s=(null!==(f=C.y)&&void 0!==f?f:e.y1)+(null!==(m=C.dy)&&void 0!==m?m:0),n=null!==(v=C.width)&&void 0!==v?v:e.width(),r=null!==(y=C.height)&&void 0!==y?y:e.height();if(B=Du.allocate(i,s,i+n,s+r),C=C.background,!R){const t=B.width(),e=B.height();B.set((null!==(_=C.x)&&void 0!==_?_:0)+(null!==(b=C.dx)&&void 0!==b?b:0),(null!==(x=C.y)&&void 0!==x?x:0)+(null!==(S=C.dy)&&void 0!==S?S:0),t,e)}}else B=t.AABBBounds,R||(B=Rc(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(C);if("success"!==n.state||!n.data)return void M();e.highPerformanceSave(),R&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,B,{backgroundMode:A,backgroundFit:w,backgroundKeepAspectRatio:k}),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n,backgroundOpacity:r=1}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=r,e.fillStyle=C,n?(Xc(e,B.x1,B.y1,B.width(),B.height(),n,!0),e.fill()):e.fillRect(B.x1,B.y1,B.width(),B.height()),e.highPerformanceRestore()}E&&Du.free(B),M()}};var ju=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Uu=function(t,e){return function(i,s){e(i,s,t)}};let Hu=class extends ru{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=pl,this.builtinContributions=[Fu],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const u=ea(t,null==r?void 0:r.theme).text,{text:d,underline:p=u.underline,lineThrough:g=u.lineThrough,keepDirIn3d:f=u.keepDirIn3d,direction:m=u.direction,fontSize:v=u.fontSize,verticalMode:y=u.verticalMode,x:_=u.x,y:b=u.y}=t.attribute,x=null!==(l=Ba(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,u,a,o);if(!S)return;const{fVisible:A,sVisible:w,doFill:k,doStroke:T}=S,C=!f,M=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,u),this.beforeRenderStep(t,e,i,s,k,T,A,w,u,n,a,o),C&&this.transformUseContext2d(t,u,M,e);const B=(n,r,l,h)=>{let c=i+r;const d=s+l;if(h){e.highPerformanceSave(),c+=v;const t=kl.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,d),e.transformFromMatrix(t,!0),kl.free(t)}T&&(o?o(e,t.attribute,u):w&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,u),e.strokeText(n,c,d,M))),k&&(a?a(e,t.attribute,u):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,u),e.fillText(n,c,d,M))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,u,M),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;T&&(o?o(e,t.attribute,u):w&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,u),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,M)})))),k&&(a?a(e,t.attribute,u):A&&(e.setCommonStyle(t,t.attribute,_-i,b-s,u),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,M),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,M,u,e,{width:n.width})}))))}else{let{textAlign:i=u.textAlign,textBaseline:s=u.textBaseline}=t.attribute;if(!y){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Tt(e,o)}));let l=0,d=0;"bottom"===s?d=-a:"middle"===s&&(d=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;B(i,a-(e+1)*x+d,r,n),r+=s}))}))}C&&this.restoreTransformUseContext2d(t,u,M,e),this.afterRenderStep(t,e,i,s,k,T,A,w,u,n,a,o)}draw(t,e,i,s){const n=ea(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,l,h,c){if(e+t<=0)return;const{textAlign:u=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,y=!d(c),_=y?c.width:i.clipedWidth,b=y?0:Ih(u,_),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+_,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+_,t,o),h.stroke()}}};function zu(t,e,i,s){if(e&&e.length){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},$u=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ku=function(t,e){return function(i,s){e(i,s,t)}};let qu=class extends ru{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=hl,this.builtinContributions=[Yu,Gu],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=ea(t,null==r?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:c=l.cornerRadius,x:u=l.x,y:d=l.y,closePath:p=l.closePath,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:b}=f;e.beginPath(),c<=0||_(c)&&c.every((t=>0===t))?zu(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void zu(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],u=h.x-o.x,d=h.y-o.y,p=h.x-c.x,g=h.y-c.y,f=(Math.atan2(d,u)-Math.atan2(g,p))/2,m=Math.abs(Math.tan(f));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,y=v/m;const _=Vu(u,d),b=Vu(p,g),x=Math.min(_,b);y>x&&(y=x,v=x*m);const S=Wu(h,y,_,u,d),A=Wu(h,y,b,p,g),w=2*h.x-S.x-A.x,k=2*h.y-S.y-A.y,T=Vu(w,k),C=Wu(h,Vu(y,v),T,w,k);let M=Math.atan2(S.y-C.y,S.x-C.x);const B=Math.atan2(A.y-C.y,A.x-C.x);let E=B-M;E<0&&(M=B,E=-E),E>Math.PI&&(E-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),E&&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,y,b,m,v,l,n,a,o);const x=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,d-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,d-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,y,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=ea(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};qu=Xu([_i(),Ku(0,vi(Li)),Ku(0,bi(Bh)),$u("design:paramtypes",[Object])],qu);var Zu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ju=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qu=function(t,e){return function(i,s){e(i,s,t)}};let td=class{constructor(t){this.groupRenderContribitions=t,this.numberType=rl}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Gc)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:u,background:d}=t.attribute;if(!(h||c||u||d))return;l=null!=l?l:ea(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:y=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:w=l.cornerType,x:k=l.x,y:T=l.y}=t.attribute,C=_h(p,m,g,f,c),M=xh(p,v,g,f),B=mh(c,d),E=vh(u,x);if(!t.valid||!S)return;if(!h){if(!B&&!E)return;if(!(C||M||a||o||d))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||_(y)&&y.every((t=>0===t))?(e.beginPath(),e.rect(i,s,g,f)):(e.beginPath(),Xc(e,i,s,g,f,y,"bevel"!==w));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Gc));const R={doFill:B,doStroke:E};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===xs.beforeFillStroke&&r.drawShape(t,e,i,s,B,E,C,M,l,n,a,o,R)})),h&&e.clip();const O=()=>{R.doFill&&(a?a(e,t.attribute,l):C&&(e.setCommonStyle(t,t.attribute,k-i,T-s,l),e.fill()))},P=()=>{R.doStroke&&(o?o(e,t.attribute,l):M&&(e.setStrokeStyle(t,t.attribute,k-i,T-s,l),e.stroke()))};A?(P(),O()):(O(),P()),this._groupRenderContribitions.forEach((r=>{r.time===xs.afterFillStroke&&r.drawShape(t,e,i,s,B,E,C,M,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,u=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=Gi.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const d=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=ea(t,null==s?void 0:s.theme).group,i=Tl.allocate(),n=Tl.allocate();Nh(n,t,e),Sl(i,p||i,n),a.modelMatrix=i,Tl.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&Tl.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=d,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=u,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}};td=Zu([_i(),Qu(0,vi(Li)),Qu(0,bi(Ch)),Ju("design:paramtypes",[Object])],td);const ed=Symbol.for("IncrementalDrawContribution"),id=Symbol.for("ArcRender"),sd=Symbol.for("AreaRender"),nd=Symbol.for("CircleRender"),rd=Symbol.for("GraphicRender"),ad=Symbol.for("GroupRender"),od=Symbol.for("LineRender"),ld=Symbol.for("PathRender"),hd=Symbol.for("PolygonRender"),cd=Symbol.for("RectRender"),ud=Symbol.for("SymbolRender"),dd=Symbol.for("TextRender"),pd=Symbol.for("RichTextRender"),gd=Symbol.for("GlyphRender"),fd=Symbol.for("DrawContribution"),md=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===el,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];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+=St;for(;o<0;)o+=St;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};var vd=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},yd=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const _d=Symbol.for("DrawItemInterceptor"),bd=new he,xd=new he;class Sd{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){bd.copy(s.dirtyBounds),xd.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,kl.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(bd),s.backupDirtyBounds.copy(xd)),!0}}class Ad{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 wd=class{constructor(){this.order=1,this.interceptors=[new Sd,new Td,new kd,new Ad]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&Tl.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Cd=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Md=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Bd=function(t,e){return function(i,s){e(i,s,t)}};let Ed=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))}reInit(){this.drawContribution.reInit()}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}};Ed=Cd([_i(),Bd(0,vi(fd)),Md("design:paramtypes",[Object])],Ed);var Rd=new ai((t=>{t(Wi).to(Ed)}));const Od=Symbol.for("PickerService"),Pd=Symbol.for("GlobalPickerService"),Id=Symbol.for("PickItemInterceptor"),Ld=Symbol.for("PickServiceInterceptor");var Dd=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Fd=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};Fd=Dd([_i()],Fd);let jd=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=ea(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,u=kl.allocateByObj(a),d=new Dt(u.a*i.x+u.c*i.y+u.e,u.b*i.x+u.d*i.y+u.f),p=e.pickGroup(c,d,u,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};jd=Dd([_i()],jd);let Nd=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new Dt(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}};Nd=Dd([_i()],Nd);let Ud=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){const a=md(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};Ud=Dd([_i()],Ud);var Hd=new ai(((t,e,i)=>{i(Od)||(t(Pd).toSelf(),t(Od).toService(Pd)),t(Ud).toSelf().inSingletonScope(),t(Id).toService(Ud),t(jd).toSelf().inSingletonScope(),t(Id).toService(jd),t(Nd).toSelf().inSingletonScope(),t(Id).toService(Nd),Fi(t,Id),t(Fd).toSelf().inSingletonScope(),t(Ld).toService(Fd),Fi(t,Ld)})),zd=new ai((t=>{t(gl).to(Uh),t(fl).toConstantValue(Mc)}));const Vd=Symbol.for("AutoEnablePlugins"),Wd=Symbol.for("PluginService");var Gd=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yd=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Xd=function(t,e){return function(i,s){e(i,s,t)}};let $d=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&&Vi.isBound(Vd)&&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(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};$d=Gd([_i(),Xd(0,vi(Li)),Xd(0,bi(Vd)),Yd("design:paramtypes",[Object])],$d);var Kd=new ai((t=>{t(Wd).to($d),function(t,e){t(Li).toDynamicValue((({container:t})=>new Di(e,t))).whenTargetNamed(e)}(t,Vd)})),qd=new ai((t=>{Fi(t,Hi)})),Zd=new ai((t=>{t(sr).to(nr).inSingletonScope(),Fi(t,sr)})),Jd=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qd=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let tp=class{constructor(){this.type="static",this.offscreen=!1,this.global=Gi.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=or({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()}};tp=Jd([_i(),Qd("design:paramtypes",[])],tp);var ep=new ai((t=>{t(tp).toSelf(),t(lh).toService(tp)}));var ip=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 sp(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function np(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=sp(t,e,s);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;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=sp(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var op=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hp=function(t,e){return function(i,s){e(i,s,t)}};let cp=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):np(e,An.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new le,this.backupDirtyBounds=new le,this.global=Gi.global,this.layerService=Gi.layerService,_(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}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){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=function(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=Xt(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.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,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:An.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:An.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,kl.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=ap(e,i,An.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&&!$t(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Du.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=kl.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Du.free(n),kl.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||Vi.get(ed);o.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0),o.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:r.layer,context:a,startAtId:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let dp=class extends gu{constructor(){super(...arguments),this.numberType=ol}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=ea(t).line,{fill:c=h.fill,stroke:u=h.stroke,opacity:d=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:f=h.lineWidth,visible:m=h.visible}=t.attribute,v=yh(d,p,c),y=bh(d,g),_=mh(c),b=vh(u,f);if(!t.valid||!m)return;if(!_&&!b)return;if(!(v||y||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())}};dp=up([_i()],dp);var pp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 gp=class extends xu{constructor(){super(...arguments),this.numberType=il}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=ea(t).area,{fill:c=h.fill,fillOpacity:u=h.fillOpacity,opacity:d=h.opacity,visible:p=h.visible}=t.attribute,g=yh(d,u,c),f=mh(c);if(!t.valid||!p)return;if(!f)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())}};gp=pp([_i()],gp);var fp,mp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yp=function(t,e){return function(i,s){e(i,s,t)}},_p=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(fp||(fp={}));let bp=class extends cp{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=fp.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new Ui([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return _p(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:An.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:An.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return _p(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return _p(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>_p(this,void 0,void 0,(function*(){if(2!==t.count)yield rp(t,An.zIndex,((i,s)=>{if(this.status===fp.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return _p(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return _p(this,void 0,void 0,(function*(){this.rendering&&(this.status=fp.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=fp.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return _p(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>_p(this,void 0,void 0,(function*(){yield rp(t,An.zIndex,(t=>_p(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};bp=mp([_i(),yp(0,yi(rd)),yp(1,vi(dp)),yp(2,vi(gp)),yp(3,vi(Li)),yp(3,bi(_d)),vp("design:paramtypes",[Array,Object,Object,Object])],bp);var xp=new ai((t=>{t(Lc).toSelf().inSingletonScope(),t(Uc).toSelf().inSingletonScope(),t(fd).to(cp),t(ed).to(bp),t(ad).to(td).inSingletonScope(),t(rd).toService(ad),Fi(t,Ch),t(Fc).toSelf().inSingletonScope(),Fi(t,Ph),Fi(t,rd),t(wd).toSelf().inSingletonScope(),t(_d).toService(wd),Fi(t,_d)}));function Sp(){Sp.__loaded||(Sp.__loaded=!0,Vi.load(fh),Vi.load(zd),Vi.load(Rd),Vi.load(Hd),Vi.load(Kd),function(t){t.load(qd),t.load(Zd),t.load(ep)}(Vi),function(t){t.load(xp)}(Vi))}Sp.__loaded=!1,Sp();const Ap=Vi.get(zi);Gi.global=Ap;const wp=Vi.get(ah);Gi.graphicUtil=wp;const kp=Vi.get(rh);Gi.transformUtil=kp;const Tp=Vi.get(gl);Gi.graphicService=Tp;const Cp=Vi.get(oh);Gi.layerService=Cp;class Mp{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=ri.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class Bp{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=ri.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=Gi.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=Gi.global.getRequestAnimationFrame();this.rafId=t((()=>{Gi.global.devicePixelRatio!==this.dpr&&(this.dpr=Gi.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=Gi.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class Ep{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=ri.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.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))})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Gi.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())}}const Rp=new he;class Op{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=ri.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()}));const e=this.pluginService.stage;e&&(e.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&&(Rp.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(Rp,t.parent&&t.parent.globalTransMatrix)))})),e.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))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let Pp;function Ip(){!function(){if(null==Pp)try{const t=document.createElement("canvas"),e=t.getContext("2d");Pp=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),Pp&&(Pp=!!document.createElement)}catch(t){Pp=!1}}();const t=Gi.global&&Gi.global.env;return t?"browser"===t:Pp}let Lp=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};Lp._pluginClasses={};const Dp="white";class Fp extends ih{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:Dp}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={}){var e,i;super({}),this.tickedBeforeRender=!0,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._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Qr,this.hooks={beforeRender:new Ui(["stage"]),afterRender:new Ui(["stage"]),afterClearScreen:new Ui(["stage"]),afterClearRect:new Ui(["stage"])},this.global=Gi.global,!this.global.env&&Ip()&&this.global.setEnv("browser"),this.window=Vi.get(Nr),this.renderService=Vi.get(Wi),this.pluginService=Vi.get(Wd),this.layerService=Vi.get(oh),this.graphicService=Vi.get(gl),this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],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:Dp,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(),t.autoRefresh&&this.enableAutoRefresh(),!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),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&y(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(i=t.rafId)&&void 0!==i?i:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new ga(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(t=!1){t&&(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:u,beta:d,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!==(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(u)+y,S=Math.sin(d)+_,A=Math.cos(u)*Math.cos(d)*1);const w=Lp.getPlugin("DirectionalLight");w&&(this.light=new w(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]}};if(this.camera)this.camera.params=k;else{const t=Lp.getPlugin("OrthoCamera");t&&(this.camera=new t(k))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=Lp.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}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 Mp))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new Bp))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new Ep))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new le;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new Op,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=Lp.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=Lp.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=Lp.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();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.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();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===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),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.dirtyBounds&&this.dirtyBounds.clear(),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,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new Dt(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;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.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=Vi.get(Nr),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=Vi.get(Od)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}var jp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Np=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};let Up=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new he}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}}loadFont(t,e,i){return Np(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}};Up=jp([_i()],Up);var Hp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Vp=class{constructor(){this._uid=ri.GenAutoIncrementId(),this.viewBox=new he,this.modelMatrix=new ue(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){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}};Vp=Hp([_i(),zp("design:paramtypes",[])],Vp);var Wp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Gp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Yp=function(t,e){return function(i,s){e(i,s,t)}};let Xp=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=Gi.global}reInit(){this._init()}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.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 he).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 ue(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),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new Dt(e.x,e.y),a=ea(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 Dt(e.x,e.y);l.transformPoint(a,a);const o=ea(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const u=this.pickItem(r,a,i,s);u&&u.graphic&&(n.graphic=u.graphic,n.params=u.params)}return!!n.graphic||!!n.group}),!0,!!r.camera),r.modelMatrix!==a&&Tl.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!d||t.stage.camera||(n.group=t),kl.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function $p(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,u=(c-h)*n+h;r[0]=t,r[1]=a,r[2]=h,r[3]=u,r[4]=u,r[5]=c,r[6]=l,r[7]=s}function Kp(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const u=n.filter((t=>t.length>2));return 1===u.length?[u[0]]:u}function eg(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;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}))),ag=(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,u=[{x:h.x,y:h.y}];for(let e=o.edgeIndex+1;e<=l.edgeIndex;e++)u.push({x:t[e].x,y:t[e].y});u.push({x:c.x,y:c.y});const d=[{x:c.x,y:c.y}];for(let e=l.edgeIndex+1,i=o.edgeIndex+s;e<=i;e++){const i=t[e%s];d.push({x:i.x,y:i.y})}return d.push({x:h.x,y:h.y}),[u,d]},og=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new le;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 ag(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return ag(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);og(n[0],s,i),og(n[1],e-s,i)}};let lg=!1;const hg=new ai((t=>{lg||(lg=!0,t(hu).toSelf().inSingletonScope(),t(id).to(hu).inSingletonScope(),t(rd).toService(id),t(kh).toService(Fc),Fi(t,kh))}));let cg=!1;const ug=new ai((t=>{cg||(cg=!0,t(Ru).toSelf().inSingletonScope(),t(cd).to(Ru).inSingletonScope(),t(rd).toService(cd),t(qc).toSelf(),t(Kc).toSelf(),t(Eh).toService(qc),t(Eh).toService(Kc),t(Eh).toService(Fc),Fi(t,Eh))}));let dg=!1;const pg=new ai((t=>{dg||(dg=!0,t(gu).toSelf().inSingletonScope(),t(dp).toSelf().inSingletonScope(),t(od).to(gu).inSingletonScope(),t(rd).toService(od))}));let gg=!1;const fg=new ai((t=>{gg||(gg=!0,t(xu).toSelf().inSingletonScope(),t(sd).to(xu).inSingletonScope(),t(rd).toService(sd),t(Th).toService(Fc),Fi(t,Th),t(gp).toSelf().inSingletonScope())}));let mg=!1;const vg=new ai((t=>{mg||(mg=!0,t(Lu).toSelf().inSingletonScope(),t(ud).to(Lu).inSingletonScope(),t(rd).toService(ud),t(Rh).toService(Fc),Fi(t,Rh))}));let yg=!1;const _g=new ai((t=>{yg||(yg=!0,t(dd).to(Hu).inSingletonScope(),t(rd).toService(dd),t(Oh).toService(Fc),Fi(t,Oh))}));let bg=!1;const xg=new ai((t=>{bg||(bg=!0,t(Cu).toSelf().inSingletonScope(),t(ld).to(Cu).inSingletonScope(),t(rd).toService(ld),t(Mh).toService(Fc),Fi(t,Mh))}));let Sg=!1;const Ag=new ai((t=>{Sg||(Sg=!0,t(hd).to(qu).inSingletonScope(),t(rd).toService(hd),t(Bh).toService(Fc),Fi(t,Bh))}));var wg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},kg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Tg=class extends ru{constructor(){super(),this.numberType=ul,this.builtinContributions=[Fu],this.init()}drawShape(t,e,i,s,n){const r=ea(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=yh(o,l,!0),u=yh(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,u,c,u,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,u,c,u,r,n))}drawIcon(t,e,i,s,n){var r;const a=ea(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:u=a.backgroundFill,backgroundFillOpacity:d=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],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(y-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,y)):(e.beginPath(),Xc(e,i-t,s-n,v,y,f,!0)),u&&(e.globalAlpha=d,e.fillStyle=u,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,s,o,l))}draw(t,e,i){const s=ea(t).richtext;this._draw(t,s,!1,i)}};Tg=wg([_i(),kg("design:paramtypes",[])],Tg);let Cg=!1;const Mg=new ai((t=>{Cg||(Cg=!0,t(pd).to(Tg).inSingletonScope(),t(rd).toService(pd))}));function Bg(t){const e=[];for(let i=0;iit.getInstance().info(`[VChart log]: ${t}`,...e),Rg=(t,e)=>(u(Pg.warnHandler)&&Pg.warnHandler.call(null,t,e),e?it.getInstance().warn(`[VChart warn]: ${t}`,e):it.getInstance().warn(`[VChart warn]: ${t}`)),Og=(t,e,i)=>{if(!u(Pg.errorHandler))throw new Error(t);Pg.errorHandler.call(null,t,e)},Pg={silent:!1,warnHandler:!1,errorHandler:!1},Ig=Ip(),Lg=Ig&&globalThis?globalThis.document:void 0;function Dg(t){return("desktop-browser"===t||"mobile-browser"===t)&&Ig}function Fg(t){return jg(t)||"mobile-browser"===t}function jg(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let Ng=0;function Ug(){return Ng>=9999999&&(Ng=0),Ng++}function Hg(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function zg(t){return!(!t||0===t.length)&&(!d(t[0])&&!d(t[0].dataId)&&_(t[0].fields))}const Vg=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Wg extends ih{constructor(t,e){super(t),this._skipRenderAttributes=Vg,(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,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!u(this.attribute[t])&&!u(e)?j(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.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,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.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){d(e)&&(e=Object.keys(t));for(let i=0;i{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"},mf=(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 vf extends l{constructor(t,e={}){var i,s,n,r,a,o,l,h,c,u;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.startTime=ha.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.pressTimeout=null}),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=ha.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||ff(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,u=mf(l[0],l[1]);s.scale=u/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=ha.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=mf(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=ff(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&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!==(u=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==u?u: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("pointerleave",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("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=ha.now()-i>this.config.press.time&&mf(s[0],t){Gi.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;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){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){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},_f=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const bf=[0,0,0];let xf=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t: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(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},vn),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},_n),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},bn),{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 ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ue(1,0,0,1,0,0),this._clearMatrix=new ue(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&it.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new ue(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&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 kl.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&&(kl.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(kl.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){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,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=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(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){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-=St;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,u=ca);t++){const e=y.getColor(t);u.beginPath(),u.rotate(v),u.moveTo(0,0),u.lineTo(f,-2*_),u.lineTo(f,0),u.fillStyle=e,u.closePath(),u.fill()}const b=u.getImageData(0,0,d,p);return c.width=b.width,c.height=b.height,u.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&Gl.Set(e,i,s,r,a,g,d,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&&(Al(bf,[t,e,i],this.modelMatrix),t=bf[0],e=bf[1],i=bf[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&&(Al(bf,[t,e,i],this.modelMatrix),t=bf[0],e=bf[1],i=bf[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Al(bf,[e,i,s],this.modelMatrix),e=bf[0],i=bf[1],s=bf[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,e=Gi.global.measureTextMethod){var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Gi.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:bn.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:bn.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&&(Al(bf,[e,i,s],this.modelMatrix),e=bf[0],i=bf[1],s=bf[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=zn(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:u=n.lineCap,miterLimit:d=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:Hn(this,a,this.dpr),r.strokeStyle=zn(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=u,r.miterLimit=d}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=se(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?this.font=t.font:this.font=se(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(t=!0,e=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(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>kl.free(t))),this.stack.length=0}};xf.env="browser",xf=yf([_i(),_f("design:paramtypes",[Object,Number])],xf);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},Af=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let wf=class extends Pl{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Gi.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new xf(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 kf(t,e){return new ai((i=>{i(rr).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(ar).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}wf.env="browser",wf=Sf([_i(),Af("design:paramtypes",[Object])],wf);const Tf=kf(wf,xf);var Cf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Bf=function(t,e){return function(i,s){e(i,s,t)}};let Ef=class extends Xp{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,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=Dr.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 Of=class{constructor(){this.type="group",this.numberType=rl}contains(t,e,i){return!1}};Of=Rf([_i()],Of);const Pf=new ai(((t,e,i,s)=>{Pf.__vloaded||(Pf.__vloaded=!0,t(pf).to(Of).inSingletonScope(),t(gf).toService(pf),Fi(t,gf))}));Pf.__vloaded=!1;var If=Pf;const Lf=new ai(((t,e,i,s)=>{i(Ef)||t(Ef).toSelf().inSingletonScope(),i(Od)?s(Od).toService(Ef):t(Od).toService(Ef)}));var Df,Ff=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Nf=Df=class extends Vp{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Df.idprefix}_${Df.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Gi.global,this.viewBox=new he,this.modelMatrix=new ue(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:Df.GenerateCanvasId(),canvasControled:!0};this.canvas=new wf(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 wf({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)}};Nf.env="browser",Nf.idprefix="visactor_window",Nf.prefix_count=0,Nf=Df=Ff([_i(),jf("design:paramtypes",[])],Nf);const Uf=new ai((t=>{t(Nf).toSelf(),t(Ur).toDynamicValue((t=>t.container.get(Nf))).whenTargetNamed(Nf.env)}));var Hf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vf=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 Wf{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 Gf(t,e=!1){const i=document.createElement("img");if(Gi.global.isImageAnonymous&&(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 Yf=class extends Up{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)/(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 Wf(t)}return new he}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(y(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=y(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return Gf(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Gf(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:ri.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(...t){}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}}loadFont(t,e,i){return Vf(this,void 0,void 0,(function*(){return new FontFace(t,y(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}};Yf=Hf([_i(),zf("design:paramtypes",[])],Yf);const Xf=new ai((t=>{Xf.isBrowserBound||(Xf.isBrowserBound=!0,t(Yf).toSelf().inSingletonScope(),t(Hi).toService(Yf))}));function $f(t,e=!0){$f.__loaded||($f.__loaded=!0,t.load(Xf),t.load(Tf),t.load(Uf),e&&function(t){t.load(If),t.load(Lf)}(t))}Xf.isBrowserBound=!1,$f.__loaded=!1;var Kf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zf=function(t,e){return function(i,s){e(i,s,t)}};let Jf=class extends Xp{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,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 Rl(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}};Jf=Kf([_i(),Zf(0,vi(Li)),Zf(0,bi(Gg)),Zf(1,vi(Li)),Zf(1,bi(Id)),Zf(2,vi(Li)),Zf(2,bi(Ld)),qf("design:paramtypes",[Object,Object,Object])],Jf);const Qf=new ai((t=>{Qf.__vloaded||(Qf.__vloaded=!0,Fi(t,Gg))}));Qf.__vloaded=!1;var tm=Qf;class em{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();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,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:Hn(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}var im=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},nm=function(t,e){return function(i,s){e(i,s,t)}};let rm=class extends em{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=tl}};rm=im([_i(),nm(0,vi(id)),sm("design:paramtypes",[Object])],rm);let am=!1;const om=new ai(((t,e,i,s)=>{am||(am=!0,t(Yg).to(rm).inSingletonScope(),t(Gg).toService(Yg))}));var lm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cm=function(t,e){return function(i,s){e(i,s,t)}};let um=class extends em{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=il}};um=lm([_i(),cm(0,vi(sd)),hm("design:paramtypes",[Object])],um);let dm=!1;const pm=new ai(((t,e,i,s)=>{dm||(dm=!0,t(Xg).to(um).inSingletonScope(),t(Gg).toService(Xg))}));var gm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fm=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)}};let vm=class extends em{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=sl}};vm=gm([_i(),mm(0,vi(nd)),fm("design:paramtypes",[Object])],vm);let ym=!1;const _m=new ai(((t,e,i,s)=>{ym||(ym=!0,t($g).to(vm).inSingletonScope(),t(Gg).toService($g))}));class bm{constructor(){this.type="glyph",this.numberType=nl}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}}var xm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},Am=function(t,e){return function(i,s){e(i,s,t)}};let wm=class extends bm{constructor(t){super(),this.canvasRenderer=t}};wm=xm([_i(),Am(0,vi(gd)),Sm("design:paramtypes",[Object])],wm);let km=!1;const Tm=new ai(((t,e,i,s)=>{km||(km=!0,t(sf).to(wm).inSingletonScope(),t(wm).toService(sf))}));var Cm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Mm=class{constructor(){this.type="image",this.numberType=al}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Mm=Cm([_i()],Mm);let Bm=!1;const Em=new ai(((t,e,i,s)=>{Bm||(Bm=!0,t(Kg).to(Mm).inSingletonScope(),t(Mm).toService(Kg))}));var Rm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Om=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Pm=function(t,e){return function(i,s){e(i,s,t)}};let Im=class extends em{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=ol}};Im=Rm([_i(),Pm(0,vi(od)),Om("design:paramtypes",[Object])],Im);let Lm=!1;const Dm=new ai(((t,e,i,s)=>{Lm||(Lm=!0,t(qg).to(Im).inSingletonScope(),t(Gg).toService(qg))}));var Fm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Nm=function(t,e){return function(i,s){e(i,s,t)}};let Um=class extends em{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=hl}};Um=Fm([_i(),Nm(0,vi(hd)),jm("design:paramtypes",[Object])],Um);let Hm=!1;const zm=new ai(((t,e,i,s)=>{Hm||(Hm=!0,t(ef).to(Um).inSingletonScope(),t(Gg).toService(ef))}));var Vm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Gm=function(t,e){return function(i,s){e(i,s,t)}};let Ym=class extends em{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=ll}};Ym=Vm([_i(),Gm(0,vi(ld)),Wm("design:paramtypes",[Object])],Ym);let Xm=!1;const $m=new ai(((t,e,i,s)=>{Xm||(Xm=!0,t(Zg).to(Ym).inSingletonScope(),t(Gg).toService(Zg))})),Km=new he;class qm{constructor(){this.type="rect",this.numberType=cl}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=t.getGraphicTheme(),{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||_(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,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:Hn(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;Km.setValue(i.x1,i.y1,i.x2,i.y2),Km.expand(-r/2),h=!Km.containsPoint(e)}}return s.highPerformanceRestore(),h}}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 tv=class extends qm{constructor(t){super(),this.canvasRenderer=t}};tv=Zm([_i(),Qm(0,vi(cd)),Jm("design:paramtypes",[Object])],tv);let ev=!1;const iv=new ai(((t,e,i,s)=>{ev||(ev=!0,t(Jg).to(tv).inSingletonScope(),t(Gg).toService(Jg))}));let sv=!1;const nv=new ai(((t,e,i,s)=>{sv||(sv=!0,t(Kg).to(Mm).inSingletonScope(),t(Mm).toService(Kg))}));var rv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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,s){e(i,s,t)}};let lv=class extends em{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=dl}};lv=rv([_i(),ov(0,vi(ud)),av("design:paramtypes",[Object])],lv);let hv=!1;const cv=new ai(((t,e,i,s)=>{hv||(hv=!0,t(Qg).to(lv).inSingletonScope(),t(Gg).toService(Qg))}));var uv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 dv=class{constructor(){this.type="text",this.numberType=pl}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};dv=uv([_i()],dv);let pv=!1;const gv=new ai(((t,e,i,s)=>{pv||(pv=!0,t(tf).to(dv).inSingletonScope(),t(Gg).toService(tf))})),fv=new ai(((t,e,i,s)=>{i(Jf)||t(Jf).toSelf().inSingletonScope(),i(Od)?s(Od).toService(Jf):t(Od).toService(Jf)}));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},vv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let yv=class extends xf{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 ue(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};yv.env="node",yv=mv([_i(),vv("design:paramtypes",[Object,Number])],yv);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},bv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let xv=class extends Pl{constructor(t){super(t)}init(){this._context=new yv(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&u(this._nativeCanvas.release)&&this._nativeCanvas.release()}};xv.env="node",xv=_v([_i(),bv("design:paramtypes",[Object])],xv);const Sv=kf(xv,yv);var Av=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kv=function(t,e){return function(i,s){e(i,s,t)}};let Tv=class extends Vp{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:ri.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new xv(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new xv({width:n,height:r,dpr:s,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}getImageBuffer(t="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){}};Tv.env="node",Tv=Av([_i(),kv(0,vi(zi)),wv("design:paramtypes",[Object])],Tv);const Cv=new ai((t=>{t(Tv).toSelf(),t(Ur).toDynamicValue((t=>t.container.get(Tv))).whenTargetNamed(Tv.env)}));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};let Bv=class extends Up{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 Ma.call(t)}}getCancelAnimationFrame(){return t=>{Ma.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};Bv=Mv([_i()],Bv);const Ev=new ai((t=>{Ev.isNodeBound||(Ev.isNodeBound=!0,t(Bv).toSelf().inSingletonScope(),t(Hi).toService(Bv))}));function Rv(t,e=!0){Rv.__loaded||(Rv.__loaded=!0,t.load(Ev),t.load(Sv),t.load(Cv))}Ev.isNodeBound=!1,Rv.__loaded=!1;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};let Pv=class extends xf{draw(){}createPattern(t,e){return null}};Pv.env="wx",Pv=Ov([_i()],Pv);var Iv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Lv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Dv=class extends Pl{constructor(t){super(t)}init(){this._context=new Pv(this,this._dpr)}release(...t){}};Dv.env="wx",Dv=Iv([_i(),Lv("design:paramtypes",[Object])],Dv);const Fv=kf(Dv,Pv);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},Nv=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)}};class Hv{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 zv=class extends Vp{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new Hv}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:ri.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Dv(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 Dv({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()}};zv.env="wx",zv=jv([_i(),Uv(0,vi(zi)),Nv("design:paramtypes",[Object])],zv);const Vv=new ai((t=>{t(zv).toSelf(),t(Ur).toDynamicValue((t=>t.container.get(zv))).whenTargetNamed(zv.env)}));var Wv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Yv=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 Xv=class extends Up{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,a){return Yv(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let o=0;o{let a=wx.createSelectorQuery();r&&(a=a.in(r)),a.select(`#${l}`).fields({node:!0,size:!0}).exec((r=>{if(!r[0])return;const a=r[0].node,h=r[0].width,c=r[0].height;a.width=h*t,a.height=c*t,i.set(l,a),o>=s&&n.push(a),e(null)}))})))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.component,e.forceUpdate).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 Ma.call(t)}}getCancelAnimationFrame(){return t=>{Ma.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(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};Xv=Wv([_i(),Gv("design:paramtypes",[])],Xv);const $v=new ai((t=>{$v._isWxBound||($v._isWxBound=!0,t(Xv).toSelf().inSingletonScope(),t(Hi).toService(Xv))}));function Kv(t,e=!0){Kv.__loaded||(Kv.__loaded=!0,t.load($v),t.load(Fv),t.load(Vv),e&&function(t){t.load(tm),t.load(fv),t.load(om),t.load(pm),t.load(_m),t.load(Tm),t.load(Em),t.load(Dm),t.load(zm),t.load($m),t.load(iv),t.load(nv),t.load(cv),t.load(gv)}(t))}$v._isWxBound=!1,Kv.__loaded=!1;var qv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jv=function(t,e){return function(i,s){e(i,s,t)}};let Qv=class extends em{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=tl}};Qv=qv([_i(),Jv(0,vi(id)),Zv("design:paramtypes",[Object])],Qv);let ty=!1;const ey=new ai(((t,e,i,s)=>{ty||(ty=!0,t(nf).to(Qv).inSingletonScope(),t(gf).toService(nf))}));var iy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ny=function(t,e){return function(i,s){e(i,s,t)}};let ry=class extends qm{constructor(t){super(),this.canvasRenderer=t}};ry=iy([_i(),ny(0,vi(cd)),sy("design:paramtypes",[Object])],ry);let ay=!1;const oy=new ai(((t,e,i,s)=>{ay||(ay=!0,t(lf).to(ry).inSingletonScope(),t(gf).toService(lf))}));class ly extends 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;s.highPerformanceSave();const n=t.getGraphicTheme(),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 u=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!u||(u=t.isPointInPath(c.x,c.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:Hn(s,n+r,s.dpr),u=t.isPointInStroke(c.x,c.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==h&&Tl.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),u}}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)},uy=function(t,e){return function(i,s){e(i,s,t)}};let dy=class extends ly{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=ol}};dy=hy([_i(),uy(0,vi(od)),cy("design:paramtypes",[Object])],dy);let py=!1;const gy=new ai(((t,e,i,s)=>{py||(py=!0,t(af).to(dy).inSingletonScope(),t(gf).toService(af))}));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},my=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vy=function(t,e){return function(i,s){e(i,s,t)}};let yy=class extends em{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=il}};yy=fy([_i(),vy(0,vi(sd)),my("design:paramtypes",[Object])],yy);let _y=!1;const by=new ai(((t,e,i,s)=>{_y||(_y=!0,t(rf).to(yy).inSingletonScope(),t(gf).toService(rf))}));class xy extends ru{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();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 u=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!u||(u=t.isPointInPath(c.x,c.y),u))),this.canvasRenderer.z=0,s.modelMatrix!==h&&Tl.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),u}}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},Ay=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wy=function(t,e){return function(i,s){e(i,s,t)}};let ky=class extends xy{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=dl}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=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let u=e;if(s.camera){u=e.clone();const i=t.parent.globalTransMatrix;u.x=i.a*e.x+i.c*e.y+i.e,u.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let d=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!d||(d=t.isPointInPath(u.x,u.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:Hn(s,n+r,s.dpr),d=t.isPointInStroke(u.x,u.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==c&&Tl.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),d}};ky=Sy([_i(),wy(0,vi(ud)),Ay("design:paramtypes",[Object])],ky);let Ty=!1;const Cy=new ai(((t,e,i,s)=>{Ty||(Ty=!0,t(hf).to(ky).inSingletonScope(),t(gf).toService(hf))}));var My=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},Ey=function(t,e){return function(i,s){e(i,s,t)}};let Ry=class extends xy{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=pl}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=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:u,lastModelMatrix:d}=l;this.canvasRenderer.z=u;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,d=l.height(),f=l.width(),m=Lh(a,d,n),v=Ih(o,f);return e.rect(v+h,m+c,f,d,u),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,s.modelMatrix!==d&&Tl.free(s.modelMatrix),s.modelMatrix=d,s.highPerformanceRestore(),g}};Ry=My([_i(),Ey(0,vi(dd)),By("design:paramtypes",[Object])],Ry);let Oy=!1;const Py=new ai(((t,e,i,s)=>{Oy||(Oy=!0,t(cf).to(Ry).inSingletonScope(),t(gf).toService(cf))}));var Iy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ly=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Dy=function(t,e){return function(i,s){e(i,s,t)}};let Fy=class extends ly{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=ll}};Fy=Iy([_i(),Dy(0,vi(ld)),Ly("design:paramtypes",[Object])],Fy);let jy=!1;const Ny=new ai(((t,e,i,s)=>{jy||(jy=!0,t(of).to(Fy).inSingletonScope(),t(gf).toService(of))}));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},Hy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zy=function(t,e){return function(i,s){e(i,s,t)}};let Vy=class extends em{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=hl}};Vy=Uy([_i(),zy(0,vi(hd)),Hy("design:paramtypes",[Object])],Vy);let Wy=!1;const Gy=new ai(((t,e,i,s)=>{Wy||(Wy=!0,t(uf).to(Vy).inSingletonScope(),t(gf).toService(uf))}));var Yy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Xy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$y=function(t,e){return function(i,s){e(i,s,t)}};let Ky=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=ul}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};Ky=Yy([_i(),$y(0,vi(pd)),Xy("design:paramtypes",[Object])],Ky);let qy=!1;const Zy=new ai(((t,e,i,s)=>{qy||(qy=!0,t(df).to(Ky).inSingletonScope(),t(gf).toService(df))})),Jy=Ip();function Qy(){Qy.__loaded||(Qy.__loaded=!0,Mc.RegisterGraphicCreator("arc",Sc),Vi.load(hg),Vi.load(Jy?ey:om))}Qy.__loaded=!1;const t_=Qy;function e_(){e_.__loaded||(e_.__loaded=!0,Mc.RegisterGraphicCreator("area",_c),Vi.load(fg),Vi.load(Jy?by:pm))}e_.__loaded=!1;const i_=e_;function s_(){s_.__loaded||(s_.__loaded=!0,Mc.RegisterGraphicCreator("group",sh))}s_.__loaded=!1;const n_=s_;function r_(){r_.__loaded||(r_.__loaded=!0,Mc.RegisterGraphicCreator("line",Zh),Vi.load(pg),Vi.load(Jy?gy:Dm))}r_.__loaded=!1;const a_=r_;function o_(){o_.__loaded||(o_.__loaded=!0,Mc.RegisterGraphicCreator("path",mc),Vi.load(xg),Vi.load(Jy?Ny:$m))}o_.__loaded=!1;const l_=o_;function h_(){h_.__loaded||(h_.__loaded=!0,Mc.RegisterGraphicCreator("polygon",kc),Vi.load(Ag),Vi.load(Jy?Gy:zm))}h_.__loaded=!1;const c_=h_;function u_(){u_.__loaded||(u_.__loaded=!0,Mc.RegisterGraphicCreator("rect",ec),Vi.load(ug),Vi.load(Jy?oy:iv))}u_.__loaded=!1;const d_=u_;function p_(){p_.__loaded||(p_.__loaded=!0,Mc.RegisterGraphicCreator("richtext",pc),Vi.load(Mg),Vi.load(Jy?Zy:nv))}p_.__loaded=!1;const g_=p_;function f_(){f_.__loaded||(f_.__loaded=!0,Mc.RegisterGraphicCreator("shadowRoot",Cc))}f_.__loaded=!1;const m_=f_;function v_(){v_.__loaded||(v_.__loaded=!0,Mc.RegisterGraphicCreator("symbol",$h),Vi.load(vg),Vi.load(Jy?Cy:cv))}v_.__loaded=!1;const y_=v_;function __(){__.__loaded||(__.__loaded=!0,Mc.RegisterGraphicCreator("text",Gh),Vi.load(_g),Vi.load(Jy?Py:gv))}__.__loaded=!1;const b_=__;function x_(){n_(),d_()}const S_=-.5*Math.PI,A_=1.5*Math.PI,w_="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 k_;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(k_||(k_={}));const T_={[k_.selectedReverse]:{},[k_.selected]:{},[k_.hover]:{},[k_.hoverReverse]:{}},C_={container:"",width:30,height:30,style:{}};function M_(){return"browser"===Ap.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const B_={debounce:gt,throttle:ft};x_();class E_ extends Wg{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},E_.defaultAttributes,t)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},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=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/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=>{this._clearDragEvents();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});const r=M_(),a="browser"===Ap.env?Ap:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:u}=this.attribute,d=ct(u[1]-u[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&d<1?a/c*(1-d):0,[n,r]},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:B_[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:ut(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=ut(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",B_[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===Ap.env?Ap:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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(),u=this._getSliderPos(ut(s,n[0],n[1])),d=u[1]-u[0];let p;this._sliderSize=d,p="horizontal"===t?{x:u[0],y:c.y1,width:d,height:c.height}:{x:c.x1,y:u[0],width:c.width,height:d};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:Ce(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,[s,n,r,a]=Ce(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,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=ct(t[0],0,1),c=ct(t[1],0,1),u=ct(c-h,0,1),d=Math.max(u*o,i),p=Math.max(o-d,0),g=l+h/Math.max(1-u,1e-12)*p;return[g,g+d]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=ut(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?ut([a+i*n,a+s*n],a,n-l):ut([o+i*r,o+s*r],o,r-l)}_clearDragEvents(){const t=M_(),e="browser"===Ap.env?Ap:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===Ap.env?Ap:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}}function R_(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&R_(t,e)}))}E_.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,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 O_=t=>!d(t)&&!1!==t.visible;const P_=["#ffffff","#000000"];function I_(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new Ae(t).toHex(),o=new Ae(e).toHex();return L_(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(...P_);for(const n of a)if(t!==n&&L_(n,e,i,s,r))return n}(a,o,i,s,n,r)}function L_(t,e,i,s,n){if("lightness"===n){const i=Ae.getColorBrightness(new Ae(e));return Ae.getColorBrightness(new Ae(t))<.5?i>=.5:i<.5}return s?D_(t,e)>s:"largeText"===i?D_(t,e)>3:D_(t,e)>4.5}function D_(t,e){const i=F_(t),s=F_(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function F_(t){const e=ke(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 j_(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 N_(t){let e=function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}function U_(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=Pt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const H_=(t,e,i,s)=>new ne(Object.assign({defaultFontParams:Object.assign({fontFamily:w_,fontSize:14},s),getTextBounds:i?void 0:Rc,specialCharSet:"-/: .,@%'\"~"+ne.ALPHABET_CHAR_SET+ne.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function z_(t,e,i={}){if(!t)return{width:0,height:0};const s=Rc({text:t,fontFamily:e.fontFamily||i.fontFamily||w_,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 V_(t,e="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 W_(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function G_(t,e="type"){const i=V_(t,e);return"rich"===i?Mc.richtext(W_(t)):("html"===i?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"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),Mc.text(t))}function Y_(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)}function X_(){n_(),d_(),y_(),g_(),b_()}var $_=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&&(T=h,P.setAttribute("maxLineWidth",h-b[1]-b[2]))),w=0,k=0;let U=0;"left"===j||"start"===j?U=1:"right"===j||"end"===j?U=-1:"center"===j&&(U=0),U?U<0?(w-=T,A&&A.setAttribute("x",(A.attribute.x||0)-I),x.setAttribute("x",-b[1]-B)):U>0&&x.setAttribute("x",b[3]):(w-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-I/2),x.setAttribute("x",-B/2));const H="right"===_||"end"===_,z="left"===_||"start"===_,V=(t,e)=>{"richtext"===P.type?P.setAttributes({x:t,textAlign:e,textConfig:G(P.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):P.setAttributes({x:t,textAlign:e})};if((_?"center"===_:y)&&U){const t=T-b[1]-b[3],e=I+B,i=1===U?(t-e)/2+B+I/2:b[0]+B-(T/2+e/2-B)+I/2;if(V(i,"center"),A){const t=i-I/2-B+F/2;A.setAttributes({x:t})}}if(z&&1!==U){const t=T-b[1]-b[3],e=0===U?-t/2+B/2:-T+b[3]+b[1]+B;if(V(e+B,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(H&&-1!==U){const t=T-b[1]-b[3],e=0===U?t/2+B/2:t;if(V(e,"right"),A){const t=e-I-B+F/2;A.setAttributes({x:t})}}"middle"===N?(k-=C/2,A&&A.setAttribute("y",0)):"bottom"===N?(k-=C,A&&A.setAttribute("y",-L/2),x.setAttribute("y",-b[2])):"top"===N&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",L/2)),E(null==m?void 0:m.text)||(P.states=m.text);const{visible:W}=a,Y=$_(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},Y),{visible:W&&!!s,width:T,height:C,x:w,y:k}),"rect");if(E(null==m?void 0:m.panel)||(t.states=m.panel),Y.customShape){const e=Y.customShape;t.pathProxy=t=>e(this,t,new pn)}this._bgRect=t}this._textShape=P,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:j({},K_.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,u,d,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(u=this._bgRect)||void 0===u||u.clearStates(),null===(d=this._symbol)||void 0===d||d.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}K_.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const q_={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}},Z_={poptip:j({},q_)};class J_ extends Wg{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}n_(),a_();class Q_ extends J_{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},Q_.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})}}Q_.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},n_(),d_();class tb extends J_{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},tb.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})}}tb.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},n_(),a_(),c_(),y_();class eb extends Wg{getStartAngle(){return Ht(this._startAngle)}getEndAngle(){return Ht(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},eb.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(A(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(q(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=Mc.line(Object.assign(Object.assign({points:t},_(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),E(null==s?void 0:s.line)||(a.states=_(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=Mc.line;G(i)[0].cornerRadius&&(t=Mc.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},G(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),E(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:u=0,refAngle:d=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(A(r)?c*Math.cos(r)+u*Math.cos(r-Math.PI/2):0),y:l.y+(A(r)?c*Math.sin(r)+u*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(A(a)?c*Math.cos(a)+u*Math.cos(a-Math.PI/2):0),y:h.y+(A(a)?c*Math.sin(a)+u*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=Mc.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+d:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),E(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?E(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):E(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?A(i)?t[i]:q(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}}var ib,sb;eb.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.labelHoverOnAxis="axis-label-hover-on-axis",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",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(ib||(ib={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(sb||(sb={}));const nb={[sb.selectedReverse]:{},[sb.selected]:{},[sb.hover]:{},[sb.hoverReverse]:{}},rb={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}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},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}}},ab={size:8,stroke:"#000",lineWidth:1,zIndex:1};const ob=Math.sin(Math.PI/10);function lb(t,e=ob){const i=!d(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function hb(t,e=ob){const i=!d(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function cb(t){const e={};return R_(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function ub(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function db(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 pb(t,e,i){var s;if(hb(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>re(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>re(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>ae(n,r)}function gb(t,e){for(let i,s=1,n=t.length,r=t[0];s{this._lastHover=((t,e,i)=>{const s=t.target;return s!==i&&s.name&&!E(s.states)?(s.addState(k_.hover,!0),R_(e,(t=>{t!==s&&t.name&&!E(t.states)&&t.addState(k_.hoverReverse,!0)})),s):i})(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=((t,e,i)=>i?(R_(e,(t=>{t.name&&!E(t.states)&&(t.removeState(k_.hoverReverse),t.removeState(k_.hover))})),null):i)(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=((t,e,i)=>{const s=t.target;return i===s&&s.hasState(k_.selected)?(R_(e,(t=>{t.name&&!E(t.states)&&(t.removeState(k_.selectedReverse),t.removeState(k_.selected))})),null):s.name&&!E(s.states)?(s.addState(k_.selected,!0),R_(e,(t=>{t!==s&&t.name&&!E(t.states)&&t.addState(k_.selectedReverse,!0)})),s):i})(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=Mc.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._prepare(),this._prevInnerView=this._innerView&&cb(this._innerView),this.removeAllChild(!0),this._innerView=Mc.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation()}_prepare(){this._prepareAnimate(mb)}_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=Mc.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=ib.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=Mc.group({x:0,y:0,pickable:!1});t.name=ib.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",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let u=r.width(),d=r.height();n&&(u=Math.abs(u*Math.cos(n)),d=Math.abs(d*Math.sin(n))),a=Math.max(a,u),o=Math.max(o,d),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=Mc.group({x:0,y:0,pickable:!1});i.name=ib.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=Mc.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=ib.tick,r.id=this._getNodeId(t.id),E(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=T_;else{const t=this.data[s],e=j({},T_,this.attribute.tick.state);Object.keys(e).forEach((i=>{u(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=Mc.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=ib.subTick,r.id=this._getNodeId(`${n}`),E(s.state))r.states=T_;else{const i=j({},T_,s.state);Object.keys(i).forEach((s=>{u(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&&u(s)&&(e=s(e,i));const n=this._transformItems(e),r=Mc.group({x:0,y:0,pickable:!1});return r.name=`${ib.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=G_(this._getLabelAttribute(t,e,n,i));if(a.name=ib.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),E(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=T_;else{const s=j({},T_,this.attribute.label.state);Object.keys(s).forEach((r=>{u(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new K_(Object.assign({},e));i.name=ib.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return ub(t,this.getVerticalVector(e,i,t))}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&&u(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;At(s[0])>At(s[1])?o=_t/2*(l.x>e.x?1:-1):h=_t/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]?d+=(this.axisLabelLayerSize[s-1].height+R(this.attribute,"label.space",4))*s:d+=(this.axisLabelLayerSize[s-1].width+R(this.attribute,"label.space",4))*s);const f=this.getVerticalCoord(t.point,d,o),m=this.getVerticalVector(d||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:y}=this.attribute.label;y=u(y)?j({},rb.label.style,y(t,e,i,s)):y;y=j(this.getLabelAlign(m,o,y.angle),y),u(y.text)&&(y.text=y.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let _=y.react;return u(_)&&(_=_(t,e,i,s)),Object.assign(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),{react:_})}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}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},R_(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(e.setFinalAttributes(e.attribute),r){r.release();const i=r.attribute,a=e.getFinalAttribute(),o=function(t,e,i){const s={};for(const i in e)i in t&&z(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}(i,a);let l=Object.keys(o).length>0;if("opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l){this._newElementAttrMap[e.id]={state:"update",node:e,attrs:e.attribute};const i=r.attribute;e.setAttributes(i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}])}}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const yb={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&&pb(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function _b(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function bb(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;t{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},wb(t,e.attribute.angle)),{angle:Ab(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({},kb(t,e.attribute.angle)),{angle:Ab(e.attribute.angle)}))}))}(t,e),function(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=Zt({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function Ab(t=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 wb(t,e=0){let 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=Ab(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 kb(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=Ab(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 Tb(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(E(t)||!A(i))return;const o=function(t){return A(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!d(h),u=c?Math.cos(h):1,p=c?Math.sin(h):0,f=hb(h),m=lb(h),v="top"===r||"bottom"===r,y=l.attribute.direction,_=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===y&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==y){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===y||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/u,l=Math.abs(i/p);if(_&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(u);r=Math.min(t,l)}else if(_&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(u);r=Math.min(t,l)}else r=l}else r=Math.abs(i/u);A(t.attribute.maxLineWidth)&&(r=A(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function Cb(t,e,i){let s;return A(e)&&(s=Math.abs(e-t)),A(i)&&(s=A(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class Mb{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,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=N_(this.getRelativeVector());return function(t,e){return[t[0]*e,t[1]*e]}([n[1],-1*n[0]],t*(e?1:-1)*s)}}class Bb{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-Bb.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*Bb.bounceIn(2*t):.5*Bb.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/St*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*St/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/St*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*St/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/St*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*St/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*St/e)*.5+1}}static registerFunc(t,e){Bb[t]=e}}function Eb(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}Bb.quadIn=Bb.getPowIn(2),Bb.quadOut=Bb.getPowOut(2),Bb.quadInOut=Bb.getPowInOut(2),Bb.cubicIn=Bb.getPowIn(3),Bb.cubicOut=Bb.getPowOut(3),Bb.cubicInOut=Bb.getPowInOut(3),Bb.quartIn=Bb.getPowIn(4),Bb.quartOut=Bb.getPowOut(4),Bb.quartInOut=Bb.getPowInOut(4),Bb.quintIn=Bb.getPowIn(5),Bb.quintOut=Bb.getPowOut(5),Bb.quintInOut=Bb.getPowInOut(5),Bb.backIn=Bb.getBackIn(1.7),Bb.backOut=Bb.getBackOut(1.7),Bb.backInOut=Bb.getBackInOut(1.7),Bb.elasticIn=Bb.getElasticIn(1,.3),Bb.elasticOut=Bb.getElasticOut(1,.3),Bb.elasticInOut=Bb.getElasticInOut(1,.3*1.5),Bb.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),Bb.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},Bb.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)Bb[`flicker${t}`]=e=>Eb(e,t);for(let t=2;t<10;t++)Bb[`aIn${t}`]=e=>t*e*e+(1-t)*e;function Rb(t,e,i){return t+(e-t)*i}const Ob=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=Rb(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=Rb(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=Rb(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=Rb(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=Rb(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=Rb(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=Rb(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=Rb(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=Rb(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=Fl(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?Nl(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=Fl(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?Nl(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=Rb(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=Rb(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=Rb(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=Rb(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=Rb(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=Rb(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=Rb(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=Rb(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=Rb(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=Rb(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=Rb(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=Rb(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=Rb(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=Rb(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=Rb(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=Rb(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=ka(e,i,s),r.addUpdateBoundTag()}}};function Pb(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.setAttributes(this.target.attribute)},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=Bb[s])&&void 0!==n?n:Bb.linear:Bb.linear,"wait"===t&&(this.onUpdate=Ib),this.id=ri.GenAutoIncrementId(),this.syncAttributeUpdate=Ib}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(y(i)&&y(s)){const n=Ll.Get(i,Il.Color255),r=Ll.Get(s,Il.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(Ob["fill"===e?"fillPure":"strokePure"])}else Ob[e]?t.push(Ob[e]):t.push(Pb)}else Ob[e]?t.push(Ob[e]):t.push(Pb)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate;this.target.animates.forEach((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const i=e.getStartProps();this.propKeys.forEach((t=>{null!=i[t]&&e.preventAttr(t)}))}))}deleteSelfAttr(t){var e;delete this.props[t],this.fromProps&&delete this.fromProps[t];const i=this.propKeys.indexOf(t);-1!==i&&(this.propKeys.splice(i,1),null===(e=this.interpolateUpdateFunctions)||void 0===e||e.splice(i,1))}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){this.target.setAttributes(this.props),t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}const Db=new Xi;class Fb{constructor(){this.released=!1}tick(t,e){Db.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class jb extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===es.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=es.INITIAL,Gi.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),Gi.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new Fb;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==es.INITIAL&&(this.status=es.PAUSE,!0)}resume(){return this.status!==es.INITIAL&&(this.status=es.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===es.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===es.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=es.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=es.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===es.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===es.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,Gi.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;_(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:Hb.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=Ub(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let u=0;l&&(u="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=u,o.custom=null!==(s=t.custom)&&void 0!==s?s:Hb.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const d=Ub(o.custom);o.customType=d;const p=e+h+c+u*(this._target.count-2),g=A(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=u*g,o.startTime=a}return o}execute(t){Array.isArray(t)?t.forEach((t=>this._execute(t))):this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,d;const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:y=0,duration:_=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:w=0,options:k,custom:T,customType:C,controlOptions:M}=t,B=e.animate();B.priority=w;const E=u(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,R=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],O=null===(l=e.context)||void 0===l?void 0:l.indexKey;R&&O&&(i=null!==(h=R[O])&&void 0!==h?h:i),B.startAt(b);const P=i*x+E;P>0&&B.wait(P);let I=null,L=t.to,D=t.from;L||(I||(I=this.createPropsFromChannel(g,e)),L=I.props),D||(I||(I=this.createPropsFromChannel(g,e)),D=I.from),I.attrOutChannel&&e.setAttributes(I.attrOutChannel),this._handleRunAnimate(B,T,C,D,L,_,m,f,M,k,p,e);let F=0;x&&(F=x*(s-i-1));const j=u(y)?y(null===(d=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===d?void 0:d[0],e,{}):y;return j>0&&(F+=j),F>0&&B.wait(F),S&&S>0&&B.loop(S),A&&B.bounce(!0),B}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,d){var p,g,f,m,v,y,_,b;if(e&&i){i=Ub(e);let c=this.resolveValue(o,d);"function"==typeof c&&(c=c(null===(g=null===(p=d.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],d,{})),c=Object.assign({width:(null===(f=d.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=d.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},c);const x=u(h)?h.call(null,null!==(y=c&&(null===(v=c.data)||void 0===v?void 0:v[0]))&&void 0!==y?y:null===(b=null===(_=d.context)||void 0===_?void 0:_.data)||void 0===b?void 0:b[0],d,c):h;c.options=x,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;const{timeSlices:l,startTime:h=0,loop:c,bounce:u,oneByOneDelay:d,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*d),c&&c>0&&v.loop(c),u&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),d&&v.wait(d*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:d=0}=t,p=u(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=u(d)?d(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):d;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let u=null,d=t.to,p=t.from;d||(u||(u=this.createPropsFromChannel(a,i)),d=u.props),p||(u||(u=this.createPropsFromChannel(a,i)),p=u.from),u.attrOutChannel&&i.setAttributes(u.attrOutChannel);const g=null!==(n=t.custom)&&void 0!==n?n:Hb.builtInAnimateMap[r],f=t.custom?t.customType:Ub(g);this._handleRunAnimate(e,g,f,p,d,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e){var i;const s={};let n=null;if(!t)return{from:n,props:s,attrOutChannel:null};const r={};let a=!1;const o=null===(i=e.context)||void 0===i?void 0:i.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===o[e]||(t[e]={to:o[e]}),t)),{})),Object.keys(t).forEach((i=>{var r,a,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?s[i]=h.to(null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,{}):s[i]=h.to),void 0!==h.from&&(n||(n={}),"function"==typeof h.from?n[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):n[i]=h.from)})),o)for(const t in o){const e=o[t];void 0!==e&&(s.hasOwnProperty(t)||(r[t]=e,a=!0))}return{from:n,props:s,attrOutChannel:a?r:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}executeItem(t,e,i=0,s=1){return Array.isArray(t)?t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean):[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=ss.END),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}Hb.builtInAnimateMap={};class zb extends Lb{constructor(t,e,i,s,n){super("customAnimate",e,i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class Vb extends zb{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class Wb{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new Hb(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttr(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function Gb(t){return new Wb(t)}class Yb extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",u=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";u=Math.max(u,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";u=Math.max(u,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";u=Math.max(u,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";u=Math.max(u,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";u=Math.max(u,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";u=Math.max(u,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=u)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,this.target.setAttribute("text",n)}}const Xb=1e3,$b="quadInOut",Kb=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],qb=(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=Fl(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Zb=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?tg(t):[],n=tg(e);i&&s&&(i.fromTransform&&eg(s,i.fromTransform.clone().getInverse()),eg(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})))},Qb=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],tx=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Qb.includes(n))return;const r=e[n];if(!d(r)&&!d(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?Ll.Get(t,Il.Color255):t;i.push({from:_(t[n])?t[n].map(e):e(t[n]),to:_(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class ex extends zb{constructor(t,e,i){super({},{},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;Zb(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&qb(this.otherAttrs,i,e),this.target.setAttributes(i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const ix=(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=Jb(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=tx(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const u=new ex({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Xb,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:$b);return c.play(u),c};class sx extends zb{constructor(t,e,i){super({},{},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;Zb(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&&qb(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const nx=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Kb.includes(t))(i)||(e[i]=t[i])})),e},rx=(t,e,i)=>{const s=nx(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),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=Gi.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},ax=(t,e,i)=>{const s=[],n=i?null:nx(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:nx(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=Jh(t.attribute),n=sg(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(Gi.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=sg(o*(r+a)/2,l,e),c=[],u=l/h.length,d=a>=r?1:-1,p=n>=s?1:-1;for(let t=0,e=h.length;t{s.push(Gi.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=sg(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(Gi.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 ng(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 ng(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(Gi.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:rg(i)}];const s=[];return og(i,e,s),s})(t,e).forEach((t=>{s.push(Gi.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 og(l,e,h),h})(t,e).forEach((t=>{s.push(Gi.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=tg(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(Gi.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(Gi.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&rx(t,s,e),s};class lx extends zb{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){super.onBind();const{points:t,segments:e}=this.target.attribute,{points:i,segments:s}=this.target.getFinalAttribute();this.from={points:t,segments:e},this.to={points:i,segments:s},this.props=this.to;const n=this.getPoints(this.from),r=this.getPoints(this.to,!0);this.fromPoints=n?Array.isArray(n)?n:[n]:[],this.toPoints=r?Array.isArray(r)?r:[r]:[];const a=new Map;this.fromPoints.forEach((t=>{t.context&&a.set(t.context,t)}));let o,l,h=1/0,c=-1/0;for(let t=0;t=0;t-=1)if(a.has(this.toPoints[t].context)){c=t,l=a.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(c)?(this.clipRange=this.toPoints[c][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[c][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),A(this.clipRange)?this.clipRange=ct(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let u=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=a.get(t.context);return i?(u=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ec&&l?[l,t]:[u,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new Dt(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;A(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(t)return Object.keys(this.to).forEach((t=>{this.target.attribute[t]=this.to[t]})),this.target.addUpdatePositionTag(),void this.target.addUpdateShapeAndBoundsTag();if(this.points=this.points.map(((t,i)=>{const s=wa(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));this.target.setAttributes({clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.target.attribute.segments=e}else this.target.attribute.points=this.points;this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class hx extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0}));const o=this.target.getFinalAttribute();o&&this.target.setAttributes(o),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(a)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class cx extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Object.assign(this.target.attribute,i),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class ux extends hx{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class dx extends cx{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}const px=(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.getFinalAttribute();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.getFinalAttribute();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)};class gx extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this._updateFunction=null}updateStartAngle(t){this.target.attribute.startAngle=this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t}updateEndAngle(t){this.target.attribute.endAngle=this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class fx extends gx{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=px(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r),this.determineUpdateFunction()}}class mx extends gx{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class vx extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/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:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class yx extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const _x=(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,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:d(l)?void 0:c,height:d(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class bx extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=_x(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class xx extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:d(o)?void 0:h,height:d(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:d(r)?void 0:t,height:d(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:d(r)?void 0:o,height:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const Sx=(t,e,i)=>{const s=t.getFinalAttribute().points,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&&(A(e.center.x)&&(n.x=e.center.x),A(e.center.y)&&(n.y=e.center.y)),"area"===t.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class Ax extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(this.target.attribute.points=r.map(((t,i)=>wa(r[i],a[i],e))),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class kx extends Ax{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:Sx(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class Tx extends Ax{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:Sx(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const Cx=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class Mx extends Ax{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:Cx(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class Bx extends Ax{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:Cx(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const Ex=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class Rx extends Ax{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:Ex(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class Ox extends Ax{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:Ex(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const Px=(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.getFinalAttribute(),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.getFinalAttribute();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)};class Ix extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Lx extends Ix{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=Px(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}}class Dx extends Ix{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const Fx=(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.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:d(a)?void 0:l,width:d(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class jx extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=Fx(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Nx extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:d(r)?void 0:t,width:d(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:d(r)?void 0:o,width:d(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Ux extends Vb{onBind(){var t;const e=Gb(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;this.target.setAttributes({x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class Hx extends Vb{onBind(){const t=Gb(this.target);this._animator=t;const e=this.duration,i=this.easing,{config:s,diffAttrs:n}=this.params;t.animate(this.target,{type:"to",to:Object.assign({},n),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},n)}}),this.completeBind(t)}deleteSelfAttr(t){super.deleteSelfAttr(t),this._animator.deleteSelfAttr(t)}tryPreventConflict(){}}function zx(){n_(),a_(),g_(),b_(),Hb.registerBuiltInAnimate("axisEnter",Ux),Hb.registerBuiltInAnimate("axisUpdate",Hx)}var Vx=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{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=Mc.group({zIndex:999});e.name=ib.axisBreak,e.id=this._getNodeId(`${ib.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=j({},ab,s),a=null!==(e=r.size)&&void 0!==e?e:ab.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=Mc.symbol(Object.assign({x:s.x,y:s.y},o));l.name=ib.axisBreakSymbol;const h=Mc.symbol(Object.assign({x:n.x,y:n.y},o));h.name=ib.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=Mc.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=ib.background,n.id=this._getNodeId("background"),n.states=j({},nb,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new K_(Object.assign({},t));e.name=ib.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=Vx(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];E(l)||(c.state={line:j({},nb,l),symbol:j({},nb,l)});const u=new eb(c);u.name=ib.line,u.id=this._getNodeId("line"),t.add(u)}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}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:u}=s,p=Vx(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),y=this.getRelativeVector();let _=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+R(this.attribute,"label.space",4);_+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===y[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?_+=i+(e-1)*t:_=0}else if(0===y[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;_+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{_+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}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.getActualOffset(x),w=this.getVerticalCoord(v,S,!1),k=this.getVerticalVector(S,!1,{x:0,y:0});let T,C,{angle:M}=p;if(T="start"===n?"start":"end"===n?"end":"center",d(M)&&o){M=U_(y,[1,0],!0);const{verticalFactor:t=1}=this.attribute;C=1==-1*t?"bottom":"top"}else T=this.getTextAlign(k),C=this.getTextBaseline(k,!1);let B=u;if(d(B)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(A(s))if("bottom"===i||"top"===i)if(M!==Math.PI/2){const t=Math.abs(Math.cos(null!=M?M:0));B=t<1e-6?1/0:this.attribute.end.x/t}else B=s-S;else if(M&&0!==M){const t=Math.abs(Math.sin(M));B=t<1e-6?1/0:this.attribute.end.y/t}else B=s-S}const E=Object.assign(Object.assign(Object.assign({},w),p),{maxWidth:B,textStyle:Object.assign({textAlign:T,textBaseline:C},a),state:{text:j({},nb,c.text),shape:j({},nb,c.shape),panel:j({},nb,c.background)}});return E.angle=M,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}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:u}=s,p=Vx(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),y=this.getVerticalVector(m,!1,{x:0,y:0});let _,{angle:b}=p,x="center";if(d(b)&&a){b=U_(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;_=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(y,!1,o.angle);x=t,_=e}const S=u,A=h?h(c):c,w=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:_},o),text:A});return w.angle=b,l&&l.visible&&(w.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),w}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return at(t[1],0)?i=!at(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 wb(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return kb(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=Y(t),u=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-d}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=u?c:h,e=u?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,d=s.y;rd&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+d-n}):t.setAttributes({y:d,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(E(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:d,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:y,firstVisible:_,autoWrap:b,overflowLimitLength:x}=a;if(u(h))h(t,e,s,this);else{if(c)!function(t,e){if(E(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,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=jt(e)})),Sb(i,t),!xb(t))break}}(t,{labelRotateAngle:d,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(E(t)||!A(i))return;const a=t[0].attribute.angle,o=hb(a),l=lb(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,u,d,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=Cb(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);A(i)&&(c=Ct(c,i))}}else{if(l){const i=Cb(e.attribute.y,null===(u=t[s+1])||void 0===u?void 0:u.attribute.y,null===(d=t[s-1])||void 0===d?void 0:d.attribute.y);A(i)&&(c=Ct(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&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);Tb(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&function(t,e){if(E(t))return;const i=t.filter(_b);if(E(i))return;let s;s=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=u(n)?n:yb[n]||yb.parity;if(s.length>=3&&gb(s,r)){do{s=a(s,r)}while(s.length>=3&&gb(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=Y(i);pb(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),bb(l,s,n,(t=>pb(t,l,r))),bb(h,s,o,(t=>pb(t,h,r)||!(!n||t===l)&&pb(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:o,method:m,separation:v,lastVisible:y,firstVisible:_})}}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(A(c)&&(!A(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=Mc.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=ib.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-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(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,u=null!==(i=o.space)&&void 0!==i?i:4;let d=t,p=0,g=0;const f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=z_(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=Ce(l.padding);g=l.space+t[0]+t[2]}return d&&(d=(d-u-g-p-f-m)/e),d}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(){super.release(),this._breaks=null}}Wx.defaultAttributes=rb,W(Wx,Mb);const Gx=t=>t.map(((t,e)=>({index:e,value:t}))),Yx=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let u=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(u+=jt(90));const d=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;d||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=H_(a),y=t.range();let _=[];for(let i=0;i{Kx[t]=!0}));const tS=t=>-Math.log(-t),eS=t=>-Math.exp(-t),iS=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,sS=t=>10===t?iS:t===Math.E?Math.exp:e=>Math.pow(t,e),nS=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),rS=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),aS=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function oS(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 lS(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function hS(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function cS(t,e,i,s){return 1===i&&(i=0),hS(t,i,s)*(e/(1-i))}function uS(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function dS(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=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 gS{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=uS(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 d(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(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 d(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!d(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=ct(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=d(s)?(l-o)*i:s;let u=Math.exp(e);u=u/(u-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=u*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const fS=Symbol("implicit");class mS extends gS{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=$x.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=fS}clone(){const t=(new mS).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!==fS)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&&a>1;)a-=1,r=Math.floor((e-t)/a);return vS(t,e,r,n)}class _S extends mS{constructor(t){super(),this.type=$x.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=cS(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)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("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),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]}}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=[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(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:yS(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=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(t=10){const e=this.calculateVisibleDomain(this._range);return yS(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=dt(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,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 d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return d(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 _S(!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:bS}=Te;function xS(t,e){const i=typeof e;let s;if(d(e)||"boolean"===i)return()=>e;if("number"===i)return mt(t,e);if("string"===i){if(s=Ae.parseColorString(e)){const e=bS(Ae.parseColorString(t),s);return t=>e(t).formatRgb()}return mt(Number(t),Number(e))}return e instanceof we?bS(t,e):e instanceof Ae?bS(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):mt(Number(t),Number(e))}class SS extends gS{constructor(t=Qx,e=Qx){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=Qx,this._piecewise=lS,this._interpolate=xS}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 s=Array.from(t,J);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=vt,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=dt(i[0],i[r-1])),this._piecewise=r>2?dS:lS,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:Qx),this.rescale(i)):this._clamp!==Qx}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=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 d(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return d(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const AS=Math.sqrt(50),wS=Math.sqrt(10),kS=Math.sqrt(2),TS=[1,2,5,10],CS=(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=RS(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)),function(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(;++sn+t*s))):t>0?BS(0,-(e-1)/s,s):BS((e-1)/s,0,s)},MS=ht(((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 CS(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return CS(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=BS(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=BS(t,e,l);return n&&r.reverse(),r})),RS=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=TS[0];return i>=AS?s=TS[3]:i>=wS?s=TS[2]:i>=kS&&(s=TS[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function OS(t,e,i){const s=(e-t)/Math.max(0,i);return RS(s)}function PS(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;e0;){if(s=OS(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function LS(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 DS=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),FS=ht(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;d<=p;++d)for(c=1;cl)break;g.push(u)}}else for(;d<=p;++d)for(c=s-1;c>=1;--c)if(u=d>0?c/r(-d):c*r(d),!(ul)break;g.push(u)}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})),jS=ht(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=ES(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?DS(t,e,n):DS(t,e,pS(n)),h=DS(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),NS=ht(((t,e,i,s,n)=>PS(s(t),s(e),i).map((t=>pS(n(t))))));class US extends SS{constructor(){super(...arguments),this.type=$x.Linear}clone(){var t;const e=new US;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return MS(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(u(null==e?void 0:e.customTicks))return e.customTicks(this,t);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=ES(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(t=10){const e=this.calculateVisibleDomain(this._range);return PS(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(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r: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}}function zS(t){return e=>-t(-e)}function VS(t=Number.EPSILON){return e=>Math.max(e,t)}class WS extends SS{constructor(){super(nS(10),sS(10)),this.type=$x.Log,this._limit=VS(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new WS).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=nS(this._base),s=sS(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=zS(i),this._pows=zS(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=tS,this.untransformer=eS):(this._logs=i,this._pows=s,this._limit=VS(),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 Qx}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return FS(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return jS(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return NS(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return NS(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{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))))}}}W(WS,HS);class GS extends US{constructor(){super(rS(1),aS(1)),this.type=$x.Symlog,this._const=1}clone(){return(new GS).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).constant(this._const)}constant(t,e){return arguments.length?(this._const=t,this.transformer=rS(t),this.untransformer=aS(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return FS(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return jS(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return NS(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return NS(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}W(GS,HS);class YS{constructor(){this.type=$x.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!d(t)&&A(+t)?this._range[st(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 YS).domain(this._domain).range(this._range).unknown(this._unknown)}}function XS(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function $S(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!qx(t.type))return Gx(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return Gx([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:d=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),y=f&&f()?f().breakDomains:null,m=y&&y.length?v.filter((t=>y.every((e=>te[1])))):v;else if(p(h))m=XS(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=u(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=XS(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:d}):t.d3Ticks(e,{noDecimals:d})))}else{const i=null!==(s=u(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=u(e.tickMode)?e.tickMode:void 0;m=XS(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:d,customTicks:n}):t.ticks(e,{noDecimals:d,customTicks:n})))}var v,y;const _=t.domain();if(e.labelFirstVisible&&_[0]!==m[0]&&!m.includes(_[0])&&m.unshift(_[0]),e.labelLastVisible&&_[_.length-1]!==m[m.length-1]&&!m.includes(_[_.length-1])&&m.push(_[_.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=Xx(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=Xx(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=Y(l),r=f&&f()?qS.greedy:qS.parity;for(;l.length>=3&&gb(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;pb(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),$S(t,l,a,(e=>pb(e,t,i))),$S(n,l,o,(e=>pb(e,n,i)||!(!a||e===t)&&pb(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),Y(h)!==Y(m)&&h.push(Y(m))),m=h}}return Gx(m)},qS={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&pb(i,t,e)||(i=t,0))))}},ZS=(t,e,i,s)=>{const n=Xx(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},JS=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,QS=(t,e)=>t[1]{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),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?Gx([s[s.length-1]]):Gx([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=u(n)?n({axisLength:f,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=$(g),a=X(g);if(s.length<=f/n){const i=ZS(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=eA(s,i,o,e.labelLastVisible,Math.floor(n/l),!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=ZS(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!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])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+s{let s=t,n=e;for(;s=0?n=t:s=t+1}return s})(n,t.length,(t=>c(t)?1:-1));let d=u;do{if(d>u&&!r&&!c(d))d++;else{if(!s){o=d;break}{const s=t.length-1;let n,r=0;n=t.length%d>0?t.length-t.length%d+d:t.length;do{if(n-=d,n!==s&&!JS(e[n],e[s],i))break;r++}while(n>0);if(n===s){o=d,a=r;break}{const i=Math.floor(t.length/d)-r+1;if(i=0?QS(e[n-d],e[n]):t,u=Math.abs(t-c);if(u~~(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:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,u=a;for(;u>=n;--u)if(o=u*t+s,l=u*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&iA[31&o]&sA[1+(31&l)])return!0}else{if(i[h]&iA[31&o])return!0;if(i[c]&sA[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,u;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,iA[31&o]&sA[1+(31&l)]);else for(s(h,iA[31&o]),s(c,sA[1+(31&l)]),u=h+1;u{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,sA[31&a]|iA[1+(31&o)]);else for(n(l,sA[31&a]),n(h,iA[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=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 rA(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=ct(i,-o,t.width+l),u=ct(s,-o,t.width+l),d=ct(n,-a,t.height+h),p=ct(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(u),y1:t.y(d),y2:t.y(p)}}function aA(t,e,i=!1){return i?rA(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function oA(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=aA(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=rA(t,r)),e.getRange(r)))}function lA(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const u=s.filter((t=>p(t))),d=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return lA(t,e,n,o,h,c,l)}return!1}var d;if("moveY"===i.type){const s=(i.offset?u(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return lA(t,e,n,s,h,c)}if("moveX"===i.type){const s=(i.offset?u(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return lA(t,e,n,s,h,c)}return!1}const cA=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],uA=["top","inside-top","inside"];function dA(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:u=0}=s,d=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+u;let y=0,_=0;return d<0-h?y=-d:p>m&&(y=m-p),g<0-l?_=-g:f>v&&(_=v-f),{dx:y,dy:_}}const pA={mode:"same-time",duration:300,easing:"linear"};function gA(t){return 3===t||4===t}function fA(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 mA=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 vA(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)}}var yA=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{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const xA=(t,e)=>Math.ceil(t)>Math.floor(e),SA=([t,e],[i,s])=>s>t&&e>i;function AA(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}var wA=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{const e=t.target;e===this._lastHover||E(e.states)||(e.addState(k_.hover,!0),R_(this,(t=>{t===e||E(t.states)||t.addState(k_.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(R_(this,(t=>{E(t.states)||(t.removeState(k_.hoverReverse),t.removeState(k_.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void R_(this,(t=>{E(t.states)||(t.removeState(k_.selectedReverse),t.removeState(k_.selected))}));E(e.states)||(e.addState(k_.selected,!0),R_(this,(t=>{t===e||E(t.states)||t.addState(k_.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)===ys.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===ys.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if($t(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,u=s+o,d=n+l,p=r+h,g=d-c,f=p-u;return[vA(g,f,c,u,a,o),vA(-g,-f,d,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds)}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=Mc.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new pn)}return e&&e.getAttributes(!0).fill&&s.setAttribute("stroke",e.getAttributes(!0).fill),this.attribute.line&&!E(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),d(this._idToGraphic)||this._isCollectionBase&&d(this._idToPoint))return;const t=[];!1!==this._enableAnimation&&this._baseMarks.forEach((e=>{t.push(e.attribute),e.initAttributes(e.getAttributes(!0))}));const{overlap:e,smartInvert:i,dataFilter:s,customLayoutFunc:n,customOverlapFunc:r}=this.attribute;let a=this.attribute.data;if(u(s)&&(a=s(a)),a&&a.length){const t=new Set;a=a.filter((e=>!t.has(e.id)&&t.add(e.id)))}let o=this._initText(a);o=u(n)?n(a,o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(o);const l=[],h=o;if(!c(e)&&u(null==e?void 0:e.filterBeforeOverlap)){const t=this.getRelatedGraphic.bind(this);o.forEach((i=>{e.filterBeforeOverlap(i,t,this)?h.push(i):l.push(i)}))}u(r)?o=r(h,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(l):!1!==e&&(o=this._overlapping(h).concat(l)),u(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),o&&o.length&&o.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==i&&this._smartInvert(o),this._renderLabels(o),!1!==this._enableAnimation&&this._baseMarks.forEach(((e,i)=>{e.initAttributes(t[i])}))}_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&&!E(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!E(e)&&(t.states=e)}_createLabelText(t){var e,i;return G_(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;const i=[];let s;if(s=u(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),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,u=t=>o.get(t).x,d=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&xA(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&xA(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(at(r,u(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(AA([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:u=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!SA([d(n),p(n)],[d(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),d=o-(t+s);if(di){const e=t-(a-d),i=l(n)-e;Math.abs(i)<=u&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-d),e=l(r)-t;Math.abs(e)<=u&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=u&&Math.abs(h)<=u&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let _=0,b=t.length-1;for(;_<=b;)_===b?y.push(t[_]):(y.push(t[_]),y.push(t[b])),_++,b--;return y}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&s.setRange(aA(i,t.AABBBounds,!0))}))),h.length>0&&h.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&&s.setRange(aA(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(aA(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){var s;if(t){if(!1!==t.attribute.visible){if(null===(s=t.context)||void 0===s?void 0:s.animationState){const e=t.clone();return Object.assign(e.attribute,t.getAttributes(!0)),e.AABBBounds}return t.AABBBounds}const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:n,y:r}=e;return{x1:n,x2:n,y1:r,y2:r}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,u=(null==n?void 0:n.get(c))?"update":"enter";let d;o&&(d=this._createLabelLine(t,h));const p=d?{text:t,labelLine:d}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===u)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===u){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:u,mode:d,interactInvertType:p}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",y=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",_=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{TA[t]=e};var MA=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{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,u=(e.y1+e.y2)/2;let d=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":d=-1;break;case"right":d=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":d=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":d=0,p=0}return{x:c+d*(s+g)+Math.sign(d)*(l/2),y:u+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}BA.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const EA=()=>{CA("symbol",BA),CA("line-data",BA)};var RA=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{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,u=0;switch(e){case"top":case"inside-top":u=-.5;break;case"bottom":case"inside-bottom":u=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,u=-.5;break;case"top-left":c=-.5,u=-.5;break;case"bottom-right":c=.5,u=.5;break;case"bottom-left":c=-.5,u=.5}return l+=c*a,h+=u*o,{x:l,y:h}})(e,i);let d=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")?d=g?1:-1:i.includes("right")&&(d=g?-1:1),i){case"top-right":case"bottom-right":d=-1;break;case"top-left":case"bottom-left":d=1}return{x:c+d*s+d*l/2,y:u+p*s+p*h/2}}}OA.tag="rect-label",OA.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var PA=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{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=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}}(t,e,i,s)}};IA.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const LA=()=>{CA("line",IA),CA("area",IA)};var DA=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);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=u(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=u(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}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),h=l.getAttributes(!0),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.y)&&void 0!==o?o:0};if(!d(s[i])&&!d(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(h.startAngle+h.endAngle)/2,d=h.endAngle-h.startAngle,p=Vt(h.endAngle-d/2),g=Ut(c,h.outerRadius,o),f=Ut(c,a+e.line.line1MinLength,o),m=new FA(t,g,f,p,d,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=Ut(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(u=m.quadrant)||2===u?this._arcRight.set(m.refDatum,m):gA(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var u}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":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,u=t.innerRadius,d=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(d,h.height))p=0;else{let t;t=c>=Math.PI?u:Math.max(u,h.height/2/Math.tan(c/2)),p=d-t-a}!0!==r.rotate&&(p=d-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?u-l+y:"inside-center"===o?u+(d-u)/2:d+l-y,t.labelPosition=Ut(t.circleCenter,v,t.middleAngle),t.labelLimit=f,ot(f,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.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=gA(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=gA(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.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 c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(lt(t.pointB.x,this._line2MinLength+h)||ot(t.pointB.x,c-this._line2MinLength-h))&&(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(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:u,quadrant:d,pointB:p}=t;A(p.x*p.y)||(t.pointC={x:NaN,y:NaN},u.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=gA(d)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const y=this._getFormatLabelText(t.refDatum,v);t.labelText=y;let _=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-_-c:0+_+c;break;default:m=p.x+f*this._line2MinLength}_=Math.max(this._ellipsisWidth,_);const b=_0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):u.x=m+f*(this._alignOffset+c+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?d(h)||"auto"===h?"edge"===c?gA(t.quadrant)?"left":"right":gA(t.quadrant)?"right":"left":h:d(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,d)}else if(-1!==u&&-1===d){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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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;A(c)?t.pointB={x:s.x+c*(gA(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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),u=this._computeLayoutRadius(h/2,e,i),d=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(at(l/2,d))g=0,f=1,m=-p;else if(at(h/2,p))g=1,f=0,m=-d;else{const t=-1/(p/d);g=t,f=-1,m=p-t*d}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),u=-(e*h+i)/t;return 0===l?[{x:u,y:h}]:[{x:u,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-u,0,u);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.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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;e{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 HA(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=Ft.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 zA(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=db(t,!!n),o=db(r,!!n);const h=Ft.distancePP(s,l),c=Ft.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=HA(e,t,!1,!!n),o=HA(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=db(t,!!n),o=db(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}UA.defaultAttributes={pickable:!1};class VA extends Wg{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&cb(this._innerView),this.removeAllChild(!0),this._innerView=Mc.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 ub(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:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${ib.grid}-sub`:`${ib.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=db(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=HA(t,o,!1,!!a)}const d=Mc.path(Object.assign({path:c,z:l},u(r)?j({},this.skipDefault?null:VA.defaultAttributes.style,r(t,i)):r));d.name=`${h}-line`,d.id=this._getNodeId(`${h}-path-${n}`),e.add(d)})),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,d=n[1].y-n[0].y,p=Math.sqrt(c*c+d*d),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+d*g});const f=db(o,!!a),m=At(o[0].x-o[1].x),v=At(o[0].y-o[1].y),y=Mc.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*_t/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},u(r)?j({},this.skipDefault?null:VA.defaultAttributes.style,r(t,i)):r));y.name=`${h}-line`,y.id=this._getNodeId(`${h}-path-${s}`),e.add(y)})),n.length>1&&o){const t=_(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!at(a.value,0)&&!at(l.value,0),u=!at(a.value,1)&&!at(l.value,1),d=[],p=a.value>l.value;(p&&u||!p&&c)&&d.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{d.push(t.points)})),(p&&c||!p&&u)&&d.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}VA.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},n_(),l_();class WA extends VA{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},VA.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=S_,endAngle:r=A_}=this.attribute;i=function(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n=2){const n=this._getPointsOfSubGrid(s,i);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})}}function GA(){n_(),y_(),b_()}W(WA,Mb);const YA={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};GA();class XA extends Wg{getCurrent(){return this._current}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},XA.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(QA.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(QA.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===QA.focus||"focus"===o){const s=a.hasState(ZA.focus);a.toggleState(ZA.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[ZA.unSelected,ZA.unSelectedHover,ZA.focus],t),this._setLegendItemState(e,ZA.selected,t)})):(this._setLegendItemState(a,ZA.selected,t),this._removeLegendItemState(a,[ZA.unSelected,ZA.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[ZA.selected,ZA.selectedHover,ZA.focus],t),this._setLegendItemState(e,ZA.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(ZA.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(ZA.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(JA.legendItemClick,a,t);i?(this._removeLegendItemState(a,[ZA.selected,ZA.selectedHover],t),this._setLegendItemState(a,ZA.unSelected,t)):(this._setLegendItemState(a,ZA.selected,t),this._removeLegendItemState(a,[ZA.unSelected,ZA.unSelectedHover],t))}else this._setLegendItemState(a,ZA.selected,t),this._removeLegendItemState(a,[ZA.unSelected,ZA.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[ZA.selected,ZA.selectedHover],t),this._setLegendItemState(e,ZA.unSelected,t))}))}this._dispatchLegendEvent(JA.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,ZA.selected),this._removeLegendItemState(e,[ZA.unSelected,ZA.unSelectedHover])):(this._removeLegendItemState(e,[ZA.selected,ZA.selectedHover]),this._setLegendItemState(e,ZA.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=$A,spaceRow:l=KA,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:u,isHorizontal:d,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:d?i:e,v=this._contentMaxHeight;let y,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:w}=this._itemContext,k=0,T=0;const C=[];for(let t=g,e=u.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),y=u[t],y.id||(y.id=y.label),y.index=t;let e=!0;_(n)&&(e=n.includes(y.label));const i=this._renderEachItem(y,e,t,u),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),d?(p(s)&&(f&&a?(w=Math.ceil((S+g)/s),b=w>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||C.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),w+=1,S=0,A+=T+l,T=0,C.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),C.push(i)):(p(v)&&(f&&a?(w=Math.ceil((A+m)/v),b=w>1):v<=m?(w+=1,b=!0,A=0,t>0&&(S+=k+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=w,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=w),r||(this._itemContext.startIndex=u.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||E(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=Mc.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:u,height:d}=t,g=[];p(c)&&g.push(c),p(u)&&g.push(u),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=$(g)),p(d)&&(this._itemHeightByUser=d);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,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(),u=h.width();let d=!1;"labelFirst"===t?u>e?d=!0:s.setAttribute("maxLineWidth",e-u):"valueFirst"===t?c>e?d=!0:i.setAttribute("maxLineWidth",e-c):c+u>e&&(d=!0),d&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-u)),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:u,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,s),A=this._handleStyle(y,t,e,i,s),w=this._handleStyle(b,t,e,i,s),k=this._handleStyle(x,t,e,i,s),T=Ce(c);let C;!1===x.visible?(C=Mc.group({x:0,y:0,cursor:null===(n=k.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(C,QA.item,t,C)):(C=Mc.group(Object.assign({x:0,y:0},k.style)),this._appendDataToShape(C,QA.item,t,C,k.state)),C.id=`${null!=a?a:o}-${i}`,C.addState(e?ZA.selected:ZA.unSelected);const M=Mc.group({x:0,y:0,pickable:!1});C.add(M);let B,E=0,O=0,P=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);O=_(i)?i[0]||0:i,P=R(v,"space",8);const s=Mc.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&&d(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&d(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,QA.itemShape,t,C,S.state),s.addState(e?ZA.selected:ZA.unSelected),M.add(s)}let I=0;if(u){const e=R(g,"size",10);B=Mc.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(B,QA.focus,t,C),I=e}const L=y.formatMethod?y.formatMethod(o,t,i):o,D=G_(Object.assign(Object.assign({x:O/2+P,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,QA.itemLabel,t,C,A.state),D.addState(e?ZA.selected:ZA.unSelected),M.add(D);const F=R(y,"space",8);if(p(l)){const s=R(b,"space",u?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=G_(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:w.style.fontSize},w.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,QA.itemValue,t,C,w.state),r.addState(e?ZA.selected:ZA.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-O-P-F-I-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-O/2-T[1]-T[3]-I-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));E=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),M.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-O-P-I),E=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):E=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);B&&(B.setAttribute("x",E),M.add(B));const j=M.AABBBounds,N=j.width();if("right"===f){const t=j.x2,e=j.x1;M.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===B?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 U=j.height(),H=p(this.attribute.item.width)?this.attribute.item.width:N+T[1]+T[3],z=this._itemHeightByUser||U+T[0]+T[2];return C.attribute.width=H,C.attribute.height=z,B&&B.setAttribute("visible",!1),M.translateTo(-j.x1+T[3],-j.y1+T[0]),C}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new XA(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},j({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new XA(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new E_(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new E_(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?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 i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",ft(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=$A,spaceRow:o=KA}=n,l=this._itemsContainer,{space:h=qA,defaultCurrent:c=1}=r,u=ew(r,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,y=0,_=0,b=0,x=1;if(d){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(u),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v<_+i&&e>0&&(_=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:_,y:b}),_+=a+i})),this._itemContext.startX=_,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(u),this._pagerComponent=g,this._innerView.add(g),y=p-g.AABBBounds.height()-h-t,y<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;y0&&(b=0,_+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:_,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(d?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=Mc.group({x:0,y:t,width:d?v:f,height:d?m:y,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(d?m+o:f+a,d?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=$A,spaceRow:a=KA}=s,o=this._itemsContainer,{space:l=qA,defaultCurrent:h=1}=n,c=ew(n,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,d=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(u)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=d-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(u){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const y=Mc.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return y.add(o),this._innerView.add(y),this._itemContext.clipContainer=y,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(y),this._bindEventsOfPager(u?g:f,u?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=Mc.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];at(ct(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),at(ct(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(ZA.selected)?this._setLegendItemState(t,ZA.selectedHover,e):this._setLegendItemState(t,ZA.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===QA.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(JA.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(ZA.unSelectedHover)||t.hasState(ZA.selectedHover))&&(i=!0),t.removeState(ZA.unSelectedHover),t.removeState(ZA.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(ZA.unSelectedHover)&&!t.hasState(ZA.selectedHover)||(i=!0),t.removeState(ZA.unSelectedHover),t.removeState(ZA.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===QA.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(JA.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(JA.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!==QA.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(JA.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!==QA.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(JA.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(ZA.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=j({},iw,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(ZA.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(u(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]&&(u(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};sw.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:$A,spaceRow:KA,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:qA,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0};const nw=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return j(t,...e,{shape:i.every(d)?void 0:j({},...i),key:s.every(d)?void 0:j({},...s),value:n.every(d)?void 0:j({},...n)})},rw=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:G(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}},aw={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:w_,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:w_,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:w_,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new he).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},ow=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];n_(),d_(),y_(),b_(),g_();let lw=class t extends Wg{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: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 u=Ce(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:u[3],y:u[0]},"group");const d=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",j({symbolType:"circle"},d.shape,{visible:O_(d)&&O_(d.shape)}),"symbol"),"object"!=typeof d.value.text||null===d.value.text||"rich"!==d.value.text.type&&"html"!==d.value.text.type?d.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:O_(d)&&O_(d.value)},rw(d.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=d.value.text)&&void 0!==e?e:"",visible:O_(d)&&O_(d.value)},d.value),"text"):"rich"===d.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:O_(d)&&O_(d.value)},rw(d.value)),"richtext"):"html"===d.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:d.value.text.text},C_),d.value),visible:O_(d)&&O_(d.value),width:d.value.width,height:d.value.height,wordBreak:d.value.wordBreak,textAlign:d.value.textAlign,textBaseline:d.value.textBaseline,singleLine:!1,textConfig:[]},d.value),"richtext"));const g=O_(d.shape)?d.shape.size+d.shape.spacing:0,{textAlign:f,textBaseline:m}=d.value,v=n.width-u[3]-u[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",d.height):"middle"===m?this._tooltipTitle.setAttribute("y",d.height/2):this._tooltipTitle.setAttribute("y",0);const y=O_(d)?d.height+d.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",u[3]),this._tooltipContent.setAttribute("y",u[0]+y);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!O_(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),u=n.shape.size+n.shape.spacing;let d="right"===c?(o?u:0)+(O_(n.key)?r+n.key.spacing:0)+(O_(n.value)?a:0):0;this._createShape("right"===c?d-n.shape.size/2:d+n.shape.size/2,n,h,l),o&&("right"===c?d-=u:d+=u);const g=this._createKey(n,h,l);g&&(Y_(c,g,n.key.textAlign,d,r),g.setAttribute("y",0),"right"===c?d-=r+n.key.spacing:d+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";p(n.value.textAlign)?t=n.value.textAlign:O_(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),Y_(c,f,t,d,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(O_(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Ba(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(O_(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},rw(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},rw(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},C_),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(O_(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},rw(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},rw(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=>ow.includes(t)))?(this._mergeAttributes(e,s),d(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,u=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?u-=i+n:"middle"===l?u-=i/2:u+=n,c+e>h.x2&&(c-=e+s),u+i>h.y2&&(u-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&O_(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:u,value:d,shape:p,spaceRow:g}=i,f=O_(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=H_(u),y=H_(d);let _=0;if(O_(u)){const{width:t,height:e}=v.quickMeasure(u.text);l.push(t),_=Math.max(_,e)}if(O_(d)){const{width:t,height:e}=y.quickMeasure(d.text);h.push(t),_=Math.max(_,e)}f&&Io[m]&&(t=!0,r.push(p.size),_=Math.max(p.size,_)),e.height=_,o+=_,a{t.width=a})),e.hasContentShape=t,e.keyWidth=u,e.valueWidth=d}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return nw({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return nw({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};function hw(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return A(s)&&(t+=s),t}),0)}function cw(t,e){const i=uw(t),s=uw(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 uw(t,e={x:0,y:0}){return Ft.distancePP(t,e)}function dw(t,e,i){let s=!1;if(e&&u(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}lw.defaultAttributes=aw;function pw(t){return function(e){let i;return i=_(t)?t.reduce(((t,e)=>null==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function gw(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&gw(t[i],e)}}var fw,mw,vw;function yw(t){var e,i;const{type:s}=t;return s===mw.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!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.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_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"}(fw||(fw={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",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",t.mosaic="mosaic",t.pictogram="pictogram"}(mw||(mw={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",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.transform="transform",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.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.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(vw||(vw={}));const _w={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},bw={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function xw(t,e){var i;if(!t)return[];const s=Mw(t,e);if(!s||_(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?Tw(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>kw(i)?Aw(t,i,e):i)).filter(p)}))):i.map((i=>kw(i)?Aw(t,i,e):i)).filter(p):[]}return[]}function Sw(t,e){var i,s;return Tw(t)?null!==(s=null===(i=t.find((t=>p(t.isAvailable)?u(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 Aw(t,e,i){var s;const n=Mw(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=_w[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=bw[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(d(e.a)&&d(e.l)||!y(r))return r;let o=new Ae(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=ge(t,i,s),a=pe(n,r,e.l),l=new Ae(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return p(e.a)&&o.setOpacity(e.a),o.toRGBA()}const ww=(t,e)=>{if(e&&kw(t)){const i=Aw(e,t);if(i)return i}return t};function kw(t){return t&&"palette"===t.type&&!!t.key}function Tw(t){return!(!_(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function Cw(t){return _(t)?{dataScheme:t}:t}function Mw(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||d(n))r=null==t?void 0:t.default;else{const a=yw(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 Bw extends mS{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(!Tw(this._range))return void super.range(this._range);const t=Sw(this._range,this._domain);super.range(t)}}const Ew={linear:US,band:_S,point:class extends _S{constructor(t){super(!1),this.type=$x.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:mS,threshold:YS,colorOrdinal:Bw};function Rw(t){const e=Ew[t];return e?new e:null}function Ow(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function Pw(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function Iw(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function Lw(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function Dw(t){return!!y(t)&&(!!t.endsWith("%")&&Hg(t.substring(0,t.length-1)))}function Fw(t){return!!g(t)&&("percent"in t||"offset"in t)}function jw(t,e,i,s=0){var n,r;return S(t)?t:Dw(t)?Number(t.substring(0,t.length-1))*e/100:u(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 Nw(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]=jw(t[s],e.size,i)}))})),o}function Uw(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}}function Hw(t){let e={};return _(t)?(d(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),d(t[1])||(e.left=e.right=t[1]),d(t[2])||(e.bottom=t[2]),d(t[3])||(e.left=t[3]),e):S(t)||Dw(t)||u(t)||Fw(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function zw(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const Vw=(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},Ww=[{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"]}];function Gw(t,e){return t&&e.key in t?t[e.key]:e.default}function Yw(t){return t&&"token"===t.type&&!!t.key}const Xw={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%"},$w={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:Ww,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)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:Xw,component:{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}}},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:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},Kw={name:"dark",colorScheme:{default:{dataScheme:Ww,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",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},qw=(t,e,i)=>{if(d(e))return t;const s=e[0];return d(s)?t:1===e.length?(t[s]=i,t):(d(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),qw(t[s],e.slice(1),i))};function Zw(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=Cw(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}Jw._charts={},Jw._series={},Jw._components={},Jw._graphicComponents={},Jw._marks={},Jw._regions={},Jw._animations={},Jw._implements={},Jw._chartPlugin={},Jw._vChartPlugin={},Jw._componentPlugin={},Jw.transforms={fields:Ve,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}},Jw.dataParser={csv:(t,e={},i)=>(i.type=ze.DSV,Ze(t)),dsv:(t,e={},i)=>{i.type=ze.DSV;const s=Ne(Qe,e),{delimiter:n}=s;if(!y(n))throw new TypeError("Invalid delimiter: must be a string!");return qe(n).parse(t)},tsv:(t,e={},i)=>(i.type=ze.DSV,Je(t))},Jw._layout={},Jw._grammarTransforms={},Jw._stageEventPlugins={},Jw.registerStageEventPlugin=(t,e)=>{Jw._stageEventPlugins[t]=e},Jw.getStageEventPlugin=t=>Jw._stageEventPlugins[t],Jw._interactionTriggers={},Jw.registerInteractionTrigger=(t,e)=>{Jw._interactionTriggers[t]=e},Jw._composedEventMap={},Jw.registerComposedEvent=(t,e)=>{Jw._composedEventMap[t]=e},Jw._tooltipProcessors={},Jw.registerTooltipProcessor=(t,e)=>{Jw._tooltipProcessors[t]=e},Jw.createTooltipProcessor=(t,e)=>{const i=Jw._tooltipProcessors[t];return i?new i(e):null};const ek=t=>{const e={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"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e};ek();const ik={[$w.name]:$w},sk=$w.name,nk=new Map(Object.keys(ik).map((t=>[t,ik[t]]))),rk=new Map,ak=new Map(Object.keys(ik).map((t=>[t,t===sk]))),ok=(t,e)=>{if(!t)return;const i=uk(e);nk.set(t,i),ak.set(t,!0)},lk=(t=sk)=>(ak.has(t)&&!ak.get(t)&&ok(t,nk.get(t)),nk.get(t)),hk=t=>nk.delete(t)&&rk.delete(t)&&ak.delete(t),ck=t=>!!y(t)&&nk.has(t),uk=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:sk;return Qw({},lk(i),t)};class dk{static registerInstance(t){dk.instances.set(t.id,t)}static unregisterInstance(t){dk.instances.delete(t.id)}static getInstance(t){return dk.instances.get(t)}static instanceExist(t){return dk.instances.has(t)}static forEach(t,e=[],i){const s=G(e);return dk.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}dk.instances=new Map;class pk{static registerTheme(t,e){ok(t,e)}static getTheme(t,e=!1){return lk(t)}static removeTheme(t){return hk(t)}static themeExist(t){return ck(t)}static getDefaultTheme(){return pk.themes.get(sk)}static setCurrentTheme(t){pk.themeExist(t)&&(pk._currentThemeName=t,dk.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return pk.getTheme(pk._currentThemeName,t)}static getCurrentThemeName(){return pk._currentThemeName}}function gk(t){return y(t)?pk.themeExist(t)?pk.getTheme(t):{}:g(t)?t:{}}pk.themes=nk,pk._currentThemeName=sk;const fk=["animationThreshold","colorScheme","name","padding"];function mk(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];fk.includes(n)?s[n]=r:m(r)?kw(r)?s[n]=ww(r,e):Yw(r)?s[n]=Gw(i,r):s[n]=mk(r,e,i):s[n]=r})),s}function vk(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]=vk(t[s],e)}return i}return _(t)?t.map((t=>vk(t,e))):t}function yk(t,e){if(!t)return t;if(m(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(y(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=yk(t[s],e)}return i}return _(t)?t.map((t=>yk(t,e))):t}function _k(t,...e){return u(t)?t(...e):t}const bk=(t,e,i,s)=>((t,e,i)=>H_(t,e,i,{fontFamily:Xw.fontFamily,fontSize:Xw.fontSize}))(e,i,s).measure(t),xk="__VCHART",Sk=500,Ak=500,wk=`${xk}_MEASURE_CANVAS_ID`,kk=`${xk}_DEFAULT_DATA_INDEX`,Tk=`${xk}_DEFAULT_DATA_KEY`,Ck=`${xk}_DEFAULT_DATA_SERIES_FIELD`,Mk=`${xk}_DEFAULT_SERIES_STYLE_NAME`,Bk=`${xk}_STACK_KEY`,Ek=`${xk}_STACK_START`,Rk=`${xk}_STACK_END`,Ok=`${xk}_STACK_START_PERCENT`,Pk=`${xk}_STACK_END_PERCENT`,Ik=`${xk}_STACK_START_OffsetSilhouette`,Lk=`${xk}_STACK_END_OffsetSilhouette`,Dk=`${xk}_STACK_TOTAL`,Fk=`${xk}_STACK_TOTAL_PERCENT`,jk=`${xk}_STACK_TOTAL_TOP`,Nk=`${xk}_STACK_TOTAL_BOTTOM`,Uk=`${xk}_MOSAIC_VALUE_START_PERCENT`,Hk=`${xk}_MOSAIC_VALUE_END_PERCENT`,zk=`${xk}_MOSAIC_CAT_START_PERCENT`,Vk=`${xk}_MOSAIC_CAT_END_PERCENT`,Wk=`${xk}_SEGMENT_START`,Gk=`${xk}_SEGMENT_END`,Yk=`${xk}_KEY`,Xk=`${xk}_MAP_LOOK_UP_KEY`;function $k(t,e){for(let i=0;it.key===e))}function qk(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 Zk(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:{groupField:a.groupField,nodes:{}},iT(t,a,n[o],l,e,r))})),s?Jk(n):n}function Jk(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))):Jk(t[e].nodes);return t}function Qk(t,e){if("values"in t&&t.values.length){const i=hw(t.values,e),s=function(t,e){const i=[];return t.forEach((t=>{const s=+t[e];A(s)&&i.push(s)})),0===i.length?null:X(i)}(t.values,Pk);t.values.forEach((t=>{t[Dk]=i,t[Fk]=s}))}else for(const i in t.nodes)Qk(t.nodes[i],e)}function tT(t){if(!t.values.length)return;const e=t.values[t.values.length-1][Rk]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,u=null;const d=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!u||l[n.end]>u[n.end])&&(u=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)eT(t.nodes[r],e,i,s,n)}function iT(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[Rk]=function(t){if(A(t))return t;const e=+t;return A(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 l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),iT(t,e.nodes[l],i.nodes[l],s,n,r,h)}}function sT(t={}){const e=Object.assign({},t);if(u(t.style)?e.style=(e,i,s,n)=>rT(t.style(e,i,s,n)):E(t.style)||(e.style=rT(t.style)),!E(t.state)){const i={};Object.keys(t.state).forEach((e=>{u(t.state[e])?i[e]=(i,s,n,r)=>rT(t.state[e](i,s,n,r)):E(t.state[e])||(i[e]=rT(t.state[e]))})),e.state=i}return e}function nT(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{u(t[i])?e[i]=(e,s,n,r)=>rT(t[i](e,s,n,r)):E(t[i])||(e[i]=rT(t[i]))})),e}function rT(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:jt(t.angle)}):t}const aT=t=>"line"===t||"area"===t,oT=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return aT(i)?e:null==e?void 0:e[0]},lT=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let hT=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},n=Jw.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{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(Jw.getComposedEvent(t))if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};var cT;!function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(cT||(cT={}));const uT=["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 dT,pT,gT;t.ChartEvent=void 0,(dT=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",dT.rendered="rendered",dT.renderFinished="renderFinished",dT.animationFinished="animationFinished",dT.regionSeriesDataFilterOver="regionSeriesDataFilterOver",dT.afterInitData="afterInitData",dT.afterInitEvent="afterInitEvent",dT.afterInitMark="afterInitMark",dT.rawDataUpdate="rawDataUpdate",dT.viewDataFilterOver="viewDataFilterOver",dT.viewDataUpdate="viewDataUpdate",dT.viewDataStatisticsUpdate="viewDataStatisticsUpdate",dT.markDeltaYUpdate="markDeltaYUpdate",dT.viewDataLabelUpdate="viewDataLabelUpdate",dT.scaleDomainUpdate="scaleDomainUpdate",dT.scaleRawDomainUpdate="scaleRawDomainUpdate",dT.scaleUpdate="scaleUpdate",dT.dataZoomChange="dataZoomChange",dT.drill="drill",dT.layoutStart="layoutStart",dT.layoutEnd="layoutEnd",dT.layoutRectUpdate="layoutRectUpdate",dT.playerPlay="playerPlay",dT.playerPause="playerPause",dT.playerEnd="playerEnd",dT.playerChange="playerChange",dT.playerForward="playerForward",dT.playerBackward="playerBackward",dT.scrollBarChange="scrollBarChange",dT.brushStart="brushStart",dT.brushChange="brushChange",dT.brushEnd="brushEnd",dT.brushClear="brushClear",dT.brushActive="brushActive",dT.legendSelectedDataChange="legendSelectedDataChange",dT.legendFilter="legendFilter",dT.legendItemClick="legendItemClick",dT.legendItemHover="legendItemHover",dT.legendItemUnHover="legendItemUnHover",dT.tooltipShow="tooltipShow",dT.tooltipHide="tooltipHide",dT.tooltipRelease="tooltipRelease",dT.afterResize="afterResize",dT.afterRender="afterRender",dT.afterLayout="afterLayout",dT.afterMarkLayoutEnd="afterMarkLayoutEnd",dT.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(pT||(pT={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(gT||(gT={}));const fT=[gT.mark,gT.model,gT.chart,gT.vchart];class mT{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(gT.vchart,[]),this._levelNodes.set(gT.chart,[]),this._levelNodes.set(gT.model,[]),this._levelNodes.set(gT.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const vT={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"};class yT{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=R(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>oT(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||pT.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||pT.chart);o.get(t)||o.set(t,new mT);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||pT.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||pT.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||pT.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||pT.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?fT.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[pT.chart,pT.window,pT.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(u(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 vT[a]&&(a=vT[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)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?gT.model:gT.vchart:gT.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=ft(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=gt(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=pT.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==gT.model&&s!==gT.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=gT.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case pT.chart:return this._viewBubbles;case pT.window:return this._windowBubbles;case pT.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case pT.chart:return this._viewListeners;case pT.window:return this._windowListeners;case pT.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return uT.includes(t)||Object.values(cT).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&Jw.hasInteractionTrigger(e)}}function _T(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function bT(t,e,i){t.getParser(e)||t.registerParser(e,i)}const xT=new Map;function ST(t,e=!1){let i=e;return t.latestData instanceof ni&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const AT=(t,e)=>0===t.length?[]:1===t.length?ST(t[0],null==e?void 0:e.deep):t.map((t=>ST(t,null==e?void 0:e.deep)));function wT(e,i,s){_T(i=i instanceof si?i:e.dataSet,"copyDataView",AT);const n=new ni(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function kT(t,e,i=[]){var s;if(t instanceof ni)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(t.fields);let u;h.clone=!(!1===h.clone);const d=i.find((t=>t.name===n));if(d)u=d;else{const t={name:n};if(c&&(t.fields=c),u=new ni(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return Rg(`no data matches fromDataId ${o}`),null;u.parse([t],{type:"dataview"}),u.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return Rg(`no data matches fromDataIndex ${a}`),null;u.parse([t],{type:"dataview"}),u.transform({type:"copyDataView"})}else Array.isArray(r)?u.parse(r,h):!y(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(u.parse([]),Rg("values should be array")):u.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&u.transform(t)}))}return u}function TT(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var CT,MT,BT,ET;t.TransformLevel=void 0,(CT=t.TransformLevel||(t.TransformLevel={}))[CT.copyDataView=-10]="copyDataView",CT[CT.treemapFilter=-8]="treemapFilter",CT[CT.treemapFlatten=-7]="treemapFlatten",CT[CT.dotObjFlat=-7]="dotObjFlat",CT[CT.linkDotInfo=-7]="linkDotInfo",CT[CT.sankeyLayout=-7]="sankeyLayout",CT[CT.dataZoomFilter=-6]="dataZoomFilter",CT[CT.legendFilter=-5]="legendFilter",function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(MT||(MT={})),function(t){t.data="data",t.mark="mark"}(BT||(BT={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(ET||(ET={}));const RT=["line","area","trail"];function OT(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(Yk,i?t.slice().sort(i):t.slice()),{keys:[Yk],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const PT=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function IT(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{IT(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function DT(t,e,i,s){const n=OT(t,(t=>i(t))),r=OT(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!d(t)){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}}const FT=`${xk}_BuiltIn_CallBack_Disappear`;var jT;!function(t){t.render="render",t.disappear="disappear"}(jT||(jT={}));class NT{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(e,i){this._count=0,this._rootMarks=[],this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{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._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var e,i,s,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:u,autoPreventDefault:d,background:f}=this._option;Ap.setEnv(function(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}(o),null!=l?l:{}),this._stage=null!==(e=this._option.stage)&&void 0!==e?e:new Fp(Object.assign({background:f,width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,canvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:u,autoPreventDefault:d},ReactDOM:this._option.ReactDOM,autoRefresh:p(r)?r:!p(a)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{})),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const m=sh({x:0,y:0,width:this._width,height:this._height});m.name="root",this._stage.defaultLayer.appendChild(m),this._rootGroup=m;const v=(p(h)?h:Fg(o))&&!1!==c&&Jw.getStageEventPlugin("gesture");v&&(this._gestureController=new v(this._stage,g(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=ET.before}_setCanvasStyle(){if(this._stage&&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")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(Ap.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=Ap.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>IT(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>IT(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{IT(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;this._hasCommitedMark()&&(Eg(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),this._rootMarks.forEach((t=>{t.render()})),this._layoutState===ET.before&&(this._layoutState=ET.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=ET.reevaluate,this._hasCommitedMark()&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),this.findProgressiveMarks(),this.updateStateAnimation(),this._doRender(!0),this.doPreProgressive(),Eg(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=LT(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=DT(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=DT(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=OT(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=OT(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}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];_(s)?e[i]="disappear"===i?s.map((t=>{return"function"==typeof(e=t.callBack)&&/^class\s/.test(e.toString())?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:FT,customParameters:{callBack:t.callBack}});var e})):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{IT(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===MT.appear))?MT.appear:e.every((t=>t===MT.disappear))?MT.disappear:MT.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===pT.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=e;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=i.parent,i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,u=p(l.modelUserId)?l.modelUserId:null,d=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:oT(o),markId:h,modelId:c,markUserId:d,modelUserId:u};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===pT.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===pT.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===pT.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===pT.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===pT.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this.releaseGrammar(!0),this._stage!==(null===(t=this._option)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{IT(t,(t=>{t.removeProduct()}),null,!0)})):this._cachedMarks=LT(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return Dg(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&function(t){return Yo(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Gi.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()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{IT(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=Ap.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){Ap.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function UT(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:Og)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function HT(t){t.crosshair=G(t.crosshair||{}).map((e=>Zw({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function zT(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}=Me(l,i.width,i.height);a=t,o=e}else if(h&&Dg(e.mode)){let t;t=y(h)?Ap.getElementById(h):h;const{width:e,height:s}=Me(t,i.width,i.height);a=e,o=s}else if(jg(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 VT(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function WT(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}}var GT,YT,XT,$T,KT,qT;t.LayoutZIndex=void 0,(GT=t.LayoutZIndex||(t.LayoutZIndex={}))[GT.SeriesGroup=0]="SeriesGroup",GT[GT.Axis_Grid=50]="Axis_Grid",GT[GT.CrossHair_Grid=100]="CrossHair_Grid",GT[GT.Region=450]="Region",GT[GT.Mark=300]="Mark",GT[GT.Node=400]="Node",GT[GT.Axis=100]="Axis",GT[GT.MarkLine=500]="MarkLine",GT[GT.MarkArea=100]="MarkArea",GT[GT.MarkPoint=500]="MarkPoint",GT[GT.DataZoom=500]="DataZoom",GT[GT.ScrollBar=500]="ScrollBar",GT[GT.Player=500]="Player",GT[GT.Legend=500]="Legend",GT[GT.CrossHair=500]="CrossHair",GT[GT.Indicator=500]="Indicator",GT[GT.Title=500]="Title",GT[GT.Label=500]="Label",GT[GT.Brush=500]="Brush",GT[GT.CustomMark=500]="CustomMark",GT[GT.Interaction=700]="Interaction",t.LayoutLevel=void 0,(YT=t.LayoutLevel||(t.LayoutLevel={}))[YT.Indicator=10]="Indicator",YT[YT.Region=20]="Region",YT[YT.Axis=30]="Axis",YT[YT.DataZoom=40]="DataZoom",YT[YT.Player=40]="Player",YT[YT.ScrollBar=40]="ScrollBar",YT[YT.Legend=50]="Legend",YT[YT.Title=70]="Title",YT[YT.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(XT=t.AttributeLevel||(t.AttributeLevel={}))[XT.Default=0]="Default",XT[XT.Theme=1]="Theme",XT[XT.Chart=2]="Chart",XT[XT.Base_Series=3]="Base_Series",XT[XT.Series=4]="Series",XT[XT.Mark=5]="Mark",XT[XT.User_Chart=6]="User_Chart",XT[XT.User_Series=7]="User_Series",XT[XT.User_Mark=8]="User_Mark",XT[XT.User_SeriesStyle=9]="User_SeriesStyle",XT[XT.Built_In=99]="Built_In";class ZT{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){d(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,j({},ZT.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=G(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]))))}}ZT.defaultMarkInfo={};class JT{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class QT{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=>Zw({},i,s,t);return _(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 tC extends JT{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}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=QT,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new ZT,this._lastLayoutRect=null,this.id=Ug(),this.userId=t.id,this._spec=t,this.effect={},this.event=new hT(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){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}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){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_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){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${xk}_${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,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=Jw.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_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(!d(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}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class eC{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}get lastComputeRect(){return this._lastComputeRect}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}get willLayoutTag(){return this._willLayoutTag}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._willLayoutTag=!0,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){let a=Nw(Hw(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=d(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:jw(t.minHeight,e.height,e),this._maxHeight=d(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:jw(t.maxHeight,e.height,e),this._minWidth=d(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:jw(t.minWidth,e.width,e),this._maxWidth=d(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:jw(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:jw(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:jw(t.height,e.height,e)},{height:9}),d(t.offsetX)||(this.layoutOffsetX=jw(t.offsetX,e.width,e)),d(t.offsetY)||(this.layoutOffsetY=jw(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){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{d(this._spec[i])||(e[i]=jw(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};d(s)||(r.width-=s),d(n)||(r.width-=n),d(e)||(r.height-=e),d(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):(d(s)?d(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,d(e)?d(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 s,n,r,a;A(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),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?(d(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),d(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(d(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),d(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(Uw(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class iC extends tC{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,this._transformLayoutPadding=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 eC(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&z(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.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,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 sC extends QT{_initTheme(t,e){return{spec:t,theme:this._theme}}}class nC extends iC{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=sC,this.modelType="region",this.specKey="region",this.type=nC.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,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"}_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,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),E(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[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.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex: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()}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,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return z(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||G(t.userId).includes(e.userId))&&(!p(t.specIndex)||G(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})}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=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function rC(t){const e=[],i=[],s=[];return t.forEach((t=>{d(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 aC(t,e,i){e?t.forEach((t=>{const e=Y(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=Y(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 oC(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 lC(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const u=[];let d=[];const p=[];t.forEach((t=>{const{rect:s}=dC(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&d.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),u.push(d),d=[t]):(a=Math.max(a,g),d.push(t))})),p.push(a),u.push(d),oC(u,!0,p,l),s&&aC(u,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function hC(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const u=[];t.forEach((t=>{const{rect:s}=dC(t,e,n),d=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=dC(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&d.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),u.push(d),d=[t]):(l=Math.max(l,n),d.push(t))})),p.push(l),u.push(d),oC(u,!1,p,o),s&&aC(u,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function uC(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const u=[];t.forEach((t=>{const{layoutTag:s,layoutRect:u,rect:d}=dC(t,e,n),p=d.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=d.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-d.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_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){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:u,relativeOverlapItems:d,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,u,d,g,o,l),this._processAutoIndent(c,u,d,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_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,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:u}=this._checkAutoIndent(n,r);(l||h||c||u)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-u,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=dC(t,this,e);"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,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=rC(t);n.length&&lC(n,e,i,!1,"left",s),r.length&&lC(r,e,i,!0,"left",s),a.length&&hC(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=rC(t);n.length&&cC(n,e,i,!1,"top",s),r.length&&cC(r,e,i,!0,"top",s),a.length&&uC(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=rC(t);n.length&&lC(n,e,i,!1,"right",s),r.length&&lC(r,e,i,!0,"right",s),a.length&&hC(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=rC(t);n.length&&cC(n,e,i,!1,"bottom",s),r.length&&cC(r,e,i,!0,"bottom",s),a.length&&uC(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=dC(t,this,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=>{z(i.getLayoutRect(),e.rect)||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{rect:i}=dC(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:u}=this._layoutRegionItem(t,l,h);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+c-l})}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+u-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&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:Og)("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}}}pC.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}($T||($T={})),t.STATE_VALUE_ENUM=void 0,(KT=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",KT.STATE_HOVER="hover",KT.STATE_HOVER_REVERSE="hover_reverse",KT.STATE_DIMENSION_HOVER="dimension_hover",KT.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",KT.STATE_SELECTED="selected",KT.STATE_SELECTED_REVERSE="selected_reverse",KT.STATE_SANKEY_EMPHASIS="selected",KT.STATE_SANKEY_EMPHASIS_REVERSE="blur",KT.STATE_HIGHLIGHT="highlight",KT.STATE_BLUR="blur",KT.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(qT||(qT={}));const gC=["linear","radial","conical"],fC={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const mC={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{mC[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class vC extends JT{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(j(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class yC extends vC{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:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||(t=this._mark.type,RT.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!mC[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(_(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(xk)));i=t.datums.some((t=>e&&_(null==t?void 0:t.items)?n.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])})):n.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(xk))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(qx(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class _C extends JT{constructor(){super(...arguments),this.id=Ug(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=Jw.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class bC extends _C{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}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._data=null,this._data=e}removeProduct(){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const xC=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,SC=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=xC(l.delay,n,a,o),u=xC(l.duration,n,a,o),d=xC(l.oneByOne,n,a,o),p=xC(l.splitPath,n,a,o),g=A(d)&&d>0?t=>S(d)?t*d:!0===d?t*u: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)?ax:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:ox)(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);ix(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{delay:c,duration:u,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)?ax:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:ox)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Jb(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>tx(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:ys.ANIMATE_END}),e.detachShadow(),s&&s())};o.forEach(((e,s)=>{var n,o,l;const u=(null!==(n=i.delay)&&void 0!==n?n:0)+i.individualDelay(s,a.length,t[s],e),d=e.animate(Object.assign({},i,{onEnd:r}));d.wait(u),d.play(new ex({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Xb,null!==(l=i.easing)&&void 0!==l?l:$b))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:ys.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new sx({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Xb,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:$b))}})(t,e[0],{delay:c,duration:u,easing:h,onEnd:s,individualDelay:g,splitPath:p}):ix(t[0],e[0],{delay:c,duration:u,easing:h,onEnd:s})},AC=(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))))},wC=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}};class kC extends _C{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}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){d(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];_(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=G(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=G(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new bC(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}d(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=sh("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){d(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(){this._product&&this._product.parent&&this._product.parent.removeChild(this._product),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new pn)),i&&(u(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==$T.enter&&t.context.diffState!==$T.update||(t.stateProxy=(e,i)=>{var s;return this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)},t.context.states&&t.useStates(t.context.states,e))},this.name=e,this.model=i.model,this.key=i.key,this.state=new yC(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_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,jt)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];d(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}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){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[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"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&Zw(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(Zx(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=Rw(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),e.clamp&&t.clamp&&t.clamp(e.clamp))}(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=u(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return r=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):gC.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):Zx(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=u(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_computeGradientAttr(t){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=t,c=e(t,["gradient","scale","field"]);let d=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(d=t),g||(g=e)}const f=Sw(xw(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},fC[o]),c);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==d?void 0:d.scale(t[g]);return u(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=Ae.SetOpacity(a,s)),{offset:u(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):u(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];u(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)gC.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=Sw(xw(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return OT(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return Jw.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=u(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[Tk],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=OT(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===MT.appear))?MT.appear:t.every((t=>t===MT.disappear))?MT.disappear:t[0];return null!=e?e:MT.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{wC(t),s.push(...t.getGraphics())})),e.forEach((t=>{wC(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const u=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);SC([],e,i,u,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=AC(e,n),r=AC(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===MT.exit?MT.exit:i===MT.update?MT.update:MT.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===$T.exit&&(t.context.reusing=!0,t.animates&&t.animates.forEach((t=>t.stop())))}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===$T.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,u,p,g;let f,m;return d(e)?(f=this._graphicMap.get(t),f&&(m=$T.exit)):d(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=$T.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=$T.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(u=f.context)||void 0===u?void 0:u.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=MT.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=MT.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return PT(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=PT(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(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||(!!u(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach(((t,e)=>{var i,n;let r=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i.update,t);null===(n=t.currentStates)||void 0===n||n.forEach((e=>{var i;const s=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i[e],t);r=Object.assign(Object.assign({},r),s)})),d(this._markConfig.interactive)||(r.pickable=this._markConfig.interactive);const a=this._transformGraphicAttributes(t,r,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=a}))}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r,a;const o=i.context.finalAttrs,l=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=lT(i,o);i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes({}),i.context.reusing=!1):l||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),!(null===(a=this.renderContext)||void 0===a?void 0:a.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i),e&&i.setFinalAttributes(o)}else{const a=i;i=this._createGraphic(o),e&&(null===(n=i.setFinalAttributes)||void 0===n||n.call(i,o)),i.context=a.context,i.context.diffAttrs=o,i.stateSort=this._stateSort;const l=this._graphics===t?s:s+this._graphics.length-t.length;if(l>=0&&(this._graphics[l]=i),null===(r=this.renderContext)||void 0===r?void 0:r.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,l),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(d(e)||(t.zIndex=e),d(i)||(t.clip=i),!d(s)){const e=_(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return d(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=Jw.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=Jw.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=G(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===ET.before||(this._product||this._initProduct(),Eg(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{"in"===this.state.checkOneState(i,i.context.data,e)?i.addState(t,!0,this.hasAnimationByState("state")):i.removeState(t,this.hasAnimationByState("state"))}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===$T.exit&&!e.isExiting)if(e.context.animationState===$T.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:$T.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=sh({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{t.clearStates()}))}}var TC;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(TC||(TC={}));class CC extends kC{constructor(){super(...arguments),this.type=CC.type,this._marks=[],this._diffState=$T.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(Rg("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?(Rg("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))}getMarkInUserId(t){let e;return IT(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.diffState===$T.update){const t=this.hasAnimation(),e=lT(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e)),t&&this._product.setFinalAttributes(i)}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=$T.update}render(){this._isCommited&&(Eg(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct()}}CC.type="group";const MC={measureText:bk};class BC{static instance(){return BC.instance_||(BC.instance_=new BC),BC.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 EC{constructor(){this.id=Ug(),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))?Rg("不要重复添加相同的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 RC extends EC{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)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const OC={type:"fadeIn"};function PC(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 OC;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const IC={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"},state:{duration:300,easing:"linear"}},LC={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},DC=()=>{Jw.registerAnimation("scaleInOut",(()=>LC))},FC=(t,e)=>({appear:PC(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:lx,duration:IC.update.duration,easing:IC.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),jC=()=>{Jw.registerAnimation("line",FC)},NC=()=>{Hb.registerBuiltInAnimate("growPointsIn",kx),Hb.registerBuiltInAnimate("growPointsOut",Tx),Hb.registerBuiltInAnimate("growPointsXIn",Mx),Hb.registerBuiltInAnimate("growPointsXOut",Bx),Hb.registerBuiltInAnimate("growPointsYIn",Rx),Hb.registerBuiltInAnimate("growPointsYOut",Ox),Hb.registerBuiltInAnimate("clipIn",ux),Hb.registerBuiltInAnimate("clipOut",dx)},UC=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class HC{constructor(t){this._markSet=new ZT,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){_(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.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 zC={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class VC extends HC{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},zC,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}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}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll(e)}}VC.type="element-highlight",VC.defaultOptions=zC;const WC=()=>{Jw.registerInteractionTrigger(VC.type,VC)},GC={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class YC extends HC{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},GC,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=G(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):y(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&&(_(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),t.addState(i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll(e)}}YC.type="element-select",YC.defaultOptions=GC;const XC=()=>{Jw.registerInteractionTrigger(YC.type,YC)};class $C extends EC{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class KC{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>Jw.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>Jw.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>Jw.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return Jw.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>Jw.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){Jw.registerTransform(t,e)}static registerFunction(t,e){t&&e&&BC.instance().registerFunction(t,e)}static unregisterFunction(t){t&&BC.instance().unregisterFunction(t)}static getFunction(t){return t?BC.instance().getFunction(t):null}static getFunctionList(){return BC.instance().getFunctionNameList()}static registerMap(t,e,i){const s=Jw.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=Jw.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,xT.get(e);var e}static registerSVG(t,e,i){const s=Jw.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=Jw.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){dk.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}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,u,d;this.id=Ug(),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._renderState=jT.render,this._disableDimensionHoverEvent=!1,this._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))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;z(n.theme,this._spec.theme)?z(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=VT(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?Jw.getSeriesBuiltInTheme(e):Jw.getComponentBuiltInTheme(e);i=i?Zw({},s,i[e]):s}s===t.length-1&&p(i)&&(i=mk({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},gw(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:_,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=Dg(v);if(S?$f(Vi):"node"===v&&Rv(Vi),S&&f&&(this._container=y(f)?Ap.getElementById(f):f),m&&(this._canvas=m),_&&(this._stage=_),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=pk.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[];!1!==b&&A.push("poptipForText"),"sankey"===i.type&&A.push("scrollbar");const w=new it(null!==(a=this._option.logLevel)&&void 0!==a?a:et.Error);it.setInstance(w),(null===(o=this._option)||void 0===o?void 0:o.onError)&&w.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._compiler=new NT({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:_,pluginList:A},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new yT(this,this._compiler),this._event=new hT(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),dk.registerInstance(this),null===(d=null===(u=this._option.performanceHook)||void 0===u?void 0:u.afterCreateVChart)||void 0===d||d.call(u,this)}_setNewSpec(t,e){return!!t&&(y(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=Zw({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=vk(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;KC.getFunctionList()&&KC.getFunctionList().length&&(t=yk(t,KC)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=Jw.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=Jw.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=Jw.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._chartSpecTransformer),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)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=ft(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.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 zT(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:Sk,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:Ak})}_initDataSet(t){this._dataSet=t instanceof si?t:new si,bT(this._dataSet,"dataview",ti),bT(this._dataSet,"array",s),_T(this._dataSet,"copyDataView",AT);for(const t in Jw.transforms)_T(this._dataSet,t,Jw.transforms[t]);for(const t in Jw.dataParser)bT(this._dataSet,t,Jw.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return u(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake?(null===(n=this._compiler)||void 0===n||n.releaseGrammar(),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.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.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),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),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(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"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?MT.none:MT.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}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._cachedProcessedTheme=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,dk.unregisterInstance(this)}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):_(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=G(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._reSetRenderState(),d(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=G(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=G(this._spec.data);return G(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof ni?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=kT(t,this._dataSet,s);_(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(y(e)&&(e=JSON.parse(e)),u(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(_(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?Zw({},t[n][e.index],i):i):t[n]=s?Zw({},t[n],i):i);else if(_(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?Zw({},t[n][r],i):i)}else t.id===e&&(t[n]=s?Zw({},t[n],i):i)}))}(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=Zw({},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),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,this),!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)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=Qw({},e,e.chart[t])),e};let l;if(E(n)&&E(r))l=gk(this._currentThemeName),this._currentTheme=o(a,l);else{const t=Qw({},gk(g(r)&&r.type?r.type:g(n)&&n.type?n.type:this._currentThemeName),gk(n),gk(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),j(Z_.poptip,q_,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;d(this._spec.width)?!d(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),d(this._spec.height)?!d(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!Dg(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return gk(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!pk.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),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}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield UT(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(!Dg(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;this._chart.resetLayoutItemTag(),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)?Ap.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)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(E(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?zw(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||d(t)||E(e))return null;if(!_(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 Rg("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?zw(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Rg("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return BC.instance().getFunction(t)}registerFunction(t,e){t&&e&&BC.instance().registerFunction(t,e)}unregisterFunction(t){t&&BC.instance().unregisterFunction(t)}getFunctionList(){return BC.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=Jw.getChartPlugins();t.length>0&&(this._chartPlugin=new RC(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=Jw.getVChartPlugins();e.length>0&&(this._vChartPlugin=new $C(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_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,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=jT.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){this._renderState=jT.render,this.getStage().eventSystem.resumeTriggerEvent()}}KC.InstanceManager=dk,KC.ThemeManager=pk,KC.globalConfig={uniqueTooltip:!0},KC.Utils=MC,KC.vglobal=Ap;Jw.registerRegion("region",nC),Jw.registerLayout("base",pC),m_(),n_(),Jw.registerMark(CC.type,CC),Jw.registerStageEventPlugin("gesture",vf),WC(),XC(),ok(Kw.name,Kw);const qC="monotone",ZC="linear",JC="bevel";function QC(t,e){return e("component",t)}function tM(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=Jw.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));const eM=(t,e,i,s)=>{if(d(t[e]))return;const n=_(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},iM=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},sM=(t,e,i,s)=>{let n;if(n=u(t)?t(e,i):m(t)&&p(t.field)?R(e,t.field):t,s){const{formatFunc:i,args:r}=tM(void 0,s,t,e);i&&r&&(n=i(...r))}return n},nM=(t,e,i)=>d(t)?t:u(t)?t(e,i):t;const rM=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(_(e.activeType)?e.activeType.includes(t):e.activeType===t)));function aM(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=d(i.key)&&d(i.value)&&!E(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:u,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:y}=l,_=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=lM(sM(h,r,a,c),u,g),o.value=lM(sM(f,r,a,m),v,y),Object.keys(_).forEach((t=>{o[t]=sM(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};_(i)?i.forEach((t=>{o(t)})):o(i)}function oM(t,e,i,s,n,r,a){if(u(e)){aM(t,e(n,a),i,s,r,a)}else e&&aM(t,e,i,s,r,a)}const lM=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=Be.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class hM{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?G(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 G(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.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,u,d,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(u=m.shapeStroke)&&void 0!==u?u:this.shapeStrokeCallback,shapeHollow:null!==(d=m.shapeHollow)&&void 0!==d&&d,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{_(t)?t.forEach((t=>{oM(a,t,e,i,s,n,r)})):u(t)?oM(a,t,e,i,s,n,r):t&&aM(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=u(e)?e(s,n):e;if(r?d(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){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}(s),e={visible:sM(r.visible,t,n),value:lM(sM(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:sM(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=sM(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&rM(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const cM={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}},uM=(t,e)=>{var i,s;let n=e.fields;if(u(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=$k([],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 dM(a,n,o)},dM=(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&&t.forEach((t=>{t&&n.push(t[a])}));const u=n.length;if(h){r.length=0,n.forEach(((t,e)=>{Hg(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===u}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{Hg(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&&!0===o.lockStatisticsByDomain&&!d(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=cM[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},pM=(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=>{Hg(t[e])||(t[e]=0)}))})),t};function gM(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function fM(t,e,i){t&&(i.needDefaultSeriesField&&(t[Ck]=i.defaultSeriesField),t[kk]=e,t[Tk]=i.getKey(t,e,i))}const mM={label:{name:"label",type:"text"}},vM=`${xk}_rect_x`,yM=`${xk}_rect_x1`,_M=`${xk}_rect_y`,bM=`${xk}_rect_y1`,xM={data:!0},SM={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},AM=[...Object.keys(IC),"normal"];function wM(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=_(a)?a.map(((t,e)=>{var s;let n=t;return BM(n)&&delete n.type,n.oneByOne&&(n=TM(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:CM,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=Zw({},o[e],a);return BM(n)&&delete n.type,n.oneByOne&&(n=TM(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:CM,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function kM(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=I(t,null,i),EM(t,(t=>{var i;if(u(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t}),i),t}(h,i)}function TM(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=u(n)?n(t,i,a):A(n)?n:0,h=u(r)?r(t,i,a):A(r)?r:0;let c=u(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=u(n)?n(t,r,o):A(n)?n:0,c=u(a)?a(t,r,o):A(a)?a:0;let d=u(s)?s(t,r,o):s;if(!1===d)return c;return d=!0===d?0:d,c+((i?i():r.parent.count-1)-l)*(h+d)},delete t.oneByOne,t}function CM(t,e){var i;return null!==(i=null==t?void 0:t[kk])&&void 0!==i?i:e.context.graphicIndex}function MM(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 BM(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function EM(t,e,i=[]){if(_(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),EM(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),EM(t[s],e,i))}function RM(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class OM extends QT{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=G(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=yw(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=Jw.getSeriesMarkMap(o)?function(t,e,i){const s=Jw.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=Zw({},i("mark",G(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return Zw({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_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),d(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;G(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:d=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(u(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&d)&&f,animationExit:!!(v&&f&&p)&&m,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=Zw({},i,s,t),n=i.label;return n&&g(n)&&_(e.label)&&(e.label=e.label.map((t=>Zw({},n,t)))),e};return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class PM extends tC{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)}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:`${xk}_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(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=OM,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=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.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=RM(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),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 d(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)&&(_T(this._rawData.dataSet,"invalidTravel",pM),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;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=kT(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=wT(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=wT(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new bC(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(d(this._rawStatisticsCache[t].min)||d(this._rawStatisticsCache[t].max))||!e&&d(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=$(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=dM(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=j(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){_T(this._dataSet,"dimensionStatistics",uM);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new ni(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&&$k(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){_T(this._dataSet,"dimensionStatistics",uM);const s=new ni(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=$k(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&$k(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new ni(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 d(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)}`)}:y(t)?e=>e[t]:_(t)&&t.every((t=>y(t)))?e=>t.map((t=>e[t])).join("-"):u(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)&&(_T(this._rawData.dataSet,"addVChartProperty",iM),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:gM.bind(this),call:fM}},!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||d(e)?null:t[e]}getDatumPositionValues(t,e){return!t||d(e)?[]:y(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;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.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(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:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=wM({},kM(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)}))),!d(t.dataId)||!d(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(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:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_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"}}:Fg(s)||jg(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=Zw(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=Zw(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=UC(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=UC(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=UC(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:Ck;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:Mk,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,Mk,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.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()}initTooltip(){this._tooltipHelper=new hM(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||e.visible!==t[i].visible))?i.reMake=!0:!i.reCompile&&e.some(((e,i)=>!z(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!z(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},xM),SM),i),{extensionMark:!0,label:!0,totalLabel:!0});return this._compareExtensionMarksSpec(G(t.extensionMark),G(e.extensionMark),s),!s.reMake&&this._compareLabelSpec(G(t.label),G(e.label),s),!s.reMake&&this._compareLabelSpec(G(t.totalLabel),G(e.totalLabel),s),s.reMake?s:(!s.reCompile&&this._marks.getMarks().some((i=>{var s,n;return r[i.name]=!0,(null===(s=e[i.name])||void 0===s?void 0:s.visible)!==(null===(n=t[i.name])||void 0===n?void 0:n.visible)}))&&(s.reCompile=!0),!s.reCompile&&n.some((i=>SM[i]&&!z(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!z(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof ni||TT(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();RM(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),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,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:Ck,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new Bw).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return xw(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:Ck}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:u={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:y=!1}=e,_=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:y,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(_)){const e=this.getSpec()||{};this._marks.addMark(_,{name:t.name}),v&&(this._seriesMark=_),d(f)?_.setData(this._data):!1!==f&&_.setDataView(f),_.setSkipBeforeLayouted(!1!==c),d(h)||_.setGroupKey(h);const l=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:null!==(s=i.morph)&&void 0!==s&&s,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(n=i.support3d)&&void 0!==n?n:e.support3d||!!e.zField,morphKey:(null===(r=e.morph)||void 0===r?void 0:r.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});_.setMarkConfig(l),this.initMarkStyleWithSpec(_,Zw({},u,g||e[_.name]))}return _}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:Tk}_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!==Rk&&t!==Pk&&t!==Ek&&t!==Ok||(t=this.getStackValueField()),null!==(e=qk(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>Hg(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:Ck]}}function IM(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();qx(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 LM(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}}}PM.mark=mM,PM.transformerConstructor=OM;class DM extends PM{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=G(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=G(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&G(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);qx(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:`${xk}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?G(this._spec.xField)[0]:G(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(Rk),this.setFieldX2(Ek)):(this.setFieldY(Rk),this.setFieldY2(Ek))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(Pk),this.setFieldX2(Ok)):(this.setFieldY(Pk),this.setFieldY2(Ok))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(Lk),this.setFieldX2(Ik)):(this.setFieldY(Lk),this.setFieldY2(Ik))}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=G(this._spec.xField),this._specYField=G(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(G(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(G(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)&&(IM("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)}}function FM(t){return"bottom"===t||"top"===t}function jM(t){return"left"===t||"right"===t}function NM(t){return"z"===t}function UM(t,e){return Lw(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function HM(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?FM(t)?"linear":"band":FM(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const zM=(t,e,i)=>{var s;const n=null!==(s="band"===e?QC("axisBand",i):["linear","log","symlog"].includes(e)?QC("axisLinear",i):{})&&void 0!==s?s:{},r=FM(t)?QC("axisX",i):jM(t)?QC("axisY",i):QC("axisZ",i);return Zw({},QC("axis",i),n,r)};class VM{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:Og)("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:Og)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;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)))),r=n.filter((t=>Jx(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return FM(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class WM extends VM{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(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:pT.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const GM=(t,e)=>{var i,s;return t===e||!d(t)&&!d(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))},YM=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return A(s)?[-s,s]:s},XM=(t,e,i,s)=>{var n;const r=e.getScale(),a=Jx(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=G(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.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))})),o.push({series:h,datum:e,key:$M(h,s)})}else if(p(i[1])){const e=[],s=[];l.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 r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{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("_")}`,KM=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(G(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};class qM extends VM{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!GM(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:pT.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:pT.canvas}),callback:this.onMouseOut}),Fg(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:pT.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Fg(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var ZM;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(ZM||(ZM={}));const JM={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class QM{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",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.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(JM.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),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:JC,curveType:ZC,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===qC?"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){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(JM.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:MM(this._spec,JM.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new ni(this._option.dataSet,{name:`${xk}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),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(ZM.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[JM.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(ZM.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,Zw({},this._spec[JM.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.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=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},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.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const tB=Object.assign(Object.assign({},mM),JM),eB=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(y(t))return!1;if(_(t))return t.length===e.length&&t.every(((t,i)=>eB(t,e[i])));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]))},iB=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class sB extends kC{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return iB}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(d(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(d(o)||s.includes(a))return;r&&n.includes(a)&&(Zx(null==o?void 0:o.type)||(null==o?void 0:o.scale)||u(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((t,e,i)=>!(!d(t)||!d(e))||!d(t)&&!d(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?eB(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,d(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n,r;const a=e.context.data,o=[],l=[],h={},c=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,u=c&&0===c.currentIndex;if(a.forEach(((e,i)=>{var s;l[i]={},o[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?l[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!c?o[i][s]=t[s](e):0!==i||c&&!u||(h[s]=t[s](e))})),l[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),c){const t=null!==(r=null===(n=e.attribute)||void 0===n?void 0:n.segments)&&void 0!==r?r:[];return t.push({points:l}),u?Object.assign(Object.assign({},h),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(o,l);if(t)return Object.assign(Object.assign(Object.assign({},h),o[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},h),o[0]),{points:l,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:$T.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[Tk]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}class nB extends sB{constructor(){super(...arguments),this.type=nB.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)===mw.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}nB.type="line";const rB=()=>{Jw.registerMark(nB.type,nB),m_(),a_(),LA(),EA(),NC(),Jw.registerGraphicComponent("line",Zh)};class aB extends kC{constructor(){super(...arguments),this.type=aB.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return d(o)?a.symbolType="circle":a.symbolType=o,a}}aB.type="symbol";const oB=()=>{Jw.registerMark(aB.type,aB),m_(),y_(),EA(),Jw.registerGraphicComponent("symbol",$h)};class lB extends OM{_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)}}function hB(t){return t.length>=2&&A(t[0])&&A(Y(t))&&Y(t)>=t[0]}function cB(t,e){var i;const s=Y(e)-e[0],n=Y(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=Y(e)>0?Y(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!A(o.min),extendable_max:!A(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):Y(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function uB(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:u}=e;if(o>0){if(!h)return!1;let t=s/i;r&&(t=s/Math.max(i,o),a[1]=-a[0]/t),u[0]=-u[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),u[1]=-u[0]*t}return!0}function dB(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 pB(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 gB(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 fB=(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=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const u=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==u?void 0:u.length))return t;const d=o.getScale();if(!d)return t;const p=d.domain(),g=Y(p)-p[0];if(0===g)return t;const f=c.domain(),m=Y(f)-f[0];if(0===g)return t;const v=u.map((t=>function(t,e,i,s,n){const r=Lt(t,e),a=Math.max(It(i),It(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return Gx(v)};class mB{constructor(t){this.id=Ug(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class vB extends mB{constructor(){super(vB.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!qx(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],u=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&u&&hB(c)&&hB(u)))return;const d=cB(t,c),p=cB(e,u);if(!0===d.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:y}=d,{positive:_,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!dB(d,p))return}else if(0===_&&0===b){if(!dB(p,d))return}else if(y||A)if(y&&!A){if(!uB(d,p))return}else if(A&&!y){if(!uB(p,d))return}else{if(f===b)return;if(f>b){if(!pB(d,p))return}else if(!pB(p,d))return}else{if(0===f&&0===_){if(!gB(d,p))return}else if(0===b&&0===g&&!gB(p,d))return;if(0===f&&0===b)if(0===c[0]&&u[0]>0){if(!x)return;u[0]=0}else{if(!(0===u[0]&&c[0]>0))return;if(!m)return;c[0]=0}if(0===g&&0===_)if(0===c[1]&&u[1]>0){if(!S)return;u[1]=0}else{if(!(0===u[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(u)})(n,i)}))}onDidCompile(t,e){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){_T(e.getOption().dataSet,"tickAlign",fB);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}vB.pluginType="component",vB.type="AxisSyncPlugin";const yB={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function _B(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 bB(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const xB=t=>"band"===t||"ordinal"===t||"point"===t;function SB(t,e){return{id:t,label:t,value:e,rawValue:t}}function AB(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class wB extends EC{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const kB=`${xk}_ARC_TRANSFORM_VALUE`,TB=`${xk}_ARC_RATIO`,CB=`${xk}_ARC_START_ANGLE`,MB=`${xk}_ARC_END_ANGLE`,BB=`${xk}_ARC_K`,EB=`${xk}_ARC_MIDDLE_ANGLE`,RB=`${xk}_ARC_QUADRANT`,OB=`${xk}_ARC_RADIAN`,PB=-Math.PI/2,IB=3*Math.PI/2,LB=(t,e,i)=>{var s;const n=null!==(s="band"===e?QC("axisBand",i):"linear"===e?QC("axisLinear",i):{})&&void 0!==s?s:{},r=QC("angle"===t?"axisAngle":"axisRadius",i);return Zw({},QC("axis",i),n,r)};function DB(t,e,i,s){switch(t){case r.cartesianBandAxis:return zM(UM(i,["z"]),"band",e);case r.cartesianLinearAxis:return zM(UM(i,["z"]),"linear",e);case r.cartesianLogAxis:return zM(UM(i,["z"]),"log",e);case r.cartesianSymlogAxis:return zM(UM(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return zM(UM(i),void 0,e);case r.polarBandAxis:return LB(i.orient,"band",e);case r.polarLinearAxis:return LB(i.orient,"linear",e);case r.polarAxis:return LB(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h,trigger:c,triggerOff:u}=null!==(s=QC(r.crosshair,t))&&void 0!==s?s:{},d=n.find((t=>FM(t.orient)));let g;g=p(d)?Zw({},xB(d.type)?a:o,l):l;const f=n.find((t=>jM(t.orient)));let m;return m=p(f)?Zw({},Jx(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:u}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h,trigger:c,triggerOff:u}=null!==(s=QC(r.crosshair,t))&&void 0!==s?s:{},d=n.find((t=>"angle"===t.orient));let g;g=p(d)?Zw({},xB(d.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?Zw({},Jx(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:u}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return FB(i,QC(t,e));default:return QC(t,e)}}const FB=(t,e)=>{var i;const s=e[function(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}(null!==(i=t.orient)&&void 0!==i?i:e.orient)],n=Zw({},e,s);return delete n.horizontal,delete n.vertical,n};class jB extends QT{getTheme(t,e){return DB(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({},Hw(e)),{[s]:0}))}}class NB extends iC{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=jB,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof la||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:pT.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}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 wB(this)}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)))}_getNeedClearVRenderComponents(){return[]}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=>!z(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&&(t.release(!0),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=>{e.compile({group:t,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}}getDatum(t){}}var UB,HB;NB.transformerConstructor=jB,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(UB||(UB={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(HB||(HB={}));class zB extends kC{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}clearComponent(){this._component&&(this._component.parent&&this._component.parent.removeChild(this._component),this._component=null)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return d(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=Jw.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(cT.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){super.release(),this.removeProduct()}}zB.type="component";const VB=()=>{Jw.registerMark(zB.type,zB)},WB=t=>t;class GB extends NB{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}getVisible(){return this._visible}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i,s;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._specVisible=!0,this._hideWhenEmpty=!1,this._tick=void 0,this._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._specVisible=null===(i=t.visible)||void 0===i||i,this._hideWhenEmpty=null!==(s=t.hideWhenEmpty)&&void 0!==s&&s,this._visible=this._specVisible,this._coordinateType="none"}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._specVisible=null===(t=this._spec.visible)||void 0===t||t,this._hideWhenEmpty=null!==(e=this._spec.hideWhenEmpty)&&void 0!==e&&e,this._visible=this._specVisible,this._scale&&this._refreshVisibilityByData()}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,u,d,g,f,m,v,y,_,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._refreshVisibilityByData(),this._shouldComputeTickData()&&this._initData(),this._specVisible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?UB.circleAxis:UB.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?HB.circleAxisGrid:HB.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if(this._syncComponentVisibility(),(null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=wM(null===(h=Jw.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(u=null!==(c=this._spec.animationAppear)&&void 0!==c?c:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(d=this._spec.animationDisappear)&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(y=null!==(v=this._spec.animationExit)&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==y?y:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(_=this._spec.animationUpdate)&&void 0!==_?_:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b: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._specVisible&&(this.getVisible()||this._spec.forceInitTick||this._hideWhenEmpty)}_initData(){const t=this._initTickDataSet(this._tickTransformOption()),e=new bC(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return this._regions&&dw(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=_(a)?qx(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!qx(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return dw(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:s}=this._spec;p(t)&&(this._seriesUserId=G(t)),p(i)&&(this._regionUserId=G(i)),p(e)&&(this._seriesIndex=G(e)),p(s)&&(this._regionIndex=G(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=function(t,e){const i=[];for(const s of t)for(const t of s.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()})),dw(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(){}_hasCollectedSeriesData(){return this.collectData(0).length>0}_refreshVisibilityByData(){const t=this._specVisible&&(!this._hideWhenEmpty||this._hasCollectedSeriesData()),e=this._visible!==t;return this._visible=t,(this._axisMark||this._gridMark)&&this._syncComponentVisibility(),e&&this._forceLayout(),e}_syncComponentVisibility(){var t,e,i,s,n,r,a,o,l,h,c,u;null===(t=this._axisMark)||void 0===t||t.setVisible(this._visible),null===(e=this._gridMark)||void 0===e||e.setVisible(this._visible&&!1!==(null===(i=this._spec.grid)||void 0===i?void 0:i.visible)),null===(a=null===(r=null===(n=null===(s=this._axisMark)||void 0===s?void 0:s.getComponent)||void 0===n?void 0:n.call(s))||void 0===r?void 0:r.setAttributes)||void 0===a||a.call(r,{visibleAll:this._visible}),null===(c=null===(h=null===(l=null===(o=this._gridMark)||void 0===o?void 0:o.getComponent)||void 0===l?void 0:l.call(o))||void 0===h?void 0:h.setAttributes)||void 0===c||c.call(h,{visibleAll:this._visible&&!1!==(null===(u=this._spec.grid)||void 0===u?void 0:u.visible)})}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&z(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):dw(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(dw(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_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=sT(s=t.domainLine)).startSymbol=sT(s.startSymbol),s.endSymbol=sT(s.endSymbol),s):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=u(t.label.style)?(e,i,s,n)=>{var r;const a=t.label.style(e.rawValue,i,e,s,n);return rT(Zw({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:rT(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(E(t))return null;const e={};return Object.keys(t).forEach((i=>{u(t[i])?e[i]=(e,s,n,r)=>rT(t[i](e.rawValue,s,e,n,r)):E(t[i])||(e[i]=rT(t[i]))})),e}(t.label.state)),u(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}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:u(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},t.tick.style&&(i.tick.style=u(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return rT(Zw({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:rT(t.tick.style)),t.tick.state&&(i.tick.state=nT(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=u(t.subTick.style)?(e,i,s,n)=>{var r;const a=t.subTick.style(e,i,s,n);return rT(Zw({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:rT(t.subTick.style)),t.subTick.state&&(i.subTick.state=nT(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 u,p=r;"left"!==t.orient&&"right"!==t.orient||n&&d(p)&&(p="left"===t.orient?-90:90,u=yB[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?jt(p):null,textStyle:Zw({},u,rT(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:rT(h.style)}),h.state&&(i.title.state.shape=nT(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:rT(o.style)}),o.state&&(i.title.state.background=nT(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=nT(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=rT(t.background.style)),t.background.state&&(i.panel.state=nT(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:_k(t.grid.alternateColor),alignWithLabel:t.grid.alignWithLabel,style:u(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 rT(Zw({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:rT(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:_k(t.subGrid.alternateColor),style:rT(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=tM(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){bT(this._option.dataSet,"scale",WB);const i=this.registerTicksTransform();return new ni(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,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)}getDatum(t){var e;return t&&t.name===ib.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}GB.specKey="axes";const YB=()=>{VB(),Jw.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},XB=[vB];class $B extends GB{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}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),dw(this._regions,(t=>{const e=this.getOrient();FM(e)?AB(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):jM(e)?AB(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):NM(e)&&AB(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&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._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{if(!this._visible)return void this._syncComponentVisibility();const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=Zw({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(Zw({x:t.x,y:t.y},this._getGridAttributes(),s)),this._syncComponentVisibility()},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=FM(this.getOrient()),n=t=>{var e;return(s?!FM(t.getOrient()):FM(t.getOrient()))&&qx(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&&Y(t.getScale().domain())>=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,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=UM(i,["z"]),NM(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(!_(e)){if(!bB(e))return null;const{axisType:t,componentName:s}=HM(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=>jM(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(!bB(t))return;const{axisType:s,componentName:n}=HM(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=Jw.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}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return FM(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):NM(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):A(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(XB.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this._specVisible){FM(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&&!FM(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!NM(this.getOrient())&&this._spec.innerOffset){const t=this._spec;jM(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=jw(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=jw(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=FM(this.getOrient())?t.fieldX:NM(this.getOrient())?t.fieldZ:t.fieldY,qx(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;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,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:qx(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 t;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(cT.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(FM(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._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=FM(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)}))}collectScale(){const t=[];return dw(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]:FM(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:NM(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();dw(this._regions,(e=>{FM(t)?AB(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):jM(t)?AB(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):NM(t)&&AB(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(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=FM(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 s={skipLayout:!1},n=FM(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)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=Zw(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new le).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=FM(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?ct(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):ct(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-Y(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&d(null===(e=a.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=a.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 o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return SB(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:qx(this._scale.type)?i>=s[0]&&i<=Y(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this._specVisible&&(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 i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}$B.type=r.cartesianAxis,$B.specKey="axes";const KB=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function qB(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,JB=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function QB(t,e,i="count"){const s=JB(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const tE=Math.sqrt(50),eE=Math.sqrt(10),iE=Math.sqrt(2);class sE{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){p(this._spec.nice)&&(this._nice=this._spec.nice),p(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=_B(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(A(i.forceTickCount))e=i.forceTickCount;else if(u(i.tickCount)){const t=this._scale.range();let s=Math.abs(Y(t)-t[0]);if(1===s&&this._option){s=FM(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=A(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return d(s)&&d(n)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&d(n)&&d(this._softMaxValue)?this._scale.niceMax(e):!(!d(s)||!d(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return d(e)&&d(i)&&d(this._softMaxValue)&&d(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&d(i)&&d(this._softMaxValue)?this._scale.niceMax():!(!d(e)||!d(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=d(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(ZB),e.sort(ZB),{domain:qB(t,e),scope:QB(t,e,i)}}(r,Bg(t),this._spec.breaks[0].scopeType);e=Bg(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=Y(t);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}=_B(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[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=tE?10:n>=eE?5:n>=iE?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(Y(t),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=Y(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}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._refreshVisibilityByData(),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(Y(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>A(+t)?Math.round(+t*s)/s:t}_updateRawDomain(){const e=this.collectData(0,!0),i=this.computeLinearDomain(e);this._rawDomain=i,this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}const nE={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},rE={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}}},aE={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}}},oE={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}}};class lE extends $B{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new US}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}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)}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!NM(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=FM(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=Dw(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=A(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=Bg(this._break.scope).map((t=>i[0]+(Y(i)-i[0])*t))),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}registerTicksTransform(){const t=`${this.type}-ticks`;return _T(this._option.dataSet,t,KS),t}}lE.type=r.cartesianLinearAxis,lE.specKey="axes",lE.builtInTheme={axis:oE,axisLinear:nE,axisX:rE,axisY:aE},W(lE,sE);const hE=()=>{Jw.registerGraphicComponent(UB.lineAxis,((t,e)=>new Wx(t,e))),Jw.registerGraphicComponent(HB.lineAxisGrid,((t,e)=>new WA(t,e))),YB(),Jw.registerComponent(lE.type,lE)};class cE extends $B{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new _S}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}}registerTicksTransform(){const t=`${this.type}-ticks`;return _T(this._option.dataSet,t,tA),t}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=cS(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(),u=e=>{const i=t===n?a:0;if(d(r)||t1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new bC(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{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._refreshVisibilityByData(),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._spec.showAllGroupLayers?this._scales:[this._scales[0]]).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=G(e).concat(i);if(n.push(r),o){const e=SB(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=>SB(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const e=this._spec.domain;for(let t=0;tthis._rawDomainIndex[t][e]=i))}this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}});const uE=()=>{Jw.registerGraphicComponent(UB.lineAxis,((t,e)=>new Wx(t,e))),Jw.registerGraphicComponent(HB.lineAxisGrid,((t,e)=>new WA(t,e))),YB(),Jw.registerComponent(cE.type,cE,!1)};class dE extends lE{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),dw(this._regions,(t=>{FM(this.getOrient())?AB(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):AB(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=Zw({},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 ni(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.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 bC(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=Be.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,u=(null===(r=null===(n=this._spec.layers)||void 0===n?void 0:n[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",d="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?d(u,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=>SB(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=>SB(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return _T(this._option.dataSet,t,KS),t}transformScaleDomain(){}}dE.type=r.cartesianTimeAxis,dE.specKey="axes",dE.builtInTheme={axis:oE,axisX:rE,axisY:aE};class pE extends lE{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new WS}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return _T(this._option.dataSet,t,KS),t}transformScaleDomain(){}}pE.type=r.cartesianLogAxis,pE.specKey="axes",pE.builtInTheme={axis:oE,axisLinear:nE,axisX:rE,axisY:aE},W(pE,sE);class gE extends lE{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new GS}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return _T(this._option.dataSet,t,KS),t}transformScaleDomain(){}}gE.type=r.cartesianSymlogAxis,gE.specKey="axes",gE.builtInTheme={axis:oE,axisLinear:nE,axisX:rE,axisY:aE},W(gE,sE);const fE=`${xk}_hide_`;function mE(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const vE=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[fE]&&(mE(t,!0),t[fE]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=d(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[fE]=!0,mE(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=d(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},yE=()=>{Jw.registerGrammarTransform("symbolOverlap",{transform:vE,runType:"afterEncode"})},_E={min:$,max:X,average:function(t,e){let i=0,s=0;return t.forEach((t=>{const n=e?+t[e]:+t;A(n)&&(i+=n,s++)})),i/s},sum:hw};function bE(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,u=0;r[u++]=c;for(let t=1;to&&(o=l,h=t))}r[u++]=h,c=h}r[u-1]!==a-1&&(r[u++]=a-1);return r.map((t=>i?e[t].i:t))}function xE(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 SE(t,e,i,s){return xE(t,e,i,"min",s)}function AE(t,e,i,s){return xE(t,e,i,"max",s)}function wE(t,e,i,s){return xE(t,e,i,"average",s)}function kE(t,e,i,s){return xE(t,e,i,"sum",s)}const TE=(t,e)=>{let i=u(t.size)?t.size():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=bE;if("min"===n?l=SE:"max"===n?l=AE:"average"===n?l=wE:"sum"===n&&(l=kE),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[]},CE=()=>{Jw.registerGrammarTransform("dataSampling",{transform:TE})};class ME extends DM{constructor(){super(...arguments),this.type=mw.line,this.transformerConstructor=lB,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.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(wM(null===(i=Jw.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),kM("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=LM(this);this._symbolMark.setAnimationConfig(wM(null===(s=Jw.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),kM("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),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]}}ME.type=mw.line,ME.mark=tB,ME.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},ME.transformerConstructor=lB,W(ME,QM);class BE{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=G(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{TT(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof ni)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];Rg(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];Rg(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class EE{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)=>{zg(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{$k(e,[{key:t,operations:qx(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&&$k(e,[{key:i.field,operations:qx(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?Rw("colorOrdinal"):Rw(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(zg(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),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(z(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;if(!z(r.specified,s.specified))return e.reMake=!0,e;s.range&&!z(s.range,n.range())&&(n.range(s.range),e.reRender=!0),zg(s.domain)?e.reRender=!0:z(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(!zg(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=qx(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=qx(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(d(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),d(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;qx(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(d(t.changeDomain)||"none"===t.changeDomain||d(t.seriesId))return void(qx(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=qx(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!E(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)));qx(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(d(t.field)||!d(t.changeDomain)&&"none"!==t.changeDomain&&!d(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class RE{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&t.addState(i,!0,l):a&&t.addState(s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&t.addState(i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{t.removeState(i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&t.removeState(e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}class OE extends JT{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){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=Ug(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:Sk,height:Ak},this._viewRect={width:Sk,height:Ak},this._viewBox={x1:0,y1:0,x2:Sk,y2:Ak},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)=>G(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=Hw(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new hT(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new BE(this._dataSet),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===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new RE;const t=this.getAllSeries(),e=[],i={};t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=`${n}-${t.type}`;i[r]?s.forEach((t=>{i[r].marks.push(t)})):(i[r]=Object.assign(Object.assign({},t),{marks:s}),e.push(i[r]))}))}})),e.forEach((t=>{const e=Jw.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(wM({},kM("stage",this._spec,{}),null))}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.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=N(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=Jw.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({},i),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_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(y(t))return this.getAllModels().find((e=>e.userId===t));if(u(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){const s=Jw.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"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(){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e,this._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof tC)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 kC))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof kC)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}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){G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&TT(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=zT(this._spec,this._option,{width:Sk,height:Ak})),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(_(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),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=xw(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new EE(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){VT(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=xw(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0};return Object.keys(t).filter((t=>!e[t])).sort()}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=this._getSpecKeys(this._spec);if(!z(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{VT(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[r.title]:!0,[r.brush]:!0,[r.indicator]:!0};this._components.forEach((s=>{var n,a;if(s.type===r.label||s.type===r.totalLabel)return;i[s.type]&&(i[s.type]=!1);const o=s.specKey||s.type,l=null!==(n=this._spec[o])&&void 0!==n?n:{};_(l)?(e[o]=e[o]||{specCount:l.length,componentCount:0},e[o].componentCount++,VT(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):VT(t,s.updateSpec(l))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}const s=t=>t&&!1!==t.visible;Object.keys(i).forEach((e=>{if(i[e]){const i=this._spec[e];(_(i)?i.some(s):s(i))&&(t.reMake=!0)}}))}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];VT(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=Nw(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.resetLayoutItemTag(),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(){this._backgroundMark&&this._backgroundMark.compile()}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._option.globalInstance),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,this._option.globalInstance)}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._option.globalInstance),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,this._option.globalInstance)}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._option.globalInstance),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,this._option.globalInstance)}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(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(E(t[s]))continue;const n=t[s];let r={stateValue:s};r=u(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(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(cT.AFTER_MARK_RENDER_END,e)};this._event.on(cT.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?G(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:oT;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||u(e.filter)&&e.filter(o,l))){if(aT(l.type))h.filter((h=>{const c=r(h,l,o,i),u=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));u&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),u=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));u>=0&&(c.splice(u,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===ZM.dimensionHover||s===ZM.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=d(t)||!n||n.every((t=>Jx(t.axis.getScale().type)&&d(t.index))),o=a||n.every((t=>Jx(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(n))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(r.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(r.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),n=[];s.forEach((e=>{const i=t(e);!1!==i&&n.push({axis:e,value:i})})),i.showCrosshair(n)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const PE=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=G(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return G(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)};class IE{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)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),u=Object.assign(Object.assign({},s),c);e?u.theme=h.getTheme(r,t):qw(t,a,c.spec),qw(n,null!=o?o:a,u)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));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=PE(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=PE(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=G(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return G(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,e,i){var s,n,r,a,o;const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,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},h=this.seriesType;return h&&(l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(Jw.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(Jw.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=Jw.getComponents();let h,c,u,d;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=Jw.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=Jw.getComponentInKey(t.type);o.push(e(s,t,i))})))}return u&&!g&&(null===(n=u.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(u,t,i))}))),p.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):eM(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),d&&(null===(a=eM(t,d.specKey,d.type))||void 0===a||a.forEach((t=>{o.push(e(d,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"];return i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(G(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(G(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}))}_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:_(a)?a[a.length-1]:a})}}class LE extends IE{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_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;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{d(i[t])&&(i[t]=n[t])})),R(i,"trimPadding")&&Zw(i,WT(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class DE extends LE{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),HT(t)}}const FE=(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&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=Zk(t,!0);for(const e in o)for(const i in o[e].nodes)eT(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)tT(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&Qk(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}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 NE{_beforeInit(){this._dataSet&&_T(this._dataSet,"stackSplit",FE)}_initStack(){this._stack=new jE(this),this._stack.init()}}const UE={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:ZM.dimensionHover};class HE extends HC{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},UE,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=oT(i);let n;return n=_(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}HE.type="dimension-hover",HE.defaultOptions=UE;const zE=()=>{Jw.registerInteractionTrigger(HE.type,HE)},VE=()=>{Jw.registerComposedEvent(ZM.dimensionHover,qM),Jw.registerComposedEvent(ZM.dimensionClick,WM)},WE=t=>t.fieldX[0],GE=t=>t.fieldY[0],YE=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},XE=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},$E=(t,e)=>t?e?WE:YE:e?GE:XE,KE=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=KM(t,(t=>FM(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=KM(t,(t=>jM(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,u=new Set;[o,l].forEach((t=>t.forEach((t=>{Jx(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&u.add(t)}))));const d=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(u.size>0){if(u.has(t)){const s=qE(t,i,$E(e,Jx(t.getScale().type)));s&&d.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=qE(t,i,$E(e,s));n&&d.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===d.length&&p("x")):(p("x"),0===d.length&&p("y")),d.length?d:null},qE=(t,e,i)=>{const s=t.positionToData(e,!0);return d(s)?null:ZE(t,s,i)},ZE=(t,e,i)=>{const s=t.getScale();if(d(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=XM(e,t,"cartesian",null!=i?i:FM(t.getOrient())?WE:GE);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},JE=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:u,cacheInfo:d,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,y=0,_=null;if(u.size){const t=Array.from(u.values())[0];y=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,_=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!u.size&&Number.isFinite(y)&&!Number.isNaN(y),x=s&&!b&&p(d),S=x?d:{coordRange:[0,0],sizeRange:[0,0],coord:y,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:_};let A;S&&(S._isCache=x);let w=0;if(f&&u.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,u,d,p;let g=null;const m=t.getScale();if(Jx(m.type))A=m.bandwidth(),0===A&&m.step&&(w=m.step());else if(qx(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,y=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=function(t){let e=0;return R(t,"tick.visible")&&(e+=R(t,"tick.tickSize")),R(t,"label.visible")&&(e+=R(t,"label.space")),e}(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(a=_.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&_&&null!==(o=_.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(l=_.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&_&&null!==(h=_.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(c=_.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&_&&null!==(u=_.attribute.textBaseline)&&void 0!==u?u:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&_&&null!==(d=_.attribute.textAlign)&&void 0!==d?d:"center",textBaseline:n&&_&&null!==(p=_.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};tR(t,u),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=y+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=y+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&QE(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=w,t[n].cacheInfo=S})),t),QE=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=tM(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},tR=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},eR=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=iR(i,s,n,e.axis),{coordRange:u}=e;c={visible:!0,start:{[r]:Math.max(o+t,u[0]),[a]:l[0]},end:{[r]:Math.min(o+h,u[1]),[a]:l[1]}}}return c},iR=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},sR=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return JE(c,r,e),c.xField.cacheInfo?eR(c.xField):c.yField.cacheInfo?eR(c.yField):void 0},nR=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],rR=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&nR.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(aR(s).every((t=>{var e;return!rM("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},aR=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},oR={dom:`${xk}_TOOLTIP_HANDLER_DOM`,canvas:`${xk}_TOOLTIP_HANDLER_CANVAS`},lR={key:"其他",value:"..."};var hR;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(hR||(hR={}));class cR{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(d(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(d(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,h=d(null==o?void 0:o.key)&&d(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:h,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}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:u,model:g}=e;if(!u||!this._cacheActiveSpec){const u=this.component.getSpec();if(this._cacheActiveSpec=rR(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){d(this._cacheActiveSpec.handler)&&p(u.handler)&&(this._cacheActiveSpec.handler=u.handler);const g=null!==(i=u[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},lR),t):lR;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!d(e)&&rM(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class uR extends cR{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)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],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(!Jx(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(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}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const dR=()=>{Jw.registerTooltipProcessor("dimension",uR)};class pR extends cR{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,u=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,d=null===(n=null==u?void 0:u.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===d||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==d){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,vs.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(oT(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const gR=()=>{Jw.registerTooltipProcessor("mark",pR)};class fR extends cR{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:G(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?G(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return G(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=G(s)[0][a];return r.filter((t=>t[a]===o))}}const mR=()=>{Jw.registerTooltipProcessor("group",fR)};class vR extends OE{constructor(){super(...arguments),this.transformerConstructor=DE,this.type="line",this.seriesType=mw.line}_setModelOption(){this._modelOption.getDimensionInfo=KE,this._modelOption.getDimensionInfoByValue=ZE,this._modelOption.getRectByDimensionData=sR}}vR.type="line",vR.seriesType=mw.line,vR.transformerConstructor=DE,W(vR,NE);function yR(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 _R=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:yR(t,e)}),bR=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:yR(t,e)}),xR={type:"fadeIn"},SR={type:"growCenterIn"};function AR(t,e){if(!1===e)return{};switch(e){case"fadeIn":return xR;case"scaleIn":return SR;default:return _R(t)}}class wR extends kC{constructor(){super(...arguments),this.type=wR.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}wR.type="rect";const kR=()=>{m_(),d_(),CA("rect",OA),Jw.registerMark(wR.type,wR),Hb.registerBuiltInAnimate("growHeightIn",bx),Hb.registerBuiltInAnimate("growHeightOut",xx),Hb.registerBuiltInAnimate("growWidthIn",jx),Hb.registerBuiltInAnimate("growWidthOut",Nx),Hb.registerBuiltInAnimate("growCenterIn",vx),Hb.registerBuiltInAnimate("growCenterOut",yx),Jw.registerGraphicComponent("rect",ec)},TR=Object.assign(Object.assign({},mM),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function CR(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;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=Vw(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[vM]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):Ow(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[yM]):Ow(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=Ow(this._dataToPosX(t),e,i),n=Ow(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[_M]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):Ow(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[bM]):Ow(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=Ow(this._dataToPosY(t),e,i),n=Ow(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},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(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},ER.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:MM(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(ER.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}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(_T(this._option.dataSet,"addVChartProperty",iM),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=d(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};_T(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new ni(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:gM.bind(this),call:fM}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new bC(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=bM,s=_M,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=yM,s=vM,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=Zk(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)CR(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,u=Ow(this[r](t),l,i),d=Ow(this[a](t),l,i);let p=Math.abs(u-d);p<=0&&!Pw(t[this.getStackValueField()],l)?p=0:pthis._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.setMarkConfig({clip:!0,clipPath:()=>{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[Ek],n=t[Rk],r=t[Ok],h=t[Pk];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]),{[Ek]:i,[Rk]:s}),a?{[Ok]:o,[Pk]:l}:void 0),c="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)};t.push(ec(Object.assign(Object.assign({},c),{cornerRadius:u(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(c,h,this._markAttributeContext):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=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>Ow(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},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=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>Ow(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),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=d(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;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=$(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=LM(this);this._barMark.setAnimationConfig(wM(null===(e=Jw.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),kM(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=d(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=p(this._spec.barWidth)&&r===n,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=a;return o&&(c=Vw(this._spec.barWidth,a)),l&&(c=Math.max(c,Vw(this._spec.barMinWidth,a))),h&&(c=Math.min(c,Vw(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,u;"horizontal"===t?(h=this.getYAxisHelper(),c="height",u="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",u="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=d(i)?f:Math.min(f,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.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=G(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],u=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],d=u.length,p=Vw(null!==(l=i[r-1])&&void 0!==l?l:Y(i),v),g=u.indexOf(e[c]);r===t.length-1?(s+=d*y+(d-1)*p,n+=g*(y+p)):(n+=g*(s+p),s+=s+(d-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const _=qx(g.type||"band");return u(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(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}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}}ER.type=mw.bar,ER.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},ER.mark=TR,ER.transformerConstructor=BR;const RR=()=>{CE(),kR(),Jw.registerAnimation("bar",((t,e)=>({appear:AR(t,e),enter:_R(t,!1),exit:bR(t,!1),disappear:{duration:IC.disappear.duration}}))),uE(),hE(),Jw.registerSeries(ER.type,ER)};class OR extends LE{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),HT(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 PR extends OE{constructor(){super(...arguments),this.transformerConstructor=OR,this.type="bar",this.seriesType=mw.bar}_setModelOption(){this._modelOption.getDimensionInfo=KE,this._modelOption.getDimensionInfoByValue=ZE,this._modelOption.getRectByDimensionData=sR}}PR.type="bar",PR.seriesType=mw.bar,PR.transformerConstructor=OR,W(PR,NE);const IR=[...iB,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class LR extends sB{constructor(){super(...arguments),this.type=LR.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return IR}_getIgnoreAttributes(){return[]}}LR.type="area";class DR extends hM{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of G(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 FR=Object.assign(Object.assign(Object.assign({},mM),JM),{area:{name:"area",type:"area"}}),jR=()=>{Jw.registerAnimation("area",FC),jC(),DC()};class NR extends lB{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!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,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,u=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),d=!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,f=h;("line"===c||d&&!u)&&(g=h,f=l),l.style=Zw({},f.style,g.style),l.state=Zw({},f.state,g.state),!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),t.area=l,t.line=h}}class UR extends DM{constructor(){super(...arguments),this.type=mw.area,this.transformerConstructor=NR,this._sortDataByAxis=!1}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(UR.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}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===qC?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return Ow(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),y1: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),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return Ow(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:!!e&&this.getColorAttribute(),stroke:!!i&&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.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[Rk]},"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(wM(null===(e=Jw.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),kM("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(wM(null===(i=Jw.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),kM("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=LM(this);this._symbolMark.setAnimationConfig(wM(null===(s=Jw.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),kM("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new DR(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.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(){super.onLayoutEnd(),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&&_(l)?l[0]:l}}}UR.type=mw.area,UR.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},UR.mark=FR,UR.transformerConstructor=NR,W(UR,QM);const HR=()=>{CE(),yE(),rB(),Jw.registerMark(LR.type,LR),m_(),i_(),LA(),EA(),NC(),Jw.registerGraphicComponent("area",_c),oB(),jR(),uE(),hE(),Jw.registerSeries(UR.type,UR)};class zR extends LE{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),HT(t)}}class VR extends OE{constructor(){super(...arguments),this.transformerConstructor=zR,this.type="area",this.seriesType=mw.area}_setModelOption(){this._modelOption.getDimensionInfo=KE,this._modelOption.getDimensionInfoByValue=ZE,this._modelOption.getRectByDimensionData=sR}}VR.type="area",VR.seriesType=mw.area,VR.transformerConstructor=zR,W(VR,NE);class WR extends PM{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)?G(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?G(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=G(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(d(t)||d(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(G(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(G(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}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:[]};qx(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:[]};qx(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)&&IM(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}}function GR(t){return Hg(t)?Number.parseFloat(t):0}const YR=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:u}=e,d=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&u&&XR(m,d,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=Vt(e+a/2)};let y=0,_=-1/0,b=!0;for(let t=0;tNumber(t[d]))),S=g-p;let A=p,w=S,k=0;const T=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))}(x);if(m.forEach(((t,e)=>{const i=t[kB],s=y?i/y:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=w/k;A=p,m.forEach((e=>{const i=e[r]===f?f:e[kB]*t;v(e,A,i),A+=i}))}if(0!==y&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},XR=(t,e,i)=>!!d(t)||(0===t.length||(!!t.every((t=>0===GR(t[e])))||!i&&0===t.reduce(((t,i)=>t+GR(i[e])),0)));function $R(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const KR=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:$R(t,!0,MT.appear)}),qR={type:"fadeIn"},ZR=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:$R(t,!0,MT.enter)}),JR=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:$R(t,!0,MT.exit)});function QR(t,e){if(!1===e)return{};switch(e){case"fadeIn":return qR;case"growRadius":return KR(Object.assign(Object.assign({},t),{growField:"radius"}));default:return KR(Object.assign(Object.assign({},t),{growField:"angle"}))}}class tO extends kC{constructor(t,e){super(t,e),this.type=eO.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>Ut({x:0,y:0},this.getAttribute("centerOffset",e,i),e[EB])[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 eO extends tO{constructor(){super(...arguments),this.type=eO.type}}eO.type="arc";const iO=()=>{m_(),t_(),CA("arc",jA),Hb.registerBuiltInAnimate("growRadiusIn",Lx),Hb.registerBuiltInAnimate("growRadiusOut",Dx),Hb.registerBuiltInAnimate("growAngleIn",fx),Hb.registerBuiltInAnimate("growAngleOut",mx),Jw.registerGraphicComponent("arc",Sc),Jw.registerMark(eO.type,eO)},sO=Object.assign(Object.assign({},mM),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class nO extends OM{_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=Zw({},this._theme,i,t);const n=(t,e)=>Zw({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);_(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const rO=`${xk}_LABEL_VISIBLE`;class aO extends WR{constructor(){super(...arguments),this.transformerConstructor=nO,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:jw(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:jw(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=PB,this._endAngle=IB,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[EB];if(d(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return Ut(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;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 a=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)?jt(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?jt(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?jt(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=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;_T(this._dataSet,"pie",YR),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?jt(this._spec.minAngle):0,asStartAngle:CB,asEndAngle:MB,asRatio:TB,asMiddleAngle:EB,asRadian:OB,asQuadrant:RB,asK:BB,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new ni(this._dataSet,{name:`${xk}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new bC(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},aO.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:Tk,groupKey:this._seriesField,isSeriesMark:!0},{morph:MM(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return pw(CB)(t)}endAngleScale(t){return pw(MB)(t)}_computeLayoutRadius(){return((t,e,i,s)=>{const n=t();if(S(n))return n;if(u(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return zt(r,i(),t,e)}return Math.min(r.width/2,r.height/2)})((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:Iw(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:Iw(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},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),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)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:pw(rO).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(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}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*(d(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[EB];if(d(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return Ut(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===MT.appear)return this._startAngle;if(i===MT.disappear)return this._endAngle;const r=[MT.disappear,MT.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[kk];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[kk]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[kk])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[kk])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+Ut({x:0,y:0},a,e[EB]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+Ut({x:0,y:0},a,e[EB]).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[EB]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+Ut({x:0,y:0},a,e[EB]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=wM(null===(i=Jw.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}aO.transformerConstructor=nO,aO.mark=sO,aO.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class oO extends aO{constructor(){super(...arguments),this.type=mw.pie}}oO.type=mw.pie;const lO=()=>{iO(),Jw.registerAnimation("pie",((t,e)=>({appear:QR(t,e),enter:ZR(t),exit:JR(t),disappear:{duration:IC.disappear.duration}}))),Jw.registerAnimation("emptyCircle",((t,e)=>({appear:QR(t,e)}))),Jw.registerSeries(oO.type,oO)};class hO extends IE{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=G(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=>{d(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],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 cO extends hO{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class uO extends OE{constructor(){super(...arguments),this.transformerConstructor=cO}}uO.transformerConstructor=cO;class dO extends uO{constructor(){super(...arguments),this.transformerConstructor=cO,this.type="pie",this.seriesType=mw.pie}}dO.type="pie",dO.seriesType=mw.pie,dO.transformerConstructor=cO;class pO extends IE{_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")&&Zw(e,WT(this.type,t))})),this._transformAxisSpec(t)}}const gO=(t,e)=>{if(!t)return null;const i=KM(t,(t=>"angle"===t.getOrient()),e),s=KM(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&Jx(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),u={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=cw({x:1,y:0},u);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=uw(u),f=null===(e=s[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(d(v))return;let y=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));y<0&&(y=void 0);const _=XM(v,t,"polar",r);n.push({index:y,value:v,position:i.scale(v),axis:t,data:_})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&Jx(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let u=cw({x:1,y:0},c);u<-Math.PI/2&&(u=2*Math.PI+u);const p=uw(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((u-(null==f?void 0:f[0]))*(u-(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=s.invert(p);if(d(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const y=XM(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:y})}})),n.length?n:null};class fO extends OE{constructor(){super(...arguments),this.transformerConstructor=pO,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=KE(t,e,i))&&void 0!==s?s:[],...null!==(n=gO(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=ZE,this._modelOption.getRectByDimensionData=sR}}fO.type="common",fO.transformerConstructor=pO,W(fO,NE);const mO={rect:SO,symbol:bO,arc:wO,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=bO(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:function(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=yO(t,l,n.formatMethod);return h.x=function(t,e,i,s){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")+s:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-s:e.totalPositionX(t,"end")+(t.end>=t.start?s:-s);return e.totalPositionX(t,"index",.5)}(l,s,a,o),h.y=function(t,e,i,s){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")-s;if("min"===i)return e.totalPositionY(t,t.end>=t.start?"start":"end")+s;return 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),Gh(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:[]}}},line:kO,area:kO,rect3d:SO,arc3d:wO,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function vO(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=mO[t])&&void 0!==i?i:mO.point;return e.series.type===mw.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=_O(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;y(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!y(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:TO(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function yO(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==mw.sankey){const{formatFunc:t,args:n}=tM(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function _O(t){return u(t)?e=>t(e.data):t}function bO(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=_O(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:xO(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function xO(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function SO(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=_O(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",u="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 d,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&u||(null==i?void 0:i[t])<0&&!u?1:0;return e[c][s]}return s},d=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:AO(o)};let g=!1;return y(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:d,smartInvert:g}}function AO(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 wO(t){var e;const{labelSpec:i}=t,s=null!==(e=_O(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:y(s)&&s.includes("inside"),{position:n,smartInvert:r}}function kO(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}))):[{index:0,[Ck]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function TO(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class CO extends NB{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,z(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=ww({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:G(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==$T.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});d(e.fill)&&(e.fill=r),d(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&d(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}CO.type=r.label;class MO extends kC{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=MO.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?pc(t):Gh(t)}}MO.type="text";class BO extends MO{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}render(){}}BO.type="text",BO.constructorType="label";const EO=()=>{Jw.registerMark(MO.type,MO),m_(),b_(),g_(),Jw.registerGraphicComponent("text",Gh),Jw.registerGraphicComponent("richtext",pc),Jw.registerMark(BO.constructorType,BO)};class RO extends jB{_initTheme(t,e){return{spec:t,theme:this._theme}}}class OO extends CO{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=RO,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.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(cT.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(cT.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),dw(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{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{G(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),u(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();_(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),u=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let d=Zw({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},vO(h,r),Object.assign(Object.assign(Object.assign({},N(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:u}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[Nk])):t=>t.filter((t=>t.data[jk]))}:{});return l&&l.parseLabelStyle&&(d=l.parseLabelStyle(d,a,o)),"line"!==h&&"area"!==h||(d.type=h),d},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?yO(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=_(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=G(i())[t])}))}return e}}OO.type=r.label,OO.specKey="label",OO.transformerConstructor=RO;var PO;!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(PO||(PO={}));const IO={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class LO extends NB{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=ft((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},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.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{Jx(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_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}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||z(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(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:gT.chart}:{source:pT.chart};_(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,r,n)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;_(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}onBeforeRender(){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"}:Fg(e)||jg(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=G(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:pT.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:pT.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:pT.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)=>{IO[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:u}=this.getLayoutStartPoint();return n.forEach((t=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const d=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+d.left),o=Math.min(o,i-u+d.top),l=Math.max(l,e+t.getLayoutRect().width-c-d.right),h=Math.max(h,i+t.getLayoutRect().height-u-d.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_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)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_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 i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:u,fillOpacity:d,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?u:d;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=R(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=R(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:u}=n,d=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:R(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},u)},d):{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||on&&(d=n-l),h>r&&(p=r-h),d&&t.setAttribute("dx",d+c),p&&t.setAttribute("dy",p+u)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}LO.specKey="crosshair";const DO={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}}}}};class FO extends LO{static getSpecInfo(t){return eM(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_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)}}_getDatumAtPoint(t,e){const i=FM(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){FM(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:jM(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();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 o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=((t,e)=>{for(let i=0;i{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=eR(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,u,d;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(u=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==u?u:0,textStyle:Object.assign(Object.assign({},null===(d=i.label)||void 0===d?void 0:d.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new Q_(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new tb(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}FO.specKey="crosshair",FO.builtInTheme={crosshair:DO},FO.type=r.cartesianCrosshair;const jO=(t,e)=>p(e)?t.map((t=>e[t])):void 0,NO=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),UO=t=>!d(t)&&(_(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function HO(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),u=i.getOption(),g=u.getRegionsInUserIdOrIndex(p(c.regionId)?[c.regionId]:void 0,p(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=zO(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),y=g.getLayoutRect(),_=u.globalInstance.getContainer(),b=Object.assign({x:0,y:0},_?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(_):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>NO(i,s)(t)&&NO(n,r)(t)&&(d(a)||NO([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),A=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),y.width),y:Math.min(Math.max(t.y,0),y.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.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 l=[{value:t[e.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=>x(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=u.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:pT.chart,event:A({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=u.globalInstance;return KC.globalConfig.uniqueTooltip&&KC.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=u.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:pT.chart,event:A(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=u.globalInstance;return KC.globalConfig.uniqueTooltip&&KC.hideTooltip(a.id),m}return"none"}const zO=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),u=e.getMeasureField(),g=e.getSeriesField(),f=p(g)?t[g]:void 0,m=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=jO(c,t);let y=jO(u,t);const _=UO(y),b=!_&&p(g)&&d(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(NO(c,v));if(!_&&(y=jO(u,i),!UO(y)))return;const n=e.type===mw.pie?e.dataToCentralPosition(i):e.dataToPosition(i);d(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:u,measureData:y,hasMeasureData:_,groupField:g,groupData:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=Jx(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])=>d(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(NO(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(y=jO(u,o),!UO(y))return;const l=t.dataToPosition(o);d(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:u,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(NO(c,n));if(!_&&(y=jO(u,r),!UO(y)))return;const o=t.dataToPosition(r);if(d(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:u,measureData:y,hasMeasureData:_,groupField:g,groupData:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===mw.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(NO(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(y=jO(u,i),!UO(y))return;const r=t.dataToPosition(i);d(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:u,measureData:y,hasMeasureData:_,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&(()=>{var i,n,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(NO(c,v));const o=e.getNameMap(),l=null===(r=null===(n=e.getMapViewData)||void 0===n?void 0:n.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=y;if(l&&!a&&(a=Object.assign({},t)),!_){if(y=jO(u,a),h=y,!UO(y)&&!a)return;UO(y)||(y=[null])}const p=e.dataToPosition(a);d(p)||isNaN(p.x)||isNaN(p.y)||s.push({pos:p,data:{dimensionFields:c,dimensionData:v,measureFields:u,measureData:h,hasMeasureData:_,groupField:g,groupData:f,originDatum:a},series:e})})()})),s},VO=t=>p(t)&&!_(t),WO=t=>p(t)&&_(t);class GO extends jB{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i,s,n;const{spec:r,theme:a}=super._initTheme(t,e);return r.style=Zw({},this._theme,r.style),r.offset=Zw({},a.offset,t.offset),r.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:a.transitionDuration,r.trigger=null!==(s=t.trigger)&&void 0!==s?s:a.trigger,r.triggerOff=null!==(n=t.triggerOff)&&void 0!==n?n:a.triggerOff,{spec:r,theme:a}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(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]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:jg(this._option.mode)||!Dg(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.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?y(t.parentElement)&&(t.parentElement=Ap.getElementById(t.parentElement)):Dg(this._option.mode)&&(t.parentElement=null==Lg?void 0:Lg.body)}}const YO={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}};class XO extends NB{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=GO,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=Dg(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return d(t.mark)&&d(t.model)&&d(t.datum)}(t)&&(n&&VO(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!d(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&KC.globalConfig.uniqueTooltip&&l&&KC.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;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;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:pT.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(null==r?void 0:r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:pT.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),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,this._enterable=!1;else{const t="canvas"===s?oR.canvas:oR.dom,n=Jw.getComponentPluginInType(t);n||Og("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,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=Jw.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=G(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=G(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(Fg(s)||jg(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,ft(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===s||s.call(i)}else 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=HO(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(d(this._cacheInfo)||d(t))return!1;if(WO(t)){if(VO(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>GM(t,e[i])))}if(WO(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!d(n)&&!d(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: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}getVisible(){return!1!==this._spec.visible}}XO.type=r.tooltip,XO.transformerConstructor=GO,XO.builtInTheme={tooltip:YO},XO.specKey="tooltip";function $O(t,i){const s=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:n={},item:r={},pager:a={},background:o={}}=t;n=I(n),r=I(r),a=I(a),o=I(o);const l=s;return n.visible?l.title=function(t){var e,i;const s=Object.assign({},t);return E(t.style)||(s.textStyle=rT(t.style)),E(t.textStyle)||Zw(s.textStyle,rT(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&rT(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&rT(s.background.style),s}(n):l.title={visible:!1},E(r.focusIconStyle)||rT(r.focusIconStyle),r.shape&&(r.shape=sT(r.shape)),r.label&&(r.label=sT(r.label)),r.value&&(r.value=sT(r.value)),r.background&&(r.background=sT(r.background)),Dw(r.maxWidth)&&(r.maxWidth=Number(r.maxWidth.substring(0,r.maxWidth.length-1))*i.width/100),Dw(r.width)&&(r.width=Number(r.width.substring(0,r.width.length-1))*i.width/100),Dw(r.height)&&(r.height=Number(r.height.substring(0,r.height.length-1))*i.width/100),l.item=r,"scrollbar"===a.type?(E(a.railStyle)||rT(a.railStyle),E(a.sliderStyle)||rT(a.sliderStyle)):(E(a.textStyle)||rT(a.textStyle),a.handler&&sT(a.handler)),l.pager=a,o.visible&&!E(o.style)&&(Zw(l,o.style),p(o.padding)&&(l.padding=o.padding)),l}const KO=(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},qO=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),u=l();if(0===c.length&&u.length)return[];if(c.length===u.length)return t;const d={};c.forEach((t=>{d[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:Ck;return h?h(t,c,g):(_(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(g)&&(t=t.filter((t=>!0===d[r.getSeriesFieldValue(t,g)]))),t)};class ZO extends NB{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:()=>{dw(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),dw(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=Lw(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=G(s)),p(e)&&(this._regionUserId=G(e)),p(n)&&(this._seriesIndex=G(n)),p(i)&&(this._regionUserIndex=G(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}_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):(z(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new bC(this._option,e),this._initSelectedData(),dw(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;d(e)||JSON.stringify(r)===JSON.stringify(e)||(dw(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;A(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)z(s,this._cacheAttrs)||this._legendComponent.setAttributes(Zw({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(Zw({},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;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());z(t,this._cacheAttrs)||this._legendComponent.setAttributes(Zw({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}ZO.specKey="legends";class JO extends ZO{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return eM(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),dw(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){_T(this._option.dataSet,"discreteLegendFilter",qO),_T(this._option.dataSet,"discreteLegendDataMake",KO);const t=new ni(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return dw(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(d(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(!zg(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 u(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)&&d(t.title.text)&&d(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=qk(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},$O(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(i),this._addLegendItemFormatMethods(i),i}_getLegendConstructor(){return sw}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(JA.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(JA.legendItemHover,(e=>{const i=R(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(JA.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:A(s)?s:1,strokeOpacity:A(n)?n: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 u(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}=tM(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=tM(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}JO.specKey="legends",JO.builtInTheme={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}},JO.type=r.discreteLegend;const QO="vchart-tooltip",tP=`${QO}-container`,eP=`${QO}-title`,iP=`${QO}-content-box`,sP={offsetX:10,offsetY:10},nP="99999999999999";function rP(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const aP=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,oP=t=>y(t)&&""!==(null==t?void 0:t.trim())||S(t)?rP(t):"",lP=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(u(t)){const s=t(e);S(s)&&(i=s)}return i},hP={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},cP=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=hP[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class uP extends mB{constructor(){super(...arguments),this._visible=!0,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._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const u=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,u,e,t))&&void 0!==n?n:0;const d=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[u])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==d?void 0:d.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,d;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const y=e.event,{activeType:_,data:b}=t,x="dimension"===_?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:w,offsetY:k}=this._option,T=m[_],C=nM(null==T?void 0:T.position,b,e),M=null!==(r=nM(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===_?"mark":"pointer",{width:B=0,height:E=0}=null!=i?i:{},R="canvas"===m.renderMode,O=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),P=null!==(o=null==O?void 0:O.width)&&void 0!==o?o:Sk,I=null!==(l=null==O?void 0:O.height)&&void 0!==l?l:Ak;let L=!1;const D={width:0,height:0};let F,j={x:0,y:0},N={x:0,y:0},U=1,H=1;const z=Dg(this._env);if(z&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=P,D.height=I),z&&!R){const t=this._getParentElement(m);N=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(d=this._compiler.getCanvas())&&void 0!==d?d:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),j={x:F.x-N.x,y:F.y-N.y},U=aP(e,F),H=aP(t,N)}const V=H/U,W={},G={x:C,y:C},Y={x:["left","right"],y:["top","bottom"]},X=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?w:k;if("mark"===i){L=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){L=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(L){const e=Y[n][0],i="x"===n?B:E;switch(cP(t,n)){case-2:W[e]=a-i*V-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*V/2;break;case-1:W[e]=(a+o)/2-i*V-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*V-c;break;case 2:W[e]=o+c}}},$=["x","y"];if(g(C))if(g(K=C)&&(p(K.left)||p(K.right)||p(K.top)||p(K.bottom))){const{left:t,right:e,top:i,bottom:s}=C;W.left=lP(t,y),W.top=lP(i,y),W.right=lP(e,y),W.bottom=lP(s,y)}else(t=>g(t)&&(p(t.x)||p(t.y)))(C)&&$.forEach((t=>{const e=C[t];S(e)||u(e)?W[Y[t][0]]=lP(e,y):X(e,t)}));else p(C)&&(X({orient:C,mode:M},"x"),X({orient:C,mode:M},"y"));var K;const q={x:null,y:null};return $.forEach((t=>{var e;const i="x"===t?B:E,s="x"===t?P:I,n="x"===t?w:k,r=cP(G[t],t);if(A(W[Y[t][0]]))q[t]=W[Y[t][0]];else if(A(W[Y[t][1]]))q[t]=s-i*V-W[Y[t][1]];else{const e="x"===t?y.canvasX:y.canvasY;q[t]=r>0?e+n:0===r?e-i*V/2:e-i*V-n}q[t]*=U,z&&(q[t]+=j[t]),q[t]/=H;const a="x"===t?D.width:D.height,o=m.confine?-(N[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/U)/H:-N[t]/H,l=a/H+o-i;2!==r&&q[t]l&&(q[t]=l)):-2!==r&&q[t]>l&&(L?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]p(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",pP=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=dP(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=dP(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},gP=(t={})=>{const{lineHeight:e}=t;return t.fontSize?jw(e,t.fontSize):0},fP=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=A(l)?`${l}px`:`${l}`),p(r)&&(o=Ce(r),a.padding=dP(o)),{panelStyle:a,panelPadding:o}};function mP(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}class vP extends uP{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(vP.type),this.type=oR.dom,this._tooltipContainer=null==Lg?void 0:Lg.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(Lg&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:u,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=fP(l),y={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),A(g)&&(y.marginBottom=`${g}px`);const _={width:dP(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=pP(h),x=pP(u),S=pP(p),w="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),d(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),d(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),d(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),_[w]=dP(null!==(i=c.spacing)&&void 0!==i?i:8),x[w]=dP(null!==(s=u.spacing)&&void 0!==s?s:26),S[w]=dP(null!==(n=p.spacing)&&void 0!==n?n:0);const k=Math.max(gP(p),gP(u));return y.lineHeight=k>0?`${k}px`:"20px",{panelPadding:v,row:y,panel:m,title:b,shape:_,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(eP))),l=a.find((t=>t.className.includes(iP)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(eP),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(mP(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${QO}-column`),e.classList.add(`${QO}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(iP),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];mP(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));mP(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${QO}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=oP(e.key),e.keyStyle&&pP(e.keyStyle,l)):"value"===i?(o.innerHTML=oP(e.value),e.valueStyle&&pP(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:u=!1,shapeFill:d}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?rP(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?rP(c):m,_=p,b=t=>new Xh({symbolType:t,size:_,fill:!0});let x=b(h);const S=x.getParsedPath();let A,w;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;w=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(w=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new le));let k=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=k.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));k=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const T=Un.IsGradientStr(d);if(!d||y(d)&&!T||u)return m=u?"none":d?rP(d):"currentColor",`\n \n \n \n `;const C=T?Un.Parse(d):g(d)?d:null;if(C){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=C.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===C.gradient?t=`\n ${i}\n `:"linear"===C.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),mP(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(iP))),h=[...o.children].find((t=>t.className.includes(eP)));if(l){const o=this._component.getSpec(),c={},u=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(u&&u.autoWidth&&!1!==u.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(eP)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=jw(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,mP(l,c))}const d=l.children,g=[];if(d){for(let i=0;i{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},Ec||(Ec=Mc.CreateGraphic("richtext",{})),Ec.setAttributes(a),Ec.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function bP(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:yP),{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:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const xP=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};class SP extends uP{constructor(){super(SP.type),this.type=oR.canvas,this._attributes=null}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 lw({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}_getTooltipBoxSize(t,e){var i,s;if(!e||d(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");this._attributes=((t,e,i)=>{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:u={},titleLabel:d,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,align:y}=l,_=Ce(u.padding),b=Hw(u.padding),x=bP(Object.assign({textAlign:"right"===y?"right":"left"},d),i),S=bP(Object.assign({textAlign:"right"===y?"right":"left"},f),i),A=bP(m,i),w={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},k={panel:xP(u),padding:_,title:{},content:[],titleStyle:{value:x,spaceRow:v},contentStyle:{shape:w,key:S,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,enterable:h,transitionDuration:c,align:y},{title:T={},content:C=[]}=t;let M=b.left+b.right,B=b.top+b.bottom,E=0;const R=!!C.length;let O=0,P=0,I=0,L=0;if(R){const t=[],e=[],i=[],s=[];let n=0;k.content=C.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:u,shapeStroke:d,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:y,spaceRow:_,keyStyle:b,valueStyle:x,shapeHollow:k}=r,T={height:0,spaceRow:null!=_?_:v};if(p(h)){const i=Zw({},S,bP(b,void 0,{})),{width:s,height:n,text:r}=_P(h,i);T.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),y?e.push(s):t.push(s),o=Math.max(o,n)}if(p(m)){const t=Zw({},A,bP(x,void 0,{})),{width:e,height:s,text:n}=_P(m,t);T.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};k?t.stroke=u:t.fill=u,t.stroke=null!=d?d:u,t.lineWidth=g,T.shape=t;const e=null!=f?f:w.size;o=Math.max(e,o),s.push(e)}else T.shape={visible:!1};return T.height=o,n+=o,aV.autoWidth&&!1!==V.multiLine;if(N){V=Zw({},x,bP(H,void 0,{})),W()&&(V.multiLine=null===(r=V.multiLine)||void 0===r||r,V.maxWidth=null!==(a=V.maxWidth)&&void 0!==a?a:R?Math.ceil(E):void 0);const{text:t,width:e,height:i}=_P(U,V);k.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=V.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},V),{text:t}),D=k.title.value.width,F=k.title.value.height,j=F+(R?k.title.spaceRow:0)}return B+=j,k.title.width=D,k.title.height=F,W()?M+=E||D:M+=Math.max(D,E),R&&k.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=M-b.left-b.right-L-O-S.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),k.valueWidth=Math.max(k.valueWidth,i.width))})),k.panel.width=M,k.panel.height=B,k})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_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{activeTooltipSpec: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()}}SP.type=oR.canvas;const AP=/\{([^}]+)\}/,wP=/\{([^}]+)\}/g,kP=/:/;class TP extends mB{constructor(){super(TP.type),this.type="formatterPlugin",this._timeModeFormat={utc:Be.getInstance().timeUTCFormat,local:Be.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Fe.getInstance().format,this._numericSpecifier=Fe.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[TP.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;u(r)?this._formatter=r:(this._formatter=this._format.bind(this),u(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),Jw.registerFormatter(this._formatter)}_format(t,e,i){return _(t)?t.map(((t,s)=>{const n=_(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):_(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=AP.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(wP,((t,i)=>{if(!kP.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(Ie.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):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}TP.pluginType="chart",TP.specKey="formatter",TP.type="formatterPlugin";KC.useRegisters([()=>{dR(),gR(),mR(),VE(),zE(),CE(),yE(),rB(),oB(),jC(),DC(),uE(),hE(),Jw.registerSeries(ME.type,ME),Jw.registerChart(vR.type,vR)},()=>{dR(),gR(),mR(),zE(),HR(),VE(),Jw.registerChart(VR.type,VR)},()=>{dR(),gR(),mR(),zE(),RR(),VE(),Jw.registerChart(PR.type,PR)},()=>{gR(),lO(),Jw.registerChart(dO.type,dO)},()=>{dR(),gR(),mR(),VE(),Jw.registerChart(fO.type,fO),zE()},hE,uE,()=>{Jw.registerComponent(JO.type,JO)},()=>{Jw.registerComponent(XO.type,XO)},()=>{Jw.registerComponent(FO.type,FO)},()=>{Jw.registerGraphicComponent(OO.type,(t=>new UA(t))),EO(),VB(),Jw.registerComponent(OO.type,OO,!0,1/0)},()=>{var t;t=SP,Jw.registerComponentPlugin(t.type,t)},()=>{var t;t=TP,Jw.registerChartPlugin(t.type,t)},WC,XC]),KC.useRegisters([()=>{Kv(Vi)}]),t.DEFAULT_CHART_HEIGHT=Ak,t.DEFAULT_CHART_WIDTH=Sk,t.DEFAULT_CLOSE_STROKE_JOIN=JC,t.DEFAULT_DATA_INDEX=kk,t.DEFAULT_DATA_KEY=Tk,t.DEFAULT_DATA_SERIES_FIELD=Ck,t.DEFAULT_KEY=Yk,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=ZC,t.DEFAULT_MAP_LOOK_UP_KEY=Xk,t.DEFAULT_MEASURE_CANVAS_ID=wk,t.DEFAULT_SERIES_STYLE_NAME=Mk,t.DEFAULT_SMOOTH_INTERPOLATE=qC,t.Factory=Jw,t.MOSAIC_CAT_END_PERCENT=Vk,t.MOSAIC_CAT_START_PERCENT=zk,t.MOSAIC_VALUE_END_PERCENT=Hk,t.MOSAIC_VALUE_START_PERCENT=Uk,t.ManualTicker=class extends jb{constructor(t){super(t),this.lastFrameTime=0,this.status=es.RUNNING}setupTickHandler(){const t=new Nb;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===es.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===es.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=es.RUNNING,!0}},t.PREFIX=xk,t.SEGMENT_FIELD_END=Gk,t.SEGMENT_FIELD_START=Wk,t.STACK_FIELD_END=Rk,t.STACK_FIELD_END_OffsetSilhouette=Lk,t.STACK_FIELD_END_PERCENT=Pk,t.STACK_FIELD_KEY=Bk,t.STACK_FIELD_START=Ek,t.STACK_FIELD_START_OffsetSilhouette=Ik,t.STACK_FIELD_START_PERCENT=Ok,t.STACK_FIELD_TOTAL=Dk,t.STACK_FIELD_TOTAL_BOTTOM=Nk,t.STACK_FIELD_TOTAL_PERCENT=Fk,t.STACK_FIELD_TOTAL_TOP=jk,t.StreamLight=class extends zb{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=Gi.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new pn,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=Gi.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,u,d,p,g,f,m,v,y;const _=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(_){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(u=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==u?u:60,d=-n,p=d+(s-d)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:ys.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(d=b.height)&&void 0!==d?d:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(y=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==y?y:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:ys.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=Os(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(u=(o-a)/c.getLength());const[e]=Os(c||s,u);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(u);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&d.push(Ft.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pu){d.push(Ft.pointAtPP(o[t-1],o[t],1-(p+e-u)/e));break}d.length&&d.push(o[t]),p+=e}if(d.length&&!(d.length<2)){t.clear(),t.moveTo(d[0].x,d[0].y);for(let e=1;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(u(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(d(i))for(let i=0;i(l(t),t)))},t.measureText=bk,t.normalizeLayoutPaddingSpec=Hw,t.queryColorFromColorScheme=Aw,t.queryToken=Gw,t.registerDataSetInstanceParser=bT,t.registerDataSetInstanceTransform=_T,t.registerTheme=ok,t.removeTheme=hk,t.themeExist=ck,t.themes=nk,t.token=Xw,t.transformColorSchemeToStandardStruct=Cw,t.transformToGraphic=rT,t.version="2.0.20",t.vglobal=Ap,t.warn=Rg,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/vchart/package.json b/packages/vchart/package.json index fb00ba9e55..7e266d5a07 100644 --- a/packages/vchart/package.json +++ b/packages/vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vchart", - "version": "2.0.19", + "version": "2.0.20", "description": "charts lib based @visactor/VGrammar", "main": "cjs/index.js", "module": "esm/index.js", @@ -118,15 +118,15 @@ "cross-env": "^7.0.3" }, "dependencies": { - "@visactor/vutils": "~1.0.22", - "@visactor/vdataset": "~1.0.22", - "@visactor/vscale": "~1.0.22", - "@visactor/vlayouts": "~1.0.22", - "@visactor/vrender-core": "~1.0.41", - "@visactor/vrender-kits": "~1.0.41", - "@visactor/vrender-components": "~1.0.41", - "@visactor/vrender-animate": "~1.0.41", - "@visactor/vutils-extension": "workspace:2.0.19" + "@visactor/vutils": "~1.0.23", + "@visactor/vdataset": "~1.0.23", + "@visactor/vscale": "~1.0.23", + "@visactor/vlayouts": "~1.0.23", + "@visactor/vrender-core": "1.0.44", + "@visactor/vrender-kits": "1.0.44", + "@visactor/vrender-components": "1.0.44", + "@visactor/vrender-animate": "1.0.44", + "@visactor/vutils-extension": "workspace:2.0.20" }, "publishConfig": { "access": "public", diff --git a/packages/vchart/src/compile/mark/interface.ts b/packages/vchart/src/compile/mark/interface.ts index 01c0568fca..b1c26c9435 100644 --- a/packages/vchart/src/compile/mark/interface.ts +++ b/packages/vchart/src/compile/mark/interface.ts @@ -64,6 +64,7 @@ export interface IMarkStateManager { addStateInfo: (stateInfo: IStateInfo) => void; changeStateInfo: (stateInfo: Partial) => void; clearStateInfo: (stateValues: StateValue[]) => void; + clearAllStateInfo: () => void; checkOneState: (renderNode: IMarkGraphic, datum: Datum[], state: IStateInfo) => 'in' | 'out' | 'skip'; checkState: (renderNode: IMarkGraphic, datum: Datum[]) => StateValue[]; getStateMap: () => StateValueMap; diff --git a/packages/vchart/src/compile/mark/mark-state-manager.ts b/packages/vchart/src/compile/mark/mark-state-manager.ts index c7d1d065bf..1374d48ef2 100644 --- a/packages/vchart/src/compile/mark/mark-state-manager.ts +++ b/packages/vchart/src/compile/mark/mark-state-manager.ts @@ -123,6 +123,10 @@ export class MarkStateManager extends StateManager implements IMarkStateManager }); } + clearAllStateInfo() { + this._stateInfoList = []; + } + protected _isMultiMark() { return !this._mark || isMultiDatumMark(this._mark.type as MarkTypeEnum); } diff --git a/packages/vchart/src/component/axis/base-axis.ts b/packages/vchart/src/component/axis/base-axis.ts index bf7e7fad78..3e9888bfb5 100644 --- a/packages/vchart/src/component/axis/base-axis.ts +++ b/packages/vchart/src/component/axis/base-axis.ts @@ -1,3 +1,4 @@ +import type { IGroup } from '@visactor/vrender-core'; // eslint-disable-next-line no-duplicate-imports import type { ITickDataOpt, AxisItem } from '@visactor/vrender-components'; import type { IBandLikeScale, IBaseScale, IContinuousScale } from '@visactor/vscale'; @@ -96,10 +97,16 @@ export abstract class AxisComponent { @@ -252,52 +275,53 @@ export abstract class AxisComponent { - let field = this.collectSeriesField(depth, s); - field = (isArray(field) ? (isContinuous(this._scale.type) ? field : [field[0]]) : [field]) as string[]; - if (!depth) { - this._dataFieldText = s.getFieldAlias(field[0]); - } + this._regions && + eachSeries( + this._regions, + s => { + let field = this.collectSeriesField(depth, s); + field = (isArray(field) ? (isContinuous(this._scale.type) ? field : [field[0]]) : [field]) as string[]; + if (!depth) { + this._dataFieldText = s.getFieldAlias(field[0]); + } - if (field) { - const viewData = s.getViewData(); - if (rawData) { - field.forEach(f => { - data.push( - s.getRawDataStatisticsByField(f, !!isContinuous(this._scale.type)) as { - min: number; - max: number; - values: any[]; + if (field) { + const viewData = s.getViewData(); + if (rawData) { + field.forEach(f => { + data.push( + s.getRawDataStatisticsByField(f, !!isContinuous(this._scale.type)) as { + min: number; + max: number; + values: any[]; + } + ); + }); + } else if (viewData && viewData.latestData && viewData.latestData.length) { + const seriesData = s.getViewDataStatistics?.(); + const userSetBreaks = + this.type === ComponentTypeEnum.cartesianLinearAxis && this._spec.breaks && this._spec.breaks.length; + + field.forEach(f => { + if (seriesData?.latestData?.[f]) { + if (userSetBreaks) { + data.push({ + ...seriesData.latestData[f], + values: viewData.latestData.map((obj: Datum) => obj[f]) + }); + } else { + data.push(seriesData.latestData[f]); + } } - ); - }); - } else if (viewData && viewData.latestData && viewData.latestData.length) { - const seriesData = s.getViewDataStatistics?.(); - const userSetBreaks = - this.type === ComponentTypeEnum.cartesianLinearAxis && this._spec.breaks && this._spec.breaks.length; - - field.forEach(f => { - if (seriesData?.latestData?.[f]) { - if (userSetBreaks) { - data.push({ - ...seriesData.latestData[f], - values: viewData.latestData.map((obj: Datum) => obj[f]) - }); - } else { - data.push(seriesData.latestData[f]); - } - } - }); + }); + } } + }, + { + userId: this._seriesUserId, + specIndex: this._seriesIndex } - }, - { - userId: this._seriesUserId, - specIndex: this._seriesIndex - } - ); + ); return data; } @@ -378,6 +402,36 @@ export abstract class AxisComponent 0; + } + + protected _refreshVisibilityByData() { + const nextVisible = this._specVisible && (!this._hideWhenEmpty || this._hasCollectedSeriesData()); + const changed = this._visible !== nextVisible; + this._visible = nextVisible; + + if (this._axisMark || this._gridMark) { + this._syncComponentVisibility(); + } + + if (changed) { + this._forceLayout(); + } + + return changed; + } + + protected _syncComponentVisibility() { + this._axisMark?.setVisible(this._visible); + this._gridMark?.setVisible(this._visible && this._spec.grid?.visible !== false); + + (this._axisMark?.getComponent?.() as IGroup)?.setAttributes?.({ visibleAll: this._visible }); + (this._gridMark?.getComponent?.() as IGroup)?.setAttributes?.({ + visibleAll: this._visible && this._spec.grid?.visible !== false + }); + } + protected _clearRawDomain() { // 留给各个类型的 axis 来 override } diff --git a/packages/vchart/src/component/axis/cartesian/axis.ts b/packages/vchart/src/component/axis/cartesian/axis.ts index d8976623f2..a058a91b11 100644 --- a/packages/vchart/src/component/axis/cartesian/axis.ts +++ b/packages/vchart/src/component/axis/cartesian/axis.ts @@ -302,7 +302,7 @@ export abstract class CartesianAxis getBoundsInRect: update tick attr -> forceLayout -> updateLayoutAttr: update tick attr -> chart layout -> scale update -> mark encode // 问题: chart layout之后, scale发生变化, 导致tick 和 mark position 不同步 // 解决方案: chart layout 之后重新计算tick位置 @@ -805,6 +805,11 @@ export abstract class CartesianAxis { + if (!this._visible) { + this._syncComponentVisibility(); + return; + } + const startPoint = this.getLayoutStartPoint(); const { grid: updateGridAttrs, ...updateAxisAttrs } = this._getUpdateAttribute(false); const axisAttrs = mergeSpec({ x: startPoint.x, y: startPoint.y }, this._axisStyle, updateAxisAttrs); @@ -822,6 +827,8 @@ export abstract class CartesianAxis number; _onTickDataChange: (compilableData: CompilableData) => void; registerTicksTransform: () => string; + _refreshVisibilityByData: () => boolean; } export class BandAxisMixin { @@ -199,6 +200,7 @@ export class BandAxisMixin { } } this.transformScaleDomain(); + this._refreshVisibilityByData(); this.event.emit(ChartEvent.scaleDomainUpdate, { model: this as unknown as IModel }); this.event.emit(ChartEvent.scaleUpdate, { model: this as unknown as IModel, value: 'domain' }); } diff --git a/packages/vchart/src/component/axis/mixin/linear-axis-mixin.ts b/packages/vchart/src/component/axis/mixin/linear-axis-mixin.ts index a73a417db3..29b3143cb7 100644 --- a/packages/vchart/src/component/axis/mixin/linear-axis-mixin.ts +++ b/packages/vchart/src/component/axis/mixin/linear-axis-mixin.ts @@ -52,6 +52,7 @@ export interface LinearAxisMixin { _orient: IOrientType; _option: IComponentOption; niceLabelFormatter: (value: StringOrNumber) => StringOrNumber; + _refreshVisibilityByData: () => boolean; } export class LinearAxisMixin { @@ -403,6 +404,7 @@ export class LinearAxisMixin { this._updateNiceLabelFormatter(domain); this._domainAfterSpec = this._scale.domain(); + this._refreshVisibilityByData(); this.event.emit(ChartEvent.scaleDomainUpdate, { model: this as any }); this.event.emit(ChartEvent.scaleUpdate, { model: this as any, value: 'domain' }); } diff --git a/packages/vchart/src/component/axis/polar/axis.ts b/packages/vchart/src/component/axis/polar/axis.ts index 9bb5755bf1..6eee0e97ab 100644 --- a/packages/vchart/src/component/axis/polar/axis.ts +++ b/packages/vchart/src/component/axis/polar/axis.ts @@ -201,7 +201,7 @@ export abstract class PolarAxis extends BaseComponent i const boundsStart = isHorizontal ? x1 : y1; const boundsEnd = isHorizontal ? x2 : y2; + const range = axis.getScale().range(); + const rangeFactor = axis.scaleRangeFactor() ?? [0, 1]; + + // 判断轴是否为反向轴(last(range) < range[0]),即从右到左, 或从下到上 + // 如果是反向轴, 计算start和end时, 也要保持 start < end + const isAxisReverse = last(range) < range[0]; + const startPosTemp = boundsStart - region.getLayoutStartPoint()[regionStartAttr]; + const endPosTemp = boundsEnd - region.getLayoutStartPoint()[regionStartAttr]; + const endPos = isAxisReverse ? Math.min(startPosTemp, endPosTemp) : Math.max(startPosTemp, endPosTemp); + const startPos = isAxisReverse ? Math.max(startPosTemp, endPosTemp) : Math.min(startPosTemp, endPosTemp); + + const start = + ((startPos - range[0]) / (last(range) - range[0])) * (rangeFactor[1] - rangeFactor[0]) + rangeFactor[0]; + const end = + ((endPos - range[0]) / (last(range) - range[0])) * (rangeFactor[1] - rangeFactor[0]) + rangeFactor[0]; + const newStart = this._stateClamp(start - axisRangeExpand); + const newEnd = this._stateClamp(end + axisRangeExpand); + if (this._axisDataZoomMap[axis.id]) { const dataZoom = this._axisDataZoomMap[axis.id]; - const startPercent = - (boundsStart - region.getLayoutStartPoint()[regionStartAttr]) / region.getLayoutRect()[regionSizeAttr]; - const endPercent = - (boundsEnd - region.getLayoutStartPoint()[regionStartAttr]) / region.getLayoutRect()[regionSizeAttr]; - const newStartPercent = this._stateClamp(startPercent - axisRangeExpand); - const newEndPercent = this._stateClamp(endPercent + axisRangeExpand); + + const newStartPercent = isAxisReverse ? 1 - newStart : newStart; + const newEndPercent = isAxisReverse ? 1 - newEnd : newEnd; dataZoom.setStartAndEnd(Math.min(newStartPercent, newEndPercent), Math.max(newStartPercent, newEndPercent), [ 'percent', 'percent' @@ -729,23 +744,6 @@ export class Brush extends BaseComponent i ) }); } else { - const range = axis.getScale().range(); - const rangeFactor = axis.scaleRangeFactor() ?? [0, 1]; - - // 判断轴是否为反向轴(last(range) < range[0]),即从右到左, 或从下到上 - // 如果是反向轴, 计算start和end时, 也要保持 start < end - const isAxisReverse = last(range) < range[0]; - const startPosTemp = boundsStart - region.getLayoutStartPoint()[regionStartAttr]; - const endPosTemp = boundsEnd - region.getLayoutStartPoint()[regionStartAttr]; - const endPos = isAxisReverse ? Math.min(startPosTemp, endPosTemp) : Math.max(startPosTemp, endPosTemp); - const startPos = isAxisReverse ? Math.max(startPosTemp, endPosTemp) : Math.min(startPosTemp, endPosTemp); - - const start = - ((startPos - range[0]) / (last(range) - range[0])) * (rangeFactor[1] - rangeFactor[0]) + rangeFactor[0]; - const end = - ((endPos - range[0]) / (last(range) - range[0])) * (rangeFactor[1] - rangeFactor[0]) + rangeFactor[0]; - const newStart = this._stateClamp(start - axisRangeExpand); - const newEnd = this._stateClamp(end + axisRangeExpand); axis.scaleRangeFactor([newStart, newEnd]); axis.effect.scaleUpdate(); diff --git a/packages/vchart/src/component/data-zoom/data-zoom/data-zoom.ts b/packages/vchart/src/component/data-zoom/data-zoom/data-zoom.ts index 74be85dae7..a23dde19e5 100644 --- a/packages/vchart/src/component/data-zoom/data-zoom/data-zoom.ts +++ b/packages/vchart/src/component/data-zoom/data-zoom/data-zoom.ts @@ -108,6 +108,8 @@ export class DataZoom extends DataFilte protected _handleDataCollectionChange() { const data = this._data.getDataView(); data.reRunAllTransform(); + // 数据更新后,重新计算scale的domain和range,保证datazoom组件的预览图和数据保持一致 + this._initAfterLayout(); const domain = this._computeDomainOfValueScale(); @@ -117,6 +119,7 @@ export class DataZoom extends DataFilte } this._valueScale.domain(domain); this._updateValueScaleRange(); + if (this._component) { this._createOrUpdateComponent(true); } @@ -453,10 +456,7 @@ export class DataZoom extends DataFilte protected _createOrUpdateComponent(changeData?: boolean) { if (this._visible) { - const xScale = this._isHorizontal ? this._stateScale : this._valueScale; - const yScale = this._isHorizontal ? this._valueScale : this._stateScale; - const isNeedPreview = - this._isScaleValid(xScale) && this._isScaleValid(yScale) && this._spec.showBackgroundChart !== false; + const isNeedPreview = this._spec.showBackgroundChart !== false; const attrs = this._getAttrs(isNeedPreview); const axis = this._relatedAxisComponent as CartesianAxis; diff --git a/packages/vchart/src/component/data-zoom/scroll-bar/scroll-bar.ts b/packages/vchart/src/component/data-zoom/scroll-bar/scroll-bar.ts index 21958104bc..7df191b913 100644 --- a/packages/vchart/src/component/data-zoom/scroll-bar/scroll-bar.ts +++ b/packages/vchart/src/component/data-zoom/scroll-bar/scroll-bar.ts @@ -16,7 +16,8 @@ import { Factory } from '../../../core/factory'; import type { ILayoutType } from '../../../typings/layout'; import { isClose } from '../../../util'; import { scrollBar } from '../../../theme/builtin/common/component/scroll-bar'; -import { statePointToData } from '../util'; +import { isReverse, statePointToData } from '../util'; +import type { CartesianAxis } from '../../axis/cartesian'; // import { SCROLLBAR_EVENT, SCROLLBAR_END_EVENT } from '@visactor/vrender-components/es/constant'; // 由vrender透出, 接入新版本后需修改 @@ -59,8 +60,10 @@ export class ScrollBar extends DataFi this._start = start; this._end = end; - const startValue = statePointToData(start, this._stateScale, false); - const endValue = statePointToData(end, this._stateScale, false); + const axis = this._relatedAxisComponent as CartesianAxis; + const reverse = isReverse(axis, this._isHorizontal); + const startValue = statePointToData(start, this._stateScale, reverse); + const endValue = statePointToData(end, this._stateScale, reverse); const hasChange = isFunction(this._spec.updateDataAfterChange) ? this._spec.updateDataAfterChange(start, end, startValue, endValue) : this._handleStateChange(startValue, endValue); diff --git a/packages/vchart/src/component/legend/continuous/interface.ts b/packages/vchart/src/component/legend/continuous/interface.ts index a925a4916d..5159dc49b5 100644 --- a/packages/vchart/src/component/legend/continuous/interface.ts +++ b/packages/vchart/src/component/legend/continuous/interface.ts @@ -1,8 +1,15 @@ import type { IRectMarkSpec, ISymbolMarkSpec, ITextMarkSpec, StringOrNumber } from '../../../typings'; import type { ComponentThemeWithDirection } from '../../interface'; import type { ILegendCommonSpec, NoVisibleMarkStyle } from '../interface'; +import type { HandlerTextStyleContext } from '@visactor/vrender-components'; type Text = StringOrNumber; +type ContinuousLegendTextStyle = Omit, 'text'>; +type ContinuousLegendTextStyleCallback = ( + value: Text, + position: 'start' | 'end', + context: HandlerTextStyleContext +) => ContinuousLegendTextStyle | undefined; export type TextAttribute = { /** 是否展示 */ @@ -16,7 +23,7 @@ export type TextAttribute = { /** * 文本样式 */ - style?: Omit, 'text'>; + style?: ContinuousLegendTextStyle; }; export type HandlerTextAttribute = { @@ -35,7 +42,7 @@ export type HandlerTextAttribute = { /** * 文本样式 */ - style?: Omit, 'text'>; + style?: ContinuousLegendTextStyle | ContinuousLegendTextStyleCallback; }; // 连续图例通用配置 diff --git a/packages/vchart/src/component/legend/continuous/util.ts b/packages/vchart/src/component/legend/continuous/util.ts index 6182035c8a..5516a318a5 100644 --- a/packages/vchart/src/component/legend/continuous/util.ts +++ b/packages/vchart/src/component/legend/continuous/util.ts @@ -1,11 +1,32 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ import type { IColorLegendSpec, ISizeLegendSpec } from './interface'; +import type { HandlerTextStyleContext } from '@visactor/vrender-components'; import { ColorContinuousLegend, SizeContinuousLegend } from '@visactor/vrender-components'; -import { isEmpty, isValid } from '@visactor/vutils'; +import { isEmpty, isFunction, isValid } from '@visactor/vutils'; import { mergeSpec } from '@visactor/vutils-extension'; import { transformComponentStyle, transformToGraphic } from '../../../util/style'; import { transformLegendTitleAttributes } from '../util'; +function transformHandlerText(handlerText: IColorLegendSpec['handlerText'] | ISizeLegendSpec['handlerText']) { + if (!handlerText) { + return handlerText; + } + + const nextHandlerText = { + ...handlerText + }; + const handlerTextStyle = handlerText.style; + + if (isFunction(handlerTextStyle)) { + nextHandlerText.style = (value: string | number, position: 'start' | 'end', context: HandlerTextStyleContext) => + transformToGraphic(handlerTextStyle(value, position, context)); + } else if (!isEmpty(handlerTextStyle)) { + nextHandlerText.style = transformToGraphic(handlerTextStyle); + } + + return nextHandlerText; +} + // 获取连续图例组件属性 export function getContinuousLegendAttributes(spec: IColorLegendSpec | ISizeLegendSpec) { const { @@ -68,7 +89,7 @@ export function getContinuousLegendAttributes(spec: IColorLegendSpec | ISizeLege attrs.startText = transformComponentStyle(startText); attrs.endText = transformComponentStyle(endText); - attrs.handlerText = transformComponentStyle(handlerText); + attrs.handlerText = transformHandlerText(handlerText); if (!isEmpty(sizeBackground)) { attrs.sizeBackground = transformToGraphic(sizeBackground); diff --git a/packages/vchart/src/core/vchart.ts b/packages/vchart/src/core/vchart.ts index b337bf670d..a43fd728fb 100644 --- a/packages/vchart/src/core/vchart.ts +++ b/packages/vchart/src/core/vchart.ts @@ -1471,27 +1471,19 @@ export class VChart implements IVChart { // 处理 specTheme 和 optionTheme, merge -> transform // 优先级 currentTheme < optionTheme < specTheme if (!isEmpty(optionTheme) || !isEmpty(specTheme)) { - if ( - (isString(optionTheme) && (!specTheme || isString(specTheme))) || - (isString(specTheme) && (!optionTheme || isString(optionTheme))) - ) { - const finalTheme = mergeTheme( - {}, - getThemeObject(this._currentThemeName), - getThemeObject(optionTheme), - getThemeObject(specTheme) - ); - - this._currentTheme = processThemeByChartType(chartType, finalTheme); - } else { - const finalTheme = mergeTheme( - {}, - getThemeObject(this._currentThemeName), - getThemeObject(optionTheme), - getThemeObject(specTheme) - ); - this._currentTheme = processThemeByChartType(chartType, finalTheme); - } + const finalTheme = mergeTheme( + {}, + getThemeObject( + isObject(specTheme) && specTheme.type + ? specTheme.type + : isObject(optionTheme) && optionTheme.type + ? optionTheme.type + : this._currentThemeName + ), + getThemeObject(optionTheme), + getThemeObject(specTheme) + ); + this._currentTheme = processThemeByChartType(chartType, finalTheme); } else { currentTheme = getThemeObject(this._currentThemeName); this._currentTheme = processThemeByChartType(chartType, currentTheme); diff --git a/packages/vchart/src/data/transforms/circle-packing.ts b/packages/vchart/src/data/transforms/circle-packing.ts index 5f5468227d..2600095ea0 100644 --- a/packages/vchart/src/data/transforms/circle-packing.ts +++ b/packages/vchart/src/data/transforms/circle-packing.ts @@ -7,6 +7,8 @@ import { CirclePackingLayout } from '@visactor/vlayouts'; export interface ICirclePackingOpt extends CirclePackingOptions { width: number; height: number; + /** the field to read node value, default is 'value' */ + valueField?: string; } /** diff --git a/packages/vchart/src/mark/base/base-mark.ts b/packages/vchart/src/mark/base/base-mark.ts index 7765d236ca..ea1e199480 100644 --- a/packages/vchart/src/mark/base/base-mark.ts +++ b/packages/vchart/src/mark/base/base-mark.ts @@ -257,13 +257,13 @@ export class BaseMark extends GrammarItem implements IMar protected _stateSort?: (stateA: string, stateB: string) => number; - protected declare _product: Maybe; + declare protected _product: Maybe; getProduct() { return this._product; } // 保存上一次的mark,用于morph的时候获取上次的图元 - protected declare _lastMark?: IMark; + declare protected _lastMark?: IMark; /** 初始化 mark data */ protected initMarkData(option: ICompilableInitOption) { @@ -526,7 +526,7 @@ export class BaseMark extends GrammarItem implements IMar return this._simpleStyle; } - protected declare _option: IMarkOption; + declare protected _option: IMarkOption; protected _attributeContext: IModelMarkAttributeContext; @@ -1087,7 +1087,14 @@ export class BaseMark extends GrammarItem implements IMar return; } this._product = mark.getProduct(); + if (!this._product) { + return; + } + this._product.clearStates(); this._graphics = mark.getGraphics(); + this._graphics.forEach(g => { + g.clearStates(); + }); this._graphicMap = (mark as any)._graphicMap; this._graphicMap.forEach(g => { @@ -1148,8 +1155,8 @@ export class BaseMark extends GrammarItem implements IMar this._keyGetter = isFunction(this.key) ? (this.key as (datum: Datum) => string) : isValid(this.key) - ? (datum: Datum) => datum?.[this.key as string] - : (datum: Datum) => datum?.[DEFAULT_DATA_KEY]; + ? (datum: Datum) => datum?.[this.key as string] + : (datum: Datum) => datum?.[DEFAULT_DATA_KEY]; this._groupKeyGetter = isValid(this._groupKey) ? (datum: Datum) => { return `${datum?.[this._groupKey]}`; @@ -1164,8 +1171,8 @@ export class BaseMark extends GrammarItem implements IMar const animationState = graphicsAnimationStates.every(state => state === AnimationStateEnum.appear) ? AnimationStateEnum.appear : graphicsAnimationStates.every(state => state === AnimationStateEnum.disappear) - ? AnimationStateEnum.disappear - : graphicsAnimationStates[0]; + ? AnimationStateEnum.disappear + : graphicsAnimationStates[0]; return animationState ?? AnimationStateEnum.none; } @@ -1186,7 +1193,7 @@ export class BaseMark extends GrammarItem implements IMar ? { ...config, // 循环动画的优先级定为最高,不会被屏蔽掉 - priority: type === 'normal' ? config.priority ?? Infinity : config.priority + priority: type === 'normal' ? (config.priority ?? Infinity) : config.priority } : config; } @@ -1311,8 +1318,8 @@ export class BaseMark extends GrammarItem implements IMar return diffState === AnimationStateEnum.exit ? AnimationStateEnum.exit : diffState === AnimationStateEnum.update - ? AnimationStateEnum.update - : AnimationStateEnum.appear; + ? AnimationStateEnum.update + : AnimationStateEnum.appear; }); const customizedState = callback(g); @@ -1789,6 +1796,12 @@ export class BaseMark extends GrammarItem implements IMar this.getVisible() && (!this._skipBeforeLayouted || this.getCompiler().getLayoutState() !== LayoutState.before) ) { + // A mark may lose its product when visibility toggles to false during compile. + // Later data/layout updates can make it visible again without triggering compile, + // so recreate the product lazily before rendering. + if (!this._product) { + this._initProduct(); + } log(`render mark: ${this.getProductId()}, type is ${this.type}`); this.renderInner(); } @@ -2056,4 +2069,13 @@ export class BaseMark extends GrammarItem implements IMar runAnimation() { this._runStateAnimation(this.getGraphics()); } + + clearBeforeReInit() { + this.state.clearAllStateInfo(); + this.uncommit(); + this.stateStyle = {}; + this.getGraphics().forEach(g => { + g.clearStates(); + }); + } } diff --git a/packages/vchart/src/mark/interface/common.ts b/packages/vchart/src/mark/interface/common.ts index 9ead7699d6..56df36e444 100644 --- a/packages/vchart/src/mark/interface/common.ts +++ b/packages/vchart/src/mark/interface/common.ts @@ -246,6 +246,8 @@ export interface IMarkRaw extends ICompilableMark { disableAnimationByState: (state: string | string[]) => void; /** 启用状态动画 */ enableAnimationByState: (state: string | string[]) => void; + /** 重新加载前清除缓存 */ + clearBeforeReInit: () => void; } export type IMark = IMarkRaw; diff --git a/packages/vchart/src/series/base/base-series.ts b/packages/vchart/src/series/base/base-series.ts index 725e6bc791..c639b4420a 100644 --- a/packages/vchart/src/series/base/base-series.ts +++ b/packages/vchart/src/series/base/base-series.ts @@ -111,7 +111,7 @@ export abstract class BaseSeries extends BaseModel imp declare getSpecInfo: () => ISeriesSpecInfo; - protected declare _option: ISeriesOption; + declare protected _option: ISeriesOption; // 坐标系信息 readonly coordinate: CoordinateType = 'none'; @@ -240,7 +240,7 @@ export abstract class BaseSeries extends BaseModel imp } protected _dataSet: DataSet; - protected declare _tooltipHelper: ISeriesTooltipHelper | undefined; + declare protected _tooltipHelper: ISeriesTooltipHelper | undefined; get tooltipHelper() { if (!this._tooltipHelper) { this.initTooltip(); @@ -842,8 +842,8 @@ export abstract class BaseSeries extends BaseModel imp const triggerOff = isValid(finalSelectSpec.triggerOff) ? finalSelectSpec.triggerOff : isMultiple - ? ['empty'] - : ['empty', finalSelectSpec.trigger]; + ? ['empty'] + : ['empty', finalSelectSpec.trigger]; return { type: TRIGGER_TYPE_ENUM.ELEMENT_SELECT as string, trigger: finalSelectSpec.trigger as GraphicEventType, @@ -1109,6 +1109,7 @@ export abstract class BaseSeries extends BaseModel imp const marks = this.getMarksWithoutRoot(); // FIXME: 合并 mark spec 的时机是否需要统一调整到 this.initMarkStyle() 中? marks.forEach(mark => { + mark.clearBeforeReInit(); (this._spec as any)[mark.name] && this.initMarkStyleWithSpec(mark, (this._spec as any)[mark.name]); }); this.initMarkStyle(); @@ -1281,7 +1282,7 @@ export abstract class BaseSeries extends BaseModel imp attributeContext: this._markAttributeContext, componentType: option.componentType, noSeparateStyle, - parent: parent !== false ? parent ?? this._rootMark : null + parent: parent !== false ? (parent ?? this._rootMark) : null }); if (isValid(m)) { diff --git a/packages/vchart/src/series/circle-packing/circle-packing.ts b/packages/vchart/src/series/circle-packing/circle-packing.ts index bcf781731f..7488171081 100644 --- a/packages/vchart/src/series/circle-packing/circle-packing.ts +++ b/packages/vchart/src/series/circle-packing/circle-packing.ts @@ -132,6 +132,7 @@ export class CirclePackingSeries< options: (): ICirclePackingOpt => { return { nodeKey: this._categoryField, + valueField: this._valueField, padding: this._layoutPadding, includeRoot: false, width: this.getLayoutRect().width || 1, diff --git a/packages/vutils-extension/package.json b/packages/vutils-extension/package.json index c8e6e5dc2c..1abc2501c9 100644 --- a/packages/vutils-extension/package.json +++ b/packages/vutils-extension/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vutils-extension", - "version": "2.0.19", + "version": "2.0.20", "description": "The extension module for VUtil from VisActor", "sideEffects": false, "main": "cjs/index.js", @@ -25,8 +25,8 @@ "test-watch": "DEBUG_MODE=1 jest --watch" }, "dependencies": { - "@visactor/vutils": "~1.0.22", - "@visactor/vdataset": "~1.0.22" + "@visactor/vutils": "~1.0.23", + "@visactor/vdataset": "~1.0.23" }, "devDependencies": { "@internal/bundler": "workspace:*", diff --git a/packages/wx-vchart/miniprogram/src/vchart/index.js b/packages/wx-vchart/miniprogram/src/vchart/index.js index 4d541ab59a..431e14b3b7 100644 --- a/packages/wx-vchart/miniprogram/src/vchart/index.js +++ b/packages/wx-vchart/miniprogram/src/vchart/index.js @@ -12,7 +12,7 @@ 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.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=(t,e=!1)=>e?"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 _=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||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=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||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 B=Object.prototype.hasOwnProperty;function P(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(B.call(t,e))return!1;return!0}var L=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&R.call(t,e);function I(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=y(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||_(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=I(r,e,i)}return s}function D(t,e,i=!1,s=!1){if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&y(t[a])?z(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(y(a)){if(s)o=[];else if(y(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(_(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function N(t){return Object.prototype.toString.call(t)}function V(t){return Object.keys(t)}function U(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(N(t)!==N(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(y(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!U(t[s],e[s],i))return!1;return!0}if(!m(t))return!1;const s=V(t),n=V(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!U(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;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},K=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;ne?1:t>=e?0:NaN}function et(t){return Number(t)}function it(t,e,i=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)}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(t=rt.None,e){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(...t){this._onErrorHandler.forEach((e=>e(...t)))}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(...t){var e;return this._level>=rt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):nt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=rt.Warn&&nt(this._method||"warn","WARN",t),this}info(...t){return this._level>=rt.Info&&nt(this._method||"log","INFO",t),this}debug(...t){return this._level>=rt.Debug&&nt(this._method||"log","DEBUG",t),this}}function ot(t,e,i=0,s){for(u(s)&&(s=t.length);i>>1;tt(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(tt)),it(i,.5)},dt=1e-10,ut=1e-10;function pt(t,e,i=ut,s=dt){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function gt(t,e,i,s){return t>e&&!pt(t,e,i,s)}function ft(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),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 f(e){const i=s,r=n;return s=n=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 _(){const t=Date.now();if(v(t))return y(t);o=m(_,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?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(_,e),c?f(t):a}(l);if(d)return o=m(_,e),f(l)}return void 0===o&&(o=m(_,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:y(Date.now())},b.pending=function(){return void 0!==o},b}function St(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),xt(t,e,{leading:s,trailing:n,maxWait:e})}function At(t,e){return i=>t*(1-i)+e*i}function kt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Mt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function Tt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}bt=!1;const wt=4294967296;const Ct=t=>e=>L(e,t),Et=(t,e={})=>{if(d(t))return t;const i=[t];return(e&&e.get||Ct)(i)},Bt=(t,e={})=>{if(y(t)){const i=t.map((t=>Et(t,e)));return t=>i.map((e=>e(t)))}return Et(t,e)},Pt=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t,Lt=t=>0,Rt=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function It(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Dt(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!u(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:d,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)d+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!u(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!u(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:d,b:p},predict:g,rSquared:It(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=Ot(f.min,f);for(let r=0;r=1?jt:t<=-1?-jt:Math.asin(t)}function Zt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Jt(t,e){return t[0]*e[1]-t[1]*e[0]}function Qt(t,e){let i=0;for(let s=0;s0?i:0}function ie(t,e){return te(t+e,10**Math.max(ee(t),ee(e)))}function se(t,e){return te(t-e,10**Math.max(ee(t),ee(e)))}class ne{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new ne(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 re{static distancePP(t,e){return Xt(Kt(t.x-e.x,2)+Kt(t.y-e.y,2))}static distanceNN(t,e,i,s){return Xt(Kt(t-i,2)+Kt(e-s,2))}static distancePN(t,e,i){return Xt(Kt(e-t.x,2)+Kt(i-t.y,2))}static pointAtPP(t,e,i){return new ne((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function ae(t){return t*(Math.PI/180)}function oe(t){return 180*t/Math.PI}const le=(t=0)=>{if(t<0)for(;t<-Ht;)t+=Ht;else if(t>0)for(;t>Ht;)t-=Ht;return t};function he(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 ce(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function de(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function ue(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function pe(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=ue(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)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function ge(t){return(t=ue(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 fe(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function me(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function _e(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=be(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var ye;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(ye||(ye={}));const be=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function xe(t,e,i){if(!t||!e)return ye.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=be(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function ke(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Me({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Te(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function we(t,e){const i=e?ae(t.angle):t.angle,s=Te(t);return[Me({x:t.x1,y:t.y1},i,s),Me({x:t.x2,y:t.y1},i,s),Me({x:t.x2,y:t.y2},i,s),Me({x:t.x1,y:t.y2},i,s)]}function Ce(t,e,i=!1){const s=we(t,i),n=we(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Te(t),Te(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?ae(t.angle):t.angle;let u=i?ae(90-t.angle):t.angle+jt;const p=i?ae(e.angle):e.angle;let g=i?ae(90-e.angle):e.angle+jt;u>Nt&&(u-=Nt),g>Nt&&(g-=Nt);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(ke(n,i)+ke(n,s))/2>ke(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Ee=1e-8;function Be(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Re(t,e){return Math.abs(t-e){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"};function Ie(t,e={},i){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")}class De{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=Ie(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:f=o}=this._userSpec;if(_(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,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: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,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}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(De.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/De.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(De.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(De.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/De.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}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)}}De.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",De.NUMBERS_CHAR_SET="0123456789",De.FULL_SIZE_CHAR="字";const Fe=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),ze=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=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(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=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(t=0,e=0,i=0,s=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(t=0,e=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(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return je(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 Ne extends He{}class Ve extends He{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Ce(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new Ve(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Me({x:this.x1,y:this.y1},this.angle,t),Me({x:this.x2,y:this.y1},this.angle,t),Me({x:this.x1,y:this.y2},this.angle,t),Me({x:this.x2,y:this.y2},this.angle,t)]}}class Ue{constructor(t=1,e=0,i=0,s=1,n=0,r=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 Ue,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,f=o*n+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 Ue;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:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ue(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=oe(r.rotateDeg),r}}class We{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 Ge(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 Ye(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 $e=/^#([0-9a-f]{3,8})$/,Xe={transparent:4294967040},Ke={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 qe(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Ze(t){return S(t)?new ii(t>>16,t>>8&255,255&t,1):y(t)?new ii(t[0],t[1],t[2]):new ii(255,255,255)}function Je(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Qe(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ti=(t,e)=>{const i=$e.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ii((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Ze(t):8===e?new ii(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class ei{static Brighter(t,e=1){return 1===e?t:new ei(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new ei(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof ei?t:new ei(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();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(Xe[t]))return function(t){return S(t)?new ii(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new ii(t[0],t[1],t[2],t[3]):new ii(255,255,255,1)}(Xe[t]);if(p(Ke[t]))return Ze(Ke[t]);const e=`${t}`.trim().toLowerCase(),i=ti(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new ii(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=Ge(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ii(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ei.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ii(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=Ye(this.color.r,this.color.g,this.color.b),r=Ge(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 ii(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=ti(e,!0);return null!=i?i:this}setColorName(t){const e=Ke[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(t=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}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new ei(this.color.toString())}copyGammaToLinear(t,e=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,e=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=Je(t.color.r),this.color.g=Je(t.color.g),this.color.b=Je(t.color.b),this}copyLinearToSRGB(t){return this.color.r=Qe(t.color.r),this.color.g=Qe(t.color.g),this.color.b=Qe(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ii{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`#${qe(this.r)+qe(this.g)+qe(this.b)+(1===this.opacity?"":qe(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}=Ye(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function si(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 ii(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:Ye});function ri(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 ai(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=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:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}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}const hi=1e-10;function ci(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+hi)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=gi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=re.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=di(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-hi,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function di(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function ui(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return di(t,t-(i*i-e*e+t*t)/(2*i))+di(e,s)}function pi(t,e){const i=re.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function gi(t){const e={x:0,y:0};for(let i=0;ithis.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 vi;function _i(t,e){const i=mi(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 yi{constructor(t={}){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 bi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function xi(t){let e;if(e=bi.exec(t))return new yi({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 Si=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Ai{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 Ai.instance||(Ai.instance=new Ai),Ai.instance}newFormat(t){const e=xi(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"):ki[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=ki[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:_,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)?m: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?Si[8+vi/3]:"")+A+(t&&"("===n?")":""),f)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=xi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=mi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=Si[8+n/3];return function(t){return s(r*t)+a}}}const ki={"%":(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)=>_i(100*t,e),r:_i,s:function(t,e){const i=mi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(vi=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")+mi(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 Mi(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(_.fx>e.fx?(Ei(y,1+c,v,-c,e),y.fx=t(y),y.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Ei(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=Qt(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Li(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Ci(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},Qi=Math.sqrt,ts=Math.tan;function es(t){return t>1?0:t<-1?zi:Math.acos(t)}function is(t){return t>1?ji:t<-1?-ji:Math.asin(t)}function ss(){}function ns(t,e){t&&as.hasOwnProperty(t.type)&&as[t.type](t,e)}var rs={Feature:function(t,e){ns(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++szi?t+Math.round(-t/Ni)*Ni:t,e]}function ys(t,e,i){return(t%=Ni)?e||i?vs(xs(t),Ss(e,i)):xs(t):e||i?Ss(e,i):_s}function bs(t){return function(e,i){return[(e+=t)>zi?e-Ni:e<-zi?e+Ni:e,i]}}function xs(t){var e=bs(t);return e.invert=bs(-t),e}function Ss(t,e){var i=$i(t),s=Zi(t),n=$i(e),r=Zi(e);function a(t,e){var a=$i(e),o=$i(t)*a,l=Zi(t)*a,h=Zi(e),c=h*i+o*s;return[Yi(l*n-c*r,o*i-h*s),is(c*n+l*r)]}return a.invert=function(t,e){var a=$i(e),o=$i(t)*a,l=Zi(t)*a,h=Zi(e),c=h*n-l*r;return[Yi(l*n+h*r,o*i+c*s),is(c*i-o*s)]},a}function As(t,e){(e=ds(e))[0]-=t,ms(e);var i=es(-e[1]);return((-e[2]<0?-i:i)+Ni-Fi)%Ni}function ks(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:ss,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function Ms(t,e){return Wi(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 Cs(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Os(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 Is(t,e,i,s){return function(n){var r,a,o,l=e(n),h=ks(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Os(a);var t=function(t,e){var i=Ls(e),s=e[1],n=Zi(s),r=[Zi(i),-$i(i),0],a=0,o=0;Ps.reset(),1===n?s=ji+Fi:-1===n&&(s=-ji-Fi);for(var l=0,h=t.length;l=0?1:-1,M=k*A,T=M>zi,w=f*x;if(Ps.add(Yi(w*k*Zi(M),m*S+w*$i(M))),a+=T?A+k*Ni:A,T^p>=i^y>=i){var C=ps(ds(u),ds(_));ms(C);var E=ps(r,C);ms(E);var B=(T^A>=0?-1:1)*is(E[2]);(s>B||s===B&&(C[0]||C[1]))&&(o+=T^A>=0?1:-1)}}return(a<-Fi||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(Ds))}return u}}function Ds(t){return t.length>1}function Fs(t,e){return((t=t.x)[0]<0?t[1]-ji-Fi:ji-t[1])-((e=e.x)[0]<0?e[1]-ji-Fi:ji-e[1])}1===(Es=Rs).length&&(Bs=Es,Es=function(t,e){return Rs(Bs(t),e)});var zs=Is((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?zi:-zi,l=Wi(r-i);Wi(l-zi)0?ji:-ji),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=zi&&(Wi(i-n)Fi?Gi((Zi(e)*(r=$i(s))*Zi(i)-Zi(s)*(n=$i(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*ji,s.point(-zi,n),s.point(0,n),s.point(zi,n),s.point(zi,0),s.point(zi,-n),s.point(0,-n),s.point(-zi,-n),s.point(-zi,0),s.point(-zi,n);else if(Wi(t[0]-e[0])>Fi){var r=t[0]0,n=Wi(e)>Fi;function r(t,i){return $i(t)*$i(i)>e}function a(t,i,s){var n=[1,0,0],r=ps(ds(t),ds(i)),a=us(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=ps(n,r),u=fs(n,h);gs(u,fs(r,c));var p=d,g=us(u,p),f=us(p,p),m=g*g-f*(us(u,u)-1);if(!(m<0)){var v=Qi(m),_=fs(p,(-g-v)/f);if(gs(_,u),_=cs(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],A=i[1];x0^_[1]<(Wi(_[0]-b)zi^(b<=_[0]&&_[0]<=x)){var T=fs(p,(-g+v)/f);return gs(T,u),[_,cs(T)]}}}function o(e,i){var n=s?t:zi-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Is(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],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?zi:-zi),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||Ms(e,p)||Ms(g,p))&&(g[2]=1),f!==l)c=0,f?(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^f){var v;m&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)))}!f||e&&Ms(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},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=$i(e),o=Zi(e),l=s*i;null==n?(n=e+s*Ni,r=e-l/2):(n=As(a,n),r=As(a,r),(s>0?nr)&&(n+=s*Ni));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 Wi(s[0]-t)0?0:3:Wi(s[0]-i)0?2:1:Wi(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,f,m,v,_,y=a,b=ks(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(A(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&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=Os(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&ws(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&&m)y.point(r,a);else{var l=[g=Math.max(Ns,Math.min(Hs,g)),f=Math.max(Ns,Math.min(Hs,f))],b=[r=Math.max(Ns,Math.min(Hs,r)),a=Math.max(Ns,Math.min(Hs,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):(m||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Us(t){return t}var Ws,Gs,Ys,$s,Xs=Ri(),Ks=Ri(),qs={point:ss,lineStart:ss,lineEnd:ss,polygonStart:function(){qs.lineStart=Zs,qs.lineEnd=tn},polygonEnd:function(){qs.lineStart=qs.lineEnd=qs.point=ss,Xs.add(Wi(Ks)),Ks.reset()},result:function(){var t=Xs/2;return Xs.reset(),t}};function Zs(){qs.point=Js}function Js(t,e){qs.point=Qs,Ws=Ys=t,Gs=$s=e}function Qs(t,e){Ks.add($s*t-Ys*e),Ys=t,$s=e}function tn(){Qs(Ws,Gs)}var en=qs,sn=1/0,nn=sn,rn=-sn,an=rn;var on,ln,hn,cn,dn={point:function(t,e){trn&&(rn=t);ean&&(an=e)},lineStart:ss,lineEnd:ss,polygonStart:ss,polygonEnd:ss,result:function(){var t=[[sn,nn],[rn,an]];return rn=an=-(nn=sn=1/0),t}},un=0,pn=0,gn=0,fn=0,mn=0,vn=0,_n=0,yn=0,bn=0,xn={point:Sn,lineStart:An,lineEnd:Tn,polygonStart:function(){xn.lineStart=wn,xn.lineEnd=Cn},polygonEnd:function(){xn.point=Sn,xn.lineStart=An,xn.lineEnd=Tn},result:function(){var t=bn?[_n/bn,yn/bn]:vn?[fn/vn,mn/vn]:gn?[un/gn,pn/gn]:[NaN,NaN];return un=pn=gn=fn=mn=vn=_n=yn=bn=0,t}};function Sn(t,e){un+=t,pn+=e,++gn}function An(){xn.point=kn}function kn(t,e){xn.point=Mn,Sn(hn=t,cn=e)}function Mn(t,e){var i=t-hn,s=e-cn,n=Qi(i*i+s*s);fn+=n*(hn+t)/2,mn+=n*(cn+e)/2,vn+=n,Sn(hn=t,cn=e)}function Tn(){xn.point=Sn}function wn(){xn.point=En}function Cn(){Bn(on,ln)}function En(t,e){xn.point=Bn,Sn(on=hn=t,ln=cn=e)}function Bn(t,e){var i=t-hn,s=e-cn,n=Qi(i*i+s*s);fn+=n*(hn+t)/2,mn+=n*(cn+e)/2,vn+=n,_n+=(n=cn*t-hn*e)*(hn+t),yn+=n*(cn+e),bn+=3*n,Sn(hn=t,cn=e)}var Pn=xn;function Ln(t){this._context=t}Ln.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,Ni)}},result:ss};var Rn,On,In,Dn,Fn,zn=Ri(),jn={point:ss,lineStart:function(){jn.point=Hn},lineEnd:function(){Rn&&Nn(On,In),jn.point=ss},polygonStart:function(){Rn=!0},polygonEnd:function(){Rn=null},result:function(){var t=+zn;return zn.reset(),t}};function Hn(t,e){jn.point=Nn,On=Dn=t,In=Fn=e}function Nn(t,e){Dn-=t,Fn-=e,zn.add(Qi(Dn*Dn+Fn*Fn)),Dn=t,Fn=e}var Vn=jn;function Un(){this._string=[]}function Wn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Gn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),hs(t,i(s))),s.result()}return r.area=function(t){return hs(t,i(en)),en.result()},r.measure=function(t){return hs(t,i(Vn)),Vn.result()},r.bounds=function(t){return hs(t,i(dn)),dn.result()},r.centroid=function(t){return hs(t,i(Pn)),Pn.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Us):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Un):new Ln(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 Yn(t){return function(e){var i=new $n;for(var s in t)i[s]=t[s];return i.stream=e,i}}function $n(){}function Xn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),hs(i,t.stream(dn)),e(dn.result()),null!=s&&t.clipExtent(s),t}function Kn(t,e,i){return Xn(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 qn(t,e,i){return Kn(t,[[0,0],e],i)}function Zn(t,e,i){return Xn(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 Jn(t,e,i){return Xn(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)}Un.prototype={_radius:4.5,_circle:Wn(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=Wn(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}},$n.prototype={constructor:$n,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 Qn=16,tr=$i(30*Ui);function er(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&f--){var b=a+u,x=o+p,S=l+g,A=Qi(b*b+x*x+S*S),k=is(S/=A),M=Wi(Wi(S)-1)e||Wi((v*E+_*B)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Ui:0,E()):[m*Vi,v*Vi,_*Vi]},w.angle=function(t){return arguments.length?(y=t%360*Ui,E()):y*Vi},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=er(o,T=t*t),B()):Qi(T)},w.fitExtent=function(t,e){return Kn(w,t,e)},w.fitSize=function(t,e){return qn(w,t,e)},w.fitWidth=function(t,e){return Zn(w,t,e)},w.fitHeight=function(t,e){return Jn(w,t,e)},function(){return e=t.apply(this,arguments),w.invert=e.invert&&C,E()}}function or(t){var e=0,i=zi/3,s=ar(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Ui,i=t[1]*Ui):[e*Vi,i*Vi]},n}function lr(t,e){var i=Zi(t),s=(i+Zi(e))/2;if(Wi(s)2?t[2]*Ui:0),e.invert=function(e){return(e=t.invert(e[0]*Ui,e[1]*Ui))[0]*=Vi,e[1]*=Vi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===fr?[[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 vr(t){return ts((ji+t)/2)}function _r(t,e){var i=$i(t),s=t===e?Zi(t):Ki(i/$i(e))/Ki(vr(e)/vr(t)),n=i*qi(vr(t),s)/s;if(!s)return fr;function r(t,e){n>0?e<-ji+Fi&&(e=-ji+Fi):e>ji-Fi&&(e=ji-Fi);var i=n/qi(vr(e),s);return[i*Zi(s*t),n-i*$i(s*t)]}return r.invert=function(t,e){var i=n-e,r=Ji(s)*Qi(t*t+i*i),a=Yi(t,Wi(i))*Ji(i);return i*s<0&&(a-=zi*Ji(t)*Ji(i)),[a/s,2*Gi(qi(n/r,1/s))-ji]},r}function yr(t,e){return[t,e]}function br(t,e){var i=$i(t),s=t===e?Zi(t):(i-$i(e))/(e-t),n=i/s+t;if(Wi(s)Fi&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Er.invert=ur(is),Br.invert=ur((function(t){return 2*Gi(t)})),Pr.invert=function(t,e){return[-e,2*Gi(Xi(t))-ji]};var Or={exports:{}},Ir=function(t,e){this.p1=t,this.p2=e};Ir.prototype.rise=function(){return this.p2[1]-this.p1[1]},Ir.prototype.run=function(){return this.p2[0]-this.p1[0]},Ir.prototype.slope=function(){return this.rise()/this.run()},Ir.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Ir.prototype.isVertical=function(){return!isFinite(this.slope())},Ir.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Ir.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Ir.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Ir.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)},Ir.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Dr=Ir,Fr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Dr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Fr(t.slice(0,s),e),o=Fr(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},zr=Fr;!function(t){var e=zr;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;r{const i=Hr(Ur,e),{tolerance:s}=i;return jr(t,s)};var Gr;!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"}(Gr||(Gr={}));const Yr=(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.sort&&(k(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!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;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,_=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],A=new Set,k=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),A.has(i)||(A.add(i),S.push(i),y(m)?k.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):k.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else _[r][l]+=a;e&&e.includeValues&&!v&&_[r][c].push(t[n]);break}}}let M=0;const T=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=_.length;t0?_[t][l]/M:0,T.push(_[t])}return T},Xr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,_=-1/0;if(e.extent)v=e.extent[0],_=e.extent[1];else for(let e=0;e_&&(_=s))}if(!Number.isFinite(v)||!Number.isFinite(_)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=_;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(_-v>1){const e=Math.floor(v),i=Math.ceil((_-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>_){t=s,m.length=t+1;break}}else{const e=(_-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>_){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",A=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",k=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",M=null!==(d=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==d?d:"percentage",T=y(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],w=y(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],C=w.length?w:void 0,E=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:A,percentageName:M,valuesName:k,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:C});if(!T.length)return $r(t,E);const B={};return t.forEach((t=>{const e=T.map((e=>null==t?void 0:t[e])).join("-&&-");B[e]?B[e].push(t):B[e]=[t]})),Object.values(B).map((t=>{const e=[...w,...T];return $r(t,Object.assign(Object.assign({},E),{groupField:e.length?e:void 0,n:t.length}))})).flat()},Kr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,_;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const A=!!(null==e?void 0:e.includeValues),k=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},M=null!==(n=k.key)&&void 0!==n?n:y(x)?null:null!==(r=x)&&void 0!==r?r:"key",T=null!==(a=k.count)&&void 0!==a?a:"count",w=null!==(o=k.mean)&&void 0!==o?o:"mean",C=null!==(l=k.q1)&&void 0!==l?l:"q1",E=null!==(h=k.median)&&void 0!==h?h:"median",B=null!==(c=k.q3)&&void 0!==c?c:"q3",P=null!==(d=k.iqr)&&void 0!==d?d:"iqr",L=null!==(p=k.min)&&void 0!==p?p:"min",R=null!==(g=k.max)&&void 0!==g?g:"max",O=null!==(f=k.lowerWhisker)&&void 0!==f?f:"lowerWhisker",I=null!==(m=k.upperWhisker)&&void 0!==m?m:"upperWhisker",D=null!==(v=k.outliers)&&void 0!==v?v:"outliers",F=null!==(_=k.values)&&void 0!==_?_:"values",z=new Map,j=new Map,H=new Map,N=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),A&&j.set(r,[]),y(x)?H.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):H.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),A){const t=j.get(r);t&&t.push(i)}}y(S)&&(S=[vt(Math.min.apply(null,S),0,1),vt(Math.max.apply(null,S),0,1)]);const V=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=H.get(t);if(null!==M)f[M]=m;else if(y(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[T]=s,f[w]=o,f[C]=l,f[E]=h,f[B]=c,f[P]=d,f[L]=n,f[R]=r,f[O]=u,f[I]=p,f[D]=g,A&&(f[F]=j.get(t)||[]),V.push(f)}return V};var qr={},Zr={};function Jr(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function Qr(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function ta(t,e){var i=t+"",s=i.length;return s9999?"+"+ta(e,6):ta(e,4))+"-"+ta(t.getUTCMonth()+1,2)+"-"+ta(t.getUTCDate(),2)+(r?"T"+ta(i,2)+":"+ta(s,2)+":"+ta(n,2)+"."+ta(r,3)+"Z":n?"T"+ta(i,2)+":"+ta(s,2)+":"+ta(n,2)+"Z":s||i?"T"+ta(i,2)+":"+ta(s,2)+"Z":"")}function ia(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 Zr;if(h)return h=!1,qr;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(;a0}function pa(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=aa(t));var r=[];switch(t.type){case"GeometryCollection":return ga(t,(function(t){ma(t,s)})),t;case"FeatureCollection":return pa(t,(function(t){pa(ma(t,s),(function(t){r.push(t)}))})),li(r)}return ma(t,s)}function ma(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return ga(t,(function(t){ma(t,e)})),t;case"LineString":return va(da(t),e),t;case"Polygon":return _a(da(t),e),t;case"MultiLineString":return da(t).forEach((function(t){va(t,e)})),t;case"MultiPolygon":return da(t).forEach((function(t){_a(t,e)})),t;case"Point":case"MultiPoint":return t}}function va(t,e){ua(t)===e&&t.reverse()}function _a(t,e){ua(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=ya(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Aa=(t,e={},i)=>{i.type=Gr.GEO;const s=Hr(xa,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Sa(t))})):e.push(Sa(t))})),e})(t);let l=t.features;return o&&(l=fa(t,{reverse:!g(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=ba.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=ba.bounds(t);t.bbox=e}})),t.features=l,t},ka={},Ma=(t,e,i)=>{i.type=Gr.GEO;const s=Hr(xa,ka,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 Rr(a,t)}))}:Rr(a,o));var a,o;return Aa(r,s,i)},Ta=(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 wa=0;function Ca(t="dataset"){return wa>1e8&&(wa=0),t+"_"+wa++}class Ea{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:Ca("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()}}class Ba{constructor(t,e){let i;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=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&U(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Ca("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){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,e=!0){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)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}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,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&U(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof Ba||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!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",Yr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Gn();const Pa={},La={albers:cr,albersusa:function(){var t,e,i,s,n,r,a=cr(),o=hr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=hr().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)}},Ra=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Oa(t,e){return function i(){const s=e();return s.type=t,s.path=Gn().projection(s),s.copy=s.copy||function(){const t=i();return Ra.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Ia{static GenAutoIncrementId(){return Ia.auto_increment_id++}}Ia.auto_increment_id=0;class Da{constructor(t){this.id=Ia.GenAutoIncrementId(),this.registry=t}}const Fa="named",za="inject",ja="multi_inject",Ha="inversify:tagged",Na="inversify:paramtypes";class Va{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===Fa?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var Ua=function(t){var e;return function(t){const e="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),s=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),n=new WeakMap;function r(t,e,i){let r=n.get(t);if(h(r)){if(!i)return;r=new s,n.set(t,r)}let a=r.get(e);if(h(a)){if(!i)return;a=new s,r.set(e,a)}return a}function a(t,e,i){if(o(t,e,i))return!0;const s=f(e);return!c(s)&&a(t,s,i)}function o(t,e,i){const s=r(e,i,!1);return!h(s)&&!!s.has(t)}function l(t,e,i){if(o(t,e,i))return function(t,e,i){const s=r(e,i,!1);if(!h(s))return s.get(t)}(t,e,i);const s=f(e);return c(s)?void 0:l(t,s,i)}function h(t){return void 0===t}function c(t){return null===t}function d(t){return"object"==typeof t?null!==t:"function"==typeof t}function u(t,i){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const s=3===i?"string":5===i?"number":"default",n=function(t,e){const i=t[e];if(null!=i){if(!g(i))throw new TypeError;return i}}(t,e);if(void 0!==n){const e=n.call(t,s);if(d(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.valueOf;if(g(i)){const e=i.call(t);if(!d(e))return e}}else{const e=t.valueOf;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.toString;if(g(i)){const e=i.call(t);if(!d(e))return e}}throw new TypeError}(t,"default"===s?"number":s)}function p(t){const e=u(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function g(t){return"function"==typeof t}function f(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const s=t.prototype,n=s&&Object.getPrototypeOf(s);if(null==n||n===Object.prototype)return e;const r=n.constructor;return"function"!=typeof r||r===t?e:r}t("defineMetadata",(function(t,e,i,s){if(!d(i))throw new TypeError;return n=t,a=e,void r(i,s,!0).set(n,a);var n,a})),t("hasMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),l(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function Wa(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};Ua.hasOwnMetadata(t,e)&&(r=Ua.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,Ua.defineMetadata(t,r,e)}(Ha,t,i.toString(),s)}function Ga(t){return(e,i,s)=>{Wa(e,0,s,t)}}function Ya(t){return e=>(i,s,n)=>Ga(new Va(t,e))(i,s,n)}const $a=Ya(za),Xa=Ya(ja);function Ka(){return function(t){return Ua.defineMetadata(Na,null,t),t}}function qa(t){return Ga(new Va(Fa,t))}const Za="Singleton",Ja="Transient",Qa="ConstantValue",to="DynamicValue",eo="Factory",io="Function",so="Instance",no="Invalid";class ro{constructor(t,e){this.id=Ia.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=no,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new ro(this.serviceIdentifier,this.scope);return t.activated=t.scope===Za&&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 ao{getConstructorMetadata(t){return{compilerGeneratedMetadata:Ua.getMetadata(Na,t),userGeneratedMetadata:Ua.getMetadata(Ha,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const oo=(lo=Fa,t=>{const e=e=>{if(null==e)return!1;if(e.key===lo&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const uo=Symbol("ContributionProvider");class po{constructor(t,e){this.serviceIdentifier=t,this.container=e,fo.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function go(t,e){t(uo).toDynamicValue((({container:t})=>new po(e,t))).inSingletonScope().whenTargetNamed(e)}class fo{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}fo.store=new Map;class mo{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 vo extends mo{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const _o=Symbol.for("EnvContribution"),yo=Symbol.for("VGlobal"),bo=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Ja,this.options=e,this.id=Ia.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new ao}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,Fa,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new ro(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new co(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[za],multiInject:s[ja]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:a,metadata:e,bindings:l};n.push(t)}}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case Qa:case io:e=t.cache;break;case so: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===Za&&(t.cache=e,t.activated=!0)}},xo=Symbol.for("RenderService");const So=new class{get renderService(){return this._renderService||(this._renderService=bo.get(xo)),this._renderService}};let Ao=0;class ko{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=So.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++Ao,t),this.tryRunAnimationFrameNextFrame(),Ao}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class Mo{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var To=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wo=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Co=function(t,e){return function(i,s){e(i,s,t)}},Eo=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 Bo=class extends Mo{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}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){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Ia.GenAutoIncrementId(),this.hooks={onSetEnv:new vo(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}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)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new ko);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}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)}loadFont(t,e,i){return Eo(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}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,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var Po,Lo,Ro,Oo;Bo=To([Ka(),Co(0,$a(uo)),Co(0,qa(_o)),wo("design:paramtypes",[Object])],Bo),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(Po||(Po={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(Lo||(Lo={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(Ro||(Ro={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(Oo||(Oo={}));const Io=Ht-1e-8;class Do{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>Io)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%=Ht)<0&&(s+=Ht),(n%=Ht)<0&&(n+=Ht),nn;++o,a-=jt)g(a);else for(a=s-s%jt+jt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const zo=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,jo={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},Ho={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let No,Vo,Uo,Wo,Go,Yo;var $o,Xo,Ko,qo,Zo,Jo;function Qo(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),f=Math.cos(n),m=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+f,A=i+m,k=S+y*m,M=A-y*f;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 tl(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=ae(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 f=d/i,m=c/i,v=-c/s,_=d/s,y=f*o+m*l,b=v*o+_*l,x=f*t+m*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+=Ht:C>0&&0===r&&(C-=Ht);const E=Math.ceil(Math.abs(C/(jt+.001))),B=[];for(let t=0;te.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 il(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=hl(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function dl(t,e){const{p0:i,p1:s}=t,n=re.pointAtPP(i,s,e);return[new ul(i,n),new ul(n,s)]}class ul extends sl{constructor(t,e){super(),this.type=Zo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return re.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Ut(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?re.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===qo.ROW?Vt(this.p0.x-this.p1.x):t===qo.COLUMN?Vt(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class pl{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new cl(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s),new ne(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new ul(new ne(this._lastX,this._lastY),new ne(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===qo.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Vt(t.p0.y-s.y)}if(t===qo.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Vt(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class gl extends pl{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 fl(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function ml(t,e,i){const s=null!=e?e:Vt(i[i.length-1].x-i[0].x)>Vt(i[i.length-1].y-i[0].y)?qo.ROW:qo.COLUMN;return"monotoneY"===t?new gl(t,s):new pl(t,s)}class vl{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 _l(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=ml("linear",i,t);return function(t,e){fl(t,e,1)}(new vl(n,s),t),n}function yl(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 bl{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&&yl(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:yl(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 xl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return _l(t,e);const n=ml("basis",i,t);return function(t,e){fl(t,e,2)}(new bl(n,s),t),n}function Sl(t){return t<0?-1:1}function Al(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(Sl(r)+Sl(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function kl(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Ml(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:Ml(this,this._t0,kl(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,Ml(this,kl(this,e=Al(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Ml(this,this._t0,e=Al(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 wl extends Tl{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Cl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return _l(t,e);const n=ml("monotoneX",i,t);return function(t,e){fl(t,e,2)}(new Tl(n,s),t),n}function El(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return _l(t,e);const n=ml("monotoneY",i,t);return function(t,e){fl(t,e,2)}(new wl(n,s),t),n}let Bl=class{constructor(t,e=.5,i){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;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):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()}};class Pl extends Bl{lineEnd(){this.context.closePath()}}function Ll(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new pl("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?qo.ROW:qo.COLUMN);return Rl(new Bl(r,e,n),t),r}function Rl(t,e){return fl(t,e,1)}class Ol extends vl{lineEnd(){this.context.closePath()}}function Il(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=ml("linear",i,t);return function(t,e){fl(t,e,1)}(new Ol(n,s),t),n}function Dl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Ft){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>Ft){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function Fl(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return _l(i,n);const o=ml(t,r,i);return fl(new e(o,s,a),i,2),o}}const zl=Fl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:Dl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const jl=Fl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:Dl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class Hl extends sl{constructor(t,e,i){super(),this.type=Zo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return ll(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,nl([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===qo.ROW?Vt(this.p0.x-this.p2.x):t===qo.COLUMN?Vt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Gt(t-.01,0),i=Yt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Ut(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=ll(i,s,n,e),a=re.pointAtPP(i,s,e),o=re.pointAtPP(s,n,e);return[new Hl(i,a,r),new Hl(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Nl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new ul(new ne(this._lastX,this._lastY),new ne(t,e))}quadraticCurveTo(t,e,i,s){const n=new Hl(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new cl(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s),new ne(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Vl(t,e,i){var s,n;switch(e){case"linear":default:return _l(t,i);case"basis":return xl(t,i);case"monotoneX":return Cl(t,i);case"monotoneY":return El(t,i);case"step":return Ll(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new pl("step",null!=s?s:Vt(t[t.length-1].x-t[0].x)>Vt(t[t.length-1].y-t[0].y)?qo.ROW:qo.COLUMN);return Rl(new Pl(r,e,n),t),r}(t,.5,i);case"stepBefore":return Ll(t,0,i);case"stepAfter":return Ll(t,1,i);case"catmullRom":return zl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return jl(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return Il(t,i)}}class Ul extends Fo{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Do(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([Ho.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([Ho.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([Ho.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([Ho.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([Ho.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([Ho.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([Ho.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([Ho.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([Ho.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()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Nl(this);il(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[Ho.M]=t=>`M${t[1]} ${t[2]}`,t[Ho.L]=t=>`L${t[1]} ${t[2]}`,t[Ho.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[Ho.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[Ho.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3];((t,e,i,s,n,r,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;e`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[Ho.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,e=Uo;for(let s=1,r=i.length;s{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,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),il(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===qo.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.y-e.p1.y)}if(this.direction===qo.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Vt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{at.getInstance().warn("空函数")}}),oh=Object.assign(Object.assign({},Ql),{points:[],cornerRadius:0,closePath:!0}),lh=Object.assign(Object.assign({},Ql),{width:100,height:100,spikes:5,thickness:.5}),hh=Object.assign(Object.assign({},Ql),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},Ql),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const ch=Object.assign(Object.assign({},Ql),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),dh=Object.assign(Object.assign(Object.assign({},Ql),ql),{strokeBoundsBuffer:0,keepDirIn3d:!0}),uh=Object.assign(Object.assign(Object.assign({},Ql),ql),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",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}),ph=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0,maxWidth:500,maxHeight:500},Ql),{fill:!0,cornerRadius:0,cornerType:"round"}),gh=Object.assign(Object.assign({},ph),{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}),fh=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 m("directional",t.sideOrCorner,1)||m("angular",t.angleValue,1)}function a(){return m("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=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 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=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 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 mh{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(mh.IsGradientStr(t))try{const e=fh(t)[0];if(e){if("linear"===e.type)return mh.ParseLinear(e);if("radial"===e.type)return mh.ParseRadial(e);if("conic"===e.type)return mh.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=zt/2,n=parseFloat(e.value)/180*zt-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Nt,stops:mh.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:mh.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=zt/2;let n="angular"===e.type?parseFloat(e.value)/180*zt:0;for(;n<0;)n+=Nt;for(;n>=Nt;)n-=Nt;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}const yh={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"}},bh=!0,xh=!1,Sh=/\w|\(|\)|-/,Ah=/[.?!,;:/,。?!、;:]/,kh=/\S/,Mh=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function Th(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=So.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=wh(t,a)),a}function wh(t,e,i=!1){let s=e;for(;Sh.test(t[s-1])&&Sh.test(t[s])||Ah.test(t[s]);)if(s--,s<=0)return i?Ch(t,e):e;return s}function Ch(t,e){let i=e;for(;Sh.test(t[i+1])&&Sh.test(t[i])||Ah.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Eh(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=So.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}var Bh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Ph=class{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=dh.fontSize}){let i=0,s=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 a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=wh(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_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){if(s===n){at.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}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),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);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}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,a=!1){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=wh(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}};Ph=Bh([Ka()],Ph);var Lh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Rh=Symbol.for("TextMeasureContribution");let Oh=class extends Ph{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}};Oh=Lh([Ka()],Oh);const Ih=Symbol.for("CanvasFactory"),Dh=Symbol.for("Context2dFactory");function Fh(t){return bo.getNamed(Ih,So.global.env)(t)}const zh=1e-4,jh=Math.sqrt(3),Hh=1/3;function Nh(t){return t>-tc&&ttc||t<-tc}const Uh=[0,0],Wh=[0,0],Gh=[0,0];function Yh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function $h(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function Xh(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 Kh(t){return(t%=Nt)<0&&(t+=Nt),t}function qh(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+=Nt);let d=Math.atan2(l,o);return d<0&&(d+=Nt),d>=s&&d<=n||d+Nt>=s&&d+Nt<=n}function Qh(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(Nh(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 ic=[-1,-1,-1],sc=[-1,-1];function nc(){const t=sc[0];sc[0]=sc[1],sc[1]=t}function rc(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(Nh(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,Hh):Math.pow(i,Hh),s=s<0?-Math.pow(-s,Hh):Math.pow(s,Hh);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+jh*Math.sin(e)))/(3*a),h=(-o+i*(s-jh*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,ic);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&nc(),p=Xh(e,s,r,o,sc[0]),u>1&&(g=Xh(e,s,r,o,sc[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Nh(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,ic);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=$h(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);ic[0]=-l,ic[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Nt-1e-4){s=0,n=Nt;const e=r?1:-1;return a>=ic[0]+t&&a<=ic[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Nt,n+=Nt);let c=0;for(let e=0;e<2;e++){const i=ic[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Nt+t),(t>=s&&t<=n||t+Nt>=s&&t+Nt<=n)&&(t>zt/2&&t<1.5*zt&&(e=-e),c+=e)}}return c}function lc(t){return Math.round(t/zt*1e8)/1e8%2*zt}function hc(t,e){let i=lc(t[0]);i<0&&(i+=Nt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Nt?n=i+Nt:e&&i-n>=Nt?n=i-Nt:!e&&i>n?n=i+(Nt-lc(i-n)):e&&i1&&(i||(h+=Le(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],v=a[2],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,A=b;cc[0]=S,cc[1]=A,hc(cc,Boolean(a[6])),S=cc[0],A=cc[1];const k=S,M=A-S,T=!!(1-(a[6]?0:1)),w=(s-m)*_/_+m;switch(f){case Ho.M:u=m,p=v,c=u,d=p;break;case Ho.L:if(i){if(Qh(c,d,m,v,e,s,n))return!0}else h+=Le(c,d,m,v,s,n)||0;c=m,d=v;break;case Ho.C:if(i){if(Zh(c,d,m,v,_,y,b,x,e,s,n))return!0}else h+=rc(c,d,m,v,_,y,b,x,s,n)||0;c=b,d=x;break;case Ho.Q:if(i){if(qh(c,d,m,v,_,y,e,s,n))return!0}else h+=ac(c,d,m,v,_,y,s,n)||0;c=_,d=y;break;case Ho.A:if(o=Math.cos(k)*_+m,l=Math.sin(k)*_+v,g?(u=o,p=l):h+=Le(c,d,o,l,s,n),i){if(Jh(m,v,_,k,k+M,T,e,w,n))return!0}else h+=oc(m,v,_,k,k+M,T,w,n);c=Math.cos(k+M)*_+m,d=Math.sin(k+M)*_+v;break;case Ho.R:if(u=c=m,p=d=v,o=u+_,l=p+y,i){if(Qh(u,p,o,p,e,s,n)||Qh(o,p,o,l,e,s,n)||Qh(o,l,u,l,e,s,n)||Qh(u,l,u,p,e,s,n))return!0}else h+=Le(o,p,o,l,s,n),h+=Le(u,l,u,p,s,n);break;case Ho.Z:if(i){if(Qh(c,d,u,p,e,s,n))return!0}else h+=Le(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},gc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const fc=Symbol.for("VWindow"),mc=Symbol.for("WindowHandlerContribution");let vc=class extends Mo{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(){super(),this.hooks={onChange:new vo(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(bo.getNamed(mc,t.env).configure(this,t),this.actived=!0)},this._uid=Ia.GenAutoIncrementId(),this.global=So.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}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.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}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&&pt(this.width,t.width())&&pt(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)}};vc=pc([Ka(),gc("design:paramtypes",[])],vc);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},yc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bc=function(t,e){return function(i,s){e(i,s,t)}};let xc=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=So.global,this._textMeasureMap=new Map,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}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||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=uc.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="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:ql.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new De(Object.assign({defaultFontParams:{fontFamily:ql.fontFamily,fontSize:ql.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+De.ALPHABET_CHAR_SET+De.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=bo.get(fc),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 Sc;xc=_c([Ka(),bc(0,$a(uo)),bc(0,qa(Rh)),yc("design:paramtypes",[Object])],xc),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Sc||(Sc={}));const Ac=new Ue;let kc=class{constructor(){this.matrix=new Ue}init(t){return this.mode=Sc.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Sc.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Ac.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(Ac.a,Ac.b,Ac.c,Ac.d,Ac.e,Ac.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Ac.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(Ac.a,Ac.b,Ac.c,Ac.d,Ac.e,Ac.f),this}scale(t,e,i){return this.mode===Sc.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Sc.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Ac.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Ac.a,Ac.b,Ac.c,Ac.d,Ac.e,Ac.f),this}translate(t,e){return this.mode===Sc.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Sc.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};kc=_c([Ka(),yc("design:paramtypes",[])],kc);const Mc={arc:th,area:eh,circle:ih,line:rh,path:ah,symbol:ch,text:dh,rect:hh,polygon:oh,star:lh,richtext:uh,richtextIcon:gh,image:ph,group:sh,glyph:nh},Tc=Object.keys(Mc);function wc(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Cc={arc:Object.assign({},Mc.arc),area:Object.assign({},Mc.area),circle:Object.assign({},Mc.circle),line:Object.assign({},Mc.line),path:Object.assign({},Mc.path),symbol:Object.assign({},Mc.symbol),text:Object.assign({},Mc.text),rect:Object.assign({},Mc.rect),polygon:Object.assign({},Mc.polygon),star:Object.assign({},Mc.star),richtext:Object.assign({},Mc.richtext),richtextIcon:Object.assign({},Mc.richtextIcon),image:Object.assign({},Mc.image),group:Object.assign({},Mc.group),glyph:Object.assign({},Mc.glyph)};class Ec{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Tc.forEach((t=>{this._defaultTheme[t]=Object.create(Cc[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,i=!1){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;Tc.forEach((s=>{const n=Object.create(Cc[s]);t&&t[s]&&wc(n,t[s]),i[s]&&wc(n,i[s]),e[s]&&wc(n,e[s]),this.combinedTheme[s]=n})),e.common&&Tc.forEach((t=>{wc(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 Bc=new Ec;function Pc(t,e){return t.glyphHost?Pc(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)):Bc.getTheme()}return null}(t)||t.attachedThemeGraphic&&Pc(t.attachedThemeGraphic)||Bc.getTheme()}var Lc=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 Rc 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=Ia.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){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,e=!1){return Lc(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,e=!0){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,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)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===t||t===e)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===t)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,e=!1){let 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,e=!1){let 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,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Dc))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(Hc(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 Dc))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=Hc(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 Dc))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=Hc(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 Dc))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=Hc(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 Dc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=jc.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Hc(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(Hc(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,Hc(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(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 Dc))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"):Hc(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 Fc))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=jc.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.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),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,supportsTouchEvents:o}),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 Dc,this.rootWheelEvent=new Fc,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.addEventListener("pointermove",this.onPointerMove,!0),t.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.addEventListener("mousemove",this.onPointerMove,!0),t.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.removeEventListener("pointermove",this.onPointerMove,!0),t.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.removeEventListener("mousemove",this.onPointerMove,!0),t.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 Gc{static GetImage(t,e){var i;const s=Gc.cache.get(t);s?"fail"===s.loadState?So.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):Gc.loadImage(t,e)}static GetSvg(t,e){var i;let s=Gc.cache.get(t);s?"fail"===s.loadState?So.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"},Gc.cache.set(t,s),s.dataPromise=So.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.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Gc.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Gc.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=So.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=So.global.loadBlob(t):"json"===e&&(i.dataPromise=So.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Gc.isLoading&&Gc.toLoadAueue.length){Gc.isLoading=!0;const t=Gc.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Gc.cache.set(i,n),n.dataPromise=So.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))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Gc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Gc.loading()})).catch((t=>{console.error(t),Gc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Gc.loading()}))}}),0)}static loadImage(t,e){const i=Yc(t,Gc.toLoadAueue);if(-1!==i)return Gc.toLoadAueue[i].marks.push(e),void Gc.loading();Gc.toLoadAueue.push({url:t,marks:[e]}),Gc.loading()}static improveImageLoading(t){const e=Yc(t,Gc.toLoadAueue);if(-1!==e){const t=Gc.toLoadAueue.splice(e,1);Gc.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Yc(t,e){for(let i=0;it?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Kc[0]=t[0],Kc[2]=t[0],Kc[1]=t[1],Kc[3]=t[1],Kc):t:t:0,Zc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Jc=[1,2,3,0,1,2,3,0];function Qc(t,e,i,s){for(;t>=Nt;)t-=Nt;for(;t<0;)t+=Nt;for(;t>e;)e+=Nt;Zc[0].x=i,Zc[1].y=i,Zc[2].x=-i,Zc[3].y=-i;const n=Math.ceil(t/jt)%4,r=Math.ceil(e/jt)%4;if(s.add(Wt(t)*i,$t(t)*i),s.add(Wt(e)*i,$t(e)*i),n!==r||e-t>zt){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new ne(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new ne(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{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)}}sd.TimeOut=1e3/60;const nd=new sd,rd=(t,e)=>{const i=((t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};class ad{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}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function od(t,e,i,s,n){return n?t.arc(i,s,e,0,Ht,!1,n):t.arc(i,s,e,0,Ht),!1}var ld=new class extends ad{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 od(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return od(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(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 hd=new class extends ad{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,this.parseSize(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,this.parseSize(e)/6,i,s,n,r)}};function cd(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 dd=new class extends ad{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 cd(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return cd(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return cd(t,this.parseSize(e)/2+n,i,s,r)}};function ud(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var pd=new class extends ad{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return ud(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return ud(t,this.parseSize(e)/2+n,i,s)}};function gd(t,e,i,s,n=0){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}class fd extends ad{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 gd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return gd(t,this.parseSize(e)/2,i,s,n)}}var md=new fd;var vd=new class extends fd{constructor(){super(...arguments),this.type="triangle"}};const _d=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),yd=Math.sin(Ht/10)*_d,bd=-Math.cos(Ht/10)*_d;function xd(t,e,i,s){const n=yd*e,r=bd*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Ht*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 Sd=new class extends ad{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 xd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return xd(t,this.parseSize(e)/2+n,i,s)}};const Ad=Xt(3);function kd(t,e,i,s){const n=e,r=n/Ad,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 Md=new class extends ad{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 kd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return kd(t,this.parseSize(e)/2+n,i,s)}};function Td(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 wd=new class extends ad{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Td(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Td(t,this.parseSize(e)/2+n,i,s)}};function Cd(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Ed=new class extends ad{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Cd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Cd(t,this.parseSize(e)/2+n,i,s)}};const Bd=-.5,Pd=Xt(3)/2,Ld=1/Xt(12);function Rd(t,e,i,s){const n=e/2,r=e*Ld,a=n,o=e*Ld+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(Bd*n-Pd*r+i,Pd*n+Bd*r+s),t.lineTo(Bd*a-Pd*o+i,Pd*a+Bd*o+s),t.lineTo(Bd*l-Pd*h+i,Pd*l+Bd*h+s),t.lineTo(Bd*n+Pd*r+i,Bd*r-Pd*n+s),t.lineTo(Bd*a+Pd*o+i,Bd*o-Pd*a+s),t.lineTo(Bd*l+Pd*h+i,Bd*h-Pd*l+s),t.closePath(),!1}var Od=new class extends ad{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 Rd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Rd(t,this.parseSize(e)/2+n,i,s)}};function Id(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}var Dd=new class extends ad{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 Id(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Id(t,this.parseSize(e)/2,i,s,n)}};function Fd(t,e,i,s,n=0){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}var zd=new class extends ad{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 Fd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Fd(t,this.parseSize(e)/2,i,s,n)}};function jd(t,e,i,s,n=0){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}var Hd=new class extends ad{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 jd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return jd(t,this.parseSize(e)/2,i,s,n)}};const Nd=Xt(3);function Vd(t,e,i,s){const n=e*Nd;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var Ud=new class extends ad{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Vd(t,this.parseSize(e)/2/Nd,i,s)}drawOffset(t,e,i,s,n){return Vd(t,this.parseSize(e)/2/Nd+n,i,s)}};function Wd(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 Gd=new class extends ad{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 Wd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Wd(t,this.parseSize(e)/4+n,i,s)}};function Yd(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 $d=new class extends ad{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 Yd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Yd(t,this.parseSize(e)/4+n,i,s)}};function Xd(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 Kd=new class extends ad{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 Xd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Xd(t,this.parseSize(e)/4+n,i,s)}};function qd(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 Zd=new class extends ad{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 qd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return qd(t,this.parseSize(e)/4+n,i,s)}};function Jd(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var Qd=new class extends ad{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return Jd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Jd(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function tu(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var eu=new class extends ad{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return tu(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return tu(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function iu(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 su=new class extends ad{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 iu(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return iu(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function nu(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function ru(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var au=new class extends ad{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)?ru(t,e,i,s):nu(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?ru(t,e+2*n,i,s):nu(t,[e[0]+2*n,e[1]+2*n],i,s)}};const ou=new Ne;class lu{constructor(t,e,i=!1){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 e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),il(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(il(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{ou.x1=i.bounds.x1*t,ou.y1=i.bounds.y1*t,ou.x2=i.bounds.x2*t,ou.y2=i.bounds.y2*t,e.union(ou)}))}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 hu={};[ld,hd,dd,pd,Ud,vd,Sd,Md,wd,Ed,Od,Dd,zd,md,Hd,Gd,$d,Kd,Zd,au,Qd,eu,su].forEach((t=>{hu[t.type]=t}));const cu={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"};class du{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 uu(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function pu(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",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=pu(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=uu(t,"--\x3e",r+4,"Comment is not closed.");else{const a=pu(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 du(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 du(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 mu(t,e){return vu(t)}function vu(t,e){const i={};for(let e=0;eTu.set(t,!0)));const wu=new Map;function Cu(t){if(Tu.has(t))return!0;if(wu.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>wu.set(t,!0)));const Eu=ku(),Bu=ku(),Pu=ku(),Lu=ku(),Ru=ku(),Ou=ku(),Iu=ku(),Du=ku(),Fu=ku(),zu=ku();ku();const ju=ku();ku();const Hu=ku();ku();const Nu=ku(),Vu=ku(),Uu=Symbol.for("GraphicService"),Wu=Symbol.for("GraphicCreator"),Gu={"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"},Yu=Object.keys(Gu),$u={duration:200,easing:"cubicOut"};function Xu(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}function Ku(t,e,i){const s=i[0],n=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]*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],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*s+c*n+g*r+e[12],t[13]=o*s+d*n+f*r+e[13],t[14]=l*s+u*n+m*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function qu(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 Zu(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],f=e[12],m=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*f,t[1]=y*n+b*l+x*u+S*m,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*f,t[5]=y*n+b*l+x*u+S*m,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*f,t[9]=y*n+b*l+x*u+S*m,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*f,t[13]=y*n+b*l+x*u+S*m,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function Ju(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 Qu{constructor(){this.pools=[]}static identity(t){return Xu(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 Qu.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},sp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const np=new Ue(1,0,0,1,0,0),rp={x:0,y:0};let ap=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new Ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ue(1,0,0,1,0,0),this.path=new Ul,this._clearMatrix=new Ue(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return tp.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ue(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(tp.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(tp.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){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,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=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(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){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},rp),function(t,e,i){return dc(t,0,!1,e,i)}(this.path.commandList,rp.x,rp.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},rp);const i=vh(this,this.lineWidth,this.dpr);return function(t,e,i,s){return dc(t,e,!0,i,s)}(this.path.commandList,i,rp.x,rp.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(t=!0,e=this.dpr){this.setTransformFromMatrix(np,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>tp.free(t))),this.stack.length=0}};ap=ip([Ka(),sp("design:paramtypes",[Object,Number])],ap);const op={WIDTH:500,HEIGHT:500,DPR:1};class lp{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}set nativeCanvas(t){this._nativeCanvas=t}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=op.WIDTH,height:n=op.HEIGHT,dpr:r=op.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(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var hp;lp.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(hp||(hp={}));class cp{static Get(t,e=hp.Color1,i=[0,0,0,1]){if(e===hp.Color1){const e=cp.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ei.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];cp.store1[t]=e,cp.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=cp.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ei.parseColorString(t);return n&&(cp.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],cp.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===hp.Color1){if(cp.store1[t])return;cp.store1[t]=i,cp.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(cp.store255[t])return;cp.store255[t]=i,cp.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function dp(t,e=!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 up(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)=>{var a,o;return pp(y(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,y(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):pp(t,e,i,s,n)}function pp(t,e,i,s,n){if(!t||!e)return t&&dp(t)||e&&dp(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=cp.Get(t,hp.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=cp.Get(e,hp.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:dp(a)})))});return o?up(r,l,i,s,n):up(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:vp(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:vp(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:vp(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),dp(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)}function gp(t,e,i){return`rgba(${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})`}cp.store255={},cp.store1={};const fp=[0,0,0,0],mp=[0,0,0,0];function vp(t,e,i){return cp.Get(t,hp.Color255,fp),cp.Get(e,hp.Color255,mp),`rgba(${Math.round(fp[0]+(mp[0]-fp[0])*i)},${Math.round(fp[1]+(mp[1]-fp[1])*i)},${Math.round(fp[2]+(mp[2]-fp[2])*i)},${fp[3]+(mp[3]-fp[3])*i})`}class _p{static GetCanvas(){try{return _p.canvas||(_p.canvas=So.global.createCanvas({})),_p.canvas}catch(t){return null}}static GetCtx(){if(!_p.ctx){const t=_p.GetCanvas();_p.ctx=t.getContext("2d")}return _p.ctx}}class yp extends We{static getInstance(){return yp._instance||(yp._instance=new yp),yp._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=_p.GetCanvas(),s=_p.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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new yp(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class bp{static GetSize(t){for(let e=0;e=t)return bp.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=bp.GenKey(t,e,i,s,n),l=bp.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=bp.GenKey(t,e,i,s,n);bp.cache[l]?bp.cache[l].push({width:a,height:o,pattern:r}):bp.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}bp.cache={},bp.ImageSize=[20,40,80,160,320,640,1280,2560];const xp=new Ne,Sp=new Ue;new Ne;const Ap=["lineWidth","scaleX","scaleY","angle","anchor","visible"],kp=["x","y"],Mp=["scaleX","scaleY"],Tp=["angle"],wp=new ne,Cp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Ep extends Rc{static mixin(t){const e=Object.keys(t);for(let i=0;i10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=hu[t];if(e)return e;if(e=Ep.userSymbolMap[t],e)return e;if(!0===((i=t=cu[t]||t).startsWith("{const e=(new Ul).fromString(t.d),i={};Yu.forEach((e=>{t[e]&&(i[Gu[e]]=t[e])})),n.push({path:e,attribute:i}),xp.union(e.bounds)}));const r=xp.width(),a=xp.height(),o=1/Gt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new lu(t,n,!0);return Ep.userSymbolMap[t]=l,l}var i;const s=(new Ul).fromString(t),n=s.bounds.width(),r=s.bounds.height(),a=1/Gt(n,r);s.transform(0,0,a,a);const o=new lu(t,s);return Ep.userSymbolMap[t]=o,o}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,s=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:n=e.boundsPadding}=i,r=qc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new Do(t);return il(e.commandList,i,0,0),!0}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(t=!0){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(t=!0){return this._transMatrix||(this._transMatrix=new Ue),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&$o.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&$o.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&$o.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&$o.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&$o.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&$o.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=$o.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===Xo.GLOBAL){const i=new ne(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){this.setAttributes(t,e,i),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||s)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,i){t&&((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,e=!1,i){const s=Object.keys(t);for(let e=0;e{i[e]?(o||(o={}),o[e]=t[e]):a[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(r=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==r?r:$u;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:a,duration:l.duration,easing:l.easing}}]),o&&this.setAttributesAndPreventAnimate(o,!1,{type:Ko.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t)}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:Ko.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{type:Ko.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(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,i;const s=this.attribute[t];return this.animates&&this.animates.size?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=s?s:null===(i=this.finalAttribute)||void 0===i?void 0:i[t]}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){const i=y(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);s.length!==this.currentStates.length&&this.useStates(s,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;this.stateSort&&(t=t.sort(this.stateSort));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|=$o.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=$o.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=$o.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&$o.UPDATE_SHAPE_AND_BOUNDS)===$o.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=$o.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=$o.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=$o.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=$o.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=$o.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=$o.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=$o.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&$o.UPDATE_LAYOUT)}getAnchor(t,e,i){const s=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Yl.x,y:e=Yl.y,scaleX:i=Yl.scaleX,scaleY:s=Yl.scaleY,angle:n=Yl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(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=Wt(a),f=$t(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const _=m-i,y=v-s,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,A=d*g-h*f;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*A,t.e=u+l*m+c*v-b*_-S*y,t.f=p+h*m+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,!0),So.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Yl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Sp.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.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:Ko.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:So.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),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 Ul).fromString(t):this.pathProxy=new Ul,this.pathProxy}loadImage(t,e=!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(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",this.stopAnimates(),So.graphicService.onRelease(this),super.release()}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new zc(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)}}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||So.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new ap(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}var Bp;Ep.userSymbolMap={},Ep.mixin(Vc),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Bp||(Bp={}));let Pp=class t extends Ep{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Ou,this._childUpdateTag=$o.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 Ec),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Ec)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===Xo.GLOBAL){const i=new ne(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&$o.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Yl.x,y:e=Yl.y,dx:i=Yl.dx,dy:s=Yl.dy,scaleX:n=Yl.scaleX,scaleY:r=Yl.scaleY,angle:a=Yl.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()}getGraphicTheme(){return Pc(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return So.graphicService.updateTempAABBBounds(i),So.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=$o.CLEAR_BOUNDS,this._childUpdateTag&=$o.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=$o.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&$o.UPDATE_BOUNDS||(this._childUpdateTag|=$o.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(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().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),this.getGraphicService().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(t=!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&$o.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=So.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}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}};function Lp(t){return new Pp(t)}Pp.NOWORK_ANIMATE_ATTR=Cp;class Rp extends Pp{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 Ec,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!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=>{So.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=>{So.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 Op=Symbol.for("TransformUtil"),Ip=Symbol.for("GraphicUtil"),Dp=Symbol.for("LayerService"),Fp=Symbol.for("StaticLayerHandlerContribution"),zp=Symbol.for("DynamicLayerHandlerContribution"),jp=Symbol.for("VirtualLayerHandlerContribution");var Hp,Np=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Up=Hp=class{static GenerateLayerId(){return`${Hp.idprefix}_${Hp.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=So.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?bo.get(Fp):"dynamic"===t?bo.get(zp):bo.get(jp),e}createLayer(t,e={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 Rp(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Hp.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)}};Up.idprefix="visactor_layer",Up.prefix_count=0,Up=Hp=Np([Ka(),Vp("design:paramtypes",[])],Up);var Wp=new Da((t=>{t(yo).to(Bo).inSingletonScope(),t(fc).to(vc),t(Ip).to(xc).inSingletonScope(),t(Op).to(kc).inSingletonScope(),t(Dp).to(Up).inSingletonScope()}));function Gp(t,e){return!(!t&&!e)}function Yp(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function $p(t,e,i){return i&&t*e>0}function Xp(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Kp(t,e){return t*e>0}function qp(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Zp(t,e,i,s,n,r,a){const o=t-i,l=e-s,h=(a?r:-r)/Math.sqrt(o*o+l*l),c=h*l,d=-h*o,u=t+c,p=e+d,g=i+c,f=s+d,m=(u+g)/2,v=(p+f)/2,_=g-u,y=f-p,b=_*_+y*y,x=n-r,S=u*f-g*p,A=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let k=(S*y-_*A)/b,M=(-S*_-y*A)/b;const T=(S*y+_*A)/b,w=(-S*_+y*A)/b,C=k-m,E=M-v,B=T-m,P=w-v;return C*C+E*E>B*B+P*P&&(k=T,M=w),{cx:k,cy:M,x01:-c,y01:-d,x11:k*(n/x-1),y11:M*(n/x-1)}}function Jp(t,e,i,s,n){const r=Vt(i-e),a=t.getParsedCornerRadius(),o=y(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,_=Math.max(f,g),b=Math.max(m,v);let x=_,S=b;const A=n*Wt(c),k=n*$t(c),M=s*Wt(u),T=s*$t(u);let w,C,E,B;if((b>Ft||_>Ft)&&(w=n*Wt(d),C=n*$t(d),E=s*Wt(p),B=s*$t(p),r1?0:P<-1?zt:Math.acos(P))/2),l=Xt(t[0]*t[0]+t[1]*t[1]);S=Yt(b,(s-l)/(o-1)),x=Yt(_,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:E,yirs:B,xore:w,yore:C,xire:M,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:_,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function Qp(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Vt(l-o),c=l>o;let d=!1;if(n=Nt-Ft)e.moveTo(i+n*Wt(o),s+n*$t(o)),e.arc(i,s,n,o,l,!c),r>Ft&&(e.moveTo(i+r*Wt(l),s+r*$t(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:M,limitedIcr:T,innerDeltaAngle:w,innerEndAngle:C,innerStartAngle:E,innerCornerRadiusStart:B,innerCornerRadiusEnd:P,maxInnerCornerRadius:L}=Jp(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>Ft){const t=Yt(v,m),r=Yt(_,m),o=Zp(g,f,u,p,n,t,Number(c)),l=Zp(b,x,S,A,n,r,Number(c));m0&&e.arc(i+o.cx,s+o.cy,t,Ut(o.y01,o.x01),Ut(o.y11,o.x11),!c),e.arc(i,s,n,Ut(o.cy+o.y11,o.cx+o.x11),Ut(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Ut(l.y11,l.x11),Ut(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Wt(Ut(l.y01,l.x01)),s+l.cy+r*$t(Ut(l.y01,l.x01))):e.moveTo(i+b,s+n*$t(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,M,!c)):e.moveTo(i+n*Wt(M),s+n*$t(M));if(!(r>Ft)||w<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(T>Ft){const t=Yt(B,T),n=Yt(P,T),o=Zp(S,A,b,x,r,-n,Number(c)),l=Zp(u,p,g,f,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,Ut(o.y01,o.x01),Ut(o.y11,o.x11),!c),e.arc(i,s,r,Ut(o.cy+o.y11,o.cx+o.x11),Ut(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Ut(l.y11,l.x11),Ut(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Wt(Ut(l.y01,l.x01)),s+l.cy+t*$t(Ut(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),!a||a[2]?e.arc(i,s,r,C,E,c):e.moveTo(i+r*Wt(E),s+r*$t(E))}return a?a[3]&&e.lineTo(i+n*Wt(o),s+n*$t(o)):e.closePath(),d}const tg=Symbol.for("ArcRenderContribution"),eg=Symbol.for("AreaRenderContribution"),ig=Symbol.for("CircleRenderContribution"),sg=Symbol.for("GroupRenderContribution"),ng=Symbol.for("ImageRenderContribution"),rg=Symbol.for("PathRenderContribution"),ag=Symbol.for("PolygonRenderContribution"),og=Symbol.for("RectRenderContribution"),lg=Symbol.for("SymbolRenderContribution"),hg=Symbol.for("TextRenderContribution"),cg=Symbol.for("InteractiveSubRenderContribution");function dg(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function ug(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}var pg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fg=function(t,e){return function(i,s){e(i,s,t)}};function mg(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:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:v}=e.attribute,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(s=m[2])&&void 0!==s?s:0}if(Xu(t),Ku(t,t,[n+o,r+l,a+h]),Ku(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),Ku(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]),f){const i=ep.allocate(),s=[0,0];if(v){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=m[1]}Ku(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,f),Ku(i,i,[-s[0],-s[1],0]),Zu(t,t,i)}}let vg=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new vo(["graphic"]),onSetStage:new vo(["graphic","stage"]),onRemove:new vo(["graphic"]),onRelease:new vo(["graphic"]),onAddIncremental:new vo(["graphic","group","stage"]),onClearIncremental:new vo(["graphic","group","stage"]),beforeUpdateAABBBounds:new vo(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new vo(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new vo(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ne,this.tempAABBBounds2=new Ne}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)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new Do(t);return il(i.commandList,s,0,0),!0}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=ug(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=dg(n,e);i.set(s,i.y1,s+e,i.y2)}}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){Su(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;Su(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&&je(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};vg=pg([Ka(),fg(0,$a(Wu)),gg("design:paramtypes",[Object])],vg);const _g=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},yg=["radius","startAngle","endAngle",...Ap];class bg extends Ep{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=Lu}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)}getGraphicTheme(){return Pc(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=So.graphicService.updateTempAABBBounds(i);return _g(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,So.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Nt-Ft?i.set(-r,-r,r,r):Qc(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,yg)}needUpdateTag(t){return super.needUpdateTag(t,yg)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Ul,s.arc(0,0,r,a,o),s}clone(){return new bg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return bg.NOWORK_ANIMATE_ATTR}}function xg(t){return new bg(t)}bg.NOWORK_ANIMATE_ATTR=Cp;class Sg{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Po.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,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;a{t+=e.str})),(Array.isArray(r)?r.join(""):r).toString()!==t}return"vertical"===s.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==s.text.toString():null!=this.clipedText&&this.clipedText!==s.text.toString()}get multilineLayout(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),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}getGraphicTheme(){return Pc(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new kg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Me(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=So.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Su(n,o/Math.abs(r+a),!0,l),i.union(n)}return So.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||So.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,je(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:_=s.ignoreBuf,keepCenterInLine:y=s.keepCenterInLine}=n,b=_?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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(f/2),this._AABBBounds}const S=So.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new Sg(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:y}),{bbox:k}=A;return this.cache.layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{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,measureMode:v=r.measureMode,suffixPosition:_=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),k=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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 M=So.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),T={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:k},w=new Sg(a,T,M),C=y(t)?t.map((t=>t.toString())):[t.toString()],E=[],B=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/k),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),B[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Gt(e,a)}));const t=dg(_,a),e=this.cache.verticalList.length*v,i=ug(y,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>function(t){const e=[];let i=0,s="";for(let n=0;n{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===Mu.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))})),this.cache.verticalList=b,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Gt(e,a)}));const x=dg(_,a),S=this.cache.verticalList.length*v,A=ug(y,S,d);return this._AABBBounds.set(A,x,A+S,x+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=rd(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=Ag){return super.needUpdateTags(t,e)}needUpdateTag(t,e=Ag){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new kg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return kg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return kg.baselineMapAlign}getAlignMapBaseline(){return kg.alignMapBaseline}}function Mg(t){return new kg(t)}kg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Cp),kg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},kg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Tg=["symbolType","size",...Ap];let wg=class t extends Ep{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=Nu}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}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{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return Pc(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=So.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Su(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return So.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(y(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){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,Tg)}needUpdateTag(t){return super.needUpdateTag(t,Tg)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new Ul).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Ul).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Cg(t){return new wg(t)}wg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Cp);const Eg=["segments","points","curveType","curveTension",...Ap];let Bg=class t extends Ep{constructor(t={}){super(t),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=ed(i,s,e))}getGraphicTheme(){return Pc(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),So.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return So.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Eg)}needUpdateTag(t){return super.needUpdateTag(t,Eg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Ul;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Pg(t){return new Bg(t)}Bg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Cp);const Lg=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}},Rg=["width","x1","y1","height","cornerRadius",...Ap];class Og extends Ep{constructor(t){super(t),this.type="rect",this.numberType=ju}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Pc(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=So.graphicService.updateTempAABBBounds(i);return _g(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,So.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Rg)}needUpdateTag(t){return super.needUpdateTag(t,Rg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=Lg(e);return t=new Ul,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new Og(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Og.NOWORK_ANIMATE_ATTR}}function Ig(t){return new Og(t)}Og.NOWORK_ANIMATE_ATTR=Cp;class Dg extends Ep{constructor(t){super(t),this.type="glyph",this.numberType=Ru,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,e=!1,i){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}getGraphicTheme(){return Pc(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}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(),this.stateSort&&(t=t.sort(this.stateSort));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.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Dg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Dg.NOWORK_ANIMATE_ATTR}}function Fg(t){return new Dg(t)}Dg.NOWORK_ANIMATE_ATTR=Cp;class zg{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=yh[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}}}function jg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Hg{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=rd(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Eh(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||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,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r: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}=Eh(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Th(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Eh(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=jg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Th(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Eh(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=jg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=jg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=jg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=jg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&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=Th(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Eh(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const Ng=["width","height","image",...Ap];class Vg extends Ep{constructor(t){super(t),this.type="image",this.numberType=Iu,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}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()})),this.addUpdateBoundTag()}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)}getGraphicTheme(){return Pc(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=So.graphicService.updateTempAABBBounds(i);return _g(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,So.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return ph[t]}needUpdateTags(t){return super.needUpdateTags(t,Ng)}needUpdateTag(t){return super.needUpdateTag(t,Ng)}clone(){return new Vg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Vg.NOWORK_ANIMATE_ATTR}}function Ug(t){return new Vg(t)}Vg.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Cp);class Wg extends Vg{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=qc(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=qc(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=ph.width,height:e=ph.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 Gg{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 Wg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=yh[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Hg){const e=kh.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,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Wg)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Eh(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Wg)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Wg)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||xh;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,Mh(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||bh;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?_h(t,s,{AABBBounds:i}):s,Mh(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Wg)break;const{width:n}=Eh(t,s.character,s.ascentDescentMode),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.forEach(((t,e)=>{i+=t instanceof Wg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Yg{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=yh[this.direction]}store(t){if(t instanceof Wg){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 Gg(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,e=!1){t instanceof Wg?"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||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Th(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Hg(i,t.newLine,t.character,t.ascentDescentMode),new Hg(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let $g=!1;try{$g=Intl&&"function"==typeof Intl.Segmenter}catch(t){$g=!1}const Xg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...Ap];class Kg extends Ep{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Hu,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:uh.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:uh.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:uh.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:uh.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:uh.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:uh.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:uh.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:uh.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Pc(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&_(t.text)&&Kg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&_(t.text)&&Kg.splitText(t.text).length>1)))}static splitText(t){if($g){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=Kg.splitText(t.text.toString());if(_(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),So.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||So.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,So.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Xg)}needUpdateTag(t){return super.needUpdateTag(t,Xg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!Kg.AllSingleCharacter(_)&&(_=Kg.TransformTextConfig2SingleCharacter(_),this.attribute.textConfig=_);const y=[],b=null!=t?t:_;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,y.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),M="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),T=new zg(0,0,(k?n:x?i:0)||0,(M?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&x,!M&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),w=new Yg(T);if(w.newLine=v,p){let t=0,e=!1;for(let i=0;i{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new Kg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(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())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return Kg.NOWORK_ANIMATE_ATTR}}function qg(t){return new Kg(t)}Kg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Cp);const Zg=["path","customPath",...Ap];class Jg extends Ep{constructor(t){super(t),this.type="path",this.numberType=Fu}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Ul?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Ul?this.cache:t.path)}getGraphicTheme(){return Pc(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=So.graphicService.updateTempAABBBounds(i);_g(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return So.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new Ul).fromString(t.path):t.customPath&&(this.cache=new Ul,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,Zg)}needUpdateTag(t){return super.needUpdateTag(t,Zg)}toCustomPath(){return(new Ul).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Jg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Jg.NOWORK_ANIMATE_ATTR}}function Qg(t){return new Jg(t)}Jg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Cp);const tf=["segments","points","curveType","curveTension",...Ap];class ef extends Ep{constructor(t){super(t),this.type="area",this.numberType=Pu}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}getGraphicTheme(){return Pc(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),So.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return So.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),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}_interpolate(t,e,i,s,n){"points"===t&&(n.points=ed(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,tf)}needUpdateTag(t){return super.needUpdateTag(t,tf)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Ul;const 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 ef(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ef.NOWORK_ANIMATE_ATTR}}function sf(t){return new ef(t)}ef.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Cp);const nf=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Ap];class rf extends Ep{constructor(t){super(t),this.type="arc",this.numberType=Eu}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=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(y(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();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=le(e),i=e+r,s&&Vt(r)Ft&&o>Ft)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=this.getGraphicTheme(),{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=Xt(a*a+o*o)}=this.attribute,h=Vt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>Ft&&l>Ft){const i=e>t?1:-1;let s=qt(Number(l)/o*$t(g)),n=qt(Number(l)/a*$t(g));return(f-=2*s)>Ft?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>Ft?(n*=i,c+=n,d-=n):(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}}getGraphicTheme(){return Pc(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=So.graphicService.updateTempAABBBounds(i);_g(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return So.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=Ft?i.set(0,0,0,0):Math.abs(o-l)>Nt-Ft?i.set(-s,-s,s,s):(Qc(l,o,s,i),Qc(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,nf)}needUpdateTag(t){return super.needUpdateTag(t,nf)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Vt(o-a),d=o>a;if(h=Nt-Ft)n.moveTo(0+h*Wt(a),0+h*$t(a)),n.arc(0,0,h,a,o,!d),l>Ft&&(n.moveTo(0+l*Wt(o),0+l*$t(o)),n.arc(0,0,l,o,a,d));else{const t=h*Wt(a),e=h*$t(a),i=l*Wt(o),s=l*$t(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new rf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return rf.NOWORK_ANIMATE_ATTR}}function af(t){return new rf(t)}rf.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Cp);const of=["points","cornerRadius",...Ap];class lf extends Ep{constructor(t){super(t),this.type="polygon",this.numberType=zu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Pc(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),So.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return So.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=ed(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,of)}needUpdateTag(t){return super.needUpdateTag(t,of)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Ul,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new lf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return lf.NOWORK_ANIMATE_ATTR}}function hf(t){return new lf(t)}lf.NOWORK_ANIMATE_ATTR=Cp;class cf extends Pp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!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 df(t){return new cf(t)}const uf=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 pf,gf;function ff(t){return pf||(pf=uf.CreateGraphic("text",{})),pf.initAttributes(t),pf.AABBBounds}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},vf=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)}};class yf{constructor(){this.time=Jo.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:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit,backgroundKeepAspectRatio:y=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip}=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=Pc(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:_,backgroundKeepAspectRatio:y,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s){const{backgroundMode:n,backgroundFit:r,backgroundKeepAspectRatio:a,backgroundScale:o=1,backgroundOffsetX:l=0,backgroundOffsetY:h=0}=s,c=i.width(),d=i.height();let u=c,p=d;if("no-repeat"===n)if(r)if(a){const s=Math.max(c/e.width,d/e.height);t.drawImage(e,i.x1+l,i.y1+h,e.width*s*o,e.height*s*o)}else t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const s=e.width*o,n=e.height*o;t.drawImage(e,i.x1+l,i.y1+h,s,n)}else{if(r&&"repeat"!==n&&(e.width||e.height)){const i=e.width,s=e.height;"repeat-x"===n?(u=i*(d/s),p=d):"repeat-y"===n&&(p=s*(c/i),u=c);const r=t.dpr,a=uc.allocate({width:u,height:p,dpr:r}),o=a.getContext("2d");o&&(o.inuse=!0,o.clearMatrix(),o.setTransformForCurrent(!0),o.clearRect(0,0,u,p),o.drawImage(e,0,0,u,p),e=a.nativeCanvas),uc.free(a)}const s=t.dpr,a=t.createPattern(e,n);a.setTransform&&a.setTransform(new DOMMatrix([1/s,0,0,1/s,0,0])),t.fillStyle=a,t.translate(i.x1,i.y1),t.fillRect(0,0,c,d),t.translate(-i.x1,-i.y1)}}}const bf=new yf;let xf=class{constructor(t){this.subRenderContribitions=t,this.time=Jo.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)}))}};xf=mf([Ka(),_f(0,$a(uo)),_f(0,qa(cg)),vf("design:paramtypes",[Object])],xf);const Sf=new class{constructor(){this.time=Jo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),_=t.AABBBounds,y=null!==(p=t.attribute.width)&&void 0!==p?p:_.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:_.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[y,b],i+y/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const Af=new class{constructor(){this.time=Jo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}};class kf{constructor(){this.time=Jo.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=uc.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])),uc.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,Nt),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:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h;const{textureRatio:c=r.textureRatio,textureOptions:d=null}=e.attribute;let u=this.textureMap.get(t);if(!u)switch(t){case"circle":u=this.createCirclePattern(o,l,a,i);break;case"diamond":u=this.createDiamondPattern(o,l,a,i);break;case"rect":u=this.createRectPattern(o,l,a,i);break;case"vertical-line":u=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":u=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":u=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":u=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":u=this.createGridPattern(o,l,a,i)}if(d&&d.dynamicTexture){const{gridConfig:u={},useNewCanvas:p}=d,g=e.AABBBounds;s=g.x1,n=g.y1;const f=i;let m;if(p){m=uc.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=m.getContext("2d");t.clearRect(0,0,g.width(),g.height()),s=0,n=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,s,n,r),f.clip();const v=g.width(),_=g.height(),y=l,b=o,x=u.columns?u.columns:Math.ceil(v/b),S=u.rows?u.rows:Math.ceil(_/b),A=u.gutterColumn?u.gutterColumn:2*y,k=u.gutterRow?u.gutterRow:2*y;this._tempSymbolGraphic||(this._tempSymbolGraphic=Cg({}));const M=u.columns?v/u.columns:b,T=u.rows?_/u.rows:b;this._tempSymbolGraphic.setAttributes({size:[M-A,T-k],symbolType:t});const w=this._tempSymbolGraphic.getParsedPath();for(let t=0;t{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:vh(e,o,e.dpr),c=o/w,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:w+u*h,innerRadius:T-u*h,startAngle:_-u*c,endAngle:y+u*c}),e.beginPath(),Qp(t,e,i,s,w+u*h,T-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/A,(S-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder"),t.setAttributes({outerRadius:w,innerRadius:T,startAngle:_,endAngle:y})}},wf=Mf,Cf=bf;const Ef=new class{constructor(){this.time=Jo.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,f=p&&!1!==p.visible;if(!g&&!f)return;const{radius:m=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,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:vh(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),f&&M(p,"innerBorder")}},Bf=Mf,Pf=bf;const Lf=new class extends yf{constructor(){super(...arguments),this.time=Jo.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,backgroundKeepAspectRatio:f=l.backgroundKeepAspectRatio,backgroundScale:m=l.backgroundScale,backgroundOffsetX:v=l.backgroundOffsetX,backgroundOffsetY:_=l.backgroundOffsetY}=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,{backgroundMode:p,backgroundFit:g,backgroundKeepAspectRatio:f,backgroundScale:m,backgroundOffsetX:v,backgroundOffsetY:_}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Rf=zt/2;function Of(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=Vt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Vt(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Vt(t[0]),i=Vt(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Vt(l[0]),l[1]=Vt(l[1]),l[2]=Vt(l[2]),l[3]=Vt(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],_=[c[0],c[1]+g[1]],y=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],x=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!q(v,_)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Rf,0,!1)}if(o&&o[1]?o[1](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(y,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Rf,!1)}if(o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),!q(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Rf,zt,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],zt,zt+Rf,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}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};class Df{constructor(){this.time=Jo.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,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:M,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:w,height:C}=t.attribute;w=(null!=w?w:k-i)||0,C=(null!=C?C:M-s)||0;const E=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=T?h:vh(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||y(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,w-o*g,C-o*g)):(e.beginPath(),Of(e,u,p,w-o*g,C-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&E(u,"outerBorder"),f&&E(p,"innerBorder")}}let Ff=class{constructor(){this.time=Jo.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)}};Ff=If([Ka()],Ff);let zf=class{constructor(){this.time=Jo.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:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:_=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||y(v)&&v.every((t=>0===t)))){let n,r=0;return Of(e,i,s,b,x,v,"bevel"!==_,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};zf=If([Ka()],zf);const jf=new Df,Hf=Mf,Nf=bf;const Vf=new class extends Df{constructor(){super(...arguments),this.time=Jo.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)}},Uf=bf;const Wf=new class{constructor(){this.time=Jo.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,f=p&&!1!==p.visible,m=g&&!1!==g.visible;if(!f&&!m)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,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,k=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:vh(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(y-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}},Gf=new class{constructor(){this.time=Jo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:_=l.scaleX,scaleY:y=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/_,(f-s)/y,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/_,(f-s)/y,l),e.stroke())))}},Yf=Mf,$f=bf;const Xf={x:0,y:0,z:0,lastModelMatrix:null};class Kf{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(Sf),this.builtinContributions.push(Af),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===Jo.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Jo.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}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)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Pc(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,_=$p(d,u,h),y=Kp(d,g),b=Gp(h),x=Yp(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(_||y||a||o))return!0;e.beginPath();return il(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),!0}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=$p(o,l,n),p=Kp(o,c),g=Gp(n,r),f=Yp(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){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;Xf.x=n,Xf.y=r,Xf.z=a,Xf.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=ep.allocate(),n=ep.allocate();mg(n,t,e),Zu(s,d||s,n),Xf.x=0,Xf.y=0,Xf.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),ep.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Xf.x+=s.x,Xf.y+=s.y,Xf.z=a,i.setTransformForCurrent()}else if(p)Xf.x=0,Xf.y=0,Xf.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Xf.x+=s.x,Xf.y+=s.y,this.transformWithoutTranslate(i,Xf.x,Xf.y,Xf.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Xf.x=0,Xf.y=0,Xf.z=0;return Xf}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,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,_=(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,f,m,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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&ep.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}var qf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zf=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 Qf=class extends Kf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Eu,this.builtinContributions=[Tf,Cf,wf],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=d>c;let p=!1;if(nFt){const t=Yt(b,y),r=Yt(x,y),a=Zp(v,_,f,m,n,t,Number(u)),o=Zp(A,k,M,T,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,Ut(o.y11,o.x11),Ut(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>Ft)||C<.001)e.lineTo(i+M,s+T),p=!0;else if(w>Ft){const t=Yt(B,w),n=Yt(P,w),a=Zp(M,T,A,k,r,-n,Number(u)),o=Zp(f,m,v,_,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),w0&&e.arc(i+a.cx,s+a.cy,n,Ut(a.y01,a.x01),Ut(a.y11,a.x11),!u);const t=Ut(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Wt(E),s+r*$t(E));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Pc(t,null==r?void 0:r.theme).arc;const{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:k=l.outerRadius,innerRadius:M=l.innerRadius}=t.attribute;k+=b,M-=x;let T=0;const w=(c(S)&&S||S[0])&&"conical"===h.gradient;if(w){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Vt(s-i){var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)Xc[s]=t,i&&(i=!(null!==(e=Xc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Xc[e]=!!t[e],i&&(i=!!Xc[e]);else Xc[0]=!1,Xc[1]=!1,Xc[2]=!1,Xc[3]=!1;return{isFullStroke:i,stroke:Xc}})(d);if((_||E)&&(e.beginPath(),Qp(t,e,i,s,k,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),g?(this._runStroke(t,e,i,s,l,y,E,v,o),this._runFill(t,e,i,s,l,_,m,u,p,a)):(this._runFill(t,e,i,s,l,_,m,u,p,a),this._runStroke(t,e,i,s,l,y,E,v,o))),!E&&y&&(e.beginPath(),Qp(t,e,i,s,k,M,B),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(c(S)&&S||S[1])&&A){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Vt(h-r)>=Nt-Ft){e.beginPath();const r=Math.abs(k-M)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,M,d,d+r),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o);const u=()=>{if(_){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+=Nt;for(;i>Nt;)i-=Nt;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),up(o.color,l.color,h,!1)}(0,0,h,n);a||$p&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}},p=()=>{y&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};u(),p()}}this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),w&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=Pc(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}};Qf=qf([Ka(),Jf(0,$a(uo)),Jf(0,qa(tg)),Zf("design:paramtypes",[Object])],Qf);var tm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},em=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},im=function(t,e){return function(i,s){e(i,s,t)}};let sm=class extends Kf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Lu,this.builtinContributions=[Ef,Pf,Bf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Pc(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,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f;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,_,y,m,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{y&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o)}draw(t,e,i,s){const n=Pc(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function nm(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]=hl(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 rm(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function am(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=rm(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),nm(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=qo.ROW:"y"===s?u=qo.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.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 lm=class extends Kf{constructor(){super(...arguments),this.numberType=Du}draw(t,e,i,s){const n=Pc(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 f;if(!e)return;t.beginPath();am(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),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:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!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:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===_)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}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=Vl(x(t.points,v),_,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===_){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===y){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],y,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=y*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Yt(_,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,y,b,i,s,t,a,o)}};function hm(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),nm(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),nm(t,l,1,s),o=!1):o=!0}t.closePath()}lm=om([Ka()],lm);const cm=new class extends kf{constructor(){super(...arguments),this.time=Jo.afterFillStroke}drawShape(t,e,i,s,n,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:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:id(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:id(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:id(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:id(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},dm=bf;var um=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gm=function(t,e){return function(i,s){e(i,s,t)}};let fm=class extends Kf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Pu,this.builtinContributions=[cm,dm],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,_=m[0];e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const i=m[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,v)}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:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(y(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Pc(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:M=g.clipRange,closePath:T,points:w,segments:C}=t.attribute;let{curveType:E=g.curveType}=t.attribute;function B(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===E&&(E="linearClosed"),1===M&&!C&&!w.some((t=>!1===t.defined))&&"linear"===E)return this.drawLinearAreaHighPerformance(t,e,!!f,k,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(C&&C.length){let e,i;const s=C.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=Vl(B(t.points,x),E,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=C.length-1;t>=0;t--){const e=C[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=C[t-1].points,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=Vl(B(i,x),"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!w||!w.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=B(w,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Vl(e,E,{curveTension:b}),n=Vl(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===M){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,y,r[c],[g,t.attribute],M,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=M*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,A,v,k,y,r[u],[g,t.attribute],Yt(f,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,y,t.attribute,g,M,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Pc(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,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let _,b,x=qo.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],_=t.points[t.points.length-1]}else b=m[0],_=m[m.length-1];const S=Vt(_.x-b.x),A=Vt(_.y-b.y);x=null==_.x1?qo.ROW:null==_.y1?qo.COLUMN:Number.isFinite(S+A)?S>A?qo.ROW:qo.COLUMN:qo.ROW,function(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?qo.ROW:qo.COLUMN,Number.isFinite(c)||(o=qo.COLUMN),Number.isFinite(d)||(o=qo.ROW);const u=i*(o===qo.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;y(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),am(t,i[0]?e.top:e.bottom,l,x===qo.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,M-c,o),t.stroke()}})(),!1}};fm=um([Ka(),gm(0,$a(uo)),gm(0,qa(eg)),pm("design:paramtypes",[Object])],fm);const mm=Mf,vm=bf;var _m=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},bm=function(t,e){return function(i,s){e(i,s,t)}};let xm=class extends Kf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Fu,this.builtinContributions=[vm,mm],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:Pc(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:_,doFill:y,doStroke:b}=m;if(e.beginPath(),t.pathShape)il(t.pathShape.commandList,e,i,s,1,1,f);else{il((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,y,b,v,_,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):_&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{y&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,y,b,v,_,d,n,a,o)}draw(t,e,i,s){const n=Pc(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};xm=_m([Ka(),bm(0,$a(uo)),bm(0,qa(rg)),ym("design:paramtypes",[Object])],xm);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)}};let Mm=class extends Kf{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=ju,this.builtinContributions=[jf,Nf,Hf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Pc(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:_=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:M=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:w}=t.attribute;T=(null!=T?T:b-S)||0,w=(null!=w?w:x-A)||0;const C=Xp(g,f,T,w,h),E=qp(g,v,T,w,M),B=Gp(h,c),P=Yp(d,m);if(!t.valid||!_)return;if(!B&&!P)return;if(!(C||E||a||o||c))return;0===u||y(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,T,w)):(e.beginPath(),Of(e,i,s,T,w,u,"bevel"!==p));const L={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,B,P,C,E,l,n,a,o,L),k?(this._runStroke(t,e,i,s,l,L,E,S,A,o),this._runFill(t,e,i,s,l,L,C,S,A,a)):(this._runFill(t,e,i,s,l,L,C,S,A,a),this._runStroke(t,e,i,s,l,L,E,S,A,o)),this.afterRenderStep(t,e,i,s,B,P,C,E,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=Pc(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}};Mm=Sm([Ka(),km(0,$a(uo)),km(0,qa(og)),Am("design:paramtypes",[Object])],Mm);var Tm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Cm=function(t,e){return function(i,s){e(i,s,t)}};let Em=class extends Kf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Nu,this.builtinContributions=[Wf,$f,Yf,Gf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:Pc(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,M=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,w=s,C=M;const E=e.camera;if(k&&E&&e.project){const t=e.project(i,s,M);e.camera=null,y(c)&&(c[0],c[1]),T=t.x,w=t.y,C=void 0}!1===A.draw(e,c,T,w,C,((n,r)=>{var h,c,v,_;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(_=r.lineWidth)&&void 0!==_?_:t.attribute.lineWidth,r=e}const y=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),y()):(y(),x())}))&&e.closePath(),e.camera=E,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,_,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,_,d,u,A,a)):(this._runFill(t,e,i,s,l,x,_,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,_,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=Pc(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Em=Tm([Ka(),Cm(0,$a(uo)),Cm(0,qa(lg)),wm("design:paramtypes",[Object])],Em);const Bm=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ne)}allocate(t,e,i,s){if(!this.pools.length)return(new Ne).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 Ne(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(...t){this.pools=[]}};const Pm=new class extends yf{constructor(){super(...arguments),this.time=Jo.beforeFillStroke}drawShape(t,e,i,s,n,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,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio}=t.attribute;let T,{background:w}=t.attribute;if(!w)return;const C=()=>{"richtext"===t.type&&(e.restore(),e.save(),T&&e.setTransformFromMatrix(T,!0,1))};let E;"richtext"===t.type&&(T=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const B=g(w)&&w.background,P=t.transMatrix.onlyTranslate();if(B){const e=t.AABBBounds,i=(null!==(u=w.x)&&void 0!==u?u:e.x1)+(null!==(p=w.dx)&&void 0!==p?p:0),s=(null!==(f=w.y)&&void 0!==f?f:e.y1)+(null!==(m=w.dy)&&void 0!==m?m:0),n=null!==(v=w.width)&&void 0!==v?v:e.width(),r=null!==(_=w.height)&&void 0!==_?_:e.height();if(E=Bm.allocate(i,s,i+n,s+r),w=w.background,!P){const t=E.width(),e=E.height();E.set((null!==(y=w.x)&&void 0!==y?y:0)+(null!==(b=w.dx)&&void 0!==b?b:0),(null!==(x=w.y)&&void 0!==x?x:0)+(null!==(S=w.dy)&&void 0!==S?S:0),t,e)}}else E=t.AABBBounds,P||(E=ff(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(w);if("success"!==n.state||!n.data)return void C();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,E,{backgroundMode:A,backgroundFit:k,backgroundKeepAspectRatio:M}),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=w,n?(Of(e,E.x1,E.y1,E.width(),E.height(),n,!0),e.fill()):e.fillRect(E.x1,E.y1,E.width(),E.height()),e.highPerformanceRestore()}B&&Bm.free(E),C()}};var Lm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Om=function(t,e){return function(i,s){e(i,s,t)}};let Im=class extends Kf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Vu,this.builtinContributions=[Pm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Pc(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,fontSize:v=d.fontSize,verticalMode:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute,x=null!==(l=rd(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:M,doStroke:T}=S,w=!f,C=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,M,T,A,k,d,n,a,o),w&&this.transformUseContext2d(t,d,C,e);const E=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=tp.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),tp.free(t)}T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,C))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,C))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,C),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,C)})))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,C),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,C,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!_){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Gt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;E(i,a-(e+1)*x+u,r,n),r+=s}))}))}w&&this.restoreTransformUseContext2d(t,d,C,e),this.afterRenderStep(t,e,i,s,M,T,A,k,d,n,a,o)}draw(t,e,i,s){const n=Pc(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,l,h,c){if(e+t<=0)return;const{textAlign:d=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,_=!u(c),y=_?c.width:i.clipedWidth,b=_?0:dg(d,y),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+y,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+y,t,o),h.stroke()}}};function Dm(t,e,i,s){if(e&&e.length){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},Vm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Um=function(t,e){return function(i,s){e(i,s,t)}};let Wm=class extends Kf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=zu,this.builtinContributions=[Hm,jm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Pc(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,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:b}=f;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?Dm(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Dm(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,f=(Math.atan2(u,d)-Math.atan2(g,p))/2,m=Math.abs(Math.tan(f));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,_=v/m;const y=Fm(d,u),b=Fm(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*m);const S=zm(h,_,y,d,u),A=zm(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=Fm(k,M),w=zm(h,Fm(_,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 B=E-C;B<0&&(C=E,B=-B),B>Math.PI&&(B-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),B&&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,_,b,m,v,l,n,a,o);const x=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,_,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=Pc(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Wm=Nm([Ka(),Um(0,$a(uo)),Um(0,qa(ag)),Vm("design:paramtypes",[Object])],Wm);var Gm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ym=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 Xm=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Ou}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Lf)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:Pc(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:M=l.x,y:T=l.y}=t.attribute,w=Xp(p,m,g,f,c),C=qp(p,v,g,f),E=Gp(c,u),B=Yp(d,x);if(!t.valid||!S)return;if(!h){if(!E&&!B)return;if(!(w||C||a||o||u))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,g,f)):(e.beginPath(),Of(e,i,s,g,f,_,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Lf));const P={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===Jo.beforeFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o,P)})),h&&e.clip();const L=()=>{P.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,M-i,T-s,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,M-i,T-s,l),e.stroke()))};A?(R(),L()):(L(),R()),this._groupRenderContribitions.forEach((r=>{r.time===Jo.afterFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=So.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=Pc(t,null==s?void 0:s.theme).group,i=ep.allocate(),n=ep.allocate();mg(n,t,e),Zu(i,p||i,n),a.modelMatrix=i,ep.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&ep.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}};Xm=Gm([Ka(),$m(0,$a(uo)),$m(0,qa(sg)),Ym("design:paramtypes",[Object])],Xm);var Km=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Zm=function(t,e){return function(i,s){e(i,s,t)}};const Jm=["","repeat-x","repeat-y","repeat"];let Qm=class extends Kf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Iu,this.builtinContributions=[Vf,Uf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Pc(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,image:m}=t.attribute,v=this.valid(t,l,a);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v;if(!m||!t.resources)return;const A=t.resources.get(m);if("success"!==A.state)return;const k=t.width,M=t.height;e.beginPath();let T=!1;0===p||y(p)&&p.every((t=>0===t))?e.rect(i,s,k,M):(Of(e,i,s,k,M,p,"bevel"!==f),T=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const w=()=>{if(x)if(a)a(e,t.attribute,l);else if(_){e.setCommonStyle(t,t.attribute,i,s,l);let n=0;if("repeat"===h&&(n|=1),"repeat"===c&&(n|=2),n){const t=e.createPattern(A.data,Jm[n]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,k,M),e.translate(-i,-s,!0)}else e.drawImage(A.data,i,s,k,M)}},C=()=>{S&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(C(),T&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),w(),T&&e.restore()):(T&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),w(),T&&e.restore(),C()),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 Gc.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Pc(t).image;this._draw(t,a,!1,i)}};Qm=Km([Ka(),Zm(0,$a(uo)),Zm(0,qa(ng)),qm("design:paramtypes",[Object])],Qm);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"),fv=Symbol.for("DrawContribution"),mv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Bu,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];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+=Nt;for(;o<0;)o+=Nt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};var vv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_v=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const yv=Symbol.for("DrawItemInterceptor"),bv=new Ne,xv=new Ne;class Sv{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){bv.copy(s.dirtyBounds),xv.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,tp.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(bv),s.backupDirtyBounds.copy(xv)),!0}}class Av{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 kv=class{constructor(){this.order=1,this.interceptors=[new Sv,new Tv,new Mv,new Av]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&ep.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var wv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ev=function(t,e){return function(i,s){e(i,s,t)}};let Bv=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))}reInit(){this.drawContribution.reInit()}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}};Bv=wv([Ka(),Ev(0,$a(fv)),Cv("design:paramtypes",[Object])],Bv);var Pv=new Da((t=>{t(xo).to(Bv)}));const Lv=Symbol.for("PickerService"),Rv=Symbol.for("GlobalPickerService"),Ov=Symbol.for("PickItemInterceptor"),Iv=Symbol.for("PickServiceInterceptor");var Dv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Fv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};Fv=Dv([Ka()],Fv);let zv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Pc(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=tp.allocateByObj(a),u=new ne(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};zv=Dv([Ka()],zv);let jv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new ne(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}};jv=Dv([Ka()],jv);let Hv=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){const a=mv(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};Hv=Dv([Ka()],Hv);var Nv=new Da(((t,e,i)=>{i(Lv)||(t(Rv).toSelf(),t(Lv).toService(Rv)),t(Hv).toSelf().inSingletonScope(),t(Ov).toService(Hv),t(zv).toSelf().inSingletonScope(),t(Ov).toService(zv),t(jv).toSelf().inSingletonScope(),t(Ov).toService(jv),go(t,Ov),t(Fv).toSelf().inSingletonScope(),t(Iv).toService(Fv),go(t,Iv)})),Vv=new Da((t=>{t(Uu).to(vg),t(Wu).toConstantValue(uf)}));const Uv=Symbol.for("AutoEnablePlugins"),Wv=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},Yv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$v=function(t,e){return function(i,s){e(i,s,t)}};let Xv=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&&bo.isBound(Uv)&&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(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Xv=Gv([Ka(),$v(0,$a(uo)),$v(0,qa(Uv)),Yv("design:paramtypes",[Object])],Xv);var Kv=new Da((t=>{t(Wv).to(Xv),function(t,e){t(uo).toDynamicValue((({container:t})=>new po(e,t))).whenTargetNamed(e)}(t,Uv)})),qv=new Da((t=>{go(t,_o)})),Zv=new Da((t=>{t(Rh).to(Oh).inSingletonScope(),go(t,Rh)})),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.type="static",this.offscreen=!1,this.global=So.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=Fh({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()}};t_=Jv([Ka(),Qv("design:paramtypes",[])],t_);var e_=new Da((t=>{t(t_).toSelf(),t(Fp).toService(t_)}));var i_=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 s_(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function n_(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=s_(t,e,s);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;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=s_(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var o_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},l_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},h_=function(t,e){return function(i,s){e(i,s,t)}};let c_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):n_(e,Ql.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new He,this.backupDirtyBounds=new He,this.global=So.global,this.layerService=So.layerService,y(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}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){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=_e(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.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,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Ql.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Ql.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,tp.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=a_(e,i,Ql.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&&!Se(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Bm.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=tp.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Bm.free(n),tp.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||bo.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};let u_=class extends lm{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=Pc(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=$p(u,p,c),_=Kp(u,g),y=Gp(c),b=Yp(d,f);if(!t.valid||!m)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())}};u_=d_([Ka()],u_);var p_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 g_=class extends fm{constructor(){super(...arguments),this.numberType=Pu}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=Pc(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=$p(u,d,c),f=Gp(c);if(!t.valid||!p)return;if(!f)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())}};g_=p_([Ka()],g_);var f_,m_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},v_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__=function(t,e){return function(i,s){e(i,s,t)}},y_=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"}(f_||(f_={}));let b_=class extends c_{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=f_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new vo([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return y_(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:Ql.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Ql.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 y_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return y_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>y_(this,void 0,void 0,(function*(){if(2!==t.count)yield r_(t,Ql.zIndex,((i,s)=>{if(this.status===f_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return y_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return y_(this,void 0,void 0,(function*(){this.rendering&&(this.status=f_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=f_.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 y_(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:()=>y_(this,void 0,void 0,(function*(){yield r_(t,Ql.zIndex,(t=>y_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};b_=m_([Ka(),__(0,Xa(nv)),__(1,$a(u_)),__(2,$a(g_)),__(3,$a(uo)),__(3,qa(yv)),v_("design:paramtypes",[Array,Object,Object,Object])],b_);var x_=new Da((t=>{t(yf).toSelf().inSingletonScope(),t(kf).toSelf().inSingletonScope(),t(fv).to(c_),t(tv).to(b_),t(rv).to(Xm).inSingletonScope(),t(nv).toService(rv),go(t,sg),t(xf).toSelf().inSingletonScope(),go(t,cg),go(t,nv),t(kv).toSelf().inSingletonScope(),t(yv).toService(kv),go(t,yv)}));function S_(){S_.__loaded||(S_.__loaded=!0,bo.load(Wp),bo.load(Vv),bo.load(Pv),bo.load(Nv),bo.load(Kv),function(t){t.load(qv),t.load(Zv),t.load(e_)}(bo),function(t){t.load(x_)}(bo))}S_.__loaded=!1,S_();const A_=bo.get(yo);So.global=A_;const k_=bo.get(Ip);So.graphicUtil=k_;const M_=bo.get(Op);So.transformUtil=M_;const T_=bo.get(Uu);So.graphicService=T_;const w_=bo.get(Dp);So.layerService=w_;class C_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class E_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=So.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=So.global.getRequestAnimationFrame();this.rafId=t((()=>{So.global.devicePixelRatio!==this.dpr&&(this.dpr=So.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=So.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class B_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.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))})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,So.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())}}const P_=new Ne;class L_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Ia.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()}));const e=this.pluginService.stage;e&&(e.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&&(P_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(P_,t.parent&&t.parent.globalTransMatrix)))})),e.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))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let R_;function O_(){!function(){if(null==R_)try{const t=document.createElement("canvas"),e=t.getContext("2d");R_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),R_&&(R_=!!document.createElement)}catch(t){R_=!1}}();const t=So.global&&So.global.env;return t?"browser"===t:R_}let I_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};I_._pluginClasses={};const D_="white";class F_ extends Pp{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:D_}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={}){var e,i;super({}),this.tickedBeforeRender=!0,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._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Ec,this.hooks={beforeRender:new vo(["stage"]),afterRender:new vo(["stage"]),afterClearScreen:new vo(["stage"]),afterClearRect:new vo(["stage"])},this.global=So.global,!this.global.env&&O_()&&this.global.setEnv("browser"),this.window=bo.get(fc),this.renderService=bo.get(xo),this.pluginService=bo.get(Wv),this.layerService=bo.get(Dp),this.graphicService=bo.get(Uu),this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],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:D_,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(),t.autoRefresh&&this.enableAutoRefresh(),!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),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&_(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(i=t.rafId)&&void 0!==i?i:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new Wc(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(t=!1){t&&(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:f=[1,1,-1],color:m="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);const k=I_.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const M={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]}};if(this.camera)this.camera.params=M;else{const t=I_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=I_.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}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 C_))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new E_))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new B_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new He;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new L_,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=I_.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=I_.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=I_.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();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.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();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===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),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.dirtyBounds&&this.dirtyBounds.clear(),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,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new ne(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;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.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=bo.get(fc),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=bo.get(Lv)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}var z_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},j_=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 H_=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ne}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}}loadFont(t,e,i){return j_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}};H_=z_([Ka()],H_);var N_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},V_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let U_=class{constructor(){this._uid=Ia.GenAutoIncrementId(),this.viewBox=new Ne,this.modelMatrix=new Ue(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){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}};U_=N_([Ka(),V_("design:paramtypes",[])],U_);var W_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},G_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Y_=function(t,e){return function(i,s){e(i,s,t)}};let $_=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=So.global}reInit(){this._init()}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.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 Ne).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 Ue(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),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new ne(e.x,e.y),a=Pc(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 ne(e.x,e.y);l.transformPoint(a,a);const o=Pc(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&&ep.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),tp.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function X_(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 K_(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function ey(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;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}))),ay=(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]},oy=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new He;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 ay(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return ay(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);oy(n[0],s,i),oy(n[1],e-s,i)}};let ly=!1;const hy=new Da((t=>{ly||(ly=!0,t(Qf).toSelf().inSingletonScope(),t(ev).to(Qf).inSingletonScope(),t(nv).toService(ev),t(tg).toService(xf),go(t,tg))}));let cy=!1;const dy=new Da((t=>{cy||(cy=!0,t(Mm).toSelf().inSingletonScope(),t(hv).to(Mm).inSingletonScope(),t(nv).toService(hv),t(zf).toSelf(),t(Ff).toSelf(),t(og).toService(zf),t(og).toService(Ff),t(og).toService(xf),go(t,og))}));let uy=!1;const py=new Da((t=>{uy||(uy=!0,t(lm).toSelf().inSingletonScope(),t(u_).toSelf().inSingletonScope(),t(av).to(lm).inSingletonScope(),t(nv).toService(av))}));let gy=!1;const fy=new Da((t=>{gy||(gy=!0,t(fm).toSelf().inSingletonScope(),t(iv).to(fm).inSingletonScope(),t(nv).toService(iv),t(eg).toService(xf),go(t,eg),t(g_).toSelf().inSingletonScope())}));let my=!1;const vy=new Da((t=>{my||(my=!0,t(Em).toSelf().inSingletonScope(),t(cv).to(Em).inSingletonScope(),t(nv).toService(cv),t(lg).toService(xf),go(t,lg))}));let _y=!1;const yy=new Da((t=>{_y||(_y=!0,t(sm).toSelf().inSingletonScope(),t(sv).to(sm).inSingletonScope(),t(nv).toService(sv),t(ig).toService(xf),go(t,ig))}));let by=!1;const xy=new Da((t=>{by||(by=!0,t(dv).to(Im).inSingletonScope(),t(nv).toService(dv),t(hg).toService(xf),go(t,hg))}));let Sy=!1;const Ay=new Da((t=>{Sy||(Sy=!0,t(xm).toSelf().inSingletonScope(),t(ov).to(xm).inSingletonScope(),t(nv).toService(ov),t(rg).toService(xf),go(t,rg))}));let ky=!1;const My=new Da((t=>{ky||(ky=!0,t(lv).to(Wm).inSingletonScope(),t(nv).toService(lv),t(ag).toService(xf),go(t,ag))}));var Ty=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 wy=class{constructor(){this.numberType=Ru}reInit(){}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=Pc(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};wy=Ty([Ka()],wy);let Cy=!1;const Ey=new Da((t=>{Cy||(Cy=!0,t(pv).to(wy).inSingletonScope(),t(nv).toService(pv))}));var By=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)};let Ly=class extends Kf{constructor(){super(),this.numberType=Hu,this.builtinContributions=[Pm],this.init()}drawShape(t,e,i,s,n){const r=Pc(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=$p(o,l,!0),d=$p(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),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=Pc(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:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),Of(e,i-t,s-n,v,_,f,!0)),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=Pc(t).richtext;this._draw(t,s,!1,i)}};Ly=By([Ka(),Py("design:paramtypes",[])],Ly);let Ry=!1;const Oy=new Da((t=>{Ry||(Ry=!0,t(uv).to(Ly).inSingletonScope(),t(nv).toService(uv))}));let Iy=!1;const Dy=new Da((t=>{Iy||(Iy=!0,t(gv).to(Qm).inSingletonScope(),t(nv).toService(gv),t(ng).toService(xf),go(t,ng))}));function Fy(t){const e=[];for(let i=0;i=0&&n>=0&&sat.getInstance().info(`[VChart log]: ${t}`,...e),Hy=(t,e)=>(d(Vy.warnHandler)&&Vy.warnHandler.call(null,t,e),e?at.getInstance().warn(`[VChart warn]: ${t}`,e):at.getInstance().warn(`[VChart warn]: ${t}`)),Ny=(t,e,i)=>{if(!d(Vy.errorHandler))throw new Error(t);Vy.errorHandler.call(null,t,e)},Vy={silent:!1,warnHandler:!1,errorHandler:!1},Uy=O_(),Wy=Uy&&globalThis?globalThis.document:void 0;function Gy(t){return("desktop-browser"===t||"mobile-browser"===t)&&Uy}function Yy(t){return $y(t)||"mobile-browser"===t}function $y(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let Xy=0;function Ky(){return Xy>=9999999&&(Xy=0),Xy++}function qy(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function Zy(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const Jy=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Qy extends Pp{constructor(t,e){super(t),this._skipRenderAttributes=Jy,(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,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?j(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.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,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.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 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"},wb=(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 Cb extends l{constructor(t,e={}){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.startTime=jc.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.pressTimeout=null}),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=jc.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||Tb(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=wb(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=jc.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=wb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=Tb(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&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("pointerleave",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("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=jc.now()-i>this.config.press.time&&wb(s[0],t){So.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;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){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){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},Bb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Pb=[0,0,0];let Lb=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t: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(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},$l),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Kl),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},ql),{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 Ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ue(1,0,0,1,0,0),this._clearMatrix=new Ue(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&at.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ue(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&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 tp.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&&(tp.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(tp.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){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,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=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(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){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-=Nt;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(f,-2*y),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&&bp.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&&(Ju(Pb,[t,e,i],this.modelMatrix),t=Pb[0],e=Pb[1],i=Pb[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&&(Ju(Pb,[t,e,i],this.modelMatrix),t=Pb[0],e=Pb[1],i=Pb[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Ju(Pb,[e,i,s],this.modelMatrix),e=Pb[0],i=Pb[1],s=Pb[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,e=So.global.measureTextMethod){var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=So.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:ql.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:ql.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&&(Ju(Pb,[e,i,s],this.modelMatrix),e=Pb[0],i=Pb[1],s=Pb[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=_h(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:vh(this,a,this.dpr),r.strokeStyle=_h(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=Ie(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?this.font=t.font:this.font=Ie(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(t=!0,e=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(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>tp.free(t))),this.stack.length=0}};Lb.env="browser",Lb=Eb([Ka(),Bb("design:paramtypes",[Object,Number])],Lb);var Rb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ob=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ib=class extends lp{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=So.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new Lb(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 Db(t,e){return new Da((i=>{i(Ih).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Dh).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Ib.env="browser",Ib=Rb([Ka(),Ob("design:paramtypes",[Object])],Ib);const Fb=Db(Ib,Lb);var zb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hb=function(t,e){return function(i,s){e(i,s,t)}};let Nb=class extends $_{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,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=uc.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 Ub=class{constructor(){this.type="group",this.numberType=Ou}contains(t,e,i){return!1}};Ub=Vb([Ka()],Ub);const Wb=new Da(((t,e,i,s)=>{Wb.__vloaded||(Wb.__vloaded=!0,t(kb).to(Ub).inSingletonScope(),t(Mb).toService(kb),go(t,Mb))}));Wb.__vloaded=!1;var Gb=Wb;const Yb=new Da(((t,e,i,s)=>{i(Nb)||t(Nb).toSelf().inSingletonScope(),i(Lv)?s(Lv).toService(Nb):t(Lv).toService(Nb)}));var $b,Xb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Kb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let qb=$b=class extends U_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${$b.idprefix}_${$b.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=So.global,this.viewBox=new Ne,this.modelMatrix=new Ue(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:$b.GenerateCanvasId(),canvasControled:!0};this.canvas=new Ib(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 Ib({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)}};qb.env="browser",qb.idprefix="visactor_window",qb.prefix_count=0,qb=$b=Xb([Ka(),Kb("design:paramtypes",[])],qb);const Zb=new Da((t=>{t(qb).toSelf(),t(mc).toDynamicValue((t=>t.container.get(qb))).whenTargetNamed(qb.env)}));var Jb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},tx=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 ex{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 ix(t,e=!1){const i=document.createElement("img");if(So.global.isImageAnonymous&&(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 sx=class extends H_{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 ex(t)}return new Ne}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 ix(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return ix(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:Ia.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(...t){}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}}loadFont(t,e,i){return tx(this,void 0,void 0,(function*(){return new FontFace(t,_(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}};sx=Jb([Ka(),Qb("design:paramtypes",[])],sx);const nx=new Da((t=>{nx.isBrowserBound||(nx.isBrowserBound=!0,t(sx).toSelf().inSingletonScope(),t(_o).toService(sx))}));function rx(t,e=!0){rx.__loaded||(rx.__loaded=!0,t.load(nx),t.load(Fb),t.load(Zb),e&&function(t){t.load(Gb),t.load(Yb)}(t))}nx.isBrowserBound=!1,rx.__loaded=!1;var ax=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ox=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lx=function(t,e){return function(i,s){e(i,s,t)}};let hx=class extends $_{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,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 ap(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}};hx=ax([Ka(),lx(0,$a(uo)),lx(0,qa(tb)),lx(1,$a(uo)),lx(1,qa(Ov)),lx(2,$a(uo)),lx(2,qa(Iv)),ox("design:paramtypes",[Object,Object,Object])],hx);const cx=new Da((t=>{cx.__vloaded||(cx.__vloaded=!0,go(t,tb))}));cx.__vloaded=!1;var dx=cx;class ux{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();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,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:vh(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}var px=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gx=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 mx=class extends ux{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Eu}};mx=px([Ka(),fx(0,$a(ev)),gx("design:paramtypes",[Object])],mx);let vx=!1;const _x=new Da(((t,e,i,s)=>{vx||(vx=!0,t(eb).to(mx).inSingletonScope(),t(tb).toService(eb))}));var yx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xx=function(t,e){return function(i,s){e(i,s,t)}};let Sx=class extends ux{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Pu}};Sx=yx([Ka(),xx(0,$a(iv)),bx("design:paramtypes",[Object])],Sx);let Ax=!1;const kx=new Da(((t,e,i,s)=>{Ax||(Ax=!0,t(ib).to(Sx).inSingletonScope(),t(tb).toService(ib))}));var Mx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Tx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Cx=function(t,e){return function(i,s){e(i,s,t)}};let Ex=class extends ux{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Lu}};Ex=Mx([Ka(),Cx(0,$a(sv)),Tx("design:paramtypes",[Object])],Ex);let Bx=!1;const Px=new Da(((t,e,i,s)=>{Bx||(Bx=!0,t(sb).to(Ex).inSingletonScope(),t(tb).toService(sb))}));class Lx{constructor(){this.type="glyph",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=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}}var Rx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ox=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ix=function(t,e){return function(i,s){e(i,s,t)}};let Dx=class extends Lx{constructor(t){super(),this.canvasRenderer=t}};Dx=Rx([Ka(),Ix(0,$a(pv)),Ox("design:paramtypes",[Object])],Dx);let Fx=!1;const zx=new Da(((t,e,i,s)=>{Fx||(Fx=!0,t(db).to(Dx).inSingletonScope(),t(Dx).toService(db))}));var jx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Hx=class{constructor(){this.type="image",this.numberType=Iu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Hx=jx([Ka()],Hx);let Nx=!1;const Vx=new Da(((t,e,i,s)=>{Nx||(Nx=!0,t(nb).to(Hx).inSingletonScope(),t(Hx).toService(nb))}));var Ux=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wx=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 Yx=class extends ux{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Du}};Yx=Ux([Ka(),Gx(0,$a(av)),Wx("design:paramtypes",[Object])],Yx);let $x=!1;const Xx=new Da(((t,e,i,s)=>{$x||($x=!0,t(rb).to(Yx).inSingletonScope(),t(tb).toService(rb))}));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},qx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zx=function(t,e){return function(i,s){e(i,s,t)}};let Jx=class extends ux{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=zu}};Jx=Kx([Ka(),Zx(0,$a(lv)),qx("design:paramtypes",[Object])],Jx);let Qx=!1;const tS=new Da(((t,e,i,s)=>{Qx||(Qx=!0,t(cb).to(Jx).inSingletonScope(),t(tb).toService(cb))}));var eS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sS=function(t,e){return function(i,s){e(i,s,t)}};let nS=class extends ux{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Fu}};nS=eS([Ka(),sS(0,$a(ov)),iS("design:paramtypes",[Object])],nS);let rS=!1;const aS=new Da(((t,e,i,s)=>{rS||(rS=!0,t(ab).to(nS).inSingletonScope(),t(tb).toService(ab))})),oS=new Ne;class lS{constructor(){this.type="rect",this.numberType=ju}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=t.getGraphicTheme(),{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,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:vh(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;oS.setValue(i.x1,i.y1,i.x2,i.y2),oS.expand(-r/2),h=!oS.containsPoint(e)}}return s.highPerformanceRestore(),h}}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 extends lS{constructor(t){super(),this.canvasRenderer=t}};uS=hS([Ka(),dS(0,$a(hv)),cS("design:paramtypes",[Object])],uS);let pS=!1;const gS=new Da(((t,e,i,s)=>{pS||(pS=!0,t(ob).to(uS).inSingletonScope(),t(tb).toService(ob))}));let fS=!1;const mS=new Da(((t,e,i,s)=>{fS||(fS=!0,t(nb).to(Hx).inSingletonScope(),t(Hx).toService(nb))}));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},_S=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yS=function(t,e){return function(i,s){e(i,s,t)}};let bS=class extends ux{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Nu}};bS=vS([Ka(),yS(0,$a(cv)),_S("design:paramtypes",[Object])],bS);let xS=!1;const SS=new Da(((t,e,i,s)=>{xS||(xS=!0,t(lb).to(bS).inSingletonScope(),t(tb).toService(lb))}));var AS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let kS=class{constructor(){this.type="text",this.numberType=Vu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};kS=AS([Ka()],kS);let MS=!1;const TS=new Da(((t,e,i,s)=>{MS||(MS=!0,t(hb).to(kS).inSingletonScope(),t(tb).toService(hb))})),wS=new Da(((t,e,i,s)=>{i(hx)||t(hx).toSelf().inSingletonScope(),i(Lv)?s(Lv).toService(hx):t(Lv).toService(hx)}));var CS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ES=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let BS=class extends Lb{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 Ue(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};BS.env="node",BS=CS([Ka(),ES("design:paramtypes",[Object,Number])],BS);var PS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},LS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let RS=class extends lp{constructor(t){super(t)}init(){this._context=new BS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};RS.env="node",RS=PS([Ka(),LS("design:paramtypes",[Object])],RS);const OS=Db(RS,BS);var IS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},DS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},FS=function(t,e){return function(i,s){e(i,s,t)}};let zS=class extends U_{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:Ia.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new RS(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new RS({width:n,height:r,dpr:s,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}getImageBuffer(t="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){}};zS.env="node",zS=IS([Ka(),FS(0,$a(yo)),DS("design:paramtypes",[Object])],zS);const jS=new Da((t=>{t(zS).toSelf(),t(mc).toDynamicValue((t=>t.container.get(zS))).whenTargetNamed(zS.env)}));var HS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let NS=class extends H_{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 nd.call(t)}}getCancelAnimationFrame(){return t=>{nd.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};NS=HS([Ka()],NS);const VS=new Da((t=>{VS.isNodeBound||(VS.isNodeBound=!0,t(NS).toSelf().inSingletonScope(),t(_o).toService(NS))}));function US(t,e=!0){US.__loaded||(US.__loaded=!0,t.load(VS),t.load(OS),t.load(jS))}VS.isNodeBound=!1,US.__loaded=!1;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};let GS=class extends Lb{draw(){}createPattern(t,e){return null}};GS.env="wx",GS=WS([Ka()],GS);var YS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$S=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let XS=class extends lp{constructor(t){super(t)}init(){this._context=new GS(this,this._dpr)}release(...t){}};XS.env="wx",XS=YS([Ka(),$S("design:paramtypes",[Object])],XS);const KS=Db(XS,GS);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)},JS=function(t,e){return function(i,s){e(i,s,t)}};class QS{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 tA=class extends U_{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new QS}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:Ia.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new XS(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 XS({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()}};tA.env="wx",tA=qS([Ka(),JS(0,$a(yo)),ZS("design:paramtypes",[Object])],tA);const eA=new Da((t=>{t(tA).toSelf(),t(mc).toDynamicValue((t=>t.container.get(tA))).whenTargetNamed(tA.env)}));var iA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},nA=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 rA=class extends H_{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,a){return nA(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let o=0;o{let a=wx.createSelectorQuery();r&&(a=a.in(r)),a.select(`#${l}`).fields({node:!0,size:!0}).exec((r=>{if(!r[0])return;const a=r[0].node,h=r[0].width,c=r[0].height;a.width=h*t,a.height=c*t,i.set(l,a),o>=s&&n.push(a),e(null)}))})))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.component,e.forceUpdate).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 nd.call(t)}}getCancelAnimationFrame(){return t=>{nd.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(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};rA=iA([Ka(),sA("design:paramtypes",[])],rA);const aA=new Da((t=>{aA._isWxBound||(aA._isWxBound=!0,t(rA).toSelf().inSingletonScope(),t(_o).toService(rA))}));function oA(t,e=!0){oA.__loaded||(oA.__loaded=!0,t.load(aA),t.load(KS),t.load(eA),e&&function(t){t.load(dx),t.load(wS),t.load(_x),t.load(kx),t.load(Px),t.load(zx),t.load(Vx),t.load(Xx),t.load(tS),t.load(aS),t.load(gS),t.load(mS),t.load(SS),t.load(TS)}(t))}aA._isWxBound=!1,oA.__loaded=!1;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},hA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cA=function(t,e){return function(i,s){e(i,s,t)}};let dA=class extends ux{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Eu}};dA=lA([Ka(),cA(0,$a(ev)),hA("design:paramtypes",[Object])],dA);let uA=!1;const pA=new Da(((t,e,i,s)=>{uA||(uA=!0,t(ub).to(dA).inSingletonScope(),t(Mb).toService(ub))}));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},fA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mA=function(t,e){return function(i,s){e(i,s,t)}};let vA=class extends lS{constructor(t){super(),this.canvasRenderer=t}};vA=gA([Ka(),mA(0,$a(hv)),fA("design:paramtypes",[Object])],vA);let _A=!1;const yA=new Da(((t,e,i,s)=>{_A||(_A=!0,t(_b).to(vA).inSingletonScope(),t(Mb).toService(_b))}));class bA extends Kf{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=t.getGraphicTheme(),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,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:vh(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&ep.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}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){return function(i,s){e(i,s,t)}};let kA=class extends bA{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Du}};kA=xA([Ka(),AA(0,$a(av)),SA("design:paramtypes",[Object])],kA);let MA=!1;const TA=new Da(((t,e,i,s)=>{MA||(MA=!0,t(mb).to(kA).inSingletonScope(),t(Mb).toService(mb))}));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 BA=class extends ux{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Pu}};BA=wA([Ka(),EA(0,$a(iv)),CA("design:paramtypes",[Object])],BA);let PA=!1;const LA=new Da(((t,e,i,s)=>{PA||(PA=!0,t(pb).to(BA).inSingletonScope(),t(Mb).toService(pb))}));class RA extends Kf{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();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,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&ep.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var OA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},IA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},DA=function(t,e){return function(i,s){e(i,s,t)}};let FA=class extends RA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Nu}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=t.getGraphicTheme(),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,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:vh(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&ep.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};FA=OA([Ka(),DA(0,$a(cv)),IA("design:paramtypes",[Object])],FA);let zA=!1;const jA=new Da(((t,e,i,s)=>{zA||(zA=!0,t(yb).to(FA).inSingletonScope(),t(Mb).toService(yb))}));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},NA=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)}};let UA=class extends ux{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Lu}};UA=HA([Ka(),VA(0,$a(sv)),NA("design:paramtypes",[Object])],UA);let WA=!1;const GA=new Da(((t,e,i,s)=>{WA||(WA=!0,t(gb).to(UA).inSingletonScope(),t(Mb).toService(gb))}));var YA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$A=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XA=function(t,e){return function(i,s){e(i,s,t)}};let KA=class extends RA{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=t.getGraphicTheme(),{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(),f=l.width(),m=ug(a,u,n),v=dg(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,s.modelMatrix!==u&&ep.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};KA=YA([Ka(),XA(0,$a(dv)),$A("design:paramtypes",[Object])],KA);let qA=!1;const ZA=new Da(((t,e,i,s)=>{qA||(qA=!0,t(bb).to(KA).inSingletonScope(),t(Mb).toService(bb))}));var JA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},QA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tk=function(t,e){return function(i,s){e(i,s,t)}};let ek=class extends bA{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Fu}};ek=JA([Ka(),tk(0,$a(ov)),QA("design:paramtypes",[Object])],ek);let ik=!1;const sk=new Da(((t,e,i,s)=>{ik||(ik=!0,t(vb).to(ek).inSingletonScope(),t(Mb).toService(vb))}));var nk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ak=function(t,e){return function(i,s){e(i,s,t)}};let ok=class extends ux{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=zu}};ok=nk([Ka(),ak(0,$a(lv)),rk("design:paramtypes",[Object])],ok);let lk=!1;const hk=new Da(((t,e,i,s)=>{lk||(lk=!0,t(xb).to(ok).inSingletonScope(),t(Mb).toService(xb))}));var ck=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uk=function(t,e){return function(i,s){e(i,s,t)}};let pk=class extends Lx{constructor(t){super(),this.canvasRenderer=t}};pk=ck([Ka(),uk(0,$a(pv)),dk("design:paramtypes",[Object])],pk);let gk=!1;const fk=new Da(((t,e,i,s)=>{gk||(gk=!0,t(Ab).to(pk).inSingletonScope(),t(Mb).toService(Ab))}));var mk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_k=function(t,e){return function(i,s){e(i,s,t)}};let yk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Hu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};yk=mk([Ka(),_k(0,$a(uv)),vk("design:paramtypes",[Object])],yk);let bk=!1;const xk=new Da(((t,e,i,s)=>{bk||(bk=!0,t(Sb).to(yk).inSingletonScope(),t(Mb).toService(Sb))}));var Sk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ak=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kk=function(t,e){return function(i,s){e(i,s,t)}};let Mk=class extends ux{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=Iu}};Mk=Sk([Ka(),kk(0,$a(gv)),Ak("design:paramtypes",[Object])],Mk);let Tk=!1;const wk=new Da(((t,e,i,s)=>{Tk||(Tk=!0,t(fb).to(Mk).inSingletonScope(),t(Mb).toService(fb))})),Ck=O_();function Ek(){Ek.__loaded||(Ek.__loaded=!0,uf.RegisterGraphicCreator("arc",af),bo.load(hy),bo.load(Ck?pA:_x))}Ek.__loaded=!1;const Bk=Ek;function Pk(){Pk.__loaded||(Pk.__loaded=!0,uf.RegisterGraphicCreator("area",sf),bo.load(fy),bo.load(Ck?LA:kx))}Pk.__loaded=!1;const Lk=Pk;function Rk(){Rk.__loaded||(Rk.__loaded=!0,uf.RegisterGraphicCreator("circle",xg),bo.load(yy),bo.load(Ck?GA:Px))}Rk.__loaded=!1;const Ok=Rk;function Ik(){Ik.__loaded||(Ik.__loaded=!0,uf.RegisterGraphicCreator("glyph",Fg),bo.load(Ey),bo.load(Ck?fk:zx))}Ik.__loaded=!1;const Dk=Ik;function Fk(){Fk.__loaded||(Fk.__loaded=!0,uf.RegisterGraphicCreator("group",Lp))}Fk.__loaded=!1;const zk=Fk;function jk(){jk.__loaded||(jk.__loaded=!0,uf.RegisterGraphicCreator("image",Ug),bo.load(Dy),bo.load(Ck?wk:Vx))}jk.__loaded=!1;const Hk=jk;function Nk(){Nk.__loaded||(Nk.__loaded=!0,uf.RegisterGraphicCreator("line",Pg),bo.load(py),bo.load(Ck?TA:Xx))}Nk.__loaded=!1;const Vk=Nk;function Uk(){Uk.__loaded||(Uk.__loaded=!0,uf.RegisterGraphicCreator("path",Qg),bo.load(Ay),bo.load(Ck?sk:aS))}Uk.__loaded=!1;const Wk=Uk;function Gk(){Gk.__loaded||(Gk.__loaded=!0,uf.RegisterGraphicCreator("polygon",hf),bo.load(My),bo.load(Ck?hk:tS))}Gk.__loaded=!1;const Yk=Gk;function $k(){$k.__loaded||($k.__loaded=!0,uf.RegisterGraphicCreator("rect",Ig),bo.load(dy),bo.load(Ck?yA:gS))}$k.__loaded=!1;const Xk=$k;function Kk(){Kk.__loaded||(Kk.__loaded=!0,uf.RegisterGraphicCreator("richtext",qg),bo.load(Oy),bo.load(Ck?xk:mS))}Kk.__loaded=!1;const qk=Kk;function Zk(){Zk.__loaded||(Zk.__loaded=!0,uf.RegisterGraphicCreator("shadowRoot",df))}Zk.__loaded=!1;const Jk=Zk;function Qk(){Qk.__loaded||(Qk.__loaded=!0,uf.RegisterGraphicCreator("symbol",Cg),bo.load(vy),bo.load(Ck?jA:SS))}Qk.__loaded=!1;const tM=Qk;function eM(){eM.__loaded||(eM.__loaded=!0,uf.RegisterGraphicCreator("text",Mg),bo.load(xy),bo.load(Ck?ZA:TS))}eM.__loaded=!1;const iM=eM;function sM(){zk(),Xk()}const nM=-.5*Math.PI,rM=1.5*Math.PI,aM="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 oM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(oM||(oM={}));const lM={[oM.selectedReverse]:{},[oM.selected]:{},[oM.hover]:{},[oM.hoverReverse]:{}},hM={container:"",width:30,height:30,style:{}},cM="scrollDrag";function dM(){return"browser"===A_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const uM={debounce:xt,throttle:St};sM();let pM=class t extends Qy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},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=>{this._clearDragEvents();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});const r=dM(),a="browser"===A_.env?A_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=vt(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},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:uM[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:_t(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){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(cM,{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",uM[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===A_.env?A_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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:ri(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,[s,n,r,a]=ri(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,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=vt(t[0],0,1),c=vt(t[1],0,1),d=vt(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_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)}_clearDragEvents(){const t=dM(),e="browser"===A_.env?A_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===A_.env?A_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};pM.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,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};var gM,fM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 mM=gM=class{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new He).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Vt(t.deltaX)>Vt(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ne,e.addEventListener("wheel",this.scroll),this.params=gM.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(cM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new pM(v),h.name=a,e.add(h),h.isScrollBar=!0);const _=this.childrenBounds,{scrollX:y,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/_.width(),1),e=Math.max(Math.min(y/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/_.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=i{i(mM)||(t(mM).toSelf(),t(Uv).toService(mM))}));function _M(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&_M(t,e)}))}const yM=t=>!u(t)&&!1!==t.visible;function bM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function xM(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 AM=["#ffffff","#000000"];function kM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ei(t).toHex(),o=new ei(e).toHex();return MM(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(...AM);for(const n of a)if(t!==n&&MM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function MM(t,e,i,s,n){if("lightness"===n){const i=ei.getColorBrightness(new ei(e));return ei.getColorBrightness(new ei(t))<.5?i>=.5:i<.5}return s?TM(t,e)>s:"largeText"===i?TM(t,e)>3:TM(t,e)>4.5}function TM(t,e){const i=wM(t),s=wM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function wM(t){const e=si(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 CM(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 EM(t,e){return[t[0]*e,t[1]*e]}function BM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function PM(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=Jt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const LM=(t,e,i,s)=>new De(Object.assign({defaultFontParams:Object.assign({fontFamily:aM,fontSize:14},s),getTextBounds:i?void 0:ff,specialCharSet:"-/: .,@%'\"~"+De.ALPHABET_CHAR_SET+De.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function RM(t,e,i={}){if(!t)return{width:0,height:0};const s=ff({text:t,fontFamily:e.fontFamily||i.fontFamily||aM,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 OM(t,e="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 IM(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function DM(t,e="type"){const i=OM(t,e);return"rich"===i?uf.richtext(IM(t)):("html"===i?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"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),uf.text(t))}function FM(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 zM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function jM(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 HM(t,e){const{dx:i,dy:s}=jM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function NM(){zk(),Xk(),tM(),qk(),iM()}var VM=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&&(T=h,R.setAttribute("maxLineWidth",h-b[1]-b[2]))),k=0,M=0;let H=0;"left"===z||"start"===z?H=1:"right"===z||"end"===z?H=-1:"center"===z&&(H=0),H?H<0?(k-=T,A&&A.setAttribute("x",(A.attribute.x||0)-O),x.setAttribute("x",-b[1]-E)):H>0&&x.setAttribute("x",b[3]):(k-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-O/2),x.setAttribute("x",-E/2));const N="right"===y||"end"===y,V="left"===y||"start"===y,U=(t,e)=>{"richtext"===R.type?R.setAttributes({x:t,textAlign:e,textConfig:Y(R.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):R.setAttributes({x:t,textAlign:e})};if((y?"center"===y:_)&&H){const t=T-b[1]-b[3],e=O+E,i=1===H?(t-e)/2+E+O/2:b[0]+E-(T/2+e/2-E)+O/2;if(U(i,"center"),A){const t=i-O/2-E+F/2;A.setAttributes({x:t})}}if(V&&1!==H){const t=T-b[1]-b[3],e=0===H?-t/2+E/2:-T+b[3]+b[1]+E;if(U(e+E,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(N&&-1!==H){const t=T-b[1]-b[3],e=0===H?t/2+E/2:t;if(U(e,"right"),A){const t=e-O-E+F/2;A.setAttributes({x:t})}}"middle"===j?(M-=w/2,A&&A.setAttribute("y",0)):"bottom"===j?(M-=w,A&&A.setAttribute("y",-I/2),x.setAttribute("y",-b[2])):"top"===j&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",I/2)),P(null==m?void 0:m.text)||(R.states=m.text);const{visible:W}=a,G=VM(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},G),{visible:W&&!!s,width:T,height:w,x:k,y:M}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),G.customShape){const e=G.customShape;t.pathProxy=t=>e(this,t,new Ul)}this._bgRect=t}this._textShape=R,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:j({},UM.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}UM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const WM={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}},GM={poptip:j({},WM)};var YM=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);nA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(y(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),I.setAttribute("x",I.attribute.x+e),o.setAttribute("dx",Yt(Gt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),I.setAttribute("y",I.attribute.y+e),o.setAttribute("dy",Yt(Gt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?zt/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:zt/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?zt/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?zt/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:zt/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?zt/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?zt:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:zt,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?zt:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}QM.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"},panel:{},maxWidthPercent:.8,space:8,padding:10};var tT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 eT=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};j(s,QM.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new QM(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};j(e,GM.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,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),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}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}};eT=tT([Ka()],eT);var iT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 sT{constructor(){this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(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)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}let nT=class extends sT{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};nT=iT([Ka()],nT);let rT=class extends sT{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}};rT=iT([Ka()],rT);const aT=new Da(((t,e,i,s)=>{i(eT)||(t(eT).toSelf().inSingletonScope(),t(cg).toService(eT)),i(nT)||(t(nT).toSelf(),t(Uv).toService(nT)),i(rT)||(t(rT).toSelf(),t(Uv).toService(rT))}));class oT extends Qy{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}zk(),Vk();class lT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},lT.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})}}lT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},zk(),Xk();class hT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},hT.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})}}hT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},zk(),Bk();class cT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},cT.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=re.distancePP(t,e);this.setAttribute("radius",i)}}cT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},zk(),Bk();class dT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},dT.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=nM,endAngle:s=rM}=this.attribute,n=s-i,r=oe(de(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}dT.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},zk(),Wk();class uT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},uT.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=he(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=re.distancePP(t,e);this.setAttribute("radius",i)}}function pT(){zk(),Vk(),Yk(),tM()}function gT(){zk(),Vk(),Bk(),tM()}uT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},pT();class fT extends Qy{getStartAngle(){return ue(this._startAngle)}getEndAngle(){return ue(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},fT.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=uf.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),P(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=uf.line;Y(i)[0].cornerRadius&&(t=uf.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"),P(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:f=12}=t;let m,v;"start"===i?(m={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)):(m={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=uf.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(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}}fT.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}}},gT();class mT extends fT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},fT.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=uf.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"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var vT,_T;!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.labelHoverOnAxis="axis-label-hover-on-axis",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",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(vT||(vT={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(_T||(_T={}));const yT={[_T.selectedReverse]:{},[_T.selected]:{},[_T.hover]:{},[_T.hoverReverse]:{}},bT={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}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},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}}},xT={size:8,stroke:"#000",lineWidth:1,zIndex:1};const ST=Math.sin(Math.PI/10);function AT(t,e=ST){const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function kT(t,e=ST){const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function MT(t){const e={};return _M(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function TT(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function wT(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return EM(r,(s?-1:1)*(n?-1:1)*t/BM(r))}function CT(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function BT(t,e,i){var s;if(kT(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>Fe(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>Fe(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>ze(n,r)}function PT(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(oM.hover,!0),_M(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(oM.hoverReverse,!0)})),s):i},RT=(t,e,i)=>i?(_M(e,(t=>{t.name&&!P(t.states)&&(t.removeState(oM.hoverReverse),t.removeState(oM.hover))})),null):i,OT=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(oM.selected)?(_M(e,(t=>{t.name&&!P(t.states)&&(t.removeState(oM.selectedReverse),t.removeState(oM.selected))})),null):s.name&&!P(s.states)?(s.addState(oM.selected,!0),_M(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(oM.selectedReverse,!0)})),s):i};class IT extends Qy{_prepareAnimate(t){if(!1!==this.attribute.animation){const{animation:e,animationEnter:i,animationExit:s,animationUpdate:n}=this.attribute,r=g(e)?e:{};this._animationConfig={enter:!1!==i&&j({},t,r,null!=i?i:{}),exit:!1!==s&&j({},t,r,null!=s?s:{}),update:!1!==n&&(y(n)?n:j({},t,r,null!=n?n:{}))}}else this._animationConfig={enter:!1,exit:!1,update:!1}}}const DT={type:"default",duration:300,easing:"linear"};class FT extends IT{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=LT(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=RT(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=OT(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=uf.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._prepare(),this._prevInnerView=this._innerView&&MT(this._innerView),this.removeAllChild(!0),this._innerView=uf.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation()}_prepare(){this._prepareAnimate(DT)}_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=uf.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=vT.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=uf.group({x:0,y:0,pickable:!1});t.name=vT.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",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=uf.group({x:0,y:0,pickable:!1});i.name=vT.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=uf.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=vT.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=lM;else{const t=this.data[s],e=j({},lM,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=uf.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=vT.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=lM;else{const i=j({},lM,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=uf.group({x:0,y:0,pickable:!1});return r.name=`${vT.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=DM(this._getLabelAttribute(t,e,n,i));if(a.name=vT.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=lM;else{const s=j({},lM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new UM(Object.assign({},e));i.name=vT.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return TT(t,this.getVerticalVector(e,i,t))}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;Vt(s[0])>Vt(s[1])?o=zt/2*(l.x>e.x?1:-1):h=zt/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+L(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+L(this.attribute,"label.space",4))*s);const f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:_}=this.attribute.label;_=d(_)?j({},bT.label.style,_(t,e,i,s)):_;_=j(this.getLabelAlign(m,o,_.angle),_),d(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let y=_.react;return d(y)&&(y=y(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,_)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==_?void 0:_.fontSize,type:h}),_),{react:y})}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}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},_M(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(e.setFinalAttributes(e.attribute),r){r.release();const i=r.attribute,a=e.getFinalAttribute(),o=function(t,e,i){const s={};for(const i in e)i in t&&U(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}(i,a);let l=Object.keys(o).length>0;if("opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l){this._newElementAttrMap[e.id]={state:"update",node:e,attrs:e.attribute};const i=r.attribute;e.setAttributes(i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}])}}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const zT={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&&BT(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function jT(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function HT(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=d(n)?n:zT[n]||zT.parity;if(s.length>=3&&PT(s,r)){do{s=a(s,r)}while(s.length>=3&&PT(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=$(i);BT(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),HT(l,s,n,(t=>BT(t,l,r))),HT(h,s,o,(t=>BT(t,h,r)||!(!n||t===l)&&BT(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function VT(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},GT(t,e.attribute.angle)),{angle:WT(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({},YT(t,e.attribute.angle)),{angle:WT(e.attribute.angle)}))}))}(t,e),function(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=Me({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function WT(t=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 GT(t,e=0){let 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=WT(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 YT(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=WT(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 $T(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!u(h),d=c?Math.cos(h):1,p=c?Math.sin(h):0,f=kT(h),m=AT(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===_||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/d,l=Math.abs(i/p);if(y&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(d);r=Math.min(t,l)}else if(y&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(d);r=Math.min(t,l)}else r=l}else r=Math.abs(i/d);k(t.attribute.maxLineWidth)&&(r=k(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function XT(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class KT{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,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=BM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return EM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class qT{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-qT.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*qT.bounceIn(2*t):.5*qT.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Nt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Nt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Nt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Nt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Nt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Nt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Nt/e)*.5+1}}static registerFunc(t,e){qT[t]=e}}function ZT(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}qT.quadIn=qT.getPowIn(2),qT.quadOut=qT.getPowOut(2),qT.quadInOut=qT.getPowInOut(2),qT.cubicIn=qT.getPowIn(3),qT.cubicOut=qT.getPowOut(3),qT.cubicInOut=qT.getPowInOut(3),qT.quartIn=qT.getPowIn(4),qT.quartOut=qT.getPowOut(4),qT.quartInOut=qT.getPowInOut(4),qT.quintIn=qT.getPowIn(5),qT.quintOut=qT.getPowOut(5),qT.quintInOut=qT.getPowInOut(5),qT.backIn=qT.getBackIn(1.7),qT.backOut=qT.getBackOut(1.7),qT.backInOut=qT.getBackInOut(1.7),qT.elasticIn=qT.getElasticIn(1,.3),qT.elasticOut=qT.getElasticOut(1,.3),qT.elasticInOut=qT.getElasticInOut(1,.3*1.5),qT.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),qT.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},qT.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)qT[`flicker${t}`]=e=>ZT(e,t);for(let t=2;t<10;t++)qT[`aIn${t}`]=e=>t*e*e+(1-t)*e;function JT(t,e,i){return t+(e-t)*i}const QT=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=JT(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=JT(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=JT(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=JT(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=JT(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=JT(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=JT(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=JT(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=JT(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=up(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?gp(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=up(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?gp(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=JT(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=JT(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=JT(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=JT(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=JT(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=JT(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=JT(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=JT(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=JT(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=ed(e,i,s),r.addUpdateBoundTag()}}};function tw(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.setAttributes(this.target.attribute)},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=qT[s])&&void 0!==n?n:qT.linear:qT.linear,"wait"===t&&(this.onUpdate=ew),this.id=Ia.GenAutoIncrementId(),this.syncAttributeUpdate=ew}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(_(i)&&_(s)){const n=cp.Get(i,hp.Color255),r=cp.Get(s,hp.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(QT["fill"===e?"fillPure":"strokePure"])}else QT[e]?t.push(QT[e]):t.push(tw)}else QT[e]?t.push(QT[e]):t.push(tw)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate;this.target.animates.forEach((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const i=e.getStartProps();this.propKeys.forEach((t=>{null!=i[t]&&e.preventAttr(t)}))}))}deleteSelfAttr(t){var e;delete this.props[t],this.fromProps&&delete this.fromProps[t];const i=this.propKeys.indexOf(t);-1!==i&&(this.propKeys.splice(i,1),null===(e=this.interpolateUpdateFunctions)||void 0===e||e.splice(i,1))}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){this.target.setAttributes(this.props),t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class sw extends iw{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();this.target.setAttributes(t)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class nw extends l{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Ia.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Oo.END?this.removeAnimate(t,!0):t.status!==Oo.RUNNING&&t.status!==Oo.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const rw=new nw;rw.isGlobal=!0;class aw{constructor(t=Ia.GenAutoIncrementId(),e=rw,i){this.id=t,this.status=Oo.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){return this.target=t,this.target.animates||(this.target.animates=new Map),this.target.animates.set(this.id,this),this.onRemove((()=>{this.stop(),this.target.animates.delete(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new iw(Ro.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new sw(Ro.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new iw(Ro.from,t,e,i);return this._firstStep?(this._lastStep.append(s),this._lastStep=s):(this._firstStep=s,this._lastStep=s),this.updateDuration(),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Oo.RUNNING&&(this.status=Oo.PAUSED)}resume(){this.status===Oo.PAUSED&&(this.status=Oo.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this._preventAttrs.add(t),delete this._startProps[t],delete this._endProps[t];let e=this._firstStep;for(;e;)e.deleteSelfAttr(t),e=e.next}preventAttrs(t){t.forEach((t=>this._preventAttrs.add(t)))}validAttr(t){return!this._preventAttrs.has(t)}runCb(t){var e;return null===(e=this._lastStep)||void 0===e||e.onEnd(t),this}startAt(t){return this._startTime=t,this}customInterpolate(t,e,i,s,n,r){return!1}getFromValue(){return this._startProps}getToValue(){return this._endProps}stop(t){let e=this._firstStep;for(;e;)e.stop(),e=e.next;this.status!==Oo.END&&this.onEnd(),this.status=Oo.END,this.target&&("start"===t?this.target.setAttributes(this._startProps):"end"===t?this.target.setAttributes(this._endProps):t&&this.target.setAttributes(t))}release(){this.status=Oo.END,this._onRemove&&this._onRemove.forEach((t=>t())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Oo.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),void(this.status=Oo.END);this.status=Oo.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&this.target.setAttributes(this._startProps);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const ow=new ko;class lw{constructor(){this.released=!1}tick(t,e){ow.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class hw extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Lo.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Lo.INITIAL,So.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),So.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new lw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Lo.INITIAL&&(this.status=Lo.PAUSE,!0)}resume(){return this.status!==Lo.INITIAL&&(this.status=Lo.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Lo.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Lo.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Lo.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Lo.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Lo.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Lo.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,So.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}function uw(t){if(!t||!d(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1}return 2}dw.getInstance();class pw{static registerBuiltInAnimate(t,e){pw.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;y(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:pw.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=uw(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:pw.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=uw(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=k(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){Array.isArray(t)?t.forEach((t=>this._execute(t))):this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,u;const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:_=0,duration:y=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:M,custom:T,customType:w,controlOptions:C}=t,E=e.animate();E.priority=k;const B=d(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],L=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&L&&(i=null!==(h=P[L])&&void 0!==h?h:i),E.startAt(b);const R=i*x+B;R>0&&E.wait(R);let O=null,I=t.to,D=t.from;I||(O||(O=this.createPropsFromChannel(g,e)),I=O.props),D||(O||(O=this.createPropsFromChannel(g,e)),D=O.from),O.attrOutChannel&&e.setAttributes(O.attrOutChannel),this._handleRunAnimate(E,T,w,D,I,y,m,f,C,M,p,e);let F=0;x&&(F=x*(s-i-1));const z=d(_)?_(null===(u=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===u?void 0:u[0],e,{}):_;return z>0&&(F+=z),F>0&&E.wait(F),S&&S>0&&E.loop(S),A&&E.bounce(!0),E}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,u){var p,g,f,m,v,_,y,b;if(e&&i){i=uw(e);let c=this.resolveValue(o,u);"function"==typeof c&&(c=c(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),c=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},c);const x=d(h)?h.call(null,null!==(_=c&&(null===(v=c.data)||void 0===v?void 0:v[0]))&&void 0!==_?_:null===(b=null===(y=u.context)||void 0===y?void 0:y.data)||void 0===b?void 0:b[0],u,c):h;c.options=x,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:u=0}=t,p=d(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=d(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;u||(d||(d=this.createPropsFromChannel(a,i)),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i)),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const g=null!==(n=t.custom)&&void 0!==n?n:pw.builtInAnimateMap[r],f=t.custom?t.customType:uw(g);this._handleRunAnimate(e,g,f,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e){var i;const s={};let n=null;if(!t)return{from:n,props:s,attrOutChannel:null};const r={};let a=!1;const o=null===(i=e.context)||void 0===i?void 0:i.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===o[e]||(t[e]={to:o[e]}),t)),{})),Object.keys(t).forEach((i=>{var r,a,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?s[i]=h.to(null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,{}):s[i]=h.to),void 0!==h.from&&(n||(n={}),"function"==typeof h.from?n[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):n[i]=h.from)})),o)for(const t in o){const e=o[t];void 0!==e&&(s.hasOwnProperty(t)||(r[t]=e,a=!0))}return{from:n,props:s,attrOutChannel:a?r:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}executeItem(t,e,i=0,s=1){return Array.isArray(t)?t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean):[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Oo.END),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}pw.builtInAnimateMap={};const gw="appear",fw="disappear",mw="update",vw="highlight",_w="unhighlight";class yw{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class bw{constructor(t){this.stateList=null,this.graphic=t}applyState(t,e,i){const s=dw.getInstance(),n=[],r=[];if(this.stateList&&this.stateList.length?t.forEach(((t,i)=>{const a={allowTransition:!0,stopOriginalTransition:!0};this.stateList.forEach((e=>{const i=s.isTransitionAllowed(e.state,t,this.graphic);a.allowTransition=a.allowTransition&&i.allowTransition})),a.allowTransition&&(r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new pw(this.graphic)}),this.stateList.forEach((e=>{s.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&n.push(e)})))})):t.forEach(((t,i)=>{r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new pw(this.graphic)})})),n.forEach((t=>{t.executor.stop(null,!1)})),r.length){r[0].executor.execute(r[0].animationConfig);for(let t=0;t{e&&e.executor.execute(e.animationConfig),this.stateList=this.stateList.filter((t=>t!==s)),t===r.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!n.includes(t))):this.stateList=[],this.stateList.push(...r)}applyAppearState(t,e){this.applyState([gw],[{name:gw,animation:t}],e)}applyDisappearState(t,e){this.applyState([fw],[{name:fw,animation:t}],e)}applyUpdateState(t,e){this.applyState([mw],[{name:mw,animation:t}],e)}applyHighlightState(t,e){this.applyState([vw],[{name:vw,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([_w],[{name:_w,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class xw{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new bw(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new yw(t)),t._animationStateStore}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return(new xw)._getAnimationStateManager(t),t}}class Sw{getAttributes(t=!1){return t&&this.finalAttribute?this.finalAttribute:this.attribute}animate(t){var e,i,s;const n=new aw(null==t?void 0:t.id,null!==(i=null!==(e=null==t?void 0:t.timeline)&&void 0!==e?e:this.stage&&this.stage.getTimeline())&&void 0!==i?i:rw,null==t?void 0:t.slience);if(n.bind(this),t){const{onStart:e,onEnd:i,onRemove:s}=t;null!=e&&n.onStart(e),null!=i&&n.onEnd(i),null!=s&&n.onRemove(s)}return null===(s=this.stage)||void 0===s||s.ticker.start(),n}createTimeline(){return new nw}createTicker(t){return new hw(t)}setFinalAttributes(t){this.finalAttribute||(this.finalAttribute={}),Object.assign(this.finalAttribute,t)}initFinalAttributes(t){this.finalAttribute=t}initAnimateExecutor(){this._animateExecutor||(this._animateExecutor=new pw(this))}executeAnimation(t){return this.initAnimateExecutor(),this._animateExecutor.execute(t),this}executeAnimations(t){return this.initAnimateExecutor(),t.forEach((t=>{this._animateExecutor.execute(t)})),this}getFinalAttribute(){return this.finalAttribute}getGraphicAttribute(t,e=!1){return!e&&this.finalAttribute?this.finalAttribute[t]:this.attribute[t]}pauseAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function Aw(){G(Ep,xw),G(Ep,Sw)}class kw extends iw{constructor(t,e,i,s,n){super("customAnimate",e,i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class Mw extends kw{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class Tw{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new pw(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttr(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function ww(t){return new Tw(t)}class Cw extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,this.target.setAttribute("text",n)}}const Ew=1e3,Bw="quadInOut",Pw=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],Lw=(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=up(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Rw=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?ty(t):[],n=ty(e);i&&s&&(i.fromTransform&&ey(s,i.fromTransform.clone().getInverse()),ey(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})))},Iw=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Dw=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Iw.includes(n))return;const r=e[n];if(!u(r)&&!u(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?cp.Get(t,hp.Color255):t;i.push({from:y(t[n])?t[n].map(e):e(t[n]),to:y(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class Fw extends kw{constructor(t,e,i){super({},{},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;Rw(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&Lw(this.otherAttrs,i,e),this.target.setAttributes(i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const zw=(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=Ow(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Dw(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new Fw({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Ew,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Bw);return c.play(d),c};class jw extends kw{constructor(t,e,i){super({},{},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;Rw(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&&Lw(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Hw=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Pw.includes(t))(i)||(e[i]=t[i])})),e},Nw=(t,e,i)=>{const s=Hw(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),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=So.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},Vw=(t,e,i)=>{const s=[],n=i?null:Hw(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:Hw(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=Lg(t.attribute),n=sy(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(So.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=sy(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(So.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=sy(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(So.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 ny(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 ny(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(So.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:ry(i)}];const s=[];return oy(i,e,s),s})(t,e).forEach((t=>{s.push(So.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 oy(l,e,h),h})(t,e).forEach((t=>{s.push(So.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=ty(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(So.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(So.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Nw(t,s,e),s};class Ww extends kw{constructor(t,e,i,s,n){super(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(){super.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:Ko.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:Ko.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:Ko.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Gw extends Ww{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;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=So.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!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:y/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(_+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 Yw extends Ww{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:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=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=So.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:f,height:"in"===v&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===y?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class $w extends kw{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){super.onBind();const{points:t,segments:e}=this.target.attribute,{points:i,segments:s}=this.target.getFinalAttribute();this.from={points:t,segments:e},this.to={points:i,segments:s},this.props=this.to;const n=this.getPoints(this.from),r=this.getPoints(this.to,!0);this.fromPoints=n?Array.isArray(n)?n:[n]:[],this.toPoints=r?Array.isArray(r)?r:[r]:[];const a=new Map;this.fromPoints.forEach((t=>{t.context&&a.set(t.context,t)}));let o,l,h=1/0,c=-1/0;for(let t=0;t=0;t-=1)if(a.has(this.toPoints[t].context)){c=t,l=a.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(c)?(this.clipRange=this.toPoints[c][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[c][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=vt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let d=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=a.get(t.context);return i?(d=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ec&&l?[l,t]:[d,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new ne(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(t)return Object.keys(this.to).forEach((t=>{this.target.attribute[t]=this.to[t]})),this.target.addUpdatePositionTag(),void this.target.addUpdateShapeAndBoundsTag();if(this.points=this.points.map(((t,i)=>{const s=td(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));this.target.setAttributes({clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.target.attribute.segments=e}else this.target.attribute.points=this.points;this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Xw extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0}));const o=this.target.getFinalAttribute();o&&this.target.setAttributes(o),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(a)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Kw extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Object.assign(this.target.attribute,i),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class qw extends Xw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class Zw extends Kw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}const Jw=(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.getFinalAttribute();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.getFinalAttribute();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)};class Qw extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this._updateFunction=null}updateStartAngle(t){this.target.attribute.startAngle=this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t}updateEndAngle(t){this.target.attribute.endAngle=this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class tC extends Qw{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=Jw(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r),this.determineUpdateFunction()}}class eC extends Qw{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class iC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/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:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class sC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const nC=(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,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:u(l)?void 0:c,height:u(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class rC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=nC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class aC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:u(o)?void 0:h,height:u(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const oC=(t,e,i)=>{const s=t.getFinalAttribute().points,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.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class lC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(this.target.attribute.points=r.map(((t,i)=>td(r[i],a[i],e))),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class hC extends lC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:oC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class cC extends lC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:oC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const dC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class uC extends lC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:dC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class pC extends lC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:dC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const gC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class fC extends lC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:gC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class mC extends lC{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:gC(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const vC=(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.getFinalAttribute(),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.getFinalAttribute();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)};class _C extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class yC extends _C{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=vC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}}class bC extends _C{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const xC=(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.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:u(a)?void 0:l,width:u(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class SC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=xC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class AC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class kC extends Mw{onBind(){var t;const e=ww(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;this.target.setAttributes({x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class MC extends Mw{onBind(){const t=ww(this.target);this._animator=t;const e=this.duration,i=this.easing,{config:s,diffAttrs:n}=this.params;t.animate(this.target,{type:"to",to:Object.assign({},n),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},n)}}),this.completeBind(t)}deleteSelfAttr(t){super.deleteSelfAttr(t),this._animator.deleteSelfAttr(t)}tryPreventConflict(){}}function TC(){zk(),Vk(),qk(),iM(),pw.registerBuiltInAnimate("axisEnter",kC),pw.registerBuiltInAnimate("axisUpdate",MC)}var wC=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{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=uf.group({zIndex:999});e.name=vT.axisBreak,e.id=this._getNodeId(`${vT.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=j({},xT,s),a=null!==(e=r.size)&&void 0!==e?e:xT.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=uf.symbol(Object.assign({x:s.x,y:s.y},o));l.name=vT.axisBreakSymbol;const h=uf.symbol(Object.assign({x:n.x,y:n.y},o));h.name=vT.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=uf.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=vT.background,n.id=this._getNodeId("background"),n.states=j({},yT,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new UM(Object.assign({},t));e.name=vT.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=wC(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];P(l)||(c.state={line:j({},yT,l),symbol:j({},yT,l)});const d=new fT(c);d.name=vT.line,d.id=this._getNodeId("line"),t.add(d)}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}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:d}=s,p=wC(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),_=this.getRelativeVector();let y=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+L(this.attribute,"label.space",4);y+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===_[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?y+=i+(e-1)*t:y=0}else if(0===_[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;y+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}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.getActualOffset(x),A=this.getVerticalCoord(v,S,!1),M=this.getVerticalVector(S,!1,{x:0,y:0});let T,w,{angle:C}=p;if(T="start"===n?"start":"end"===n?"end":"center",u(C)&&o){C=PM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;w=1==-1*t?"bottom":"top"}else T=this.getTextAlign(M),w=this.getTextBaseline(M,!1);let E=d;if(u(E)){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(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=s-S;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=s-S}const B=Object.assign(Object.assign(Object.assign({},A),p),{maxWidth:E,textStyle:Object.assign({textAlign:T,textBaseline:w},a),state:{text:j({},yT,c.text),shape:j({},yT,c.shape),panel:j({},yT,c.background)}});return B.angle=C,l&&l.visible&&(B.shape=Object.assign({visible:!0},l.style),l.space&&(B.space=l.space)),h&&h.visible&&(B.panel=Object.assign({visible:!0},h.style)),B}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:d}=s,p=wC(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),_=this.getVerticalVector(m,!1,{x:0,y:0});let y,{angle:b}=p,x="center";if(u(b)&&a){b=PM(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;y=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(_,!1,o.angle);x=t,y=e}const S=d,A=h?h(c):c,k=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:y},o),text:A});return k.angle=b,l&&l.visible&&(k.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),k}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 GT(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return YT(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=$(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(P(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(P(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,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=ae(e)})),UT(i,t),!VT(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=kT(a),l=AT(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=XT(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);k(i)&&(c=Yt(c,i))}}else{if(l){const i=XT(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);k(i)&&(c=Yt(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&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);$T(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&NT(t,{orient:o,method:m,separation:v,lastVisible:_,firstVisible: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=uf.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=vT.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-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(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 f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=RM(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=ri(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(){super.release(),this._breaks=null}}CC.defaultAttributes=bT,G(CC,KT);class EC{isInValidValue(t){const{startAngle:e=nM,endAngle:i=rM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=nM,endAngle:i=rM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return he(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return wT(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function BC(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=BC(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var RC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),k(l)&&l>=3){const t=CT(n,l,c,e,i);h=uf.path(Object.assign(Object.assign({},a.style),{path:ET(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=uf.circle(t)}h.name=vT.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=j({},yT,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=RC(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=L(this.attribute.label,"style.fontSize",12)+L(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=n+m+f+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:j({},yT,d.text),shape:j({},yT,d.shape),panel:j({},yT,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;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(pt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=BC(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&PC(e,c,i)}else e.AABBBounds.width()>r&&PC(e,r,i)}else o>a.x&&h.x2>n.x2?(PC(e,n.x2-o,i),r&&LC(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return pt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}OC.defaultAttributes=bT,G(OC,EC);const IC=t=>t.map(((t,e)=>({index:e,value:t}))),DC=(t,e,i=0)=>{const s=new Ne(t).expand(i/2),n=new Ne(e).expand(i/2);return s.intersects(n)},FC=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=ae(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;u||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=LM(a),_=t.range();let y=[];for(let i=0;i{HC[t]=!0}));const GC=t=>-Math.log(-t),YC=t=>-Math.exp(-t),$C=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,XC=t=>10===t?$C:t===Math.E?Math.exp:e=>Math.pow(t,e),KC=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),qC=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),ZC=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function JC(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 QC(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function tE(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function eE(t,e,i,s){return 1===i&&(i=0),tE(t,i,s)*(e/(1-i))}function iE(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function sE(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=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 rE{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=iE(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}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const aE=Symbol("implicit");class oE extends rE{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=jC.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=aE}clone(){const t=(new oE).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!==aE)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&&a>1;)a-=1,r=Math.floor((e-t)/a);return lE(t,e,r,n)}class cE extends oE{constructor(t){super(),this.type=jC.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=eE(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)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("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),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]}}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(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:hE(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=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(t=10){const e=this.calculateVisibleDomain(this._range);return hE(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=yt(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,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 cE(!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:dE}=ni;function uE(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=ei.parseColorString(e)){const e=dE(ei.parseColorString(t),s);return t=>e(t).formatRgb()}return At(Number(t),Number(e))}return e instanceof ii?dE(t,e):e instanceof ei?dE(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 pE extends rE{constructor(t=WC,e=WC){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=WC,this._piecewise=QC,this._interpolate=uE}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,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=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?sE:QC,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:WC),this.rescale(i)):this._clamp!==WC}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=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 gE=Math.sqrt(50),fE=Math.sqrt(10),mE=Math.sqrt(2),vE=[1,2,5,10],_E=(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=SE(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?bE(0,-(e-1)/s,s):bE((e-1)/s,0,s)},yE=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 _E(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return _E(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=bE(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=bE(t,e,l);return n&&r.reverse(),r})),SE=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=vE[0];return i>=gE?s=vE[3]:i>=fE?s=vE[2]:i>=mE&&(s=vE[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function AE(t,e,i){const s=(e-t)/Math.max(0,i);return SE(s)}function kE(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;e0;){if(s=AE(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function TE(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 wE=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),CE=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})),EE=mt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=xE(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?wE(t,e,n):wE(t,e,nE(n)),h=wE(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),BE=mt(((t,e,i,s,n)=>kE(s(t),s(e),i).map((t=>nE(n(t))))));class PE extends pE{constructor(){super(...arguments),this.type=jC.Linear}clone(){var t;const e=new PE;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return yE(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(d(null==e?void 0:e.customTicks))return e.customTicks(this,t);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=xE(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(t=10){const e=this.calculateVisibleDomain(this._range);return kE(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(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r: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}}function RE(t){return e=>-t(-e)}function OE(t=Number.EPSILON){return e=>Math.max(e,t)}class IE extends pE{constructor(){super(KC(10),XC(10)),this.type=jC.Log,this._limit=OE(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new IE).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=KC(this._base),s=XC(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=RE(i),this._pows=RE(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=GC,this.untransformer=YC):(this._logs=i,this._pows=s,this._limit=OE(),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 WC}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return CE(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return EE(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return BE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return BE(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{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))))}}}G(IE,LE);class DE extends PE{constructor(){super(qC(1),ZC(1)),this.type=jC.Symlog,this._const=1}clone(){return(new DE).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=qC(t),this.untransformer=ZC(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return CE(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return EE(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return BE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return BE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}G(DE,LE);class FE{constructor(){this.type=jC.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 FE).domain(this._domain).range(this._range).unknown(this._unknown)}}function zE(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function jE(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!NC(t.type))return IC(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return IC([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:u=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),_=f&&f()?f().breakDomains:null,m=_&&_.length?v.filter((t=>_.every((e=>te[1])))):v;else if(p(h))m=zE(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=zE(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:u}):t.d3Ticks(e,{noDecimals:u})))}else{const i=null!==(s=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;m=zE(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:u,customTicks:n}):t.ticks(e,{noDecimals:u,customTicks:n})))}var v,_;const y=t.domain();if(e.labelFirstVisible&&y[0]!==m[0]&&!m.includes(y[0])&&m.unshift(y[0]),e.labelLastVisible&&y[y.length-1]!==m[m.length-1]&&!m.includes(y[y.length-1])&&m.push(y[y.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=zC(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=zC(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=$(l),r=f&&f()?NE.greedy:NE.parity;for(;l.length>=3&&PT(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;BT(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),jE(t,l,a,(e=>BT(e,t,i))),jE(n,l,o,(e=>BT(e,n,i)||!(!a||e===t)&&BT(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),$(h)!==$(m)&&h.push($(m))),m=h}}return IC(m)},NE={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&BT(i,t,e)||(i=t,0))))}},VE=(t,e,i,s)=>{const n=zC(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},UE=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,WE=(t,e)=>t[1]{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),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?IC([s[s.length-1]]):IC([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:f,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=K(g),a=X(g);if(s.length<=f/n){const i=VE(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=YE(s,i,o,e.labelLastVisible,Math.floor(n/l),!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=VE(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!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])){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&&!UE(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?WE(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{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=LM(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=he({x:0,y:0},i,t),a=TT(r,wT(s,r,e,n));return o=a,l=wT(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return _.align||(pt(y,f.x)?_.baseline||(_.baseline=b>f.y?"top":"bottom"):y>f.x?_.align="left":y{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||h<=0)return IC(t.domain());let c;if(p(n))c=t.stepTicks(n);else if(p(s))c=t.forceTicks(s);else if(p(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=d(i)?i({axisLength:s,labelStyle:l}):i;c=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=$E(t,i,e),r=K(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=KE(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-p)}else c=t.domain();return IC(c)},KE=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&DC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},qE=new Uint32Array(33),ZE=new Uint32Array(33);ZE[0]=0,qE[0]=~ZE[0];for(let t=1;t<=32;++t)ZE[t]=ZE[t-1]<<1|1,qE[t]=~ZE[t];function JE(t,e,i={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:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&qE[31&o]&ZE[1+(31&l)])return!0}else{if(i[h]&qE[31&o])return!0;if(i[c]&ZE[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,qE[31&o]&ZE[1+(31&l)]);else for(s(h,qE[31&o]),s(c,ZE[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,ZE[31&a]|qE[1+(31&o)]);else for(n(l,ZE[31&a]),n(h,qE[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=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 QE(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=vt(i,-o,t.width+l),d=vt(s,-o,t.width+l),u=vt(n,-a,t.height+h),p=vt(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function tB(t,e,i=!1){return i?QE(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function eB(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=tB(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=QE(t,r)),e.getRange(r)))}function iB(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>p(t))),u=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return iB(t,e,n,o,h,c,l)}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 iB(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 iB(t,e,n,s,h,c)}return!1}const nB=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],rB=["top","inside-top","inside"];function aB(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let _=0,y=0;return u<0-h?_=-u:p>m&&(_=m-p),g<0-l?y=-g:f>v&&(y=v-f),{dx:_,dy:y}}const oB={mode:"same-time",duration:300,easing:"linear"};function lB(t){return 3===t||4===t}function hB(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 cB=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 dB(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)}}var uB=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{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const fB=(t,e)=>Math.ceil(t)>Math.floor(e),mB=([t,e],[i,s])=>s>t&&e>i;function vB(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}var _B=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{const e=t.target;e===this._lastHover||P(e.states)||(e.addState(oM.hover,!0),_M(this,(t=>{t===e||P(t.states)||t.addState(oM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(_M(this,(t=>{P(t.states)||(t.removeState(oM.hoverReverse),t.removeState(oM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void _M(this,(t=>{P(t.states)||(t.removeState(oM.selectedReverse),t.removeState(oM.selected))}));P(e.states)||(e.addState(oM.selected,!0),_M(this,(t=>{t===e||P(t.states)||t.addState(oM.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)===Ko.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===Ko.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(Se(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,f=p-d;return[dB(g,f,c,d,a,o),dB(-g,-f,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds)}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=uf.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Ul)}return e&&e.getAttributes(!0).fill&&s.setAttribute("stroke",e.getAttributes(!0).fill),this.attribute.line&&!P(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;const t=[];!1!==this._enableAnimation&&this._baseMarks.forEach((e=>{t.push(e.attribute),e.initAttributes(e.getAttributes(!0))}));const{overlap:e,smartInvert:i,dataFilter:s,customLayoutFunc:n,customOverlapFunc:r}=this.attribute;let a=this.attribute.data;if(d(s)&&(a=s(a)),a&&a.length){const t=new Set;a=a.filter((e=>!t.has(e.id)&&t.add(e.id)))}let o=this._initText(a);o=d(n)?n(a,o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(o);const l=[],h=o;if(!c(e)&&d(null==e?void 0:e.filterBeforeOverlap)){const t=this.getRelatedGraphic.bind(this);o.forEach((i=>{e.filterBeforeOverlap(i,t,this)?h.push(i):l.push(i)}))}d(r)?o=r(h,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(l):!1!==e&&(o=this._overlapping(h).concat(l)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),o&&o.length&&o.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==i&&this._smartInvert(o),this._renderLabels(o),!1!==this._enableAnimation&&this._baseMarks.forEach(((e,i)=>{e.initAttributes(t[i])}))}_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&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(e)&&(t.states=e)}_createLabelText(t){var e,i;return DM(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;const i=[];let s;if(s=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),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&fB(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&fB(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(pt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(vB([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!mB([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let y=0,b=t.length-1;for(;y<=b;)y===b?_.push(t[y]):(_.push(t[y]),_.push(t[b])),y++,b--;return _}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&s.setRange(tB(i,t.AABBBounds,!0))}))),h.length>0&&h.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&&s.setRange(tB(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(tB(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){var s;if(t){if(!1!==t.attribute.visible){if(null===(s=t.context)||void 0===s?void 0:s.animationState){const e=t.clone();return Object.assign(e.attribute,t.getAttributes(!0)),e.AABBBounds}return t.AABBBounds}const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:n,y:r}=e;return{x1:n,x2:n,y1:r,y2:r}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:p}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{bB[t]=e};var SB=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{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,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*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}AB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const kB=()=>{xB("symbol",AB),xB("line-data",AB)};var MB=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{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}})(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}}}TB.tag="rect-label",TB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var wB=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{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=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}}(t,e,i,s)}};CB.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const EB=()=>{xB("line",CB),xB("area",CB)};var BB=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);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=d(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=d(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}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),h=l.getAttributes(!0),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.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=(h.startAngle+h.endAngle)/2,u=h.endAngle-h.startAngle,p=ge(h.endAngle-u/2),g=he(c,h.outerRadius,o),f=he(c,a+e.line.line1MinLength,o),m=new PB(t,g,f,p,u,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=he(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(d=m.quadrant)||2===d?this._arcRight.set(m.refDatum,m):lB(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var d}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":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 f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,_=0;if("inside"===o&&(_="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=he(t.circleCenter,v,t.middleAngle),t.labelLimit=f,gt(f,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.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=lB(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=lB(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.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 c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(ft(t.pointB.x,this._line2MinLength+h)||gt(t.pointB.x,c-this._line2MinLength-h))&&(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(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;k(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=lB(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-y-c:0+y+c;break;default:m=p.x+f*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+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?lB(t.quadrant)?"left":"right":lB(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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*(lB(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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,f,m;if(pt(l/2,u))g=0,f=1,m=-p;else if(pt(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,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,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?pt(v[0].y,v[1].y)?gt(t.middleAngle,-Math.PI)&&ft(t.middleAngle,0)||gt(t.middleAngle,Math.PI)&&ft(t.middleAngle,2*Math.PI)?(_=0,y=v[1].y+h/2):(_=v[1].y+h/2,y=h):v[0].y{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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;e{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 IB(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=re.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 DB(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=ET(t,!!n),o=ET(r,!!n);const h=re.distancePP(s,l),c=re.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=IB(e,t,!1,!!n),o=IB(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=ET(t,!!n),o=ET(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}OB.defaultAttributes={pickable:!1};class FB extends Qy{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&MT(this._innerView),this.removeAllChild(!0),this._innerView=uf.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 TT(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:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${vT.grid}-sub`:`${vT.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=ET(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=IB(t,o,!1,!!a)}const u=uf.path(Object.assign({path:c,z:l},d(r)?j({},this.skipDefault?null:FB.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 f=ET(o,!!a),m=Vt(o[0].x-o[1].x),v=Vt(o[0].y-o[1].y),_=uf.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*zt/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?j({},this.skipDefault?null:FB.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],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!pt(a.value,0)&&!pt(l.value,0),d=!pt(a.value,1)&&!pt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}FB.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},zk(),Wk();class zB extends FB{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},FB.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=nM,endAngle:r=rM}=this.attribute;i=CT(t,s,re.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=j({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);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})}}G(zB,KT);var jB,HB,NB,VB=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){const e=this._getPointsOfSubGrid(p,d);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"})}}G(UB,EC),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(jB||(jB={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(HB||(HB={})),function(t){t.dataZoomChange="dataZoomChange"}(NB||(NB={}));const WB="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",GB={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:WB,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:WB,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},YB={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}},$B=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var XB=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;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto"},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,k,M,T;const{orient:w,middleHandlerStyle:C={},startHandlerStyle:E={},endHandlerStyle:B={},zoomLock:P}=this.attribute,{start:L,end:R}=this._getState(),{position:O,width:I,height:D}=this._getLayoutAttrFromConfig(),F=null!==(t=E.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=B.triggerMinSize)&&void 0!==e?e:40,j=this._getContainer();if(this._isHorizontal){if(C.visible){const t=(null===(i=C.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:O.x+L*I,y:O.y-t,width:(R-L)*I,height:t},null===(s=C.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=C.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:O.x+(L+R)/2*I,y:O.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=C.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square"},C.icon),{pickable:!P&&(null===(h=C.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:O.x+L*I,y:O.y+D/2,size:D,symbolType:null!==(c=E.symbolType)&&void 0!==c?c:"square"},YB.horizontal),E),{pickable:!P&&(null===(d=E.pickable)||void 0===d||d)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:O.x+R*I,y:O.y+D/2,size:D,symbolType:null!==(u=B.symbolType)&&void 0!==u?u:"square"},YB.horizontal),B),{pickable:!P&&(null===(p=B.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:O.x+L*I-t/2,y:O.y+D/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:999},YB.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:O.x+R*I-g/2,y:O.y+D/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:999},YB.horizontal),{pickable:!P}),"rect")}else{if(C.visible){const t=(null===(g=C.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===w?O.x-t:O.x+I,y:O.y+L*D,width:t,height:(R-L)*D},null===(f=C.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(_=null===(v=null===(m=C.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===_||_)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===w?O.x-t/2:O.x+I+t/2,y:O.y+(L+R)/2*D,angle:Math.PI/180*90,symbolType:null!==(b=null===(y=C.icon)||void 0===y?void 0:y.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0},C.icon),{pickable:!P&&(null===(S=null===(x=C.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:O.x+I/2,y:O.y+L*D,size:I,symbolType:null!==(A=E.symbolType)&&void 0!==A?A:"square"},YB.vertical),E),{pickable:!P&&(null===(k=E.pickable)||void 0===k||k)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:O.x+I/2,y:O.y+R*D,size:I,symbolType:null!==(M=B.symbolType)&&void 0!==M?M:"square"},YB.vertical),B),{pickable:!P&&(null===(T=B.pickable)||void 0===T||T)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:O.x+I/2+t/2,y:O.y+L*D-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},YB.vertical),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:O.x+I/2+i/2,y:O.y+R*D-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},YB.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move"},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move"},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_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))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){return t.length<=10||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,void 0!==e?e*e:1)}(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(t);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(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){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 He).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)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=XB(c,["formatMethod"]),{formatMethod:g}=d,f=XB(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:_,width:y,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,A={x1:_.x,y1:_.y,x2:_.x+y,y2:_.y+b};let k,M,T,w;this._isHorizontal?(k={x:_.x+m*y,y:_.y+b/2},M={x:_.x+v*y,y:_.y+b/2},T={textAlign:$B(A,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},w={textAlign:$B(A,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:_.x+y/2,y:_.y+m*b},M={x:_.x+y/2,y:_.y+v*b},T={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:$B(A,t,"start",this._isHorizontal)?"top":"bottom"},w={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:$B(A,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),j({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),j({},f,{text:S,x:M.x,y:M.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new UM(e),s.name=i,t.add(s)),s}}const qB={debounce:xt,throttle:St};class ZB extends l{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=jB.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=jB.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=jB.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=jB.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=jB.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===A_.env?A_:this.stage,s=dM();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===jB.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===jB.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===jB.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===jB.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(HB.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(HB.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(HB.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===jB.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(HB.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(HB.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:qB[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===A_.env?A_:this.stage,e=dM();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===A_.env?A_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===A_.env?A_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:vt(e+t,0,1),end:vt(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=jB.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}NM(),Xk(),tM(),Lk(),Vk();let JB=class t extends Qy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,_;h.visible?this._isHorizontal?(m=p,v=g-f,_={x:a.x,y:a.y+f}):(m=p-f,v=g,_={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(y+b)/2,_={x:_.x+y/2,y:_.y}):(v-=(y+b)/2,_={x:_.x,y:_.y+y/2})),v+=(null!==(n=u.lineWidth)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:_,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new KB(this._getRendererAttrs()),this._interaction=new ZB(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(HB.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(HB.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(NB.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(HB.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;p(t)&&p(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(NB.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.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._renderer.previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._renderer.statePointToData=t)}};var QB,tP,eP,iP;function sP(){zk(),NM(),Aw()}JB.defaultAttributes=GB,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"}(QB||(QB={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(tP||(tP={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(eP||(eP={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(iP||(iP={}));class nP extends Qy{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=LT(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=RT(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=OT(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:j({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:j({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:j({},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=uf.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=uf.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=uf.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 rP(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 aP(t,e,i,s){t&&(rP(t.startSymbol,e,i,s),t.lines.forEach((t=>rP(t,e,i,s))),rP(t.line,e,i,s),rP(t.endSymbol,e,i,s))}function oP(t,e,i,s){t&&(rP(t.getTextShape(),e,i,s),rP(t.getBgRect(),e,i,s))}function lP(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 hP(t,e,i,s){t&&(lP(t.startSymbol,e,i,s),t.lines.forEach((t=>lP(t,e,i,s))),lP(t.line,e,i,s),lP(t.endSymbol,e,i,s))}function cP(t,e,i,s){t&&(lP(t.getTextShape(),e,i,s),lP(t.getBgRect(),e,i,s))}function dP(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;rP(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)})),rP(t.endSymbol,s+r+a,o,n),Y(e).forEach((t=>{const e=s+r+a+o;rP(t.getTextShape(),e,l,n),rP(t.getBgRect(),e,l,n)}))}function uP(t,e,i,s,n){aP(t,s,i,n),Y(e).forEach((t=>{oP(t,s,i,n)}))}function pP(t,e,i,s,n){rP(t,s,i,n),Y(e).forEach((t=>{oP(t,s,i,n)}))}function gP(t,e,i,s,n){rP(t,s,i,n),Y(e).forEach((t=>{oP(t,s,i,n)}))}function fP(t,e,i,s,n,r){var a;aP(t,n,s,r),rP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?oP(i,n,s,r):rP(i,n,s,r)}function mP(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;rP(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)})),rP(e,n+o+l,h,r),rP(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(rP(i.getTextShape(),n+o+l+h+c,d,r),rP(i.getBgRect(),n+o+l+c,d,r)):rP(i,n+o+l+c,d,r)}function vP(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?dP(t,e,s,r,a):"fadeIn"===i&&uP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?dP(t,e,s,n,a):"fadeIn"===i&&uP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){hP(t,s,i,n),Y(e).forEach((t=>{cP(t,s,i,n)}))}(t,e,i,s,n)}}function _P(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&&pP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&pP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){lP(t,s,i,n),Y(e).forEach((t=>{cP(t,s,i,n)}))}(t,e,i,s,n)}}function yP(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&&gP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&gP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){lP(t,s,i,n),Y(e).forEach((t=>{cP(t,s,i,n)}))}(t,e,i,s,n)}}function bP(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?fP(n,r,e,i,s,o):"callIn"===t&&mP(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?fP(n,r,e,i,s,a):"callIn"===t&&mP(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;hP(t,n,s,r),lP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?cP(i,n,s,r):lP(i,n,s,r)}(n,r,e,t,i,s)}}const xP={type:"clipIn",duration:500,easing:"linear",delay:0},SP={type:"fadeIn",duration:500,easing:"linear",delay:0},AP={type:"callIn",duration:500,easing:"linear",delay:0},kP={type:"fadeOut",duration:500,easing:"linear",delay:0};class MP{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=Y(null==n?void 0:n.label),a=Y(null==n?void 0:n.labelBackground),o=Y(s).map(((s,n)=>{var o,l;const h=j({},i,s),c=new UM(Object.assign(Object.assign({},h),{state:{panel:j({},lM,null!==(o=a[n])&&void 0!==o?o:$(a)),text:j({},lM,null!==(l=r[n])&&void 0!==l?l:$(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===Y(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=Y(this._label),n=Y(null==i?void 0:i.label),r=Y(null==i?void 0:i.labelBackground);if(s.length){const i=Y(e);s.forEach(((e,s)=>{var a,o;const l=j({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:j({},lM,null!==(a=r[s])&&void 0!==a?a:$(r)),text:j({},lM,null!==(o=n[s])&&void 0!==o?o:$(n))}})),this.setLabelPos(e,l)}))}}}class TP extends nP{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=xP,this.defaultExitAnimation=kP}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;HM(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}G(TP,MP);const wP=.001,CP={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:QB.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]}},EP={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"}}},BP={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:{autoRotate:!0,position:eP.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]}},PP={interactive:!0,label:{position:tP.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}},LP={interactive:!0,label:{autoRotate:!0,position:eP.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}},RP={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"}},OP={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"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},IP={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 DP(){FP._animate=vP}sP(),pT(),Aw();class FP extends TP{markerAnimate(t){FP._animate&&this._animationConfig&&FP._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},FP.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i: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,e){var i;return(bM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return xM(Math.abs(e),Math.PI/2,wP)||xM(Math.abs(e),3*Math.PI/2,wP)?SM(i,e,t):bM(e)?EP.postiveXAxis[t]:EP.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new fT({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:j({},lM,null==a?void 0:a.line),startSymbol:j({},lM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},lM,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:j({},lM,null==a?void 0:a.line),startSymbol:j({},lM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},lM,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}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",FP.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(FP.defaultAttributes.label)}}function zP(){jP._animate=_P}FP.defaultAttributes=CP,sP(),Yk(),Aw();class jP extends nP{markerAnimate(t){jP._animate&&this._animationConfig&&jP._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},jP.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=SP,this.defaultExitAnimation=kP}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},OP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;HM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=uf.polygon(Object.assign({points:e},i));n.states=j({},lM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",jP.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=j({},lM,null==i?void 0:i.area)),this._updateMarkLabels(jP.defaultAttributes.label)}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}}jP.defaultAttributes=PP,G(jP,MP),sP(),gT(),Aw();class HP extends TP{markerAnimate(t){HP._animate&&this._animationConfig&&HP._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},HP.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case eP.arcInnerStart:l=n;case eP.arcOuterStart:l=n;break;case eP.arcInnerEnd:l=r;case eP.arcOuterEnd:l=r;break;case eP.center:case eP.arcInnerMiddle:case eP.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return RP[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new mT({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:j({},lM,null==o?void 0:o.line),startSymbol:j({},lM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},lM,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:j({},lM,null==o?void 0:o.line),startSymbol:j({},lM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},lM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",HP.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(HP.defaultAttributes.label)}}HP.defaultAttributes=BP,sP(),Bk(),Aw();class NP extends nP{markerAnimate(t){NP._animate&&this._animationConfig&&NP._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},NP.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=SP,this.defaultExitAnimation=kP}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case eP.center:h=(s+n)/2,c=(r+a)/2;break;case eP.arcInnerStart:h=s,c=r;break;case eP.arcOuterStart:h=n,c=r;break;case eP.arcInnerEnd:h=s,c=a;break;case eP.arcOuterEnd:h=n,c=a;break;case eP.arcInnerMiddle:h=s,c=(r+a)/2;break;case eP.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},RP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;HM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=uf.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=j({},lM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",NP.defaultAttributes.label)}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=j({},lM,null==o?void 0:o.area)),this._updateMarkLabels(NP.defaultAttributes.label)}isValidPoints(){return!0}}function VP(){UP._animate=bP}NP.defaultAttributes=LP,G(NP,MP),sP(),pT(),gT(),tM(),Hk(),Vk(),Aw();class UP extends nP{markerAnimate(t){UP._animate&&this._animationConfig&&UP._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},UP.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=AP,this.defaultExitAnimation=kP,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return xM(Math.abs(s),Math.PI/2,wP)||xM(Math.abs(s),3*Math.PI/2,wP)?SM(t,s,n):bM(s)?IP.postiveXAxis[n]:IP.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,style:d,position:u=iP.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-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,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:j({},lM,null==p?void 0:p.textBackground),text:j({},lM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=j({},lM,null==p?void 0:p.itemContent));const v=bM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+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",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=uf.symbol(Object.assign(Object.assign({},i),r)),o.states=j({},lM,null==s?void 0:s.itemContent)):"text"===n?o=new UM(Object.assign(Object.assign({},i),{state:{panel:j({},lM,null==s?void 0:s.textBackground),text:j({},lM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=uf.richtext(Object.assign(Object.assign({},i),r)),o.states=j({},lM,null==s?void 0:s.itemContent)):"image"===n?(o=uf.image(Object.assign(Object.assign({},i),r)),o.states=j({},lM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=j({},lM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}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=xM(c,0,wP)||xM(d,0,wP),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=zM(e-u,t-d),o=zM(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*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(JP.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(JP.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===JP.focus||"focus"===o){const s=a.hasState(qP.focus);a.toggleState(qP.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[qP.unSelected,qP.unSelectedHover,qP.focus],t),this._setLegendItemState(e,qP.selected,t)})):(this._setLegendItemState(a,qP.selected,t),this._removeLegendItemState(a,[qP.unSelected,qP.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[qP.selected,qP.selectedHover,qP.focus],t),this._setLegendItemState(e,qP.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(qP.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(qP.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(ZP.legendItemClick,a,t);i?(this._removeLegendItemState(a,[qP.selected,qP.selectedHover],t),this._setLegendItemState(a,qP.unSelected,t)):(this._setLegendItemState(a,qP.selected,t),this._removeLegendItemState(a,[qP.unSelected,qP.unSelectedHover],t))}else this._setLegendItemState(a,qP.selected,t),this._removeLegendItemState(a,[qP.unSelected,qP.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[qP.selected,qP.selectedHover],t),this._setLegendItemState(e,qP.unSelected,t))}))}this._dispatchLegendEvent(ZP.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,qP.selected),this._removeLegendItemState(e,[qP.unSelected,qP.unSelectedHover])):(this._removeLegendItemState(e,[qP.selected,qP.selectedHover]),this._setLegendItemState(e,qP.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=$P,spaceRow:l=XP,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:u?i:e,v=this._contentMaxHeight;let _,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,M=0,T=0;const w=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),_=d[t],_.id||(_.id=_.label),_.index=t;let e=!0;y(n)&&(e=n.includes(_.label));const i=this._renderEachItem(_,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||w.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=T+l,T=0,w.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),w.push(i)):(p(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=M+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=uf.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:u}=t,g=[];p(c)&&g.push(c),p(d)&&g.push(d),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=K(g)),p(u)&&(this._itemHeightByUser=u);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,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:f,autoEllipsisStrategy:m}=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=ri(c);let w;!1===x.visible?(w=uf.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,JP.item,t,w)):(w=uf.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,JP.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?qP.selected:qP.unSelected);const C=uf.group({x:0,y:0,pickable:!1});w.add(C);let E,B=0,P=0,R=0;if(v&&!1!==v.visible){const i=L(S,"style.size",10);P=y(i)?i[0]||0:i,R=L(v,"space",8);const s=uf.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,JP.itemShape,t,w,S.state),s.addState(e?qP.selected:qP.unSelected),C.add(s)}let O=0;if(d){const e=L(g,"size",10);E=uf.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,JP.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=DM(Object.assign(Object.assign({x:P/2+R,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,JP.itemLabel,t,w,A.state),D.addState(e?qP.selected:qP.unSelected),C.add(D);const F=L(_,"space",8);if(p(l)){const s=L(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=DM(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,JP.itemValue,t,w,k.state),r.addState(e?qP.selected:qP.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-P-R-F-O-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-P/2-T[1]-T[3]-O-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));B=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-P-R-O),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",B),C.add(E));const z=C.AABBBounds,j=z.width();if("right"===f){const t=z.x2,e=z.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=z.height(),N=p(this.attribute.item.width)?this.attribute.item.width:j+T[1]+T[3],V=this._itemHeightByUser||H+T[0]+T[2];return w.attribute.width=N,w.attribute.height=V,E&&E.setAttribute("visible",!1),C.translateTo(-z.x1+T[3],-z.y1+T[0]),w}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new YP(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},j({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new YP(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new pM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new pM(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?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 i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",St(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=$P,spaceRow:o=XP}=n,l=this._itemsContainer,{space:h=KP,defaultCurrent:c=1}=r,d=iL(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,_=0,y=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v0&&(y=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:y,y:b}),y+=a+i})),this._itemContext.startX=y,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),_=p-g.AABBBounds.height()-h-t,_<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;_0&&(b=0,y+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:y,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=uf.group({x:0,y:t,width:u?v:f,height:u?m:_,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=$P,spaceRow:a=XP}=s,o=this._itemsContainer,{space:l=KP,defaultCurrent:h=1}=n,c=iL(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const _=uf.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=uf.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];pt(vt(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),pt(vt(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(qP.selected)?this._setLegendItemState(t,qP.selectedHover,e):this._setLegendItemState(t,qP.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===JP.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(ZP.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(qP.unSelectedHover)||t.hasState(qP.selectedHover))&&(i=!0),t.removeState(qP.unSelectedHover),t.removeState(qP.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(qP.unSelectedHover)&&!t.hasState(qP.selectedHover)||(i=!0),t.removeState(qP.unSelectedHover),t.removeState(qP.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===JP.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(ZP.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(ZP.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!==JP.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(ZP.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!==JP.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(ZP.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(qP.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=j({},sL,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(qP.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}release(){super.release(),this.removeAllEventListeners()}};var rL;function aL(t){return y(t)?t:[t,t]}function oL(t){return t?"ew-resize":"ns-resize"}nL.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:$P,spaceRow:XP,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:KP,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"}(rL||(rL={})),tL();class lL extends Qy{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:j({},lL.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=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=dM(),n="browser"===A_.env?A_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;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=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=dM(),n="browser"===A_.env?A_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{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=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),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:aL(d)[0],endValue:aL(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=uf.group({x:0,y:0});f.name=rL.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=uf.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)),m.name=rL.startText,f.add(m);const e=p(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const _=uf.group({x:g?v:0,y:g?0:v});f.add(_);const y=uf.group({x:0,y:0});let b;if(y.name=rL.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=uf.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=rL.endText,f.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=uf.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=rL.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,f]=aL(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":oL(p)},r));if(v.name=rL.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=rL.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":oL(p)},r));if(i.name=rL.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f,"end");e.name=rL.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 f=uf.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=rL.trackContainer;const m=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":oL(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=uf.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=rL.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return uf.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":oL(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),uf.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=uf.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=uf.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),("browser"===A_.env?A_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=dM(),e="browser"===A_.env?A_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_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===rL.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===rL.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===rL.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===rL.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}}release(t){super.release(t),("browser"===A_.env?A_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}lL.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}}},eL(),tL();class hL extends QP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},hL.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:f,handlerText:m,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:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function cL(t="bottom"){let 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`}hL.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"}}},eL(),tL(),Wk();class dL extends QP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},dL.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:f,showTooltip:m,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=uf.group({x:0,y:0});this._innerView.add(x);const S=new lL({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:cL(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,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=uf.path(Object.assign(Object.assign({x:0,y:k,path:A},_),{zIndex:0}));x.add(M);const T=this._title?this._title.AABBBounds.height()+L(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))}}dL.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)"}},zk(),iM(),qk();let uL=class t extends Qy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,b,x;const{textType:S,text:A,subtextType:k,textStyle:M={},subtext:T,subtextStyle:w={},width:C,height:E,minWidth:B,maxWidth:P,minHeight:L,maxHeight:R,align:O,verticalAlign:I,padding:D=0}=this.attribute,F=ri(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),j=null!==(t=M.height)&&void 0!==t?t:E;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:u="break-word",maxWidth:g,lineClamp:f}=M;if("rich"===S||p(M.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:C)&&void 0!==e?e:0,height:null!=j?j:0,ellipsis:null==d||d,wordBreak:null!=u?u:"break-word",maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:null!==(i=M.character)&&void 0!==i?i:A},M);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},hM),M),x:h,y:c,width:null!==(s=null!=t?t:C)&&void 0!==s?s:0,height:null!=j?j:0,ellipsis:d,wordBreak:u,maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:[]},M);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else p(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(A)?A:[A],whiteSpace:"normal"},M),{maxLineWidth:null!==(r=null!==(n=M.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:C,heightLimit:null!==(a=M.height)&&void 0!==a?a:R,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const H=this._mainTitle?this._mainTitle.AABBBounds.height():0,N=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==w.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=w,v=Math.max(Number.MIN_VALUE,R-H);if("rich"===k||p(w.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:C)&&void 0!==o?o:0,height:null!==(l=null!=e?e:E)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=w.character)&&void 0!==h?h:T},w);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:T},hM),w),x:n,y:r,width:null!==(c=null!=t?t:C)&&void 0!==c?c:0,height:null!==(d=null!=e?e:E)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},w);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else p(T)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(T)?T:[T],whiteSpace:"normal"},w),{maxLineWidth:null!==(u=w.maxLineWidth)&&void 0!==u?u:C,heightLimit:null!==(g=w.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:H}),"text"))}const V=this._subTitle?this._subTitle.AABBBounds.height():0,U=this._subTitle?this._subTitle.AABBBounds.width():0;let W=Math.max(N,U),G=H+(null!==(f=w.height)&&void 0!==f?f:V);if(p(C)&&(W=C),p(E)&&(G=E),p(B)&&WP&&(W=P),p(L)&&GR&&(G=R),z.attribute.width=W,z.attribute.height=G,z.attribute.boundsPadding=F,this._mainTitle){if(p(O)||p(M.align)){const t=M.align?M.align:O,e=null!==(m=M.width)&&void 0!==m?m:W;"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")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:I,e=null!=j?j:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"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")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(p(O)||p(w.align)){const t=w.align?w.align:O,e=null!==(_=null!==(v=w.width)&&void 0!==v?v:M.width)&&void 0!==_?_:W;"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")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=w.verticalAlign?w.verticalAlign:I,e=this._mainTitle?p(j)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),j):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=w.height)&&void 0!==b?b:E)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"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")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};uL.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 pL={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"}}};zk(),iM(),qk();let gL=class extends Qy{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=j({},L(pL,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=DM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{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,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(p(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),p(s)){const t=Y(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e: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=RM(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,f=c/2,m=g**2+1,v=2*f*g,_=f**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*m*_))/(2*m))+f),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 fL extends wg{constructor(t){super(t)}}var mL,vL;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(mL||(mL={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(vL||(vL={}));class _L extends Qy{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},_L.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"},_L.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"},_L.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},_L.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},_L.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 fL(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new fL(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new fL(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(mL.OnPlay)},this.pause=()=>{this._dispatchEvent(mL.OnPause)},this.forward=()=>{this._dispatchEvent(mL.OnForward)},this.backward=()=>{this._dispatchEvent(mL.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()}}_L.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},_L.defaultAttributes={[vL.Start]:{},[vL.Pause]:{},[vL.Backward]:{},[vL.Forward]:{}};const yL={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},bL=[200,10];var xL,SL;!function(t){t.Default="default",t.Reverse="reverse"}(xL||(xL={})),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"}(SL||(SL={}));const AL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===xL.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===xL.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),kL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===xL.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===xL.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),ML=t=>"top"===t||"bottom"===t;class TL extends Qy{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},TL.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=Gt(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(ML(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:bL[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:bL[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 lL(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 t.layout=ML(this._orient)?"horizontal":"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 _L(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=ML(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:bL[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Gt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(ML(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:Gt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:ML(this._orient)?t+s:(this._size.width-r)/2,y:ML(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:ML(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:ML(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:Gt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:ML(this._orient)?t+s:(this._size.width-r)/2,y:ML(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]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function wL(){tL(),zk(),tM()}TL.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({},yL),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},yL),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},yL),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},yL),{key:"backward",position:"start"})}},wL();class CL extends TL{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},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:xL.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(mL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(mL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(mL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(mL.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(SL.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(AL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||kL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===xL.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(SL.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=A_.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(SL.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(SL.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=A_.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(),A_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(SL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,A_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(SL.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(SL.change),this.dispatchCustomEvent(SL.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var EL,BL=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())}))};wL();class PL extends TL{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(mL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(mL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(mL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(mL.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(SL.change))},this.play=()=>BL(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(SL.play),this._rafId=A_.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=A_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,A_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(SL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,A_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(SL.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(SL.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(SL.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.brushActive="brushActive",t.brushClear="brushClear"}(EL||(EL={}));const LL={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],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:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},RL=5;const OL={debounce:xt,throttle:St};zk(),Yk();let IL=class t extends Qy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=LL.updateTrigger,endTrigger:i=LL.endTrigger,brushMoved:s=!0}=this.attribute;Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushingWithDelay))),Y(i).forEach((t=>this.stage.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos]},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:OL[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(EL.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const{trigger:t=LL.trigger,resetTrigger:e=LL.resetTrigger}=this.attribute;Y(t).forEach((t=>this.stage.addEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(EL.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;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,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(EL.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=RL}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(EL.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(EL.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;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._dispatchBrushEvent(EL.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=RL}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(EL.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(EL.brushClear,t)):Math.abs(r-s)this.stage.removeEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents()}_releaseBrushUpdateEvents(){const{updateTrigger:t=LL.updateTrigger,endTrigger:e=LL.endTrigger}=this.attribute;Y(t).forEach((t=>this.stage.removeEventListener(t,this._onBrushingWithDelay))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushEnd)))}_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=uf.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}_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(Pe(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_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.ythis._brushMaskAABBBoundsDict[t].empty()))}};IL.defaultAttributes=LL;const DL=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return j(t,...e,{shape:i.every(u)?void 0:j({},...i),key:s.every(u)?void 0:j({},...s),value:n.every(u)?void 0:j({},...n)})},FL=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}},zL={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:aM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:aM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:aM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ne).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},jL=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];zk(),Xk(),tM(),iM(),qk();let HL=class t extends Qy{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: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=ri(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",j({symbolType:"circle"},u.shape,{visible:yM(u)&&yM(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:yM(u)&&yM(u.value)},FL(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:yM(u)&&yM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:yM(u)&&yM(u.value)},FL(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},hM),u.value),visible:yM(u)&&yM(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=yM(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:f,textBaseline:m}=u.value,v=n.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 _=yM(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(!yM(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)+(yM(n.key)?r+n.key.spacing:0)+(yM(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&&(FM(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";p(n.value.textAlign)?t=n.value.textAlign:yM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),FM(c,f,t,u,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(yM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=rd(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(yM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},FL(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},FL(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},hM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(yM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},FL(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},FL(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=>jL.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)&&yM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=yM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=LM(d),_=LM(u);let y=0;if(yM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),y=Math.max(y,e)}if(yM(u)){const{width:t,height:e}=_.quickMeasure(u.text);h.push(t),y=Math.max(y,e)}f&&hu[m]&&(t=!0,r.push(p.size),y=Math.max(p.size,y)),e.height=y,o+=y,a{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 DL({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return DL({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};HL.defaultAttributes=zL;const NL=pt;function VL(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:K(i)}function UL(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function WL(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function GL(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 YL(t,e){const i=GL(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 $L(t,e){const i=XL(t),s=XL(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 XL(t,e={x:0,y:0}){return re.distancePP(t,e)}function KL(t){return k(t.x)&&k(t.y)}function qL(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 ZL(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const JL=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function tR(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&tR(t[i],e)}}var eR,iR,sR;function nR(t){var e,i;const{type:s}=t;return s===iR.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!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.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_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"}(eR||(eR={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",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",t.mosaic="mosaic",t.pictogram="pictogram"}(iR||(iR={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",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.transform="transform",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.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.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(sR||(sR={}));const rR={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},aR={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function oR(t,e){var i;if(!t)return[];const s=gR(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?uR(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>dR(i)?hR(t,i,e):i)).filter(p)}))):i.map((i=>dR(i)?hR(t,i,e):i)).filter(p):[]}return[]}function lR(t,e){var i,s;return uR(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 hR(t,e,i){var s;const n=gR(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=rR[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=aR[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 ei(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Ye(t,i,s),a=Ge(n,r,e.l),l=new ei(`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 cR=(t,e)=>{if(e&&dR(t)){const i=hR(e,t);if(i)return i}return t};function dR(t){return t&&"palette"===t.type&&!!t.key}function uR(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function pR(t){return y(t)?{dataScheme:t}:t}function gR(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=nR(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 fR extends oE{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(!uR(this._range))return void super.range(this._range);const t=lR(this._range,this._domain);super.range(t)}}const mR={linear:PE,band:cE,point:class extends cE{constructor(t){super(!1),this.type=jC.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:oE,threshold:FE,colorOrdinal:fR};function vR(t){const e=mR[t];return e?new e:null}function _R(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function yR(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function bR(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function xR(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function SR(t){return!!_(t)&&(!!t.endsWith("%")&&qy(t.substring(0,t.length-1)))}function AR(t){return!!g(t)&&("percent"in t||"offset"in t)}function kR(t,e,i,s=0){var n,r;return S(t)?t:SR(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 MR(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]=kR(t[s],e.size,i)}))})),o}function TR(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}}function wR(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)||SR(t)||d(t)||AR(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function CR(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const ER=(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},BR=[{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"]}];function PR(t,e){return t&&e.key in t?t[e.key]:e.default}function LR(t){return t&&"token"===t.type&&!!t.key}const RR={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%"},OR={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:BR,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)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:RR,component:{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}}},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:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},IR={name:"dark",colorScheme:{default:{dataScheme:BR,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",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},DR=(t,e)=>t===e||!d(t)&&!d(e)&&(y(t)&&y(e)?e.every((e=>t.some((t=>DR(t,e))))):!(!g(t)||!g(e))&&Object.keys(e).every((i=>DR(t[i],e[i])))),FR=(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]={}),FR(t[s],e.slice(1),i))},zR=t=>t instanceof Ba||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)))}}(t);function jR(t,e=["data"]){return I(t,zR,e)}function HR(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=pR(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}NR._charts={},NR._series={},NR._components={},NR._graphicComponents={},NR._marks={},NR._regions={},NR._animations={},NR._implements={},NR._chartPlugin={},NR._vChartPlugin={},NR._componentPlugin={},NR.transforms={fields:Yr,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}},NR.dataParser={csv:(t,e={},i)=>(i.type=Gr.DSV,sa(t)),dsv:(t,e={},i)=>{i.type=Gr.DSV;const s=Hr(ra,e),{delimiter:n}=s;if(!_(n))throw new TypeError("Invalid delimiter: must be a string!");return ia(n).parse(t)},tsv:(t,e={},i)=>(i.type=Gr.DSV,na(t))},NR._layout={},NR._grammarTransforms={},NR._stageEventPlugins={},NR.registerStageEventPlugin=(t,e)=>{NR._stageEventPlugins[t]=e},NR.getStageEventPlugin=t=>NR._stageEventPlugins[t],NR._interactionTriggers={},NR.registerInteractionTrigger=(t,e)=>{NR._interactionTriggers[t]=e},NR._composedEventMap={},NR.registerComposedEvent=(t,e)=>{NR._composedEventMap[t]=e},NR._tooltipProcessors={},NR.registerTooltipProcessor=(t,e)=>{NR._tooltipProcessors[t]=e},NR.createTooltipProcessor=(t,e)=>{const i=NR._tooltipProcessors[t];return i?new i(e):null};const WR=t=>{const e={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"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},GR=WR(),YR={[OR.name]:OR},$R=OR.name,XR=new Map(Object.keys(YR).map((t=>[t,YR[t]]))),KR=new Map,qR=new Map(Object.keys(YR).map((t=>[t,t===$R]))),ZR=(t,e)=>{if(!t)return;const i=eO(e);XR.set(t,i),qR.set(t,!0)},JR=(t=$R)=>(qR.has(t)&&!qR.get(t)&&ZR(t,XR.get(t)),XR.get(t)),QR=t=>XR.delete(t)&&KR.delete(t)&&qR.delete(t),tO=t=>!!_(t)&&XR.has(t),eO=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:$R;return VR({},JR(i),t)};class iO{static registerInstance(t){iO.instances.set(t.id,t)}static unregisterInstance(t){iO.instances.delete(t.id)}static getInstance(t){return iO.instances.get(t)}static instanceExist(t){return iO.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return iO.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}iO.instances=new Map;class sO{static registerTheme(t,e){ZR(t,e)}static getTheme(t,e=!1){return JR(t)}static removeTheme(t){return QR(t)}static themeExist(t){return tO(t)}static getDefaultTheme(){return sO.themes.get($R)}static setCurrentTheme(t){sO.themeExist(t)&&(sO._currentThemeName=t,iO.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return sO.getTheme(sO._currentThemeName,t)}static getCurrentThemeName(){return sO._currentThemeName}}function nO(t){return _(t)?sO.themeExist(t)?sO.getTheme(t):{}:g(t)?t:{}}sO.themes=XR,sO._currentThemeName=$R;const rO=["animationThreshold","colorScheme","name","padding"];function aO(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];rO.includes(n)?s[n]=r:m(r)?dR(r)?s[n]=cR(r,e):LR(r)?s[n]=PR(i,r):s[n]=aO(r,e,i):s[n]=r})),s}function oO(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]=oO(t[s],e)}return i}return y(t)?t.map((t=>oO(t,e))):t}function lO(t,e){if(!t)return t;if(m(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]=lO(t[s],e)}return i}return y(t)?t.map((t=>lO(t,e))):t}function hO(t,...e){return d(t)?t(...e):t}const cO=(t,e,i,s)=>((t,e,i)=>LM(t,e,i,{fontFamily:RR.fontFamily,fontSize:RR.fontSize}))(e,i,s).measure(t),dO="__VCHART",uO=500,pO=500,gO=`${dO}_MEASURE_CANVAS_ID`,fO=`${dO}_DEFAULT_DATA_INDEX`,mO=`${dO}_DEFAULT_DATA_KEY`,vO=`${dO}_DEFAULT_DATA_SERIES_FIELD`,_O=`${dO}_DEFAULT_SERIES_STYLE_NAME`,yO=`${dO}_STACK_KEY`,bO=`${dO}_STACK_START`,xO=`${dO}_STACK_END`,SO=`${dO}_STACK_START_PERCENT`,AO=`${dO}_STACK_END_PERCENT`,kO=`${dO}_STACK_START_OffsetSilhouette`,MO=`${dO}_STACK_END_OffsetSilhouette`,TO=`${dO}_STACK_TOTAL`,wO=`${dO}_STACK_TOTAL_PERCENT`,CO=`${dO}_STACK_TOTAL_TOP`,EO=`${dO}_STACK_TOTAL_BOTTOM`,BO=`${dO}_MOSAIC_VALUE_START_PERCENT`,PO=`${dO}_MOSAIC_VALUE_END_PERCENT`,LO=`${dO}_MOSAIC_CAT_START_PERCENT`,RO=`${dO}_MOSAIC_CAT_END_PERCENT`,OO=`${dO}_SEGMENT_START`,IO=`${dO}_SEGMENT_END`,DO=`${dO}_KEY`,FO=`${dO}_MAP_LOOK_UP_KEY`;function zO(t,e){for(let i=0;it.key===e))}function HO(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 NO(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:{groupField:a.groupField,nodes:{}},YO(t,a,n[o],l,e,r))})),s?VO(n):n}function VO(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))):VO(t[e].nodes);return t}function UO(t,e){if("values"in t&&t.values.length){const i=WL(t.values,e),s=UL(t.values,AO);t.values.forEach((t=>{t[TO]=i,t[wO]=s}))}else for(const i in t.nodes)UO(t.nodes[i],e)}function WO(t){if(!t.values.length)return;const e=t.values[t.values.length-1][xO]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)GO(t.nodes[r],e,i,s,n)}function YO(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[xO]=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 l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),YO(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const $O=(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]=KO(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function qO(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>QO(t.style(e,i,s,n)):P(t.style)||(e.style=QO(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>QO(t.state[e](i,s,n,r)):P(t.state[e])||(i[e]=QO(t.state[e]))})),e.state=i}return e}function ZO(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>QO(t[i](e,s,n,r)):P(t[i])||(e[i]=QO(t[i]))})),e}function JO(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),QO(i)}function QO(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:ae(t.angle)}):t}const tI=t=>"line"===t||"area"===t,eI=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return tI(i)?e:null==e?void 0:e[0]},iI=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let sI=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},n=NR.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{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(NR.getComposedEvent(t))if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};var nI;!function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(nI||(nI={}));const rI=["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 aI,oI,lI;t.ChartEvent=void 0,(aI=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",aI.rendered="rendered",aI.renderFinished="renderFinished",aI.animationFinished="animationFinished",aI.regionSeriesDataFilterOver="regionSeriesDataFilterOver",aI.afterInitData="afterInitData",aI.afterInitEvent="afterInitEvent",aI.afterInitMark="afterInitMark",aI.rawDataUpdate="rawDataUpdate",aI.viewDataFilterOver="viewDataFilterOver",aI.viewDataUpdate="viewDataUpdate",aI.viewDataStatisticsUpdate="viewDataStatisticsUpdate",aI.markDeltaYUpdate="markDeltaYUpdate",aI.viewDataLabelUpdate="viewDataLabelUpdate",aI.scaleDomainUpdate="scaleDomainUpdate",aI.scaleRawDomainUpdate="scaleRawDomainUpdate",aI.scaleUpdate="scaleUpdate",aI.dataZoomChange="dataZoomChange",aI.drill="drill",aI.layoutStart="layoutStart",aI.layoutEnd="layoutEnd",aI.layoutRectUpdate="layoutRectUpdate",aI.playerPlay="playerPlay",aI.playerPause="playerPause",aI.playerEnd="playerEnd",aI.playerChange="playerChange",aI.playerForward="playerForward",aI.playerBackward="playerBackward",aI.scrollBarChange="scrollBarChange",aI.brushStart="brushStart",aI.brushChange="brushChange",aI.brushEnd="brushEnd",aI.brushClear="brushClear",aI.brushActive="brushActive",aI.legendSelectedDataChange="legendSelectedDataChange",aI.legendFilter="legendFilter",aI.legendItemClick="legendItemClick",aI.legendItemHover="legendItemHover",aI.legendItemUnHover="legendItemUnHover",aI.tooltipShow="tooltipShow",aI.tooltipHide="tooltipHide",aI.tooltipRelease="tooltipRelease",aI.afterResize="afterResize",aI.afterRender="afterRender",aI.afterLayout="afterLayout",aI.afterMarkLayoutEnd="afterMarkLayoutEnd",aI.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(oI||(oI={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(lI||(lI={}));const hI=[lI.mark,lI.model,lI.chart,lI.vchart];class cI{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(lI.vchart,[]),this._levelNodes.set(lI.chart,[]),this._levelNodes.set(lI.model,[]),this._levelNodes.set(lI.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const dI={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"};class uI{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=L(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>eI(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||oI.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||oI.chart);o.get(t)||o.set(t,new cI);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||oI.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||oI.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||oI.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||oI.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?hI.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[oI.chart,oI.window,oI.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.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&&L(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 dI[a]&&(a=dI[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)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?lI.model:lI.vchart:lI.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=St(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=xt(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=oI.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==lI.model&&s!==lI.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=lI.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case oI.chart:return this._viewBubbles;case oI.window:return this._windowBubbles;case oI.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case oI.chart:return this._viewListeners;case oI.window:return this._windowListeners;case oI.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return rI.includes(t)||Object.values(nI).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&NR.hasInteractionTrigger(e)}}function pI(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function gI(t,e,i){t.getParser(e)||t.registerParser(e,i)}const fI=new Map;let mI;function vI(){mI||(mI=new Ea,gI(mI,"geojson",Aa),gI(mI,"topojson",Ma),pI(mI,"simplify",Wr))}function _I(t,e,i={type:"geojson",centroid:!0}){fI.has(t)&&Hy(`map type of '${t}' already exists, will be overwritten.`),vI();const s=new Ba(mI),n=j({},{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}),fI.set(t,s)}function yI(t){fI.has(t)?fI.delete(t):Hy(`map type of '${t}' does not exists.`)}function bI(t,e=!1){let i=e;return t.latestData instanceof Ba&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const xI=(t,e)=>0===t.length?[]:1===t.length?bI(t[0],null==e?void 0:e.deep):t.map((t=>bI(t,null==e?void 0:e.deep)));function SI(e,i,s){pI(i=i instanceof Ea?i:e.dataSet,"copyDataView",xI);const n=new Ba(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function AI(t,e,i=[]){var s;if(t instanceof Ba)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new Ba(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return Hy(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return Hy(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!_(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),Hy("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function kI(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var MI,TI,wI,CI;t.TransformLevel=void 0,(MI=t.TransformLevel||(t.TransformLevel={}))[MI.copyDataView=-10]="copyDataView",MI[MI.treemapFilter=-8]="treemapFilter",MI[MI.treemapFlatten=-7]="treemapFlatten",MI[MI.dotObjFlat=-7]="dotObjFlat",MI[MI.linkDotInfo=-7]="linkDotInfo",MI[MI.sankeyLayout=-7]="sankeyLayout",MI[MI.dataZoomFilter=-6]="dataZoomFilter",MI[MI.legendFilter=-5]="legendFilter",function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(TI||(TI={})),function(t){t.data="data",t.mark="mark"}(wI||(wI={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(CI||(CI={}));const EI=["line","area","trail"];function BI(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(DO,i?t.slice().sort(i):t.slice()),{keys:[DO],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const PI=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function LI(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{LI(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function OI(t,e,i,s){const n=BI(t,(t=>i(t))),r=BI(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!u(t)){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}}const II=`${dO}_BuiltIn_CallBack_Disappear`;var DI;!function(t){t.render="render",t.disappear="disappear"}(DI||(DI={}));class FI{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(e,i){this._count=0,this._rootMarks=[],this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{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._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var e,i,s,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:u,background:f}=this._option;A_.setEnv(function(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}(o),null!=l?l:{}),this._stage=null!==(e=this._option.stage)&&void 0!==e?e:new F_(Object.assign({background:f,width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,canvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:u},ReactDOM:this._option.ReactDOM,autoRefresh:p(r)?r:!p(a)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{})),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const m=Lp({x:0,y:0,width:this._width,height:this._height});m.name="root",this._stage.defaultLayer.appendChild(m),this._rootGroup=m;const v=(p(h)?h:Yy(o))&&!1!==c&&NR.getStageEventPlugin("gesture");v&&(this._gestureController=new v(this._stage,g(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=CI.before}_setCanvasStyle(){if(this._stage&&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")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(A_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=A_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>LI(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>LI(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{LI(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;this._hasCommitedMark()&&(jy(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),this._rootMarks.forEach((t=>{t.render()})),this._layoutState===CI.before&&(this._layoutState=CI.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=CI.reevaluate,this._hasCommitedMark()&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),this.findProgressiveMarks(),this.updateStateAnimation(),this._doRender(!0),this.doPreProgressive(),jy(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=RI(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=OI(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=OI(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=BI(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=BI(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}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];y(s)?e[i]="disappear"===i?s.map((t=>{return"function"==typeof(e=t.callBack)&&/^class\s/.test(e.toString())?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:II,customParameters:{callBack:t.callBack}});var e})):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{LI(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===TI.appear))?TI.appear:e.every((t=>t===TI.disappear))?TI.disappear:TI.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===oI.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=e;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=i.parent,i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:eI(o),markId:h,modelId:c,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===oI.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===oI.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===oI.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===oI.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===oI.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this.releaseGrammar(!0),this._stage!==(null===(t=this._option)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{LI(t,(t=>{t.removeProduct()}),null,!0)})):this._cachedMarks=RI(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return Gy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&function(t){return xu(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{So.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()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{LI(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=A_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){A_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function zI(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:Ny)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function jI(t){t.crosshair=Y(t.crosshair||{}).map((e=>HR({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function HI(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}=ai(l,i.width,i.height);a=t,o=e}else if(h&&Gy(e.mode)){let t;t=_(h)?A_.getElementById(h):h;const{width:e,height:s}=ai(t,i.width,i.height);a=e,o=s}else if($y(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 NI(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function VI(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}}var UI,WI,GI,YI,$I,XI;t.LayoutZIndex=void 0,(UI=t.LayoutZIndex||(t.LayoutZIndex={}))[UI.SeriesGroup=0]="SeriesGroup",UI[UI.Axis_Grid=50]="Axis_Grid",UI[UI.CrossHair_Grid=100]="CrossHair_Grid",UI[UI.Region=450]="Region",UI[UI.Mark=300]="Mark",UI[UI.Node=400]="Node",UI[UI.Axis=100]="Axis",UI[UI.MarkLine=500]="MarkLine",UI[UI.MarkArea=100]="MarkArea",UI[UI.MarkPoint=500]="MarkPoint",UI[UI.DataZoom=500]="DataZoom",UI[UI.ScrollBar=500]="ScrollBar",UI[UI.Player=500]="Player",UI[UI.Legend=500]="Legend",UI[UI.CrossHair=500]="CrossHair",UI[UI.Indicator=500]="Indicator",UI[UI.Title=500]="Title",UI[UI.Label=500]="Label",UI[UI.Brush=500]="Brush",UI[UI.CustomMark=500]="CustomMark",UI[UI.Interaction=700]="Interaction",t.LayoutLevel=void 0,(WI=t.LayoutLevel||(t.LayoutLevel={}))[WI.Indicator=10]="Indicator",WI[WI.Region=20]="Region",WI[WI.Axis=30]="Axis",WI[WI.DataZoom=40]="DataZoom",WI[WI.Player=40]="Player",WI[WI.ScrollBar=40]="ScrollBar",WI[WI.Legend=50]="Legend",WI[WI.Title=70]="Title",WI[WI.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(GI=t.AttributeLevel||(t.AttributeLevel={}))[GI.Default=0]="Default",GI[GI.Theme=1]="Theme",GI[GI.Chart=2]="Chart",GI[GI.Base_Series=3]="Base_Series",GI[GI.Series=4]="Series",GI[GI.Mark=5]="Mark",GI[GI.User_Chart=6]="User_Chart",GI[GI.User_Series=7]="User_Series",GI[GI.User_Mark=8]="User_Mark",GI[GI.User_SeriesStyle=9]="User_SeriesStyle",GI[GI.Built_In=99]="Built_In";class KI{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({},KI.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]))))}}KI.defaultMarkInfo={};class qI{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class ZI{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=>HR({},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 JI extends qI{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}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=ZI,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new KI,this._lastLayoutRect=null,this.id=Ky(),this.userId=t.id,this._spec=t,this.effect={},this.event=new sI(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){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}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){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_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){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${dO}_${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,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=NR.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_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 L(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}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class QI{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}get lastComputeRect(){return this._lastComputeRect}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}get willLayoutTag(){return this._willLayoutTag}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._willLayoutTag=!0,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){let a=MR(wR(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),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:kR(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:kR(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:kR(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:kR(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:kR(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:kR(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=kR(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=kR(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){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_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]=kR(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(TR(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class tD extends JI{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,this._transformLayoutPadding=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 QI(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&U(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.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,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 eD extends ZI{_initTheme(t,e){return{spec:t,theme:this._theme}}}class iD extends tD{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=eD,this.modelType="region",this.specKey="region",this.type=iD.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,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"}_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,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[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.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex: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()}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,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(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})}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=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function sD(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 nD(t,e,i){e?t.forEach((t=>{const e=$(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=$(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 rD(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 aD(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=cD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),rD(d,!0,p,l),s&&nD(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function oD(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=cD(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=cD(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),rD(d,!1,p,o),s&&nD(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function hD(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=cD(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_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){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_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,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=cD(t,this,e);"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,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=sD(t);n.length&&aD(n,e,i,!1,"left",s),r.length&&aD(r,e,i,!0,"left",s),a.length&&oD(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=sD(t);n.length&&lD(n,e,i,!1,"top",s),r.length&&lD(r,e,i,!0,"top",s),a.length&&hD(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=sD(t);n.length&&aD(n,e,i,!1,"right",s),r.length&&aD(r,e,i,!0,"right",s),a.length&&oD(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=sD(t);n.length&&lD(n,e,i,!1,"bottom",s),r.length&&lD(r,e,i,!0,"bottom",s),a.length&&hD(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=cD(t,this,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=>{U(i.getLayoutRect(),e.rect)||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{rect:i}=cD(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);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+c-l})}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+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&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:Ny)("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}}}dD.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(YI||(YI={})),t.STATE_VALUE_ENUM=void 0,($I=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",$I.STATE_HOVER="hover",$I.STATE_HOVER_REVERSE="hover_reverse",$I.STATE_DIMENSION_HOVER="dimension_hover",$I.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",$I.STATE_SELECTED="selected",$I.STATE_SELECTED_REVERSE="selected_reverse",$I.STATE_SANKEY_EMPHASIS="selected",$I.STATE_SANKEY_EMPHASIS_REVERSE="blur",$I.STATE_HIGHLIGHT="highlight",$I.STATE_BLUR="blur",$I.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(XI||(XI={}));const uD=["linear","radial","conical"],pD={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const gD={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{gD[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class fD extends qI{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(j(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class mD extends fD{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:{}})}))}_isMultiMark(){return!this._mark||(t=this._mark.type,EI.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!gD[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(y(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(dO)));i=t.datums.some((t=>e&&y(null==t?void 0:t.items)?n.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])})):n.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(dO))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(NC(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class vD extends qI{constructor(){super(...arguments),this.id=Ky(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=NR.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class _D extends vD{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}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._data=null,this._data=e}removeProduct(){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const yD=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,bD=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=yD(l.delay,n,a,o),d=yD(l.duration,n,a,o),u=yD(l.oneByOne,n,a,o),p=yD(l.splitPath,n,a,o),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)?Vw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Uw)(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);zw(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{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)?Vw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Uw)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Ow(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Dw(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:Ko.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 Fw({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Ew,null!==(l=i.easing)&&void 0!==l?l:Bw))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:Ko.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new jw({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Ew,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Bw))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):zw(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},xD=(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))))},SD=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}};class AD extends vD{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}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){u(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];y(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new _D(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}u(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=Lp("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){u(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(){this._product&&this._product.parent&&this._product.parent.removeChild(this._product),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Ul)),i&&(d(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==YI.enter&&t.context.diffState!==YI.update||(t.stateProxy=(e,i)=>{var s;return this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)},t.context.states&&t.useStates(t.context.states,e))},this.name=e,this.model=i.model,this.key=i.key,this.state=new mD(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_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,ae)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];u(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}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){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[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"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&HR(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(VC(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=vR(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),e.clamp&&t.clamp&&t.clamp(e.clamp))}(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=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):uD.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):VC(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=d(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_computeGradientAttr(t){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=t,c=e(t,["gradient","scale","field"]);let u=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(u=t),g||(g=e)}const f=lR(oR(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},pD[o]),c);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==u?void 0:u.scale(t[g]);return d(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=ei.SetOpacity(a,s)),{offset:d(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):d(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];d(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)uD.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=lR(oR(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return BI(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._graphics=t.getGraphics(),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear)}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return NR.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=d(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[mO],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=BI(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===TI.appear))?TI.appear:t.every((t=>t===TI.disappear))?TI.disappear:t[0];return null!=e?e:TI.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{SD(t),s.push(...t.getGraphics())})),e.forEach((t=>{SD(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);bD([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=xD(e,n),r=xD(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===TI.exit?TI.exit:i===TI.update?TI.update:TI.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===YI.exit&&(t.context.reusing=!0,t.animates&&t.animates.forEach((t=>t.stop())))}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===YI.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,d,p,g;let f,m;return u(e)?(f=this._graphicMap.get(t),f&&(m=YI.exit)):u(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=YI.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=YI.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(d=f.context)||void 0===d?void 0:d.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=TI.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=TI.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return PI(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=PI(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(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))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach(((t,e)=>{var i,n;let r=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i.update,t);null===(n=t.currentStates)||void 0===n||n.forEach((e=>{var i;const s=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i[e],t);r=Object.assign(Object.assign({},r),s)})),u(this._markConfig.interactive)||(r.pickable=this._markConfig.interactive);const a=this._transformGraphicAttributes(t,r,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=a}))}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r,a;const o=i.context.finalAttrs,l=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=iI(i,o);i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes({}),i.context.reusing=!1):l||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),!(null===(a=this.renderContext)||void 0===a?void 0:a.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i),e&&i.setFinalAttributes(o)}else{const a=i;i=this._createGraphic(o),e&&(null===(n=i.setFinalAttributes)||void 0===n||n.call(i,o)),i.context=a.context,i.context.diffAttrs=o,i.stateSort=this._stateSort;const l=this._graphics===t?s:s+this._graphics.length-t.length;if(l>=0&&(this._graphics[l]=i),null===(r=this.renderContext)||void 0===r?void 0:r.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,l),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(u(e)||(t.zIndex=e),u(i)||(t.clip=i),!u(s)){const e=y(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return u(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=NR.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=NR.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=Y(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===CI.before||(jy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{"in"===this.state.checkOneState(i,i.context.data,e)?i.addState(t,!0,this.hasAnimationByState("state")):i.removeState(t,this.hasAnimationByState("state"))}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===YI.exit&&!e.isExiting)if(e.context.animationState===YI.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:YI.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=Lp({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}}var kD;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(kD||(kD={}));class MD extends AD{constructor(){super(...arguments),this.type=MD.type,this._marks=[],this._diffState=YI.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(Hy("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?(Hy("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))}getMarkInUserId(t){let e;return LI(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.diffState===YI.update){const t=this.hasAnimation(),e=iI(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e)),t&&this._product.setFinalAttributes(i)}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=YI.update}render(){this._isCommited&&(jy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct()}}MD.type="group";const TD={measureText:cO};class wD{static instance(){return wD.instance_||(wD.instance_=new wD),wD.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 CD{constructor(){this.id=Ky(),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))?Hy("不要重复添加相同的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 ED extends CD{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)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const BD={type:"fadeIn"};function PD(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 BD;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const LD={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"},state:{duration:300,easing:"linear"}},RD={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},OD={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},ID=()=>{NR.registerAnimation("scaleInOut",(()=>RD))},DD=()=>{NR.registerAnimation("fadeInOut",(()=>OD))},FD=(t,e)=>({appear:PD(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:$w,duration:LD.update.duration,easing:LD.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),zD=()=>{NR.registerAnimation("line",FD)},jD=()=>{pw.registerBuiltInAnimate("growPointsIn",hC),pw.registerBuiltInAnimate("growPointsOut",cC),pw.registerBuiltInAnimate("growPointsXIn",uC),pw.registerBuiltInAnimate("growPointsXOut",pC),pw.registerBuiltInAnimate("growPointsYIn",fC),pw.registerBuiltInAnimate("growPointsYOut",mC),pw.registerBuiltInAnimate("clipIn",qw),pw.registerBuiltInAnimate("clipOut",Zw)},HD=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class ND{constructor(t){this._markSet=new KI,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){y(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.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 VD={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class UD extends ND{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},VD,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}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}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll(e)}}UD.type="element-highlight",UD.defaultOptions=VD;const WD=()=>{NR.registerInteractionTrigger(UD.type,UD)},GD={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class YD extends ND{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},GD,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}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,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),t.addState(i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll(e)}}YD.type="element-select",YD.defaultOptions=GD;const $D=()=>{NR.registerInteractionTrigger(YD.type,YD)};class XD extends CD{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class KD{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>NR.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>NR.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>NR.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return NR.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>NR.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){NR.registerTransform(t,e)}static registerFunction(t,e){t&&e&&wD.instance().registerFunction(t,e)}static unregisterFunction(t){t&&wD.instance().unregisterFunction(t)}static getFunction(t){return t?wD.instance().getFunction(t):null}static getFunctionList(){return wD.instance().getFunctionNameList()}static registerMap(t,e,i){const s=NR.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=NR.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,fI.get(e);var e}static registerSVG(t,e,i){const s=NR.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=NR.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){iO.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}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d,u;this.id=Ky(),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._renderState=DI.render,this._disableDimensionHoverEvent=!1,this._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))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;U(n.theme,this._spec.theme)?U(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=NI(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?NR.getSeriesBuiltInTheme(e):NR.getComponentBuiltInTheme(e);i=i?HR({},s,i[e]):s}s===t.length-1&&p(i)&&(i=aO({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},tR(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:y,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=Gy(v);if(S?rx(bo):"node"===v&&US(bo),S&&f&&(this._container=_(f)?A_.getElementById(f):f),m&&(this._canvas=m),y&&(this._stage=y),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=sO.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[];!1!==b&&A.push("poptipForText"),"sankey"===i.type&&A.push("scrollbar");const k=new at(null!==(a=this._option.logLevel)&&void 0!==a?a:rt.Error);at.setInstance(k),(null===(o=this._option)||void 0===o?void 0:o.onError)&&k.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._compiler=new FI({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:y,pluginList:A},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new uI(this,this._compiler),this._event=new sI(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),iO.registerInstance(this),null===(u=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===u||u.call(d,this)}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=HR({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=oO(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;KD.getFunctionList()&&KD.getFunctionList().length&&(t=lO(t,KD)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=NR.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=NR.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=NR.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._chartSpecTransformer),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)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=St(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.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 HI(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:uO,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:pO})}_initDataSet(t){this._dataSet=t instanceof Ea?t:new Ea,gI(this._dataSet,"dataview",Ta),gI(this._dataSet,"array",s),pI(this._dataSet,"copyDataView",xI);for(const t in NR.transforms)pI(this._dataSet,t,NR.transforms[t]);for(const t in NR.dataParser)gI(this._dataSet,t,NR.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake?(null===(n=this._compiler)||void 0===n||n.releaseGrammar(),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.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.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),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),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(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"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?TI.none:TI.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}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._cachedProcessedTheme=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,iO.unregisterInstance(this)}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):y(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._reSetRenderState(),u(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof Ba?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=AI(t,this._dataSet,s);y(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?HR({},t[n][e.index],i):i):t[n]=s?HR({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?HR({},t[n][r],i):i)}else t.id===e&&(t[n]=s?HR({},t[n],i):i)}))}(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=HR({},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),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,this),!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)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=VR({},e,e.chart[t])),e};let l;if(P(n)&&P(r))l=nO(this._currentThemeName),this._currentTheme=o(a,l);else if(_(n)&&(!r||_(r))||_(r)&&(!n||_(n))){const t=VR({},nO(this._currentThemeName),nO(n),nO(r));this._currentTheme=o(a,t)}else{const t=VR({},nO(this._currentThemeName),nO(n),nO(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),j(GM.poptip,WM,h),null===(s=this._compiler)||void 0===s||s.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=!!Gy(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return nO(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!sO.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),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}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield zI(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(!Gy(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;this._chart.resetLayoutItemTag(),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)?A_.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)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(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?CR(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||P(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 Hy("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?CR(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Hy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return wD.instance().getFunction(t)}registerFunction(t,e){t&&e&&wD.instance().registerFunction(t,e)}unregisterFunction(t){t&&wD.instance().unregisterFunction(t)}getFunctionList(){return wD.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=NR.getChartPlugins();t.length>0&&(this._chartPlugin=new ED(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=NR.getVChartPlugins();e.length>0&&(this._vChartPlugin=new XD(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_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,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=DI.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){this._renderState=DI.render,this.getStage().eventSystem.resumeTriggerEvent()}}KD.InstanceManager=iO,KD.ThemeManager=sO,KD.globalConfig={uniqueTooltip:!0},KD.Utils=TD,KD.vglobal=A_;NR.registerRegion("region",iD),NR.registerLayout("base",dD),Jk(),zk(),NR.registerMark(MD.type,MD),NR.registerStageEventPlugin("gesture",Cb),WD(),$D(),ZR(IR.name,IR);const qD="monotone",ZD="linear",JD="bevel";function QD(t,e){return e("component",t)}function tF(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=NR.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));const eF=(t,e,i,s)=>{if(u(t[e]))return;const n=y(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},iF=(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)))},sF=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},nF=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):m(t)&&p(t.field)?L(e,t.field):t,s){const{formatFunc:i,args:r}=tF(void 0,s,t,e);i&&r&&(n=i(...r))}return n},rF=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const aF=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(y(e.activeType)?e.activeType.includes(t):e.activeType===t)));function oF(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=u(i.key)&&u(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:d,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:_}=l,y=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=hF(nF(h,r,a,c),d,g),o.value=hF(nF(f,r,a,m),v,_),Object.keys(y).forEach((t=>{o[t]=nF(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};y(i)?i.forEach((t=>{o(t)})):o(i)}function lF(t,e,i,s,n,r,a){if(d(e)){oF(t,e(n,a),i,s,r,a)}else e&&oF(t,e,i,s,r,a)}const hF=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=fi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class cF{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},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.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{y(t)?t.forEach((t=>{lF(a,t,e,i,s,n,r)})):d(t)?lF(a,t,e,i,s,n,r):t&&oF(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=d(e)?e(s,n):e;if(r?u(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){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}(s),e={visible:nF(r.visible,t,n),value:hF(nF(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:nF(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=nF(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&aF(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const dF={min:t=>t.length?K(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?K(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}},uF=(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=zO([],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 pF(a,n,o)},pF=(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&&t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{qy(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=>{qy(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&&!0===o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=dF[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},gF=(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=>{qy(t[e])||(t[e]=0)}))})),t},fF=`${dO}_HIERARCHY_DEPTH`,mF=`${dO}_HIERARCHY_ROOT`,vF=`${dO}_HIERARCHY_ROOT_INDEX`;function _F(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function yF(t,e,i){t&&(i.needDefaultSeriesField&&(t[vO]=i.defaultSeriesField),t[fO]=e,t[mO]=i.getKey(t,e,i))}function bF(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function xF(t,e,i,s=0,n,r){void 0===r&&(r=e),yF(t,e,i),t[fF]=s,t[mF]=n||t[i.categoryField],t[vF]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>xF(e,s,i,t[fF]+1,t[mF],r)))}const SF={label:{name:"label",type:"text"}},AF=`${dO}_rect_x`,kF=`${dO}_rect_x1`,MF=`${dO}_rect_y`,TF=`${dO}_rect_y1`,wF={data:!0},CF={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},EF=[...Object.keys(LD),"normal"];function BF(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 IF(n)&&delete n.type,n.oneByOne&&(n=LF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:RF,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=HR({},o[e],a);return IF(n)&&delete n.type,n.oneByOne&&(n=LF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:RF,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function PF(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=I(t,null,i),DF(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}),i),t}(h,i)}function LF(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.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function RF(t,e){var i;return null!==(i=null==t?void 0:t[fO])&&void 0!==i?i:e.context.graphicIndex}function OF(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 IF(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function DF(t,e,i=[]){if(y(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),DF(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),DF(t[s],e,i))}function FF(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class zF extends ZI{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=nR(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=NR.getSeriesMarkMap(o)?function(t,e,i){const s=NR.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=HR({},i("mark",Y(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return HR({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;Y(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(d(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,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=HR({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>HR({},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 jF extends JI{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)}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:`${dO}_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(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=zF,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=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.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=FF(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),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)&&(pI(this._rawData.dataSet,"invalidTravel",gF),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;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=AI(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=SI(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=SI(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new _D(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=K(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=pF(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=j(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){pI(this._dataSet,"dimensionStatistics",uF);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new Ba(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&&zO(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){pI(this._dataSet,"dimensionStatistics",uF);const s=new Ba(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=zO(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&zO(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new Ba(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)&&(pI(this._rawData.dataSet,"addVChartProperty",sF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:_F.bind(this),call:yF}},!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,i;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.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(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:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=BF({},PF(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)}))),!u(t.dataId)||!u(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(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:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_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"}}:Yy(s)||$y(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=HR(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=HR(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=HD(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=HD(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=HD(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:vO;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:_O,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,_O,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.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()}initTooltip(){this._tooltipHelper=new cF(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||e.visible!==t[i].visible))?i.reMake=!0:!i.reCompile&&e.some(((e,i)=>!U(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!U(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},wF),CF),i),{extensionMark:!0,label:!0,totalLabel:!0});return this._compareExtensionMarksSpec(Y(t.extensionMark),Y(e.extensionMark),s),!s.reMake&&this._compareLabelSpec(Y(t.label),Y(e.label),s),!s.reMake&&this._compareLabelSpec(Y(t.totalLabel),Y(e.totalLabel),s),s.reMake?s:(!s.reCompile&&this._marks.getMarks().some((i=>{var s,n;return r[i.name]=!0,(null===(s=e[i.name])||void 0===s?void 0:s.visible)!==(null===(n=t[i.name])||void 0===n?void 0:n.visible)}))&&(s.reCompile=!0),!s.reCompile&&n.some((i=>CF[i]&&!U(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!U(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Ba||kI(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.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();FF(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),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:vO,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new fR).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return oR(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:vO}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:d={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:_=!1}=e,y=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:_,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(y)){const e=this.getSpec()||{};this._marks.addMark(y,{name:t.name}),v&&(this._seriesMark=y),u(f)?y.setData(this._data):!1!==f&&y.setDataView(f),y.setSkipBeforeLayouted(!1!==c),u(h)||y.setGroupKey(h);const l=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:null!==(s=i.morph)&&void 0!==s&&s,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(n=i.support3d)&&void 0!==n?n:e.support3d||!!e.zField,morphKey:(null===(r=e.morph)||void 0===r?void 0:r.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});y.setMarkConfig(l),this.initMarkStyleWithSpec(y,HR({},d,g||e[y.name]))}return y}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:mO}_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!==xO&&t!==AO&&t!==bO&&t!==SO||(t=this.getStackValueField()),null!==(e=HO(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>qy(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:vO]}}function HF(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();NC(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 NF(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}}}jF.mark=SF,jF.transformerConstructor=zF;class VF extends jF{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);NC(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:`${dO}_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(xO),this.setFieldX2(bO)):(this.setFieldY(xO),this.setFieldY2(bO))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(AO),this.setFieldX2(SO)):(this.setFieldY(AO),this.setFieldY2(SO))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(MO),this.setFieldX2(kO)):(this.setFieldY(MO),this.setFieldY2(kO))}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)&&(HF("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)}}function UF(t){return"bottom"===t||"top"===t}function WF(t){return"left"===t||"right"===t}function GF(t){return"z"===t}function YF(t,e){return xR(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function $F(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function XF(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?UF(t)?"linear":"band":UF(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const KF=(t,e,i)=>{var s;const n=null!==(s="band"===e?QD("axisBand",i):["linear","log","symlog"].includes(e)?QD("axisLinear",i):{})&&void 0!==s?s:{},r=UF(t)?QD("axisX",i):WF(t)?QD("axisY",i):QD("axisZ",i);return HR({},QD("axis",i),n,r)};class qF{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:Ny)("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:Ny)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;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)))),r=n.filter((t=>UC(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return UF(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class ZF extends qF{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(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:oI.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const JF=(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))},QF=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},tz=(t,e,i,s)=>{var n;const r=e.getScale(),a=UC(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=Y(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.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))})),o.push({series:h,datum:e,key:ez(h,s)})}else if(p(i[1])){const e=[],s=[];l.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 r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{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("_")}`,iz=(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};class sz extends qF{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!JF(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:oI.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:oI.canvas}),callback:this.onMouseOut}),Yy(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:oI.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Yy(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var nz;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(nz||(nz={}));const rz={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class az{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",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.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(rz.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),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:JD,curveType:ZD,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===qD?"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){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(rz.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:OF(this._spec,rz.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new Ba(this._option.dataSet,{name:`${dO}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),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(nz.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[rz.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(nz.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,HR({},this._spec[rz.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.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=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},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.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const oz=Object.assign(Object.assign({},SF),rz),lz=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(y(t))return t.length===e.length&&t.every(((t,i)=>lz(t,e[i])));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]))},hz=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class cz extends AD{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return hz}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(u(o)||s.includes(a))return;r&&n.includes(a)&&(VC(null==o?void 0:o.type)||(null==o?void 0:o.scale)||d(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((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?lz(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n,r;const a=e.context.data,o=[],l=[],h={},c=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,d=c&&0===c.currentIndex;if(a.forEach(((e,i)=>{var s;l[i]={},o[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?l[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!c?o[i][s]=t[s](e):0!==i||c&&!d||(h[s]=t[s](e))})),l[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),c){const t=null!==(r=null===(n=e.attribute)||void 0===n?void 0:n.segments)&&void 0!==r?r:[];return t.push({points:l}),d?Object.assign(Object.assign({},h),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(o,l);if(t)return Object.assign(Object.assign(Object.assign({},h),o[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},h),o[0]),{points:l,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:YI.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[mO]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}class dz extends cz{constructor(){super(...arguments),this.type=dz.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)===iR.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}dz.type="line";const uz=()=>{NR.registerMark(dz.type,dz),Jk(),Vk(),EB(),kB(),jD(),NR.registerGraphicComponent("line",Pg)};class pz extends AD{constructor(){super(...arguments),this.type=pz.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="circle":a.symbolType=o,a}}pz.type="symbol";const gz=()=>{NR.registerMark(pz.type,pz),Jk(),tM(),kB(),NR.registerGraphicComponent("symbol",Cg)};class fz extends zF{_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)}}function mz(t){return t.length>=2&&k(t[0])&&k($(t))&&$(t)>=t[0]}function vz(t,e){var i;const s=$(e)-e[0],n=$(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=$(e)>0?$(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!k(o.min),extendable_max:!k(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):$(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function _z(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 yz(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 bz(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 xz(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 Sz=(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=>t.type.includes("ticks"))))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)-p[0];if(0===g)return t;const f=c.domain(),m=$(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=se(t,e),a=Math.max(ee(i),ee(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return IC(v)};class Az{constructor(t){this.id=Ky(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class kz extends Az{constructor(){super(kz.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!NC(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&&mz(c)&&mz(d)))return;const u=vz(t,c),p=vz(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!yz(u,p))return}else if(0===y&&0===b){if(!yz(p,u))return}else if(_||A)if(_&&!A){if(!_z(u,p))return}else if(A&&!_){if(!_z(p,u))return}else{if(f===b)return;if(f>b){if(!bz(u,p))return}else if(!bz(p,u))return}else{if(0===f&&0===y){if(!xz(u,p))return}else if(0===b&&0===g&&!xz(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===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){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){pI(e.getOption().dataSet,"tickAlign",Sz);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}kz.pluginType="component",kz.type="AxisSyncPlugin";const Mz={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function Tz(t){let e=0;return L(t,"tick.visible")&&(e+=L(t,"tick.tickSize")),L(t,"label.visible")&&(e+=L(t,"label.space")),e}function wz(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 Cz(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const Ez=t=>"band"===t||"ordinal"===t||"point"===t;function Bz(t,e){return{id:t,label:t,value:e,rawValue:t}}function Pz(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class Lz extends CD{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const Rz=`${dO}_ARC_TRANSFORM_VALUE`,Oz=`${dO}_ARC_RATIO`,Iz=`${dO}_ARC_START_ANGLE`,Dz=`${dO}_ARC_END_ANGLE`,Fz=`${dO}_ARC_K`,zz=`${dO}_ARC_MIDDLE_ANGLE`,jz=`${dO}_ARC_QUADRANT`,Hz=`${dO}_ARC_RADIAN`,Nz=-Math.PI/2,Vz=3*Math.PI/2,Uz=.6,Wz=(t,e,i,s)=>{const n=t();if(S(n))return n;if(d(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return pe(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},Gz=(t,e,i)=>{var s;const n=null!==(s="band"===e?QD("axisBand",i):"linear"===e?QD("axisLinear",i):{})&&void 0!==s?s:{},r=QD("angle"===t?"axisAngle":"axisRadius",i);return HR({},QD("axis",i),n,r)};function Yz(t,e,i,s){switch(t){case r.cartesianBandAxis:return KF(YF(i,["z"]),"band",e);case r.cartesianLinearAxis:return KF(YF(i,["z"]),"linear",e);case r.cartesianLogAxis:return KF(YF(i,["z"]),"log",e);case r.cartesianSymlogAxis:return KF(YF(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return KF(YF(i),void 0,e);case r.polarBandAxis:return Gz(i.orient,"band",e);case r.polarLinearAxis:return Gz(i.orient,"linear",e);case r.polarAxis:return Gz(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,trigger:c,triggerOff:d}=null!==(s=QD(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>UF(t.orient)));let g;g=p(u)?HR({},Ez(u.type)?a:o,l):l;const f=n.find((t=>WF(t.orient)));let m;return m=p(f)?HR({},UC(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(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,trigger:c,triggerOff:d}=null!==(s=QD(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>"angle"===t.orient));let g;g=p(u)?HR({},Ez(u.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?HR({},UC(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return $z(i,QD(t,e));default:return QD(t,e)}}const $z=(t,e)=>{var i;const s=HR({},e,e[$F(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class Xz extends ZI{getTheme(t,e){return Yz(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({},wR(e)),{[s]:0}))}}class Kz extends tD{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=Xz,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof zc||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:oI.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}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 Lz(this)}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)))}_getNeedClearVRenderComponents(){return[]}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=>!U(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&&(t.release(!0),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=>{e.compile({group:t,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}}getDatum(t){}}var qz,Zz;Kz.transformerConstructor=Xz,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(qz||(qz={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(Zz||(Zz={}));class Jz extends AD{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}clearComponent(){this._component&&(this._component.parent&&this._component.parent.removeChild(this._component),this._component=null)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=NR.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(nI.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){super.release(),this.removeProduct()}}Jz.type="component";const Qz=()=>{NR.registerMark(Jz.type,Jz)},tj=t=>t;class ej extends Kz{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._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,y,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?qz.circleAxis:qz.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?Zz.circleAxisGrid:Zz.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if((null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==L(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=BF(null===(h=NR.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(d=null!==(c=this._spec.animationAppear)&&void 0!==c?c:L(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==d?d:L(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(u=this._spec.animationDisappear)&&void 0!==u?u:L(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:L(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:L(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:L(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(_=null!==(v=this._spec.animationExit)&&void 0!==v?v:L(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==_?_:L(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(y=this._spec.animationUpdate)&&void 0!==y?y:L(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b:L(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()),e=new _D(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return qL(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=y(a)?NC(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!NC(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return qL(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=ZL(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()})),qL(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(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&U(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):qL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(qL(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_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=qO(s=t.domainLine)).startSymbol=qO(s.startSymbol),s.endSymbol=qO(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 QO(HR({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:QO(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>QO(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=QO(t[i]))})),e}(t.label.state)),d(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}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:d(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},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 QO(HR({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:QO(t.tick.style)),t.tick.state&&(i.tick.state=ZO(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 QO(HR({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:QO(t.subTick.style)),t.subTick.state&&(i.subTick.state=ZO(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=Mz[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?ae(p):null,textStyle:HR({},d,QO(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:QO(h.style)}),h.state&&(i.title.state.shape=ZO(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:QO(o.style)}),o.state&&(i.title.state.background=ZO(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=ZO(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=QO(t.background.style)),t.background.state&&(i.panel.state=ZO(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:hO(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 QO(HR({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:QO(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:hO(t.subGrid.alternateColor),style:QO(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=tF(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){gI(this._option.dataSet,"scale",tj);const i=this.registerTicksTransform();return new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,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)}getDatum(t){var e;return t&&t.name===vT.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}ej.specKey="axes";const ij=()=>{Qz(),NR.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},sj=[kz];class nj extends ej{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}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),qL(this._regions,(t=>{const e=this.getOrient();UF(e)?Pz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):WF(e)?Pz(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):GF(e)&&Pz(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&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._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=HR({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(HR({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=UF(this.getOrient()),n=t=>{var e;return(s?!UF(t.getOrient()):UF(t.getOrient()))&&NC(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())>=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,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=YF(i,["z"]),GF(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(!Cz(e))return null;const{axisType:t,componentName:s}=XF(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=>WF(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(!Cz(t))return;const{axisType:s,componentName:n}=XF(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=NR.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}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return UF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):GF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(sj.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){UF(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&&!UF(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!GF(this.getOrient())&&this._spec.innerOffset){const t=this._spec;WF(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=kR(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=kR(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=UF(this.getOrient())?t.fieldX:GF(this.getOrient())?t.fieldZ:t.fieldY,NC(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;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,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:NC(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 t;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(nI.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(UF(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._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=UF(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:K(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return qL(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]:UF(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:GF(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();qL(this._regions,(e=>{UF(t)?Pz(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):WF(t)?Pz(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):GF(t)&&Pz(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(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=UF(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=UF(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)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=HR(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new He).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=UF(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?vt(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):vt(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-$(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&u(null===(e=a.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=a.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 o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return Bz(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:NC(this._scale.type)?i>=s[0]&&i<=$(s):s.includes(i)}))]:[]}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 i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}nj.type=r.cartesianAxis,nj.specKey="axes";const rj=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function aj(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,lj=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function hj(t,e,i="count"){const s=lj(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const cj=Math.sqrt(50),dj=Math.sqrt(10),uj=Math.sqrt(2);class pj{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){p(this._spec.nice)&&(this._nice=this._spec.nice),p(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=wz(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(i.forceTickCount))e=i.forceTickCount;else if(d(i.tickCount)){const t=this._scale.range();let s=Math.abs($(t)-t[0]);if(1===s&&this._option){s=UF(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=k(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return u(s)&&u(n)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&u(n)&&u(this._softMaxValue)?this._scale.niceMax(e):!(!u(s)||!u(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return u(e)&&u(i)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&u(i)&&u(this._softMaxValue)?this._scale.niceMax():!(!u(e)||!u(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=u(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(oj),e.sort(oj),{domain:aj(t,e),scope:hj(t,e,i)}}(r,Fy(t),this._spec.breaks[0].scopeType);e=Fy(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return 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);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}=wz(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs(K(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[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=cj?10:n>=dj?5:n>=uj?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max($(t),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)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}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)-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}_updateRawDomain(){const e=this.collectData(0,!0),i=this.computeLinearDomain(e);this._rawDomain=i,this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}const gj={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},fj={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}}},mj={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}}},vj={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}}};class _j extends nj{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new PE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}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)}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!GF(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=UF(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=SR(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=Fy(this._break.scope).map((t=>i[0]+($(i)-i[0])*t))),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}registerTicksTransform(){const t=`${this.type}-ticks`;return pI(this._option.dataSet,t,HE),t}}_j.type=r.cartesianLinearAxis,_j.specKey="axes",_j.builtInTheme={axis:vj,axisLinear:gj,axisX:fj,axisY:mj},G(_j,pj);const yj=()=>{NR.registerGraphicComponent(qz.lineAxis,((t,e)=>new CC(t,e))),NR.registerGraphicComponent(Zz.lineAxisGrid,((t,e)=>new zB(t,e))),ij(),NR.registerComponent(_j.type,_j)};class bj{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new _D(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{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._spec.showAllGroupLayers?this._scales:[this._scales[0]]).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=Bz(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=>Bz(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const e=this._spec.domain;for(let t=0;tthis._rawDomainIndex[t][e]=i))}this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const xj={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}};class Sj extends nj{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new cE}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}}registerTicksTransform(){const t=`${this.type}-ticks`;return pI(this._option.dataSet,t,GE),t}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=eE(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{NR.registerGraphicComponent(qz.lineAxis,((t,e)=>new CC(t,e))),NR.registerGraphicComponent(Zz.lineAxisGrid,((t,e)=>new zB(t,e))),ij(),NR.registerComponent(Sj.type,Sj,!1)};class kj extends _j{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),qL(this._regions,(t=>{UF(this.getOrient())?Pz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):Pz(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=HR({},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 Ba(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.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 _D(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=fi.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=>Bz(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=>Bz(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return pI(this._option.dataSet,t,HE),t}transformScaleDomain(){}}kj.type=r.cartesianTimeAxis,kj.specKey="axes",kj.builtInTheme={axis:vj,axisX:fj,axisY:mj};class Mj extends _j{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new IE}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return pI(this._option.dataSet,t,HE),t}transformScaleDomain(){}}Mj.type=r.cartesianLogAxis,Mj.specKey="axes",Mj.builtInTheme={axis:vj,axisLinear:gj,axisX:fj,axisY:mj},G(Mj,pj);class Tj extends _j{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new DE}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return pI(this._option.dataSet,t,HE),t}transformScaleDomain(){}}Tj.type=r.cartesianSymlogAxis,Tj.specKey="axes",Tj.builtInTheme={axis:vj,axisLinear:gj,axisX:fj,axisY:mj},G(Tj,pj);const wj=`${dO}_hide_`;function Cj(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const Ej=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[wj]&&(Cj(t,!0),t[wj]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=u(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[wj]=!0,Cj(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},Bj=()=>{NR.registerGrammarTransform("symbolOverlap",{transform:Ej,runType:"afterEncode"})},Pj={min:K,max:X,average:GL,sum:WL};function Lj(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}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function Rj(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 Oj(t,e,i,s){return Rj(t,e,i,"min",s)}function Ij(t,e,i,s){return Rj(t,e,i,"max",s)}function Dj(t,e,i,s){return Rj(t,e,i,"average",s)}function Fj(t,e,i,s){return Rj(t,e,i,"sum",s)}const zj=(t,e)=>{let i=d(t.size)?t.size():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=Lj;if("min"===n?l=Oj:"max"===n?l=Ij:"average"===n?l=Dj:"sum"===n&&(l=Fj),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[]},jj=()=>{NR.registerGrammarTransform("dataSampling",{transform:zj})};class Hj extends VF{constructor(){super(...arguments),this.type=iR.line,this.transformerConstructor=fz,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.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(BF(null===(i=NR.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),PF("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=NF(this);this._symbolMark.setAnimationConfig(BF(null===(s=NR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),PF("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),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]}}Hj.type=iR.line,Hj.mark=oz,Hj.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},Hj.transformerConstructor=fz,G(Hj,az);class Nj{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{kI(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof Ba)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];Hy(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];Hy(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class Vj{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)=>{Zy(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{zO(e,[{key:t,operations:NC(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&&zO(e,[{key:i.field,operations:NC(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?vR("colorOrdinal"):vR(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(Zy(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),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(U(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;if(!U(r.specified,s.specified))return e.reMake=!0,e;s.range&&!U(s.range,n.range())&&(n.range(s.range),e.reRender=!0),Zy(s.domain)?e.reRender=!0:U(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(!Zy(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=NC(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=NC(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;NC(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(NC(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=NC(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(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)));NC(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 Uj{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&t.addState(i,!0,l):a&&t.addState(s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&t.addState(i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{t.removeState(i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&t.removeState(e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}class Wj extends qI{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){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=Ky(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:uO,height:pO},this._viewRect={width:uO,height:pO},this._viewBox={x1:0,y1:0,x2:uO,y2:pO},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=wR(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new sI(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new Nj(this._dataSet),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===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new Uj;const t=this.getAllSeries(),e=[],i={};t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=`${n}-${t.type}`;i[r]?s.forEach((t=>{i[r].marks.push(t)})):(i[r]=Object.assign(Object.assign({},t),{marks:s}),e.push(i[r]))}))}})),e.forEach((t=>{const e=NR.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(BF({},PF("stage",this._spec,{}),null))}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.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=H(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=NR.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({},i),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_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){const s=NR.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"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(){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e,this._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof JI)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 AD))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof AD)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}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&&kI(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=HI(this._spec,this._option,{width:uO,height:pO})),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),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=oR(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new Vj(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){NI(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=oR(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0};return Object.keys(t).filter((t=>!e[t])).sort()}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=this._getSpecKeys(this._spec);if(!U(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{NI(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[r.title]:!0,[r.brush]:!0,[r.indicator]:!0};this._components.forEach((s=>{var n,a;if(s.type===r.label||s.type===r.totalLabel)return;i[s.type]&&(i[s.type]=!1);const o=s.specKey||s.type,l=null!==(n=this._spec[o])&&void 0!==n?n:{};y(l)?(e[o]=e[o]||{specCount:l.length,componentCount:0},e[o].componentCount++,NI(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):NI(t,s.updateSpec(l))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}const s=t=>t&&!1!==t.visible;Object.keys(i).forEach((e=>{if(i[e]){const i=this._spec[e];(y(i)?i.some(s):s(i))&&(t.reMake=!0)}}))}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];NI(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=MR(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.resetLayoutItemTag(),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(){this._backgroundMark&&this._backgroundMark.compile()}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._option.globalInstance),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,this._option.globalInstance)}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._option.globalInstance),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,this._option.globalInstance)}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._option.globalInstance),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,this._option.globalInstance)}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(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(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(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(nI.AFTER_MARK_RENDER_END,e)};this._event.on(nI.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?Y(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:eI;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||d(e.filter)&&e.filter(o,l))){if(tI(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===nz.dimensionHover||s===nz.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=u(t)||!n||n.every((t=>UC(t.axis.getScale().type)&&u(t.index))),o=a||n.every((t=>UC(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(n))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(r.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(r.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),n=[];s.forEach((e=>{const i=t(e);!1!==i&&n.push({axis:e,value:i})})),i.showCrosshair(n)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const Gj=(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 Yj{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)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):FR(t,a,c.spec),FR(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));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=Gj(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=Gj(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,e,i){var s,n,r,a,o;const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,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},h=this.seriesType;return h&&(l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(NR.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(NR.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=NR.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=NR.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=NR.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.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):eF(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=eF(t,u.specKey,u.type))||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"];return 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}))}_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 $j extends Yj{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_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;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{u(i[t])&&(i[t]=n[t])})),L(i,"trimPadding")&&HR(i,VI(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class Xj extends $j{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),jI(t)}}const Kj=(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&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=NO(t,!0);for(const e in o)for(const i in o[e].nodes)GO(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)WO(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&UO(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}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 Zj{_beforeInit(){this._dataSet&&pI(this._dataSet,"stackSplit",Kj)}_initStack(){this._stack=new qj(this),this._stack.init()}}const Jj={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:nz.dimensionHover};class Qj extends ND{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},Jj,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=eI(i);let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}Qj.type="dimension-hover",Qj.defaultOptions=Jj;const tH=()=>{NR.registerInteractionTrigger(Qj.type,Qj)},eH=()=>{NR.registerComposedEvent(nz.dimensionHover,sz),NR.registerComposedEvent(nz.dimensionClick,ZF)},iH=t=>t.fieldX[0],sH=t=>t.fieldY[0],nH=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},rH=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},aH=(t,e)=>t?e?iH:nH:e?sH:rH,oH=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=iz(t,(t=>UF(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=iz(t,(t=>WF(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{UC(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((t=>{if(d.size>0){if(d.has(t)){const s=lH(t,i,aH(e,UC(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=lH(t,i,aH(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},lH=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:hH(t,s,i)},hH=(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=tz(e,t,"cartesian",null!=i?i:UF(t.getOrient())?iH:sH);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},cH=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:u,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,_=0,y=null;if(d.size){const t=Array.from(d.values())[0];_=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,y=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(_)&&!Number.isNaN(_),x=s&&!b&&p(u),S=x?u:{coordRange:[0,0],sizeRange:[0,0],coord:_,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:y};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(UC(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(NC(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,_=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=Tz(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(a=y.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&y&&null!==(o=y.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(l=y.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&y&&null!==(h=y.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(c=y.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&y&&null!==(d=y.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(u=y.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&y&&null!==(p=y.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};uH(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=_+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=_+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&dH(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),dH=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=tF(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},uH=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},pH=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=gH(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},gH=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},fH=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return cH(c,r,e),c.xField.cacheInfo?pH(c.xField):c.yField.cacheInfo?pH(c.yField):void 0},mH=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],vH=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&mH.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(_H(s).every((t=>{var e;return!aF("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},_H=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},yH={dom:`${dO}_TOOLTIP_HANDLER_DOM`,canvas:`${dO}_TOOLTIP_HANDLER_CANVAS`},bH={key:"其他",value:"..."};var xH;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(xH||(xH={}));class SH{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(u(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,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:h,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}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:d,model:g}=e;if(!d||!this._cacheActiveSpec){const d=this.component.getSpec();if(this._cacheActiveSpec=vH(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){u(this._cacheActiveSpec.handler)&&p(d.handler)&&(this._cacheActiveSpec.handler=d.handler);const g=null!==(i=d[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},bH),t):bH;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!u(e)&&aF(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class AH extends SH{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)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],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(!UC(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(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}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const kH=()=>{NR.registerTooltipProcessor("dimension",AH)};class MH extends SH{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,Xo.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(eI(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const TH=()=>{NR.registerTooltipProcessor("mark",MH)};class wH extends SH{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:Y(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?Y(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_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 CH=()=>{NR.registerTooltipProcessor("group",wH)};class EH extends Wj{constructor(){super(...arguments),this.transformerConstructor=Xj,this.type="line",this.seriesType=iR.line}_setModelOption(){this._modelOption.getDimensionInfo=oH,this._modelOption.getDimensionInfoByValue=hH,this._modelOption.getRectByDimensionData=fH}}EH.type="line",EH.seriesType=iR.line,EH.transformerConstructor=Xj,G(EH,Zj);const BH=[...hz,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class PH extends cz{constructor(){super(...arguments),this.type=PH.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return BH}_getIgnoreAttributes(){return[]}}PH.type="area";const LH=()=>{NR.registerMark(PH.type,PH),Jk(),Lk(),EB(),kB(),jD(),NR.registerGraphicComponent("area",sf)};class RH extends cF{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 OH=Object.assign(Object.assign(Object.assign({},SF),rz),{area:{name:"area",type:"area"}}),IH=()=>{NR.registerAnimation("area",FD),zD(),ID()};class DH extends fz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!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,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_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,f=h;("line"===c||u&&!d)&&(g=h,f=l),l.style=HR({},f.style,g.style),l.state=HR({},f.state,g.state),!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),t.area=l,t.line=h}}class FH extends VF{constructor(){super(...arguments),this.type=iR.area,this.transformerConstructor=DH,this._sortDataByAxis=!1}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(FH.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}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===qD?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return _R(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),y1: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),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return _R(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:!!e&&this.getColorAttribute(),stroke:!!i&&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.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[xO]},"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(BF(null===(e=NR.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),PF("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(BF(null===(i=NR.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),PF("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=NF(this);this._symbolMark.setAnimationConfig(BF(null===(s=NR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),PF("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new RH(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.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(){super.onLayoutEnd(),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}}}FH.type=iR.area,FH.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},FH.mark=OH,FH.transformerConstructor=DH,G(FH,az);class zH extends $j{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),jI(t)}}class jH extends Wj{constructor(){super(...arguments),this.transformerConstructor=zH,this.type="area",this.seriesType=iR.area}_setModelOption(){this._modelOption.getDimensionInfo=oH,this._modelOption.getDimensionInfoByValue=hH,this._modelOption.getRectByDimensionData=fH}}jH.type="area",jH.seriesType=iR.area,jH.transformerConstructor=zH,G(jH,Zj);function HH(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 NH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:HH(t,e)}),VH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:HH(t,e)}),UH={type:"fadeIn"},WH={type:"growCenterIn"};function GH(t,e){if(!1===e)return{};switch(e){case"fadeIn":return UH;case"scaleIn":return WH;default:return NH(t)}}class YH extends AD{constructor(){super(...arguments),this.type=YH.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}YH.type="rect";const $H=()=>{Jk(),Xk(),xB("rect",TB),NR.registerMark(YH.type,YH),pw.registerBuiltInAnimate("growHeightIn",rC),pw.registerBuiltInAnimate("growHeightOut",aC),pw.registerBuiltInAnimate("growWidthIn",SC),pw.registerBuiltInAnimate("growWidthOut",AC),pw.registerBuiltInAnimate("growCenterIn",iC),pw.registerBuiltInAnimate("growCenterOut",sC),NR.registerGraphicComponent("rect",Ig)},XH=Object.assign(Object.assign({},SF),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function KH(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;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=ER(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[AF]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):_R(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[kF]):_R(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=_R(this._dataToPosX(t),e,i),n=_R(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[MF]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):_R(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[TF]):_R(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=_R(this._dataToPosY(t),e,i),n=_R(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},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(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},JH.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:OF(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(JH.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}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(pI(this._option.dataSet,"addVChartProperty",sF),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};pI(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new Ba(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:_F.bind(this),call:yF}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new _D(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=TF,s=MF,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=kF,s=AF,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=NO(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)KH(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=_R(this[r](t),l,i),u=_R(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!yR(t[this.getStackValueField()],l)?p=0:pthis._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.setMarkConfig({clip:!0,clipPath:()=>{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[bO],n=t[xO],r=t[SO],h=t[AO];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]),{[bO]:i,[xO]:s}),a?{[SO]:o,[AO]:l}:void 0),c="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)};t.push(Ig(Object.assign(Object.assign({},c),{cornerRadius:d(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(c,h,this._markAttributeContext):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=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>_R(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},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=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>_R(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),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;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=K(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=NF(this);this._barMark.setAnimationConfig(BF(null===(e=NR.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),PF(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=p(this._spec.barWidth)&&r===n,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=a;return o&&(c=ER(this._spec.barWidth,a)),l&&(c=Math.max(c,ER(this._spec.barMinWidth,a))),h&&(c=Math.min(c,ER(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=u(i)?f:Math.min(f,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,m-1))&&void 0!==r?r:6,_=m===f?this._barMark.getAttribute(c,e):v;if(m>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=ER(null!==(l=i[r-1])&&void 0!==l?l:$(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=NC(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(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}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}}JH.type=iR.bar,JH.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},JH.mark=XH,JH.transformerConstructor=ZH;const QH=()=>{jj(),$H(),NR.registerAnimation("bar",((t,e)=>({appear:GH(t,e),enter:NH(t,!1),exit:VH(t,!1),disappear:{duration:LD.disappear.duration}}))),Aj(),yj(),NR.registerSeries(JH.type,JH)};class tN extends $j{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),jI(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 eN extends Wj{constructor(){super(...arguments),this.transformerConstructor=tN,this.type="bar",this.seriesType=iR.bar}_setModelOption(){this._modelOption.getDimensionInfo=oH,this._modelOption.getDimensionInfoByValue=hH,this._modelOption.getRectByDimensionData=fH}}eN.type="bar",eN.seriesType=iR.bar,eN.transformerConstructor=tN,G(eN,Zj);const iN=[10,20],sN=jC.Linear,nN="circle",rN=jC.Ordinal,aN=["circle","square","triangle","diamond","star"],oN=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},lN=Object.assign(Object.assign({},SF),{point:{name:"point",type:"symbol"}});class hN extends zF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class cN extends VF{constructor(){super(...arguments),this.type=iR.scatter,this.transformerConstructor=hN,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=`${dO}_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=`${dO}_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:sN,defaultRange:iN},"size")}getShapeAttribute(t,e){return u(e)?nN:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:rN,defaultRange:aN},"shape")}initMark(){this._symbolMark=this._createMark(cN.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:OF(this._spec,cN.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=NF(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(BF(null===(i=NR.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),PF("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:nN},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{if(!t)return;const e=t.getGraphics();e&&e.length&&e.forEach(((t,e)=>{var i,s;const n=null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],r=this.dataToPosition(n);r&&t&&t.translateTo(r.x,r.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){this.handleZoom(t)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}cN.type=iR.scatter,cN.mark=lN,cN.builtInTheme={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"}}}}},cN.transformerConstructor=hN;const dN=()=>{gz(),NR.registerAnimation("scatter",((t,e)=>Object.assign({appear:oN(0,e)},RD))),Aj(),yj(),NR.registerSeries(cN.type,cN)};class uN extends $j{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class pN extends Wj{constructor(){super(...arguments),this.transformerConstructor=uN,this.type="scatter",this.seriesType=iR.scatter}_setModelOption(){this._modelOption.getDimensionInfo=oH,this._modelOption.getDimensionInfoByValue=hH,this._modelOption.getRectByDimensionData=fH}}pN.type="scatter",pN.seriesType=iR.scatter,pN.transformerConstructor=uN,G(pN,Zj);class gN extends jF{constructor(){super(...arguments),this.type=iR.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=`${dO}_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 fN=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[fO]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[FO]=e.nameMap[n]:t[FO]=n})),t.features);class mN extends cF{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 vN extends AD{constructor(){super(...arguments),this.type=vN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}vN.type="path";const _N=()=>{NR.registerMark(vN.type,vN),Jk(),Wk(),NR.registerGraphicComponent("path",Qg)},yN=Object.assign(Object.assign({},SF),{area:{name:"area",type:"path"}});class bN{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Oa(i,e):La[i]?(Pa[i]||(Pa[i]=Oa(i,La[i])),Pa[i]):null}(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 xN{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(){}}class SN{constructor(){this._lastScale=0}clearZoom(){this._lastScale=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 AN(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:xN}:Yy(e)||$y(e)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:SN}:null}const kN={debounce:xt,throttle:St};class MN{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=Yy(this._renderMode)||$y(this._renderMode),AN(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return AN(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(u(r))return;if(!Ae({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{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(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:lI.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:lI.chart,consume:!1}];l.on(...c,kN[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,kN[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||AN(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||AN(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:Ae({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:lI.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:lI.chart,consume:!1}];l.on(...c,kN[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,kN[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){AN(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||AN(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(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:lI.chart},(t=>{if(!t.event)return;const{event:n}=t;Ae({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:lI.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||AN(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:lI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||AN(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:lI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:lI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:lI.chart,source:oI.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:lI.chart,source:oI.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=kN[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=kN[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:lI.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:lI.chart,source:oI.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:lI.chart,source:oI.chart},this._handleDragMouseUp)}))}}function TN(t,e){return`${dO}_${e}_${t}`}class wN extends Kz{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:TN(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;const l=p(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,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,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):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,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=HR(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var e,i,s;this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:n}=this._spec;if(n){let t=!0,r=!0,a=!1;!0!==n&&(t=null===(e=n.zoom)||void 0===e||e,r=null===(i=n.drag)||void 0===i||i,a=null!==(s=n.blank)&&void 0!==s&&s),t&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!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 bN(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===iR.map||e.type===iR.pictogram?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(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),qL(this._regions,(t=>{var e;if(t.type===iR.map||t.type===iR.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ue})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==iR.map&&e.type!==iR.pictogram||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[FO],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!U(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}wN.type=r.geoCoordinate,G(wN,MN);const CN=()=>{NR.registerComponent(wN.type,wN)};class EN extends zF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class BN extends gN{constructor(){super(...arguments),this.type=iR.map,this.transformerConstructor=EN,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 !`),fI.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var e,i;super.initData(),pI(this._dataSet,"copyDataView",xI),pI(this._dataSet,"map",fN),pI(this._dataSet,"lookup",iF);const s=fI.get(this.map);s||null===(e=this._option)||void 0===e||e.onError("no valid map data found!");const n=new Ba(this._dataSet,{name:`map_${this.id}_data`});n.parse([s],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:t.TransformLevel.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:FO,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",n.reRunAllTransform),this._mapViewData=new _D(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(BN.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:OF(this._spec,BN.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}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:vO])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:vO]):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(BF(null===(t=NR.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),PF("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new mN(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[fO]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[fO],{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;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ue}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ue}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}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 fO}getActiveMarks(){return[this._pathMark]}}BN.type=iR.map,BN.mark=yN,BN.builtInTheme={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"}}}}},BN.transformerConstructor=EN;const PN=`${dO}_waterfall_default_seriesField`,LN=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n,calculationMode:r}=e,a=[],{dimensionValues:o,dimensionData:l}=n().latestData;let h=Array.from(o[i]);"decrease"===r&&(h=h.reverse());let c={start:0,end:0,positive:0,negative:0,lastIndex:null};return h.forEach(((t,i)=>{const n={start:c.end,end:c.end,lastIndex:c.lastIndex,lastEnd:c.end,index:t,isTotal:!1,positive:c.end,negative:c.end},r=!0===e.stackInverse?l[t].reverse():l[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[CO]=!0:delete t[CO]})),r.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===h.length-1)return!0;return!1};if(r.some((t=>o(t))))return c=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,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=RN([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 f=g[0];let{start:m,end:v}=ON(f,i,s,n,u);i.start=m,i.end=v;let _=m,y=m,b=v-m;const x=p.reduce(((t,e)=>se(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=ie(_,e)):(t[c]=+y,y=ie(y,e)),t[d]=ie(t[c],e),m=ie(m,e),b=se(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,n,a,c,h,i,e,o),void a.push(n)}c=RN(r,t,n,a,c,h,i,e),a.push(n)})),a};function RN(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}=ON(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=ie(i.positive,e)):(t[h]=+i.negative,i.negative=ie(i.negative,e)),t[c]=ie(t[h],e),i.end=ie(i.end,e)}i.isTotal=e,(u(p)||p===PN)&&(t[PN]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function ON(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?Hy("total.collectCountField error"):n=e[a].start;o<0?Hy("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=ie(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 IN=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>ie(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?t.unshift(o):t.push(o),t},DN={type:"fadeIn"},FN={type:"growCenterIn"};function zN(t,e){switch(e){case"fadeIn":return DN;case"scaleIn":return FN;default:return NH(t,!1)}}class jN extends AD{constructor(){super(...arguments),this.type=jN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(t,i,s){const n=super._transformGraphicAttributes(t,i,s),{x:r,x1:a,y:o,y1:l}=n,h=e(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return Pg(t)}}jN.type="rule";const HN=()=>{NR.registerMark(jN.type,jN),Jk(),Vk(),NR.registerGraphicComponent("line",Pg)},NN=Object.assign(Object.assign({},XH),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),VN=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:UN(t.map((t=>t.latestData)).flat(),e.fields,i)}};function UN(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)=>UN(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class WN{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 Ba(e instanceof Ea?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),pI(e,"dimensionTree",VN),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 GN extends ZH{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const YN={rect:JN,symbol:qN,arc:tV,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=qN(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:eV,line:iV,area:iV,rect3d:JN,arc3d:tV,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function $N(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=YN[t])&&void 0!==i?i:YN.point;return e.series.type===iR.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=KN(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;_(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!_(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:sV(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function XN(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==iR.sankey){const{formatFunc:t,args:n}=tF(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function KN(t){return d(t)?e=>t(e.data):t}function qN(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=KN(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:ZN(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function ZN(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function JN(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=KN(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;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:QN(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function QN(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 tV(t){var e;const{labelSpec:i}=t,s=null!==(e=KN(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 eV(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=XN(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),Mg(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 iV(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}))):[{index:0,[vO]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function sV(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class nV extends JH{constructor(){super(...arguments),this.type=iR.waterfall,this.transformerConstructor=GN,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&UO(t,e)}}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 WN(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=PN)}getSeriesKeys(){return this._seriesField===PN?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t,e,i;super.initData(),pI(this._dataSet,"waterfallFillTotal",IN),pI(this._dataSet,"waterfall",LN),(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,calculationMode:null!==(e=this._spec.calculationMode)&&void 0!==e?e:"increase",stackInverse:this.getRegion().getStackInverse()}},!1));const s=SI(this.getViewData(),this._dataSet,{name:`${dO}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",s.reRunAllTransform),this._totalData=new _D(this._option,s),s.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:bO,endAs:xO,total:this._spec.total,calculationMode:null!==(i=this._spec.calculationMode)&&void 0!==i?i:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}},!1),s.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}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=NF(this);this._barMark.setAnimationConfig(BF(null===(i=NR.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),PF("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(BF(null===(s=NR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),PF("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(){super.initMark();const t=this._createMark(nV.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:se(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:se(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return eV(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?_R(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):_R(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle();const e="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),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",e?0:1):0,y1:t=>this.totalPositionY(t,"index",e?1:0)},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",e?0:1):0,x1:t=>this.totalPositionX(t,"index",e?1:0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}isVisibleLeaderLine(t){return!u(t.lastIndex)&&yR([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}nV.type=iR.waterfall,nV.mark=NN,nV.builtInTheme={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}}}},nV.transformerConstructor=GN;const rV=()=>{HN(),$H(),NR.registerAnimation("waterfall",((t,e)=>({appear:zN(t,e),enter:NH(t,!1),exit:VH(t,!1),disappear:{duration:LD.disappear.duration}}))),DD(),Aj(),yj(),NR.registerSeries(nV.type,nV)},aV=`${dO}_BOX_PLOT_OUTLIER_VALUE`;var oV;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(oV||(oV={}));const lV=(t,e)=>{const i=[],{outliersField:s,dimensionField:n,seriesField:r}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];y(e)||(e=[e]),i.push(...e.map((e=>{const i={[aV]:e};return n.forEach((e=>{i[e]=t[e]})),p(r)&&(i[r]=t[r]),i})))})),i};class hV extends cF{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===oV.OUTLIER)return this.series.getOutliersField();if(t===oV.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case oV.MIN:return this.series.getMinField();case oV.MAX:return this.series.getMaxField();case oV.MEDIAN:return this.series.getMedianField();case oV.Q1:return this.series.getQ1Field();case oV.Q3:return this.series.getQ3Field();case oV.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===oV.OUTLIER)return e[aV];if(t===oV.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case oV.MIN:return e[this.series.getMinField()];case oV.MAX:return e[this.series.getMaxField()];case oV.MEDIAN:return e[this.series.getMedianField()];case oV.Q1:return e[this.series.getQ1Field()];case oV.Q3:return e[this.series.getQ3Field()];case oV.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,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>p(t[aV])}getDefaultContentList(t){return[{key:this.getContentKey(oV.OUTLIER),value:this.getContentValue(oV.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(oV.MAX),value:this.getContentValue(oV.MAX)},{key:this.getContentKey(oV.Q3),value:this.getContentValue(oV.Q3)},{key:this.getContentKey(oV.MEDIAN),value:this.getContentValue(oV.MEDIAN)},{key:this.getContentKey(oV.Q1),value:this.getContentValue(oV.Q1)},{key:this.getContentKey(oV.MIN),value:this.getContentValue(oV.MIN)},{key:this.getContentKey(oV.SERIES_FIELD),value:this.getContentValue(oV.SERIES_FIELD)}]}}class cV extends AD{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==YI.enter&&t.context.diffState!==YI.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;return this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?j(r,i):i}})),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=Fg(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=NR.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const dV=()=>{NR.registerGraphicComponent("glyph",Fg),Jk(),Dk()},uV=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],pV=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class gV extends cV{constructor(){super(...arguments),this.type=gV.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=uV,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=pV,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}gV.type="boxPlot";const fV=Object.assign(Object.assign({},SF),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),mV=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},vV=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},_V=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),yV=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,M;if(i&&k(i.center))return i.center;let T,w,C,E,B;if("horizontal"===e){T=null===(r=null===(n=(null===(s=_V(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,w=null===(h=null===(l=null===(o=null===(a=_V(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,C=null===(p=null===(u=null===(d=null===(c=_V(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=_V(t,"box").attribute.width,i=_V(t,"box").attribute.x;E=i,B=i+e}else{T=null===(m=null===(f=(null===(g=_V(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,w=null===(b=null===(y=null===(_=null===(v=_V(t,"max"))||void 0===v?void 0:v.attribute)||void 0===_?void 0:_.points)||void 0===y?void 0:y[0])||void 0===b?void 0:b.y,C=null===(M=null===(A=null===(S=null===(x=_V(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===M?void 0:M.y;const e=_V(t,"box").attribute.height,i=_V(t,"box").attribute.y;E=i,B=i+e}return k(T)?T:k(E)&&k(B)?(E+B)/2:k(w)&&k(C)?(w+C)/2:k(C)?C:k(w)?w:NaN},bV=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,_,y,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=_V(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=_V(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=_V(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;y=i,_=i+e;const c=(null===(l=_V(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=_V(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=_V(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=_V(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=_V(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;y=i,_=i+e;const s=(null===(f=_V(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=_V(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(_)&&k(y)?(_+y)/2:k(y)?y:k(_)?_:NaN};class xV extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return mV(yV)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class SV extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return vV(yV)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class AV extends xV{computeAttribute(){return mV(bV)(this.target,this.params,this.params.options)}}class kV extends SV{computeAttribute(){return vV(bV)(this.target,this.params,this.params.options)}}class MV extends zF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}class TV extends VF{constructor(){super(...arguments),this.type=iR.boxPlot,this.transformerConstructor=MV,this._bandPosition=0}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,r,a;super.setAttrFromSpec();const o=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=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(TV.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(TV.mark.outlier,{key:fO,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var e,i,s,n,r,a;const o=this._boxPlotMark;if(o){const s={lineWidth:this._lineWidth,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"!==this._shaftShape?"#000":this.getColorAttribute()};o.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const n="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return ER(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return ER(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return ER(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return ER(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return ER(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return ER(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return ER(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return ER(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(o,s,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(o,n,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Built_In)}const l=this._outlierMark;l&&this.setMarkStyle(l,{fill:null!==(r=null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this._boxFillColor)&&void 0!==r?r:this.getColorAttribute(),stroke:this.getColorAttribute(),size:S(null===(a=this._outliersStyle)||void 0===a?void 0:a.size)?this._outliersStyle.size:10},t.STATE_VALUE_ENUM.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=>_R(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>_R(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>_R(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>_R(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>_R(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},t.STATE_VALUE_ENUM.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:t=>this._getPosition(this.direction,t),x:t=>_R(e(this.getDatumPositionValues(t,aV),{bandPosition:this._bandPosition}),s)}:{x:t=>this._getPosition(this.direction,t),y:t=>_R(e(this.getDatumPositionValues(t,aV),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;pI(this._dataSet,"foldOutlierData",lV),pI(this._dataSet,"addVChartProperty",sF);const t=new Ba(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${dO}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField}}),t.transform({type:"addVChartProperty",options:{beforeCall:_F.bind(this),call:yF}},!1),this._outlierData=new _D(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t;if(this._autoBoxWidth)return this._autoBoxWidth;const e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,i=this._groups?this._groups.fields.length:1,s=null===(t=e.getBandwidth)||void 0===t?void 0:t.call(e,i-1);let n=s;return p(this._spec.boxWidth)&&(n=ER(this._spec.boxWidth,s)),p(this._spec.boxMinWidth)&&(n=Math.max(n,ER(this._spec.boxMinWidth,s))),p(this._spec.boxMaxWidth)&&(n=Math.min(n,ER(this._spec.boxMaxWidth,s))),this._autoBoxWidth=n,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r;let a,o,l;"horizontal"===t?(a=this.getYAxisHelper(),o="boxHeight",l=this.dataToPositionY.bind(this)):(a=this.getXAxisHelper(),o="boxWidth",l=this.dataToPositionX.bind(this));const h=a.getScale(0),c=this._groups?this._groups.fields.length:1,d=null===(i=a.getBandwidth)||void 0===i?void 0:i.call(a,c-1),u=this._boxPlotMark.getAttribute(o,e);if(c>1&&p(this._spec.boxGapInGroup)){const t=this._groups.fields,i=Y(this._spec.boxGapInGroup);let o=0,l=0;for(let h=t.length-1;h>=1;h--){const c=t[h],p=null!==(n=null===(s=a.getScale(h))||void 0===s?void 0:s.domain())&&void 0!==n?n:[],g=p.length,f=ER(null!==(r=i[h-1])&&void 0!==r?r:$(i),d),m=p.indexOf(e[c]);h===t.length-1?(o+=g*u+(g-1)*f,l+=m*(u+f)):(l+=m*(o+f),o+=o+(g-1)*f)}return h.scale(e[t[0]])+a.getBandwidth(0)/2-o/2+l+u/2}const g=NC(h.type||"band");return l(e)+.5*d+(g?-d/2:0)}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=j({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=NF(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=NR.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(PF("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(BF(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(BF(null===(a=NR.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new hV(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}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}TV.type=iR.boxPlot,TV.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},TV.mark=fV,TV.transformerConstructor=MV;const wV=()=>{dV(),Vk(),Xk(),NR.registerGraphicComponent("line",(t=>Pg(t))),NR.registerGraphicComponent("rect",(t=>Ig(t))),NR.registerMark(gV.type,gV),gz(),ID(),Aj(),yj(),pw.registerBuiltInAnimate("boxplotScaleIn",xV),pw.registerBuiltInAnimate("boxplotScaleOut",SV),pw.registerBuiltInAnimate("barBoxplotScaleIn",AV),pw.registerBuiltInAnimate("barBoxplotScaleOut",kV),NR.registerSeries(TV.type,TV)};class CV extends AD{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=CV.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?qg(t):Mg(t)}}CV.type="text";const EV=()=>{NR.registerMark(CV.type,CV),Jk(),iM(),qk(),NR.registerGraphicComponent("text",Mg),NR.registerGraphicComponent("richtext",qg)};class BV extends cF{constructor(){super(...arguments),this._getMeasureData=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]]}}const PV=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),LV={type:"fadeIn"},RV=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function OV(t,e){return"fadeIn"===e?LV:PV(t)}const IV=Object.assign(Object.assign({},XH),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class DV extends ZH{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 FV extends JH{constructor(){super(...arguments),this.type=iR.rangeColumn,this._barMarkType="rect",this._barName=iR.bar,this.transformerConstructor=DV}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(FV.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:OF(this._spec,FV.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(FV.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(FV.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(e,i,s,n){var r,a,o,l;if(e){this.setMarkStyle(e,{fill:null!==(a=null===(r=null==i?void 0:i.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[s]]:t[this._spec.yField[s]];return(null==i?void 0:i.formatMethod)?i.formatMethod(e,t):e}});!function(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)}(this,e,null!==(o=null==i?void 0:i.position)&&void 0!==o?o:n,null!==(l=null==i?void 0:i.offset)&&void 0!==l?l:"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=NF(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(BF(null===(i=NR.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),PF("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(BF(null===(s=NR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),PF("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(BF(null===(n=NR.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),PF("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new BV(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)}}FV.type=iR.rangeColumn,FV.mark=IV,FV.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},FV.transformerConstructor=DV;const zV=()=>{$H(),EV(),NR.registerAnimation("rangeColumn",((t,e)=>({appear:OV(t,e),enter:PV(t),exit:RV(t),disappear:{duration:LD.disappear.duration}}))),DD(),Aj(),yj(),NR.registerSeries(FV.type,FV)};var jV,HV;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}(jV||(jV={})),function(t){t.middle="middle",t.start="start",t.end="end"}(HV||(HV={}));class NV extends cF{constructor(){super(...arguments),this._getMeasureData=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]]}}const VV=Object.assign({},OH);class UV extends FH{constructor(){super(...arguments),this.type=iR.rangeArea}initMark(){this._areaMark=this._createMark(UV.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}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 NV(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}UV.type=iR.rangeArea,UV.mark=VV;class WV extends jF{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=Uz,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.radiusAxisHelper.dataToPosition(Y(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(Y(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}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:[]};NC(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:[]};NC(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)&&HF(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}}function GV(t){return qy(t)?Number.parseFloat(t):0}const YV=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&$V(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=ge(e+a/2)};let _=0,y=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,M=0;const T=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))}(x);if(m.forEach(((t,e)=>{const i=t[Rz],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/M;A=p,m.forEach((e=>{const i=e[r]===f?f:e[Rz]*t;v(e,A,i),A+=i}))}if(0!==_&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},$V=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===GV(t[e])))||!i&&0===t.reduce(((t,i)=>t+GV(i[e])),0)));function XV(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const KV=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:XV(t,!0,TI.appear)}),qV={type:"fadeIn"},ZV=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:XV(t,!0,TI.enter)}),JV=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:XV(t,!0,TI.exit)});function QV(t,e){if(!1===e)return{};switch(e){case"fadeIn":return qV;case"growRadius":return KV(Object.assign(Object.assign({},t),{growField:"radius"}));default:return KV(Object.assign(Object.assign({},t),{growField:"angle"}))}}class tU extends AD{constructor(t,e){super(t,e),this.type=eU.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>he({x:0,y:0},this.getAttribute("centerOffset",e,i),e[zz])[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 eU extends tU{constructor(){super(...arguments),this.type=eU.type}}eU.type="arc";const iU=()=>{Jk(),Bk(),xB("arc",LB),pw.registerBuiltInAnimate("growRadiusIn",yC),pw.registerBuiltInAnimate("growRadiusOut",bC),pw.registerBuiltInAnimate("growAngleIn",tC),pw.registerBuiltInAnimate("growAngleOut",eC),NR.registerGraphicComponent("arc",af),NR.registerMark(eU.type,eU)},sU=Object.assign(Object.assign({},SF),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class nU extends zF{_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=HR({},this._theme,i,t);const n=(t,e)=>HR({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);y(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const rU=`${dO}_LABEL_VISIBLE`;class aU extends WV{constructor(){super(...arguments),this.transformerConstructor=nU,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:kR(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:kR(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=Nz,this._endAngle=Vz,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[zz];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return he(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;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 a=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)?ae(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?ae(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?ae(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=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;pI(this._dataSet,"pie",YV),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?ae(this._spec.minAngle):0,asStartAngle:Iz,asEndAngle:Dz,asRatio:Oz,asMiddleAngle:zz,asRadian:Hz,asQuadrant:jz,asK:Fz,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new Ba(this._dataSet,{name:`${dO}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new _D(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},aU.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:mO,groupKey:this._seriesField,isSeriesMark:!0},{morph:OF(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return QL(Iz)(t)}endAngleScale(t){return QL(Dz)(t)}_computeLayoutRadius(){return Wz((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:bR(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:bR(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},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),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)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:QL(rU).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(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[zz];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return he(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===TI.appear)return this._startAngle;if(i===TI.disappear)return this._endAngle;const r=[TI.disappear,TI.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[fO];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[fO]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[fO])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[fO])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+he({x:0,y:0},a,e[zz]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+he({x:0,y:0},a,e[zz]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+he({x:0,y:0},a,e[zz]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+he({x:0,y:0},a,e[zz]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=BF(null===(i=NR.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}aU.transformerConstructor=nU,aU.mark=sU,aU.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class oU extends aU{constructor(){super(...arguments),this.type=iR.pie}}oU.type=iR.pie;const lU=()=>{iU(),NR.registerAnimation("pie",((t,e)=>({appear:QV(t,e),enter:ZV(t),exit:JV(t),disappear:{duration:LD.disappear.duration}}))),NR.registerAnimation("emptyCircle",((t,e)=>({appear:QV(t,e)}))),NR.registerSeries(oU.type,oU)};function hU(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const cU=t=>({type:hU(t.growField),options:{overall:!0}}),dU={type:"fadeIn"},uU=t=>({type:hU(t.growField)}),pU=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function gU(t,e){if(!1===e)return{};switch(e){case"fadeIn":return dU;case"growAngle":return cU(Object.assign(Object.assign({},t),{growField:"angle"}));default:return cU(Object.assign(Object.assign({},t),{growField:"radius"}))}}class fU extends WV{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(xO),this.setInnerRadiusField(bO)}setValueFieldToPercent(){this.setRadiusField(AO),this.setInnerRadiusField(SO)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const mU=Object.assign(Object.assign({},SF),{rose:{name:"rose",type:"arc"}});class vU extends zF{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class _U extends ej{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=y(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let n,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:u,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((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:-90,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.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=u,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const _={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(_),"radius"===i.orient?(o.push(_),a=h):(l.push(_),n=h)})),o.forEach((t=>{t.angleAxisIndex=n})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=NR.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=Nz,this._endAngle=Vz,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),qL(this._regions,(t=>{"radius"===this.getOrient()?Pz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):Pz(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(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.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:kR(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:kR(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this.visible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=ae(this._spec.startAngle),this._endAngle=ae(this._spec.endAngle),this._inverse=this._spec.inverse}_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:Tz(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}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(){qL(this._regions,(t=>{"radius"===this.getOrient()?Pz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):Pz(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(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 NC(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:NC(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 he(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return ce(t,this.getCenter(),this._startAngle,this._endAngle)}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=>Bz(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_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=re.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",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return Wz((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=Uz,e=0;const i=this.getChart().getSpec();return qL(this.getRegions(),(s=>{const n=s;if(r=n.type,[iR.rose,iR.radar,iR.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.getComponent().setAttributes(HR({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(HR({},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)}}_U.type=r.polarAxis,_U.specKey="axes";const yU={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},bU={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class xU extends _U{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new PE}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}registerTicksTransform(){const t=`${this.type}-ticks`;return pI(this._option.dataSet,t,HE),t}}xU.type=r.polarLinearAxis,xU.specKey="axes",xU.builtInTheme={axis:vj,axisLinear:gj,axisAngle:bU,axisRadius:yU},G(xU,pj);const SU=()=>{NR.registerGraphicComponent(qz.lineAxis,((t,e)=>new CC(t,e))),NR.registerGraphicComponent(Zz.lineAxisGrid,((t,e)=>new zB(t,e))),NR.registerGraphicComponent(qz.circleAxis,((t,e)=>new OC(t,e))),NR.registerGraphicComponent(Zz.circleAxisGrid,((t,e)=>new UB(t,e))),ij(),NR.registerComponent(xU.type,xU)};class AU extends _U{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new cE}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)}registerTicksTransform(){const t=`${this.type}-ticks`;return pI(this._option.dataSet,t,XE),t}transformScaleDomain(){}}AU.type=r.polarBandAxis,AU.specKey="axes",AU.builtInTheme={axis:vj,axisBand:xj,axisAngle:bU,axisRadius:yU},G(AU,bj);const kU=()=>{NR.registerGraphicComponent(qz.lineAxis,((t,e)=>new CC(t,e))),NR.registerGraphicComponent(Zz.lineAxisGrid,((t,e)=>new zB(t,e))),NR.registerGraphicComponent(qz.circleAxis,((t,e)=>new OC(t,e))),NR.registerGraphicComponent(Zz.circleAxisGrid,((t,e)=>new UB(t,e))),ij(),NR.registerComponent(AU.type,AU)};class MU extends fU{constructor(){super(...arguments),this.type=iR.rose,this.transformerConstructor=vU,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(){this._roseMark=this._createMark(MU.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:OF(this._spec,MU.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}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=>_R(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=_R(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(BF(null===(i=NR.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),PF("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}MU.type=iR.rose,MU.mark=mU,MU.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},MU.transformerConstructor=vU;const TU=()=>{NR.registerSeries(MU.type,MU),iU(),NR.registerAnimation("rose",((t,e)=>({appear:gU(t,e),enter:uU(t),exit:pU(t),disappear:{duration:LD.disappear.duration}}))),kU(),SU()};class wU extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:he(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=ce(this.from,this._prevCenter),{angle:i,radius:s}=ce(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,NL(this._fromAngle,this._toAngle)&&NL(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=he({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class CU extends $w{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!KL(t)&&!KL(e))return e;const s=ce(t,this._prevCenter),n=ce(e,this._center);let r=ue(s.angle),a=ue(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return he({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new ne(s,n,r,a);return o.defined=e.defined,o}}const EU=t=>({type:"in"===t?"fadeIn":"fadeOut"});function BU(t,e,i){return"fadeIn"===e?EU(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function PU(t,e,i){return"fadeIn"===e?EU(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 LU=(t,e)=>({custom:Gw,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),RU=Object.assign(Object.assign(Object.assign({},SF),rz),{area:{name:"area",type:"area"}});class OU extends fU{constructor(){super(...arguments),this.type=iR.radar,this.transformerConstructor=fz,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!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),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(OU.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}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:ZD,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{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.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)?ae(this._spec.startAngle):Nz},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(BF(null===(s=NR.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),PF("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=NR.getAnimationInKey(e);t.setAnimationConfig(BF(null==i?void 0:i(n,r),PF(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}}}OU.type=iR.radar,OU.mark=RU,OU.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},OU.transformerConstructor=fz,G(OU,az);const IU=()=>{NR.registerSeries(OU.type,OU),LH(),uz(),gz(),NR.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:BU(t,e,"in"),enter:BU(t,e,"in"),exit:BU(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:LD.disappear.duration},update:[{channel:["points","center"],custom:CU,customParameters:t,duration:LD.update.duration,easing:LD.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),NR.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:PU(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:LD.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:wU,customParameters:t,duration:LD.update.duration,easing:LD.update.easing}]}))),NR.registerAnimation("radarGroup",((t,e)=>({appear:LU(t,"in"),disappear:{duration:LD.disappear.duration}}))),Bk(),kU(),SU()};class DU extends cF{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>fi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const FU=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(dO)||(i[n]=t[n],s=p(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[fO]:r,[mO]:`${s}_${e}`})),r++}))})),n},zU={fill:"#bbb",fillOpacity:.2},jU=Object.assign(Object.assign({},SF),{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"}});class HU extends VF{constructor(){super(...arguments),this.type=iR.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 e;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),pI(this._option.dataSet,"objFlat",FU),pI(this._option.dataSet,"copyDataView",xI),gI(this._option.dataSet,"dataview",Ta),null===(e=this.getViewData())||void 0===e||e.transform({type:"objFlat",options:"dots",level:t.TransformLevel.dotObjFlat},!1)}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(HR(zU,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(HU.mark.group),this._containerMark=this._createMark(HU.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(HU.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(HU.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(HU.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(HU.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(HU.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(HU.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var e;const i=this._clipMark;i&&(this.setMarkStyle(i,{x:-(null!==(e=this._spec.leftAppendPadding)&&void 0!==e?e:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",t.AttributeLevel.Series),i.setMarkConfig({interactive:!1,clip:!0}));const s=this._containerMark;s&&(this.setMarkStyle(s,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),s.setMarkConfig({interactive:!1}));const n=this._gridBackgroundMark;n&&this.setMarkStyle(n,{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 r=this._gridMark;r&&this.setMarkStyle(r,{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 a=this._dotMark;a&&this.setMarkStyle(a,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const o=this._titleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._subTitleMark;l&&this.setMarkStyle(l,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const h=this._symbolMark;h&&this.setMarkStyle(h,{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(){var e,i;super.onLayoutEnd();const s=null!==(i=null===(e=this._spec)||void 0===e?void 0:e.leftAppendPadding)&&void 0!==i?i:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+s},"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:vO}}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 fR).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:vO}}initTooltip(){this._tooltipHelper=new DU(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}HU.type=iR.dot,HU.mark=jU,HU.builtInTheme={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"}}}}};class NU extends cF{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>fi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const VU=Object.assign(Object.assign({},SF),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),UU=(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 WU extends VF{constructor(){super(...arguments),this.type=iR.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 e;super.initData(),pI(this._option.dataSet,"linkDotInfo",UU),null===(e=this.getViewData())||void 0===e||e.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:t.TransformLevel.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(WU.mark.group),this._containerMark=this._createMark(WU.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(WU.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(WU.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},"normal",t.AttributeLevel.Series),r.setMarkConfig({interactive:!1,clip:!0}));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setMarkConfig({interactive:!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:vO}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new NU(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}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]}}WU.type=iR.link,WU.mark=VU,WU.builtInTheme={link:{arrow:{style:{size:10}}}};const GU=Object.assign(Object.assign({},SF),{group:{name:"group",type:"group"}});class YU extends WV{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()?bO:OO],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ae(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()?xO:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ae(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)?ae(n):Nz;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?ae(r):Vz,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=_R(this.angleAxisHelper.dataToPosition([t[bO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=_R(this.angleAxisHelper.dataToPosition([t[xO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?_R(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(YU.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+ae(a),o=ae(r)/2;return af(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[Ig({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_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 qU=()=>{NR.registerAnimation("circularProgress",((t,e)=>({appear:KU(t,e),enter:{type:"growAngleIn"},disappear:{duration:LD.disappear.duration}})))};class ZU extends zF{constructor(){super(...arguments),this._supportStack=!0}}class JU extends YU{constructor(){super(...arguments),this.type=iR.circularProgress,this.transformerConstructor=ZU,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(){return this._progressMark=this._createMark(JU.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:OF(this._spec,"progress")}),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)}getInteractionTriggers(){const t=[];return 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(){return this._trackMark=this._createMark(JU.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),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()?bO:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?xO: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(BF(null===(i=NR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),PF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(BF(null===(s=NR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),PF("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}JU.type=iR.circularProgress,JU.mark=$U,JU.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},JU.transformerConstructor=ZU;const QU=()=>{NR.registerSeries(JU.type,JU),iU(),qU(),DD(),kU(),SU()};function tW(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const eW={type:"fadeIn"};function iW(t,e="grow"){return!1===e?{}:"fadeIn"===e?eW:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:tW(t)}))(t)}class sW extends cF{enableByType(t){return"dimension"!==t}}const nW=Object.assign(Object.assign({},SF),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class rW extends VF{constructor(){super(...arguments),this.type=iR.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=p(e.width)?e.width:e.x1-e.x,o=p(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(rW.mark.progress,{isSeriesMark:!0}),u(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n;const r=this._progressMark;if(r)if("vertical"===this._spec.direction){const s=this._spec.progress||{},n=null!==(e=s.leftPadding)&&void 0!==e?e:0,a=null!==(i=s.rightPadding)&&void 0!==i?i:0;this.setMarkStyle(r,{x:t=>{var e,i;return _R(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),!0)-this._spec.bandWidth/2+n},y1:t=>{var e,i;return _R(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))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?_R(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-n-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=this._spec.progress||{},i=null!==(s=e.topPadding)&&void 0!==s?s:0,a=null!==(n=e.bottomPadding)&&void 0!==n?n:0;this.setMarkStyle(r,{x1:t=>{var e,i;return _R(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))},y:t=>{var e,s;return _R(this.dataToPositionY(t),null===(s=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===s?void 0:s.call(e,0),!0)-this._spec.bandWidth/2+i},height:this._spec.bandWidth-i-a,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?_R(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){return this._trackMark=this._createMark(rW.mark.track),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return _R(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),!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 _R(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),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series))}getInteractionTriggers(){const t=[];return 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(BF(null===(i=NR.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),PF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(BF(null===(s=NR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),PF("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new sW(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}rW.type=iR.linearProgress,rW.mark=nW,rW.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const aW=()=>{$H(),NR.registerAnimation("linearProgress",((t,e)=>({appear:iW(t,e),enter:iW(t),disappear:{duration:LD.disappear.duration}}))),DD(),NR.registerSeries(rW.type,rW)},oW=[0],lW=[20,40],hW=[200,500],cW={shrink:!1,enlarge:!1,fontSizeLimitMin:0},dW=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class uW{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const pW=`${dO}_WORD_CLOUD_TEXT`,gW=Object.assign(Object.assign({},SF),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),fW={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic",scaleX:1,scaleY:1}}};class mW extends jF{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},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._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=lW}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,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:hW,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:oW,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?pW:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:cW},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||Gy(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:oW,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!dW.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new uW(1e3))}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",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var e;this._wordMark=this._createMark(mW.mark.word,{key:mO,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(e=this._spec.wordMask)||void 0===e?void 0:e.visible)&&(this._maskMark=this._createMark(mW.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",t.AttributeLevel.Series)}initMarkStyleOfWord(e,i,s,n,r){var a,o;e&&(this.setMarkStyle(e,{text:(null==i?void 0:i.formatMethod)?t=>i.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{fill:null!==(o=null===(a=null==i?void 0:i.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(BF(NR.getAnimationInKey("wordCloud")(n,s),PF("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 fR).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:vO])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new PE).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new PE).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[fO])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(e=this._spec.word)&&void 0!==e?e:{},h=null!==(i=l.style)&&void 0!==i?i:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const e=()=>{var i,s,n,r;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((t=>t.fn!==e)),null===(s=(i=this._option).dispatchEvent)||void 0===s||s.call(i,t.ChartEvent.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(r=null===(n=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===n?void 0:n.afterWordcloudShapeDraw)||void 0===r||r.call(n,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:e})},dataIndexKey:mO,text:l.formatMethod?t=>l.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(n=null===(s=this._spec.word)||void 0===s?void 0:s.padding)&&void 0!==n?n:1,fontFamily:p(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(r=h.fontFamily)&&void 0!==r?r:this._defaultFontFamily,fontWeight:p(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:p(h.fontWeight)?h.fontWeight:p(this._valueField)?this._calculateFontWeight:"normal",fontStyle:p(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:h.fontStyle,createCanvas:A_.createCanvas.bind(A_),getTextBounds:ff}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,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,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:Ug,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:p(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:p(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:p(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}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(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}mW.mark=gW,mW.builtInTheme={wordCloud:fW};function vW(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||LD.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,d;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(d=t.children)||void 0===d?void 0:d.length){p.children=[],p.isLeaf=!1;const e=_W(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Mt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Mt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},yW=(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=yW(t.children,e,t,n))})),s},bW=(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=bW(t.children,e,t,n)),n=e(t,s,i,n)})),n},xW=(t,e=[],i)=>{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):xW(t.children,e,i)))})),e};function SW(t,e){let i,s;if(MW(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function MW(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 EW(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 BW(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 PW(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 LW(t){return{_:t,next:null,prev:null}}function RW(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];EW(n,s,r);let a,o,l,h,c,d,u,p=LW(s),g=LW(n),f=LW(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.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=_W(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%wt)/wt}(),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:FW.defaultOpionts.nodeSort;yW([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)yW([o],OW(h)),bW([o],IW(this._getPadding,.5,a)),yW([o],DW(1,this._maxDepth));else{const t=Math.min(s.width,s.height);yW([o],OW(FW.defaultOpionts.setRadius)),bW([o],IW(Lt,1,a)),c&&bW([o],IW(this._getPadding,o.radius/t,a)),yW([o],DW(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}FW.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const zW=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=zW(t.children):t.value=0),e+=Math.abs(t.value)})),e};function jW(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){zW(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=u(t.value)?0:Mt(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=H(t,["parents"]);if(a.parents=t.parents.map((t=>H(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=Mt(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function HW(t){return t.depth}function NW(t,e){return e-1-t.endDepth}const VW=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),UW=(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},WW={left:HW,right:NW,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?K(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:HW,end:NW},GW=yt(0,1);class YW{constructor(t){this._ascendingSourceBreadth=(t,e)=>VW(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>VW(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},YW.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?Bt(e):null;this._getNodeKey=i,this._logger=at.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):WW[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)};"vertical"===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<=0)return null;const a=this.computeNodeBreadths(n);if(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))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;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}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return 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){return jW(t,this._getNodeKey)}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=[UW(s[t.source]),UW(s[t.target],!0)].filter((t=>!u(t)));e.length&&(t.value=K(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){return function(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=Mt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Mt(e.value))&&void 0!==i?i:0)}),0))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=d(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}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;ea)&&(o=a);let l=0,h=null,c=null;if(d(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)c=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:c>0?t=>c:t=>Math.max(t.value*l,0),m=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*GW(t.value/e.value):0,n,0),o);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;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,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(VW),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(VW),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{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];$W(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),XW);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({},KW.defaultOpionts,t):Object.assign({},KW.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?Bt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Pt(this.options.center[0],t.width),s=t.y0+Pt(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=>Pt(t,n))):Pt(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>Pt(t,n))):Pt(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=Pt(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=_W(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=he({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)}}}function qW(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(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,f,m,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,_=Math.max(v/x,x/m),_>y){f-=h;break}y=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{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*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:$W,slice:qW,sliceDice:function(t,e,i,s,n){(t.depth%2==1?qW:$W)(t,e,i,s,n)}};class QW{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({},QW.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?Bt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?ZW(this.options.aspectRatio):null!==(e=JW[this.options.splitType])&&void 0!==e?e:JW.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=_W(t,n,0,-1,null,this._getNodeKey,this.options.valueField);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)}))}}function tG(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+hi?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return at.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=tG(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=wi(o.map(wi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rTt(e)));u=Li(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=eG(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&at.getInstance().error("Area "+r+" not represented on screen")}return i}function lG(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Bi((function(i){return-1*hG({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},dG=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=Y(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!P(Y(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:Y(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||sG,s=e.lossFunction||iG,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=Y(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];ci(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rre.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:cG(f),arcs:f})}))},uG={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:pG,triangle:pG,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.955)%(2*Math.PI/5)-2*Math.PI/10>=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 pG(){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 gG(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*.4),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"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const fG=t=>uG[t]?uG[t]():uG.circle(),mG=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function vG(t){return d(t)?t:function(){return t}}class _G{constructor(t){var e,i;switch(this.options=j({},_G.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=fG(this.options.shape),this.getText=null!==(e=vG(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=vG(this.options.fontWeight),this.getTextFontSize=vG(this.options.fontSize),this.getTextFontStyle=vG(this.options.fontStyle),this.getTextFontFamily=vG(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>mG(10,50);break;case"random-light":this.getTextColor=()=>mG(50,90);break;default:this.getTextColor=vG(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 ae(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():Tt(e);return ae(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+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:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1: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 bG extends _G{constructor(t){var e;super(j({},bG.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<=bG.defaultOptions.minFontSize&&(this.options.minFontSize=bG.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=yG[this.options.spiral])&&void 0!==e?e:yG.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=vG(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}=gG(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,f,m;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,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,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._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=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(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=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}));if(this.originalData=s,this.data=s,this.progressiveRun(),!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._originSize[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],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});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 f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);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*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(kG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(AG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}kG(p,this._size)&&(p=MG(p,this._size))}else if(kG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||SG(p,i))&&(!i||!xG(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 xG(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 SG(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,kG=(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 MG(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{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const u=n.measureText(h),g="normal"!==o?1.1:1,f=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(u.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},wG=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>he(t,e,i+r*n)))},CG=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},EG=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=gG(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=fG("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return he(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)CG(n,wG({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)CG(n,wG({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)CG(n,wG({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)CG(n,wG({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)CG(n,wG({x:l,y:h},o,0,3));else if("star"===t.shape){const t=wG({x:l,y:h},o,-Math.PI/2,5),e=wG({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);CG(n,i)}else n.fillRect(0,0,i,s)}; + ***************************************************************************** */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.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=(t,e=!1)=>e?"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 _=(t,e=!1)=>{const i=typeof t;return e?"string"===i:"string"===i||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=(t,e=!1)=>{const i=typeof t;return e?"number"===i:"number"===i||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 B=Object.prototype.hasOwnProperty;function P(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(B.call(t,e))return!1;return!0}var L=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&R.call(t,e);function I(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=y(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||_(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=I(r,e,i)}return s}function D(t,e,i=!1,s=!1){if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&y(t[a])?z(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i,s=!1,n=!1){const r=t[i],a=e[i];let o=e[i],l=!0;if(y(a)){if(s)o=[];else if(y(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.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 U(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(!U(t[s],e[s],i))return!1;return!0}if(!m(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(!U(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;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},K=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;ne?1:t>=e?0:NaN}function et(t){return Number(t)}function it(t,e,i=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)}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(t=rt.None,e){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(...t){this._onErrorHandler.forEach((e=>e(...t)))}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(...t){var e;return this._level>=rt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...t):nt(null!==(e=this._method)&&void 0!==e?e:"error","ERROR",t)),this}warn(...t){return this._level>=rt.Warn&&nt(this._method||"warn","WARN",t),this}info(...t){return this._level>=rt.Info&&nt(this._method||"log","INFO",t),this}debug(...t){return this._level>=rt.Debug&&nt(this._method||"log","DEBUG",t),this}}function ot(t,e,i=0,s){for(u(s)&&(s=t.length);i>>1;tt(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(tt)),it(i,.5)},dt=1e-10,ut=1e-10;function pt(t,e,i=ut,s=dt){const n=s,r=i*Math.max(t,e);return Math.abs(t-e)<=Math.max(n,r)}function gt(t,e,i,s){return t>e&&!pt(t,e,i,s)}function ft(t,e,i,s){return t{let e=null,i=null;return(...s)=>(e&&s.every(((t,i)=>t===e[i]))||(e=s,i=t(...s)),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 f(e){const i=s,r=n;return s=n=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 _(){const t=Date.now();if(v(t))return y(t);o=m(_,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?f(t):(s=n=void 0,a)}function b(...t){const i=Date.now(),r=v(i);if(s=t,n=this,l=i,r){if(void 0===o)return function(t){return h=t,o=m(_,e),c?f(t):a}(l);if(d)return o=m(_,e),f(l)}return void 0===o&&(o=m(_,e)),a}return e=+e||0,g(i)&&(c=!!i.leading,d="maxWait"in i,d&&(r=Math.max(k(i.maxWait)?i.maxWait:0,e)),u="trailing"in i?!!i.trailing:u),b.cancel=function(){void 0!==o&&function(t){if(p)return cancelAnimationFrame(t);clearTimeout(t)}(o),h=0,s=l=n=o=void 0},b.flush=function(){return void 0===o?a:y(Date.now())},b.pending=function(){return void 0!==o},b}function St(t,e,i){let s=!0,n=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return g(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),xt(t,e,{leading:s,trailing:n,maxWait:e})}function At(t,e){return i=>t*(1-i)+e*i}function kt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}function Mt(t){if(k(t))return t;const e=+t;return k(e)?e:0}function Tt(t){return parseFloat("0."+Math.sin(t).toString().substring(6))}bt=!1;const wt=4294967296;const Ct=t=>e=>L(e,t),Et=(t,e={})=>{if(d(t))return t;const i=[t];return(e&&e.get||Ct)(i)},Bt=(t,e={})=>{if(y(t)){const i=t.map((t=>Et(t,e)));return t=>i.map((e=>e(t)))}return Et(t,e)},Pt=(t,e)=>u(t)?e:_(t)?e*parseFloat(t)/100:t,Lt=t=>0,Rt=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;r2?r/(i-2):0;return{seMean:n>0?Math.sqrt(a*(1/i+(t-s)*(t-s)/n)):Math.sqrt(a/i),sePred:Math.sqrt(a*(1+1/i+(n>0?(t-s)*(t-s)/n:0)))}}function It(t,e,i,s,n){let r=0,a=0;for(let o=0;o=h){const t=h-n(e(l));r+=t*t;const i=h-s;a+=i*i}}return 0===a?0:1-r/a}function Dt(t,e=(t=>t.x),i=(t=>t.y),s){var n;const r=null!==(n=null==s?void 0:s.alpha)&&void 0!==n?n:.05;let a=0,o=0,l=0,h=0,c=0;!function(t,e,i,s){for(let n=0;n=a&&!u(o)&&(o=+o)>=o&&s(a,o,n)}}(t,e,i,((t,e)=>{a++,o+=(t-o)/a,l+=(e-l)/a,h+=(t*e-h)/a,c+=(t*t-c)/a}));const{a:d,b:p}=function(t,e,i,s){const n=s-t*t;if(Math.abs(n)d+p*t,f=function(t,e,i,s){let n=1/0,r=-1/0,a=0,o=0;for(let s=0;s=h&&!u(c)&&(c=+c)>=c&&(hr&&(r=h),a++,o+=h)}if(0===a)return{min:n,max:r,n:a,X:0,SSE:0,Sxx:0};const l=o/a;let h=0,c=0;for(let n=0;n=a&&!u(o)&&(o=+o)>=o){const t=o-s(a);h+=t*t;const e=a-l;c+=e*e}}return{min:n,max:r,n:a,X:l,SSE:h,Sxx:c}}(t,e,i,g);return{coef:{a:d,b:p},predict:g,rSquared:It(t,e,i,l,g),evaluateGrid:function(t){const e=[];if(0===f.n||t<=0)return e;if(f.min===f.max){for(let i=0;i=1)return 0;const e=-.00778489400243029,i=-.322396458041136,s=-2.40075827716184,n=-2.54973253934373,r=4.37466414146497,a=2.93816398269878,o=.00778469570904146,l=.32246712907004,h=2.445134137143,c=3.75440866190742;let d,u;return t<.02425?(d=Math.sqrt(-2*Math.log(t)),(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1)):t<=.97575?(d=t-.5,u=d*d,(((((-39.6968302866538*u+220.946098424521)*u-275.928510446969)*u+138.357751867269)*u-30.6647980661472)*u+2.50662827745924)*d/(((((-54.4760987982241*u+161.585836858041)*u-155.698979859887)*u+66.8013118877197)*u-13.2806815528857)*u+1)):(d=Math.sqrt(-2*Math.log(1-t)),-(((((e*d+i)*d+s)*d+n)*d+r)*d+a)/((((o*d+l)*d+h)*d+c)*d+1))}(1-r/2);if(f.min===f.max){const s=g(f.min),n=Ot(f.min,f);for(let r=0;r=1?jt:t<=-1?-jt:Math.asin(t)}function Zt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Jt(t,e){return t[0]*e[1]-t[1]*e[0]}function Qt(t,e){let i=0;for(let s=0;s0?i:0}function ie(t,e){return te(t+e,10**Math.max(ee(t),ee(e)))}function se(t,e){return te(t-e,10**Math.max(ee(t),ee(e)))}class ne{constructor(t=0,e=0,i,s){this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new ne(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 re{static distancePP(t,e){return Xt(Kt(t.x-e.x,2)+Kt(t.y-e.y,2))}static distanceNN(t,e,i,s){return Xt(Kt(t-i,2)+Kt(e-s,2))}static distancePN(t,e,i){return Xt(Kt(e-t.x,2)+Kt(i-t.y,2))}static pointAtPP(t,e,i){return new ne((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function ae(t){return t*(Math.PI/180)}function oe(t){return 180*t/Math.PI}const le=(t=0)=>{if(t<0)for(;t<-Ht;)t+=Ht;else if(t>0)for(;t>Ht;)t-=Ht;return t};function he(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 ce(t,e={x:0,y:0},i=0,s=2*Math.PI){const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function de(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function ue(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function pe(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=ue(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)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function ge(t){return(t=ue(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 fe(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function me(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function _e(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=be(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var ye;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(ye||(ye={}));const be=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function xe(t,e,i){if(!t||!e)return ye.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=be(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function ke(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function Me({x:t,y:e},i,s={x:0,y:0}){return{x:(t-s.x)*Math.cos(i)-(e-s.y)*Math.sin(i)+s.x,y:(t-s.x)*Math.sin(i)+(e-s.y)*Math.cos(i)+s.y}}function Te(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function we(t,e){const i=e?ae(t.angle):t.angle,s=Te(t);return[Me({x:t.x1,y:t.y1},i,s),Me({x:t.x2,y:t.y1},i,s),Me({x:t.x2,y:t.y2},i,s),Me({x:t.x1,y:t.y2},i,s)]}function Ce(t,e,i=!1){const s=we(t,i),n=we(e,i),r=(t,e)=>[e.x-t.x,e.y-t.y],a=r(Te(t),Te(e)),o=r(s[0],s[1]),l=r(s[1],s[2]),h=r(n[0],n[1]),c=r(n[1],n[2]),d=i?ae(t.angle):t.angle;let u=i?ae(90-t.angle):t.angle+jt;const p=i?ae(e.angle):e.angle;let g=i?ae(90-e.angle):e.angle+jt;u>Vt&&(u-=Vt),g>Vt&&(g-=Vt);const f=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(ke(n,i)+ke(n,s))/2>ke(n,a)};return f((t.x2-t.x1)/2,d,h,c)&&f((t.y2-t.y1)/2,u,h,c)&&f((e.x2-e.x1)/2,p,o,l)&&f((e.y2-e.y1)/2,g,o,l)}const Ee=1e-8;function Be(t,e,i,s,n){for(let r=0,a=n[n.length-1];re&&r>s||rn?o:0}function Re(t,e){return Math.abs(t-e){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"};function Ie(t,e={},i){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")}class De{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=Ie(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:f=o}=this._userSpec;if(_(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,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: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,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}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(De.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/De.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(De.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(De.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/De.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}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)}}De.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",De.NUMBERS_CHAR_SET="0123456789",De.FULL_SIZE_CHAR="字";const Fe=(t,e)=>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),ze=(t,e)=>{const i=[{x:Math.cos(t.angle),y:Math.sin(t.angle)},{x:-Math.sin(t.angle),y:Math.cos(t.angle)},{x:Math.cos(e.angle),y:Math.sin(t.angle)},{x:-Math.sin(e.angle),y:Math.cos(t.angle)}];function s(t,e,i){const s=t.getRotatedCorners().map((t=>t.x*e+t.y*i));return{min:Math.min(...s),max:Math.max(...s)}}let n=0;for(const r of i){const i=s(t,r.x,r.y),a=s(e,r.x,r.y);let o;o=i.maxthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(t=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(t=0,e=0){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(t=0,e=0,i=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(t=0,e=0,i=0,s=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(t=0,e=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(t=0){return this.x1*=t,this.x2*=t,this}scaleY(t=0){return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return je(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 Ve extends He{}class Ne extends He{constructor(t,e=0){var i;super(t),t&&(this.angle=null!==(i=t.angle)&&void 0!==i?i:e)}intersects(t){return Ce(this,t)}setValue(t=0,e=0,i=0,s=0,n=0){return super.setValue(t,e,i,s),this.angle=n,this}clone(){return new Ne(this)}getRotatedCorners(){const t={x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2};return[Me({x:this.x1,y:this.y1},this.angle,t),Me({x:this.x2,y:this.y1},this.angle,t),Me({x:this.x1,y:this.y2},this.angle,t),Me({x:this.x2,y:this.y2},this.angle,t)]}}class Ue{constructor(t=1,e=0,i=0,s=1,n=0,r=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 Ue,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,f=o*n+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 Ue;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:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(t=1){return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Ue(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=oe(r.rotateDeg),r}}class We{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 Ge(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 Ye(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 $e=/^#([0-9a-f]{3,8})$/,Xe={transparent:4294967040},Ke={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 qe(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Ze(t){return S(t)?new ii(t>>16,t>>8&255,255&t,1):y(t)?new ii(t[0],t[1],t[2]):new ii(255,255,255)}function Je(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Qe(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ti=(t,e)=>{const i=$e.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new ii((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Ze(t):8===e?new ii(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class ei{static Brighter(t,e=1){return 1===e?t:new ei(t).brighter(e).toRGBA()}static SetOpacity(t,e=1){return 1===e?t:new ei(t).setOpacity(e).toRGBA()}static getColorBrightness(t,e="hsl"){const i=t instanceof ei?t:new ei(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();case"wcag":return i.getLuminanceWCAG()}}static parseColorString(t){if(p(Xe[t]))return function(t){return S(t)?new ii(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new ii(t[0],t[1],t[2],t[3]):new ii(255,255,255,1)}(Xe[t]);if(p(Ke[t]))return Ze(Ke[t]);const e=`${t}`.trim().toLowerCase(),i=ti(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new ii(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=Ge(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new ii(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ei.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new ii(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=Ye(this.color.r,this.color.g,this.color.b),r=Ge(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 ii(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=ti(e,!0);return null!=i?i:this}setColorName(t){const e=Ke[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(t=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}getLuminanceWCAG(){const t=this.color.r/255,e=this.color.g/255,i=this.color.b/255;let s,n,r;return s=t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4),n=e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4),r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*n+.0722*r}clone(){return new ei(this.color.toString())}copyGammaToLinear(t,e=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,e=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=Je(t.color.r),this.color.g=Je(t.color.g),this.color.b=Je(t.color.b),this}copyLinearToSRGB(t){return this.color.r=Qe(t.color.r),this.color.g=Qe(t.color.g),this.color.b=Qe(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class ii{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`#${qe(this.r)+qe(this.g)+qe(this.b)+(1===this.opacity?"":qe(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}=Ye(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function si(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 ii(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:Ye});function ri(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 ai(t,e=0,i=0){if(!t)return{width:e,height:i};let s;try{s=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){s=()=>({})}const n=s(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const s=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:s<=0?e:s,height:r<=0?i:r}}return{width:e,height:i}}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}const hi=1e-10;function ci(t,e){const i=function(t){const e=[];for(let i=0;ie[i].radius+hi)return!1;return!0}(e,t)}));let n=0,r=0;const a=[];if(s.length>1){const e=gi(s);for(let t=0;t-1){const s=t[o.parentIndex[e]],n=Math.atan2(o.x-s.x,o.y-s.y),r=Math.atan2(i.x-s.x,i.y-s.y);let a=r-n;a<0&&(a+=2*Math.PI);const c=r-a/2;let d=re.distancePP(l,{x:s.x+s.radius*Math.sin(c),y:s.y+s.radius*Math.cos(c)});d>2*s.radius&&(d=2*s.radius),(null===h||h.width>d)&&(h={circle:s,width:d,p1:o,p2:i})}null!==h&&(a.push(h),n+=di(h.circle.radius,h.width),i=o)}}else{let e=t[0];for(let i=1;iMath.abs(e.radius-t[s].radius)){i=!0;break}i?n=r=0:(n=e.radius*e.radius*Math.PI,a.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-hi,y:e.y+e.radius},width:2*e.radius}))}return r/=2,e&&(e.area=n+r,e.arcArea=n,e.polygonArea=r,e.arcs=a,e.innerPoints=s,e.intersectionPoints=i),n+r}function di(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function ui(t,e,i){if(i>=t+e)return 0;if(i<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(i*i-t*t+e*e)/(2*i);return di(t,t-(i*i-e*e+t*t)/(2*i))+di(e,s)}function pi(t,e){const i=re.distancePP(t,e),s=t.radius,n=e.radius;if(i>=s+n||i<=Math.abs(s-n))return[];const r=(s*s-n*n+i*i)/(2*i),a=Math.sqrt(s*s-r*r),o=t.x+r*(e.x-t.x)/i,l=t.y+r*(e.y-t.y)/i,h=-(e.y-t.y)*(a/i),c=-(e.x-t.x)*(a/i);return[{x:o+h,y:l-c},{x:o-h,y:l+c}]}function gi(t){const e={x:0,y:0};for(let i=0;ithis.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 vi;function _i(t,e){const i=mi(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 yi{constructor(t={}){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 bi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function xi(t){let e;if(e=bi.exec(t))return new yi({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 Si=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Ai{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 Ai.instance||(Ai.instance=new Ai),Ai.instance}newFormat(t){const e=xi(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"):ki[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=ki[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:_,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)?m: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?Si[8+vi/3]:"")+A+(t&&"("===n?")":""),f)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=xi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=mi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=Si[8+n/3];return function(t){return s(r*t)+a}}}const ki={"%":(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)=>_i(100*t,e),r:_i,s:function(t,e){const i=mi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(vi=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")+mi(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 Mi(t){const e=new Array(t);for(let i=0;i=g[p-1].fx){let i=!1;if(_.fx>e.fx?(Ei(y,1+c,v,-c,e),y.fx=t(y),y.fx=1)break;for(let e=1;eo+r*n*l||h>=p)u=n;else{if(Math.abs(d)<=-a*l)return n;d*(u-c)>=0&&(u=c),c=n,p=h}return 0}n=n||1,r=r||1e-6,a=a||.1;for(let g=0;g<10;++g){if(Ei(s.x,1,i.x,n,e),h=s.fx=t(s.x,s.fxprime),d=Qt(s.fxprime,e),h>o+r*n*l||g&&h>=c)return p(u,n,c);if(Math.abs(d)<=-a*l)return n;if(d>=0)return p(n,u,h);c=h,u=n,n*=2}return n}function Li(t,e,i){let s={x:e.slice(),fx:0,fxprime:e.slice()},n={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let a,o=1;const l=(i=i||{}).maxIterations||20*e.length;s.fx=t(s.x,s.fxprime);const h=s.fxprime.slice();Ci(h,s.fxprime,-1);for(let e=0;e0?1:t<0?-1:0},Qi=Math.sqrt,ts=Math.tan;function es(t){return t>1?0:t<-1?zi:Math.acos(t)}function is(t){return t>1?ji:t<-1?-ji:Math.asin(t)}function ss(){}function ns(t,e){t&&as.hasOwnProperty(t.type)&&as[t.type](t,e)}var rs={Feature:function(t,e){ns(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++szi?t+Math.round(-t/Vi)*Vi:t,e]}function ys(t,e,i){return(t%=Vi)?e||i?vs(xs(t),Ss(e,i)):xs(t):e||i?Ss(e,i):_s}function bs(t){return function(e,i){return[(e+=t)>zi?e-Vi:e<-zi?e+Vi:e,i]}}function xs(t){var e=bs(t);return e.invert=bs(-t),e}function Ss(t,e){var i=$i(t),s=Zi(t),n=$i(e),r=Zi(e);function a(t,e){var a=$i(e),o=$i(t)*a,l=Zi(t)*a,h=Zi(e),c=h*i+o*s;return[Yi(l*n-c*r,o*i-h*s),is(c*n+l*r)]}return a.invert=function(t,e){var a=$i(e),o=$i(t)*a,l=Zi(t)*a,h=Zi(e),c=h*n-l*r;return[Yi(l*n+h*r,o*i+c*s),is(c*i-o*s)]},a}function As(t,e){(e=ds(e))[0]-=t,ms(e);var i=es(-e[1]);return((-e[2]<0?-i:i)+Vi-Fi)%Vi}function ks(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:ss,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function Ms(t,e){return Wi(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 Cs(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function Os(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 Is(t,e,i,s){return function(n){var r,a,o,l=e(n),h=ks(),c=e(h),d=!1,u={point:p,lineStart:f,lineEnd:m,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=f,u.lineEnd=m,a=Os(a);var t=function(t,e){var i=Ls(e),s=e[1],n=Zi(s),r=[Zi(i),-$i(i),0],a=0,o=0;Ps.reset(),1===n?s=ji+Fi:-1===n&&(s=-ji-Fi);for(var l=0,h=t.length;l=0?1:-1,M=k*A,T=M>zi,w=f*x;if(Ps.add(Yi(w*k*Zi(M),m*S+w*$i(M))),a+=T?A+k*Vi:A,T^p>=i^y>=i){var C=ps(ds(u),ds(_));ms(C);var E=ps(r,C);ms(E);var B=(T^A>=0?-1:1)*is(E[2]);(s>B||s===B&&(C[0]||C[1]))&&(o+=T^A>=0?1:-1)}}return(a<-Fi||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(Ds))}return u}}function Ds(t){return t.length>1}function Fs(t,e){return((t=t.x)[0]<0?t[1]-ji-Fi:ji-t[1])-((e=e.x)[0]<0?e[1]-ji-Fi:ji-e[1])}1===(Es=Rs).length&&(Bs=Es,Es=function(t,e){return Rs(Bs(t),e)});var zs=Is((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?zi:-zi,l=Wi(r-i);Wi(l-zi)0?ji:-ji),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=zi&&(Wi(i-n)Fi?Gi((Zi(e)*(r=$i(s))*Zi(i)-Zi(s)*(n=$i(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*ji,s.point(-zi,n),s.point(0,n),s.point(zi,n),s.point(zi,0),s.point(zi,-n),s.point(0,-n),s.point(-zi,-n),s.point(-zi,0),s.point(-zi,n);else if(Wi(t[0]-e[0])>Fi){var r=t[0]0,n=Wi(e)>Fi;function r(t,i){return $i(t)*$i(i)>e}function a(t,i,s){var n=[1,0,0],r=ps(ds(t),ds(i)),a=us(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=ps(n,r),u=fs(n,h);gs(u,fs(r,c));var p=d,g=us(u,p),f=us(p,p),m=g*g-f*(us(u,u)-1);if(!(m<0)){var v=Qi(m),_=fs(p,(-g-v)/f);if(gs(_,u),_=cs(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],A=i[1];x0^_[1]<(Wi(_[0]-b)zi^(b<=_[0]&&_[0]<=x)){var T=fs(p,(-g+v)/f);return gs(T,u),[_,cs(T)]}}}function o(e,i){var n=s?t:zi-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return Is(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],f=r(d,u),m=s?f?0:o(d,u):f?o(d+(d<0?zi:-zi),u):0;if(!e&&(h=l=f)&&t.lineStart(),f!==l&&(!(p=a(e,g))||Ms(e,p)||Ms(g,p))&&(g[2]=1),f!==l)c=0,f?(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^f){var v;m&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)))}!f||e&&Ms(e,g)||t.point(g[0],g[1]),e=g,l=f,i=m},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=$i(e),o=Zi(e),l=s*i;null==n?(n=e+s*Vi,r=e-l/2):(n=As(a,n),r=As(a,r),(s>0?nr)&&(n+=s*Vi));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 Wi(s[0]-t)0?0:3:Wi(s[0]-i)0?2:1:Wi(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,f,m,v,_,y=a,b=ks(),x={point:S,lineStart:function(){x.point=A,h&&h.push(c=[]);v=!0,m=!1,g=f=NaN},lineEnd:function(){l&&(A(d,u),p&&m&&b.rejoin(),l.push(b.result()));x.point=S,m&&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=Os(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&ws(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&&m)y.point(r,a);else{var l=[g=Math.max(Vs,Math.min(Hs,g)),f=Math.max(Vs,Math.min(Hs,f))],b=[r=Math.max(Vs,Math.min(Hs,r)),a=Math.max(Vs,Math.min(Hs,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):(m||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,f=a,m=o}return x}}function Us(t){return t}var Ws,Gs,Ys,$s,Xs=Ri(),Ks=Ri(),qs={point:ss,lineStart:ss,lineEnd:ss,polygonStart:function(){qs.lineStart=Zs,qs.lineEnd=tn},polygonEnd:function(){qs.lineStart=qs.lineEnd=qs.point=ss,Xs.add(Wi(Ks)),Ks.reset()},result:function(){var t=Xs/2;return Xs.reset(),t}};function Zs(){qs.point=Js}function Js(t,e){qs.point=Qs,Ws=Ys=t,Gs=$s=e}function Qs(t,e){Ks.add($s*t-Ys*e),Ys=t,$s=e}function tn(){Qs(Ws,Gs)}var en=qs,sn=1/0,nn=sn,rn=-sn,an=rn;var on,ln,hn,cn,dn={point:function(t,e){trn&&(rn=t);ean&&(an=e)},lineStart:ss,lineEnd:ss,polygonStart:ss,polygonEnd:ss,result:function(){var t=[[sn,nn],[rn,an]];return rn=an=-(nn=sn=1/0),t}},un=0,pn=0,gn=0,fn=0,mn=0,vn=0,_n=0,yn=0,bn=0,xn={point:Sn,lineStart:An,lineEnd:Tn,polygonStart:function(){xn.lineStart=wn,xn.lineEnd=Cn},polygonEnd:function(){xn.point=Sn,xn.lineStart=An,xn.lineEnd=Tn},result:function(){var t=bn?[_n/bn,yn/bn]:vn?[fn/vn,mn/vn]:gn?[un/gn,pn/gn]:[NaN,NaN];return un=pn=gn=fn=mn=vn=_n=yn=bn=0,t}};function Sn(t,e){un+=t,pn+=e,++gn}function An(){xn.point=kn}function kn(t,e){xn.point=Mn,Sn(hn=t,cn=e)}function Mn(t,e){var i=t-hn,s=e-cn,n=Qi(i*i+s*s);fn+=n*(hn+t)/2,mn+=n*(cn+e)/2,vn+=n,Sn(hn=t,cn=e)}function Tn(){xn.point=Sn}function wn(){xn.point=En}function Cn(){Bn(on,ln)}function En(t,e){xn.point=Bn,Sn(on=hn=t,ln=cn=e)}function Bn(t,e){var i=t-hn,s=e-cn,n=Qi(i*i+s*s);fn+=n*(hn+t)/2,mn+=n*(cn+e)/2,vn+=n,_n+=(n=cn*t-hn*e)*(hn+t),yn+=n*(cn+e),bn+=3*n,Sn(hn=t,cn=e)}var Pn=xn;function Ln(t){this._context=t}Ln.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,Vi)}},result:ss};var Rn,On,In,Dn,Fn,zn=Ri(),jn={point:ss,lineStart:function(){jn.point=Hn},lineEnd:function(){Rn&&Vn(On,In),jn.point=ss},polygonStart:function(){Rn=!0},polygonEnd:function(){Rn=null},result:function(){var t=+zn;return zn.reset(),t}};function Hn(t,e){jn.point=Vn,On=Dn=t,In=Fn=e}function Vn(t,e){Dn-=t,Fn-=e,zn.add(Qi(Dn*Dn+Fn*Fn)),Dn=t,Fn=e}var Nn=jn;function Un(){this._string=[]}function Wn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Gn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),hs(t,i(s))),s.result()}return r.area=function(t){return hs(t,i(en)),en.result()},r.measure=function(t){return hs(t,i(Nn)),Nn.result()},r.bounds=function(t){return hs(t,i(dn)),dn.result()},r.centroid=function(t){return hs(t,i(Pn)),Pn.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Us):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Un):new Ln(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 Yn(t){return function(e){var i=new $n;for(var s in t)i[s]=t[s];return i.stream=e,i}}function $n(){}function Xn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),hs(i,t.stream(dn)),e(dn.result()),null!=s&&t.clipExtent(s),t}function Kn(t,e,i){return Xn(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 qn(t,e,i){return Kn(t,[[0,0],e],i)}function Zn(t,e,i){return Xn(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 Jn(t,e,i){return Xn(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)}Un.prototype={_radius:4.5,_circle:Wn(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=Wn(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}},$n.prototype={constructor:$n,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 Qn=16,tr=$i(30*Ui);function er(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&f--){var b=a+u,x=o+p,S=l+g,A=Qi(b*b+x*x+S*S),k=is(S/=A),M=Wi(Wi(S)-1)e||Wi((v*E+_*B)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Ui:0,E()):[m*Ni,v*Ni,_*Ni]},w.angle=function(t){return arguments.length?(y=t%360*Ui,E()):y*Ni},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=er(o,T=t*t),B()):Qi(T)},w.fitExtent=function(t,e){return Kn(w,t,e)},w.fitSize=function(t,e){return qn(w,t,e)},w.fitWidth=function(t,e){return Zn(w,t,e)},w.fitHeight=function(t,e){return Jn(w,t,e)},function(){return e=t.apply(this,arguments),w.invert=e.invert&&C,E()}}function or(t){var e=0,i=zi/3,s=ar(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Ui,i=t[1]*Ui):[e*Ni,i*Ni]},n}function lr(t,e){var i=Zi(t),s=(i+Zi(e))/2;if(Wi(s)2?t[2]*Ui:0),e.invert=function(e){return(e=t.invert(e[0]*Ui,e[1]*Ui))[0]*=Ni,e[1]*=Ni,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===fr?[[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 vr(t){return ts((ji+t)/2)}function _r(t,e){var i=$i(t),s=t===e?Zi(t):Ki(i/$i(e))/Ki(vr(e)/vr(t)),n=i*qi(vr(t),s)/s;if(!s)return fr;function r(t,e){n>0?e<-ji+Fi&&(e=-ji+Fi):e>ji-Fi&&(e=ji-Fi);var i=n/qi(vr(e),s);return[i*Zi(s*t),n-i*$i(s*t)]}return r.invert=function(t,e){var i=n-e,r=Ji(s)*Qi(t*t+i*i),a=Yi(t,Wi(i))*Ji(i);return i*s<0&&(a-=zi*Ji(t)*Ji(i)),[a/s,2*Gi(qi(n/r,1/s))-ji]},r}function yr(t,e){return[t,e]}function br(t,e){var i=$i(t),s=t===e?Zi(t):(i-$i(e))/(e-t),n=i/s+t;if(Wi(s)Fi&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},Er.invert=ur(is),Br.invert=ur((function(t){return 2*Gi(t)})),Pr.invert=function(t,e){return[-e,2*Gi(Xi(t))-ji]};var Or={exports:{}},Ir=function(t,e){this.p1=t,this.p2=e};Ir.prototype.rise=function(){return this.p2[1]-this.p1[1]},Ir.prototype.run=function(){return this.p2[0]-this.p1[0]},Ir.prototype.slope=function(){return this.rise()/this.run()},Ir.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},Ir.prototype.isVertical=function(){return!isFinite(this.slope())},Ir.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},Ir.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},Ir.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},Ir.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)},Ir.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var Dr=Ir,Fr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new Dr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=Fr(t.slice(0,s),e),o=Fr(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},zr=Fr;!function(t){var e=zr;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;r{const i=Hr(Ur,e),{tolerance:s}=i;return jr(t,s)};var Gr;!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"}(Gr||(Gr={}));const Yr=(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.sort&&(k(l.sortIndex)||(l.sortIndex=0),p(l.sortReverse)||(l.sortReverse="desc"===l.sort)),!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;s{var i,s,n,r;const{numBins:a,thresholds:o,countName:l,percentageName:h,valuesName:c,countField:d,field:u,n:p,x0Name:g,x1Name:f}=e,m=e.groupField,v=Array.isArray(m)?m.length>0:!!m,_=[];if(!v)for(let t=0;tnew Map)):[],x=v?new Array(a).fill(0).map((()=>new Map)):[],S=[],A=new Set,k=new Map;for(let n=0;n=u&&hString(t[n][e]))).join("||"):String(t[n][m]);const o=b[r],l=null!==(s=o.get(i))&&void 0!==s?s:0;if(o.set(i,l+a),A.has(i)||(A.add(i),S.push(i),y(m)?k.set(i,Object.fromEntries(m.map((e=>[e,t[n][e]])))):k.set(i,t[n][m])),e&&e.includeValues){const e=x[r];e.has(i)||e.set(i,[]);const s=e.get(i);s&&s.push(t[n])}}else _[r][l]+=a;e&&e.includeValues&&!v&&_[r][c].push(t[n]);break}}}let M=0;const T=[];if(v){for(let t=0;t0?e[l]/t:0}else{for(let t=0,e=_.length;t0?_[t][l]/M:0,T.push(_[t])}return T},Xr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d;const p=null==e?void 0:e.field;if(!p)return[];const g=e.countField,f=t.length;let m,v=1/0,_=-1/0;if(e.extent)v=e.extent[0],_=e.extent[1];else for(let e=0;e_&&(_=s))}if(!Number.isFinite(v)||!Number.isFinite(_)||0===f)return[];if(e.thresholds&&e.thresholds.length)m=e.thresholds.slice(),m.sort(((t,e)=>t-e));else if("number"==typeof e.step&&e.step>0){const t=e.step;let i=v;for(e.extent||(i=Math.floor(v/t)*t),m=[i];i<=_;)i+=t,m.push(i)}else{let t=e.bins&&e.bins>0?Math.floor(e.bins):10;if(_-v>1){const e=Math.floor(v),i=Math.ceil((_-e)/t);m=new Array(t+1);for(let s=0;s<=t;s++)if(m[s]=e+i*s,m[s]>_){t=s,m.length=t+1;break}}else{const e=(_-v)/t;m=new Array(t+1);for(let i=0;i<=t;i++)if(m[i]=v+e*i,m[i]>_){t=i,m.length=t+1;break}}}const b=Math.max(0,m.length-1);if(0===b)return[];const x=null!==(s=null===(i=e.outputNames)||void 0===i?void 0:i.x0)&&void 0!==s?s:"x0",S=null!==(r=null===(n=e.outputNames)||void 0===n?void 0:n.x1)&&void 0!==r?r:"x1",A=null!==(o=null===(a=e.outputNames)||void 0===a?void 0:a.count)&&void 0!==o?o:"count",k=null!==(h=null===(l=e.outputNames)||void 0===l?void 0:l.values)&&void 0!==h?h:"values",M=null!==(d=null===(c=e.outputNames)||void 0===c?void 0:c.percentage)&&void 0!==d?d:"percentage",T=y(null==e?void 0:e.facetField)?null==e?void 0:e.facetField:(null==e?void 0:e.facetField)?[e.facetField]:[],w=y(null==e?void 0:e.groupField)?null==e?void 0:e.groupField:(null==e?void 0:e.groupField)?[e.groupField]:[],C=w.length?w:void 0,E=Object.assign(Object.assign({},e),{numBins:b,thresholds:m,countName:A,percentageName:M,valuesName:k,countField:g,field:p,n:f,x0Name:x,x1Name:S,groupField:C});if(!T.length)return $r(t,E);const B={};return t.forEach((t=>{const e=T.map((e=>null==t?void 0:t[e])).join("-&&-");B[e]?B[e].push(t):B[e]=[t]})),Object.values(B).map((t=>{const e=[...w,...T];return $r(t,Object.assign(Object.assign({},E),{groupField:e.length?e:void 0,n:t.length}))})).flat()},Kr=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,v,_;const b=null==e?void 0:e.field;if(!b)return[];const x=null==e?void 0:e.groupField;let S=null!==(i=null==e?void 0:e.whiskers)&&void 0!==i?i:1.5;const A=!!(null==e?void 0:e.includeValues),k=null!==(s=null==e?void 0:e.outputNames)&&void 0!==s?s:{},M=null!==(n=k.key)&&void 0!==n?n:y(x)?null:null!==(r=x)&&void 0!==r?r:"key",T=null!==(a=k.count)&&void 0!==a?a:"count",w=null!==(o=k.mean)&&void 0!==o?o:"mean",C=null!==(l=k.q1)&&void 0!==l?l:"q1",E=null!==(h=k.median)&&void 0!==h?h:"median",B=null!==(c=k.q3)&&void 0!==c?c:"q3",P=null!==(d=k.iqr)&&void 0!==d?d:"iqr",L=null!==(p=k.min)&&void 0!==p?p:"min",R=null!==(g=k.max)&&void 0!==g?g:"max",O=null!==(f=k.lowerWhisker)&&void 0!==f?f:"lowerWhisker",I=null!==(m=k.upperWhisker)&&void 0!==m?m:"upperWhisker",D=null!==(v=k.outliers)&&void 0!==v?v:"outliers",F=null!==(_=k.values)&&void 0!==_?_:"values",z=new Map,j=new Map,H=new Map,V=t.length;for(let e=0;eString(i[t]))).join("||"):x?String(i[x]):"___all",z.has(r)||(z.set(r,[]),A&&j.set(r,[]),y(x)?H.set(r,Object.fromEntries(x.map((t=>[t,i[t]])))):H.set(r,x?i[x]:null));const a=z.get(r);if(a&&a.push(n),A){const t=j.get(r);t&&t.push(i)}}y(S)&&(S=[vt(Math.min.apply(null,S),0,1),vt(Math.max.apply(null,S),0,1)]);const N=[];for(const[t,e]of z){if(!e||0===e.length)continue;const i=e.slice().sort(((t,e)=>t-e)),s=i.length,n=i[0],r=i[i.length-1];let a=0;for(let t=0;tp)&&g.push(i[t]);const f={},m=H.get(t);if(null!==M)f[M]=m;else if(y(x)){const t=m||{};for(const e of x)f[e]=t[e]}f[T]=s,f[w]=o,f[C]=l,f[E]=h,f[B]=c,f[P]=d,f[L]=n,f[R]=r,f[O]=u,f[I]=p,f[D]=g,A&&(f[F]=j.get(t)||[]),N.push(f)}return N};var qr={},Zr={};function Jr(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function Qr(t){var e=Object.create(null),i=[];return t.forEach((function(t){for(var s in t)s in e||i.push(e[s]=s)})),i}function ta(t,e){var i=t+"",s=i.length;return s9999?"+"+ta(e,6):ta(e,4))+"-"+ta(t.getUTCMonth()+1,2)+"-"+ta(t.getUTCDate(),2)+(r?"T"+ta(i,2)+":"+ta(s,2)+":"+ta(n,2)+"."+ta(r,3)+"Z":n?"T"+ta(i,2)+":"+ta(s,2)+":"+ta(n,2)+"Z":s||i?"T"+ta(i,2)+":"+ta(s,2)+"Z":"")}function ia(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 Zr;if(h)return h=!1,qr;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(;a0}function pa(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=aa(t));var r=[];switch(t.type){case"GeometryCollection":return ga(t,(function(t){ma(t,s)})),t;case"FeatureCollection":return pa(t,(function(t){pa(ma(t,s),(function(t){r.push(t)}))})),li(r)}return ma(t,s)}function ma(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return ga(t,(function(t){ma(t,e)})),t;case"LineString":return va(da(t),e),t;case"Polygon":return _a(da(t),e),t;case"MultiLineString":return da(t).forEach((function(t){va(t,e)})),t;case"MultiPolygon":return da(t).forEach((function(t){_a(t,e)})),t;case"Point":case"MultiPoint":return t}}function va(t,e){ua(t)===e&&t.reverse()}function _a(t,e){ua(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=ya(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},Aa=(t,e={},i)=>{i.type=Gr.GEO;const s=Hr(xa,e),{centroid:n,name:r,bbox:a,rewind:o}=s;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(Sa(t))})):e.push(Sa(t))})),e})(t);let l=t.features;return o&&(l=fa(t,{reverse:!g(o)||o.reverse}).features),l.forEach((t=>{if(n){const e=ba.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(r&&(t.name=t.properties.name),a){const e=ba.bounds(t);t.bbox=e}})),t.features=l,t},ka={},Ma=(t,e,i)=>{i.type=Gr.GEO;const s=Hr(xa,ka,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 Rr(a,t)}))}:Rr(a,o));var a,o;return Aa(r,s,i)},Ta=(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 wa=0;function Ca(t="dataset"){return wa>1e8&&(wa=0),t+"_"+wa++}class Ea{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:Ca("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()}}class Ba{constructor(t,e){let i;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=(t={})=>{const e=this.latestData;return this.isRunning=!0,this.resetTransformData(),this.transformsArr.forEach((e=>{this.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1})})),this.isRunning=!1,!1===t.emitMessage||t.skipEqual&&U(e,this.latestData)||this.target.emit("change",{latestData:this.latestData}),this},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},i=(null==e?void 0:e.name)?e.name:Ca("dataview"),this.name=i,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(i,this),this.setFields(null==e?void 0:e.fields)}parse(t,e,i=!1){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,e=!0){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)}i&&this.transformsArr.push(t),e&&this.executeTransform(t)}return this.sortTransform(),this.isRunning=!1,this}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,e={}){const{pushHistory:i,emitMessage:s,skipEqual:n}=e,r=this.dataSet.getTransform(t.type),a=this.latestData,o=r(a,t.options);this.history&&!1!==i&&this.historyData.push(o),this.latestData=o,!1===s||n&&U(a,this.latestData)||this.target.emit("change",{latestData:this.latestData})}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}cloneParseData(t,e){let i=!1;return t instanceof Ba||!0!==(null==e?void 0:e.clone)||(i=!0),i?I(t):t}parseNewData(t,e){this.parse(t,e||this.parseOption),this.reRunAllTransform()}updateRawData(t,e){const i=this.cloneParseData(t,e);this.rawData=i,this.parserData=i,this.latestData=i,this.reRunAllTransform()}getFields(){var t;return this._fields?this._fields:"dataview"===(null===(t=this.parseOption)||void 0===t?void 0:t.type)&&1===this.rawData.length&&this.rawData[0].getFields?this.rawData[0].getFields():null}setFields(t,e=!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",Yr),this.transform({type:"fields",options:{fields:this._fields}},!1)):i&&(i.options.fields=this._fields)}destroy(){this.dataSet.removeDataView(this.name),this.latestData=null,this.rawData=null,this.parserData=null,this.transformsArr=null,this.target=null}}Gn();const Pa={},La={albers:cr,albersusa:function(){var t,e,i,s,n,r,a=cr(),o=hr().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=hr().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)}},Ra=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Oa(t,e){return function i(){const s=e();return s.type=t,s.path=Gn().projection(s),s.copy=s.copy||function(){const t=i();return Ra.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}class Ia{static GenAutoIncrementId(){return Ia.auto_increment_id++}}Ia.auto_increment_id=0;class Da{constructor(t){this.id=Ia.GenAutoIncrementId(),this.registry=t}}const Fa="named",za="inject",ja="multi_inject",Ha="inversify:tagged",Va="inversify:paramtypes";class Na{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===Fa?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var Ua=function(t){var e;return function(t){const e="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),s=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),n=new WeakMap;function r(t,e,i){let r=n.get(t);if(h(r)){if(!i)return;r=new s,n.set(t,r)}let a=r.get(e);if(h(a)){if(!i)return;a=new s,r.set(e,a)}return a}function a(t,e,i){if(o(t,e,i))return!0;const s=f(e);return!c(s)&&a(t,s,i)}function o(t,e,i){const s=r(e,i,!1);return!h(s)&&!!s.has(t)}function l(t,e,i){if(o(t,e,i))return function(t,e,i){const s=r(e,i,!1);if(!h(s))return s.get(t)}(t,e,i);const s=f(e);return c(s)?void 0:l(t,s,i)}function h(t){return void 0===t}function c(t){return null===t}function d(t){return"object"==typeof t?null!==t:"function"==typeof t}function u(t,i){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const s=3===i?"string":5===i?"number":"default",n=function(t,e){const i=t[e];if(null!=i){if(!g(i))throw new TypeError;return i}}(t,e);if(void 0!==n){const e=n.call(t,s);if(d(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.valueOf;if(g(i)){const e=i.call(t);if(!d(e))return e}}else{const e=t.valueOf;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.toString;if(g(i)){const e=i.call(t);if(!d(e))return e}}throw new TypeError}(t,"default"===s?"number":s)}function p(t){const e=u(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function g(t){return"function"==typeof t}function f(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const s=t.prototype,n=s&&Object.getPrototypeOf(s);if(null==n||n===Object.prototype)return e;const r=n.constructor;return"function"!=typeof r||r===t?e:r}t("defineMetadata",(function(t,e,i,s){if(!d(i))throw new TypeError;return n=t,a=e,void r(i,s,!0).set(n,a);var n,a})),t("hasMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),l(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function Wa(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};Ua.hasOwnMetadata(t,e)&&(r=Ua.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,Ua.defineMetadata(t,r,e)}(Ha,t,i.toString(),s)}function Ga(t){return(e,i,s)=>{Wa(e,0,s,t)}}function Ya(t){return e=>(i,s,n)=>Ga(new Na(t,e))(i,s,n)}const $a=Ya(za),Xa=Ya(ja);function Ka(){return function(t){return Ua.defineMetadata(Va,null,t),t}}function qa(t){return Ga(new Na(Fa,t))}const Za="Singleton",Ja="Transient",Qa="ConstantValue",to="DynamicValue",eo="Factory",io="Function",so="Instance",no="Invalid";class ro{constructor(t,e){this.id=Ia.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=no,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new ro(this.serviceIdentifier,this.scope);return t.activated=t.scope===Za&&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 ao{getConstructorMetadata(t){return{compilerGeneratedMetadata:Ua.getMetadata(Va,t),userGeneratedMetadata:Ua.getMetadata(Ha,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const oo=(lo=Fa,t=>{const e=e=>{if(null==e)return!1;if(e.key===lo&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const uo=Symbol("ContributionProvider");class po{constructor(t,e){this.serviceIdentifier=t,this.container=e,fo.setStore(this.serviceIdentifier,this)}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}refresh(){this.caches&&(this.caches.length=0,this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier)))}}function go(t,e){t(uo).toDynamicValue((({container:t})=>new po(e,t))).inSingletonScope().whenTargetNamed(e)}class fo{static getStore(t){return this.store.get(t)}static setStore(t,e){this.store.set(t,e)}static refreshAllContributions(){this.store.forEach((t=>{t.refresh()}))}}fo.store=new Map;class mo{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 vo extends mo{call(...t){this.taps.map((t=>t.fn)).forEach((e=>e(...t)))}}const _o=Symbol.for("EnvContribution"),yo=Symbol.for("VGlobal"),bo=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Ja,this.options=e,this.id=Ia.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new ao}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,Fa,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new ro(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new co(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[za],multiInject:s[ja]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l=(this._bindingDictionary.get(a)||[]).filter((t=>t.constraint(o)));if(l.length){const t={injectIdentifier:a,metadata:e,bindings:l};n.push(t)}}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case Qa:case io:e=t.cache;break;case so: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===Za&&(t.cache=e,t.activated=!0)}},xo=Symbol.for("RenderService");const So=new class{get renderService(){return this._renderService||(this._renderService=bo.get(xo)),this._renderService}};let Ao=0;class ko{constructor(){this.nextAnimationFrameCbs=new Map,this._rafHandle=null,this.runAnimationFrame=t=>{this._rafHandle=null;const e=this.nextAnimationFrameCbs;this.nextAnimationFrameCbs=new Map,e.forEach((e=>e(t)))},this.tryRunAnimationFrameNextFrame=()=>{null===this._rafHandle&&0!==this.nextAnimationFrameCbs.size&&(this._rafHandle=So.global.getRequestAnimationFrame()(this.runAnimationFrame))}}addAnimationFrameCb(t){return this.nextAnimationFrameCbs.set(++Ao,t),this.tryRunAnimationFrameNextFrame(),Ao}removeAnimationFrameCb(t){return!!this.nextAnimationFrameCbs.has(t)&&(this.nextAnimationFrameCbs.delete(t),!0)}}class Mo{constructor(){this._listenerMap=new Map,this._eventListenerTransformer=t=>t}setEventListenerTransformer(t){this._eventListenerTransformer=t||(t=>t)}addEventListener(t,e,i){if(!e)return;const s=this._resolveCapture(i),n=this._resolveOnce(i),r=this._getOrCreateListenerTypeMap(t),a=this._getOrCreateWrappedMap(r,e);if(a.has(s))return;const o=i=>{const r=this._eventListenerTransformer(i);"function"==typeof e?e(r):e.handleEvent&&e.handleEvent(r),n&&this._deleteListenerRecord(t,e,s)};a.set(s,{wrappedListener:o,options:i}),this._nativeAddEventListener(t,o,i)}removeEventListener(t,e,i){var s,n;if(!e)return;const r=this._resolveCapture(i),a=null===(n=null===(s=this._listenerMap.get(t))||void 0===s?void 0:s.get(e))||void 0===n?void 0:n.get(r);a&&(this._nativeRemoveEventListener(t,a.wrappedListener,r),this._deleteListenerRecord(t,e,r))}dispatchEvent(t){return this._nativeDispatchEvent(t)}clearAllEventListeners(){this._listenerMap.forEach(((t,e)=>{t.forEach((t=>{t.forEach(((t,i)=>{this._nativeRemoveEventListener(e,t.wrappedListener,i)}))}))})),this._listenerMap.clear()}_resolveCapture(t){return"boolean"==typeof t?t:!!(null==t?void 0:t.capture)}_resolveOnce(t){return"object"==typeof t&&!!(null==t?void 0:t.once)}_getOrCreateListenerTypeMap(t){let e=this._listenerMap.get(t);return e||(e=new Map,this._listenerMap.set(t,e)),e}_getOrCreateWrappedMap(t,e){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}_deleteListenerRecord(t,e,i){const s=this._listenerMap.get(t);if(!s)return;const n=s.get(e);n&&(n.delete(i),0===n.size&&s.delete(e),0===s.size&&this._listenerMap.delete(t))}_nativeAddEventListener(t,e,i){throw new Error("_nativeAddEventListener must be implemented by derived classes")}_nativeRemoveEventListener(t,e,i){throw new Error("_nativeRemoveEventListener must be implemented by derived classes")}_nativeDispatchEvent(t){throw new Error("_nativeDispatchEvent must be implemented by derived classes")}}var To=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wo=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Co=function(t,e){return function(i,s){e(i,s,t)}},Eo=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 Bo=class extends Mo{get env(){return this._env}get isImageAnonymous(){return this._isImageAnonymous}set isImageAnonymous(t){this._isImageAnonymous=t}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){super(),this.contributions=t,this._isImageAnonymous=!0,this._performanceRAFList=[],this.eventListenerTransformer=t=>t,this.id=Ia.GenAutoIncrementId(),this.hooks={onSetEnv:new vo(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}_nativeAddEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}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)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getSpecifiedRequestAnimationFrame(t){this._env||this.setEnv("browser"),this._performanceRAFList[t]||(this._performanceRAFList[t]=new ko);const e=this._performanceRAFList[t];return t=>e.addAnimationFrameCb(t)}getSpecifiedCancelAnimationFrame(t){if(this._env||this.setEnv("browser"),!this._performanceRAFList[t])return()=>!1;const e=this._performanceRAFList[t];return t=>e.removeAnimationFrameCb(t)}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)}loadFont(t,e,i){return Eo(this,void 0,void 0,(function*(){return this._env||this.setEnv("browser"),this.envContribution.loadFont(t,e,i)}))}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,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t,e=!1){return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}isMacOS(){return this._env||this.setEnv("browser"),this.envContribution.isMacOS()}copyToClipBoard(t){return this._env||this.setEnv("browser"),this.envContribution.copyToClipBoard(t)}};var Po,Lo,Ro,Oo;Bo=To([Ka(),Co(0,$a(uo)),Co(0,qa(_o)),wo("design:paramtypes",[Object])],Bo),function(t){t[t.estimate=0]="estimate",t[t.actualBounding=1]="actualBounding",t[t.fontBounding=2]="fontBounding"}(Po||(Po={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(Lo||(Lo={})),function(t){t.wait="wait",t.from="from",t.to="to",t.customAnimate="customAnimate"}(Ro||(Ro={})),function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSED=2]="PAUSED",t[t.END=3]="END"}(Oo||(Oo={}));const Io=Ht-1e-8;class Do{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>Io)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%=Ht)<0&&(s+=Ht),(n%=Ht)<0&&(n+=Ht),nn;++o,a-=jt)g(a);else for(a=s-s%jt+jt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const zo=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,jo={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},Ho={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let Vo,No,Uo,Wo,Go,Yo;var $o,Xo,Ko,qo,Zo,Jo;function Qo(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),f=Math.cos(n),m=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+f,A=i+m,k=S+y*m,M=A-y*f;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 tl(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=ae(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 f=d/i,m=c/i,v=-c/s,_=d/s,y=f*o+m*l,b=v*o+_*l,x=f*t+m*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+=Ht:C>0&&0===r&&(C-=Ht);const E=Math.ceil(Math.abs(C/(jt+.001))),B=[];for(let t=0;te.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 il(t,e,i=0,s=0,n=1,r=1,a){for(let o=0;o=1)t.bezierCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i,this.p3.x*s+e,this.p3.y*n+i);else if(r>0){const[a]=hl(this,r);t.bezierCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i,a.p3.x*s+e,a.p3.y*n+i)}}includeX(t){const e=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x);return t>=e&&t<=i}getYAt(t){const e=Yt(this.p0.x,this.p1.x,this.p2.x,this.p3.x),i=(t-e)/(Gt(this.p0.x,this.p1.x,this.p2.x,this.p3.x)-e);return this.getPointAt(i).y}}function dl(t,e){const{p0:i,p1:s}=t,n=re.pointAtPP(i,s,e);return[new ul(i,n),new ul(n,s)]}class ul extends sl{constructor(t,e){super(),this.type=Zo.LineCurve,this.p0=t,this.p1=e}getPointAt(t){if(!1!==this.defined)return re.pointAtPP(this.p0,this.p1,t);throw new Error("defined为false的点不能getPointAt")}getAngleAt(t){return null==this.angle&&(this.angle=Ut(this.p1.y-this.p0.y,this.p1.x-this.p0.x)),this.angle}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y)}calcLength(){return this._validPoint()?re.distancePP(this.p0,this.p1):60}calcProjLength(t){return t===qo.ROW?Nt(this.p0.x-this.p1.x):t===qo.COLUMN?Nt(this.p0.y-this.p1.y):0}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.lineTo(this.p1.x*s+e,this.p1.y*n+i);else if(r>0){const a=this.getPointAt(r);t.lineTo(a.x*s+e,a.y*n+i)}}includeX(t){return t>=this.p0.x&&t<=this.p1.x||t>=this.p1.x&&t<=this.p0.x}getYAt(t){if(this.includeX(t)){let e=this.p0,i=this.p1;this.p0.x>this.p1.x&&(e=this.p1,i=this.p0);const s=(t-e.x)/(i.x-e.x);return e.y+s*(i.y-e.y)}return 1/0}}class pl{get endX(){return this._lastX}get endY(){return this._lastY}constructor(t,e){this.init(t,e)}init(t,e){this._lastX=this._lastY=this._startX=this._startY=0,this.curveType=t,this.direction=e,this.curves=[]}bezierCurveTo(t,e,i,s,n,r,a,o){const l=new cl(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s),new ne(n,r));l.originP1=this._lastOriginP,l.originP2=o,l.defined=a,this.curves.push(l),this._lastX=n,this._lastY=r,this._lastOriginP=o}closePath(){if(this.curves.length<2)return;const t=this.curves[this.curves.length-1];this.lineTo(this._startX,this._startY,t.defined,this._startOriginP)}ellipse(){throw new Error("SegContext不支持调用ellipse")}lineTo(t,e,i,s){const n=this.addLinearCurve(t,e,i,this._lastOriginP,s);this.curves.push(n),this._lastX=t,this._lastY=e,this._lastOriginP=s}moveTo(t,e,i){return this._lastX=this._startX=t,this._lastY=this._startY=e,this._lastOriginP=i,this._startOriginP=i,this}quadraticCurveTo(t,e,i,s){throw new Error("SegContext不支持调用quadraticCurveTo")}clear(){this.curves=[],this.length=NaN}tryUpdateLength(t){return this.getLength(t)}addLinearCurve(t,e,i,s,n){const r=new ul(new ne(this._lastX,this._lastY),new ne(t,e));return r.originP1=s,r.originP2=n,r.defined=i,r}getPointAt(t){throw new Error("暂未实现")}getCurveLengths(){return[]}getLength(t){var e,i;if(t===qo.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],i=this.curves[this.curves.length-1],s=null!==(e=i.p3)&&void 0!==e?e:i.p1;return Nt(t.p0.y-s.y)}if(t===qo.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1],s=null!==(i=e.p3)&&void 0!==i?i:e.p1;return Nt(t.p0.x-s.x)}return Number.isFinite(this.length)||(this.length=this.curves.reduce(((t,e)=>t+e.getLength()),0)),this.length}}class gl extends pl{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 fl(t,e,i=1){let s=!1;for(let i=0,n=e.length;i<=n;i++)i>=n===s&&((s=!s)?t.lineStart():t.lineEnd()),s&&t.point(e[i])}function ml(t,e,i){const s=null!=e?e:Nt(i[i.length-1].x-i[0].x)>Nt(i[i.length-1].y-i[0].y)?qo.ROW:qo.COLUMN;return"monotoneY"===t?new gl(t,s):new pl(t,s)}class vl{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 _l(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=ml("linear",i,t);return function(t,e){fl(t,e,1)}(new vl(n,s),t),n}function yl(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 bl{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&&yl(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:yl(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 xl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return _l(t,e);const n=ml("basis",i,t);return function(t,e){fl(t,e,2)}(new bl(n,s),t),n}function Sl(t){return t<0?-1:1}function Al(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(Sl(r)+Sl(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function kl(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Ml(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:Ml(this,this._t0,kl(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,Ml(this,kl(this,e=Al(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Ml(this,this._t0,e=Al(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 wl extends Tl{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Cl(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return _l(t,e);const n=ml("monotoneX",i,t);return function(t,e){fl(t,e,2)}(new Tl(n,s),t),n}function El(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return _l(t,e);const n=ml("monotoneY",i,t);return function(t,e){fl(t,e,2)}(new wl(n,s),t),n}let Bl=class{constructor(t,e=.5,i){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;.5===this._t?this.context.lineTo(s,this._y,!1!==this._lastDefined,this.lastPoint):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()}};class Pl extends Bl{lineEnd(){this.context.closePath()}}function Ll(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new pl("step",null!=s?s:Nt(t[t.length-1].x-t[0].x)>Nt(t[t.length-1].y-t[0].y)?qo.ROW:qo.COLUMN);return Rl(new Bl(r,e,n),t),r}function Rl(t,e){return fl(t,e,1)}class Ol extends vl{lineEnd(){this.context.closePath()}}function Il(t,e={}){const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=ml("linear",i,t);return function(t,e){fl(t,e,1)}(new Ol(n,s),t),n}function Dl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Ft){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>Ft){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function Fl(t,e){return function(i,s,n={}){const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return _l(i,n);const o=ml(t,r,i);return fl(new e(o,s,a),i,2),o}}const zl=Fl("catmullRom",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:Dl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const jl=Fl("catmullRomClosed",class{constructor(t,e=.5,i){this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:Dl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});class Hl extends sl{constructor(t,e,i){super(),this.type=Zo.QuadraticBezierCurve,this.p0=t,this.p1=e,this.p2=i}_validPoint(){return Number.isFinite(this.p0.x+this.p0.y+this.p1.x+this.p1.y+this.p2.x+this.p2.y)}getPointAt(t){if(!1!==this.defined)return ll(this.p0,this.p1,this.p2,t);throw new Error("defined为false的点不能getPointAt")}calcLength(){return this._validPoint()?(t=this.p0,e=this.p1,i=this.p2,nl([t.x,e.x,i.x],[t.y,e.y,i.y])):60;var t,e,i}calcProjLength(t){return t===qo.ROW?Nt(this.p0.x-this.p2.x):t===qo.COLUMN?Nt(this.p0.y-this.p2.y):0}getAngleAt(t){const e=Gt(t-.01,0),i=Yt(t+.01,1),s=this.getPointAt(e),n=this.getPointAt(i);return Ut(n.y-s.y,n.x-s.x)}draw(t,e,i,s,n,r){if(t.moveTo(this.p0.x*s+e,this.p0.y*n+i),r>=1)t.quadraticCurveTo(this.p1.x*s+e,this.p1.y*n+i,this.p2.x*s+e,this.p2.y*n+i);else if(r>0){const[a]=function(t,e){const{p0:i,p1:s,p2:n}=t,r=ll(i,s,n,e),a=re.pointAtPP(i,s,e),o=re.pointAtPP(s,n,e);return[new Hl(i,a,r),new Hl(r,o,n)]}(this,r);t.quadraticCurveTo(a.p1.x*s+e,a.p1.y*n+i,a.p2.x*s+e,a.p2.y*n+i)}}getYAt(t){throw new Error("QuadraticBezierCurve暂不支持getYAt")}includeX(t){throw new Error("QuadraticBezierCurve暂不支持includeX")}}class Vl{constructor(t){this.path=t,this._lastX=this._lastY=this._startX=this._startY=0}moveTo(t,e){return this._lastX=this._startX=t,this._lastY=this._startY=e,this}lineTo(t,e){const i=this.addLinearCurve(t,e);this.path.addCurve(i),this._lastX=t,this._lastY=e}addLinearCurve(t,e){return new ul(new ne(this._lastX,this._lastY),new ne(t,e))}quadraticCurveTo(t,e,i,s){const n=new Hl(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s));this.path.addCurve(n),this._lastX=i,this._lastY=s}bezierCurveTo(t,e,i,s,n,r){const a=new cl(new ne(this._lastX,this._lastY),new ne(t,e),new ne(i,s),new ne(n,r));this.path.addCurve(a),this._lastX=n,this._lastY=r}arcTo(t,e,i,s,n){throw new Error("CurveContext不支持调用arcTo")}ellipse(t,e,i,s,n,r,a,o){throw new Error("CurveContext不支持调用ellipse")}rect(t,e,i,s){throw new Error("CurveContext不支持调用rect")}arc(t,e,i,s,n,r){throw new Error("CurveContext不支持调用arc")}closePath(){this.path.curves.length<2||this.lineTo(this._startX,this._startY)}}function Nl(t,e,i){var s,n;switch(e){case"linear":default:return _l(t,i);case"basis":return xl(t,i);case"monotoneX":return Cl(t,i);case"monotoneY":return El(t,i);case"step":return Ll(t,.5,i);case"stepClosed":return function(t,e,i={}){const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new pl("step",null!=s?s:Nt(t[t.length-1].x-t[0].x)>Nt(t[t.length-1].y-t[0].y)?qo.ROW:qo.COLUMN);return Rl(new Pl(r,e,n),t),r}(t,.5,i);case"stepBefore":return Ll(t,0,i);case"stepAfter":return Ll(t,1,i);case"catmullRom":return zl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return jl(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return Il(t,i)}}class Ul extends Fo{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Do(this.bounds)}get curves(){return this.tryBuildCurves()}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([Ho.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([Ho.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([Ho.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([Ho.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([Ho.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([Ho.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([Ho.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([Ho.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([Ho.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()}tryBuildCurves(){if(!this._curves||!this._curves.length){const t=new Vl(this);il(this.commandList,t,0,0,1,1)}return this._curves}toString(){if(!this.toStringCbList){const t=[];t[Ho.M]=t=>`M${t[1]} ${t[2]}`,t[Ho.L]=t=>`L${t[1]} ${t[2]}`,t[Ho.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[Ho.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[Ho.A]=t=>{const e=[],i=t[1],s=t[2],n=t[3];((t,e,i,s,n,r,a,o=!1)=>{const l=2*Math.PI,h=(e%l+l)%l;let c,d=(i%l+l)%l;o?(d>=h&&(d-=l),c=d-h):(d<=h&&(d+=l),c=d-h);const u=Math.ceil(Math.abs(c)/(.5*Math.PI)),p=c/u;for(let e=0;e`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[Ho.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,e=Uo;for(let s=1,r=i.length;s{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,e=0,i=0,s=1,n=1){let r,a,o,l,h,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;ft.slice()))}_updateBounds(){this.bounds.clear(),il(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===qo.COLUMN){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Nt(t.p0.y-e.p1.y)}if(this.direction===qo.ROW){if(!this._curves.length)return 0;const t=this._curves[0],e=this._curves[this._curves.length-1];return Nt(t.p0.x-e.p1.x)}return this._curves.reduce(((t,e)=>t+e.getLength()),0)}getYAt(t){if(!this.curves)return 1/0;for(let e=0;e=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}drawWithClipRange(t,e,i,s,n){this.tryBuildCurves();const r=this.getLength()*n;let a=0;for(let n=0;n{at.getInstance().warn("空函数")}}),oh=Object.assign(Object.assign({},Ql),{points:[],cornerRadius:0,closePath:!0}),lh=Object.assign(Object.assign({},Ql),{width:100,height:100,spikes:5,thickness:.5}),hh=Object.assign(Object.assign({},Ql),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0,cornerType:"round",drawStrokeWhenZeroWH:!1});Object.assign(Object.assign({},Ql),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0,cornerType:"round",drawStrokeWhenZeroWH:!1});const ch=Object.assign(Object.assign({},Ql),{symbolType:"circle",size:10,keepDirIn3d:!0,clipRange:1}),dh=Object.assign(Object.assign(Object.assign({},Ql),ql),{strokeBoundsBuffer:0,keepDirIn3d:!0}),uh=Object.assign(Object.assign(Object.assign({},Ql),ql),{upgradeAttrs:null,editable:!1,editOptions:null,ascentDescentMode:"actual",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}),ph=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0,maxWidth:500,maxHeight:500},Ql),{fill:!0,cornerRadius:0,cornerType:"round"}),gh=Object.assign(Object.assign({},ph),{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}),fh=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 m("directional",t.sideOrCorner,1)||m("angular",t.angleValue,1)}function a(){return m("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=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 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=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 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 mh{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(mh.IsGradientStr(t))try{const e=fh(t)[0];if(e){if("linear"===e.type)return mh.ParseLinear(e);if("radial"===e.type)return mh.ParseRadial(e);if("conic"===e.type)return mh.ParseConic(e)}}catch(e){return t}return t}static processColorStops(t){if(!t||0===t.length)return[];if(t.some((t=>t.length))){const e=t.map((t=>({color:t.value,offset:t.length?parseFloat(t.length.value)/100:-1})));e[0].offset<0&&(e[0].offset=0),e[e.length-1].offset<0&&(e[e.length-1].offset=1);for(let t=1;t{const s=t.length>1?i/(t.length-1):0;return{color:e.value,offset:s}}))}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=zt/2,n=parseFloat(e.value)/180*zt-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Vt,stops:mh.processColorStops(i)}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:mh.processColorStops(e)}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=zt/2;let n="angular"===e.type?parseFloat(e.value)/180*zt:0;for(;n<0;)n+=Vt;for(;n>=Vt;)n-=Vt;let r=0,a=0,o=0,l=0;return n{c.addColorStop(t.offset,t.color)})),c}(t,c,p,g,d,u):"conical"===c.gradient?h=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern?l.GetPattern(n+i,r+s,void 0):l}(t,c,p,g,d,u):"radial"===c.gradient&&(h=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,c,p,g,d,u))}return h||"orange"}const yh={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"}},bh=!0,xh=!1,Sh=/\w|\(|\)|-/,Ah=/[.?!,;:/,。?!、;:]/,kh=/\S/,Mh=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily})};function Th(t,e,i,s,n){if(t.length<=1)return 0;if(!e||e<=0)return 0;const r=So.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=wh(t,a)),a}function wh(t,e,i=!1){let s=e;for(;Sh.test(t[s-1])&&Sh.test(t[s])||Ah.test(t[s]);)if(s--,s<=0)return i?Ch(t,e):e;return s}function Ch(t,e){let i=e;for(;Sh.test(t[i+1])&&Sh.test(t[i])||Ah.test(t[i]);)if(i++,i>=t.length)return i;return i+1}function Eh(t,e,i="actual"){var s;if(""===t)return{ascent:0,height:0,descent:0,width:0};const n=So.graphicUtil.textMeasure.measureText(t,e),r={ascent:0,height:0,descent:0,width:0},a="actual"===i?n.actualBoundingBoxAscent:n.fontBoundingBoxAscent,o="actual"===i?n.actualBoundingBoxDescent:n.fontBoundingBoxDescent;"number"!=typeof a||"number"!=typeof o?(r.width=Math.floor(n.width),r.height=e.fontSize||0,r.ascent=r.height,r.descent=0):(r.width=Math.floor(n.width),r.height=Math.floor(a+o),r.ascent=Math.floor(a),r.descent=r.height-r.ascent);const l=null!==(s=e.space)&&void 0!==s?s:0;return r.width+=l,r}var Bh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Ph=class{constructor(){this.id="ATextMeasure"}configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}_measureTextWithoutAlignBaseline(t,e,i){this.context.setTextStyleWithoutAlignBaseline(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}_measureTextWithAlignBaseline(t,e,i){this.context.setTextStyle(e);const s=this.context.measureText(t);return i?this.compatibleMetrics(s,e):s}compatibleMetrics(t,e){if(null==t.actualBoundingBoxAscent||null==t.actualBoundingBoxDescent||null==t.fontBoundingBoxAscent||null==t.fontBoundingBoxDescent){t={width:t.width};const{ascent:i,descent:s}=this.measureTextBoundADscentEstimate(e);t.actualBoundingBoxAscent=i,t.actualBoundingBoxDescent=s,t.fontBoundingBoxAscent=i,t.fontBoundingBoxDescent=s}if(null==t.actualBoundingBoxLeft||null==t.actualBoundingBoxRight){t={width:t.width,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent};const{left:i,right:s}=this.measureTextBoundLeftRightEstimate(e);t.actualBoundingBoxLeft=i,t.actualBoundingBoxRight=s}return t}estimate(t,{fontSize:e=dh.fontSize}){let i=0,s=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 a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=wh(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_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){if(s===n){at.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}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),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);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}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,a=!1){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=wh(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}};Ph=Bh([Ka()],Ph);var Lh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Rh=Symbol.for("TextMeasureContribution");let Oh=class extends Ph{constructor(){super(...arguments),this.id="DefaultTextMeasureContribution"}};Oh=Lh([Ka()],Oh);const Ih=Symbol.for("CanvasFactory"),Dh=Symbol.for("Context2dFactory");function Fh(t){return bo.getNamed(Ih,So.global.env)(t)}const zh=1e-4,jh=Math.sqrt(3),Hh=1/3;function Vh(t){return t>-tc&&ttc||t<-tc}const Uh=[0,0],Wh=[0,0],Gh=[0,0];function Yh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function $h(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function Xh(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 Kh(t){return(t%=Vt)<0&&(t+=Vt),t}function qh(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+=Vt);let d=Math.atan2(l,o);return d<0&&(d+=Vt),d>=s&&d<=n||d+Vt>=s&&d+Vt<=n}function Qh(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(Vh(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 ic=[-1,-1,-1],sc=[-1,-1];function nc(){const t=sc[0];sc[0]=sc[1],sc[1]=t}function rc(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(Vh(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,Hh):Math.pow(i,Hh),s=s<0?-Math.pow(-s,Hh):Math.pow(s,Hh);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+jh*Math.sin(e)))/(3*a),h=(-o+i*(s-jh*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,ic);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&nc(),p=Xh(e,s,r,o,sc[0]),u>1&&(g=Xh(e,s,r,o,sc[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Vh(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,ic);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=$h(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);ic[0]=-l,ic[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Vt-1e-4){s=0,n=Vt;const e=r?1:-1;return a>=ic[0]+t&&a<=ic[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Vt,n+=Vt);let c=0;for(let e=0;e<2;e++){const i=ic[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Vt+t),(t>=s&&t<=n||t+Vt>=s&&t+Vt<=n)&&(t>zt/2&&t<1.5*zt&&(e=-e),c+=e)}}return c}function lc(t){return Math.round(t/zt*1e8)/1e8%2*zt}function hc(t,e){let i=lc(t[0]);i<0&&(i+=Vt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Vt?n=i+Vt:e&&i-n>=Vt?n=i-Vt:!e&&i>n?n=i+(Vt-lc(i-n)):e&&i1&&(i||(h+=Le(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],v=a[2],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,A=b;cc[0]=S,cc[1]=A,hc(cc,Boolean(a[6])),S=cc[0],A=cc[1];const k=S,M=A-S,T=!!(1-(a[6]?0:1)),w=(s-m)*_/_+m;switch(f){case Ho.M:u=m,p=v,c=u,d=p;break;case Ho.L:if(i){if(Qh(c,d,m,v,e,s,n))return!0}else h+=Le(c,d,m,v,s,n)||0;c=m,d=v;break;case Ho.C:if(i){if(Zh(c,d,m,v,_,y,b,x,e,s,n))return!0}else h+=rc(c,d,m,v,_,y,b,x,s,n)||0;c=b,d=x;break;case Ho.Q:if(i){if(qh(c,d,m,v,_,y,e,s,n))return!0}else h+=ac(c,d,m,v,_,y,s,n)||0;c=_,d=y;break;case Ho.A:if(o=Math.cos(k)*_+m,l=Math.sin(k)*_+v,g?(u=o,p=l):h+=Le(c,d,o,l,s,n),i){if(Jh(m,v,_,k,k+M,T,e,w,n))return!0}else h+=oc(m,v,_,k,k+M,T,w,n);c=Math.cos(k+M)*_+m,d=Math.sin(k+M)*_+v;break;case Ho.R:if(u=c=m,p=d=v,o=u+_,l=p+y,i){if(Qh(u,p,o,p,e,s,n)||Qh(o,p,o,l,e,s,n)||Qh(o,l,u,l,e,s,n)||Qh(u,l,u,p,e,s,n))return!0}else h+=Le(o,p,o,l,s,n),h+=Le(u,l,u,p,s,n);break;case Ho.Z:if(i){if(Qh(c,d,u,p,e,s,n))return!0}else h+=Le(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},gc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const fc=Symbol.for("VWindow"),mc=Symbol.for("WindowHandlerContribution");let vc=class extends Mo{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(){super(),this.hooks={onChange:new vo(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(bo.getNamed(mc,t.env).configure(this,t),this.actived=!0)},this._uid=Ia.GenAutoIncrementId(),this.global=So.global,this.postInit()}_nativeAddEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}_nativeRemoveEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}_nativeDispatchEvent(t){return this._handler.dispatchEvent(t)}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.clearAllEventListeners(),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}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&&pt(this.width,t.width())&&pt(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)}};vc=pc([Ka(),gc("design:paramtypes",[])],vc);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},yc=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},bc=function(t,e){return function(i,s){e(i,s,t)}};let xc=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=So.global,this._textMeasureMap=new Map,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}getTextMeasureInstance(t){return t&&this._textMeasureMap.get(t)||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=uc.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure&&"DefaultTextMeasureContribution"!==t.id||(this._textMeasure=t),this._textMeasureMap.has(t.id)||this._textMeasureMap.set(t.id,t)}measureText(t,e,i="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:ql.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new De(Object.assign({defaultFontParams:{fontFamily:ql.fontFamily,fontSize:ql.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+De.ALPHABET_CHAR_SET+De.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=bo.get(fc),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 Sc;xc=_c([Ka(),bc(0,$a(uo)),bc(0,qa(Rh)),yc("design:paramtypes",[Object])],xc),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Sc||(Sc={}));const Ac=new Ue;let kc=class{constructor(){this.matrix=new Ue}init(t){return this.mode=Sc.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Sc.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Ac.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(Ac.a,Ac.b,Ac.c,Ac.d,Ac.e,Ac.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Ac.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(Ac.a,Ac.b,Ac.c,Ac.d,Ac.e,Ac.f),this}scale(t,e,i){return this.mode===Sc.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Sc.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Ac.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Ac.a,Ac.b,Ac.c,Ac.d,Ac.e,Ac.f),this}translate(t,e){return this.mode===Sc.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Sc.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};kc=_c([Ka(),yc("design:paramtypes",[])],kc);const Mc={arc:th,area:eh,circle:ih,line:rh,path:ah,symbol:ch,text:dh,rect:hh,polygon:oh,star:lh,richtext:uh,richtextIcon:gh,image:ph,group:sh,glyph:nh},Tc=Object.keys(Mc);function wc(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Cc={arc:Object.assign({},Mc.arc),area:Object.assign({},Mc.area),circle:Object.assign({},Mc.circle),line:Object.assign({},Mc.line),path:Object.assign({},Mc.path),symbol:Object.assign({},Mc.symbol),text:Object.assign({},Mc.text),rect:Object.assign({},Mc.rect),polygon:Object.assign({},Mc.polygon),star:Object.assign({},Mc.star),richtext:Object.assign({},Mc.richtext),richtextIcon:Object.assign({},Mc.richtextIcon),image:Object.assign({},Mc.image),group:Object.assign({},Mc.group),glyph:Object.assign({},Mc.glyph)};class Ec{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Tc.forEach((t=>{this._defaultTheme[t]=Object.create(Cc[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,i=!1){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;Tc.forEach((s=>{const n=Object.create(Cc[s]);t&&t[s]&&wc(n,t[s]),i[s]&&wc(n,i[s]),e[s]&&wc(n,e[s]),this.combinedTheme[s]=n})),e.common&&Tc.forEach((t=>{wc(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 Bc=new Ec;function Pc(t,e){return t.glyphHost?Pc(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)):Bc.getTheme()}return null}(t)||t.attachedThemeGraphic&&Pc(t.attachedThemeGraphic)||Bc.getTheme()}var Lc=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 Rc 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=Ia.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t,e=!1){if(e){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,e=!1){return Lc(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,e=!0){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,e=!1){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this===t||t===e)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===t||t===e)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===t)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,e=!1){let 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,e=!1){let 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,e=!1){return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i{if(!(t instanceof Dc))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(Hc(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 Dc))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=Hc(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 Dc))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=Hc(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 Dc))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=Hc(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 Dc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=jc.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Hc(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(Hc(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,Hc(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(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 Dc))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"):Hc(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 Fc))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=jc.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.get(i).forEach((e=>{e.eventPhase=t.NONE,e.currentTarget=null,e.path=[],e.detailPath=[],e.target=null})),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 Vc(s,{clickInterval:a,supportsTouchEvents:o}),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 Dc,this.rootWheelEvent=new Fc,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.addEventListener("pointermove",this.onPointerMove,!0),t.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.addEventListener("mousemove",this.onPointerMove,!0),t.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.removeEventListener("pointermove",this.onPointerMove,!0),t.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.removeEventListener("mousemove",this.onPointerMove,!0),t.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 Gc{static GetImage(t,e){var i;const s=Gc.cache.get(t);s?"fail"===s.loadState?So.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):Gc.loadImage(t,e)}static GetSvg(t,e){var i;let s=Gc.cache.get(t);s?"fail"===s.loadState?So.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"},Gc.cache.set(t,s),s.dataPromise=So.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.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Gc.cache.get(t);return i?"fail"===i.loadState?Promise.reject():"init"===i.loadState||"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Gc.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=So.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=So.global.loadBlob(t):"json"===e&&(i.dataPromise=So.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Gc.isLoading&&Gc.toLoadAueue.length){Gc.isLoading=!0;const t=Gc.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Gc.cache.set(i,n),n.dataPromise=So.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))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Gc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Gc.loading()})).catch((t=>{console.error(t),Gc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Gc.loading()}))}}),0)}static loadImage(t,e){const i=Yc(t,Gc.toLoadAueue);if(-1!==i)return Gc.toLoadAueue[i].marks.push(e),void Gc.loading();Gc.toLoadAueue.push({url:t,marks:[e]}),Gc.loading()}static improveImageLoading(t){const e=Yc(t,Gc.toLoadAueue);if(-1!==e){const t=Gc.toLoadAueue.splice(e,1);Gc.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Yc(t,e){for(let i=0;it?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Kc[0]=t[0],Kc[2]=t[0],Kc[1]=t[1],Kc[3]=t[1],Kc):t:t:0,Zc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Jc=[1,2,3,0,1,2,3,0];function Qc(t,e,i,s){for(;t>=Vt;)t-=Vt;for(;t<0;)t+=Vt;for(;t>e;)e+=Vt;Zc[0].x=i,Zc[1].y=i,Zc[2].x=-i,Zc[3].y=-i;const n=Math.ceil(t/jt)%4,r=Math.ceil(e/jt)%4;if(s.add(Wt(t)*i,$t(t)*i),s.add(Wt(e)*i,$t(e)*i),n!==r||e-t>zt){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new ne(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new ne(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{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)}}sd.TimeOut=1e3/60;const nd=new sd,rd=(t,e)=>{const i=((t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t)(t,e);return isNaN(i)?i:Math.max(e,i)};class ad{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}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function od(t,e,i,s,n){return n?t.arc(i,s,e,0,Ht,!1,n):t.arc(i,s,e,0,Ht),!1}var ld=new class extends ad{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 od(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return od(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(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 hd=new class extends ad{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,this.parseSize(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,this.parseSize(e)/6,i,s,n,r)}};function cd(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 dd=new class extends ad{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 cd(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return cd(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return cd(t,this.parseSize(e)/2+n,i,s,r)}};function ud(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var pd=new class extends ad{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return ud(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return ud(t,this.parseSize(e)/2+n,i,s)}};function gd(t,e,i,s,n=0){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}class fd extends ad{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 gd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return gd(t,this.parseSize(e)/2,i,s,n)}}var md=new fd;var vd=new class extends fd{constructor(){super(...arguments),this.type="triangle"}};const _d=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),yd=Math.sin(Ht/10)*_d,bd=-Math.cos(Ht/10)*_d;function xd(t,e,i,s){const n=yd*e,r=bd*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Ht*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 Sd=new class extends ad{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 xd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return xd(t,this.parseSize(e)/2+n,i,s)}};const Ad=Xt(3);function kd(t,e,i,s){const n=e,r=n/Ad,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 Md=new class extends ad{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 kd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return kd(t,this.parseSize(e)/2+n,i,s)}};function Td(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 wd=new class extends ad{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Td(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Td(t,this.parseSize(e)/2+n,i,s)}};function Cd(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Ed=new class extends ad{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Cd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Cd(t,this.parseSize(e)/2+n,i,s)}};const Bd=-.5,Pd=Xt(3)/2,Ld=1/Xt(12);function Rd(t,e,i,s){const n=e/2,r=e*Ld,a=n,o=e*Ld+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(Bd*n-Pd*r+i,Pd*n+Bd*r+s),t.lineTo(Bd*a-Pd*o+i,Pd*a+Bd*o+s),t.lineTo(Bd*l-Pd*h+i,Pd*l+Bd*h+s),t.lineTo(Bd*n+Pd*r+i,Bd*r-Pd*n+s),t.lineTo(Bd*a+Pd*o+i,Bd*o-Pd*a+s),t.lineTo(Bd*l+Pd*h+i,Bd*h-Pd*l+s),t.closePath(),!1}var Od=new class extends ad{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 Rd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Rd(t,this.parseSize(e)/2+n,i,s)}};function Id(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}var Dd=new class extends ad{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 Id(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Id(t,this.parseSize(e)/2,i,s,n)}};function Fd(t,e,i,s,n=0){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}var zd=new class extends ad{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 Fd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Fd(t,this.parseSize(e)/2,i,s,n)}};function jd(t,e,i,s,n=0){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}var Hd=new class extends ad{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 jd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return jd(t,this.parseSize(e)/2,i,s,n)}};const Vd=Xt(3);function Nd(t,e,i,s){const n=e*Vd;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var Ud=new class extends ad{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Nd(t,this.parseSize(e)/2/Vd,i,s)}drawOffset(t,e,i,s,n){return Nd(t,this.parseSize(e)/2/Vd+n,i,s)}};function Wd(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 Gd=new class extends ad{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 Wd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Wd(t,this.parseSize(e)/4+n,i,s)}};function Yd(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 $d=new class extends ad{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 Yd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Yd(t,this.parseSize(e)/4+n,i,s)}};function Xd(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 Kd=new class extends ad{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 Xd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Xd(t,this.parseSize(e)/4+n,i,s)}};function qd(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 Zd=new class extends ad{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 qd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return qd(t,this.parseSize(e)/4+n,i,s)}};function Jd(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var Qd=new class extends ad{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return Jd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Jd(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function tu(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var eu=new class extends ad{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return tu(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return tu(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function iu(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 su=new class extends ad{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 iu(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return iu(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function nu(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function ru(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var au=new class extends ad{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)?ru(t,e,i,s):nu(t,e,i,s)}drawWithClipRange(t,e,i,s,n,r,a){S(e)&&(e=[e,e/2]);const o=2*(e[0]+e[1])*n,l=[{x:i+e[0]/2,y:s-e[1]/2},{x:i+e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s+e[1]/2},{x:i-e[0]/2,y:s-e[1]/2}];let h=0,c=l[3];t.moveTo(c.x,c.y);for(let e=0;eo){const e=(i.x-c.x)*(o-h)/s,n=(i.y-c.y)*(o-h)/s;t.lineTo(c.x+e,c.y+n);break}t.lineTo(i.x,i.y),c=i,h+=s}return!1}drawOffset(t,e,i,s,n){return S(e)?ru(t,e+2*n,i,s):nu(t,[e[0]+2*n,e[1]+2*n],i,s)}};const ou=new Ve;class lu{constructor(t,e,i=!1){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 e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),il(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(il(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}drawWithClipRange(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((r=>{r.path.drawWithClipRange(t,e,i,s,n),a&&a(r.path,r.attribute)})),!1):(this.path.drawWithClipRange(t,e,i,s,n),!1)}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((({path:i})=>{ou.x1=i.bounds.x1*t,ou.y1=i.bounds.y1*t,ou.x2=i.bounds.x2*t,ou.y2=i.bounds.y2*t,e.union(ou)}))}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 hu={};[ld,hd,dd,pd,Ud,vd,Sd,Md,wd,Ed,Od,Dd,zd,md,Hd,Gd,$d,Kd,Zd,au,Qd,eu,su].forEach((t=>{hu[t.type]=t}));const cu={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"};class du{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 uu(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function pu(t,e,i,s=">"){const n=function(t,e,i=">"){let s,n="";for(let r=e;r",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=pu(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=uu(t,"--\x3e",r+4,"Comment is not closed.");else{const a=pu(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 du(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 du(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 mu(t,e){return vu(t)}function vu(t,e){const i={};for(let e=0;eTu.set(t,!0)));const wu=new Map;function Cu(t){if(Tu.has(t))return!0;if(wu.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>wu.set(t,!0)));const Eu=ku(),Bu=ku(),Pu=ku(),Lu=ku(),Ru=ku(),Ou=ku(),Iu=ku(),Du=ku(),Fu=ku(),zu=ku();ku();const ju=ku();ku();const Hu=ku();ku();const Vu=ku(),Nu=ku(),Uu=Symbol.for("GraphicService"),Wu=Symbol.for("GraphicCreator"),Gu={"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"},Yu=Object.keys(Gu),$u={duration:200,easing:"cubicOut"};function Xu(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}function Ku(t,e,i){const s=i[0],n=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]*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],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*s+c*n+g*r+e[12],t[13]=o*s+d*n+f*r+e[13],t[14]=l*s+u*n+m*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function qu(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 Zu(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],f=e[12],m=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*f,t[1]=y*n+b*l+x*u+S*m,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*f,t[5]=y*n+b*l+x*u+S*m,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*f,t[9]=y*n+b*l+x*u+S*m,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*f,t[13]=y*n+b*l+x*u+S*m,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function Ju(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 Qu{constructor(){this.pools=[]}static identity(t){return Xu(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 Qu.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},sp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const np=new Ue(1,0,0,1,0,0),rp={x:0,y:0};let ap=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new Ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ue(1,0,0,1,0,0),this.path=new Ul,this._clearMatrix=new Ue(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(t=!1){!t&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return tp.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}reset(){this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ue(1,0,0,1,0,0),this.stack.length=0}restore(){this.stack.length>0&&(tp.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(tp.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){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,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=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(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){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},rp),function(t,e,i){return dc(t,0,!1,e,i)}(this.path.commandList,rp.x,rp.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},rp);const i=vh(this,this.lineWidth,this.dpr);return function(t,e,i,s){return dc(t,e,!0,i,s)}(this.path.commandList,i,rp.x,rp.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(t=!0,e=this.dpr){this.setTransformFromMatrix(np,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>tp.free(t))),this.stack.length=0}};ap=ip([Ka(),sp("design:paramtypes",[Object,Number])],ap);const op={WIDTH:500,HEIGHT:500,DPR:1};class lp{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}set nativeCanvas(t){this._nativeCanvas=t}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=op.WIDTH,height:n=op.HEIGHT,dpr:r=op.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(...t){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}var hp;lp.env="browser",function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(hp||(hp={}));class cp{static Get(t,e=hp.Color1,i=[0,0,0,1]){if(e===hp.Color1){const e=cp.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ei.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];cp.store1[t]=e,cp.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=cp.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ei.parseColorString(t);return n&&(cp.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],cp.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===hp.Color1){if(cp.store1[t])return;cp.store1[t]=i,cp.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(cp.store255[t])return;cp.store255[t]=i,cp.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function dp(t,e=!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 up(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)=>{var a,o;return pp(y(t)?null!==(a=t[r])&&void 0!==a?a:t[0]:t,y(e)?null!==(o=e[r])&&void 0!==o?o:e[0]:e,i,s)})):pp(t,e,i,s,n)}function pp(t,e,i,s,n){if(!t||!e)return t&&dp(t)||e&&dp(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=cp.Get(t,hp.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=cp.Get(e,hp.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:dp(a)})))});return o?up(r,l,i,s,n):up(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:vp(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:vp(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:vp(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),dp(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)}function gp(t,e,i){return`rgba(${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})`}cp.store255={},cp.store1={};const fp=[0,0,0,0],mp=[0,0,0,0];function vp(t,e,i){return cp.Get(t,hp.Color255,fp),cp.Get(e,hp.Color255,mp),`rgba(${Math.round(fp[0]+(mp[0]-fp[0])*i)},${Math.round(fp[1]+(mp[1]-fp[1])*i)},${Math.round(fp[2]+(mp[2]-fp[2])*i)},${fp[3]+(mp[3]-fp[3])*i})`}class _p{static GetCanvas(){try{return _p.canvas||(_p.canvas=So.global.createCanvas({})),_p.canvas}catch(t){return null}}static GetCtx(){if(!_p.ctx){const t=_p.GetCanvas();_p.ctx=t.getContext("2d")}return _p.ctx}}class yp extends We{static getInstance(){return yp._instance||(yp._instance=new yp),yp._instance}constructor(t=[],e=100){super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=_p.GetCanvas(),s=_p.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,n=[],r=100){let a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new yp(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class bp{static GetSize(t){for(let e=0;e=t)return bp.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=bp.GenKey(t,e,i,s,n),l=bp.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=bp.GenKey(t,e,i,s,n);bp.cache[l]?bp.cache[l].push({width:a,height:o,pattern:r}):bp.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}bp.cache={},bp.ImageSize=[20,40,80,160,320,640,1280,2560];const xp=new Ve,Sp=new Ue;new Ve;const Ap=["lineWidth","scaleX","scaleY","angle","anchor","visible"],kp=["x","y"],Mp=["scaleX","scaleY"],Tp=["angle"],wp=new ne,Cp={strokeSeg:1,boundsPadding:2,pickMode:1,boundsMode:1,customPickShape:1,pickable:1,childrenPickable:1,visible:1,zIndex:1,layout:1,keepDirIn3d:1,globalZIndex:1,outerBorder:1,innerBorder:1,lineDash:1,lineCap:1,lineJoin:1,miterLimit:2,strokeBoundsBuffer:2,scaleCenter:1,anchor:1,anchor3d:1,postMatrix:1,backgroundMode:2,background:1,texture:1,cursor:1,html:1};class Ep extends Rc{static mixin(t){const e=Object.keys(t);for(let i=0;i10&&this.clipPathMap.clear(),i=this.parsePath(e),i&&this.clipPathMap.set(e,i)),i}parsePath(t){if(!t)return null;let e=hu[t];if(e)return e;if(e=Ep.userSymbolMap[t],e)return e;if(!0===((i=t=cu[t]||t).startsWith("{const e=(new Ul).fromString(t.d),i={};Yu.forEach((e=>{t[e]&&(i[Gu[e]]=t[e])})),n.push({path:e,attribute:i}),xp.union(e.bounds)}));const r=xp.width(),a=xp.height(),o=1/Gt(r,a);n.forEach((t=>t.path.transform(0,0,o,o)));const l=new lu(t,n,!0);return Ep.userSymbolMap[t]=l,l}var i;const s=(new Ul).fromString(t),n=s.bounds.width(),r=s.bounds.height(),a=1/Gt(n,r);s.transform(0,0,a,a);const o=new lu(t,s);return Ep.userSymbolMap[t]=o,o}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,s=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:n=e.boundsPadding}=i,r=qc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new Do(t);return il(e.commandList,i,0,0),!0}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(t=!0){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(t=!0){return this._transMatrix||(this._transMatrix=new Ue),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&$o.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&$o.UPDATE_BOUNDS)&&this.getGraphicService().validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&$o.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&$o.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&$o.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&$o.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=$o.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===Xo.GLOBAL){const i=new ne(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setWidthHeightWithoutTransform(t){this.widthWithoutTransform=t.x2-t.x1,this.heightWithoutTransform=t.y2-t.y1}setAttributesAndPreventAnimate(t,e=!1,i,s){this.setAttributes(t,e,i),this.animates&&this.animates.forEach((e=>{(e.priority!==1/0||s)&&Object.keys(t).forEach((t=>{e.preventAttr(t)}))}))}setAttributes(t,e=!1,i){t&&((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,e=!1,i){const s=Object.keys(t);for(let e=0;e{i[e]?(o||(o={}),o[e]=t[e]):a[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const l=null!==(r=null!==(n=this.context&&this.context.stateAnimateConfig)&&void 0!==n?n:this.stateAnimateConfig)&&void 0!==r?r:$u;this.applyAnimationState(["state"],[{name:"state",animation:{type:"state",to:a,duration:l.duration,easing:l.easing}}]),o&&this.setAttributesAndPreventAnimate(o,!1,{type:Ko.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t)}else this.stopStateAnimates(),this.setAttributesAndPreventAnimate(t,!1,{type:Ko.STATE}),this.finalAttribute&&Object.assign(this.finalAttribute,t);this._emitCustomEvent("afterStateUpdate",{type:Ko.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(t="end"){this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){var e,i;const s=this.attribute[t];return this.animates&&this.animates.size?null===(e=this.finalAttribute)||void 0===e?void 0:e[t]:null!=s?s:null===(i=this.finalAttribute)||void 0===i?void 0:i[t]}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){const i=y(t)?e=>!t.includes(e):e=>e!==t,s=this.currentStates.filter(i);s.length!==this.currentStates.length&&this.useStates(s,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;this.stateSort&&(t=t.sort(this.stateSort));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|=$o.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=$o.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=$o.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&$o.UPDATE_SHAPE_AND_BOUNDS)===$o.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=$o.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=$o.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=$o.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=$o.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=$o.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=$o.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=$o.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&$o.UPDATE_LAYOUT)}getAnchor(t,e,i){const s=[0,0],n=()=>{if(e.b)return e.b;const t=this.clone();return t.attribute.angle=0,t.attribute.scaleCenter=null,i&&(t.attribute.scaleX=1,t.attribute.scaleY=1),e.b=t.AABBBounds,e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,i=n();s[0]=i.x1+(i.x2-i.x1)*e}else s[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,i=n();s[1]=i.y1+(i.y2-i.y1)*e}else s[1]=t[1];return s}doUpdateLocalMatrix(){const{x:t=Yl.x,y:e=Yl.y,scaleX:i=Yl.scaleX,scaleY:s=Yl.scaleY,angle:n=Yl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&n&&(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=Wt(a),f=$t(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const _=m-i,y=v-s,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,A=d*g-h*f;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*A,t.e=u+l*m+c*v-b*_-S*y,t.f=p+h*m+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,!0),So.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Yl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Sp.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.timeline.isGlobal&&(t.setTimeline(e),e.addAnimate(t))}))}this._onSetStage&&this._onSetStage(this,t,e),this.getGraphicService().onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:Ko.ANIMATE_END})}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t,e=!1){this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:So.graphicService.creator.shadowRoot(this),this.addUpdateBoundTag(),this.shadowRoot.setStage(this.stage,this.layer),this.shadowRoot}detachShadow(){this.shadowRoot&&(this.addUpdateBoundTag(),this.shadowRoot.release(!0),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 Ul).fromString(t):this.pathProxy=new Ul,this.pathProxy}loadImage(t,e=!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(t=!1){this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",this.stopAnimates(),So.graphicService.onRelease(this),super.release()}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new zc(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)}}toCustomPath(){var t,e,i;const s=null===(i=null===(e=(null===(t=this.stage)||void 0===t?void 0:t.renderService)||So.renderService)||void 0===e?void 0:e.drawContribution)||void 0===i?void 0:i.getRenderContribution(this);if(s){const t=new ap(null,1);return s.drawShape(this,t,0,0,{},{}),t.path}return null}}var Bp;Ep.userSymbolMap={},Ep.mixin(Nc),function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Bp||(Bp={}));let Pp=class t extends Ep{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Ou,this._childUpdateTag=$o.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 Ec),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Ec)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===Xo.GLOBAL){const i=new ne(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&$o.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.getGraphicService().beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),this.getGraphicService().afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),"empty"===this.attribute.boundsMode&&e.clear(),e}doUpdateLocalMatrix(){const{x:t=Yl.x,y:e=Yl.y,dx:i=Yl.dx,dy:s=Yl.dy,scaleX:n=Yl.scaleX,scaleY:r=Yl.scaleY,angle:a=Yl.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()}getGraphicTheme(){return Pc(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip}=t;if(a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),!o){this.forEachChildren((t=>{i.union(t.AABBBounds)}));const{scrollX:e=0,scrollY:s=0}=t;i.translate(e,s)}return So.graphicService.updateTempAABBBounds(i),So.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=$o.CLEAR_BOUNDS,this._childUpdateTag&=$o.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=$o.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&$o.UPDATE_BOUNDS||(this._childUpdateTag|=$o.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(),this.getGraphicService().onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),this.getGraphicService().onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t,e=!0){const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return this.getGraphicService().onRemove(t),t.stage=null,this.addUpdateBoundTag(),e}removeAllChild(t=!1){this.forEachChildren((e=>{this.getGraphicService().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),this.getGraphicService().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(t=!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&$o.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=So.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}release(t){t&&this.forEachChildren((e=>{e.release(t)})),super.release()}};function Lp(t){return new Pp(t)}Pp.NOWORK_ANIMATE_ATTR=Cp;class Rp extends Pp{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 Ec,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(t=!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=>{So.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=>{So.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 Op=Symbol.for("TransformUtil"),Ip=Symbol.for("GraphicUtil"),Dp=Symbol.for("LayerService"),Fp=Symbol.for("StaticLayerHandlerContribution"),zp=Symbol.for("DynamicLayerHandlerContribution"),jp=Symbol.for("VirtualLayerHandlerContribution");var Hp,Vp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Np=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Up=Hp=class{static GenerateLayerId(){return`${Hp.idprefix}_${Hp.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=So.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?bo.get(Fp):"dynamic"===t?bo.get(zp):bo.get(jp),e}createLayer(t,e={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 Rp(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Hp.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)}};Up.idprefix="visactor_layer",Up.prefix_count=0,Up=Hp=Vp([Ka(),Np("design:paramtypes",[])],Up);var Wp=new Da((t=>{t(yo).to(Bo).inSingletonScope(),t(fc).to(vc),t(Ip).to(xc).inSingletonScope(),t(Op).to(kc).inSingletonScope(),t(Dp).to(Up).inSingletonScope()}));function Gp(t,e){return!(!t&&!e)}function Yp(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function $p(t,e,i){return i&&t*e>0}function Xp(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Kp(t,e){return t*e>0}function qp(t,e,i,s,n){return n?t*e>0:t*e>0&&0!==i&&0!==s}function Zp(t,e,i,s,n,r,a){const o=t-i,l=e-s,h=(a?r:-r)/Math.sqrt(o*o+l*l),c=h*l,d=-h*o,u=t+c,p=e+d,g=i+c,f=s+d,m=(u+g)/2,v=(p+f)/2,_=g-u,y=f-p,b=_*_+y*y,x=n-r,S=u*f-g*p,A=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let k=(S*y-_*A)/b,M=(-S*_-y*A)/b;const T=(S*y+_*A)/b,w=(-S*_+y*A)/b,C=k-m,E=M-v,B=T-m,P=w-v;return C*C+E*E>B*B+P*P&&(k=T,M=w),{cx:k,cy:M,x01:-c,y01:-d,x11:k*(n/x-1),y11:M*(n/x-1)}}function Jp(t,e,i,s,n){const r=Nt(i-e),a=t.getParsedCornerRadius(),o=y(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,_=Math.max(f,g),b=Math.max(m,v);let x=_,S=b;const A=n*Wt(c),k=n*$t(c),M=s*Wt(u),T=s*$t(u);let w,C,E,B;if((b>Ft||_>Ft)&&(w=n*Wt(d),C=n*$t(d),E=s*Wt(p),B=s*$t(p),r1?0:P<-1?zt:Math.acos(P))/2),l=Xt(t[0]*t[0]+t[1]*t[1]);S=Yt(b,(s-l)/(o-1)),x=Yt(_,(n-l)/(o+1))}}var P;return{outerDeltaAngle:l,xors:A,yors:k,xirs:E,yirs:B,xore:w,yore:C,xire:M,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:_,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function Qp(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Nt(l-o),c=l>o;let d=!1;if(n=Vt-Ft)e.moveTo(i+n*Wt(o),s+n*$t(o)),e.arc(i,s,n,o,l,!c),r>Ft&&(e.moveTo(i+r*Wt(l),s+r*$t(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:M,limitedIcr:T,innerDeltaAngle:w,innerEndAngle:C,innerStartAngle:E,innerCornerRadiusStart:B,innerCornerRadiusEnd:P,maxInnerCornerRadius:L}=Jp(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>Ft){const t=Yt(v,m),r=Yt(_,m),o=Zp(g,f,u,p,n,t,Number(c)),l=Zp(b,x,S,A,n,r,Number(c));m0&&e.arc(i+o.cx,s+o.cy,t,Ut(o.y01,o.x01),Ut(o.y11,o.x11),!c),e.arc(i,s,n,Ut(o.cy+o.y11,o.cx+o.x11),Ut(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Ut(l.y11,l.x11),Ut(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Wt(Ut(l.y01,l.x01)),s+l.cy+r*$t(Ut(l.y01,l.x01))):e.moveTo(i+b,s+n*$t(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,M,!c)):e.moveTo(i+n*Wt(M),s+n*$t(M));if(!(r>Ft)||w<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(T>Ft){const t=Yt(B,T),n=Yt(P,T),o=Zp(S,A,b,x,r,-n,Number(c)),l=Zp(u,p,g,f,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,Ut(o.y01,o.x01),Ut(o.y11,o.x11),!c),e.arc(i,s,r,Ut(o.cy+o.y11,o.cx+o.x11),Ut(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Ut(l.y11,l.x11),Ut(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Wt(Ut(l.y01,l.x01)),s+l.cy+t*$t(Ut(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),!a||a[2]?e.arc(i,s,r,C,E,c):e.moveTo(i+r*Wt(E),s+r*$t(E))}return a?a[3]&&e.lineTo(i+n*Wt(o),s+n*$t(o)):e.closePath(),d}const tg=Symbol.for("ArcRenderContribution"),eg=Symbol.for("AreaRenderContribution"),ig=Symbol.for("CircleRenderContribution"),sg=Symbol.for("GroupRenderContribution"),ng=Symbol.for("ImageRenderContribution"),rg=Symbol.for("PathRenderContribution"),ag=Symbol.for("PolygonRenderContribution"),og=Symbol.for("RectRenderContribution"),lg=Symbol.for("SymbolRenderContribution"),hg=Symbol.for("TextRenderContribution"),cg=Symbol.for("InteractiveSubRenderContribution");function dg(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function ug(t,e,i,s=0){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?s-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}var pg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fg=function(t,e){return function(i,s){e(i,s,t)}};function mg(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:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:v}=e.attribute,_=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=m[1];_[2]=null!==(s=m[2])&&void 0!==s?s:0}if(Xu(t),Ku(t,t,[n+o,r+l,a+h]),Ku(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),Ku(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]),f){const i=ep.allocate(),s=[0,0];if(v){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=m[1]}Ku(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,f),Ku(i,i,[-s[0],-s[1],0]),Zu(t,t,i)}}let vg=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new vo(["graphic"]),onSetStage:new vo(["graphic","stage"]),onRemove:new vo(["graphic"]),onRelease:new vo(["graphic"]),onAddIncremental:new vo(["graphic","group","stage"]),onClearIncremental:new vo(["graphic","group","stage"]),beforeUpdateAABBBounds:new vo(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new vo(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"]),clearAABBBounds:new vo(["graphic","stage","aabbBounds"])},this.tempAABBBounds1=new Ve,this.tempAABBBounds2=new Ve}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)}clearAABBBounds(t,e,i){this.hooks.clearAABBBounds.taps.length&&this.hooks.clearAABBBounds.call(t,e,i)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new Do(t);return il(i.commandList,s,0,0),!0}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=ug(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=dg(n,e);i.set(s,i.y1,s+e,i.y2)}}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){Su(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;Su(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&&je(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot||s.isContainer)return!0;const{visible:n=e.visible}=t;return!(!s.valid||!n)||(i.empty()||(s.parent&&i.transformWithMatrix(s.parent.globalTransMatrix),this.clearAABBBounds(s,s.stage,i),i.clear()),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};vg=pg([Ka(),fg(0,$a(Wu)),gg("design:paramtypes",[Object])],vg);const _g=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},yg=["radius","startAngle","endAngle",...Ap];class bg extends Ep{constructor(t={radius:1}){super(t),this.type="circle",this.numberType=Lu}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)}getGraphicTheme(){return Pc(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=So.graphicService.updateTempAABBBounds(i);return _g(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,So.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Vt-Ft?i.set(-r,-r,r,r):Qc(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,yg)}needUpdateTag(t){return super.needUpdateTag(t,yg)}toCustomPath(){var t,e,i;let s=super.toCustomPath();if(s)return s;const n=this.attribute,r=null!==(t=n.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),a=null!==(e=n.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),o=null!==(i=n.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle");return s=new Ul,s.arc(0,0,r,a,o),s}clone(){return new bg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return bg.NOWORK_ANIMATE_ATTR}}function xg(t){return new bg(t)}bg.NOWORK_ANIMATE_ATTR=Cp;class Sg{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i,s){if(t.xOffset="left"===e||"start"===e?0:"center"===e?t.width/-2:"right"===e||"end"===e?-t.width:0,"top"===i)t.yOffset=0;else if("middle"===i)t.yOffset=t.height/-2;else if("alphabetic"===i){let e=.79;if(1===s.length){const t=s[0];e=t.ascent/(t.ascent+t.descent)}t.yOffset=t.height*-e}else t.yOffset=-t.height;return t}GetLayoutByLines(t,e,i,s,n="",r,a){const{lineWidth:o,suffixPosition:l="end",measureMode:h=Po.actualBounding,keepCenterInLine:c=!1}=null!=a?a:{};t=t.map((t=>t.toString()));const d=[],u=[0,0];if("number"==typeof o&&o!==1/0){let e;for(let i=0,s=t.length;io){const s=this.textMeasure.clipTextWithSuffix(t[i],this.textOptions,o,n,r,l);a=s.str,e=s.width}else e=s.width;d.push({str:a,width:e,ascent:s.ascent,descent:s.descent,keepCenterInLine:c})}u[0]=o}else{let e,i,s=0;for(let n=0,r=t.length;nMath.max(t,e.width)),0);const p={xOffset:0,yOffset:0,width:u[0],height:u[1]};return this.LayoutBBox(p,e,i,d),this.layoutWithBBox(p,d,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;a{t+=e.str})),(Array.isArray(r)?r.join(""):r).toString()!==t}return"vertical"===s.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==s.text.toString():null!=this.clipedText&&this.clipedText!==s.text.toString()}get multilineLayout(){return this.tryUpdateAABBBounds(),this.cache.layoutData}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(t={text:"",fontSize:16}){super(t),this.type="text",this.numberType=Nu,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}getGraphicTheme(){return Pc(this).text}doUpdateOBBBounds(){const t=this.getGraphicTheme();this._OBBBounds.clear();const e=this.attribute,{angle:i=t.angle}=e;if(!i){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new kg({})),this.obbText.setAttributes(Object.assign(Object.assign({},e),{angle:0}));const s=this.obbText.AABBBounds,{x:n,y:r}=e,a={x:(s.x1+s.x2)/2,y:(s.y1+s.y2)/2},o=Me(a,i,{x:n,y:r});return this._OBBBounds.copy(s),this._OBBBounds.translate(o.x-a.x,o.y-a.y),this._OBBBounds.angle=i,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=So.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Su(n,o/Math.abs(r+a),!0,l),i.union(n)}return So.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||So.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,je(i,i,this.transMatrix),i}updateSingallineAABBBounds(t){this.updateMultilineAABBBounds([t]);const e=this.cache.layoutData;if(e&&e.lines&&e.lines.length){const t=e.lines[0];this.cache.clipedText=t.str,this.cache.clipedWidth=t.width}return this._AABBBounds}updateMultilineAABBBounds(t){const e=this.getGraphicTheme(),{direction:i=e.direction,underlineOffset:s=e.underlineOffset}=this.attribute,n="horizontal"===i?this.updateHorizontalMultilineAABBBounds(t):this.updateVerticalMultilineAABBBounds(t);return"horizontal"===i&&s&&this._AABBBounds.add(this._AABBBounds.x1,this._AABBBounds.y2+s),n}guessLineHeightBuf(t){return t?.1*t:0}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),n=this.attribute,{fontFamily:r=s.fontFamily,textAlign:a=s.textAlign,textBaseline:o=s.textBaseline,fontSize:l=s.fontSize,fontWeight:h=s.fontWeight,ellipsis:c=s.ellipsis,maxLineWidth:d,stroke:u=s.stroke,wrap:p=s.wrap,measureMode:g=s.measureMode,lineWidth:f=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:v=s.suffixPosition,ignoreBuf:_=s.ignoreBuf,keepCenterInLine:y=s.keepCenterInLine}=n,b=_?0:this.guessLineHeightBuf(l),x=this.getLineHeight(n,s,b);if("normal"===m||p)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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(f/2),this._AABBBounds}const S=So.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),A=new Sg(r,{fontSize:l,fontWeight:h,fontFamily:r,lineHeight:x},S).GetLayoutByLines(t,a,o,x,!0===c?s.ellipsis:c||void 0,!1,{lineWidth:d,suffixPosition:v,measureMode:g,keepCenterInLine:y}),{bbox:k}=A;return this.cache.layoutData=A,this.clearUpdateShapeTag(),this._AABBBounds.set(k.xOffset,k.yOffset,k.xOffset+k.width,k.yOffset+k.height),u&&this._AABBBounds.expand(f/2),this._AABBBounds}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{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,measureMode:v=r.measureMode,suffixPosition:_=r.suffixPosition,heightLimit:b=0,lineClamp:x,keepCenterInLine:S=r.keepCenterInLine}=this.attribute,A=m?0:this.guessLineHeightBuf(h),k=this.getLineHeight(this.attribute,r,A);if(!this.shouldUpdateShape()&&(null===(e=this.cache)||void 0===e?void 0:e.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 M=So.graphicUtil.getTextMeasureInstance(this.textMeasureId||(null===(i=this.stage)||void 0===i?void 0:i.textMeasureId)),T={fontSize:h,fontWeight:f,fontFamily:a,lineHeight:k},w=new Sg(a,T,M),C=y(t)?t.map((t=>t.toString())):[t.toString()],E=[],B=[0,0];let P=1/0;if(b>0&&(P=Math.max(Math.floor(b/k),1)),x&&(P=Math.min(P,x)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),B[0]=t}else{let t,e,i=0;for(let s=0,n=C.length;s{const e=t.reduce(((t,e)=>t+e.width),0);a=Gt(e,a)}));const t=dg(_,a),e=this.cache.verticalList.length*v,i=ug(y,e,d);return this._AABBBounds.set(i,t,i+e,t+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const b=t.map((t=>function(t){const e=[];let i=0,s="";for(let n=0;n{if(Number.isFinite(l))if(h){const i=!0===h?n.ellipsis:h,s=r.clipTextWithSuffixVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,i,!1,m);b[e]=s.verticalList,a=s.width}else{const i=r.clipTextVertical(t,{fontSize:d,fontWeight:u,fontFamily:c},l,!1);b[e]=i.verticalList,a=i.width}else a=0,t.forEach((t=>{const e=t.direction===Mu.HORIZONTAL?d:r.measureTextWidth(t.text,{fontSize:d,fontWeight:u,fontFamily:c});a+=e,t.width=e}))})),this.cache.verticalList=b,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);a=Gt(e,a)}));const x=dg(_,a),S=this.cache.verticalList.length*v,A=ug(y,S,d);return this._AABBBounds.set(A,x,A+S,x+a),p&&this._AABBBounds.expand(g/2),this._AABBBounds}getMaxWidth(t){var e,i;const s=this.attribute;return null!==(i=null!==(e=s.maxLineWidth)&&void 0!==e?e:s.maxWidth)&&void 0!==i?i:t.maxWidth}getLineHeight(t,e,i){var s;return null!==(s=rd(t.lineHeight,t.fontSize||e.fontSize))&&void 0!==s?s:(t.fontSize||e.fontSize)+i}needUpdateTags(t,e=Ag){return super.needUpdateTags(t,e)}needUpdateTag(t,e=Ag){return super.needUpdateTag(t,e)}_interpolate(t,e,i,s,n){"text"===t&&(n.text=s)}clone(){return new kg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return kg.NOWORK_ANIMATE_ATTR}getBaselineMapAlign(){return kg.baselineMapAlign}getAlignMapBaseline(){return kg.alignMapBaseline}}function Mg(t){return new kg(t)}kg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},Cp),kg.baselineMapAlign={top:"left",bottom:"right",middle:"center"},kg.alignMapBaseline={left:"top",right:"bottom",center:"middle"};const Tg=["symbolType","size",...Ap];let wg=class t extends Ep{constructor(t={symbolType:"circle"}){super(t),this.type="symbol",this.numberType=Vu}getParsedPath(){return this.shouldUpdateShape()&&(this._parsedPath=this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}getParsedPath2D(t=0,e=0,i=1){let s=null;try{s=new Path2D}catch(t){return null}const n=this.getParsedPath();if(!n)return null;n.draw(s,i,t,e)}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{symbolType:t="circle"}=this.attribute;return super.parsePath(t)}getGraphicTheme(){return Pc(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=So.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Su(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,this.x1WithoutTransform=i.x1,this.y1WithoutTransform=i.y1;const{lineJoin:a=e.lineJoin}=t;return So.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(y(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){const{size:s=e.size}=t,n=this.getParsedPath();return n?(n.bounds(s,i),i):i}needUpdateTags(t){return super.needUpdateTags(t,Tg)}needUpdateTag(t){return super.needUpdateTag(t,Tg)}toCustomPath(){const t=this.getParsedPath();if(!t)return null;const e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new Ul).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Ul).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Cg(t){return new wg(t)}wg.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},Cp);const Eg=["segments","points","curveType","curveTension",...Ap];let Bg=class t extends Ep{constructor(t={}){super(t),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=ed(i,s,e))}getGraphicTheme(){return Pc(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),So.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return So.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Eg)}needUpdateTag(t){return super.needUpdateTag(t,Eg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute;t=new Ul;const i=e.segments,s=e=>{if(e&&e.length){let i=!0;e.forEach((e=>{!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):e.points&&s(e.points),t}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Pg(t){return new Bg(t)}Bg.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Cp);const Lg=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}},Rg=["width","x1","y1","height","cornerRadius",...Ap];class Og extends Ep{constructor(t){super(t),this.type="rect",this.numberType=ju}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Pc(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=So.graphicService.updateTempAABBBounds(i);return _g(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,So.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Rg)}needUpdateTag(t){return super.needUpdateTag(t,Rg)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute,{x:i,y:s,width:n,height:r}=Lg(e);return t=new Ul,t.moveTo(i,s),t.rect(i,s,n,r),t}clone(){return new Og(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Og.NOWORK_ANIMATE_ATTR}}function Ig(t){return new Og(t)}Og.NOWORK_ANIMATE_ATTR=Cp;class Dg extends Ep{constructor(t){super(t),this.type="glyph",this.numberType=Ru,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,e=!1,i){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}getGraphicTheme(){return Pc(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}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(),this.stateSort&&(t=t.sort(this.stateSort));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.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Dg(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Dg.NOWORK_ANIMATE_ATTR}}function Fg(t){return new Dg(t)}Dg.NOWORK_ANIMATE_ATTR=Cp;class zg{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=yh[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}}}function jg(t,e,i,s){const n=Math.round(t),r=Math.round(i),a=Math.round(e),o=Math.round(s);return{left:t>n?n:n-.5,top:i>r?r:r-.5,right:a>e?a:a+.5,bottom:o>s?o:o+.5}}class Hg{constructor(t,e,i,s){var n,r;this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic",this.ascentDescentMode=s;const a=rd(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof a?a>this.fontSize?a:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:o,height:l,descent:h,width:c}=Eh(t,i,this.ascentDescentMode);let d=0,u=0,p=0;this.height>l&&(d=(this.height-l)/2,u=Math.ceil(d),p=Math.floor(d)),"top"===this.textBaseline?(this.ascent=d,this.descent=l-d):"bottom"===this.textBaseline?(this.ascent=l-d,this.descent=d):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=o+u,this.descent=h+p),this.length=t.length,this.width=c||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,this.space=i.space,this.dx=null!==(n=i.dx)&&void 0!==n?n:0,this.dy=null!==(r=i.dy)&&void 0!==r?r: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}=Eh(this.text,this.character,this.ascentDescentMode);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}drawBackground(t,e,i,s,n,r,a){if(""===this.text||"\n"===this.text||!this.character.background||this.character.backgroundOpacity&&!(this.character.backgroundOpacity>0))return;let o=e+i,l=this.text,h=this.left+s;o+=this.top;let c=this.direction;if(this.verticalEllipsis)l=this.ellipsisStr,c="vertical",o-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)l+=this.ellipsisStr,"right"!==r&&"end"!==r||(h-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Th(l,("vertical"===c?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,l.length-1);if(l=l.slice(0,t),l+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===c);else{const{width:e}=Eh(this.text.slice(t),this.character,this.ascentDescentMode);h-=this.ellipsisWidth-e}}}const d=jg(h,h+(this.widthOrigin||this.width),e,e+a);return Object.assign(Object.assign({},d),{fillStyle:this.character.background,globalAlpha:this.character.backgroundOpacity})}draw(t,e,i,s,n,r,a){var o;let l=e+i,h=this.text,c=this.left+s+(null!==(o=this.space)&&void 0!==o?o:0)/2;l+=this.top;let d=this.direction;if(this.verticalEllipsis)h=this.ellipsisStr,d="vertical",l-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)h+=this.ellipsisStr,"right"!==r&&"end"!==r||(c-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Th(h,("vertical"===d?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,h.length-1);if(h=h.slice(0,t),h+=this.ellipsisStr,"right"===r||"end"===r)if("vertical"===d);else{const{width:e}=Eh(this.text.slice(t),this.character,this.ascentDescentMode);c-=this.ellipsisWidth-e}}}switch(this.character.script){case"super":l-=this.ascent*(1/3);break;case"sub":l+=this.descent/2}"vertical"===d&&(t.save(),t.rotateAbout(Math.PI/2,c,l),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(c,l),c=0,l=0);const{lineWidth:u=1}=this.character;if(this.character.stroke&&u&&t.strokeText(h,c+this.dx,l+this.dy),this.character.fill&&t.fillText(h,c+this.dx,l+this.dy),this.character.fill)if(this.character.lineThrough||this.character.underline){if(this.character.underline){const e=1+l,i=jg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}if(this.character.lineThrough){const e=1+l-this.ascent/2,i=jg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}}else if("underline"===this.character.textDecoration){const e=1+l,i=jg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}else if("line-through"===this.character.textDecoration){const e=1+l-this.ascent/2,i=jg(c,c+(this.widthOrigin||this.width),e,e+(this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1));t.fillRect(i.left,1+l-this.ascent/2,i.right-i.left,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)}"vertical"===d&&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=Th(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Eh(this.text.slice(t),this.character,this.ascentDescentMode);return i+this.ellipsisWidth-s}return i}}const Vg=["width","height","image",...Ap];class Ng extends Ep{constructor(t){super(t),this.type="image",this.numberType=Iu,this.loadImage(this.attribute.image)}getImageElement(){const{image:t}=this.attribute;if(!t||!this.resources)return null;const e=this.resources.get(t);return"success"!==e.state?null:e.data}get width(){return this.tryUpdateAABBBounds(),this._actualWidth}get height(){return this.tryUpdateAABBBounds(),this._actualHeight}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()})),this.addUpdateBoundTag()}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)}getGraphicTheme(){return Pc(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{maxWidth:s=e.maxWidth,maxHeight:n=e.maxHeight}=t;let{width:r,height:a}=t;if(null==r||null==a){const t=this.getImageElement();if(t){const e=t.width,i=t.height;if(null!=r)a=r*(i/e);else if(null!=a)r=a*(e/i);else{const t=e/i;t>s/n?(r=s,a=s/t):(a=n,r=n*t)}}else r=s,a=n}this._actualWidth=r,this._actualHeight=a,i.set(0,0,r,a)}const{tb1:s,tb2:n}=So.graphicService.updateTempAABBBounds(i);return _g(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,So.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return ph[t]}needUpdateTags(t){return super.needUpdateTags(t,Vg)}needUpdateTag(t){return super.needUpdateTag(t,Vg)}clone(){return new Ng(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Ng.NOWORK_ANIMATE_ATTR}}function Ug(t){return new Ng(t)}Ng.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},Cp);class Wg extends Ng{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=qc(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=qc(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=ph.width,height:e=ph.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 Gg{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 Wg?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=yh[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Hg){const e=kh.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,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Wg)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Eh(r,i.character,i.ascentDescentMode),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}let a="",o=-1,l=[];const h=[l];this.paragraphs.forEach(((e,n)=>{if(e instanceof Wg)return;const r=e.drawBackground(t,s,this.ascent,i,0===n,this.textAlign,this.height);r&&(a===r.fillStyle&&o===r.globalAlpha||(l=[],h.push(l),a=r.fillStyle,o=r.globalAlpha),l.push(r))})),h.forEach((e=>{if(0===e.length)return;const i=e[0],s=e[e.length-1];t.fillStyle=i.fillStyle,t.globalAlpha=i.globalAlpha,t.fillRect(i.left,i.top,s.right-i.left,s.bottom-i.top)})),this.paragraphs.forEach(((e,n)=>{if(e instanceof Wg)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||xh;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,Mh(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||bh;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?_h(t,s,{AABBBounds:i}):s,Mh(t,e)}(t,e.character,a),e.draw(t,s,this.ascent,i,0===n,this.textAlign,this.height)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Wg)break;const{width:n}=Eh(t,s.character,s.ascentDescentMode),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.forEach(((t,e)=>{i+=t instanceof Wg?t.width:t.getWidthWithEllips(this.direction)})),i}}class Yg{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=yh[this.direction]}store(t){if(t instanceof Wg){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 Gg(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,e=!1){t instanceof Wg?"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||this.newLine)&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Th(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Hg(i,t.newLine,t.character,t.ascentDescentMode),new Hg(s,!0,t.character,t.ascentDescentMode)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}let $g=!1;try{$g=Intl&&"function"==typeof Intl.Segmenter}catch(t){$g=!1}const Xg=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...Ap];class Kg extends Ep{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Hu,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:uh.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:uh.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:uh.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:uh.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:uh.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:uh.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:uh.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:uh.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Pc(this).richtext}static AllSingleCharacter(t){return t.lines?t.lines.every((t=>t.paragraphs.every((t=>!(t.text&&_(t.text)&&Kg.splitText(t.text).length>1))))):t.every((t=>t.isComposing||!(t.text&&_(t.text)&&Kg.splitText(t.text).length>1)))}static splitText(t){if($g){const e=new Intl.Segmenter(void 0,{granularity:"grapheme"}),i=[];for(const{segment:s}of e.segment(t))i.push(s);return i}return Array.from(t)}static TransformTextConfig2SingleCharacter(t){const e=[];return t.forEach((t=>{const i=Kg.splitText(t.text.toString());if(_(t.text)&&i.length>1)for(let s=0;s0&&l>0)i.set(0,0,o,l);else{const t=this.getFrameCache(),{width:e,height:s}=t.getActualSize();let n=o||e||0,r=l||s||0;r="number"==typeof c&&r>c?c:r||0,n="number"==typeof h&&n>h?h:n||0,i.set(0,0,n,r)}p&&p.keepHeightWhileEmpty&&!i.height()&&!(null===(r=t.textConfig)||void 0===r?void 0:r.length)&&(i.y2=i.y1+(null!==(a=t.fontSize)&&void 0!==a?a:12),i.x2=i.x1+2);let g=0;switch(u){case"top":g=0;break;case"middle":g=-i.height()/2;break;case"bottom":g=-i.height()}let f=0;switch(d){case"left":f=0;break;case"center":f=-i.width()/2;break;case"right":f=-i.width()}return l||("middle"===this.verticalDirection?g-=i.height()/2:"bottom"===this.verticalDirection&&(g-=i.height())),i.translate(f,g),So.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||So.graphicService.updateHTMLTextAABBBounds(t,e,i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1,So.graphicService.transformAABBBounds(t,i,e,!1,this),0===i.width()&&0===i.height()&&i.clear(),i}needUpdateTags(t){return super.needUpdateTags(t,Xg)}needUpdateTag(t){return super.needUpdateTag(t,Xg)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e0&&!Kg.AllSingleCharacter(_)&&(_=Kg.TransformTextConfig2SingleCharacter(_),this.attribute.textConfig=_);const y=[],b=null!=t?t:_;for(let t=0;t{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,y.push(t)}}else{const e=this.combinedStyleToCharacter(b[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const i=e.text.split("\n");for(let s=0;s0,A="number"==typeof s&&Number.isFinite(s)&&s>0,k="number"==typeof n&&Number.isFinite(n)&&n>0&&(!x||n<=i),M="number"==typeof r&&Number.isFinite(r)&&r>0&&(!A||r<=s),T=new zg(0,0,(k?n:x?i:0)||0,(M?r:A?s:0)||0,a,o,l,h,c,d||"horizontal",!k&&x,!M&&A,u||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),w=new Yg(T);if(w.newLine=v,p){let t=0,e=!1;for(let i=0;i{const e=t.paragraphs;t.paragraphs=t.paragraphs.filter((t=>""!==t.text)),0===t.paragraphs.length&&e.length&&(e[0].text="\n",t.paragraphs.push(e[0]))})),this._frameCache=T}clone(){return new Kg(Object.assign({},this.attribute))}setStage(t,e){super.setStage(t,e),this.getFrameCache().icons.forEach((i=>{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(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())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return Kg.NOWORK_ANIMATE_ATTR}}function qg(t){return new Kg(t)}Kg.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},Cp);const Zg=["path","customPath",...Ap];class Jg extends Ep{constructor(t){super(t),this.type="path",this.numberType=Fu}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Ul?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Ul?this.cache:t.path)}getGraphicTheme(){return Pc(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=So.graphicService.updateTempAABBBounds(i);_g(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:r=e.lineJoin}=t;return So.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new Ul).fromString(t.path):t.customPath&&(this.cache=new Ul,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,Zg)}needUpdateTag(t){return super.needUpdateTag(t,Zg)}toCustomPath(){return(new Ul).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Jg(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Jg.NOWORK_ANIMATE_ATTR}}function Qg(t){return new Jg(t)}Jg.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},Cp);const tf=["segments","points","curveType","curveTension",...Ap];class ef extends Ep{constructor(t){super(t),this.type="area",this.numberType=Pu}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}getGraphicTheme(){return Pc(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),So.graphicService.updateTempAABBBounds(i),this.setWidthHeightWithoutTransform(i);const{lineJoin:s=e.lineJoin}=t;return So.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),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}_interpolate(t,e,i,s,n){"points"===t&&(n.points=ed(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,tf)}needUpdateTag(t){return super.needUpdateTag(t,tf)}toCustomPath(){let t=super.toCustomPath();if(t)return t;t=new Ul;const 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 ef(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ef.NOWORK_ANIMATE_ATTR}}function sf(t){return new ef(t)}ef.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},Cp);const nf=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Ap];class rf extends Ep{constructor(t){super(t),this.type="arc",this.numberType=Eu}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=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(y(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();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=le(e),i=e+r,s&&Nt(r)Ft&&o>Ft)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=this.getGraphicTheme(),{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=Xt(a*a+o*o)}=this.attribute,h=Nt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>Ft&&l>Ft){const i=e>t?1:-1;let s=qt(Number(l)/o*$t(g)),n=qt(Number(l)/a*$t(g));return(f-=2*s)>Ft?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>Ft?(n*=i,c+=n,d-=n):(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}}getGraphicTheme(){return Pc(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=So.graphicService.updateTempAABBBounds(i);_g(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),this.setWidthHeightWithoutTransform(i);const{lineJoin:a=e.lineJoin}=t;return So.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=Ft?i.set(0,0,0,0):Math.abs(o-l)>Vt-Ft?i.set(-s,-s,s,s):(Qc(l,o,s,i),Qc(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,nf)}needUpdateTag(t){return super.needUpdateTag(t,nf)}toCustomPath(){var t,e,i,s;let n=super.toCustomPath();if(n)return n;const r=this.attribute,{startAngle:a,endAngle:o}=this.getParsedAngle();let l=(null!==(t=r.innerRadius)&&void 0!==t?t:0)-(null!==(e=r.innerPadding)&&void 0!==e?e:0),h=(null!==(i=r.outerRadius)&&void 0!==i?i:0)-(null!==(s=r.outerPadding)&&void 0!==s?s:0);const c=Nt(o-a),d=o>a;if(h=Vt-Ft)n.moveTo(0+h*Wt(a),0+h*$t(a)),n.arc(0,0,h,a,o,!d),l>Ft&&(n.moveTo(0+l*Wt(o),0+l*$t(o)),n.arc(0,0,l,o,a,d));else{const t=h*Wt(a),e=h*$t(a),i=l*Wt(o),s=l*$t(o);n.moveTo(0+t,0+e),n.arc(0,0,h,a,o,!d),n.lineTo(0+i,0+s),n.arc(0,0,l,o,a,d),n.closePath()}return n}clone(){return new rf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return rf.NOWORK_ANIMATE_ATTR}}function af(t){return new rf(t)}rf.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},Cp);const of=["points","cornerRadius",...Ap];class lf extends Ep{constructor(t){super(t),this.type="polygon",this.numberType=zu}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Pc(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),So.graphicService.updateTempAABBBounds(i),this.widthWithoutTransform=i.x2-i.x1,this.heightWithoutTransform=i.y2-i.y1;const{lineJoin:s=e.lineJoin}=t;return So.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=ed(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,of)}needUpdateTag(t){return super.needUpdateTag(t,of)}toCustomPath(){let t=super.toCustomPath();if(t)return t;const e=this.attribute.points;return t=new Ul,e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t}clone(){return new lf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return lf.NOWORK_ANIMATE_ATTR}}function hf(t){return new lf(t)}lf.NOWORK_ANIMATE_ATTR=Cp;class cf extends Pp{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(t=!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 df(t){return new cf(t)}const uf=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 pf,gf;function ff(t){return pf||(pf=uf.CreateGraphic("text",{})),pf.initAttributes(t),pf.AABBBounds}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},vf=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)}};class yf{constructor(){this.time=Jo.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:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit,backgroundKeepAspectRatio:y=l.backgroundKeepAspectRatio,backgroundScale:b=l.backgroundScale,backgroundOffsetX:x=l.backgroundOffsetX,backgroundOffsetY:S=l.backgroundOffsetY,backgroundClip:A=l.backgroundClip}=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=Pc(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}A&&e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,{backgroundMode:v,backgroundFit:_,backgroundKeepAspectRatio:y,backgroundScale:b,backgroundOffsetX:x,backgroundOffsetY:S}),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s){const{backgroundMode:n,backgroundFit:r,backgroundKeepAspectRatio:a,backgroundScale:o=1,backgroundOffsetX:l=0,backgroundOffsetY:h=0}=s,c=i.width(),d=i.height();let u=c,p=d;if("no-repeat"===n)if(r)if(a){const s=Math.max(c/e.width,d/e.height);t.drawImage(e,i.x1+l,i.y1+h,e.width*s*o,e.height*s*o)}else t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const s=e.width*o,n=e.height*o;t.drawImage(e,i.x1+l,i.y1+h,s,n)}else{if(r&&"repeat"!==n&&(e.width||e.height)){const i=e.width,s=e.height;"repeat-x"===n?(u=i*(d/s),p=d):"repeat-y"===n&&(p=s*(c/i),u=c);const r=t.dpr,a=uc.allocate({width:u,height:p,dpr:r}),o=a.getContext("2d");o&&(o.inuse=!0,o.clearMatrix(),o.setTransformForCurrent(!0),o.clearRect(0,0,u,p),o.drawImage(e,0,0,u,p),e=a.nativeCanvas),uc.free(a)}const s=t.dpr,a=t.createPattern(e,n);a.setTransform&&a.setTransform(new DOMMatrix([1/s,0,0,1/s,0,0])),t.fillStyle=a,t.translate(i.x1,i.y1),t.fillRect(0,0,c,d),t.translate(-i.x1,-i.y1)}}}const bf=new yf;let xf=class{constructor(t){this.subRenderContribitions=t,this.time=Jo.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)}))}};xf=mf([Ka(),_f(0,$a(uo)),_f(0,qa(cg)),vf("design:paramtypes",[Object])],xf);const Sf=new class{constructor(){this.time=Jo.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;const{clipConfig:f}=t.attribute;if(!f)return;const m=t.getClipPath();if(!m)return;const v=!(c||d),_=t.AABBBounds,y=null!==(p=t.attribute.width)&&void 0!==p?p:_.width(),b=null!==(g=t.attribute.height)&&void 0!==g?g:_.height();v&&e.save(),e.beginPath(),!1===m.draw(e,[y,b],i+y/2,s+b/2,0)&&e.closePath(),c&&c(e,t.attribute,l,!0),v&&e.clip()}};const Af=new class{constructor(){this.time=Jo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipConfig:p}=t.attribute;p&&t.getClipPath()&&(c||d||e.restore())}};class kf{constructor(){this.time=Jo.afterFillStroke,this.useStyle=!0,this.order=10,this._tempSymbolGraphic=null}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=uc.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])),uc.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,Vt),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:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){var h;const{textureRatio:c=r.textureRatio,textureOptions:d=null}=e.attribute;let u=this.textureMap.get(t);if(!u)switch(t){case"circle":u=this.createCirclePattern(o,l,a,i);break;case"diamond":u=this.createDiamondPattern(o,l,a,i);break;case"rect":u=this.createRectPattern(o,l,a,i);break;case"vertical-line":u=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":u=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":u=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":u=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":u=this.createGridPattern(o,l,a,i)}if(d&&d.dynamicTexture){const{gridConfig:u={},useNewCanvas:p}=d,g=e.AABBBounds;s=g.x1,n=g.y1;const f=i;let m;if(p){m=uc.allocate({width:g.width(),height:g.height(),dpr:i.dpr});const t=m.getContext("2d");t.clearRect(0,0,g.width(),g.height()),s=0,n=0,i=t}if(f.save(),e.parent&&!e.transMatrix.onlyTranslate()){const{scrollX:t=0,scrollY:i=0}=e.parent.attribute;f.setTransformFromMatrix(e.parent.globalTransMatrix),f.translate(t,i,!0)}f.setCommonStyle(e,e.attribute,s,n,r),f.clip();const v=g.width(),_=g.height(),y=l,b=o,x=u.columns?u.columns:Math.ceil(v/b),S=u.rows?u.rows:Math.ceil(_/b),A=u.gutterColumn?u.gutterColumn:2*y,k=u.gutterRow?u.gutterRow:2*y;this._tempSymbolGraphic||(this._tempSymbolGraphic=Cg({}));const M=u.columns?v/u.columns:b,T=u.rows?_/u.rows:b;this._tempSymbolGraphic.setAttributes({size:[M-A,T-k],symbolType:t});const w=this._tempSymbolGraphic.getParsedPath();for(let t=0;t{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:vh(e,o,e.dpr),c=o/w,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:w+u*h,innerRadius:T-u*h,startAngle:_-u*c,endAngle:y+u*c}),e.beginPath(),Qp(t,e,i,s,w+u*h,T-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/A,(S-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),f&&C(p,"innerBorder"),t.setAttributes({outerRadius:w,innerRadius:T,startAngle:_,endAngle:y})}},wf=Mf,Cf=bf;const Ef=new class{constructor(){this.time=Jo.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,f=p&&!1!==p.visible;if(!g&&!f)return;const{radius:m=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,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:vh(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,m+c*h,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),f&&M(p,"innerBorder")}},Bf=Mf,Pf=bf;const Lf=new class extends yf{constructor(){super(...arguments),this.time=Jo.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,backgroundKeepAspectRatio:f=l.backgroundKeepAspectRatio,backgroundScale:m=l.backgroundScale,backgroundOffsetX:v=l.backgroundOffsetX,backgroundOffsetY:_=l.backgroundOffsetY}=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,{backgroundMode:p,backgroundFit:g,backgroundKeepAspectRatio:f,backgroundScale:m,backgroundOffsetX:v,backgroundOffsetY:_}),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Rf=zt/2;function Of(t,e,i,s,n,r,a=!0,o){let l;if(Array.isArray(a)&&(o=a,a=!0),s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))l=[r=Nt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:l=[0,0,0,0];break;case 1:e=Nt(t[0]),l=[e,e,e,e];break;case 2:case 3:e=Nt(t[0]),i=Nt(t[1]),l=[e,i,e,i];break;default:l=t,l[0]=Nt(l[0]),l[1]=Nt(l[1]),l[2]=Nt(l[2]),l[3]=Nt(l[3])}}else l=[0,0,0,0];if(s<0||l[0]+l[1]+l[2]+l[3]<1e-12)return t.rect(e,i,s,n);const[h,c,d,u]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],p=Math.min(s/2,n/2),g=[Math.min(p,l[0]),Math.min(p,l[1]),Math.min(p,l[2]),Math.min(p,l[3])],f=[h[0]+g[0],h[1]],m=[h[0],h[1]+g[0]],v=[c[0]-g[1],c[1]],_=[c[0],c[1]+g[1]],y=[d[0]-g[2],d[1]],b=[d[0],d[1]-g[2]],x=[u[0]+g[3],u[1]],A=[u[0],u[1]-g[3]];if(t.moveTo(f[0],f[1]),a){if(o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),!q(v,_)){o&&o[0]&&t.moveTo(v[0],v[1]);const e=v[0],i=v[1]+g[1];t.arc(e,i,g[1],-Rf,0,!1)}if(o&&o[1]?o[1](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(y,b)){const e=b[0]-g[2],i=b[1];o&&o[1]&&t.moveTo(b[0],b[1]),t.arc(e,i,g[2],0,Rf,!1)}if(o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),!q(x,A)){const e=x[0],i=x[1]-g[3];o&&o[2]&&t.moveTo(x[0],x[1]),t.arc(e,i,g[3],Rf,zt,!1)}if(o&&o[3]?o[3](A[0],A[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(f,m)){const e=f[0],i=f[1]+g[0];o&&o[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,g[0],zt,zt+Rf,!1)}}else o&&o[0]?o[0](f[0],f[1],v[0],v[1]):t.lineTo(v[0],v[1]),o&&o[1]?o[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),o&&o[2]?o[2](y[0],y[1],x[0],x[1]):t.lineTo(x[0],x[1]),o&&o[2]?o[2](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]);return!o&&t.closePath(),t}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};class Df{constructor(){this.time=Jo.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,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,cornerType:v=l.cornerType,opacity:_=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:A=l.scaleY,x1:k,y1:M,keepStrokeScale:T=l.keepStrokeScale}=t.attribute;let{width:w,height:C}=t.attribute;w=(null!=w?w:k-i)||0,C=(null!=C?C:M-s)||0;const E=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=T?h:vh(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||y(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,w-o*g,C-o*g)):(e.beginPath(),Of(e,u,p,w-o*g,C-o*g,m,"bevel"!==v)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&E(u,"outerBorder"),f&&E(p,"innerBorder")}}let Ff=class{constructor(){this.time=Jo.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)}};Ff=If([Ka()],Ff);let zf=class{constructor(){this.time=Jo.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:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius,cornerType:_=l.cornerType}=t.attribute;let{width:b,height:x}=t.attribute;if(b=(null!=b?b:u-g)||0,x=(null!=x?x:p-f)||0,Array.isArray(m)&&m.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||y(v)&&v.every((t=>0===t)))){let n,r=0;return Of(e,i,s,b,x,v,"bevel"!==_,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+b,s):e.moveTo(i+b,s),m[1]?e.lineTo(i+b,s+x):e.moveTo(i+b,s+x),m[2]?e.lineTo(i,s+x):e.moveTo(i,s+x),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};zf=If([Ka()],zf);const jf=new Df,Hf=Mf,Vf=bf;const Nf=new class extends Df{constructor(){super(...arguments),this.time=Jo.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)}},Uf=bf;const Wf=new class{constructor(){this.time=Jo.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,f=p&&!1!==p.visible,m=g&&!1!==g.visible;if(!f&&!m)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,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,k=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:vh(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(y-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}},Gf=new class{constructor(){this.time=Jo.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{clipRange:p=l.clipRange,x:g=l.x,y:f=l.y,z:m=l.z,size:v=l.size,scaleX:_=l.scaleX,scaleY:y=l.scaleY}=t.attribute,b=t.getParsedPath();b&&p<1&&p>0&&(e.beginPath(),b.drawWithClipRange&&b.drawWithClipRange(e,v,i,s,p,m,((n,r)=>{var a,h,c,u;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(a=r.fill)&&void 0!==a?a:t.attribute.fill,e.opacity=null!==(h=r.opacity)&&void 0!==h?h:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(c=r.stroke)&&void 0!==c?c:t.attribute.stroke,e.lineWidth=null!==(u=r.lineWidth)&&void 0!==u?u:t.attribute.lineWidth,r=e}r.stroke&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,r,(g-i)/_,(f-s)/y,l),e.stroke()))})),r&&!b.isSvg&&(d?d(e,t.attribute,l):o&&(e.setStrokeStyle(t,t.attribute,(g-i)/_,(f-s)/y,l),e.stroke())))}},Yf=Mf,$f=bf;const Xf={x:0,y:0,z:0,lastModelMatrix:null};class Kf{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions||(this.builtinContributions=[]),this.builtinContributions.push(Sf),this.builtinContributions.push(Af),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===Jo.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Jo.afterFillStroke)))}reInit(){this.init(this.graphicRenderContributions)}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)}))}drawPathProxy(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Pc(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,_=$p(d,u,h),y=Kp(d,g),b=Gp(h),x=Yp(c,p);if(!f)return!0;if(!b&&!x)return!0;if(!(_||y||a||o))return!0;e.beginPath();return il(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),this.afterRenderStep(t,e,i,s,b,x,_,y,l,n,a,o),!0}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=$p(o,l,n),p=Kp(o,c),g=Gp(n,r),f=Yp(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i,s=!1){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;Xf.x=n,Xf.y=r,Xf.z=a,Xf.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=ep.allocate(),n=ep.allocate();mg(n,t,e),Zu(s,d||s,n),Xf.x=0,Xf.y=0,Xf.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),ep.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Xf.x+=s.x,Xf.y+=s.y,Xf.z=a,i.setTransformForCurrent()}else if(p)Xf.x=0,Xf.y=0,Xf.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Xf.x+=s.x,Xf.y+=s.y,this.transformWithoutTranslate(i,Xf.x,Xf.y,Xf.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Xf.x=0,Xf.y=0,Xf.z=0;return Xf}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,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,_=(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,f,m,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,r){const{context:a}=s;if(!a)return;const{renderable:o}=t.attribute;if(!1===o)return;a.highPerformanceSave();const l=this.transform(t,e,a,i),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.z=d,this.drawPathProxy(t,a,h,c,s,n)||(this.drawShape(t,a,h,c,s,n,null,null,r),this.z=0,a.modelMatrix!==u&&ep.free(a.modelMatrix),a.modelMatrix=u),a.highPerformanceRestore()}}var qf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zf=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 Qf=class extends Kf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Eu,this.builtinContributions=[Tf,Cf,wf],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=d>c;let p=!1;if(nFt){const t=Yt(b,y),r=Yt(x,y),a=Zp(v,_,f,m,n,t,Number(u)),o=Zp(A,k,M,T,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,Ut(o.y11,o.x11),Ut(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>Ft)||C<.001)e.lineTo(i+M,s+T),p=!0;else if(w>Ft){const t=Yt(B,w),n=Yt(P,w),a=Zp(M,T,A,k,r,-n,Number(u)),o=Zp(f,m,v,_,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),w0&&e.arc(i+a.cx,s+a.cy,n,Ut(a.y01,a.x01),Ut(a.y11,a.x11),!u);const t=Ut(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Wt(E),s+r*$t(E));return p}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Pc(t,null==r?void 0:r.theme).arc;const{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:k=l.outerRadius,innerRadius:M=l.innerRadius}=t.attribute;k+=b,M-=x;let T=0;const w=(c(S)&&S||S[0])&&"conical"===h.gradient;if(w){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Nt(s-i){var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)Xc[s]=t,i&&(i=!(null!==(e=Xc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Xc[e]=!!t[e],i&&(i=!!Xc[e]);else Xc[0]=!1,Xc[1]=!1,Xc[2]=!1,Xc[3]=!1;return{isFullStroke:i,stroke:Xc}})(d);if((_||E)&&(e.beginPath(),Qp(t,e,i,s,k,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),g?(this._runStroke(t,e,i,s,l,y,E,v,o),this._runFill(t,e,i,s,l,_,m,u,p,a)):(this._runFill(t,e,i,s,l,_,m,u,p,a),this._runStroke(t,e,i,s,l,y,E,v,o))),!E&&y&&(e.beginPath(),Qp(t,e,i,s,k,M,B),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(c(S)&&S||S[1])&&A){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Nt(h-r)>=Vt-Ft){e.beginPath();const r=Math.abs(k-M)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,M,d,d+r),C||this.beforeRenderStep(t,e,i,s,_,y,m,v,l,n,a,o);const u=()=>{if(_){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+=Vt;for(;i>Vt;)i-=Vt;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),up(o.color,l.color,h,!1)}(0,0,h,n);a||$p&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}},p=()=>{y&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};u(),p()}}this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o),w&&(h.startAngle+=T,h.endAngle+=T)}_runFill(t,e,i,s,n,r,a,o,l,h){r&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l){r&&a&&(l?l(e,t.attribute,n):o&&(e.setStrokeStyle(t,t.attribute,i,s,n),e.stroke()))}draw(t,e,i,s){const n=Pc(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s,n)}};Qf=qf([Ka(),Jf(0,$a(uo)),Jf(0,qa(tg)),Zf("design:paramtypes",[Object])],Qf);var tm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},em=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},im=function(t,e){return function(i,s){e(i,s,t)}};let sm=class extends Kf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Lu,this.builtinContributions=[Ef,Pf,Bf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Pc(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,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:y}=f;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,_,y,m,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{y&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,_,y,m,v,l,n,a,o)}draw(t,e,i,s){const n=Pc(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function nm(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]=hl(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 rm(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function am(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=rm(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),nm(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=qo.ROW:"y"===s?u=qo.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.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 lm=class extends Kf{constructor(){super(...arguments),this.numberType=Du}draw(t,e,i,s){const n=Pc(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 f;if(!e)return;t.beginPath();am(t,e,l,h,{offsetX:c,offsetY:d,offsetZ:null!==(f=this.z)&&void 0!==f?f:0}),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:m=0,x:v=0}=a;return!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,m-c,v-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,m-c,v-d,o),t.stroke())),!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:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===_)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);function x(t,e){return"none"===e?t:t.filter((t=>!1!==t.defined))}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=Nl(x(t.points,v),_,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===_){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===y){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],y,b,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=y*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Yt(_,1),b,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,y,b,i,s,t,a,o)}};function hm(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),nm(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),nm(t,l,1,s),o=!1):o=!0}t.closePath()}lm=om([Ka()],lm);const cm=new class extends kf{constructor(){super(...arguments),this.time=Jo.afterFillStroke}drawShape(t,e,i,s,n,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:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:id(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:id(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:id(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:id(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},dm=bf;var um=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gm=function(t,e){return function(i,s){e(i,s,t)}};let fm=class extends Kf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Pu,this.builtinContributions=[cm,dm],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,_=m[0];e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const i=m[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,v)}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:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(y(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Pc(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension,connectedType:x=g.connectedType}=t.attribute,S=this.valid(t,g,a,o);if(!S)return;const{doFill:A}=S,k=S.doStroke&&S.sVisible,{clipRange:M=g.clipRange,closePath:T,points:w,segments:C}=t.attribute;let{curveType:E=g.curveType}=t.attribute;function B(t,e){return"connect"!==e?t:t.filter((t=>!1!==t.defined))}if(T&&"linear"===E&&(E="linearClosed"),1===M&&!C&&!w.some((t=>!1===t.defined))&&"linear"===E)return this.drawLinearAreaHighPerformance(t,e,!!f,k,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(C&&C.length){let e,i;const s=C.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=Nl(B(t.points,x),E,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=C.length-1;t>=0;t--){const e=C[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=C[t-1].points,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=Nl(B(i,x),"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!w||!w.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=B(w,x),i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(u=e[t].x1)&&void 0!==u?u:e[t].x,y:null!==(p=e[t].y1)&&void 0!==p?p:e[t].y});const s=Nl(e,E,{curveTension:b}),n=Nl(i,"stepBefore"===E?"stepAfter":"stepAfter"===E?"stepBefore":E,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===M){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,A,v,k,y,r[c],[g,t.attribute],M,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=M*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,A,v,k,y,r[u],[g,t.attribute],Yt(f,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,A,v,k,y,t.attribute,g,M,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Pc(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,f){return this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f)}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;t.beginPath();const{points:m,segments:v}=u.attribute;let _,b,x=qo.ROW;if(v){const t=v[v.length-1];b=v[0].points[0],_=t.points[t.points.length-1]}else b=m[0],_=m[m.length-1];const S=Nt(_.x-b.x),A=Nt(_.y-b.y);x=null==_.x1?qo.ROW:null==_.y1?qo.COLUMN:Number.isFinite(S+A)?S>A?qo.ROW:qo.COLUMN:qo.ROW,function(t,e,i,s){var n;const{top:r,bottom:a}=e;if(r.curves.length!==a.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;for(let o=0,l=r.curves.length;od?qo.ROW:qo.COLUMN,Number.isFinite(c)||(o=qo.COLUMN),Number.isFinite(d)||(o=qo.ROW);const u=i*(o===qo.ROW?c:d);let p=0,g=!0;const f=[],m=[];for(let e=0,i=r.curves.length;e{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;y(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),am(t,i[0]?e.top:e.bottom,l,x===qo.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d})),t.setStrokeStyle(u,a,k-h,M-c,o),t.stroke()}})(),!1}};fm=um([Ka(),gm(0,$a(uo)),gm(0,qa(eg)),pm("design:paramtypes",[Object])],fm);const mm=Mf,vm=bf;var _m=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(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)},bm=function(t,e){return function(i,s){e(i,s,t)}};let xm=class extends Kf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Fu,this.builtinContributions=[vm,mm],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:Pc(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:_,doFill:y,doStroke:b}=m;if(e.beginPath(),t.pathShape)il(t.pathShape.commandList,e,i,s,1,1,f);else{il((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,y,b,v,_,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):_&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{y&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,y,b,v,_,d,n,a,o)}draw(t,e,i,s){const n=Pc(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};xm=_m([Ka(),bm(0,$a(uo)),bm(0,qa(rg)),ym("design:paramtypes",[Object])],xm);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)}};let Mm=class extends Kf{constructor(t){super(),this.graphicRenderContributions=t,this.type="rect",this.numberType=ju,this.builtinContributions=[jf,Vf,Hf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){l=null!=l?l:Pc(t,null==r?void 0:r.theme).rect;const{fill:h=l.fill,background:c,stroke:d=l.stroke,cornerRadius:u=l.cornerRadius,cornerType:p=l.cornerType,opacity:g=l.opacity,fillOpacity:f=l.fillOpacity,lineWidth:m=l.lineWidth,strokeOpacity:v=l.strokeOpacity,visible:_=l.visible,x1:b,y1:x,x:S=l.x,y:A=l.y,fillStrokeOrder:k=l.fillStrokeOrder,drawStrokeWhenZeroWH:M=l.drawStrokeWhenZeroWH}=t.attribute;let{width:T,height:w}=t.attribute;T=(null!=T?T:b-S)||0,w=(null!=w?w:x-A)||0;const C=Xp(g,f,T,w,h),E=qp(g,v,T,w,M),B=Gp(h,c),P=Yp(d,m);if(!t.valid||!_)return;if(!B&&!P)return;if(!(C||E||a||o||c))return;0===u||y(u)&&u.every((t=>0===t))?(e.beginPath(),e.rect(i,s,T,w)):(e.beginPath(),Of(e,i,s,T,w,u,"bevel"!==p));const L={doFill:B,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,B,P,C,E,l,n,a,o,L),k?(this._runStroke(t,e,i,s,l,L,E,S,A,o),this._runFill(t,e,i,s,l,L,C,S,A,a)):(this._runFill(t,e,i,s,l,L,C,S,A,a),this._runStroke(t,e,i,s,l,L,E,S,A,o)),this.afterRenderStep(t,e,i,s,B,P,C,E,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h){r.doFill&&(h?h(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h){r.doStroke&&(h?h(e,t.attribute,n):a&&(e.setStrokeStyle(t,t.attribute,o-i,l-s,n),e.stroke()))}draw(t,e,i,s){const n=Pc(t,null==s?void 0:s.theme).rect;this._draw(t,n,!1,i,s,n)}};Mm=Sm([Ka(),km(0,$a(uo)),km(0,qa(og)),Am("design:paramtypes",[Object])],Mm);var Tm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Cm=function(t,e){return function(i,s){e(i,s,t)}};let Em=class extends Kf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Vu,this.builtinContributions=[Wf,$f,Yf,Gf],this.init(t)}drawShape(t,e,i,s,n,r,a,o,l){var h;l=null!=l?l:Pc(t,null==r?void 0:r.theme).symbol;const{size:c=l.size,x:d=l.x,y:u=l.y,scaleX:p=l.scaleX,scaleY:g=l.scaleY,fillStrokeOrder:f=l.fillStrokeOrder,clipRange:m=l.clipRange}=t.attribute,v=this.valid(t,l,a,o);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v,A=t.getParsedPath();if(!A)return;const{keepDirIn3d:k=l.keepDirIn3d}=t.attribute,M=null!==(h=this.z)&&void 0!==h?h:0;e.beginPath();let T=i,w=s,C=M;const E=e.camera;if(k&&E&&e.project){const t=e.project(i,s,M);e.camera=null,y(c)&&(c[0],c[1]),T=t.x,w=t.y,C=void 0}!1===A.draw(e,c,T,w,C,((n,r)=>{var h,c,v,_;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(h=r.fill)&&void 0!==h?h:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(v=r.stroke)&&void 0!==v?v:t.attribute.stroke,e.lineWidth=null!==(_=r.lineWidth)&&void 0!==_?_:t.attribute.lineWidth,r=e}const y=()=>{r.fill&&(a?a(e,t.attribute,l):(e.setCommonStyle(t,r,d-i,u-s,l),e.fill()))},x=()=>{r.stroke&&(o?o(e,t.attribute,l):b&&m>=1&&(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,l),e.stroke()))};f?(x(),y()):(y(),x())}))&&e.closePath(),e.camera=E,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,x,S,_,b,l,n,a,o),f?(this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o),this._runFill(t,e,i,s,l,x,_,d,u,A,a)):(this._runFill(t,e,i,s,l,x,_,d,u,A,a),this._runStroke(t,e,i,s,l,S,b,d,u,A,m,p,g,o)),this.afterRenderStep(t,e,i,s,x,S,_,b,l,n,a,o)}_runFill(t,e,i,s,n,r,a,o,l,h,c){r&&!h.isSvg&&(c?c(e,t.attribute,n):a&&(e.setCommonStyle(t,t.attribute,o-i,l-s,n),e.fill()))}_runStroke(t,e,i,s,n,r,a,o,l,h,c,d,u,p){r&&!h.isSvg&&(p?p(e,t.attribute,n):a&&c>=1&&(e.setStrokeStyle(t,t.attribute,(o-i)/d,(l-s)/u,n),e.stroke()))}draw(t,e,i,s){const n=Pc(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Em=Tm([Ka(),Cm(0,$a(uo)),Cm(0,qa(lg)),wm("design:paramtypes",[Object])],Em);const Bm=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Ve)}allocate(t,e,i,s){if(!this.pools.length)return(new Ve).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 Ve(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(...t){this.pools=[]}};const Pm=new class extends yf{constructor(){super(...arguments),this.time=Jo.beforeFillStroke}drawShape(t,e,i,s,n,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,backgroundKeepAspectRatio:M=l.backgroundKeepAspectRatio}=t.attribute;let T,{background:w}=t.attribute;if(!w)return;const C=()=>{"richtext"===t.type&&(e.restore(),e.save(),T&&e.setTransformFromMatrix(T,!0,1))};let E;"richtext"===t.type&&(T=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const B=g(w)&&w.background,P=t.transMatrix.onlyTranslate();if(B){const e=t.AABBBounds,i=(null!==(u=w.x)&&void 0!==u?u:e.x1)+(null!==(p=w.dx)&&void 0!==p?p:0),s=(null!==(f=w.y)&&void 0!==f?f:e.y1)+(null!==(m=w.dy)&&void 0!==m?m:0),n=null!==(v=w.width)&&void 0!==v?v:e.width(),r=null!==(_=w.height)&&void 0!==_?_:e.height();if(E=Bm.allocate(i,s,i+n,s+r),w=w.background,!P){const t=E.width(),e=E.height();E.set((null!==(y=w.x)&&void 0!==y?y:0)+(null!==(b=w.dx)&&void 0!==b?b:0),(null!==(x=w.y)&&void 0!==x?x:0)+(null!==(S=w.dy)&&void 0!==S?S:0),t,e)}}else E=t.AABBBounds,P||(E=ff(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(w);if("success"!==n.state||!n.data)return void C();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,E,{backgroundMode:A,backgroundFit:k,backgroundKeepAspectRatio:M}),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n,backgroundOpacity:r=1}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=r,e.fillStyle=w,n?(Of(e,E.x1,E.y1,E.width(),E.height(),n,!0),e.fill()):e.fillRect(E.x1,E.y1,E.width(),E.height()),e.highPerformanceRestore()}B&&Bm.free(E),C()}};var Lm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Om=function(t,e){return function(i,s){e(i,s,t)}};let Im=class extends Kf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Nu,this.builtinContributions=[Pm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Pc(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,fontSize:v=d.fontSize,verticalMode:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute,x=null!==(l=rd(t.attribute.lineHeight,v))&&void 0!==l?l:v,S=this.valid(t,d,a,o);if(!S)return;const{fVisible:A,sVisible:k,doFill:M,doStroke:T}=S,w=!f,C=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,M,T,A,k,d,n,a,o),w&&this.transformUseContext2d(t,d,C,e);const E=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=tp.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),tp.free(t)}T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,C))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,C))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,C),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;T&&(o?o(e,t.attribute,d):k&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,C)})))),M&&(a?a(e,t.attribute,d):A&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,C),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,n.descent,(n.descent-n.ascent)/2,C,d,e,{width:n.width})}))))}else{let{textAlign:i=d.textAlign,textBaseline:s=d.textBaseline}=t.attribute;if(!_){const e=i;i=null!==(h=t.getBaselineMapAlign()[s])&&void 0!==h?h:"left",s=null!==(c=t.getAlignMapBaseline()[e])&&void 0!==c?c:"top"}t.tryUpdateAABBBounds();const n=t.cache,{verticalList:r}=n;e.textAlign="left",e.textBaseline="top";const a=x*r.length;let o=0;r.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);o=Gt(e,o)}));let l=0,u=0;"bottom"===s?u=-a:"middle"===s&&(u=-a/2),"center"===i?l-=o/2:"right"===i&&(l-=o),r.forEach(((t,e)=>{const s=t.reduce(((t,e)=>t+(e.width||0)),0),n=o-s;let r=l;"center"===i?r+=n/2:"right"===i&&(r+=n),t.forEach((t=>{const{text:i,width:s,direction:n}=t;E(i,a-(e+1)*x+u,r,n),r+=s}))}))}w&&this.restoreTransformUseContext2d(t,d,C,e),this.afterRenderStep(t,e,i,s,M,T,A,k,d,n,a,o)}draw(t,e,i,s){const n=Pc(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,l,h,c){if(e+t<=0)return;const{textAlign:d=l.textAlign,fill:p=l.fill,opacity:g=l.opacity,underlineOffset:f=l.underlineOffset,underlineDash:m=l.underlineDash,fillOpacity:v=l.fillOpacity}=i.attribute,_=!u(c),y=_?c.width:i.clipedWidth,b=_?0:dg(d,y),x={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};if(t){x.lineWidth=t,h.setStrokeStyle(i,x,s,n,l),m&&h.setLineDash(m),h.beginPath();const e=n+r+f;h.moveTo(s+b,e,o),h.lineTo(s+b+y,e,o),h.stroke()}if(e){x.lineWidth=e,h.setStrokeStyle(i,x,s,n,l),h.beginPath();const t=n+a;h.moveTo(s+b,t,o),h.lineTo(s+b+y,t,o),h.stroke()}}};function Dm(t,e,i,s){if(e&&e.length){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},Nm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Um=function(t,e){return function(i,s){e(i,s,t)}};let Wm=class extends Kf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=zu,this.builtinContributions=[Hm,jm],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Pc(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,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:_,doStroke:b}=f;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?Dm(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n,r=!0){var a;if(e.length<3)return void Dm(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,f=(Math.atan2(u,d)-Math.atan2(g,p))/2,m=Math.abs(Math.tan(f));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,_=v/m;const y=Fm(d,u),b=Fm(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*m);const S=zm(h,_,y,d,u),A=zm(h,_,b,p,g),k=2*h.x-S.x-A.x,M=2*h.y-S.y-A.y,T=Fm(k,M),w=zm(h,Fm(_,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 B=E-C;B<0&&(C=E,B=-B),B>Math.PI&&(B-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),B&&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,_,b,m,v,l,n,a,o);const x=()=>{_&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,_,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=Pc(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Wm=Vm([Ka(),Um(0,$a(uo)),Um(0,qa(ag)),Nm("design:paramtypes",[Object])],Wm);var Gm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ym=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 Xm=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Ou}reInit(){this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Lf)}drawShape(t,e,i,s,n,r,a,o,l){const{clip:h,fill:c,stroke:d,background:u}=t.attribute;if(!(h||c||d||u))return;l=null!=l?l:Pc(t,null==r?void 0:r.theme).group;const{opacity:p=l.opacity,width:g=l.width,height:f=l.height,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,cornerType:k=l.cornerType,x:M=l.x,y:T=l.y}=t.attribute,w=Xp(p,m,g,f,c),C=qp(p,v,g,f),E=Gp(c,u),B=Yp(d,x);if(!t.valid||!S)return;if(!h){if(!E&&!B)return;if(!(w||C||a||o||u))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,g,f)):(e.beginPath(),Of(e,i,s,g,f,_,"bevel"!==k));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Lf));const P={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this._groupRenderContribitions.forEach((r=>{r.time===Jo.beforeFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o,P)})),h&&e.clip();const L=()=>{P.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,M-i,T-s,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,M-i,T-s,l),e.stroke()))};A?(R(),L()):(L(),R()),this._groupRenderContribitions.forEach((r=>{r.time===Jo.afterFillStroke&&r.drawShape(t,e,i,s,E,B,w,C,l,n,a,o)}))}draw(t,e,i,s){var n,r;const{context:a}=i;if(!a)return;const{clip:o,baseOpacity:l=1,drawMode:h}=t.attribute,c=a.nativeContext,d=a.canvas.nativeCanvas;if(h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.canvas,o=So.global.createCanvas({width:r.width,height:r.height,dpr:1}),l=o.getContext("2d"),c=a.nativeContext.getTransform();l.setTransform(c.a,c.b,c.c,c.d,c.e,c.f),1===h&&(l.save(),l.clearRect(0,0,r.width,r.height),l.beginPath(),l.rect(e,i,s,n),l.clip(),l.drawImage(r.nativeCanvas,0,0,r.width,r.height,0,0,r.displayWidth,r.displayHeight),l.restore()),a.nativeContext=l,r.nativeCanvas=o}o?a.save():a.highPerformanceSave();const u=a.baseGlobalAlpha;a.baseGlobalAlpha*=l;const p=a.modelMatrix;if(a.camera){const e=Pc(t,null==s?void 0:s.theme).group,i=ep.allocate(),n=ep.allocate();mg(n,t,e),Zu(i,p||i,n),a.modelMatrix=i,ep.free(n),a.setTransform(1,0,0,1,0,0,!0)}else a.transformFromMatrix(t.transMatrix,!0);a.beginPath(),s.skipDraw?this.drawShape(t,a,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,a,0,0,i,null,null,null);const{scrollX:g,scrollY:f}=t.attribute;let m;if((g||f)&&a.translate(g,f),s&&s.renderInGroup&&(m=s.renderInGroup(null===(n=s.renderInGroupParams)||void 0===n?void 0:n.skipSort,t,i,null===(r=s.renderInGroupParams)||void 0===r?void 0:r.nextM)),a.modelMatrix!==p&&ep.free(a.modelMatrix),a.modelMatrix=p,a.baseGlobalAlpha=u,h>0){const{x:e,y:i,width:s,height:n}=t.attribute,r=a.nativeContext,o=a.canvas.nativeCanvas;c.save(),c.setTransform(a.dpr,0,0,a.dpr,0,0,!0),1===h&&r.rect(e,i,s,n),c.drawImage(o,0,0,o.width,o.height,0,0,a.canvas.displayWidth,a.canvas.displayHeight);const l=r.getTransform();c.setTransform(l.a,l.b,l.c,l.d,l.e,l.f),a.nativeContext=c,a.canvas.nativeCanvas=d,c.restore()}m&&m.then?m.then((()=>{o?a.restore():a.highPerformanceRestore()})):o?a.restore():a.highPerformanceRestore()}};Xm=Gm([Ka(),$m(0,$a(uo)),$m(0,qa(sg)),Ym("design:paramtypes",[Object])],Xm);var Km=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},Zm=function(t,e){return function(i,s){e(i,s,t)}};const Jm=["","repeat-x","repeat-y","repeat"];let Qm=class extends Kf{constructor(t){super(),this.graphicRenderContributions=t,this.numberType=Iu,this.builtinContributions=[Nf,Uf],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Pc(t).image,{repeatX:h=l.repeatX,repeatY:c=l.repeatY,x:d=l.x,y:u=l.y,cornerRadius:p=l.cornerRadius,fillStrokeOrder:g=l.fillStrokeOrder,cornerType:f=l.cornerType,image:m}=t.attribute,v=this.valid(t,l,a);if(!v)return;const{fVisible:_,sVisible:b,doFill:x,doStroke:S}=v;if(!m||!t.resources)return;const A=t.resources.get(m);if("success"!==A.state)return;const k=t.width,M=t.height;e.beginPath();let T=!1;0===p||y(p)&&p.every((t=>0===t))?e.rect(i,s,k,M):(Of(e,i,s,k,M,p,"bevel"!==f),T=!0),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const w=()=>{if(x)if(a)a(e,t.attribute,l);else if(_){e.setCommonStyle(t,t.attribute,i,s,l);let n=0;if("repeat"===h&&(n|=1),"repeat"===c&&(n|=2),n){const t=e.createPattern(A.data,Jm[n]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,k,M),e.translate(-i,-s,!0)}else e.drawImage(A.data,i,s,k,M)}},C=()=>{S&&(o?o(e,t.attribute,l):b&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(C(),T&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),w(),T&&e.restore()):(T&&(e.save(),e.clip()),this.beforeRenderStep(t,e,i,s,x,!1,_,!1,l,n,a),w(),T&&e.restore(),C()),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 Gc.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Pc(t).image;this._draw(t,a,!1,i)}};Qm=Km([Ka(),Zm(0,$a(uo)),Zm(0,qa(ng)),qm("design:paramtypes",[Object])],Qm);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"),fv=Symbol.for("DrawContribution"),mv=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Bu,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];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+=Vt;for(;o<0;)o+=Vt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};var vv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_v=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const yv=Symbol.for("DrawItemInterceptor"),bv=new Ve,xv=new Ve;class Sv{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){bv.copy(s.dirtyBounds),xv.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,tp.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(bv),s.backupDirtyBounds.copy(xv)),!0}}class Av{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 kv=class{constructor(){this.order=1,this.interceptors=[new Sv,new Tv,new Mv,new Av]}afterDrawItem(t,e,i,s,n){if((!t.in3dMode||i.in3dInterceptor)&&!t.shadowRoot&&!t.attribute._debug_bounds&&!(t.baseGraphic||t.attribute.globalZIndex||t.interactiveGraphic))return!1;for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&ep.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var wv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ev=function(t,e){return function(i,s){e(i,s,t)}};let Bv=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))}reInit(){this.drawContribution.reInit()}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}};Bv=wv([Ka(),Ev(0,$a(fv)),Cv("design:paramtypes",[Object])],Bv);var Pv=new Da((t=>{t(xo).to(Bv)}));const Lv=Symbol.for("PickerService"),Rv=Symbol.for("GlobalPickerService"),Ov=Symbol.for("PickItemInterceptor"),Iv=Symbol.for("PickServiceInterceptor");var Dv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Fv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){if(t.graphic){let e=t.graphic;for(;e.parent;)e=e.parent;e.shadowHost&&(t.params={shadowTarget:t.graphic},t.graphic=e.shadowHost)}return t}};Fv=Dv([Ka()],Fv);let zv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Pc(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=tp.allocateByObj(a),u=new ne(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};zv=Dv([Ka()],zv);let jv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new ne(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}};jv=Dv([Ka()],jv);let Hv=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){const a=mv(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};Hv=Dv([Ka()],Hv);var Vv=new Da(((t,e,i)=>{i(Lv)||(t(Rv).toSelf(),t(Lv).toService(Rv)),t(Hv).toSelf().inSingletonScope(),t(Ov).toService(Hv),t(zv).toSelf().inSingletonScope(),t(Ov).toService(zv),t(jv).toSelf().inSingletonScope(),t(Ov).toService(jv),go(t,Ov),t(Fv).toSelf().inSingletonScope(),t(Iv).toService(Fv),go(t,Iv)})),Nv=new Da((t=>{t(Uu).to(vg),t(Wu).toConstantValue(uf)}));const Uv=Symbol.for("AutoEnablePlugins"),Wv=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},Yv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$v=function(t,e){return function(i,s){e(i,s,t)}};let Xv=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&&bo.isBound(Uv)&&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(...t){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Xv=Gv([Ka(),$v(0,$a(uo)),$v(0,qa(Uv)),Yv("design:paramtypes",[Object])],Xv);var Kv=new Da((t=>{t(Wv).to(Xv),function(t,e){t(uo).toDynamicValue((({container:t})=>new po(e,t))).whenTargetNamed(e)}(t,Uv)})),qv=new Da((t=>{go(t,_o)})),Zv=new Da((t=>{t(Rh).to(Oh).inSingletonScope(),go(t,Rh)})),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.type="static",this.offscreen=!1,this.global=So.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=Fh({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()}};t_=Jv([Ka(),Qv("design:paramtypes",[])],t_);var e_=new Da((t=>{t(t_).toSelf(),t(Fp).toService(t_)}));var i_=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 s_(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function n_(t,e,i,s=!1,n=!1){let r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=s_(t,e,s);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;t{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=s_(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var o_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},l_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},h_=function(t,e){return function(i,s){e(i,s,t)}};let c_=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this._renderInGroup=(t,e,i,s)=>{var n;t?e.forEachChildren((t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))})):n_(e,Ql.zIndex,(t=>{i.break||(t.isContainer?this.renderGroup(t,i,s):this.renderItem(t,i))}),!1,!!(null===(n=i.context)||void 0===n?void 0:n.camera))},this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new He,this.backupDirtyBounds=new He,this.global=So.global,this.layerService=So.layerService,y(this.contributions)||(this.contributions=[this.contributions]),this.init()}reInit(){this.init(),this.contributions.forEach((t=>{t.reInit()}))}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){var i;this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:s,stage:n,viewBox:r,transMatrix:a}=e;if(!s)return;const o=this.dirtyBounds.setValue(0,0,r.width(),r.height());if(n.dirtyBounds&&!n.dirtyBounds.empty()){const t=_e(o,n.dirtyBounds,!1);o.x1=Math.floor(t.x1),o.y1=Math.floor(t.y1),o.x2=Math.ceil(t.x2),o.y2=Math.ceil(t.y2)}const l=s.dpr%1;(l||.5!==l)&&(o.x1=Math.floor(o.x1*s.dpr)/s.dpr,o.y1=Math.floor(o.y1*s.dpr)/s.dpr,o.x2=Math.ceil(o.x2*s.dpr)/s.dpr,o.y2=Math.ceil(o.y2*s.dpr)/s.dpr),this.backupDirtyBounds.copy(o),s.reset(!1),s.save(),s.setClearMatrix(a.a,a.b,a.c,a.d,a.e,a.f),s.clearMatrix(!1),s.translate(r.x1,r.y1,!0),s.beginPath(),s.rect(o.x1,o.y1,o.width(),o.height()),s.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,s,e),(null===(i=t.drawParams)||void 0===i?void 0:i.stage)&&t.drawParams.stage.hooks.afterClearScreen.call(t.drawParams),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:Ql.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Ql.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,tp.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),s.restore(),s.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=a_(e,i,Ql.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&&!Se(t.AABBBounds,this.dirtyBounds,!1)&&"empty"!==t.attribute.boundsMode)return;let n,r=i;if(this.useDirtyBounds){n=Bm.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=tp.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}e.isGroupScroll=!(!t.attribute.scrollX&&!t.attribute.scrollY),this.renderItem(t,e,{renderInGroupParams:{skipSort:s,nextM:r},renderInGroup:this._renderInGroup}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Bm.free(n),tp.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||bo.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};let u_=class extends lm{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=Pc(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=$p(u,p,c),_=Kp(u,g),y=Gp(c),b=Yp(d,f);if(!t.valid||!m)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())}};u_=d_([Ka()],u_);var p_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 g_=class extends fm{constructor(){super(...arguments),this.numberType=Pu}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=Pc(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=$p(u,d,c),f=Gp(c);if(!t.valid||!p)return;if(!f)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())}};g_=p_([Ka()],g_);var f_,m_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},v_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__=function(t,e){return function(i,s){e(i,s,t)}},y_=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"}(f_||(f_={}));let b_=class extends c_{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=f_.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new vo([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return y_(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:Ql.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:Ql.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 y_(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return y_(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>y_(this,void 0,void 0,(function*(){if(2!==t.count)yield r_(t,Ql.zIndex,((i,s)=>{if(this.status===f_.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return y_(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return y_(this,void 0,void 0,(function*(){this.rendering&&(this.status=f_.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=f_.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 y_(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:()=>y_(this,void 0,void 0,(function*(){yield r_(t,Ql.zIndex,(t=>y_(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};b_=m_([Ka(),__(0,Xa(nv)),__(1,$a(u_)),__(2,$a(g_)),__(3,$a(uo)),__(3,qa(yv)),v_("design:paramtypes",[Array,Object,Object,Object])],b_);var x_=new Da((t=>{t(yf).toSelf().inSingletonScope(),t(kf).toSelf().inSingletonScope(),t(fv).to(c_),t(tv).to(b_),t(rv).to(Xm).inSingletonScope(),t(nv).toService(rv),go(t,sg),t(xf).toSelf().inSingletonScope(),go(t,cg),go(t,nv),t(kv).toSelf().inSingletonScope(),t(yv).toService(kv),go(t,yv)}));function S_(){S_.__loaded||(S_.__loaded=!0,bo.load(Wp),bo.load(Nv),bo.load(Pv),bo.load(Vv),bo.load(Kv),function(t){t.load(qv),t.load(Zv),t.load(e_)}(bo),function(t){t.load(x_)}(bo))}S_.__loaded=!1,S_();const A_=bo.get(yo);So.global=A_;const k_=bo.get(Ip);So.graphicUtil=k_;const M_=bo.get(Op);So.transformUtil=M_;const T_=bo.get(Uu);So.graphicService=T_;const w_=bo.get(Dp);So.layerService=w_;class C_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),e.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),e.graphicService.hooks.onRemove.tap(this.key,this.handleChange))}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key)),i=this.pluginService.stage;i&&(i.graphicService.hooks.onAttributeUpdate.taps=e(i.graphicService.hooks.onAttributeUpdate.taps),i.graphicService.hooks.onSetStage.taps=e(i.graphicService.hooks.onSetStage.taps),i.graphicService.hooks.onRemove.taps=e(i.graphicService.hooks.onRemove.taps))}}class E_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=So.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=So.global.getRequestAnimationFrame();this.rafId=t((()=>{So.global.devicePixelRatio!==this.dpr&&(this.dpr=So.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))},i=matchMedia(t);i&&i.addEventListener("change",e),this.autoRefreshCbs||(this.autoRefreshCbs=[]),this.autoRefreshCbs.push((()=>{i&&i.removeEventListener("change",e)}))}catch(t){return!1}return!0}deactivate(t){var e;const i=So.global.getCancelAnimationFrame();i&&this.rafId&&i(this.rafId),null===(e=this.autoRefreshCbs)||void 0===e||e.forEach((t=>{t()})),this.autoRefreshCbs=void 0}}class B_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t;const e=this.pluginService.stage;e&&(e.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))})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.onAddIncremental.taps=e.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onClearIncremental.taps=e.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key)))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,So.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())}}const P_=new Ve;class L_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=Ia.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()}));const e=this.pluginService.stage;e&&(e.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&&(P_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(P_,t.parent&&t.parent.globalTransMatrix)))})),e.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))})),e.graphicService.hooks.clearAABBBounds.tap(this.key,((t,e,i)=>{e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(i)})),e.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){const e=this.pluginService.stage;e&&(e.graphicService.hooks.beforeUpdateAABBBounds.taps=e.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.afterUpdateAABBBounds.taps=e.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.clearAABBBounds.taps=e.graphicService.hooks.clearAABBBounds.taps.filter((t=>t.name!==this.key)),e.hooks.afterRender.taps=e.hooks.afterRender.taps.filter((t=>t.name!==this.key)),e.graphicService.hooks.onRemove.taps=e.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key)))}}let R_;function O_(){!function(){if(null==R_)try{const t=document.createElement("canvas"),e=t.getContext("2d");R_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),R_&&(R_=!!document.createElement)}catch(t){R_=!1}}();const t=So.global&&So.global.env;return t?"browser"===t:R_}let I_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};I_._pluginClasses={};const D_="white";class F_ extends Pp{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:D_}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}get ticker(){return this._ticker}set ticker(t){t.bindStage(this),this._ticker&&this._ticker.removeListener("tick",this.afterTickCb),t.addTimeline(this.timeline),this._ticker=t,this._ticker.on("tick",this.afterTickCb)}constructor(t={}){var e,i;super({}),this.tickedBeforeRender=!0,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._beforeRenderList.forEach((e=>e(t)))},this.afterClearScreen=t=>{this._afterClearScreen&&this._afterClearScreen(t)},this.afterClearRect=t=>{this._afterClearRect&&this._afterClearRect(t)},this.afterRender=t=>{this.renderCount++,this._afterRenderList.forEach((e=>e(t))),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null,this.tickedBeforeRender=!1},this.afterTickCb=()=>{this.tickedBeforeRender=!0,"rendering"!==this.state&&this.renderNextFrame()},this.params=t,this.theme=new Ec,this.hooks={beforeRender:new vo(["stage"]),afterRender:new vo(["stage"]),afterClearScreen:new vo(["stage"]),afterClearRect:new vo(["stage"])},this.global=So.global,!this.global.env&&O_()&&this.global.setEnv("browser"),this.window=bo.get(fc),this.renderService=bo.get(xo),this.pluginService=bo.get(Wv),this.layerService=bo.get(Dp),this.graphicService=bo.get(Uu),this.pluginService.active(this,t),this._beforeRenderList=[],this._afterRenderList=[],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:D_,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(),t.autoRefresh&&this.enableAutoRefresh(),!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),t.beforeRender&&this._beforeRenderList.push(t.beforeRender),t.afterRender&&this._afterRenderList.push(t.afterRender),this.hooks.afterClearScreen.tap("constructor",this.afterClearScreen),this.hooks.afterClearRect.tap("constructor",this.afterClearRect),this._afterClearScreen=t.afterClearScreen,this._afterClearRect=t.afterClearRect,this.supportInteractiveLayer=!1!==t.interactiveLayer,t.optimize||(t.optimize={tickRenderMode:"effect"}),this.optmize(t.optimize),t.background&&_(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background}),this.initAnimate(t),this.rafId=null!==(i=t.rafId)&&void 0!==i?i:Math.floor(6*Math.random())}initAnimate(t){var e;this.createTicker&&this.createTimeline&&(this._ticker=t.ticker||this.createTicker(this),this._ticker.bindStage(this),"performance"===(null===(e=this.params.optimize)||void 0===e?void 0:e.tickRenderMode)&&this._ticker.setFPS(30),this.timeline=this.createTimeline(),this._ticker.addTimeline(this.timeline),this._ticker.on("tick",this.afterTickCb))}startAnimate(){this._ticker&&this.timeline&&(this._ticker.start(),this.timeline.resume())}pauseRender(t=-1){this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new Wc(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(t=!1){t&&(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:f=[1,1,-1],color:m="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);const k=I_.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const M={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]}};if(this.camera)this.camera.params=M;else{const t=I_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRenderList.push(t)}removeBeforeRender(t){this._beforeRenderList=this._beforeRenderList.filter((e=>e!==t))}setAfterRender(t){this._afterRenderList.push(t)}removeAfterRender(t){this._afterRenderList=this._afterRenderList.filter((e=>e!==t))}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=I_.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}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 C_))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||"node"===this.global.env||(this.autoRefresh=!0,this.pluginService.register(new E_))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new B_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new He;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new L_,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=I_.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=I_.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=I_.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.startAnimate();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.getSpecifiedRequestAnimationFrame(this.rafId)((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.startAnimate();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===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),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.dirtyBounds&&this.dirtyBounds.clear(),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,i=!0){this.window.resize(t,e),i&&this.render()}resize(t,e,i=!0){"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e,i=!0){"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t,e=!0){this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new ne(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}setToFrame(t){throw new Error("暂不支持")}release(){var t,e,i;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.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),null===(t=this._ticker)||void 0===t||t.remTimeline(null==this?void 0:this.timeline),null===(e=this._ticker)||void 0===e||e.removeListener("tick",this.afterTickCb),this.params.ticker||null===(i=this._ticker)||void 0===i||i.release(),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(t=!0,e){if("released"===this.releaseStatus)return;const i=bo.get(fc),s=e?-e.x1:0,n=e?-e.y1:0,r=e?e.x2:this.viewWidth,a=e?e.y2:this.viewHeight,o=e?e.width():this.viewWidth,l=e?e.height():this.viewHeight;return i.create({viewBox:{x1:s,y1:n,x2:r,y2:a},width:o,height:l,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(i),i}toCanvas(t=!0,e){if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=bo.get(Lv)),this.pickerService}reInit(){this.renderService.reInit(),this.pickerService.reInit()}}var z_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},j_=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 H_=class{configure(t,...e){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Ve}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}}loadFont(t,e,i){return j_(this,void 0,void 0,(function*(){return{loadState:"fail"}}))}isMacOS(){return!1}copyToClipBoard(t){return Promise.resolve(null)}};H_=z_([Ka()],H_);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},N_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let U_=class{constructor(){this._uid=Ia.GenAutoIncrementId(),this.viewBox=new Ve,this.modelMatrix=new Ue(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(...t){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}};U_=V_([Ka(),N_("design:paramtypes",[])],U_);var W_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},G_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Y_=function(t,e){return function(i,s){e(i,s,t)}};let $_=class{constructor(t,e){this.pickItemInterceptorContributions=t,this.pickServiceInterceptorContributions=e,this.type="default",this.global=So.global}reInit(){this._init()}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order)),this.pickerServiceInterceptorContributions=this.pickServiceInterceptorContributions.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 Ve).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 Ue(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),this.pickerServiceInterceptorContributions.length)for(let t=0;t{if(r.isContainer){const i=new ne(e.x,e.y),a=Pc(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 ne(e.x,e.y);l.transformPoint(a,a);const o=Pc(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&&ep.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),tp.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};function X_(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 K_(t,e){const i=t.length,s=e.length;if(i===s)return[t,e];const n=[],r=[],a=i1e-10||Math.abs(h-e.p0.y)>1e-10)&&(c=!0)}}const d=n.filter((t=>t.length>2));return 1===d.length?[d[0]]:d}function ey(t,e){for(let i=0;i2){e.moveTo(s[0],s[1]);for(let t=2;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}))),ay=(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]},oy=(t,e,i)=>{if(1===e)i.push({points:t});else{const s=Math.floor(e/2),n=(t=>{const e=new He;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 ay(t,{x:s,y:e.y1},{x:s,y:e.y2})}const n=e.y1+s/2;return ay(t,{x:e.x1,y:n},{x:e.x2,y:n})})(t);oy(n[0],s,i),oy(n[1],e-s,i)}};let ly=!1;const hy=new Da((t=>{ly||(ly=!0,t(Qf).toSelf().inSingletonScope(),t(ev).to(Qf).inSingletonScope(),t(nv).toService(ev),t(tg).toService(xf),go(t,tg))}));let cy=!1;const dy=new Da((t=>{cy||(cy=!0,t(Mm).toSelf().inSingletonScope(),t(hv).to(Mm).inSingletonScope(),t(nv).toService(hv),t(zf).toSelf(),t(Ff).toSelf(),t(og).toService(zf),t(og).toService(Ff),t(og).toService(xf),go(t,og))}));let uy=!1;const py=new Da((t=>{uy||(uy=!0,t(lm).toSelf().inSingletonScope(),t(u_).toSelf().inSingletonScope(),t(av).to(lm).inSingletonScope(),t(nv).toService(av))}));let gy=!1;const fy=new Da((t=>{gy||(gy=!0,t(fm).toSelf().inSingletonScope(),t(iv).to(fm).inSingletonScope(),t(nv).toService(iv),t(eg).toService(xf),go(t,eg),t(g_).toSelf().inSingletonScope())}));let my=!1;const vy=new Da((t=>{my||(my=!0,t(Em).toSelf().inSingletonScope(),t(cv).to(Em).inSingletonScope(),t(nv).toService(cv),t(lg).toService(xf),go(t,lg))}));let _y=!1;const yy=new Da((t=>{_y||(_y=!0,t(sm).toSelf().inSingletonScope(),t(sv).to(sm).inSingletonScope(),t(nv).toService(sv),t(ig).toService(xf),go(t,ig))}));let by=!1;const xy=new Da((t=>{by||(by=!0,t(dv).to(Im).inSingletonScope(),t(nv).toService(dv),t(hg).toService(xf),go(t,hg))}));let Sy=!1;const Ay=new Da((t=>{Sy||(Sy=!0,t(xm).toSelf().inSingletonScope(),t(ov).to(xm).inSingletonScope(),t(nv).toService(ov),t(rg).toService(xf),go(t,rg))}));let ky=!1;const My=new Da((t=>{ky||(ky=!0,t(lv).to(Wm).inSingletonScope(),t(nv).toService(lv),t(ag).toService(xf),go(t,ag))}));var Ty=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 wy=class{constructor(){this.numberType=Ru}reInit(){}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=Pc(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};wy=Ty([Ka()],wy);let Cy=!1;const Ey=new Da((t=>{Cy||(Cy=!0,t(pv).to(wy).inSingletonScope(),t(nv).toService(pv))}));var By=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)};let Ly=class extends Kf{constructor(){super(),this.numberType=Hu,this.builtinContributions=[Pm],this.init()}drawShape(t,e,i,s,n){const r=Pc(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=$p(o,l,!0),d=$p(o,a,!0);c&&(e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,r),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=Pc(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:_=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),Of(e,i-t,s-n,v,_,f,!0)),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=Pc(t).richtext;this._draw(t,s,!1,i)}};Ly=By([Ka(),Py("design:paramtypes",[])],Ly);let Ry=!1;const Oy=new Da((t=>{Ry||(Ry=!0,t(uv).to(Ly).inSingletonScope(),t(nv).toService(uv))}));let Iy=!1;const Dy=new Da((t=>{Iy||(Iy=!0,t(gv).to(Qm).inSingletonScope(),t(nv).toService(gv),t(ng).toService(xf),go(t,ng))}));function Fy(t){const e=[];for(let i=0;i=0&&n>=0&&sat.getInstance().info(`[VChart log]: ${t}`,...e),Hy=(t,e)=>(d(Ny.warnHandler)&&Ny.warnHandler.call(null,t,e),e?at.getInstance().warn(`[VChart warn]: ${t}`,e):at.getInstance().warn(`[VChart warn]: ${t}`)),Vy=(t,e,i)=>{if(!d(Ny.errorHandler))throw new Error(t);Ny.errorHandler.call(null,t,e)},Ny={silent:!1,warnHandler:!1,errorHandler:!1},Uy=O_(),Wy=Uy&&globalThis?globalThis.document:void 0;function Gy(t){return("desktop-browser"===t||"mobile-browser"===t)&&Uy}function Yy(t){return $y(t)||"mobile-browser"===t}function $y(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let Xy=0;function Ky(){return Xy>=9999999&&(Xy=0),Xy++}function qy(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function Zy(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const Jy=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Qy extends Pp{constructor(t,e){super(t),this._skipRenderAttributes=Jy,(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,s){const n=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate({[t]:e},this.attribute,t,s);if(n)return this._setAttributes(n,i);m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?j(this.attribute[t],e):this.attribute[t]=e,this._skipRenderAttributes.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,i){return t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t,this._setAttributes(t,e)}_setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>this._skipRenderAttributes.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 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"},wb=(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 Cb extends l{constructor(t,e={}){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.startTime=jc.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.pressTimeout=null}),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=jc.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||Tb(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=wb(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=jc.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=wb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=Tb(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&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("pointerleave",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("pointerleave",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=jc.now()-i>this.config.press.time&&wb(s[0],t){So.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;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){if(!this.element)return;const i=this.element._events;this._callListeners(t,e,i["*"]),this._callListeners(t,e,i[t]),this.emit(t,e)}_callListeners(t,e,i){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},Bb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Pb=[0,0,0];let Lb=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){t!==this._font&&(this._font=t,this.nativeContext.font=t)}get font(){var t;return null!==(t=this._font)&&void 0!==t?t: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(),this._font=""))}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},$l),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},Kl),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},ql),{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 Ue(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Ue(1,0,0,1,0,0),this._clearMatrix=new Ue(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(t=!0){this.stack.length&&at.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Ue(1,0,0,1,0,0),this.stack.length=0,t&&this.nativeContext.setTransform(1,0,0,1,0,0)}getCanvas(){return this.canvas}getContext(){return this.nativeContext}setTransformForCurrent(t=!1){!t&&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 tp.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&&(tp.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0)),this.font="",this._clearFilterStyle=!1,this._clearShadowStyle=!1}highPerformanceRestore(){this.stack.length>0&&(tp.free(this.matrix),this.matrix=this.stack.pop())}rotate(t,e=!0){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,i=!0){this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e,i=!0){this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s,n=!0){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,a=!0,o=this.dpr){this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t,e=!0,i=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(t=!0,e=this.dpr){this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r,a=!0){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,i=!0){this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t,e=!0){const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i,s=!0){this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i,s=!0){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-=Vt;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(f,-2*y),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&&bp.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&&(Ju(Pb,[t,e,i],this.modelMatrix),t=Pb[0],e=Pb[1],i=Pb[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&&(Ju(Pb,[t,e,i],this.modelMatrix),t=Pb[0],e=Pb[1],i=Pb[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Ju(Pb,[e,i,s],this.modelMatrix),e=Pb[0],i=Pb[1],s=Pb[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,e=So.global.measureTextMethod){var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=So.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:ql.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:ql.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&&(Ju(Pb,[e,i,s],this.modelMatrix),e=Pb[0],i=Pb[1],s=Pb[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=_h(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowOffsetX:a=i.shadowOffsetX,shadowOffsetY:o=i.shadowOffsetY,blur:l=i.blur,globalCompositeOperation:h=i.globalCompositeOperation}=e;if(!(n<=1e-12)){if(a||o||r){const{shadowColor:t=i.shadowColor,shadowOffsetX:n=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=e;s.shadowBlur=r*this.dpr,s.shadowColor=t,s.shadowOffsetX=n*this.dpr,s.shadowOffsetY=a*this.dpr,this._clearShadowStyle=!0}else this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0);l?(s.filter=`blur(${l}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),h?(s.globalCompositeOperation=h,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1)}}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineDashOffset:c=n.lineDashOffset,lineCap:d=n.lineCap,miterLimit:u=n.miterLimit,keepStrokeScale:p=n.keepStrokeScale}=e;r.lineWidth=p?a:vh(this,a,this.dpr),r.strokeStyle=_h(this,o,t,i,s),r.lineJoin=l,h&&(r.setLineDash(h),r.lineDashOffset=c),r.lineCap=d,r.miterLimit=u}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?this.font=t.font:this.font=Ie(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?this.font=t.font:this.font=Ie(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(t=!0,e=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(t=this.dpr){return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(...t){this.stack.forEach((t=>tp.free(t))),this.stack.length=0}};Lb.env="browser",Lb=Eb([Ka(),Bb("design:paramtypes",[Object,Number])],Lb);var Rb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ob=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ib=class extends lp{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=So.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new Lb(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 Db(t,e){return new Da((i=>{i(Ih).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Dh).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Ib.env="browser",Ib=Rb([Ka(),Ob("design:paramtypes",[Object])],Ib);const Fb=Db(Ib,Lb);var zb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hb=function(t,e){return function(i,s){e(i,s,t)}};let Vb=class extends $_{constructor(t,e,i,s){super(i,s),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.pickServiceInterceptorContributions=s,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=uc.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 Ub=class{constructor(){this.type="group",this.numberType=Ou}contains(t,e,i){return!1}};Ub=Nb([Ka()],Ub);const Wb=new Da(((t,e,i,s)=>{Wb.__vloaded||(Wb.__vloaded=!0,t(kb).to(Ub).inSingletonScope(),t(Mb).toService(kb),go(t,Mb))}));Wb.__vloaded=!1;var Gb=Wb;const Yb=new Da(((t,e,i,s)=>{i(Vb)||t(Vb).toSelf().inSingletonScope(),i(Lv)?s(Lv).toService(Vb):t(Lv).toService(Vb)}));var $b,Xb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Kb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let qb=$b=class extends U_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${$b.idprefix}_${$b.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=So.global,this.viewBox=new Ve,this.modelMatrix=new Ue(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:$b.GenerateCanvasId(),canvasControled:!0};this.canvas=new Ib(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 Ib({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)}};qb.env="browser",qb.idprefix="visactor_window",qb.prefix_count=0,qb=$b=Xb([Ka(),Kb("design:paramtypes",[])],qb);const Zb=new Da((t=>{t(qb).toSelf(),t(mc).toDynamicValue((t=>t.container.get(qb))).whenTargetNamed(qb.env)}));var Jb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},tx=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 ex{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 ix(t,e=!1){const i=document.createElement("img");if(So.global.isImageAnonymous&&(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 sx=class extends H_{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 ex(t)}return new Ve}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 ix(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return ix(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:Ia.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(...t){}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}}loadFont(t,e,i){return tx(this,void 0,void 0,(function*(){return new FontFace(t,_(e)?`url(${e})`:e,i).load().then((function(t){return document.fonts.add(t),{loadState:"success"}})).catch((function(t){return console.error("Failed to load font:",t),{loadState:"fail"}}))}))}isMacOS(){if(void 0===this._isMacOS)try{this._isMacOS=navigator.platform.toUpperCase().indexOf("MAC")>=0}catch(t){this._isMacOS=!1}return this._isMacOS}copyToClipBoard(t){return navigator.clipboard.writeText(t).then((()=>{})).catch((t=>{}))}};sx=Jb([Ka(),Qb("design:paramtypes",[])],sx);const nx=new Da((t=>{nx.isBrowserBound||(nx.isBrowserBound=!0,t(sx).toSelf().inSingletonScope(),t(_o).toService(sx))}));function rx(t,e=!0){rx.__loaded||(rx.__loaded=!0,t.load(nx),t.load(Fb),t.load(Zb),e&&function(t){t.load(Gb),t.load(Yb)}(t))}nx.isBrowserBound=!1,rx.__loaded=!1;var ax=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ox=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lx=function(t,e){return function(i,s){e(i,s,t)}};let hx=class extends $_{constructor(t,e,i){super(e,i),this.contributions=t,this.pickItemInterceptorContributions=e,this.pickServiceInterceptorContributions=i,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 ap(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}};hx=ax([Ka(),lx(0,$a(uo)),lx(0,qa(tb)),lx(1,$a(uo)),lx(1,qa(Ov)),lx(2,$a(uo)),lx(2,qa(Iv)),ox("design:paramtypes",[Object,Object,Object])],hx);const cx=new Da((t=>{cx.__vloaded||(cx.__vloaded=!0,go(t,tb))}));cx.__vloaded=!1;var dx=cx;class ux{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;if(!this.canvasRenderer)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();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,l=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s,n)=>!(!o&&!l)||(o=t.isPointInPath(e.x,e.y),l=n||l,o)),((t,i,n,r)=>{if(o||l)return!0;const a=i.lineWidth||n.lineWidth,h=i.pickStrokeBuffer||n.pickStrokeBuffer,c=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=c?a+h:vh(s,a+h,s.dpr),o=t.isPointInStroke(e.x,e.y),l=r||l,o})),s.highPerformanceRestore(),o}}var px=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gx=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 mx=class extends ux{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Eu}};mx=px([Ka(),fx(0,$a(ev)),gx("design:paramtypes",[Object])],mx);let vx=!1;const _x=new Da(((t,e,i,s)=>{vx||(vx=!0,t(eb).to(mx).inSingletonScope(),t(tb).toService(eb))}));var yx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xx=function(t,e){return function(i,s){e(i,s,t)}};let Sx=class extends ux{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Pu}};Sx=yx([Ka(),xx(0,$a(iv)),bx("design:paramtypes",[Object])],Sx);let Ax=!1;const kx=new Da(((t,e,i,s)=>{Ax||(Ax=!0,t(ib).to(Sx).inSingletonScope(),t(tb).toService(ib))}));var Mx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Tx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Cx=function(t,e){return function(i,s){e(i,s,t)}};let Ex=class extends ux{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Lu}};Ex=Mx([Ka(),Cx(0,$a(sv)),Tx("design:paramtypes",[Object])],Ex);let Bx=!1;const Px=new Da(((t,e,i,s)=>{Bx||(Bx=!0,t(sb).to(Ex).inSingletonScope(),t(tb).toService(sb))}));class Lx{constructor(){this.type="glyph",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=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}}var Rx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ox=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ix=function(t,e){return function(i,s){e(i,s,t)}};let Dx=class extends Lx{constructor(t){super(),this.canvasRenderer=t}};Dx=Rx([Ka(),Ix(0,$a(pv)),Ox("design:paramtypes",[Object])],Dx);let Fx=!1;const zx=new Da(((t,e,i,s)=>{Fx||(Fx=!0,t(db).to(Dx).inSingletonScope(),t(Dx).toService(db))}));var jx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 Hx=class{constructor(){this.type="image",this.numberType=Iu}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Hx=jx([Ka()],Hx);let Vx=!1;const Nx=new Da(((t,e,i,s)=>{Vx||(Vx=!0,t(nb).to(Hx).inSingletonScope(),t(Hx).toService(nb))}));var Ux=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wx=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 Yx=class extends ux{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Du}};Yx=Ux([Ka(),Gx(0,$a(av)),Wx("design:paramtypes",[Object])],Yx);let $x=!1;const Xx=new Da(((t,e,i,s)=>{$x||($x=!0,t(rb).to(Yx).inSingletonScope(),t(tb).toService(rb))}));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},qx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zx=function(t,e){return function(i,s){e(i,s,t)}};let Jx=class extends ux{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=zu}};Jx=Kx([Ka(),Zx(0,$a(lv)),qx("design:paramtypes",[Object])],Jx);let Qx=!1;const tS=new Da(((t,e,i,s)=>{Qx||(Qx=!0,t(cb).to(Jx).inSingletonScope(),t(tb).toService(cb))}));var eS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sS=function(t,e){return function(i,s){e(i,s,t)}};let nS=class extends ux{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Fu}};nS=eS([Ka(),sS(0,$a(ov)),iS("design:paramtypes",[Object])],nS);let rS=!1;const aS=new Da(((t,e,i,s)=>{rS||(rS=!0,t(ab).to(nS).inSingletonScope(),t(tb).toService(ab))})),oS=new Ve;class lS{constructor(){this.type="rect",this.numberType=ju}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=t.getGraphicTheme(),{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,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:vh(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;oS.setValue(i.x1,i.y1,i.x2,i.y2),oS.expand(-r/2),h=!oS.containsPoint(e)}}return s.highPerformanceRestore(),h}}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 extends lS{constructor(t){super(),this.canvasRenderer=t}};uS=hS([Ka(),dS(0,$a(hv)),cS("design:paramtypes",[Object])],uS);let pS=!1;const gS=new Da(((t,e,i,s)=>{pS||(pS=!0,t(ob).to(uS).inSingletonScope(),t(tb).toService(ob))}));let fS=!1;const mS=new Da(((t,e,i,s)=>{fS||(fS=!0,t(nb).to(Hx).inSingletonScope(),t(Hx).toService(nb))}));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},_S=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yS=function(t,e){return function(i,s){e(i,s,t)}};let bS=class extends ux{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Vu}};bS=vS([Ka(),yS(0,$a(cv)),_S("design:paramtypes",[Object])],bS);let xS=!1;const SS=new Da(((t,e,i,s)=>{xS||(xS=!0,t(lb).to(bS).inSingletonScope(),t(tb).toService(lb))}));var AS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let kS=class{constructor(){this.type="text",this.numberType=Nu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};kS=AS([Ka()],kS);let MS=!1;const TS=new Da(((t,e,i,s)=>{MS||(MS=!0,t(hb).to(kS).inSingletonScope(),t(tb).toService(hb))})),wS=new Da(((t,e,i,s)=>{i(hx)||t(hx).toSelf().inSingletonScope(),i(Lv)?s(Lv).toService(hx):t(Lv).toService(hx)}));var CS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ES=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let BS=class extends Lb{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 Ue(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(...t){}};BS.env="node",BS=CS([Ka(),ES("design:paramtypes",[Object,Number])],BS);var PS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},LS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let RS=class extends lp{constructor(t){super(t)}init(){this._context=new BS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(...t){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};RS.env="node",RS=PS([Ka(),LS("design:paramtypes",[Object])],RS);const OS=Db(RS,BS);var IS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},DS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},FS=function(t,e){return function(i,s){e(i,s,t)}};let zS=class extends U_{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:Ia.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new RS(i)}createWindowByCanvas(t){var e;const i=t.canvas,s=null!==(e=t.dpr)&&void 0!==e?e:1;let n=t.width,r=t.height;null!=n&&null!=r&&t.canvasControled||(n=i.width/s,r=i.height/s),this.canvas=new RS({width:n,height:r,dpr:s,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}getImageBuffer(t="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){}};zS.env="node",zS=IS([Ka(),FS(0,$a(yo)),DS("design:paramtypes",[Object])],zS);const jS=new Da((t=>{t(zS).toSelf(),t(mc).toDynamicValue((t=>t.container.get(zS))).whenTargetNamed(zS.env)}));var HS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let VS=class extends H_{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 nd.call(t)}}getCancelAnimationFrame(){return t=>{nd.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(...t){}createOffscreenCanvas(t){}};VS=HS([Ka()],VS);const NS=new Da((t=>{NS.isNodeBound||(NS.isNodeBound=!0,t(VS).toSelf().inSingletonScope(),t(_o).toService(VS))}));function US(t,e=!0){US.__loaded||(US.__loaded=!0,t.load(NS),t.load(OS),t.load(jS))}NS.isNodeBound=!1,US.__loaded=!1;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};let GS=class extends Lb{draw(){}createPattern(t,e){return null}};GS.env="wx",GS=WS([Ka()],GS);var YS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$S=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let XS=class extends lp{constructor(t){super(t)}init(){this._context=new GS(this,this._dpr)}release(...t){}};XS.env="wx",XS=YS([Ka(),$S("design:paramtypes",[Object])],XS);const KS=Db(XS,GS);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)},JS=function(t,e){return function(i,s){e(i,s,t)}};class QS{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 tA=class extends U_{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new QS}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:Ia.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new XS(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 XS({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()}};tA.env="wx",tA=qS([Ka(),JS(0,$a(yo)),ZS("design:paramtypes",[Object])],tA);const eA=new Da((t=>{t(tA).toSelf(),t(mc).toDynamicValue((t=>t.container.get(tA))).whenTargetNamed(tA.env)}));var iA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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)},nA=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 rA=class extends H_{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,a){return nA(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let o=0;o{let a=wx.createSelectorQuery();r&&(a=a.in(r)),a.select(`#${l}`).fields({node:!0,size:!0}).exec((r=>{if(!r[0])return;const a=r[0].node,h=r[0].width,c=r[0].height;a.width=h*t,a.height=c*t,i.set(l,a),o>=s&&n.push(a),e(null)}))})))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.component,e.forceUpdate).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 nd.call(t)}}getCancelAnimationFrame(){return t=>{nd.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(...t){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};rA=iA([Ka(),sA("design:paramtypes",[])],rA);const aA=new Da((t=>{aA._isWxBound||(aA._isWxBound=!0,t(rA).toSelf().inSingletonScope(),t(_o).toService(rA))}));function oA(t,e=!0){oA.__loaded||(oA.__loaded=!0,t.load(aA),t.load(KS),t.load(eA),e&&function(t){t.load(dx),t.load(wS),t.load(_x),t.load(kx),t.load(Px),t.load(zx),t.load(Nx),t.load(Xx),t.load(tS),t.load(aS),t.load(gS),t.load(mS),t.load(SS),t.load(TS)}(t))}aA._isWxBound=!1,oA.__loaded=!1;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},hA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cA=function(t,e){return function(i,s){e(i,s,t)}};let dA=class extends ux{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Eu}};dA=lA([Ka(),cA(0,$a(ev)),hA("design:paramtypes",[Object])],dA);let uA=!1;const pA=new Da(((t,e,i,s)=>{uA||(uA=!0,t(ub).to(dA).inSingletonScope(),t(Mb).toService(ub))}));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},fA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mA=function(t,e){return function(i,s){e(i,s,t)}};let vA=class extends lS{constructor(t){super(),this.canvasRenderer=t}};vA=gA([Ka(),mA(0,$a(hv)),fA("design:paramtypes",[Object])],vA);let _A=!1;const yA=new Da(((t,e,i,s)=>{_A||(_A=!0,t(_b).to(vA).inSingletonScope(),t(Mb).toService(_b))}));class bA extends Kf{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=t.getGraphicTheme(),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,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:vh(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&ep.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}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){return function(i,s){e(i,s,t)}};let kA=class extends bA{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Du}};kA=xA([Ka(),AA(0,$a(av)),SA("design:paramtypes",[Object])],kA);let MA=!1;const TA=new Da(((t,e,i,s)=>{MA||(MA=!0,t(mb).to(kA).inSingletonScope(),t(Mb).toService(mb))}));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 BA=class extends ux{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Pu}};BA=wA([Ka(),EA(0,$a(iv)),CA("design:paramtypes",[Object])],BA);let PA=!1;const LA=new Da(((t,e,i,s)=>{PA||(PA=!0,t(pb).to(BA).inSingletonScope(),t(Mb).toService(pb))}));class RA extends Kf{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();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,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&ep.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var OA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},IA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},DA=function(t,e){return function(i,s){e(i,s,t)}};let FA=class extends RA{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Vu}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=t.getGraphicTheme(),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,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:vh(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&ep.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};FA=OA([Ka(),DA(0,$a(cv)),IA("design:paramtypes",[Object])],FA);let zA=!1;const jA=new Da(((t,e,i,s)=>{zA||(zA=!0,t(yb).to(FA).inSingletonScope(),t(Mb).toService(yb))}));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},VA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},NA=function(t,e){return function(i,s){e(i,s,t)}};let UA=class extends ux{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Lu}};UA=HA([Ka(),NA(0,$a(sv)),VA("design:paramtypes",[Object])],UA);let WA=!1;const GA=new Da(((t,e,i,s)=>{WA||(WA=!0,t(gb).to(UA).inSingletonScope(),t(Mb).toService(gb))}));var YA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$A=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},XA=function(t,e){return function(i,s){e(i,s,t)}};let KA=class extends RA{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=Nu}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=t.getGraphicTheme(),{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(),f=l.width(),m=ug(a,u,n),v=dg(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,s.modelMatrix!==u&&ep.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};KA=YA([Ka(),XA(0,$a(dv)),$A("design:paramtypes",[Object])],KA);let qA=!1;const ZA=new Da(((t,e,i,s)=>{qA||(qA=!0,t(bb).to(KA).inSingletonScope(),t(Mb).toService(bb))}));var JA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},QA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tk=function(t,e){return function(i,s){e(i,s,t)}};let ek=class extends bA{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Fu}};ek=JA([Ka(),tk(0,$a(ov)),QA("design:paramtypes",[Object])],ek);let ik=!1;const sk=new Da(((t,e,i,s)=>{ik||(ik=!0,t(vb).to(ek).inSingletonScope(),t(Mb).toService(vb))}));var nk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ak=function(t,e){return function(i,s){e(i,s,t)}};let ok=class extends ux{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=zu}};ok=nk([Ka(),ak(0,$a(lv)),rk("design:paramtypes",[Object])],ok);let lk=!1;const hk=new Da(((t,e,i,s)=>{lk||(lk=!0,t(xb).to(ok).inSingletonScope(),t(Mb).toService(xb))}));var ck=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},uk=function(t,e){return function(i,s){e(i,s,t)}};let pk=class extends Lx{constructor(t){super(),this.canvasRenderer=t}};pk=ck([Ka(),uk(0,$a(pv)),dk("design:paramtypes",[Object])],pk);let gk=!1;const fk=new Da(((t,e,i,s)=>{gk||(gk=!0,t(Ab).to(pk).inSingletonScope(),t(Mb).toService(Ab))}));var mk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_k=function(t,e){return function(i,s){e(i,s,t)}};let yk=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Hu}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};yk=mk([Ka(),_k(0,$a(uv)),vk("design:paramtypes",[Object])],yk);let bk=!1;const xk=new Da(((t,e,i,s)=>{bk||(bk=!0,t(Sb).to(yk).inSingletonScope(),t(Mb).toService(Sb))}));var Sk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ak=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},kk=function(t,e){return function(i,s){e(i,s,t)}};let Mk=class extends ux{constructor(t){super(),this.canvasRenderer=t,this.type="image",this.numberType=Iu}};Mk=Sk([Ka(),kk(0,$a(gv)),Ak("design:paramtypes",[Object])],Mk);let Tk=!1;const wk=new Da(((t,e,i,s)=>{Tk||(Tk=!0,t(fb).to(Mk).inSingletonScope(),t(Mb).toService(fb))})),Ck=O_();function Ek(){Ek.__loaded||(Ek.__loaded=!0,uf.RegisterGraphicCreator("arc",af),bo.load(hy),bo.load(Ck?pA:_x))}Ek.__loaded=!1;const Bk=Ek;function Pk(){Pk.__loaded||(Pk.__loaded=!0,uf.RegisterGraphicCreator("area",sf),bo.load(fy),bo.load(Ck?LA:kx))}Pk.__loaded=!1;const Lk=Pk;function Rk(){Rk.__loaded||(Rk.__loaded=!0,uf.RegisterGraphicCreator("circle",xg),bo.load(yy),bo.load(Ck?GA:Px))}Rk.__loaded=!1;const Ok=Rk;function Ik(){Ik.__loaded||(Ik.__loaded=!0,uf.RegisterGraphicCreator("glyph",Fg),bo.load(Ey),bo.load(Ck?fk:zx))}Ik.__loaded=!1;const Dk=Ik;function Fk(){Fk.__loaded||(Fk.__loaded=!0,uf.RegisterGraphicCreator("group",Lp))}Fk.__loaded=!1;const zk=Fk;function jk(){jk.__loaded||(jk.__loaded=!0,uf.RegisterGraphicCreator("image",Ug),bo.load(Dy),bo.load(Ck?wk:Nx))}jk.__loaded=!1;const Hk=jk;function Vk(){Vk.__loaded||(Vk.__loaded=!0,uf.RegisterGraphicCreator("line",Pg),bo.load(py),bo.load(Ck?TA:Xx))}Vk.__loaded=!1;const Nk=Vk;function Uk(){Uk.__loaded||(Uk.__loaded=!0,uf.RegisterGraphicCreator("path",Qg),bo.load(Ay),bo.load(Ck?sk:aS))}Uk.__loaded=!1;const Wk=Uk;function Gk(){Gk.__loaded||(Gk.__loaded=!0,uf.RegisterGraphicCreator("polygon",hf),bo.load(My),bo.load(Ck?hk:tS))}Gk.__loaded=!1;const Yk=Gk;function $k(){$k.__loaded||($k.__loaded=!0,uf.RegisterGraphicCreator("rect",Ig),bo.load(dy),bo.load(Ck?yA:gS))}$k.__loaded=!1;const Xk=$k;function Kk(){Kk.__loaded||(Kk.__loaded=!0,uf.RegisterGraphicCreator("richtext",qg),bo.load(Oy),bo.load(Ck?xk:mS))}Kk.__loaded=!1;const qk=Kk;function Zk(){Zk.__loaded||(Zk.__loaded=!0,uf.RegisterGraphicCreator("shadowRoot",df))}Zk.__loaded=!1;const Jk=Zk;function Qk(){Qk.__loaded||(Qk.__loaded=!0,uf.RegisterGraphicCreator("symbol",Cg),bo.load(vy),bo.load(Ck?jA:SS))}Qk.__loaded=!1;const tM=Qk;function eM(){eM.__loaded||(eM.__loaded=!0,uf.RegisterGraphicCreator("text",Mg),bo.load(xy),bo.load(Ck?ZA:TS))}eM.__loaded=!1;const iM=eM;function sM(){zk(),Xk()}const nM=-.5*Math.PI,rM=1.5*Math.PI,aM="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 oM;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(oM||(oM={}));const lM={[oM.selectedReverse]:{},[oM.selected]:{},[oM.hover]:{},[oM.hoverReverse]:{}},hM={container:"",width:30,height:30,style:{}},cM="scrollDrag";function dM(){return"browser"===A_.env?["pointerup","pointerleave","pointercancel"]:["pointerup","pointerleave","pointerupoutside"]}const uM={debounce:xt,throttle:St};sM();let pM=class t extends Qy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="scrollbar",this._handleTouchMove=t=>{p(this._prePos)&&t.preventDefault()},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=>{this._clearDragEvents();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});const r=dM(),a="browser"===A_.env?A_:this.stage;a.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),r.forEach((t=>{a.addEventListener(t,this._onSliderPointerUp)}))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r=0,a=0;const{width:o,height:l}=this.getSliderRenderBounds(),h="vertical"===e?l:o,c=Math.max(h-this._sliderSize,0),{range:d}=this.attribute,u=vt(d[1]-d[0],0,1);return"vertical"===e?(n=s,a=n-this._prePos):(n=i,a=n-this._prePos),r=c>0&&u<1?a/c*(1-u):0,[n,r]},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:uM[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{const{range:e,limitRange:i=[0,1]}=this.attribute,s=this.getScrollRange(),[n,r]=this._computeScrollValue(t),a=[s[0]+r,s[1]+r];this._prePos=null,this._dispatchEvent("scrollUp",{pre:e,value:_t(a,i[0],i[1])}),this._clearDragEvents()}}setScrollRange(t,e=!0){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(cM,{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",uM[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown),("browser"===A_.env?A_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}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:ri(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,[s,n,r,a]=ri(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,minSliderSize:i=0}=this.attribute,{width:s,height:n,x1:r,y1:a}=this.getSliderRenderBounds(),o="horizontal"===e?s:n,l="horizontal"===e?r:a,h=vt(t[0],0,1),c=vt(t[1],0,1),d=vt(c-h,0,1),u=Math.max(d*o,i),p=Math.max(o-u,0),g=l+h/Math.max(1-d,1e-12)*p;return[g,g+u]}_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)}_clearDragEvents(){const t=dM(),e="browser"===A_.env?A_:this.stage;e.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onSliderPointerUp)}))}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}release(t){super.release(t),("browser"===A_.env?A_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearDragEvents()}};pM.defaultAttributes={direction:"horizontal",round:!0,sliderSize:20,minSliderSize:0,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};var gM,fM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 mM=gM=class{constructor(){this.name="scrollbar",this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.key=this.name+this._uid,this.scroll=t=>{var e,i;const s=t.target,n=this.getScrollContainer(s);if(!n&&!this.scrollContainer)return;if(!n&&this.scrollContainer){if(!this.scrollContainer.g.stage||this.scrollContainer.g.stage!==s.stage)return;const t=this.formatScrollContainer(this.scrollContainer.g);if(!t)return void this.clearScrollbar(this.scrollContainer.g,"all");this.scrollContainer.showH&&!t.showH&&this.clearScrollbar(this.scrollContainer.g,"horizontal"),this.scrollContainer.showV&&!t.showV&&this.clearScrollbar(this.scrollContainer.g,"vertical"),this.scrollContainer=t}else n&&this.scrollContainer&&n.g!==this.scrollContainer.g&&this.clearScrollbar(this.scrollContainer.g,"all");if(this.scrollContainer=null!=n?n:this.scrollContainer,!n)return;const r=n.g;if(!r)return;const{width:a,height:o,scrollX:l=0,scrollY:h=0}=r.attribute;let c=l,d=h,{showH:u,showV:p}=n;this.scrollContainerBounds=(new He).set(0,0,r.attribute.width,r.attribute.height),u&&u&&(Nt(t.deltaX)>Nt(t.deltaY)?(u=u&&!0,p=p&&!1):(u=u&&!1,p=p&&!0));const g=this.childrenBounds.width(),f=this.childrenBounds.height();u&&(c=l-(null!==(e=t.deltaX)&&void 0!==e?e:0),c>0?c=0:c0?d=0:d{if(!(this.scrollContainer&&this.scrollContainerBounds&&this.childrenBounds&&t&&t.target&&t.detail&&t.detail.value))return;const e=t.target,i=t.detail.value;if("horizontal"===e.attribute.direction){const t=this.childrenBounds.width();this.scrollContainer.g.setAttributes({scrollX:-i[0]*t})}else{const t=this.childrenBounds.height();this.scrollContainer.g.setAttributes({scrollY:-i[0]*t})}}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;this.childrenBounds=new Ve,e.addEventListener("wheel",this.scroll),this.params=gM.defaultParams}initEventOfScrollbar(t,e,i){t.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointermove",(()=>{e.setAttribute("visibleAll",!0)})),t.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!1)})),e.addEventListener("pointerover",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("pointerout",(()=>{e.setAttribute("visibleAll",!0)})),e.addEventListener("scrollUp",this.handleScrollBarChange),e.addEventListener(cM,this.handleScrollBarChange)}addOrUpdateScroll(t,e,i,s){if(t){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!0);e||this.initEventOfScrollbar(s,t,!0)}else this.clearScrollbar(s,"horizontal");if(e){const{scrollBar:t,isUpdate:e}=this.addOrUpdateHScroll(s,i,!1);e||this.initEventOfScrollbar(s,t,!1)}else this.clearScrollbar(s,"vertical")}getDirection(t){return t?"horizontal":"vertical"}addOrUpdateHScroll(t,e,i){var s,n;const r=this.getDirection(i),a=`${null!==(s=t.name)&&void 0!==s?s:t._uid}_${this.getDirection(i)}_${this.name}`,o=e.children.filter((t=>t.name===a));let l=!0,h=o[0];const{y:c=0,dy:d=0,x:u=0,dx:p=0,height:g,width:f,zIndex:m=0}=this.scrollContainer.g.attribute,v={x:0,y:0,direction:r,zIndex:m+1,visibleAll:!0,padding:[2,0],railStyle:{fill:"rgba(0, 0, 0, .1)"},range:[0,.05]};i?(v.width=this.scrollContainerBounds.width(),v.height=12):(v.height=this.scrollContainerBounds.height(),v.width=12),h?o.length>1&&o.forEach(((t,e)=>{var i;e&&(null===(i=t.parent)||void 0===i||i.removeChild(t))})):(l=!1,h=new pM(v),h.name=a,e.add(h),h.isScrollBar=!0);const _=this.childrenBounds,{scrollX:y,scrollY:b}=t.attribute;if(i){const t=Math.min(this.scrollContainerBounds.width()/_.width(),1),e=Math.max(Math.min(y/this.childrenBounds.width(),0),t-1);v.x=u+p,v.y=c+d+g-(null!==(n=v.height)&&void 0!==n?n:0),v.range=[-e,-e+t]}else{const t=Math.min(this.scrollContainerBounds.height()/_.height(),1),e=Math.max(Math.min(b/this.childrenBounds.height(),0),t-1);v.x=u+p+f-this.scrollContainerBounds.width(),v.y=c+d,v.range=[-e,-e+t]}return h.setAttributes(v),{scrollBar:h,isUpdate:l}}clearScrollbar(t,e){t.parent&&t.parent.children.filter((t=>t.isScrollBar&&("all"===e||t.attribute.direction===e))).forEach((t=>{t.parent.removeChild(t)}))}formatScrollContainer(t){if(!t||"group"!==t.type||!t.attribute)return null;const{overflow:e,width:i,height:s}=t.attribute;if(!e||"hidden"===e)return null;let n=!1,r=!1;"scroll"===e?(n=!0,r=!0):(n="scroll-x"===e,r=!n);const a=this.childrenBounds;return a.clear(),t.forEachChildren((t=>{a.union(t.AABBBounds)})),t.AABBBounds.empty()||(n&&(n=i{i(mM)||(t(mM).toSelf(),t(Uv).toService(mM))}));function _M(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&_M(t,e)}))}const yM=t=>!u(t)&&!1!==t.visible;function bM(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function xM(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 AM=["#ffffff","#000000"];function kM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ei(t).toHex(),o=new ei(e).toHex();return MM(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(...AM);for(const n of a)if(t!==n&&MM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function MM(t,e,i,s,n){if("lightness"===n){const i=ei.getColorBrightness(new ei(e));return ei.getColorBrightness(new ei(t))<.5?i>=.5:i<.5}return s?TM(t,e)>s:"largeText"===i?TM(t,e)>3:TM(t,e)>4.5}function TM(t,e){const i=wM(t),s=wM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function wM(t){const e=si(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 CM(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 EM(t,e){return[t[0]*e,t[1]*e]}function BM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function PM(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=Jt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const LM=(t,e,i,s)=>new De(Object.assign({defaultFontParams:Object.assign({fontFamily:aM,fontSize:14},s),getTextBounds:i?void 0:ff,specialCharSet:"-/: .,@%'\"~"+De.ALPHABET_CHAR_SET+De.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function RM(t,e,i={}){if(!t)return{width:0,height:0};const s=ff({text:t,fontFamily:e.fontFamily||i.fontFamily||aM,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 OM(t,e="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 IM(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function DM(t,e="type"){const i=OM(t,e);return"rich"===i?uf.richtext(IM(t)):("html"===i?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"===i&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),uf.text(t))}function FM(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 zM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function jM(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 HM(t,e){const{dx:i,dy:s}=jM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function VM(){zk(),Xk(),tM(),qk(),iM()}var NM=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&&(T=h,R.setAttribute("maxLineWidth",h-b[1]-b[2]))),k=0,M=0;let H=0;"left"===z||"start"===z?H=1:"right"===z||"end"===z?H=-1:"center"===z&&(H=0),H?H<0?(k-=T,A&&A.setAttribute("x",(A.attribute.x||0)-O),x.setAttribute("x",-b[1]-E)):H>0&&x.setAttribute("x",b[3]):(k-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-O/2),x.setAttribute("x",-E/2));const V="right"===y||"end"===y,N="left"===y||"start"===y,U=(t,e)=>{"richtext"===R.type?R.setAttributes({x:t,textAlign:e,textConfig:Y(R.attribute.textConfig).map((t=>Object.assign(Object.assign({},t),{textAlign:e})))}):R.setAttributes({x:t,textAlign:e})};if((y?"center"===y:_)&&H){const t=T-b[1]-b[3],e=O+E,i=1===H?(t-e)/2+E+O/2:b[0]+E-(T/2+e/2-E)+O/2;if(U(i,"center"),A){const t=i-O/2-E+F/2;A.setAttributes({x:t})}}if(N&&1!==H){const t=T-b[1]-b[3],e=0===H?-t/2+E/2:-T+b[3]+b[1]+E;if(U(e+E,"left"),A){const t=e+F/2;A.setAttributes({x:t})}}if(V&&-1!==H){const t=T-b[1]-b[3],e=0===H?t/2+E/2:t;if(U(e,"right"),A){const t=e-O-E+F/2;A.setAttributes({x:t})}}"middle"===j?(M-=w/2,A&&A.setAttribute("y",0)):"bottom"===j?(M-=w,A&&A.setAttribute("y",-I/2),x.setAttribute("y",-b[2])):"top"===j&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",I/2)),P(null==m?void 0:m.text)||(R.states=m.text);const{visible:W}=a,G=NM(a,["visible"]);if(f&&c(W)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},G),{visible:W&&!!s,width:T,height:w,x:k,y:M}),"rect");if(P(null==m?void 0:m.panel)||(t.states=m.panel),G.customShape){const e=G.customShape;t.pathProxy=t=>e(this,t,new Ul)}this._bgRect=t}this._textShape=R,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:j({},UM.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}UM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const WM={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}},GM={poptip:j({},WM)};var YM=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);nA?q=A:qlt&&(lt=n,ot=t)}}if(["top","bottom","left","right"].includes(e)){const t="top"===e||"bottom"===e,n="left"===e||"right"===e;let r=!1;if(t?r="top"===e&&i.y1<0||"bottom"===e&&i.y2>s.y2:n&&(r="left"===e&&i.x1<0||"right"===e&&i.x2>s.x2),!r){let e=0;const r=(y(et)?et[1]:et)/2;t?(i.x1<0?e=-i.x1:i.x2>s.x2&&(e=s.x2-i.x2),I.setAttribute("x",I.attribute.x+e),o.setAttribute("dx",Yt(Gt(o.attribute.dx-e,r),i.width()-r))):n&&(i.y1<0?e=-i.y1:i.y2>s.y2&&(e=s.y2-i.y2),I.setAttribute("y",I.attribute.y+e),o.setAttribute("dy",Yt(Gt(o.attribute.dy-e,r),i.height()-r)));break}}if(!rt)break}}}calculateAnchorPoint(t,e){if(!e)return{x:0,y:0};const{x:i,y:s}=this.attribute,{x1:n,y1:r,x2:a,y2:o}=e,l=a-n,h=o-r;switch(t){case"top":case"tl":case"tr":return{x:n+l/2-i,y:r-s};case"bottom":case"bl":case"br":return{x:n+l/2-i,y:o-s};case"left":case"lt":case"lb":return{x:n-i,y:r+h/2-s};case"right":case"rt":case"rb":return{x:a-i,y:r+h/2-s};default:return{x:0,y:0}}}getAngleAndOffset(t,e,i,s,n){const r="arrow2Left"===n?s[1]/2:s[1];switch(t){case"tl":return{angle:"arrow2Left"===n?zt/2*3:0,offset:"arrow2Left"===n?[e/4,i+r]:[0,i+r]};case"top":return{angle:zt/2*3,offset:[e/2,i+r]};case"tr":return{angle:"arrow2Left"===n?zt/2*3:0,offset:"arrow2Left"===n?[e/4*3,i+r]:[e,i+r]};case"rt":return{angle:0,offset:"arrow2Left"===n?[-r,i/5]:[-r,0]};case"right":return{angle:0,offset:[-r,i/2]};case"rb":return{angle:0,offset:"arrow2Left"===n?[-r,i/5*4]:[-r,i]};case"bl":return{angle:"arrow2Left"===n?zt/2:0,offset:"arrow2Left"===n?[e/4,-r]:[0,-r]};case"bottom":return{angle:zt/2,offset:[e/2,-r]};case"br":return{angle:"arrow2Left"===n?zt/2:0,offset:"arrow2Left"===n?[e/4*3,-r]:[e,-r]};case"lt":return{angle:"arrow2Left"===n?zt:0,offset:"arrow2Left"===n?[e+r,i/5]:[e+r,0]};case"left":return{angle:zt,offset:[e+r,i/2]};case"lb":return{angle:"arrow2Left"===n?zt:0,offset:"arrow2Left"===n?[e+r,i/5*4]:[e+r,i]}}}}QM.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"},panel:{},maxWidthPercent:.8,space:8,padding:10};var tT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 eT=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};j(s,QM.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new QM(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};j(e,GM.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,poptipAnchor:"bounds"},n),{x:r.e,y:r.f,positionBounds:t.globalAABBBounds})),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}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}};eT=tT([Ka()],eT);var iT=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(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 sT{constructor(){this.activeEvent="onRegister",this._uid=Ia.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(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)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}let nT=class extends sT{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};nT=iT([Ka()],nT);let rT=class extends sT{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}};rT=iT([Ka()],rT);const aT=new Da(((t,e,i,s)=>{i(eT)||(t(eT).toSelf().inSingletonScope(),t(cg).toService(eT)),i(nT)||(t(nT).toSelf(),t(Uv).toService(nT)),i(rT)||(t(rT).toSelf(),t(Uv).toService(rT))}));class oT extends Qy{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}zk(),Nk();class lT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},lT.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})}}lT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},zk(),Xk();class hT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},hT.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})}}hT.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},zk(),Bk();class cT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},cT.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=re.distancePP(t,e);this.setAttribute("radius",i)}}cT.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},zk(),Bk();class dT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},dT.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=nM,endAngle:s=rM}=this.attribute,n=s-i,r=oe(de(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}dT.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},zk(),Wk();class uT extends oT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},uT.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=he(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=re.distancePP(t,e);this.setAttribute("radius",i)}}function pT(){zk(),Nk(),Yk(),tM()}function gT(){zk(),Nk(),Bk(),tM()}uT.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},pT();class fT extends Qy{getStartAngle(){return ue(this._startAngle)}getEndAngle(){return ue(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},fT.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=uf.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),P(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=uf.line;Y(i)[0].cornerRadius&&(t=uf.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"),P(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:f=12}=t;let m,v;"start"===i?(m={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)):(m={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=uf.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),P(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?P(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):P(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}}fT.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}}},gT();class mT extends fT{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},fT.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=uf.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"),P(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}var vT,_T;!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.labelHoverOnAxis="axis-label-hover-on-axis",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",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(vT||(vT={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(_T||(_T={}));const yT={[_T.selectedReverse]:{},[_T.selected]:{},[_T.hover]:{},[_T.hoverReverse]:{}},bT={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}},labelHoverOnAxis:{visible:!1,space:7,padding:2,position:0,autoRotate:!1,textStyle:{fontSize:12,fill:"red",fontWeight:"normal",fillOpacity:1},background:{visible:!0,style:{cornerRadius:2,fill:"black"}}},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}}},xT={size:8,stroke:"#000",lineWidth:1,zIndex:1};const ST=Math.sin(Math.PI/10);function AT(t,e=ST){const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function kT(t,e=ST){const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function MT(t){const e={};return _M(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function TT(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function wT(t,e,i,s=!1,n=!1){const r=[e.x-i.x,e.y-i.y];return EM(r,(s?-1:1)*(n?-1:1)*t/BM(r))}function CT(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function BT(t,e,i){var s;if(kT(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON))return i>Fe(t.AABBBounds,e.AABBBounds);const n=t.OBBBounds,r=e.OBBBounds;return!n||!r||n.empty()||r.empty()?i>Fe(t.AABBBounds,e.AABBBounds):n.intersects(r)||i>ze(n,r)}function PT(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!P(s.states)?(s.addState(oM.hover,!0),_M(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(oM.hoverReverse,!0)})),s):i},RT=(t,e,i)=>i?(_M(e,(t=>{t.name&&!P(t.states)&&(t.removeState(oM.hoverReverse),t.removeState(oM.hover))})),null):i,OT=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(oM.selected)?(_M(e,(t=>{t.name&&!P(t.states)&&(t.removeState(oM.selectedReverse),t.removeState(oM.selected))})),null):s.name&&!P(s.states)?(s.addState(oM.selected,!0),_M(e,(t=>{t!==s&&t.name&&!P(t.states)&&t.addState(oM.selectedReverse,!0)})),s):i};class IT extends Qy{_prepareAnimate(t){if(!1!==this.attribute.animation){const{animation:e,animationEnter:i,animationExit:s,animationUpdate:n}=this.attribute,r=g(e)?e:{};this._animationConfig={enter:!1!==i&&j({},t,r,null!=i?i:{}),exit:!1!==s&&j({},t,r,null!=s?s:{}),update:!1!==n&&(y(n)?n:j({},t,r,null!=n?n:{}))}}else this._animationConfig={enter:!1,exit:!1,update:!1}}}const DT={type:"default",duration:300,easing:"linear"};class FT extends IT{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=LT(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=RT(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=OT(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=I(this.attribute);e.scale=this.attribute.scale,this.attribute=t;const i=uf.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._prepare(),this._prevInnerView=this._innerView&&MT(this._innerView),this.removeAllChild(!0),this._innerView=uf.group({x:0,y:0,pickable:!1}),this.add(this._innerView),this._renderInner(this._innerView),this._bindEvent(),this.runAnimation()}_prepare(){this._prepareAnimate(DT)}_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=uf.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=vT.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=uf.group({x:0,y:0,pickable:!1});t.name=vT.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",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=uf.group({x:0,y:0,pickable:!1});i.name=vT.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=uf.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=vT.tick,r.id=this._getNodeId(t.id),P(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=lM;else{const t=this.data[s],e=j({},lM,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=uf.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=vT.subTick,r.id=this._getNodeId(`${n}`),P(s.state))r.states=lM;else{const i=j({},lM,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=uf.group({x:0,y:0,pickable:!1});return r.name=`${vT.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=DM(this._getLabelAttribute(t,e,n,i));if(a.name=vT.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),P(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=lM;else{const s=j({},lM,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}a.data=Object.assign(Object.assign({},t),{index:e,layer:i}),r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new UM(Object.assign({},e));i.name=vT.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return TT(t,this.getVerticalVector(e,i,t))}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;Nt(s[0])>Nt(s[1])?o=zt/2*(l.x>e.x?1:-1):h=zt/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+L(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+L(this.attribute,"label.space",4))*s);const f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:_}=this.attribute.label;_=d(_)?j({},bT.label.style,_(t,e,i,s)):_;_=j(this.getLabelAlign(m,o,_.angle),_),d(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s}));let y=_.react;return d(y)&&(y=y(t,e,i,s)),Object.assign(Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,_)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==_?void 0:_.fontSize,type:h}),_),{react:y})}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}runAnimation(){const t=this.lastScale;if(this.attribute.scale){const t=this.attribute.scale;this.lastScale=t.clone(),this.lastScale.range([0,1])}if(this.attribute.animation&&this.applyAnimationState){const e=this.getInnerView(),i=this.getPrevInnerView();if(!i)return;const s=this._animationConfig;this._newElementAttrMap={},_M(e,(e=>{var n;if("group"!==e.type&&e.id){const r=i[e.id];if(e.setFinalAttributes(e.attribute),r){r.release();const i=r.attribute,a=e.getFinalAttribute(),o=function(t,e,i){const s={};for(const i in e)i in t&&U(t[i],e[i])||(s[i]=e[i]);if(i)for(const n in t)if(!(n in e)){const t=i(n);void 0!==t&&(s[n]=t)}return s}(i,a);let l=Object.keys(o).length>0;if("opacity"in i&&a.opacity!==i.opacity&&(o.opacity=null!==(n=a.opacity)&&void 0!==n?n:1,l=!0),s.update&&l){this._newElementAttrMap[e.id]={state:"update",node:e,attrs:e.attribute};const i=r.attribute;e.setAttributes(i),e.applyAnimationState(["update"],[{name:"update",animation:Object.assign(Object.assign({selfOnly:!0},s.update),{type:"axisUpdate",customParameters:{config:s.update,diffAttrs:o,lastScale:t}})}])}}else s.enter&&(this._newElementAttrMap[e.id]={state:"enter",node:e,attrs:e.attribute},e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s.enter),{type:"axisEnter",selfOnly:!0,customParameters:{config:s.enter,lastScale:t,getTickCoord:this.getTickCoord.bind(this)}})}]))}}))}}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const zT={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&&BT(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function jT(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function HT(t,e,i,s,n=!1){if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=d(n)?n:zT[n]||zT.parity;if(s.length>=3&&PT(s,r)){do{s=a(s,r)}while(s.length>=3&&PT(s,r));const t=(t,e,i=!0)=>i&&t<3||e,n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=$(i);BT(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),HT(l,s,n,(t=>BT(t,l,r))),HT(h,s,o,(t=>BT(t,h,r)||!(!n||t===l)&&BT(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function NT(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},GT(t,e.attribute.angle)),{angle:WT(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({},YT(t,e.attribute.angle)),{angle:WT(e.attribute.angle)}))}))}(t,e),function(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=Me({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function WT(t=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 GT(t,e=0){let 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=WT(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 YT(t,e=0){let i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=WT(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 $T(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(P(t)||!k(i))return;const o=function(t){return k(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!u(h),d=c?Math.cos(h):1,p=c?Math.sin(h):0,f=kT(h),m=AT(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===_||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/d,l=Math.abs(i/p);if(y&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(d);r=Math.min(t,l)}else if(y&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(d);r=Math.min(t,l)}else r=l}else r=Math.abs(i/d);k(t.attribute.maxLineWidth)&&(r=k(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function XT(t,e,i){let s;return k(e)&&(s=Math.abs(e-t)),k(i)&&(s=k(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class KT{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,e=!1,i){const{verticalFactor:s=1}=this.attribute,n=function(t){let e=BM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return EM([n[1],-1*n[0]],t*(e?1:-1)*s)}}class qT{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-qT.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*qT.bounceIn(2*t):.5*qT.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Vt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Vt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Vt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Vt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Vt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Vt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Vt/e)*.5+1}}static registerFunc(t,e){qT[t]=e}}function ZT(t,e){const i=1/e;let s=1;for(;t>i;)t-=i,s*=-1;const n=s*t/i;return n>0?n:1+n}qT.quadIn=qT.getPowIn(2),qT.quadOut=qT.getPowOut(2),qT.quadInOut=qT.getPowInOut(2),qT.cubicIn=qT.getPowIn(3),qT.cubicOut=qT.getPowOut(3),qT.cubicInOut=qT.getPowInOut(3),qT.quartIn=qT.getPowIn(4),qT.quartOut=qT.getPowOut(4),qT.quartInOut=qT.getPowInOut(4),qT.quintIn=qT.getPowIn(5),qT.quintOut=qT.getPowOut(5),qT.quintInOut=qT.getPowInOut(5),qT.backIn=qT.getBackIn(1.7),qT.backOut=qT.getBackOut(1.7),qT.backInOut=qT.getBackInOut(1.7),qT.elasticIn=qT.getElasticIn(1,.3),qT.elasticOut=qT.getElasticOut(1,.3),qT.elasticInOut=qT.getElasticInOut(1,.3*1.5),qT.easeInOutQuad=t=>(t/=.5)<1?.5*Math.pow(t,2):-.5*((t-=2)*t-2),qT.easeOutElastic=t=>{const e=2*Math.PI/3;return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*e)+1},qT.easeInOutElastic=t=>{const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*e)/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*e)/2+1};for(let t=0;t<10;t++)qT[`flicker${t}`]=e=>ZT(e,t);for(let t=2;t<10;t++)qT[`aIn${t}`]=e=>t*e*e+(1-t)*e;function JT(t,e,i){return t+(e-t)*i}const QT=new class{constructor(){this.opacity=(t,e,i,s,n,r)=>{r.attribute.opacity=JT(e,i,s)},this.baseOpacity=(t,e,i,s,n,r)=>{r.attribute.baseOpacity=JT(e,i,s)},this.fillOpacity=(t,e,i,s,n,r)=>{r.attribute.fillOpacity=JT(e,i,s)},this.strokeOpacity=(t,e,i,s,n,r)=>{r.attribute.strokeOpacity=JT(e,i,s)},this.zIndex=(t,e,i,s,n,r)=>{r.attribute.zIndex=JT(e,i,s)},this.backgroundOpacity=(t,e,i,s,n,r)=>{r.attribute.backgroundOpacity=JT(e,i,s)},this.shadowOffsetX=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetX=JT(e,i,s)},this.shadowOffsetY=(t,e,i,s,n,r)=>{r.attribute.shadowOffsetY=JT(e,i,s)},this.shadowBlur=(t,e,i,s,n,r)=>{r.attribute.shadowBlur=JT(e,i,s)},this.fill=(t,e,i,s,n,r)=>{r.attribute.fill=up(e,i,s,!1)},this.fillPure=(t,e,i,s,n,r)=>{r.attribute.fill=n.fromParsedProps.fill?gp(n.fromParsedProps.fill,n.toParsedProps.fill,s):n.toParsedProps.fill},this.stroke=(t,e,i,s,n,r)=>{r.attribute.stroke=up(e,i,s,!1)},this.strokePure=(t,e,i,s,n,r)=>{r.attribute.stroke=n.fromParsedProps.stroke?gp(n.fromParsedProps.stroke,n.toParsedProps.stroke,s):n.toParsedProps.stroke},this.width=(t,e,i,s,n,r)=>{r.attribute.width=JT(e,i,s),r.addUpdateBoundTag()},this.height=(t,e,i,s,n,r)=>{r.attribute.height=JT(e,i,s),r.addUpdateBoundTag()},this.x=(t,e,i,s,n,r)=>{r.attribute.x=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.y=(t,e,i,s,n,r)=>{r.attribute.y=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dx=(t,e,i,s,n,r)=>{r.attribute.dx=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.dy=(t,e,i,s,n,r)=>{r.attribute.dy=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.angle=(t,e,i,s,n,r)=>{r.attribute.angle=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleX=(t,e,i,s,n,r)=>{r.attribute.scaleX=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.scaleY=(t,e,i,s,n,r)=>{r.attribute.scaleY=JT(e,i,s),r.addUpdateBoundTag(),r.addUpdatePositionTag()},this.lineWidth=(t,e,i,s,n,r)=>{r.attribute.lineWidth=JT(e,i,s),r.addUpdateBoundTag()},this.startAngle=(t,e,i,s,n,r)=>{r.attribute.startAngle=JT(e,i,s),r.addUpdateBoundTag()},this.endAngle=(t,e,i,s,n,r)=>{r.attribute.endAngle=JT(e,i,s),r.addUpdateBoundTag()},this.radius=(t,e,i,s,n,r)=>{r.attribute.radius=JT(e,i,s),r.addUpdateBoundTag()},this.outerRadius=(t,e,i,s,n,r)=>{r.attribute.outerRadius=JT(e,i,s),r.addUpdateBoundTag()},this.innerRadius=(t,e,i,s,n,r)=>{r.attribute.innerRadius=JT(e,i,s),r.addUpdateBoundTag()},this.size=(t,e,i,s,n,r)=>{r.attribute.size=JT(e,i,s),r.addUpdateBoundTag()},this.points=(t,e,i,s,n,r)=>{r.attribute.points=ed(e,i,s),r.addUpdateBoundTag()}}};function tw(t,e,i,s,n,r){if(Number.isFinite(i)&&Number.isFinite(e))return r.attribute[t]=e+(i-e)*s,!0;if(Array.isArray(i)&&Array.isArray(e)&&i.length===e.length){const n=[];let a=!0;for(let t=0;t{this.target.setAttributes(this.target.attribute)},this.type=t,this.props=e,this.duration=i,this.easing=s?"function"==typeof s?s:null!==(n=qT[s])&&void 0!==n?n:qT.linear:qT.linear,"wait"===t&&(this.onUpdate=ew),this.id=Ia.GenAutoIncrementId(),this.syncAttributeUpdate=ew}bind(t,e){this.target=t,this.animate=e,this.onBind(),this.syncAttributeUpdate()}append(t){this.next=t,t.prev=this,t.setStartTime(this.getStartTime()+this.duration,!1)}updateDownstreamStartTimes(){let t=this.next,e=this._startTime+this.duration;for(;t;)t.setStartTime(e,!1),e+=t.duration,t=t.next;this.animate.updateDuration()}getLastProps(){return this.prev?this.prev.props||{}:this.animate.getStartProps()}setDuration(t,e=!0){this.duration=t,e&&this.updateDownstreamStartTimes()}getDuration(){return this.duration}determineInterpolateUpdateFunction(){if(!this.props)return;const t=[];this.propKeys.forEach((e=>{if("fill"===e||"stroke"===e){const i=this.fromProps[e],s=this.props[e];if(_(i)&&_(s)){const n=cp.Get(i,hp.Color255),r=cp.Get(s,hp.Color255);this.fromParsedProps||(this.fromParsedProps={}),this.toParsedProps||(this.toParsedProps={}),this.fromParsedProps[e]=n,this.toParsedProps[e]=r,t.push(QT["fill"===e?"fillPure":"strokePure"])}else QT[e]?t.push(QT[e]):t.push(tw)}else QT[e]?t.push(QT[e]):t.push(tw)})),this.interpolateUpdateFunctions=t}setStartTime(t,e=!0){this._startTime=t,e&&this.updateDownstreamStartTimes()}getStartTime(){return this._startTime}onBind(){"glyph"===this.target.type&&(this.syncAttributeUpdate=this._syncAttributeUpdate)}onFirstRun(){}onStart(){if(!this._hasFirstRun){this._hasFirstRun=!0,this.fromProps=this.getLastProps();const t=this.animate.getStartProps();this.propKeys&&this.propKeys.forEach((e=>{var i;this.fromProps[e]=null!==(i=this.fromProps[e])&&void 0!==i?i:t[e]})),this.determineInterpolateUpdateFunction(),this.tryPreventConflict(),this.trySyncStartProps(),this.onFirstRun()}}tryPreventConflict(){const t=this.animate;this.target.animates.forEach((e=>{if(e===t||e.priority>t.priority||e.priority===1/0)return;const i=e.getStartProps();this.propKeys.forEach((t=>{null!=i[t]&&e.preventAttr(t)}))}))}deleteSelfAttr(t){var e;delete this.props[t],this.fromProps&&delete this.fromProps[t];const i=this.propKeys.indexOf(t);-1!==i&&(this.propKeys.splice(i,1),null===(e=this.interpolateUpdateFunctions)||void 0===e||e.splice(i,1))}trySyncStartProps(){this.propKeys.forEach((t=>{this.fromProps[t]=this.animate.target.getComputedAttribute(t)}))}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.animate.interpolateUpdateFunction?this.animate.interpolateUpdateFunction(this.fromProps,this.props,s,this,this.target):this.interpolateUpdateFunctions.forEach(((t,e)=>{if(!this.animate.validAttr(this.propKeys[e]))return;const i=this.propKeys[e];t(i,this.fromProps[i],this.props[i],s,this,this.target)})),this.onUpdate(t,s,i),this.syncAttributeUpdate()}onUpdate(t,e,i){}onEnd(t){this.target.setAttributes(this.props),t?this._endCb=t:this._endCb&&this._endCb(this.animate,this)}getEndProps(){return this.props}getFromProps(){return this.fromProps}getMergedEndProps(){return this.getEndProps()}stop(){}release(){}}class sw extends iw{constructor(t,e,i,s){super(t,e,i,s)}onStart(){super.onStart();const t=this.getFromProps();this.target.setAttributes(t)}update(t,e,i){this.onStart()}determineInterpolateUpdateFunction(){}}class nw extends l{get animateCount(){return this._animateCount}constructor(){super(),this.head=null,this.tail=null,this.animateMap=new Map,this._animateCount=0,this._playSpeed=1,this._totalDuration=0,this._startTime=0,this._currentTime=0,this._animationEndFlag=!0,this.id=Ia.GenAutoIncrementId(),this.paused=!1}isRunning(){return!this.paused&&this._animateCount>0}forEachAccessAnimate(t){let e=this.head,i=0;for(;e;){const s=e.next;t(e.animate,i),i++,e=s}}addAnimate(t){const e={animate:t,next:null,prev:null};this.head?this.tail&&(this.tail.next=e,e.prev=this.tail,this.tail=e):(this.head=e,this.tail=e),this.animateMap.set(t,e),this._animateCount++,this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;this._animationEndFlag&&(this._animationEndFlag=!1,this.emit("animationStart"));const e=t*this._playSpeed;this._currentTime+=e,this.forEachAccessAnimate(((t,i)=>{t.status===Oo.END?this.removeAnimate(t,!0):t.status!==Oo.RUNNING&&t.status!==Oo.INITIAL||t.advance(e)})),0===this._animateCount&&(this._animationEndFlag=!0,this.emit("animationEnd"))}clear(){this.forEachAccessAnimate((t=>{t.release()})),this.head=null,this.tail=null,this.animateMap.clear(),this._animateCount=0,this._totalDuration=0}removeAnimate(t,e=!0){const i=this.animateMap.get(t);i&&(e&&(t._onRemove&&t._onRemove.forEach((t=>t())),t.release()),i.prev?i.prev.next=i.next:this.head=i.next,i.next?i.next.prev=i.prev:this.tail=i.prev,this.animateMap.delete(t),this._animateCount--,t.getStartTime()+t.getDuration()>=this._totalDuration&&this.recalculateTotalDuration())}recalculateTotalDuration(){this._totalDuration=0,this.forEachAccessAnimate((t=>{this._totalDuration=Math.max(this._totalDuration,t.getStartTime()+t.getDuration())}))}getTotalDuration(){return this._totalDuration}getPlaySpeed(){return this._playSpeed}setPlaySpeed(t){this._playSpeed=t}getPlayState(){return this.paused?"paused":0===this.animateCount?"stopped":"playing"}setStartTime(t){this._startTime=t}getStartTime(){return this._startTime}getCurrentTime(){return this._currentTime}setCurrentTime(t){this._currentTime=t}}const rw=new nw;rw.isGlobal=!0;class aw{constructor(t=Ia.GenAutoIncrementId(),e=rw,i){this.id=t,this.status=Oo.INITIAL,this._timeline=e,e.addAnimate(this),this.slience=i,this._startTime=0,this._duration=0,this._totalDuration=0,this._loopCount=0,this._currentLoop=0,this._bounce=!1,this._firstStep=null,this._lastStep=null,this._startProps={},this._endProps={},this._preventAttrs=new Set,this.currentTime=0,this.interpolateUpdateFunction=null,this.priority=0}getStartProps(){return this._startProps}getEndProps(){return this._endProps}setTimeline(t){this._timeline=t}getTimeline(){return this._timeline}get timeline(){return this._timeline}bind(t){return this.target=t,this.target.animates||(this.target.animates=new Map),this.target.animates.set(this.id,this),this.onRemove((()=>{this.stop(),this.target.animates.delete(this.id)})),this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.target.animationAttribute||(this.target.animationAttribute={}),this}to(t,e=300,i="linear"){const s=new iw(Ro.to,t,e,i);return s.bind(this.target,this),this.updateStepAfterAppend(s),this}wait(t){const e=new sw(Ro.wait,{},t,"linear");return e.bind(this.target,this),this.updateStepAfterAppend(e),this}updateStepAfterAppend(t){this._firstStep?(this._lastStep.append(t),this._lastStep=t):(this._firstStep=t,this._lastStep=t),this.parseStepProps(t),this.updateDuration()}parseStepProps(t){this._lastStep&&(t.propKeys=t.propKeys||Object.keys(t.props),Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})))}reSyncProps(){if(!this._lastStep)return;this._endProps={};let t=this._firstStep;for(;t;)Object.keys(this._endProps).forEach((e=>{var i;t.props[e]=null!==(i=t.props[e])&&void 0!==i?i:this._endProps[e]})),t.propKeys.forEach((e=>{this._endProps[e]=t.props[e]})),t=t.next}from(t,e=300,i="linear"){const s=new iw(Ro.from,t,e,i);return this._firstStep?(this._lastStep.append(s),this._lastStep=s):(this._firstStep=s,this._lastStep=s),this.updateDuration(),this}play(t){return t.bind(this.target,this),this.updateStepAfterAppend(t),this}pause(){this.status===Oo.RUNNING&&(this.status=Oo.PAUSED)}resume(){this.status===Oo.PAUSED&&(this.status=Oo.RUNNING)}onStart(t){var e;t?(this._onStart||(this._onStart=[]),this._onStart.push(t)):(null===(e=this._onStart)||void 0===e||e.forEach((t=>t())),Object.keys(this._endProps).forEach((t=>{this._startProps[t]=this.target.getComputedAttribute(t)})))}onEnd(t){var e;t?(this._onEnd||(this._onEnd=[]),this._onEnd.push(t)):null===(e=this._onEnd)||void 0===e||e.forEach((t=>t()))}onFrame(t){t&&(this._onFrame||(this._onFrame=[]),this._onFrame.push(t))}onRemove(t){var e;t?(this._onRemove||(this._onRemove=[]),this._onRemove.push(t)):null===(e=this._onRemove)||void 0===e||e.forEach((t=>t()))}preventAttr(t){this._preventAttrs.add(t),delete this._startProps[t],delete this._endProps[t];let e=this._firstStep;for(;e;)e.deleteSelfAttr(t),e=e.next}preventAttrs(t){t.forEach((t=>this._preventAttrs.add(t)))}validAttr(t){return!this._preventAttrs.has(t)}runCb(t){var e;return null===(e=this._lastStep)||void 0===e||e.onEnd(t),this}startAt(t){return this._startTime=t,this}customInterpolate(t,e,i,s,n,r){return!1}getFromValue(){return this._startProps}getToValue(){return this._endProps}stop(t){let e=this._firstStep;for(;e;)e.stop(),e=e.next;this.status!==Oo.END&&this.onEnd(),this.status=Oo.END,this.target&&("start"===t?this.target.setAttributes(this._startProps):"end"===t?this.target.setAttributes(this._endProps):t&&this.target.setAttributes(t))}release(){this.status=Oo.END,this._onRemove&&this._onRemove.forEach((t=>t())),this._onStart=[],this._onFrame=[],this._onEnd=[],this._onRemove=[],this.forEachStep((t=>{t.release()}))}getDuration(){return this._duration}getStartTime(){return this._startTime}afterAll(t){if(!t||0===t.length)return this;let e=0;return t.forEach((t=>{const i=t.getStartTime()+t.getTotalDuration();e=Math.max(e,i)})),this.startAt(e)}after(t){if(!t)return this;const e=t.getStartTime()+t.getTotalDuration();return this.startAt(e)}parallel(t){return t?(this.startAt(t.getStartTime()),this):this}loop(t){return!0===t?t=1/0:!1===t&&(t=0),this._loopCount=t,this.updateDuration(),this}bounce(t){return this._bounce=t,this}advance(t){var e,i,s;if(this.status===Oo.END)return void console.warn("aaa 动画已经结束,不能推进");const n=this.currentTime+t;if(n=this._startTime+this._totalDuration)return null===(e=this._lastStep)||void 0===e||e.onUpdate(!0,1,{}),null===(i=this._lastStep)||void 0===i||i.onEnd(),this.onEnd(),void(this.status=Oo.END);this.status=Oo.RUNNING,this.currentTime<=this._startTime&&this.onStart(),this.currentTime=n;let r=n-this._startTime,a=!1,o=!1;if(this._loopCount>0){r=(n-this._startTime)%this._duration;const t=Math.floor((n-this._startTime)/this._duration);a=t>this._currentLoop,this._currentLoop=t,o=this._bounce&&t%2==1,o&&(r=this._duration-r)}a&&!o&&this.target.setAttributes(this._startProps);let l=null;if(this._lastStep===this._firstStep)l=this._firstStep;else{let t=this._firstStep;for(;t;){const e=t.getStartTime(),i=t.getDuration();if(r>=e&&r<=e+i){l=t;break}t=t.next}}if(!l)return;l!==this.lastRunStep&&(null===(s=this.lastRunStep)||void 0===s||s.onEnd()),this.lastRunStep=l;const h=(r-l.getStartTime())/l.getDuration(),c=h>=1;l.update(c,h,{}),c&&(l.onEnd(),this.lastRunStep=null)}updateDuration(){this._lastStep?(this._duration=this._lastStep.getStartTime()+this._lastStep.getDuration(),this._totalDuration=this._duration*(this._loopCount+1)):this._duration=0}getTotalDuration(){return this._totalDuration}getLoop(){return this._loopCount}forEachStep(t){let e=this._firstStep;for(;e;)t(e),e=e.next}}const ow=new ko;class lw{constructor(){this.released=!1}tick(t,e){ow.addAnimationFrameCb((()=>{if(!this.released)return e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class hw extends l{constructor(t){super(),this.timelines=[],this.frameTimeHistory=[],this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};if(this.ifCanStop())return this.stop(),!1;const s=t.getTime();this._lastTickTime=s,this.lastFrameTime<0&&(this.lastFrameTime=s-this.interval+this.timeOffset,this.frameTimeHistory.push(this.lastFrameTime));const n=s-this.lastFrameTime,r=this.checkSkip(n);return r||(this._handlerTick(n),this.lastFrameTime=s,this.frameTimeHistory.push(this.lastFrameTime)),i||t.tick(this.interval,this.handleTick),!r},this._handlerTick=t=>{this.status===Lo.RUNNING&&(this.tickCounts++,this.timelines.forEach((e=>{e.tick(t)})),this.emit("tick",t))},this._handleGraphTick=()=>{this.initHandler(!1)},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.stage=t,this.autoStop=!0,this.interval=16,this.computeTimeOffsetAndJitter()}bindStage(t){this.stage=t}computeTimeOffsetAndJitter(){this.timeOffset=Math.floor(Math.random()*this.interval),this._jitter=Math.min(Math.max(.2*this.interval,6),.7*this.interval)}init(){this.interval=16,this.status=Lo.INITIAL,So.global.hooks.onSetEnv.tap("graph-ticker",this._handleGraphTick),So.global.env&&this.initHandler(!1)}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}getTimelines(){return this.timelines}initHandler(t=!1){this.setupTickHandler(t)}setupTickHandler(t=!1){if(!t&&this.tickerHandler)return!0;const e=new lw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=e,!0}setInterval(t){this.interval=t,this.computeTimeOffsetAndJitter()}getInterval(){return this.interval}setFPS(t){this.setInterval(Math.floor(1e3/t))}getFPS(){return 1e3/this.interval}tick(t){this.tickerHandler.tick(t,(t=>this.handleTick(t,{once:!0})))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==Lo.INITIAL&&(this.status=Lo.PAUSE,!0)}resume(){return this.status!==Lo.INITIAL&&(this.status=Lo.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(this.timelines.every((t=>!t.isRunning())))return!0}return!1}start(t=!1){if(this.status===Lo.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Lo.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Lo.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=Lo.INITIAL,this.setupTickHandler(!0),this.lastFrameTime=-1}trySyncTickStatus(){this.status===Lo.INITIAL&&this.timelines.some((t=>t.isRunning()))?this.start():this.status===Lo.RUNNING&&this.timelines.every((t=>!t.isRunning()))&&this.stop()}release(){var t;this.stop(),this.timelines=[],null===(t=this.tickerHandler)||void 0===t||t.release(),this.tickerHandler=null,this.lastFrameTime=-1,So.global.hooks.onSetEnv.unTap("graph-ticker",this._handleGraphTick)}checkSkip(t){var e,i,s;return"performance"!==(null===(s=null===(i=null===(e=this.stage)||void 0===e?void 0:e.params)||void 0===i?void 0:i.optimize)||void 0===s?void 0:s.tickRenderMode)&&t({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("appear","appear",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("appear","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("appear","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("normal","normal",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("normal","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("normal","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("exit","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","enter",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("exit","exit",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("enter","enter",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("enter","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("enter","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("disappear","*",(()=>({allowTransition:!1,stopOriginalTransition:!1}))),this.registerTransition("disappear","appear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("update","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("update","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","*",(()=>({allowTransition:!0,stopOriginalTransition:!1}))),this.registerTransition("state","disappear",(()=>({allowTransition:!0,stopOriginalTransition:!0}))),this.registerTransition("state","exit",(()=>({allowTransition:!0,stopOriginalTransition:!0})))}isTransitionAllowed(t,e,i){var s,n,r,a;let o=null===(s=this.transitions.get(t))||void 0===s?void 0:s.get(e);return o?o(i,t):(o=null===(n=this.transitions.get(t))||void 0===n?void 0:n.get("*"),o?o(i,t):(o=null===(r=this.transitions.get("*"))||void 0===r?void 0:r.get(e),o?o(i,t):(o=null===(a=this.transitions.get("*"))||void 0===a?void 0:a.get("*"),o?o(i,t):{allowTransition:!0,stopOriginalTransition:!0})))}registerTransition(t,e,i){let s=this.transitions.get(t);s||(s=new Map,this.transitions.set(t,s)),s.set(e,i)}}function uw(t){if(!t||!d(t))return 0;const e=Function.prototype.toString.call(t);if(/^class\s/.test(e))return 1;if(!t.prototype)return 2;if(t.prototype.constructor===t){const e=Object.getOwnPropertyDescriptor(t,"prototype");if(e&&!e.writable)return 1}return 2}dw.getInstance();class pw{static registerBuiltInAnimate(t,e){pw.builtInAnimateMap[t]=e}constructor(t){this._animates=[],this._startCallbacks=[],this._endCallbacks=[],this._started=!1,this._activeCount=0,this._target=t}get started(){return this._started}onStart(t){t?(this._startCallbacks.push(t),this._started&&this._activeCount>0&&t()):this._startCallbacks.forEach((t=>{t()}))}onEnd(t){t?this._endCallbacks.push(t):this._endCallbacks.forEach((t=>{t()}))}_trackAnimation(t){this._animates.push(t),this._activeCount++,1!==this._activeCount||this._started||(this._started=!0,this.onStart()),t.onEnd((()=>{this._activeCount--;const e=this._animates.indexOf(t);e>=0&&this._animates.splice(e,1),0===this._activeCount&&this._started&&(this._started=!1,this.onEnd())}))}parseParams(t,e,i){var s,n;const r=this.resolveValue(t.totalTime,i,void 0),a=this.resolveValue(t.startTime,i,0),o=Object.assign({},t);o.oneByOneDelay=0,o.startTime=a,o.totalTime=r;const l=this.resolveValue(t.oneByOne,i,!1);if(e){const t=o.timeSlices;y(t)||(o.timeSlices=[t]);let e=0;o.timeSlices=o.timeSlices.map((t=>{const s=this.resolveValue(t.delay,i,0),n=this.resolveValue(t.delayAfter,i,0),r=this.resolveValue(t.duration,i,300);return e+=s+r+n,Object.assign(Object.assign({},t),{delay:s,delayAfter:n,duration:r})}));let s=0;l&&(s="number"==typeof l?l:l?e:0),o.oneByOneDelay=s;let n=1;if(r){const t=e+s*(this._target.count-2);n=r?r/t:1}o.timeSlices=o.timeSlices.map((t=>{let e=t.effects;return Array.isArray(e)||(e=[e]),Object.assign(Object.assign({},t),{delay:t.delay*n,delayAfter:t.delayAfter*n,duration:t.duration*n,effects:e.map((t=>{var e,i;const s=null!==(e=t.custom)&&void 0!==e?e:pw.builtInAnimateMap[null!==(i=t.type)&&void 0!==i?i:"fromTo"],n=uw(s);return Object.assign(Object.assign({},t),{custom:s,customType:n})}))})})),o.oneByOneDelay=s*n,o.startTime=a*n}else{const e=this.resolveValue(t.delay,i,0),h=this.resolveValue(t.delayAfter,i,0),c=this.resolveValue(t.duration,i,300);let d=0;l&&(d="number"==typeof l?l:l?e+h+c:0),o.oneByOneDelay=d,o.custom=null!==(s=t.custom)&&void 0!==s?s:pw.builtInAnimateMap[null!==(n=t.type)&&void 0!==n?n:"fromTo"];const u=uw(o.custom);o.customType=u;const p=e+h+c+d*(this._target.count-2),g=k(r)?r/p:1;o.delay=e*g,o.delayAfter=h*g,o.duration=c*g,o.oneByOneDelay=d*g,o.startTime=a}return o}execute(t){Array.isArray(t)?t.forEach((t=>this._execute(t))):this._execute(t)}_execute(t){if(t.selfOnly)return this._executeItem(t,this._target,0,1);const e="timeSlices"in t;let i;e&&t.partitioner&&(i=(null!=i?i:this._target.getChildren()).filter((e=>{var i,s;return t.partitioner(null===(s=null===(i=e.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],e,{})}))),e&&t.sort&&(i=null!=i?i:this._target.getChildren(),i.sort(((e,i)=>{var s,n,r,a;return t.sort(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],null===(a=null===(r=i.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,i,{})})));const s=e?(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTimelineItem(r,i,s,n);a&&this._trackAnimation(a)}:(i,s,n)=>{const r=this.parseParams(t,e,i),a=this.executeTypeConfigItem(r,i,s,n);a&&this._trackAnimation(a)};i?i.forEach(((t,e)=>s(t,e,i.length))):this._target.count<=1?s(this._target,0,1):this._target.forEachChildren(((t,e)=>s(t,e,this._target.count-1)))}executeTypeConfigItem(t,e,i,s){var n,r,a,o,l,h,c,u;const{type:p="fromTo",channel:g,customParameters:f,easing:m="linear",delay:v=0,delayAfter:_=0,duration:y=300,startTime:b=0,oneByOneDelay:x=0,loop:S,bounce:A,priority:k=0,options:M,custom:T,customType:w,controlOptions:C}=t,E=e.animate();E.priority=k;const B=d(v)?v(null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],e,{}):v,P=null===(o=null===(a=e.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],L=null===(l=e.context)||void 0===l?void 0:l.indexKey;P&&L&&(i=null!==(h=P[L])&&void 0!==h?h:i),E.startAt(b);const R=i*x+B;R>0&&E.wait(R);let O=null,I=t.to,D=t.from;I||(O||(O=this.createPropsFromChannel(g,e)),I=O.props),D||(O||(O=this.createPropsFromChannel(g,e)),D=O.from),O.attrOutChannel&&e.setAttributes(O.attrOutChannel),this._handleRunAnimate(E,T,w,D,I,y,m,f,C,M,p,e);let F=0;x&&(F=x*(s-i-1));const z=d(_)?_(null===(u=null===(c=e.context)||void 0===c?void 0:c.data)||void 0===u?void 0:u[0],e,{}):_;return z>0&&(F+=z),F>0&&E.wait(F),S&&S>0&&E.loop(S),A&&E.bounce(!0),E}_handleRunAnimate(t,e,i,s,n,r,a,o,l,h,c,u){var p,g,f,m,v,_,y,b;if(e&&i){i=uw(e);let c=this.resolveValue(o,u);"function"==typeof c&&(c=c(null===(g=null===(p=u.context)||void 0===p?void 0:p.data)||void 0===g?void 0:g[0],u,{})),c=Object.assign({width:(null===(f=u.stage)||void 0===f?void 0:f.width)||0,height:(null===(m=u.stage)||void 0===m?void 0:m.height)||0,group:this._target.parent},c);const x=d(h)?h.call(null,null!==(_=c&&(null===(v=c.data)||void 0===v?void 0:v[0]))&&void 0!==_?_:null===(b=null===(y=u.context)||void 0===y?void 0:y.data)||void 0===b?void 0:b[0],u,c):h;c.options=x,c.controlOptions=l,1===i?this.createCustomAnimation(t,e,s,n,r,a,c):2===i&&this.createCustomInterpolatorAnimation(t,e,n,r,a,c)}else"to"===c?t.to(n,r,a):"from"===c&&t.from(n,r,a)}executeTimelineItem(t,e,i,s){var n,r,a,o;const{timeSlices:l,startTime:h=0,loop:c,bounce:d,oneByOneDelay:u,priority:p,controlOptions:g}=t,f=null===(r=null===(n=e.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],m=null===(a=e.context)||void 0===a?void 0:a.indexKey;f&&m&&(i=null!==(o=f[m])&&void 0!==o?o:i);const v=e.animate();return v.priority=p,v.startAt(h),v.wait(i*u),c&&c>0&&v.loop(c),d&&v.bounce(!0),(Array.isArray(l)?l:[l]).forEach((t=>{this.applyTimeSliceToAnimate(t,v,e,g)})),u&&v.wait(u*(s-i-1)),v}applyTimeSliceToAnimate(t,e,i,s){var n,r,a,o;const{effects:l,duration:h=300,delay:c=0,delayAfter:u=0}=t,p=d(c)?c(null===(r=null===(n=i.context)||void 0===n?void 0:n.data)||void 0===r?void 0:r[0],i,{}):c,g=d(u)?u(null===(o=null===(a=i.context)||void 0===a?void 0:a.data)||void 0===o?void 0:o[0],i,{}):u;p>0&&e.wait(p),(Array.isArray(l)?l:[l]).forEach((t=>{var n;const{type:r="fromTo",channel:a,customParameters:o,easing:l="linear",options:c}=t;let d=null,u=t.to,p=t.from;u||(d||(d=this.createPropsFromChannel(a,i)),u=d.props),p||(d||(d=this.createPropsFromChannel(a,i)),p=d.from),d.attrOutChannel&&i.setAttributes(d.attrOutChannel);const g=null!==(n=t.custom)&&void 0!==n?n:pw.builtInAnimateMap[r],f=t.custom?t.customType:uw(g);this._handleRunAnimate(e,g,f,p,u,h,l,o,s,c,r,i)})),g>0&&e.wait(g)}createCustomInterpolatorAnimation(t,e,i,s,n,r){const a=i;Object.keys(a).forEach((e=>{t.target.getComputedAttribute(e)})),t.interpolateUpdateFunction=(i,s,n,a,o)=>{e(n,i,s,a,o,t.target,r)},t.to(i,s,n)}createCustomAnimation(t,e,i,s,n,r,a){const o=new e(i,s,n,r,a);t.play(o)}createPropsFromChannel(t,e){var i;const s={};let n=null;if(!t)return{from:n,props:s,attrOutChannel:null};const r={};let a=!1;const o=null===(i=e.context)||void 0===i?void 0:i.diffAttrs;if(Array.isArray(t)&&(t=t.reduce(((t,e)=>(void 0===o[e]||(t[e]={to:o[e]}),t)),{})),Object.keys(t).forEach((i=>{var r,a,o,l;const h=t[i];void 0!==h.to&&("function"==typeof h.to?s[i]=h.to(null===(a=null===(r=e.context)||void 0===r?void 0:r.data)||void 0===a?void 0:a[0],e,{}):s[i]=h.to),void 0!==h.from&&(n||(n={}),"function"==typeof h.from?n[i]=h.from(null===(l=null===(o=e.context)||void 0===o?void 0:o.data)||void 0===l?void 0:l[0],e,{}):n[i]=h.from)})),o)for(const t in o){const e=o[t];void 0!==e&&(s.hasOwnProperty(t)||(r[t]=e,a=!0))}return{from:n,props:s,attrOutChannel:a?r:null}}resolveValue(t,e,i){var s,n;return void 0===t?i:"function"==typeof t&&e?t(null===(n=null===(s=e.context)||void 0===s?void 0:s.data)||void 0===n?void 0:n[0],e,{}):t}executeItem(t,e,i=0,s=1){return Array.isArray(t)?t.map((t=>this._executeItem(t,e,i,s))).filter(Boolean):[this._executeItem(t,e,i,s)].filter(Boolean)}_executeItem(t,e,i=0,s=1){if(!e)return null;const n="timeSlices"in t;let r=null;const a=this.parseParams(t,n);return r=n?this.executeTimelineItem(a,e,i,s):this.executeTypeConfigItem(a,e,i,s),r&&this._trackAnimation(r),r}stop(t,e=!0){for(;this._animates.length>0;){const i=this._animates.pop();!1===e&&(i.status=Oo.END),null==i||i.stop(t)}this._animates=[],this._activeCount=0,this._started&&(this._started=!1,e&&this.onEnd())}}pw.builtInAnimateMap={};const gw="appear",fw="disappear",mw="update",vw="highlight",_w="unhighlight";class yw{constructor(t){this.graphic=t}registerState(t){this.states||(this.states=new Map),this.states.set(t.name,t)}clearStates(){var t;null===(t=this.states)||void 0===t||t.clear()}}class bw{constructor(t){this.stateList=null,this.graphic=t}applyState(t,e,i){const s=dw.getInstance(),n=[],r=[];if(this.stateList&&this.stateList.length?t.forEach(((t,i)=>{const a={allowTransition:!0,stopOriginalTransition:!0};this.stateList.forEach((e=>{const i=s.isTransitionAllowed(e.state,t,this.graphic);a.allowTransition=a.allowTransition&&i.allowTransition})),a.allowTransition&&(r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new pw(this.graphic)}),this.stateList.forEach((e=>{s.isTransitionAllowed(e.state,t,this.graphic).stopOriginalTransition&&n.push(e)})))})):t.forEach(((t,i)=>{r.push({state:t,animationConfig:y(e[i])?e[i].map((t=>t.animation)):e[i].animation,executor:new pw(this.graphic)})})),n.forEach((t=>{t.executor.stop(null,!1)})),r.length){r[0].executor.execute(r[0].animationConfig);for(let t=0;t{e&&e.executor.execute(e.animationConfig),this.stateList=this.stateList.filter((t=>t!==s)),t===r.length-1&&i&&i(!1)}))}}else i&&i(!0);this.stateList?this.stateList=this.stateList.filter((t=>!n.includes(t))):this.stateList=[],this.stateList.push(...r)}applyAppearState(t,e){this.applyState([gw],[{name:gw,animation:t}],e)}applyDisappearState(t,e){this.applyState([fw],[{name:fw,animation:t}],e)}applyUpdateState(t,e){this.applyState([mw],[{name:mw,animation:t}],e)}applyHighlightState(t,e){this.applyState([vw],[{name:vw,animation:t}],e)}applyUnhighlightState(t,e){this.applyState([_w],[{name:_w,animation:t}],e)}stopState(t,e){var i;const s=null===(i=this.stateList)||void 0===i?void 0:i.find((e=>e.state===t));s&&s.executor.stop(e)}clearState(){var t;null===(t=this.stateList)||void 0===t||t.forEach((t=>{t.executor.stop(null,!1)})),this.stateList=null}reApplyState(t){var e;const i=null===(e=this.stateList)||void 0===e?void 0:e.find((e=>e.state===t));if(i&&i.executor.started){const t=this.stateList.slice();i.executor.stop(),this.stateList=t,i.executor.execute(i.animationConfig)}}}class xw{_getAnimationStateManager(t){return t._animationStateManager||(t._animationStateManager=new bw(t)),t._animationStateManager}_getAnimationStateStore(t){return t._animationStateStore||(t._animationStateStore=new yw(t)),t._animationStateStore}registerAnimationState(t){return this._getAnimationStateStore(this).registerState(t),this}applyAnimationState(t,e,i){return this._getAnimationStateManager(this).applyState(t,e,i),this}applyAppearState(t,e){return this._getAnimationStateManager(this).applyAppearState(t,e),this}applyDisappearState(t,e){return this._getAnimationStateManager(this).applyDisappearState(t,e),this}applyUpdateState(t,e){return this._getAnimationStateManager(this).applyUpdateState(t,e),this}applyHighlightState(t,e){return this._getAnimationStateManager(this).applyHighlightState(t,e),this}applyUnhighlightState(t,e){return this._getAnimationStateManager(this).applyUnhighlightState(t,e),this}stopAnimationState(t,e,i=!1){return this._getAnimationStateManager(this).stopState(t,e),i&&this.isContainer&&this.forEachChildren((s=>{s.stopAnimationState(t,e,i)})),this}clearAnimationStates(){const t=this._animationStateManager;return t&&t.clearState(),this}reApplyAnimationState(t,e=!1){const i=this._animationStateManager;return i&&i.reApplyState(t),e&&this.isContainer&&this.forEachChildren((i=>{i.reApplyAnimationState(t,e)})),this}static extend(t){return(new xw)._getAnimationStateManager(t),t}}class Sw{getAttributes(t=!1){return t&&this.finalAttribute?this.finalAttribute:this.attribute}animate(t){var e,i,s;const n=new aw(null==t?void 0:t.id,null!==(i=null!==(e=null==t?void 0:t.timeline)&&void 0!==e?e:this.stage&&this.stage.getTimeline())&&void 0!==i?i:rw,null==t?void 0:t.slience);if(n.bind(this),t){const{onStart:e,onEnd:i,onRemove:s}=t;null!=e&&n.onStart(e),null!=i&&n.onEnd(i),null!=s&&n.onRemove(s)}return null===(s=this.stage)||void 0===s||s.ticker.start(),n}createTimeline(){return new nw}createTicker(t){return new hw(t)}setFinalAttributes(t){this.finalAttribute||(this.finalAttribute={}),Object.assign(this.finalAttribute,t)}initFinalAttributes(t){this.finalAttribute=t}initAnimateExecutor(){this._animateExecutor||(this._animateExecutor=new pw(this))}executeAnimation(t){return this.initAnimateExecutor(),this._animateExecutor.execute(t),this}executeAnimations(t){return this.initAnimateExecutor(),t.forEach((t=>{this._animateExecutor.execute(t)})),this}getFinalAttribute(){return this.finalAttribute}getGraphicAttribute(t,e=!1){return!e&&this.finalAttribute?this.finalAttribute[t]:this.attribute[t]}pauseAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.pause())),t&&this.isContainer&&this.forEachChildren((e=>{e.pauseAnimation(t)}))}resumeAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.resume())),t&&this.isContainer&&this.forEachChildren((e=>{e.resumeAnimation(t)}))}stopAnimation(t=!1){this.animates&&this.animates.forEach((t=>t.stop())),t&&this.isContainer&&this.forEachChildren((e=>{e.stopAnimation(t)}))}}function Aw(){G(Ep,xw),G(Ep,Sw)}class kw extends iw{constructor(t,e,i,s,n){super("customAnimate",e,i,s),this.type="customAnimate",this.customFrom=t,this.params=n,this.from=t,this.to=e}update(t,e,i){if(this.onStart(),!this.props||!this.propKeys)return;const s=this.easing(e);this.onUpdate(t,s,i),this.syncAttributeUpdate()}setProps(t){this.props=t,this.propKeys=Object.keys(t),this.animate.reSyncProps()}}class Mw extends kw{completeBind(t){this.setStartTime(0),this._animator&&this._animator.start(),this.setDuration(t.getDuration())}stop(){this._animator&&this._animator.stop()}}class Tw{constructor(t){this.tasks=[],this.started=!1,this.completed=0,this.totalDuration=0,this.onStartCallbacks=[],this.onEndCallbacks=[],this.onUpdateCallbacks=[],this.component=t}animate(t,e){return this.started?(console.warn("Cannot add animations after animation has started"),this):(this.tasks.push({graphic:t,config:e}),this)}onStart(t){return this.onStartCallbacks.push(t),this}onEnd(t){return this.onEndCallbacks.push(t),this}onUpdate(t){return this.onUpdateCallbacks.push(t),this}start(){return this.started?(console.warn("Animation has already started"),this):(this.started=!0,this.completed=0,this.onStartCallbacks.forEach((t=>t())),0===this.tasks.length?(setTimeout((()=>{this.onEndCallbacks.forEach((t=>t()))}),0),this):(this.tasks.forEach((t=>{const e=new pw(t.graphic);e.onEnd((()=>{this.completed++,this.completed===this.tasks.length&&this.onEndCallbacks.forEach((t=>t()))}));const i=e.executeItem(t.config,t.graphic);t.animate=i,i.forEach((t=>{this.totalDuration=Math.max(this.totalDuration,t.getStartTime()+t.getDuration())}))})),this))}deleteSelfAttr(t){this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.preventAttr(t)))}))}stop(t){return this.tasks.forEach((e=>{e.animate&&e.animate.forEach((e=>e.stop(t)))})),this.started&&this.completed!==this.tasks.length&&(this.onEndCallbacks.forEach((t=>t())),this.completed=this.tasks.length),this}getDuration(){return this.totalDuration}}function ww(t){return new Tw(t)}class Cw extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.formatTemplate=null,this.decimalLength=null==n?void 0:n.decimalLength,(null==n?void 0:n.formatTemplate)&&n.formatTemplate.includes("{{var}}")&&(this.formatTemplate=n.formatTemplate)}onFirstRun(){var t,e,i;const s=this.getLastProps(),n=this.getEndProps(),r=null!==(t=s.text)&&void 0!==t?t:0,a=null!==(e=n.text)&&void 0!==e?e:0;this.valid=!0;let o=0,l=0,h="",c="",d=0;if("number"==typeof r){o=r;const t=r.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof r)return void(this.valid=!1);if(r.endsWith("%")){h="%";const t=r.substring(0,r.length-1).replace(/,/g,"");if(o=parseFloat(t)/100,isNaN(o))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=r.replace(/,/g,"");if(o=parseFloat(t),isNaN(o))return void(this.valid=!1);r.includes(",")&&(h=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if("number"==typeof a){l=a;const t=a.toString().split(".")[1]||"";d=Math.max(d,t.length)}else{if("string"!=typeof a)return void(this.valid=!1);if(a.endsWith("%")){c="%";const t=a.substring(0,a.length-1).replace(/,/g,"");if(l=parseFloat(t)/100,isNaN(l))return void(this.valid=!1);const e=t.split(".")[1]||"";d=Math.max(d,e.length+2)}else{const t=a.replace(/,/g,"");if(l=parseFloat(t),isNaN(l))return void(this.valid=!1);a.includes(",")&&(c=",");const e=t.split(".")[1]||"";d=Math.max(d,e.length)}}if(null===(i=this.params)||void 0===i?void 0:i.format){switch(this.params.format){case"percent":this.format="%";break;case"thousandth":this.format=",";break;case"none":this.format="";break;default:this.format=c||h}"%"===this.format&&"%"!==c&&"%"!==h&&void 0===this.decimalLength&&(this.decimalLength=2),"%"===this.format||"%"!==c&&"%"!==h||(o*=100,l*=100)}else this.format=c||h;this.fromNumber=o,this.toNumber=l,void 0===this.decimalLength&&(this.decimalLength=d)}onEnd(t){super.onEnd(t),t||this.props&&this.target.setAttributes(this.props)}onUpdate(t,e,i){if(!this.valid)return;const s=this.fromNumber+(this.toNumber-this.fromNumber)*e;let n="";const r=this.format,a=("%"===r?100*s:s).toFixed(this.decimalLength);let o,l=a;if(parseFloat(a)===Math.floor(parseFloat(a))&&(l=Math.floor(parseFloat(a))),"%"===r)o=`${l}%`;else if(","===r){const t=l.toString().split(".");t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),o=t.join(".")}else o=l;n=this.formatTemplate?this.formatTemplate.replace("{{var}}",o.toString()):o,this.target.setAttribute("text",n)}}const Ew=1e3,Bw="quadInOut",Pw=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","scrollX","scrollY"],Lw=(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=up(t.from,t.to,i,!1);s&&(e[t.key]=s)}}))},Rw=(t,e,i)=>{const s=[],n=[];e.clear();for(let r=0;r{const s=t?ty(t):[],n=ty(e);i&&s&&(i.fromTransform&&ey(s,i.fromTransform.clone().getInverse()),ey(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})))},Iw=["fill","fillOpacity","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","lineDashOffset"],Dw=(t,e)=>{if(!t||!e)return null;const i=[];let s=!1;return Object.keys(t).forEach((n=>{if(!Iw.includes(n))return;const r=e[n];if(!u(r)&&!u(t[n])&&r!==t[n]){if("fill"===n||"stroke"===n){const e=t=>"string"==typeof t?cp.Get(t,hp.Color255):t;i.push({from:y(t[n])?t[n].map(e):e(t[n]),to:y(r)?r.map(e):e(r),key:n})}else i.push({from:t[n],to:r,key:n});s=!0}})),s?i:null};class Fw extends kw{constructor(t,e,i){super({},{},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;Rw(this.morphingData,n,e),this.otherAttrs&&this.otherAttrs.length&&Lw(this.otherAttrs,i,e),this.target.setAttributes(i),t&&!this.saveOnEnd&&(this.target.pathProxy=null)}}const zw=(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=Ow(null===(n=null==t?void 0:t.toCustomPath)||void 0===n?void 0:n.call(t),e.toCustomPath(),{fromTransform:o,toTransfrom:e.globalTransMatrix}),h=Dw(null==t?void 0:t.attribute,e.attribute),c=e.animate(i);(null==i?void 0:i.delay)&&c.wait(i.delay);const d=new Fw({morphingData:l,otherAttrs:h},null!==(r=null==i?void 0:i.duration)&&void 0!==r?r:Ew,null!==(a=null==i?void 0:i.easing)&&void 0!==a?a:Bw);return c.play(d),c};class jw extends kw{constructor(t,e,i){super({},{},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;Rw(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&&Lw(this.otherAttrs[i],t.attribute,e)})),t&&(this.clearPathProxy(),this.morphingData=null)}}const Hw=t=>{const e={};return Object.keys(t).forEach((i=>{(t=>Pw.includes(t))(i)||(e[i]=t[i])})),e},Vw=(t,e,i)=>{const s=Hw(t.attribute),n=t.attachShadow();if(e.length)n.setTheme({[e[0].type]:s}),e.forEach((t=>{t.setAttributes({pickable:!1}),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=So.graphicService.creator.rect({x:0,y:0,width:a,height:o,pickable:!1});n.appendChild(i),e.push(i)}))}},Nw=(t,e,i)=>{const s=[],n=i?null:Hw(t.attribute),r=t.toCustomPath();for(let t=0;t{const s=[],n=i?null:Hw(t.attribute);if("rect"===t.type)((t,e)=>{const{width:i,height:s}=Lg(t.attribute),n=sy(i,s,e),r=[],a=s/n.length;for(let t=0,e=n.length;t{s.push(So.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=sy(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(So.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=sy(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(So.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 ny(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 ny(t,e)}return[]})(t,e),a={size:10,symbolType:"circle"};r.forEach((t=>{s.push(So.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:ry(i)}];const s=[];return oy(i,e,s),s})(t,e).forEach((t=>{s.push(So.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 oy(l,e,h),h})(t,e).forEach((t=>{s.push(So.graphicService.creator.polygon(i?t:Object.assign({},n,t)))})):"path"===t.type&&((t,e)=>{const i=ty(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(So.graphicService.creator.path(i?t:Object.assign({},n,t))):s.push(So.graphicService.creator.polygon(i?t:Object.assign({},n,t)))}));return i&&Vw(t,s,e),s};class Ww extends kw{constructor(t,e,i,s,n){super(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(){super.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:Ko.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:Ko.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:Ko.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Gw extends Ww{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,f,m;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=So.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!==(f=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==f?f:y/2,outerRadius:null!==(m=null==n?void 0:n.radius)&&void 0!==m?m:(_+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 Yw extends Ww{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:{},f=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,m=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=So.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:f,height:"in"===v&&"y"===_?0:m,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:m,height:0},S={y:0,height:m}):(x={height:0},S={height:m}):"negative"===y?(x={x:f,width:0},S={x:0,width:f}):(x={width:0},S={width:f}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}class $w extends kw{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t,e=!1){if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){super.onBind();const{points:t,segments:e}=this.target.attribute,{points:i,segments:s}=this.target.getFinalAttribute();this.from={points:t,segments:e},this.to={points:i,segments:s},this.props=this.to;const n=this.getPoints(this.from),r=this.getPoints(this.to,!0);this.fromPoints=n?Array.isArray(n)?n:[n]:[],this.toPoints=r?Array.isArray(r)?r:[r]:[];const a=new Map;this.fromPoints.forEach((t=>{t.context&&a.set(t.context,t)}));let o,l,h=1/0,c=-1/0;for(let t=0;t=0;t-=1)if(a.has(this.toPoints[t].context)){c=t,l=a.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(c)?(this.clipRange=this.toPoints[c][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],1===this.clipRange&&(this.shrinkClipRange=this.toPoints[c][this.clipRangeByDimension]/this.fromPoints[this.fromPoints.length-1][this.clipRangeByDimension]),k(this.clipRange)?this.clipRange=vt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let d=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const i=a.get(t.context);return i?(d=i,[i,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ec&&l?[l,t]:[d,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new ne(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onFirstRun(){const t=this.target.attribute.clipRange;k(t*this.clipRange)&&(this.clipRange*=t)}onUpdate(t,e,i){if(t)return Object.keys(this.to).forEach((t=>{this.target.attribute[t]=this.to[t]})),this.target.addUpdatePositionTag(),void this.target.addUpdateShapeAndBoundsTag();if(this.points=this.points.map(((t,i)=>{const s=td(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange){if(this.shrinkClipRange)return void(t?(i.points=this.toPoints,i.clipRange=1):(i.points=this.fromPoints,i.clipRange=this.clipRange-(this.clipRange-this.shrinkClipRange)*e));this.target.setAttributes({clipRange:this.clipRange+(1-this.clipRange)*e})}if(this.segmentsCache&&this.to.segments){let t=0;const e=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}));this.target.attribute.segments=e}else this.target.attribute.points=this.points;this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Xw extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const s=this.target.getFinalAttribute(),n=null!==(t=this.target.attribute)&&void 0!==t?t:{},r={},a=null!==(e=this.from)&&void 0!==e?e:{};this.keys.forEach((t=>{var e,i,o;r[t]=null!==(e=null==s?void 0:s[t])&&void 0!==e?e:1,a[t]=null!==(o=null!==(i=a[t])&&void 0!==i?i:n[t])&&void 0!==o?o:0}));const o=this.target.getFinalAttribute();o&&this.target.setAttributes(o),this.props=r,this.propKeys=this.keys,this.from=a,this.to=r,!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(a)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class Kw extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.attribute,e={},i={};this.keys.forEach((s=>{var n;e[s]=0,i[s]=null!==(n=t[s])&&void 0!==n?n:1})),this.props=e,this.propKeys=this.keys,this.from=i,this.to=e,Object.assign(this.target.attribute,i),this.target.addUpdatePositionTag(),this.target.addUpdateBoundTag()}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class qw extends Xw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"],this.from={clipRange:0}}onFirstRun(){var t;super.onFirstRun();const{clipDimension:e}=(null===(t=this.params)||void 0===t?void 0:t.options)||{};e&&(this.target.attribute.clipRangeByDimension=e)}}class Zw extends Kw{constructor(t,e,i,s,n){super(t,e,i,s,n),this.keys=["clipRange"]}}const Jw=(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.getFinalAttribute();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.getFinalAttribute();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)};class Qw extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}determineUpdateFunction(){this.propKeys?this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this.valid=!1:this.valid=!1}deleteSelfAttr(t){delete this.props[t],this.fromProps&&delete this.fromProps[t];const e=this.propKeys.indexOf(t);-1!==e&&this.propKeys.splice(e,1),this.propKeys&&this.propKeys.length>1?this._updateFunction=this.updateAngle:"startAngle"===this.propKeys[0]?this._updateFunction=this.updateStartAngle:"endAngle"===this.propKeys[0]?this._updateFunction=this.updateEndAngle:this._updateFunction=null}updateStartAngle(t){this.target.attribute.startAngle=this.from.startAngle+(this.to.startAngle-this.from.startAngle)*t}updateEndAngle(t){this.target.attribute.endAngle=this.from.endAngle+(this.to.endAngle-this.from.endAngle)*t}updateAngle(t){this.updateStartAngle(t),this.updateEndAngle(t)}onUpdate(t,e,i){this._updateFunction&&(this._updateFunction(e),this.target.addUpdateShapeAndBoundsTag())}}class tC extends Qw{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=Jw(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r),this.determineUpdateFunction()}}class eC extends Qw{onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,this.params,!1!==(null!==(n=null==s?void 0:s.overall)&&void 0!==n&&n)?((t,e,i)=>{const s=t.attribute;if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:t,endAngle:t}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:s.startAngle,endAngle:s.endAngle},to:{startAngle:n,endAngle:n}}})(i,s):((t,e,i)=>{const s=t.attribute;return e&&"anticlockwise"===e.orient?{from:{startAngle:s.startAngle},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:s.endAngle},to:{endAngle:null==s?void 0:s.startAngle}}})(i,s));var i,s,n;const r=t;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=r?r:this.target.attribute,this.to=e,this.determineUpdateFunction()}}class iC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=((t,e,i)=>{const s=t.getFinalAttribute();switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{from:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0},to:{x:t,x1:e,width:i}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{from:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0},to:{y:t,y1:e,height:i}}}default:{const t=s.x,e=s.x1,i=s.width,n=s.y,r=s.y1,a=s.height,o={};return p(i)?(o.x=t+i/2,o.width=0,o.x1=void 0):(o.x=(t+e)/2,o.x1=(t+e)/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:t,y:n,x1:e,y1:r,width:i,height:a}}}}})(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class sC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=((t,e,i)=>{const s=t.attribute;switch(null==e?void 0:e.direction){case"x":{const t=s.x,e=s.x1,i=s.width;return{to:p(i)?{x:t+i/2,x1:void 0,width:0}:{x:(t+e)/2,x1:(t+e)/2,width:void 0}}}case"y":{const t=s.y,e=s.y1,i=s.height;return{to:p(i)?{y:t+i/2,y1:void 0,height:0}:{y:(t+e)/2,y1:(t+e)/2,height:void 0}}}default:{const t=s.x,e=s.y,i=s.x1,n=s.y1,r=s.width,a=s.height,o={};return p(r)?(o.x=t+r/2,o.width=0,o.x1=void 0):(o.x=(t+i)/2,o.x1=(t+i)/2,o.width=void 0),p(a)?(o.y=e+a/2,o.height=0,o.y1=void 0):(o.y=(e+n)/2,o.y1=(e+n)/2,o.height=void 0),{to:o}}}})(this.target,this.params.options,this.params);this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const nC=(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,n,r;const a=t.getFinalAttribute(),o=a.y,l=a.y1,h=a.height;let c;return e&&"negative"===e.orient?S(e.overall)?c=e.overall:i.group?(c=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=c):c=i.height:c=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:c,y1:u(l)?void 0:c,height:u(h)?void 0:0},to:{y:o,y1:l,height:h}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e)};class rC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=nC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class aC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s,n,r;const a=t.getFinalAttribute(),o=a.y1,l=a.height;let h;return e&&"negative"===e.orient?S(e.overall)?h=e.overall:i.group?(h=null!==(r=null!==(s=i.groupHeight)&&void 0!==s?s:null===(n=e.layoutRect)||void 0===n?void 0:n.height)&&void 0!==r?r:i.group.getBounds().height(),i.groupHeight=h):h=i.height:h=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:h,y1:u(o)?void 0:h,height:u(l)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.y,r=s.y1,a=s.height;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{y:t,y1:u(r)?void 0:t,height:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}const oC=(t,e,i)=>{const s=t.getFinalAttribute().points,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.type&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))};class lC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){var s,n;const r=null===(s=this.from)||void 0===s?void 0:s.points,a=null===(n=this.to)||void 0===n?void 0:n.points;r&&a&&(this.target.attribute.points=r.map(((t,i)=>td(r[i],a[i],e))),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag())}}class hC extends lC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:oC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class cC extends lC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:oC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const dC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewWidth;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.width()),Object.assign(Object.assign({},i),{x:e,y:i.y,x1:e,y1:i.y1,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:0,y:i.y,x1:0,y1:i.y1,defined:!1!==i.defined})}));class uC extends lC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:dC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class pC extends lC{onBind(){if(super.onBind(),["area","line"].includes(this.target.type)){const i=this.target.getFinalAttribute(),{from:s,to:n}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:dC(t,e)}});this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=s||i,this.to=n}else this.valid=!1;var t,e}}const gC=(t,e,i)=>t.getFinalAttribute().points.map((i=>{if(e&&"negative"===e.orient){let e=t.stage.viewHeight;return t.parent.parent.parent&&(e=t.parent.parent.parent.AABBBounds.height()),Object.assign(Object.assign({},i),{x:i.x,y:e,x1:i.x1,y1:e,defined:!1!==i.defined})}return Object.assign(Object.assign({},i),{x:i.x,y:0,x1:i.x1,y1:0,defined:!1!==i.defined})}));class fC extends lC{onBind(){var t;if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:e,to:i}=((t,e,i)=>{const s=t.getFinalAttribute();return{from:{points:gC(t,e)},to:{points:s.points}}})(this.target,this.params.options,this.params);this.props=i,this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.from=e,this.to=i;const s=this.target.getFinalAttribute();s&&this.target.setAttributes(s),!1!==(null===(t=this.params.controlOptions)||void 0===t?void 0:t.immediatelyApply)&&this.target.setAttributes(e)}else this.valid=!1}}class mC extends lC{onBind(){if(super.onBind(),["area","line","polygon"].includes(this.target.type)){const{from:i,to:s}=(t=this.target,e=this.params.options,this.params,{from:{points:t.getFinalAttribute().points},to:{points:gC(t,e)}});this.props=s,this.propKeys=Object.keys(s).filter((t=>null!=s[t])),this.from=null!=i?i:this.target.attribute,this.to=s}else this.valid=!1;var t,e}}const vC=(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.getFinalAttribute(),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.getFinalAttribute();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)};class _C extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class yC extends _C{onBind(){var t,e,i;super.onBind();const{from:s,to:n}=vC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}}class bC extends _C{onBind(){super.onBind();const{to:t}=(e=this.target,i=this.params.options,this.params,!1!==(null!==(s=null==i?void 0:i.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAttribute(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:n,outerRadius:n}}})(e,i):((t,e,i)=>{const s=t.getFinalAttribute();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.innerRadius},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:null==s?void 0:s.outerRadius},to:{outerRadius:null==s?void 0:s.innerRadius}}})(e,i));var e,i,s;this.props=t,this.propKeys=Object.keys(t).filter((e=>null!=t[e])),this.from=this.target.attribute,this.to=t}}const xC=(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.getFinalAttribute(),r=n.x,a=n.x1,o=n.width;let l;return e&&"negative"===e.orient?S(e.overall)?l=e.overall:i.group?(l=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=l):l=i.width:l=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:l,x1:u(a)?void 0:l,width:u(o)?void 0:0},to:{x:r,x1:a,width:o}}}(t,e,i):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{from:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e)};class SC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t,e,i;super.onBind();const{from:s,to:n}=xC(this.target,this.params.options,this.params),r=null!==(e=null===(t=this.target.context)||void 0===t?void 0:t.lastAttrs)&&void 0!==e?e:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.from=r,this.to=n;const a=this.target.getFinalAttribute();a&&this.target.setAttributes(a),!1!==(null===(i=this.params.controlOptions)||void 0===i?void 0:i.immediatelyApply)&&this.target.setAttributes(r)}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class AC extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const{from:t,to:e}=(i=this.target,s=this.params.options,n=this.params,!1!==(null!==(r=null==s?void 0:s.overall)&&void 0!==r&&r)?function(t,e,i){var s;const n=t.getFinalAttribute(),r=n.x1,a=n.width;let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s,n):function(t,e,i){const s=t.getFinalAttribute(),n=s.x,r=s.x1,a=s.width;if(e&&"negative"===e.orient){const t=p(a)?Math.max(n,n+a):Math.max(n,r);return{to:{x:t,x1:u(r)?void 0:t,width:u(a)?void 0:0}}}const o=p(a)?Math.min(n,n+a):Math.min(n,r);return{to:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0}}}(i,s));var i,s,n,r;this.props=e,this.propKeys=Object.keys(e).filter((t=>null!=e[t])),this.from=null!=t?t:this.target.attribute,this.to=e}onEnd(t){super.onEnd(t)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class kC extends Mw{onBind(){var t;const e=ww(this.target);this._animator=e;const i=this.duration,s=this.easing,{config:n,lastScale:r,getTickCoord:a}=this.params;let o=1;const l=this.target.data;if(r&&a&&l){o=.7;const t=a(r.scale(l.rawValue)),n=this.target.attribute.x,h=this.target.attribute.y;this.target.setAttributes({x:t.x,y:t.y}),e.animate(this.target,{type:"to",to:{x:n,y:h},duration:i,easing:s})}e.animate(this.target,{type:null!==(t=n.type)&&void 0!==t?t:"fadeIn",to:n.to,duration:i*o,easing:s}),this.completeBind(e)}}class MC extends Mw{onBind(){const t=ww(this.target);this._animator=t;const e=this.duration,i=this.easing,{config:s,diffAttrs:n}=this.params;t.animate(this.target,{type:"to",to:Object.assign({},n),duration:e,easing:i,customParameters:{diffAttrs:Object.assign({},n)}}),this.completeBind(t)}deleteSelfAttr(t){super.deleteSelfAttr(t),this._animator.deleteSelfAttr(t)}tryPreventConflict(){}}function TC(){zk(),Nk(),qk(),iM(),pw.registerBuiltInAnimate("axisEnter",kC),pw.registerBuiltInAnimate("axisUpdate",MC)}var wC=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{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=uf.group({zIndex:999});e.name=vT.axisBreak,e.id=this._getNodeId(`${vT.axisBreak}-${i}`),e.data=a;const o=function(t={}){var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=j({},xT,s),a=null!==(e=r.size)&&void 0!==e?e:xT.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=uf.symbol(Object.assign({x:s.x,y:s.y},o));l.name=vT.axisBreakSymbol;const h=uf.symbol(Object.assign({x:n.x,y:n.y},o));h.name=vT.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=uf.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=vT.background,n.id=this._getNodeId("background"),n.states=j({},yT,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}const{labelHoverOnAxis:s}=this.attribute;s&&s.visible&&this.renderLabelHoverOnAxis()}renderLabelHoverOnAxis(){const t=this.getLabelHoverOnAxisAttribute(),e=new UM(Object.assign({},t));e.name=vT.title,e.id=this._getNodeId("hover-on-label"),this.labelHoverOnAxisGroup=e,this.axisContainer.add(e)}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=wC(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];P(l)||(c.state={line:j({},yT,l),symbol:j({},yT,l)});const d=new fT(c);d.name=vT.line,d.id=this._getNodeId("line"),t.add(d)}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}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:d}=s,p=wC(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),_=this.getRelativeVector();let y=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+L(this.attribute,"label.space",4);y+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===_[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?y+=i+(e-1)*t:y=0}else if(0===_[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;y+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}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.getActualOffset(x),A=this.getVerticalCoord(v,S,!1),M=this.getVerticalVector(S,!1,{x:0,y:0});let T,w,{angle:C}=p;if(T="start"===n?"start":"end"===n?"end":"center",u(C)&&o){C=PM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;w=1==-1*t?"bottom":"top"}else T=this.getTextAlign(M),w=this.getTextBaseline(M,!1);let E=d;if(u(E)){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(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=s-S;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=s-S}const B=Object.assign(Object.assign(Object.assign({},A),p),{maxWidth:E,textStyle:Object.assign({textAlign:T,textBaseline:w},a),state:{text:j({},yT,c.text),shape:j({},yT,c.shape),panel:j({},yT,c.background)}});return B.angle=C,l&&l.visible&&(B.shape=Object.assign({visible:!0},l.style),l.space&&(B.space=l.space)),h&&h.visible&&(B.panel=Object.assign({visible:!0},h.style)),B}getLabelHoverOnAxisAttribute(){var t,e;const{orient:i}=this.attribute,s=this.attribute.labelHoverOnAxis,{position:n=0,space:r=4,autoRotate:a=!0,textStyle:o={},background:l={},formatMethod:h,text:c="",maxWidth:d}=s,p=wC(s,["position","space","autoRotate","textStyle","background","formatMethod","text","maxWidth"]),g=this.getTickCoord(0);"bottom"===i||"top"===i?g.x=n:g.y=n;let f=0;(null===(t=this.attribute.tick)||void 0===t?void 0:t.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(e=this.attribute.subTick)||void 0===e?void 0:e.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const m=f+0+r,v=this.getVerticalCoord(g,m,!1),_=this.getVerticalVector(m,!1,{x:0,y:0});let y,{angle:b}=p,x="center";if(u(b)&&a){b=PM(this.getRelativeVector(),[1,0],!0);const{verticalFactor:t=1}=this.attribute;y=1==-1*t?"bottom":"top"}else{const{textAlign:t,textBaseline:e}=this.getLabelAlign(_,!1,o.angle);x=t,y=e}const S=d,A=h?h(c):c,k=Object.assign(Object.assign(Object.assign({},v),p),{maxWidth:S,textStyle:Object.assign({textAlign:x,textBaseline:y},o),text:A});return k.angle=b,l&&l.visible&&(k.panel=Object.assign(Object.assign({visible:!0},p.panel),l.style)),k}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 GT(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return YT(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=$(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(P(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(P(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,a=s;for(t.length>2&&("bottom"===i||"top"===i?Math.abs(t[1].attribute.x-t[0].attribute.x)0&&(r=a.length);n{t.attribute.angle=ae(e)})),UT(i,t),!NT(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(P(t)||!k(i))return;const a=t[0].attribute.angle,o=kT(a),l=AT(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=XT(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);k(i)&&(c=Yt(c,i))}}else{if(l){const i=XT(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);k(i)&&(c=Yt(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&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);$T(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&VT(t,{orient:o,method:m,separation:v,lastVisible:_,firstVisible: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=uf.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=vT.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-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(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 f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=RM(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=ri(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}showLabelHoverOnAxis(t,e,i=!0){if(this.attribute.labelHoverOnAxis){const s=this.axisContainer.AABBBounds,n=s.width(),r=s.height(),a=s.x1,o=s.y1,l=s.x2,h=s.y2;if(this.labelHoverOnAxisGroup){const{formatMethod:i}=this.attribute.labelHoverOnAxis,s=i?i(e):e;this.labelHoverOnAxisGroup.setAttribute("text",s),this.labelHoverOnAxisGroup.setAttribute("visible",!0),this.labelHoverOnAxisGroup.setAttribute("visibleAll",!0),"left"===this.attribute.orient||"right"===this.attribute.orient?this.labelHoverOnAxisGroup.setAttributes({y:t}):this.labelHoverOnAxisGroup.setAttributes({x:t})}else this.attribute.labelHoverOnAxis.visible=!0,this.attribute.labelHoverOnAxis.position=t,this.attribute.labelHoverOnAxis.text=e,this.renderLabelHoverOnAxis();if(i){const i=this.axisContainer.AABBBounds,s=i.width()-n,c=i.height()-r;s>0&&("top"===this.attribute.orient||"bottom"===this.attribute.orient)&&(i.x1l&&this.showLabelHoverOnAxis(t-s,e,!1)),c>0&&("left"===this.attribute.orient||"right"===this.attribute.orient)&&(i.y1h&&this.showLabelHoverOnAxis(t-c,e,!1))}}}hideLabelHoverOnAxis(){this.attribute.labelHoverOnAxis&&this.labelHoverOnAxisGroup&&this.labelHoverOnAxisGroup.setAttributes({visible:!1,visibleAll:!1})}getActualOffset(t){const e=this.attribute.orient;return"left"===e||"right"===e?this.attribute.width?this.attribute.width:(this.attribute.maxWidth&&(t=Math.min(t,this.attribute.maxWidth)),this.attribute.minWidth&&(t=Math.max(t,this.attribute.minWidth)),t):t}release(){super.release(),this._breaks=null}}CC.defaultAttributes=bT,G(CC,KT);class EC{isInValidValue(t){const{startAngle:e=nM,endAngle:i=rM}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=nM,endAngle:i=rM,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return he(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t,e=!1,i){return wT(t,i,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function BC(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=BC(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var RC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),k(l)&&l>=3){const t=CT(n,l,c,e,i);h=uf.path(Object.assign(Object.assign({},a.style),{path:ET(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=uf.circle(t)}h.name=vT.line,h.id=this._getNodeId("line"),P(a.state)||(h.states=j({},yT,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=RC(a,["space","textStyle","shape","background","state"]);let g=s,f=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(f=L(this.attribute.label,"style.fontSize",12)+L(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=n+m+f+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:j({},yT,d.text),shape:j({},yT,d.shape),panel:j({},yT,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;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(pt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=BC(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&PC(e,c,i)}else e.AABBBounds.width()>r&&PC(e,r,i)}else o>a.x&&h.x2>n.x2?(PC(e,n.x2-o,i),r&&LC(t,s,n)):o0?i.setAttributes({maxLineWidth:a}):i.setAttributes({maxLineWidth:0})}}getTextBaseline(t){return Math.abs(t[1]/t[0])<.3?"middle":t[1]<0?"bottom":t[1]>0?"top":"middle"}getLabelAlign(t,e,i){return pt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}OC.defaultAttributes=bT,G(OC,EC);const IC=t=>t.map(((t,e)=>({index:e,value:t}))),DC=(t,e,i=0)=>{const s=new Ve(t).expand(i/2),n=new Ve(e).expand(i/2);return s.intersects(n)},FC=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s,n,r;const{labelStyle:a,axisOrientType:o,labelFlush:l,labelFormatter:h,startAngle:c=0}=i;let d=null!==(s=a.angle)&&void 0!==s?s:0;"vertical"===a.direction&&(d+=ae(90));const u=["bottom","top"].includes(o),p=["left","right"].includes(o);let g=1,f=0;u||(p?(g=0,f=1):c&&(g=Math.cos(c),f=-Math.sin(c)));const v=LM(a),_=t.range();let y=[];for(let i=0;i{HC[t]=!0}));const GC=t=>-Math.log(-t),YC=t=>-Math.exp(-t),$C=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,XC=t=>10===t?$C:t===Math.E?Math.exp:e=>Math.pow(t,e),KC=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),qC=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),ZC=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function JC(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 QC(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function tE(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function eE(t,e,i,s){return 1===i&&(i=0),tE(t,i,s)*(e/(1-i))}function iE(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function sE(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=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 rE{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=iE(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}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const aE=Symbol("implicit");class oE extends rE{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=jC.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=aE}clone(){const t=(new oE).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!==aE)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&&a>1;)a-=1,r=Math.floor((e-t)/a);return lE(t,e,r,n)}class cE extends oE{constructor(t){super(),this.type=jC.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=eE(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)){const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;if("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),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]}}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(t=10){const e=this.calculateVisibleDomain(this._range);return-1===t?e:hE(0,e.length-1,t,!1).map((t=>e[t]))}tickData(t=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(t=10){const e=this.calculateVisibleDomain(this._range);return hE(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=yt(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,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 cE(!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:dE}=ni;function uE(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=ei.parseColorString(e)){const e=dE(ei.parseColorString(t),s);return t=>e(t).formatRgb()}return At(Number(t),Number(e))}return e instanceof ii?dE(t,e):e instanceof ei?dE(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 pE extends rE{constructor(t=WC,e=WC){super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=WC,this._piecewise=QC,this._interpolate=uE}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,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=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?sE:QC,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:WC),this.rescale(i)):this._clamp!==WC}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(t=10){return[]}tickData(t=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 gE=Math.sqrt(50),fE=Math.sqrt(10),mE=Math.sqrt(2),vE=[1,2,5,10],_E=(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=SE(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?bE(0,-(e-1)/s,s):bE((e-1)/s,0,s)},yE=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 _E(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return _E(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=bE(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=bE(t,e,l);return n&&r.reverse(),r})),SE=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=vE[0];return i>=gE?s=vE[3]:i>=fE?s=vE[2]:i>=mE&&(s=vE[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function AE(t,e,i){const s=(e-t)/Math.max(0,i);return SE(s)}function kE(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;e0;){if(s=AE(a,o,e).step,s===i)return t[n]=a,t[r]=o,t;if(s>0)a=Math.floor(a/s)*s,o=Math.ceil(o/s)*s;else{if(!(s<0))break;a=Math.ceil(a*s)/s,o=Math.floor(o*s)/s}i=s}}function TE(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 wE=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),CE=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})),EE=mt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=xE(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?wE(t,e,n):wE(t,e,nE(n)),h=wE(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),BE=mt(((t,e,i,s,n)=>kE(s(t),s(e),i).map((t=>nE(n(t))))));class PE extends pE{constructor(){super(...arguments),this.type=jC.Linear}clone(){var t;const e=new PE;return e.domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate),this._niceType&&(e._niceType=this._niceType,e._domainValidator=this._domainValidator,e._niceDomain=null===(t=this._niceDomain)||void 0===t?void 0:t.slice()),e}tickFormat(){return()=>{}}d3Ticks(t=10,e){const i=this.calculateVisibleDomain(this._range);return yE(i[0],i[i.length-1],t,e)}ticks(t=10,e){var i;if(d(null==e?void 0:e.customTicks))return e.customTicks(this,t);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=xE(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(t=10){const e=this.calculateVisibleDomain(this._range);return kE(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(;++r{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===l?t[t.length-1]=null!==(n=o[1])&&void 0!==n?n:t[t.length-1]:"max"===l&&(t[0]=null!==(r=o[0])&&void 0!==r?r: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}}function RE(t){return e=>-t(-e)}function OE(t=Number.EPSILON){return e=>Math.max(e,t)}class IE extends pE{constructor(){super(KC(10),XC(10)),this.type=jC.Log,this._limit=OE(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new IE).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=KC(this._base),s=XC(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=RE(i),this._pows=RE(s),this._limit=function(t=Number.EPSILON){return e=>Math.min(e,-t)}(),this.transformer=GC,this.untransformer=YC):(this._logs=i,this._pows=s,this._limit=OE(),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 WC}d3Ticks(t=10,e){const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return CE(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return EE(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return BE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return BE(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{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))))}}}G(IE,LE);class DE extends PE{constructor(){super(qC(1),ZC(1)),this.type=jC.Symlog,this._const=1}clone(){return(new DE).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=qC(t),this.untransformer=ZC(t),this.rescale(e)):this._const}d3Ticks(t=10,e){const i=this.domain(),s=i[0],n=i[i.length-1];return CE(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(t=10){const e=this.calculateVisibleDomain(this._range);return EE(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(t=10){const e=this.calculateVisibleDomain(this._range);return BE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return BE(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}G(DE,LE);class FE{constructor(){this.type=jC.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 FE).domain(this._domain).range(this._range).unknown(this._unknown)}}function zE(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function jE(t,e,i,s,n=!1){if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s,n,r;if(!VC(t.type))return IC(t.domain());const a=t.range(),o=Math.abs(a[a.length-1]-a[0]);if(o<2)return IC([t.domain()[0]]);const{tickCount:l,forceTickCount:h,tickStep:c,noDecimals:u=!1,labelStyle:g,breakData:f}=e;let m;if(p(c))v=t.stepTicks(c),_=f&&f()?f().breakDomains:null,m=_&&_.length?v.filter((t=>_.every((e=>te[1])))):v;else if(p(h))m=zE(e,t,h,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==i?i:5;m=zE(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:u}):t.d3Ticks(e,{noDecimals:u})))}else{const i=null!==(s=d(l)?l({axisLength:o,labelStyle:g}):l)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;m=zE(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:u,customTicks:n}):t.ticks(e,{noDecimals:u,customTicks:n})))}var v,_;const y=t.domain();if(e.labelFirstVisible&&y[0]!==m[0]&&!m.includes(y[0])&&m.unshift(y[0]),e.labelLastVisible&&y[y.length-1]!==m[m.length-1]&&!m.includes(y[y.length-1])&&m.push(y[y.length-1]),e.sampling&&m.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e,a=6;let l;if(m.length*a>o){const i=[],s=Math.floor(m.length*a/o);m.forEach(((t,e)=>{e%s!=0&&e!==m.length-1||i.push(t)})),l=null===(n=zC(t,i,e))||void 0===n?void 0:n.map(((t,e)=>({AABBBounds:t,value:i[e]})))}else l=null===(r=zC(t,m,e))||void 0===r?void 0:r.map(((t,e)=>({AABBBounds:t,value:m[e]})));if(l){const t=l[0],n=$(l),r=f&&f()?VE.greedy:VE.parity;for(;l.length>=3&&PT(l,i);)l=r(l,i);const a=e.labelFirstVisible;let o=e.labelLastVisible;BT(t,n,i)&&l.includes(n)&&l.length>1&&a&&o&&(l.splice(l.indexOf(n),1),o=!1),jE(t,l,a,(e=>BT(e,t,i))),jE(n,l,o,(e=>BT(e,n,i)||!(!a||e===t)&&BT(e,t,i)),!0);const h=l.map((t=>t.value));h.length<3&&s&&(h.length>1&&h.pop(),$(h)!==$(m)&&h.push($(m))),m=h}}return IC(m)},VE={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&BT(i,t,e)||(i=t,0))))}},NE=(t,e,i,s)=>{const n=zC(t,e,i);return n&&n.map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()]))},UE=(t,e,i=0)=>Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2,WE=(t,e)=>t[1]{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),g=t.range(),f=t.calculateWholeRangeSize();if(f<2)return e.labelLastVisible?IC([s[s.length-1]]):IC([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:f,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=K(g),a=X(g);if(s.length<=f/n){const i=NE(t,s,e,c);if(i){const n=Math.min(...i.map((t=>t[2]))),l=(a-r)/s.length,h=YE(s,i,o,e.labelLastVisible,Math.floor(n/l),!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=NE(t,i,e,c);if(n){let i=null;n.forEach((t=>{i?i[2]0?Math.ceil(s.length*(o+i[2])/(a-r-o)):s.length-1;m=t.stepTicks(l),!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])){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&&!UE(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?WE(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{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=LM(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),f={x:0,y:0};let m=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=he({x:0,y:0},i,t),a=TT(r,wT(s,r,e,n));return o=a,l=wT(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,f,h,a,l);return _.align||(pt(y,f.x)?_.baseline||(_.baseline=b>f.y?"top":"bottom"):y>f.x?_.align="left":y{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||h<=0)return IC(t.domain());let c;if(p(n))c=t.stepTicks(n);else if(p(s))c=t.forceTicks(s);else if(p(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=d(i)?i({axisLength:s,labelStyle:l}):i;c=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=$E(t,i,e),r=K(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=KE(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-p)}else c=t.domain();return IC(c)},KE=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&DC(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}},qE=new Uint32Array(33),ZE=new Uint32Array(33);ZE[0]=0,qE[0]=~ZE[0];for(let t=1;t<=32;++t)ZE[t]=ZE[t-1]<<1|1,qE[t]=~ZE[t];function JE(t,e,i={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:({x1:s,y1:n,x2:r,y2:a})=>{if(r<0||a<0||s>t||n>e)return!0;let o,l,h,c,d=a;for(;d>=n;--d)if(o=d*t+s,l=d*t+r,h=o>>>5,c=l>>>5,h===c){if(i[h]&qE[31&o]&ZE[1+(31&l)])return!0}else{if(i[h]&qE[31&o])return!0;if(i[c]&ZE[1+(31&l)])return!0;for(let t=h+1;t{if(r<0||a<0||i>t||n>e)return;let o,l,h,c,d;for(;n<=a;++n)if(o=n*t+i,l=n*t+r,h=o>>>5,c=l>>>5,h===c)s(h,qE[31&o]&ZE[1+(31&l)]);else for(s(h,qE[31&o]),s(c,ZE[1+(31&l)]),d=h+1;d{let a,o,l,h,c;for(;i<=r;++i)if(a=i*t+e,o=i*t+s,l=a>>>5,h=o>>>5,l===h)n(l,ZE[31&a]|qE[1+(31&o)]);else for(n(l,ZE[31&a]),n(h,qE[1+(31&o)]),c=l+1;ci<0||s<0||r>=e||n>=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 QE(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,{top:a=0,left:o=0,right:l=0,bottom:h=0}=t.padding,c=vt(i,-o,t.width+l),d=vt(s,-o,t.width+l),u=vt(n,-a,t.height+h),p=vt(r,-a,t.height+h);return{x1:t.x(c),x2:t.x(d),y1:t.y(u),y2:t.y(p)}}function tB(t,e,i=!1){return i?QE(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function eB(t,e,i,s=!0,n=0){let r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=tB(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=QE(t,r)),e.getRange(r)))}function iB(t,e,i,s=[],n=!0,r=0,a=!1){var o,l,h,c;const d=s.filter((t=>p(t))),u=null!==(o=i.attribute.x)&&void 0!==o?o:0,g=null!==(l=i.attribute.y)&&void 0!==l?l:0,f=i.AABBBounds,m={x1:f.x1,x2:f.x2,y1:f.y1,y2:f.y2};let v;for(let i=0;ia(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return iB(t,e,n,o,h,c,l)}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 iB(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 iB(t,e,n,s,h,c)}return!1}const nB=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],rB=["top","inside-top","inside"];function aB(t,e,i,s={}){const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=e+c,v=i+d;let _=0,y=0;return u<0-h?_=-u:p>m&&(_=m-p),g<0-l?y=-g:f>v&&(y=v-f),{dx:_,dy:y}}const oB={mode:"same-time",duration:300,easing:"linear"};function lB(t){return 3===t||4===t}function hB(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 cB=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 dB(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)}}var uB=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{h=Math.max(h,t.getStartTime()+t.getTotalDuration())})):"after-all"===a?n&&n.forEach((t=>{t.animates&&t.animates.forEach((t=>{h=Math.max(h,t.getStartTime()+t.getTotalDuration())}))})):s.animates&&s.animates.forEach((t=>{h=Math.max(h,t.getStartTime())})),t.animate(l,Object.assign(Object.assign({},r),{duration:e,easing:i,startTime:h,type:o})),this.completeBind(t)}tryPreventConflict(){}}const fB=(t,e)=>Math.ceil(t)>Math.floor(e),mB=([t,e],[i,s])=>s>t&&e>i;function vB(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}var _B=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{const e=t.target;e===this._lastHover||P(e.states)||(e.addState(oM.hover,!0),_M(this,(t=>{t===e||P(t.states)||t.addState(oM.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(_M(this,(t=>{P(t.states)||(t.removeState(oM.hoverReverse),t.removeState(oM.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void _M(this,(t=>{P(t.states)||(t.removeState(oM.selectedReverse),t.removeState(oM.selected))}));P(e.states)||(e.addState(oM.selected,!0),_M(this,(t=>{t===e||P(t.states)||t.addState(oM.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)===Ko.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===Ko.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(Se(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,f=p-d;return[dB(g,f,c,d,a,o),dB(-g,-f,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds)}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=uf.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Ul)}return e&&e.getAttributes(!0).fill&&s.setAttribute("stroke",e.getAttributes(!0).fill),this.attribute.line&&!P(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;const t=[];!1!==this._enableAnimation&&this._baseMarks.forEach((e=>{t.push(e.attribute),e.initAttributes(e.getAttributes(!0))}));const{overlap:e,smartInvert:i,dataFilter:s,customLayoutFunc:n,customOverlapFunc:r}=this.attribute;let a=this.attribute.data;if(d(s)&&(a=s(a)),a&&a.length){const t=new Set;a=a.filter((e=>!t.has(e.id)&&t.add(e.id)))}let o=this._initText(a);o=d(n)?n(a,o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this):this._layout(o);const l=[],h=o;if(!c(e)&&d(null==e?void 0:e.filterBeforeOverlap)){const t=this.getRelatedGraphic.bind(this);o.forEach((i=>{e.filterBeforeOverlap(i,t,this)?h.push(i):l.push(i)}))}d(r)?o=r(h,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this).concat(l):!1!==e&&(o=this._overlapping(h).concat(l)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(o,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null,this),o&&o.length&&o.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==i&&this._smartInvert(o),this._renderLabels(o),!1!==this._enableAnimation&&this._baseMarks.forEach(((e,i)=>{e.initAttributes(t[i])}))}_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&&!P(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!P(e)&&(t.states=e)}_createLabelText(t){var e,i;return DM(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;const i=[];let s;if(s=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),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e!!t&&!0!==t)):a.stroke:a.fill},e),n),l=this._createLabelText(o);i.push(l)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity&&this.isMarkInsideRect(this.getRelatedGraphic(t.attribute),i)));const{clampForce:r=!0,hideOnHit:a=!0,hideOnOverflow:o=!1,overlapPadding:l,strategy:h}=e;if(r||o)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&fB(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&fB(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(pt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(vB([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!mB([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let y=0,b=t.length-1;for(;y<=b;)y===b?_.push(t[y]):(_.push(t[y]),_.push(t[b])),y++,b--;return _}(n,Object.assign(Object.assign({maxY:i.height},h),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&s.setRange(tB(i,t.AABBBounds,!0))}))),h.length>0&&h.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&&s.setRange(tB(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(tB(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t,e={},i){var s;if(t){if(!1!==t.attribute.visible){if(null===(s=t.context)||void 0===s?void 0:s.animationState){const e=t.clone();return Object.assign(e.attribute,t.getAttributes(!0)),e.AABBBounds}return t.AABBBounds}const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}if(e&&i&&"inside-middle"===i){const{x:t,y:i,x1:s=t,y1:n=i}=e;return{x1:(t+s)/2,x2:(t+s)/2,y1:(i+n)/2,y2:(i+n)/2}}const{x:n,y:r}=e;return{x1:n,x2:n,y1:r,y2:r}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;o&&(u=this._createLabelLine(t,h));const p=u?{text:t,labelLine:u}:{text:t};if(i&&this.updateStatesOfLabels([p],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,p),this._addLabel(p,r,a,e);else if("update"===d){const t=n.get(c);n.delete(c),s.set(c,t),this._updateLabel(t,p)}})),this._removeLabel(n),this._graphicToText=s}runEnterAnimation(t,e){if(!1===this._enableAnimation||!this._animationConfig.enter)return;const i=this.getRelatedGraphic(t.attribute),{enter:s}=this._animationConfig;[t,e].filter(Boolean).forEach((e=>{var n;null===(n=e.setFinalAttributes)||void 0===n||n.call(e,e.attribute),e.applyAnimationState(["enter"],[{name:"enter",animation:Object.assign(Object.assign({},s),{type:"labelEnter",selfOnly:!0,customParameters:{relatedGraphic:i,relatedGraphics:this._idToGraphic,config:Object.assign(Object.assign({},s),{type:e===t?s.type:"fadeIn"})}})}])}))}_runUpdateAnimation(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;i.applyAnimationState(["update"],[{name:"update",animation:{type:"labelUpdate",customParameters:Object.assign(Object.assign({},this._animationConfig.update),{prevText:i,curText:n,prevLabelLine:s,curLabelLine:r})}}])}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterStateUpdate",this._handleRelatedGraphicSetState)}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);this._syncStateWithRelatedGraphic(a),n&&this.add(n),r&&this.add(r),this.runEnterAnimation(n,r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;!1===this._enableAnimation||!1===this._animationConfig.update?(t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)):this._runUpdateAnimation(t,e)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};!1!==this._enableAnimation&&!1!==this._animationConfig.exit?t.forEach((t=>{var i;t.text.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{e(t)})),null===(i=t.labelLine)||void 0===i||i.applyAnimationState(["exit"],[{name:"exit",animation:Object.assign(Object.assign({},this._animationConfig.exit),{type:"fadeOut"})}],(()=>{}))})):t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:p}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{bB[t]=e};var SB=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{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,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*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}})(t,e,i,s)}}AB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const kB=()=>{xB("symbol",AB),xB("line-data",AB)};var MB=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{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}})(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}}}TB.tag="rect-label",TB.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var wB=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{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?0:s.length-1;return s[r]?{x1:s[r].x,x2:s[r].x,y1:s[r].y,y2:s[r].y}:void 0}labeling(t,e,i="end",s=0){return function(t,e,i="end",s=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}}(t,e,i,s)}};CB.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const EB=()=>{xB("line",CB),xB("area",CB)};var BB=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);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=d(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=d(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,r.refArc&&"arc3d"===r.refArc.type&&(e.anchor3d=[r.circleCenter.x-e.x,r.circleCenter.y-e.y],e.beta=r.refArc.attribute.beta),n[t].setAttributes(e)}}return n}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),h=l.getAttributes(!0),c={x:null!==(r=null==h?void 0:h.x)&&void 0!==r?r:0,y:null!==(o=null==h?void 0:h.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=(h.startAngle+h.endAngle)/2,u=h.endAngle-h.startAngle,p=ge(h.endAngle-u/2),g=he(c,h.outerRadius,o),f=he(c,a+e.line.line1MinLength,o),m=new PB(t,g,f,p,u,o,h.innerRadius,h.outerRadius,c);m.refArc=l,m.pointA=he(c,this.computeDatumRadius(2*c.x,2*c.y,h.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(d=m.quadrant)||2===d?this._arcRight.set(m.refDatum,m):lB(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var d}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":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 f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,_=0;if("inside"===o&&(_="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=he(t.circleCenter,v,t.middleAngle),t.labelLimit=f,gt(f,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.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=lB(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=lB(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.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 c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(ft(t.pointB.x,this._line2MinLength+h)||gt(t.pointB.x,c-this._line2MinLength-h))&&(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(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;k(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=lB(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-y-c:0+y+c;break;default:m=p.x+f*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+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?lB(t.quadrant)?"left":"right":lB(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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*(lB(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.getAttributes(!0).outerRadius>r&&(r=t.getAttributes(!0).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,f,m;if(pt(l/2,u))g=0,f=1,m=-p;else if(pt(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,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,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?pt(v[0].y,v[1].y)?gt(t.middleAngle,-Math.PI)&&ft(t.middleAngle,0)||gt(t.middleAngle,Math.PI)&&ft(t.middleAngle,2*Math.PI)?(_=0,y=v[1].y+h/2):(_=v[1].y+h/2,y=h):v[0].y{t.getAttributes(!0).outerRadius>a&&(a=t.getAttributes(!0).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;e{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 IB(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=re.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 DB(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=ET(t,!!n),o=ET(r,!!n);const h=re.distancePP(s,l),c=re.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=IB(e,t,!1,!!n),o=IB(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=ET(t,!!n),o=ET(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}OB.defaultAttributes={pickable:!1};class FB extends Qy{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&MT(this._innerView),this.removeAllChild(!0),this._innerView=uf.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 TT(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:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${vT.grid}-sub`:`${vT.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=ET(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=IB(t,o,!1,!!a)}const u=uf.path(Object.assign({path:c,z:l},d(r)?j({},this.skipDefault?null:FB.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 f=ET(o,!!a),m=Nt(o[0].x-o[1].x),v=Nt(o[0].y-o[1].y),_=uf.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*zt/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?j({},this.skipDefault?null:FB.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],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!pt(a.value,0)&&!pt(l.value,0),d=!pt(a.value,1)&&!pt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}FB.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},zk(),Wk();class zB extends FB{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},FB.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=nM,endAngle:r=rM}=this.attribute;i=CT(t,s,re.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=j({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);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})}}G(zB,KT);var jB,HB,VB,NB=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){const e=this._getPointsOfSubGrid(p,d);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"})}}G(UB,EC),function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(jB||(jB={})),function(t){t.stateUpdate="stateUpdate",t.maskUpdate="maskUpdate",t.dataZoomUpdate="dataZoomUpdate"}(HB||(HB={})),function(t){t.dataZoomChange="dataZoomChange"}(VB||(VB={}));const WB="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",GB={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:WB,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:WB,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},YB={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}},$B=0,XB=1,KB=2,qB=3,ZB=4,JB=5,QB=5,tP=999,eP=(t,e,i,s)=>{if(!e)return!1;if(s){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1};var iP=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;const{showDetail:e}=t.attribute;this._showText="auto"!==e&&e,this._initAttrs(t)}setAttributes(t){this._initAttrs(t)}renderDataZoom(t=!1){var e,i,s,n,r,a;const{backgroundChartStyle:o={},selectedBackgroundChartStyle:l={},brushSelect:h}=this.attribute;this._renderBackground(),(null===(e=o.line)||void 0===e?void 0:e.visible)&&!t&&this._setPreviewAttributes("line",this._getContainer()),(null===(i=o.area)||void 0===i?void 0:i.visible)&&!t&&this._setPreviewAttributes("area",this._getContainer()),h&&this.renderDragMask(),this._renderSelectedBackground(),(null===(s=l.line)||void 0===s?void 0:s.visible)&&this._setSelectedPreviewClipAttributes("line",this._getContainer()),(null===(n=l.line)||void 0===n?void 0:n.visible)&&!t&&this._setSelectedPreviewAttributes("line"),(null===(r=l.line)||void 0===r?void 0:r.visible)&&this._setSelectedPreviewClipAttributes("area",this._getContainer()),(null===(a=l.area)||void 0===a?void 0:a.visible)&&!t&&this._setSelectedPreviewAttributes("area"),this._renderHandler(),this._showText&&this.renderText()}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this._getLayoutAttrFromConfig(),{start:n,end:r}=this._getState();return this._isHorizontal?this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x+n*i,y:e.y,width:(r-n)*i,height:s,zIndex:KB},t),"rect"):this._dragMask=this._getContainer().createOrUpdateChild("dragMask",Object.assign({x:e.x,y:e.y+n*s,width:i,height:(r-n)*s,zIndex:KB},t),"rect"),{start:n,end:r}}_renderBackground(){var t;const{backgroundStyle:e,brushSelect:i,zoomLock:s}=this.attribute,{position:n,width:r,height:a}=this._getLayoutAttrFromConfig(),o=this._getContainer();this._background=o.createOrUpdateChild("background",Object.assign(Object.assign({x:n.x,y:n.y,width:r,height:a,cursor:i?"crosshair":"auto",zIndex:$B},e),{pickable:!s&&(null===(t=e.pickable)||void 0===t||t)}),"rect")}_renderHandler(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,k,M,T;const{orient:w,middleHandlerStyle:C={},startHandlerStyle:E={},endHandlerStyle:B={},zoomLock:P}=this.attribute,{start:L,end:R}=this._getState(),{position:O,width:I,height:D}=this._getLayoutAttrFromConfig(),F=null!==(t=E.triggerMinSize)&&void 0!==t?t:40,z=null!==(e=B.triggerMinSize)&&void 0!==e?e:40,j=this._getContainer();if(this._isHorizontal){if(C.visible){const t=(null===(i=C.background)||void 0===i?void 0:i.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:O.x+L*I,y:O.y-t,width:(R-L)*I,height:t,zIndex:JB},null===(s=C.background)||void 0===s?void 0:s.style),{pickable:!P&&(null===(a=null===(r=null===(n=C.background)||void 0===n?void 0:n.style)||void 0===r?void 0:r.pickable)||void 0===a||a)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:O.x+(L+R)/2*I,y:O.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(l=null===(o=C.icon)||void 0===o?void 0:o.symbolType)&&void 0!==l?l:"square",zIndex:JB},C.icon),{pickable:!P&&(null===(h=C.icon.pickable)||void 0===h||h)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:O.x+L*I,y:O.y+D/2,size:D,symbolType:null!==(c=E.symbolType)&&void 0!==c?c:"square"},YB.horizontal),{zIndex:JB}),E),{pickable:!P&&(null===(d=E.pickable)||void 0===d||d)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:O.x+R*I,y:O.y+D/2,size:D,symbolType:null!==(u=B.symbolType)&&void 0!==u?u:"square"},YB.horizontal),{zIndex:JB}),B),{pickable:!P&&(null===(p=B.pickable)||void 0===p||p)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),g=Math.max(this._endHandler.AABBBounds.width(),z),f=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:O.x+L*I-t/2,y:O.y+D/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:tP},YB.horizontal),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:O.x+R*I-g/2,y:O.y+D/2-f/2,width:g,height:f,fill:"white",fillOpacity:0,zIndex:tP},YB.horizontal),{pickable:!P}),"rect")}else{if(C.visible){const t=(null===(g=C.background)||void 0===g?void 0:g.size)||10;this._middleHandlerRect=j.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===w?O.x-t:O.x+I,y:O.y+L*D,width:t,height:(R-L)*D,zIndex:JB},null===(f=C.background)||void 0===f?void 0:f.style),{pickable:!P&&(null===(_=null===(v=null===(m=C.background)||void 0===m?void 0:m.style)||void 0===v?void 0:v.pickable)||void 0===_||_)}),"rect"),this._middleHandlerSymbol=j.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===w?O.x-t/2:O.x+I+t/2,y:O.y+(L+R)/2*D,angle:Math.PI/180*90,symbolType:null!==(b=null===(y=C.icon)||void 0===y?void 0:y.symbolType)&&void 0!==b?b:"square",strokeBoundsBuffer:0,zIndex:JB},C.icon),{pickable:!P&&(null===(S=null===(x=C.icon)||void 0===x?void 0:x.pickable)||void 0===S||S)}),"symbol")}this._startHandler=j.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign(Object.assign({x:O.x+I/2,y:O.y+L*D,size:I,symbolType:null!==(A=E.symbolType)&&void 0!==A?A:"square"},YB.vertical),{zIndex:JB}),E),{pickable:!P&&(null===(k=E.pickable)||void 0===k||k)}),"symbol"),this._endHandler=j.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:O.x+I/2,y:O.y+R*D,size:I,symbolType:null!==(M=B.symbolType)&&void 0!==M?M:"square",zIndex:JB},YB.vertical),B),{pickable:!P&&(null===(T=B.pickable)||void 0===T||T)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),F),e=Math.max(this._startHandler.AABBBounds.height(),F),i=Math.max(this._endHandler.AABBBounds.width(),z),s=Math.max(this._endHandler.AABBBounds.height(),z);this._startHandlerMask=j.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:O.x+I/2+t/2,y:O.y+L*D-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:tP},YB.vertical),{pickable:!P}),"rect"),this._endHandlerMask=j.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:O.x+I/2+i/2,y:O.y+R*D-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:tP},YB.vertical),{pickable:!P}),"rect")}}_renderSelectedBackground(){var t,e;const{selectedBackgroundStyle:i={},selectedBackgroundChartStyle:s={},brushSelect:n,zoomLock:r}=this.attribute,{start:a,end:o}=this._getState(),{position:l,width:h,height:c}=this._getLayoutAttrFromConfig(),d=this._getContainer();this._isHorizontal?this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x+a*h,y:l.y,width:(o-a)*h,height:c,cursor:n?"crosshair":"move",zIndex:qB},i),{pickable:!r&&(null===(t=s.pickable)||void 0===t||t)}),"rect"):this._selectedBackground=d.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:l.x,y:l.y+a*c,width:h,height:(o-a)*c,cursor:n?"crosshair":"move",zIndex:qB},i),{pickable:!r&&(null===(e=i.pickable)||void 0===e||e)}),"rect")}_setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1,zIndex:XB},"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))}_setSelectedPreviewClipAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1,zIndex:ZB},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group"));const{start:i,end:s}=this._getState(),{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?n.x+i*r:n.x,y:this._isHorizontal?n.y:n.y+i*a,width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?n.x+i*r:n.x),y:-(this._isHorizontal?n.y:n.y+i*a),width:this._isHorizontal?(s-i)*r:r,height:this._isHorizontal?a:(s-i)*a,pickable:!1})}_setSelectedPreviewAttributes(t){const{selectedBackgroundChartStyle:e={}}=this.attribute;"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area"),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this._getPreviewLinePoints(),curveType:"basis",pickable:!1},e.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this._getPreviewAreaPoints(),curveType:"basis",pickable:!1},e.area))}_computeBasePoints(t){const{orient:e}=this.attribute,i="bottom"===e||"top"===e?"x":"y";let s=Math.sign(t[t.length-1][i]-t[0][i]);0===s&&(s=1);const{position:n,width:r,height:a}=this._getLayoutAttrFromConfig();let o,l;return this._isHorizontal?(o=[{x:n.x,y:n.y+a}],l=[{x:n.x+r,y:n.y+a}]):"left"===e?(o=[{x:n.x+r,y:n.y}],l=[{x:n.x+r,y:n.y+a}]):(o=[{x:n.x,y:n.y+a}],l=[{x:n.x,y:n.y}]),Math.sign(l[0][i]-o[0][i])!==s?{basePointStart:l,basePointEnd:o}:{basePointStart:o,basePointEnd:l}}_simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){return t.length<=10||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,void 0!==e?e*e:1)}(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(t);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(t);return e.concat(t).concat(i)}renderText(){let t=null,e=null;if(this._setTextAttr(t,e),this._showText){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 He).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)}}_setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=iP(c,["formatMethod"]),{formatMethod:g}=d,f=iP(d,["formatMethod"]),{start:m,end:v}=this._getState();this._startValue=this._statePointToData(m),this._endValue=this._statePointToData(v);const{position:_,width:y,height:b}=this._getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,A={x1:_.x,y1:_.y,x2:_.x+y,y2:_.y+b};let k,M,T,w;this._isHorizontal?(k={x:_.x+m*y,y:_.y+b/2},M={x:_.x+v*y,y:_.y+b/2},T={textAlign:eP(A,t,"start",this._isHorizontal)?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},w={textAlign:eP(A,e,"end",this._isHorizontal)?"right":"left",textBaseline:null!==(r=null===(n=null==f?void 0:f.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(k={x:_.x+y/2,y:_.y+m*b},M={x:_.x+y/2,y:_.y+v*b},T={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:eP(A,t,"start",this._isHorizontal)?"top":"bottom"},w={textAlign:null!==(h=null===(l=null==f?void 0:f.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:eP(A,e,"end",this._isHorizontal)?"bottom":"top"}),this._startText=this._maybeAddLabel(this._getContainer(),j({},p,{text:x,x:k.x,y:k.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T,zIndex:QB}),"data-zoom-start-text"),this._endText=this._maybeAddLabel(this._getContainer(),j({},f,{text:S,x:M.x,y:M.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w,zIndex:QB}),"data-zoom-end-text")}_maybeAddLabel(t,e,i){let s=t.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new UM(e),s.name=i,t.add(s)),s}}const nP={debounce:xt,throttle:St};class rP extends l{constructor(t){super(),this._activeState=!1,this._activeCache={startPos:{x:0,y:0},lastPos:{x:0,y:0}},this._layoutCache={attPos:"x",attSize:"width",size:0},this._handleTouchMove=t=>{this._activeState&&t.preventDefault()},this._onHandlerPointerDown=(t,e)=>{this.clearDragEvents(),"start"===e?(this._activeTag=jB.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=jB.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=jB.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=jB.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=jB.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this._eventPosToStagePos(t),this._activeCache.lastPos=this._eventPosToStagePos(t);const i="browser"===A_.env?A_:this.stage,s=dM();i.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.on("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{i.addEventListener(t,this._onHandlerPointerUp)}))},this._pointerMove=t=>{const{brushSelect:e}=this.attribute,{position:i}=this._getLayoutAttrFromConfig(),s=this._eventPosToStagePos(t),{attPos:n,size:r,attSize:a}=this._layoutCache,o=(s[n]-this._activeCache.lastPos[n])/r,l=(s[n]-i[n])/this._getLayoutAttrFromConfig()[a];let{start:h,end:c}=this._getState(),d=!0;this._activeState&&(this._activeTag===jB.middleHandler?({start:h,end:c}=this._moveZoomWithMiddle(o)):this._activeTag===jB.startHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"start")):this._activeTag===jB.endHandler?({start:h,end:c}=this._moveZoomWithHandler(l,"end")):this._activeTag===jB.background&&e&&(({start:h,end:c}=this._moveZoomWithBackground(l)),d=!1,this._dispatchEvent(HB.maskUpdate)),this._activeCache.lastPos=s),this._getState().start===h&&this._getState().end===c||(this._setStateAttr(h,c),this._dispatchEvent(HB.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:d,tag:this._activeTag}),this.attribute.realTime&&this._dispatchEvent(HB.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}))},this._onHandlerPointerUp=t=>{this._activeState&&this._activeTag===jB.background&&(this._setStateAttr(this._getState().start,this._getState().end),this._dispatchEvent(HB.stateUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag})),this._activeState=!1,this._dispatchEvent(HB.dataZoomUpdate,{start:this._getState().start,end:this._getState().end,shouldRender:!0,tag:this._activeTag}),this.clearDragEvents()},this._initAttrs(t)}setAttributes(t){var e,i,s,n,r,a;this._initAttrs(t),this._onHandlerPointerMove=0===(null!==(i=null===(e=this.attribute)||void 0===e?void 0:e.delayTime)&&void 0!==i?i:0)?this._pointerMove:nP[null!==(n=null===(s=this.attribute)||void 0===s?void 0:s.delayType)&&void 0!==n?n:"debounce"](this._pointerMove,null!==(a=null===(r=this.attribute)||void 0===r?void 0:r.delayTime)&&void 0!==a?a:0)}_initAttrs(t){this.stage=t.stage,this.attribute=t.attribute,this._startHandlerMask=t.startHandlerMask,this._endHandlerMask=t.endHandlerMask,this._middleHandlerSymbol=t.middleHandlerSymbol,this._middleHandlerRect=t.middleHandlerRect,this._selectedBackground=t.selectedBackground,this._background=t.background,this._previewGroup=t.previewGroup,this._selectedPreviewGroup=t.selectedPreviewGroup,this._getLayoutAttrFromConfig=t.getLayoutAttrFromConfig,this._getState=t.getState,this._setState=t.setState;const{width:e,height:i}=this._getLayoutAttrFromConfig();this._spanCache=this._getState().end-this._getState().start;const s="top"===this.attribute.orient||"bottom"===this.attribute.orient;this._layoutCache.size=s?e:i,this._layoutCache.attPos=s?"x":"y",this._layoutCache.attSize=s?"width":"height",this._getGlobalTransMatrix=t.getGlobalTransMatrix}clearDragEvents(){const t="browser"===A_.env?A_:this.stage,e=dM();t.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),e.forEach((e=>{t.removeEventListener(e,this._onHandlerPointerUp)})),this.off("pointermove",this._onHandlerPointerMove,{capture:!0})}clearVGlobalEvents(){("browser"===A_.env?A_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1})}bindEvents(){var t,e,i,s,n,r,a,o;const{brushSelect:l}=this.attribute;null===(t=this._startHandlerMask)||void 0===t||t.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),null===(e=this._endHandlerMask)||void 0===e||e.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),null===(i=this._middleHandlerSymbol)||void 0===i||i.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),null===(s=this._middleHandlerRect)||void 0===s||s.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const h=l?"background":"middleRect";null===(n=this._selectedBackground)||void 0===n||n.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),l&&(null===(r=this._background)||void 0===r||r.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),l&&(null===(a=this._previewGroup)||void 0===a||a.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background")))),null===(o=this._selectedPreviewGroup)||void 0===o||o.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,h))),("browser"===A_.env?A_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1})}_setStateAttr(t,e){const{zoomLock:i=!1,minSpan:s=0,maxSpan:n=1}=this.attribute,r=e-t;r!==this._spanCache&&(i||rn)||(this._spanCache=r,this._setState({start:t,end:e}))}_moveZoomWithMiddle(t){const{start:e,end:i}=this._getState();return t>0&&i+t>1?t=1-i:t<0&&e+t<0&&(t=-e),{start:vt(e+t,0,1),end:vt(i+t,0,1)}}_moveZoomWithHandler(t,e){const{start:i,end:s}=this._getState();let n=i,r=s;return"start"===e?t>s?(n=s,r=t,this._activeTag=jB.endHandler):n=t:"end"===e&&(ta&&([r,a]=[a,r]),{start:r,end:a}}_eventPosToStagePos(t){var e,i;const s={x:0,y:0},n=null!==(i=null===(e=this.stage)||void 0===e?void 0:e.eventPointTransform(t))&&void 0!==i?i:{x:0,y:0};return this._getGlobalTransMatrix().transformPoint(n,s),s}_dispatchEvent(t,e){this.emit(t,e)}}VM(),Xk(),tM(),Lk(),Nk();let aP=class t extends Qy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="dataZoom",this._state={start:0,end:1},this.getLayoutAttrFromConfig=()=>{var t,e,i,s,n,r;if(this._layoutCacheFromConfig)return this._layoutCacheFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,f=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let m,v,_;h.visible?this._isHorizontal?(m=p,v=g-f,_={x:a.x,y:a.y+f}):(m=p-f,v=g,_={x:a.x+("left"===l?f:0),y:a.y}):(m=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:m,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:m;return c.visible&&(this._isHorizontal?(m-=(y+b)/2,_={x:_.x+y/2,y:_.y}):(v-=(y+b)/2,_={x:_.x,y:_.y+y/2})),v+=(null!==(n=u.lineWidth)&&void 0!==n?n:2)/2,m+=(null!==(r=u.lineWidth)&&void 0!==r?r:2)/2,this._layoutCacheFromConfig={position:_,width:m,height:v},this._layoutCacheFromConfig};const{start:s,end:n,orient:r}=this.attribute;this._isHorizontal="top"===r||"bottom"===r,s&&(this._state.start=s),n&&(this._state.end=n),this._renderer=new sP(this._getRendererAttrs()),this._interaction=new rP(this._getInteractionAttrs())}_getRendererAttrs(){return{attribute:this.attribute,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getContainer:()=>this._container}}_getInteractionAttrs(){return{stage:this.stage,attribute:this.attribute,startHandlerMask:this._renderer.startHandlerMask,endHandlerMask:this._renderer.endHandlerMask,middleHandlerSymbol:this._renderer.middleHandlerSymbol,middleHandlerRect:this._renderer.middleHandlerRect,selectedBackground:this._renderer.selectedBackground,background:this._renderer.background,previewGroup:this._renderer.previewGroup,selectedPreviewGroup:this._renderer.selectedPreviewGroup,getLayoutAttrFromConfig:this.getLayoutAttrFromConfig,setState:t=>{this._state=t},getState:()=>this._state,getGlobalTransMatrix:()=>this.globalTransMatrix}}bindEvents(){this.attribute.disableTriggerEvent?this.setAttribute("childrenPickable",!1):(this._interaction.bindEvents(),this._interaction.on(HB.stateUpdate,(({shouldRender:t})=>{t&&this._renderer.renderDataZoom(!0)})),this._interaction.on(HB.dataZoomUpdate,(({start:t,end:e,tag:i})=>{this._dispatchEvent(VB.dataZoomChange,{start:t,end:e,tag:i})})),this._interaction.on(HB.maskUpdate,(()=>{this._renderer.renderDragMask()})),"auto"===this.attribute.showDetail&&(this._container.addEventListener("pointerenter",(()=>{this._renderer.showText=!0,this._renderer.renderText()})),this._container.addEventListener("pointerleave",(()=>{this._renderer.showText=!1,this._renderer.renderText()}))))}setAttributes(t,e){var i,s;const{start:n,end:r}=this.attribute;n&&(this._state.start=null!==(i=t.start)&&void 0!==i?i:n),r&&(this._state.end=null!==(s=t.end)&&void 0!==s?s:r),this._renderer.setAttributes(this._getRendererAttrs()),this._interaction.setAttributes(this._getInteractionAttrs()),super.setAttributes(t,e)}render(){this._layoutCacheFromConfig=null,this._container=this.createOrUpdateChild("datazoom-container",{},"group"),this._renderer.renderDataZoom(),this._interaction.setAttributes(this._getInteractionAttrs())}release(t){super.release(t),this._interaction.clearDragEvents()}setStartAndEnd(t,e){const{start:i,end:s}=this._state;p(t)&&p(e)&&(t!==i||e!==s)&&(this._state={start:t,end:e},this._renderer.renderDataZoom(!0),this._dispatchEvent(VB.dataZoomChange,{start:t,end:e}))}setPreviewData(t){this._renderer.previewData=t}setText(t,e){"start"===e?this._renderer.startText.setAttribute("text",t):this._renderer.endText.setAttribute("text",t)}getStartValue(){return this._renderer.startValue}getEndTextValue(){return this._renderer.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._renderer.previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._renderer.previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._renderer.previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._renderer.previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._renderer.statePointToData=t)}};var oP,lP,hP,cP;function dP(){zk(),VM(),Aw()}aP.defaultAttributes=GB,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"}(oP||(oP={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(lP||(lP={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(hP||(hP={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}(cP||(cP={}));class uP extends Qy{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=LT(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=RT(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=OT(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:j({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:j({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:j({},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=uf.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=uf.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=uf.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 pP(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 gP(t,e,i,s){t&&(pP(t.startSymbol,e,i,s),t.lines.forEach((t=>pP(t,e,i,s))),pP(t.line,e,i,s),pP(t.endSymbol,e,i,s))}function fP(t,e,i,s){t&&(pP(t.getTextShape(),e,i,s),pP(t.getBgRect(),e,i,s))}function mP(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 vP(t,e,i,s){t&&(mP(t.startSymbol,e,i,s),t.lines.forEach((t=>mP(t,e,i,s))),mP(t.line,e,i,s),mP(t.endSymbol,e,i,s))}function _P(t,e,i,s){t&&(mP(t.getTextShape(),e,i,s),mP(t.getBgRect(),e,i,s))}function yP(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;pP(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)})),pP(t.endSymbol,s+r+a,o,n),Y(e).forEach((t=>{const e=s+r+a+o;pP(t.getTextShape(),e,l,n),pP(t.getBgRect(),e,l,n)}))}function bP(t,e,i,s,n){gP(t,s,i,n),Y(e).forEach((t=>{fP(t,s,i,n)}))}function xP(t,e,i,s,n){pP(t,s,i,n),Y(e).forEach((t=>{fP(t,s,i,n)}))}function SP(t,e,i,s,n){pP(t,s,i,n),Y(e).forEach((t=>{fP(t,s,i,n)}))}function AP(t,e,i,s,n,r){var a;gP(t,n,s,r),pP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?fP(i,n,s,r):pP(i,n,s,r)}function kP(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;pP(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)})),pP(e,n+o+l,h,r),pP(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(pP(i.getTextShape(),n+o+l+h+c,d,r),pP(i.getBgRect(),n+o+l+c,d,r)):pP(i,n+o+l+c,d,r)}function MP(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?yP(t,e,s,r,a):"fadeIn"===i&&bP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?yP(t,e,s,n,a):"fadeIn"===i&&bP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){vP(t,s,i,n),Y(e).forEach((t=>{_P(t,s,i,n)}))}(t,e,i,s,n)}}function TP(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&&xP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&xP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){mP(t,s,i,n),Y(e).forEach((t=>{_P(t,s,i,n)}))}(t,e,i,s,n)}}function wP(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&&SP(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&SP(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){mP(t,s,i,n),Y(e).forEach((t=>{_P(t,s,i,n)}))}(t,e,i,s,n)}}function CP(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?AP(n,r,e,i,s,o):"callIn"===t&&kP(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?AP(n,r,e,i,s,a):"callIn"===t&&kP(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;vP(t,n,s,r),mP(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?_P(i,n,s,r):mP(i,n,s,r)}(n,r,e,t,i,s)}}const EP={type:"clipIn",duration:500,easing:"linear",delay:0},BP={type:"fadeIn",duration:500,easing:"linear",delay:0},PP={type:"callIn",duration:500,easing:"linear",delay:0},LP={type:"fadeOut",duration:500,easing:"linear",delay:0};class RP{getLabel(){return this._label}_addMarkLabels(t,e,i){const{label:s,state:n}=this.attribute,r=Y(null==n?void 0:n.label),a=Y(null==n?void 0:n.labelBackground),o=Y(s).map(((s,n)=>{var o,l;const h=j({},i,s),c=new UM(Object.assign(Object.assign({},h),{state:{panel:j({},lM,null!==(o=a[n])&&void 0!==o?o:$(a)),text:j({},lM,null!==(l=r[n])&&void 0!==l?l:$(r))}}));return c.name=e,t.add(c),this.setLabelPos(c,h),c}));this._label=1===Y(o).length?o[0]:o}_updateMarkLabels(t){const{label:e,state:i}=this.attribute,s=Y(this._label),n=Y(null==i?void 0:i.label),r=Y(null==i?void 0:i.labelBackground);if(s.length){const i=Y(e);s.forEach(((e,s)=>{var a,o;const l=j({},t,i[s]);e.setAttributes(Object.assign(Object.assign({dx:0,dy:0},l),{state:{panel:j({},lM,null!==(a=r[s])&&void 0!==a?a:$(r)),text:j({},lM,null!==(o=n[s])&&void 0!==o?o:$(n))}})),this.setLabelPos(e,l)}))}}}class OP extends uP{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=EP,this.defaultExitAnimation=LP}getLine(){return this._line}setLabelPos(t,e){const{limitRect:i}=this.attribute,{position:s,confine:n,autoRotate:r}=e,a=this.getPointAttrByPosition(s,e),o=s.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(t.setAttributes(Object.assign(Object.assign({},a.position),{angle:r?this.getRotateByAngle(a.angle,e):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(s,o,r)),e.textStyle)})),i&&n){const{x:e,y:s,width:n,height:r}=i;HM(t,{x1:e,y1:s,x2:e+n,y2:s+r})}}initMarker(t){const e=this.createSegment();e.name="mark-common-line-line",this._line=e,t.add(e),this.addMarkLineLabels(t)}updateMarker(){this.setLineAttributes(),this.updateMarkLineLabels()}}G(OP,RP);const IP=.001,DP={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:oP.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]}},FP={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"}}},zP={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:{autoRotate:!0,position:hP.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]}},jP={interactive:!0,label:{position:lP.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}},HP={interactive:!0,label:{autoRotate:!0,position:hP.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}},VP={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"}},NP={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"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},UP={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 WP(){GP._animate=MP}dP(),pT(),Aw();class GP extends OP{markerAnimate(t){GP._animate&&this._animationConfig&&GP._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},GP.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t,e){var i;const{refX:s=0,refY:n=0}=e,r=this._line.getMainSegmentPoints(),a=null!==(i=this._line.getEndAngle())&&void 0!==i?i: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,e){var i;return(bM(t)?t:t-Math.PI)+(null!==(i=e.refAngle)&&void 0!==i?i:0)}getTextStyle(t,e,i){return xM(Math.abs(e),Math.PI/2,IP)||xM(Math.abs(e),3*Math.PI/2,IP)?SM(i,e,t):bM(e)?FP.postiveXAxis[t]:FP.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new fT({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:j({},lM,null==a?void 0:a.line),startSymbol:j({},lM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},lM,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:j({},lM,null==a?void 0:a.line),startSymbol:j({},lM,null==a?void 0:a.lineStartSymbol),endSymbol:j({},lM,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}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",GP.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(GP.defaultAttributes.label)}}function YP(){$P._animate=TP}GP.defaultAttributes=DP,dP(),Yk(),Aw();class $P extends uP{markerAnimate(t){$P._animate&&this._animationConfig&&$P._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},$P.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=BP,this.defaultExitAnimation=LP}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds,r={x:(e+i)/2,y:(s+n)/2};return(t.includes("left")||t.includes("Left"))&&(r.x=e),(t.includes("right")||t.includes("Right"))&&(r.x=i),(t.includes("top")||t.includes("Top"))&&(r.y=s),(t.includes("bottom")||t.includes("Bottom"))&&(r.y=n),r}setLabelPos(t,e){var i;if(this._area){const s=null!==(i=e.position)&&void 0!==i?i:"middle",n=this.getPointAttrByPosition(s);if(t.setAttributes(Object.assign(Object.assign({},n),{textStyle:Object.assign(Object.assign({},NP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;HM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{points:e,areaStyle:i,state:s}=this.attribute,n=uf.polygon(Object.assign({points:e},i));n.states=j({},lM,null==s?void 0:s.area),n.name="mark-area-polygon",this._area=n,t.add(n),this._addMarkLabels(t,"mark-area-label",$P.defaultAttributes.label)}updateMarker(){const{points:t,areaStyle:e,state:i}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},e)),this._area.states=j({},lM,null==i?void 0:i.area)),this._updateMarkLabels($P.defaultAttributes.label)}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}}$P.defaultAttributes=jP,G($P,RP),dP(),gT(),Aw();class XP extends OP{markerAnimate(t){XP._animate&&this._animationConfig&&XP._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},XP.defaultAttributes,t)),this.name="markArcLine"}getPointAttrByPosition(t,e){const{center:i,radius:s,startAngle:n,endAngle:r}=this.attribute,{refX:a=0,refY:o=0}=e;let l;switch(t){case hP.arcInnerStart:l=n;case hP.arcOuterStart:l=n;break;case hP.arcInnerEnd:l=r;case hP.arcOuterEnd:l=r;break;case hP.center:case hP.arcInnerMiddle:case hP.arcOuterMiddle:default:l=(n+r)/2}return{position:{x:i.x+(s+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:i.y+(s+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return VP[t]}getRotateByAngle(t,e){var i;return t-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new mT({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:j({},lM,null==o?void 0:o.line),startSymbol:j({},lM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},lM,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:j({},lM,null==o?void 0:o.line),startSymbol:j({},lM,null==o?void 0:o.lineStartSymbol),endSymbol:j({},lM,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}addMarkLineLabels(t){this._addMarkLabels(t,"mark-common-line-label",XP.defaultAttributes.label)}updateMarkLineLabels(){this._updateMarkLabels(XP.defaultAttributes.label)}}XP.defaultAttributes=zP,dP(),Bk(),Aw();class KP extends uP{markerAnimate(t){KP._animate&&this._animationConfig&&KP._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},KP.defaultAttributes,t)),this.name="markArcArea",this.defaultUpdateAnimation=BP,this.defaultExitAnimation=LP}getPointAttrByPosition(t,e){const{center:i,innerRadius:s,outerRadius:n,startAngle:r,endAngle:a}=this.attribute,{refX:o=0,refY:l=0}=e;let h,c;switch(t){case hP.center:h=(s+n)/2,c=(r+a)/2;break;case hP.arcInnerStart:h=s,c=r;break;case hP.arcOuterStart:h=n,c=r;break;case hP.arcInnerEnd:h=s,c=a;break;case hP.arcOuterEnd:h=n,c=a;break;case hP.arcInnerMiddle:h=s,c=(r+a)/2;break;case hP.arcOuterMiddle:h=n,c=(r+a)/2;break;default:h=s,c=(r+a)/2}return{position:{x:i.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:i.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(t,e){var i;if(this._area){const{position:s="arcInnerMiddle",autoRotate:n}=e,r=this.getPointAttrByPosition(s,e);if(t.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?r.angle-Math.PI/2+(null!==(i=e.refAngle)&&void 0!==i?i:0):0,textStyle:Object.assign(Object.assign({},VP[s]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:e,y:i,width:s,height:n}=this.attribute.limitRect;HM(t,{x1:e,y1:i,x2:e+s,y2:i+n})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,state:o}=this.attribute,l=uf.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));l.states=j({},lM,null==o?void 0:o.area),l.name="polar-mark-area-area",this._area=l,t.add(l),this._addMarkLabels(t,"mark-area-label",KP.defaultAttributes.label)}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=j({},lM,null==o?void 0:o.area)),this._updateMarkLabels(KP.defaultAttributes.label)}isValidPoints(){return!0}}function qP(){ZP._animate=CP}KP.defaultAttributes=HP,G(KP,RP),dP(),pT(),gT(),tM(),Hk(),Nk(),Aw();class ZP extends uP{markerAnimate(t){ZP._animate&&this._animationConfig&&ZP._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},ZP.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=PP,this.defaultExitAnimation=LP,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return xM(Math.abs(s),Math.PI/2,IP)||xM(Math.abs(s),3*Math.PI/2,IP)?SM(t,s,n):bM(s)?UP.postiveXAxis[n]:UP.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,style:d,position:u=cP.middle}=e,{state:p}=this.attribute,g=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,f=l*Math.cos(g)+h*Math.cos(g-Math.PI/2),m=l*Math.sin(g)+h*Math.sin(g-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,g,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:j({},lM,null==p?void 0:p.textBackground),text:j({},lM,null==p?void 0:p.itemContent)}}))}else("richText"===n||"image"===n)&&(t.setAttributes({dx:this.getItemDx(t,u,d)+(d.dx||0),dy:this.getItemDy(t,u,d)+(d.dy||0)}),t.states=j({},lM,null==p?void 0:p.itemContent));const v=bM(g)?g:g-Math.PI;t.setAttributes({x:s.x+(f||0),y:s.y+(m||0),angle:o&&v+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",style:r,renderCustomCallback:a}=t;let o;return"symbol"===n?(o=uf.symbol(Object.assign(Object.assign({},i),r)),o.states=j({},lM,null==s?void 0:s.itemContent)):"text"===n?o=new UM(Object.assign(Object.assign({},i),{state:{panel:j({},lM,null==s?void 0:s.textBackground),text:j({},lM,null==s?void 0:s.itemContent)}})):"richText"===n?(o=uf.richtext(Object.assign(Object.assign({},i),r)),o.states=j({},lM,null==s?void 0:s.itemContent)):"image"===n?(o=uf.image(Object.assign(Object.assign({},i),r)),o.states=j({},lM,null==s?void 0:s.itemContent)):"custom"===n&&a&&(o=a(),o.states=j({},lM,null==s?void 0:s.itemContent)),o.name=`mark-point-${n}`,this.setItemAttributes(o,t,e,i,n),o}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=xM(c,0,IP)||xM(d,0,IP),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=zM(e-u,t-d),o=zM(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*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(aL.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(aL.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===aL.focus||"focus"===o){const s=a.hasState(nL.focus);a.toggleState(nL.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[nL.unSelected,nL.unSelectedHover,nL.focus],t),this._setLegendItemState(e,nL.selected,t)})):(this._setLegendItemState(a,nL.selected,t),this._removeLegendItemState(a,[nL.unSelected,nL.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[nL.selected,nL.selectedHover,nL.focus],t),this._setLegendItemState(e,nL.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(nL.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(nL.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(rL.legendItemClick,a,t);i?(this._removeLegendItemState(a,[nL.selected,nL.selectedHover],t),this._setLegendItemState(a,nL.unSelected,t)):(this._setLegendItemState(a,nL.selected,t),this._removeLegendItemState(a,[nL.unSelected,nL.unSelectedHover],t))}else this._setLegendItemState(a,nL.selected,t),this._removeLegendItemState(a,[nL.unSelected,nL.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[nL.selected,nL.selectedHover],t),this._setLegendItemState(e,nL.unSelected,t))}))}this._dispatchLegendEvent(rL.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,nL.selected),this._removeLegendItemState(e,[nL.unSelected,nL.unSelectedHover])):(this._removeLegendItemState(e,[nL.selected,nL.selectedHover]),this._setLegendItemState(e,nL.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=eL,spaceRow:l=iL,verticalAlign:h="middle"}=t,c=this._itemsContainer,{items:d,isHorizontal:u,startIndex:g,isScrollbar:f}=this._itemContext,m=f?1:u?i:e,v=this._contentMaxHeight;let _,{doWrap:b,maxWidthInCol:x,startX:S,startY:A,pages:k}=this._itemContext,M=0,T=0;const w=[];for(let t=g,e=d.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),_=d[t],_.id||(_.id=_.label),_.index=t;let e=!0;y(n)&&(e=n.includes(_.label));const i=this._renderEachItem(_,e,t,d),g=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),x=Math.max(g,x),this._itemMaxWidth=Math.max(g,this._itemMaxWidth),u?(p(s)&&(f&&a?(k=Math.ceil((S+g)/s),b=k>1):S+g>s&&(b=!0,S>0&&("middle"!==h&&"bottom"!==h||w.forEach((t=>{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),k+=1,S=0,A+=T+l,T=0,w.length=0))),0===S&&0===A||i.setAttributes({x:S,y:A}),S+=o+g,T=Math.max(T,m),w.push(i)):(p(v)&&(f&&a?(k=Math.ceil((A+m)/v),b=k>1):v<=m?(k+=1,b=!0,A=0,t>0&&(S+=M+o)):v{t.setAttributes({y:t.attribute.y+(T-t.attribute.height)/("middle"===h?2:1)})})),this._itemContext.doWrap=b,this._itemContext.startX=S,this._itemContext.startY=A,this._itemContext.maxWidthInCol=x,this._itemContext.pages=k,this._itemContext.maxPages=m,f&&(this._itemContext.totalPage=k),r||(this._itemContext.startIndex=d.length),this._itemContext}_renderContent(){const{item:t={},items:e,reversed:i,maxWidth:s,maxHeight:n}=this.attribute;if(!1===t.visible||P(e))return;let r=e;i&&(r=null==e?void 0:e.reverse()),this._contentMaxHeight=Math.max(0,n-this._parsedPadding[0]-this._parsedPadding[2]);const a=uf.group({x:0,y:0});this._itemsContainer=a;const{layout:o,autoPage:l}=this.attribute,h="horizontal"===o,{maxWidth:c,width:d,height:u}=t,g=[];p(c)&&g.push(c),p(d)&&g.push(d),g.length&&(p(s)&&g.push(s),this._itemWidthByUser=K(g)),p(u)&&(this._itemHeightByUser=u);const f=this.attribute.pager;this._itemContext={currentPage:f&&f.defaultCurrent||1,doWrap:!1,maxWidthInCol:0,maxPages:1,pages:1,startX:0,startY:0,startIndex:0,items:r,isHorizontal:h,totalPage:1/0,isScrollbar:f&&"scrollbar"===f.type,clipContainer:void 0},this._itemContext=this._renderItems();let m=!1;this._itemContext.doWrap&&l&&this._itemContext.pages>this._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,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:f,autoEllipsisStrategy:m}=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=ri(c);let w;!1===x.visible?(w=uf.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(w,aL.item,t,w)):(w=uf.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(w,aL.item,t,w,M.state)),w.id=`${null!=a?a:o}-${i}`,w.addState(e?nL.selected:nL.unSelected);const C=uf.group({x:0,y:0,pickable:!1});w.add(C);let E,B=0,P=0,R=0;if(v&&!1!==v.visible){const i=L(S,"style.size",10);P=y(i)?i[0]||0:i,R=L(v,"space",8);const s=uf.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,aL.itemShape,t,w,S.state),s.addState(e?nL.selected:nL.unSelected),C.add(s)}let O=0;if(d){const e=L(g,"size",10);E=uf.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,aL.focus,t,w),O=e}const I=_.formatMethod?_.formatMethod(o,t,i):o,D=DM(Object.assign(Object.assign({x:P/2+R,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,aL.itemLabel,t,w,A.state),D.addState(e?nL.selected:nL.unSelected),C.add(D);const F=L(_,"space",8);if(p(l)){const s=L(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=DM(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,aL.itemValue,t,w,k.state),r.addState(e?nL.selected:nL.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-P-R-F-O-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-P/2-T[1]-T[3]-O-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));B=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-P-R-O),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",B),C.add(E));const z=C.AABBBounds,j=z.width();if("right"===f){const t=z.x2,e=z.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=z.height(),V=p(this.attribute.item.width)?this.attribute.item.width:j+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(-z.x1+T[3],-z.y1+T[0]),w}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new tL(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},j({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new tL(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new pM(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new pM(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?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 i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",St(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=eL,spaceRow:o=iL}=n,l=this._itemsContainer,{space:h=sL,defaultCurrent:c=1}=r,d=cL(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,_=0,y=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v0&&(y=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:y,y:b}),y+=a+i})),this._itemContext.startX=y,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),_=p-g.AABBBounds.height()-h-t,_<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;_0&&(b=0,y+=this._itemMaxWidth+a,x+=1),e>0&&t.setAttributes({x:y,y:b}),b+=o+s}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=uf.group({x:0,y:t,width:u?v:f,height:u?m:_,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+L(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=eL,spaceRow:a=iL}=s,o=this._itemsContainer,{space:l=sL,defaultCurrent:h=1}=n,c=cL(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const _=uf.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=uf.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];pt(vt(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),pt(vt(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(nL.selected)?this._setLegendItemState(t,nL.selectedHover,e):this._setLegendItemState(t,nL.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===aL.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(rL.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(nL.unSelectedHover)||t.hasState(nL.selectedHover))&&(i=!0),t.removeState(nL.unSelectedHover),t.removeState(nL.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(nL.unSelectedHover)&&!t.hasState(nL.selectedHover)||(i=!0),t.removeState(nL.unSelectedHover),t.removeState(nL.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===aL.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(rL.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(rL.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!==aL.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(rL.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!==aL.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(rL.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(nL.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s,n={}){t.name=e,t.data=i,t.delegate=s,t.states=j({},dL,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(nL.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}release(){super.release(),this.removeAllEventListeners()}};var pL;function gL(t){return y(t)?t:[t,t]}function fL(t){return t?"ew-resize":"ns-resize"}uL.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:eL,spaceRow:iL,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:sL,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"}(pL||(pL={})),lL();class mL extends Qy{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:j({},mL.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=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i;const s=dM(),n="browser"===A_.env?A_:this.stage;n.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onHandlerPointerUp)}))},this._onHandlerPointerMove=t=>{var e,i;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=>{this._isChanging=!1,this._currentHandler=null,this._clearAllDragEvents()},this._handleTouchMove=t=>{this._isChanging&&t.preventDefault()},this._onTrackPointerdown=t=>{this._clearAllDragEvents(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i;const s=dM(),n="browser"===A_.env?A_:this.stage;n.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),s.forEach((t=>{n.addEventListener(t,this._onTrackPointerUp)}))},this._onTrackPointerMove=t=>{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=>{this._isChanging=!1,this._clearAllDragEvents()},this._onRailPointerDown=t=>{this._clearAllDragEvents(),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:gL(d)[0],endValue:gL(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const f=uf.group({x:0,y:0});f.name=pL.innerView,this.add(f),this._innerView=f;let m,v=0;if(r&&r.visible){m=uf.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)),m.name=pL.startText,f.add(m);const e=p(r.space)?r.space:0;v+=(g?m.AABBBounds.width():m.AABBBounds.height())+e}const _=uf.group({x:g?v:0,y:g?0:v});f.add(_);const y=uf.group({x:0,y:0});let b;if(y.name=pL.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=uf.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=pL.endText,f.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=uf.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=pL.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,f]=gL(c),m=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?m:l/2,y:p?o/2:m,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":fL(p)},r));if(v.name=pL.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=m,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=pL.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(f,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":fL(p)},r));if(i.name=pL.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(f,"end");e.name=pL.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 f=uf.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});f.name=pL.trackContainer;const m=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===m?"pointer":fL(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=uf.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=pL.track,this._track=b,f.add(b),t.add(f)}_renderHandler(t){return uf.symbol(t)}_renderHandlerText(t,e){return uf.text(this._getHandlerTextAttributes(t,e))}_getHandlerPosition(t){return this.attribute.range&&t?"start":"end"}_getHandlerTextStyle(t,e){const{align:i,handlerSize:s=14,handlerText:n={},railHeight:r,railWidth:a,slidable:o}=this.attribute;return d(n.style)?n.style(t,e,{layout:this.attribute.layout,align:i,railWidth:a,railHeight:r,handlerSize:s,slidable:o}):n.style}_getHandlerTextAttributes(t,e){var i,s;const{align:n,handlerSize:r=14,handlerText:a={},railHeight:o,railWidth:l,slidable:h}=this.attribute,c=this._isHorizontal,d=this.calculatePosByValue(t,e),u=null!==(i=a.space)&&void 0!==i?i:4,p=this._getHandlerTextStyle(t,e),g={text:a.formatter?a.formatter(t):t.toFixed(null!==(s=a.precision)&&void 0!==s?s:0),lineHeight:null==p?void 0:p.lineHeight,cursor:!1===h?"default":fL(c)};return c?"top"===n?(g.textBaseline="bottom",g.textAlign="center",g.x=d,g.y=(o-r)/2-u):(g.textBaseline="top",g.textAlign="center",g.x=d,g.y=(o+r)/2+u):"left"===n?(g.textBaseline="middle",g.textAlign="end",g.x=(l-r)/2-u,g.y=d):(g.textBaseline="middle",g.textAlign="start",g.x=(l+r)/2+u,g.y=d),Object.assign(Object.assign({},g),p)}_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=uf.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=uf.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),("browser"===A_.env?A_:this.stage).addEventListener("touchmove",this._handleTouchMove,{passive:!1}))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_clearAllDragEvents(){const t=dM(),e="browser"===A_.env?A_:this.stage;e.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onHandlerPointerUp)})),e.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),t.forEach((t=>{e.removeEventListener(t,this._onTrackPointerUp)}))}_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){const s=this._isHorizontal;t.setAttribute(s?"x":"y",e);const n=t.name===pL.startHandler?this._startHandlerText:this._endHandlerText;if(n){const e=this._getHandlerPosition(t.name===pL.startHandler);n.setAttributes(this._getHandlerTextAttributes(i,e))}t.name===pL.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){const s=this._isHorizontal,n=this._getHandlerPosition(t.name===pL.startHandlerText);t.setAttributes(this._getHandlerTextAttributes(i,n));const r=t.name===pL.startHandlerText?this._startHandler:this._endHandler;r&&r.setAttributes({[s?"x":"y"]:e}),t.name===pL.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}}release(t){super.release(t),("browser"===A_.env?A_:this.stage).removeEventListener("touchmove",this._handleTouchMove,{passive:!1}),this._clearAllDragEvents()}}mL.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}}},hL(),lL();class vL extends oL{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},vL.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:f,handlerText:m,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:m}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function _L(t="bottom"){let 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`}vL.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"}}},hL(),lL(),Wk();class yL extends oL{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},yL.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:f,showTooltip:m,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=uf.group({x:0,y:0});this._innerView.add(x);const S=new mL({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:_L(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:f,showTooltip:m,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=uf.path(Object.assign(Object.assign({x:0,y:k,path:A},_),{zIndex:0}));x.add(M);const T=this._title?this._title.AABBBounds.height()+L(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))}}yL.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)"}},zk(),iM(),qk();let bL=class t extends Qy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,b,x;const{textType:S,text:A,subtextType:k,textStyle:M={},subtext:T,subtextStyle:w={},width:C,height:E,minWidth:B,maxWidth:P,minHeight:L,maxHeight:R,align:O,verticalAlign:I,padding:D=0}=this.attribute,F=ri(D),z=this.createOrUpdateChild("title-container",{x:F[3],y:F[0],zIndex:1},"group"),j=null!==(t=M.height)&&void 0!==t?t:E;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,maxHeight:o,maxWidth:l,x:h=0,y:c=0,ellipsis:d=!0,wordBreak:u="break-word",maxWidth:g,lineClamp:f}=M;if("rich"===S||p(M.character)){const s=Object.assign({x:h,y:c,width:null!==(e=null!=t?t:C)&&void 0!==e?e:0,height:null!=j?j:0,ellipsis:null==d||d,wordBreak:null!=u?u:"break-word",maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:null!==(i=M.character)&&void 0!==i?i:A},M);this._mainTitle=z.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===S){const e=Object.assign({html:Object.assign(Object.assign({dom:A},hM),M),x:h,y:c,width:null!==(s=null!=t?t:C)&&void 0!==s?s:0,height:null!=j?j:0,ellipsis:d,wordBreak:u,maxHeight:null!=o?o:R,maxWidth:null!=l?l:g,textConfig:[]},M);this._mainTitle=z.createOrUpdateChild("mainTitle",e,"richtext")}else p(A)&&(this._mainTitle=z.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(A)?A:[A],whiteSpace:"normal"},M),{maxLineWidth:null!==(r=null!==(n=M.maxLineWidth)&&void 0!==n?n:t)&&void 0!==r?r:C,heightLimit:null!==(a=M.height)&&void 0!==a?a:R,lineClamp:f,ellipsis:d,x:h,y:c}),"text"))}const H=this._mainTitle?this._mainTitle.AABBBounds.height():0,V=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==w.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:f="break-word",lineClamp:m}=w,v=Math.max(Number.MIN_VALUE,R-H);if("rich"===k||p(w.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:C)&&void 0!==o?o:0,height:null!==(l=null!=e?e:E)&&void 0!==l?l:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:null!==(h=w.character)&&void 0!==h?h:T},w);this._subTitle=z.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===k){const o=Object.assign({html:Object.assign(Object.assign({dom:T},hM),w),x:n,y:r,width:null!==(c=null!=t?t:C)&&void 0!==c?c:0,height:null!==(d=null!=e?e:E)&&void 0!==d?d:0,ellipsis:a,wordBreak:f,maxHeight:null!=s?s:v,maxWidth:null!=i?i:P,textConfig:[]},w);this._subTitle=z.createOrUpdateChild("subTitle",o,"richtext")}else p(T)&&(this._subTitle=z.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(T)?T:[T],whiteSpace:"normal"},w),{maxLineWidth:null!==(u=w.maxLineWidth)&&void 0!==u?u:C,heightLimit:null!==(g=w.heightLimit)&&void 0!==g?g:v,lineClamp:m,ellipsis:a,x:0,y:H}),"text"))}const N=this._subTitle?this._subTitle.AABBBounds.height():0,U=this._subTitle?this._subTitle.AABBBounds.width():0;let W=Math.max(V,U),G=H+(null!==(f=w.height)&&void 0!==f?f:N);if(p(C)&&(W=C),p(E)&&(G=E),p(B)&&WP&&(W=P),p(L)&&GR&&(G=R),z.attribute.width=W,z.attribute.height=G,z.attribute.boundsPadding=F,this._mainTitle){if(p(O)||p(M.align)){const t=M.align?M.align:O,e=null!==(m=M.width)&&void 0!==m?m:W;"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")):(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left"))}const t=M.verticalAlign?M.verticalAlign:I,e=null!=j?j:this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height();"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")):(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top"))}if(this._subTitle){if(p(O)||p(w.align)){const t=w.align?w.align:O,e=null!==(_=null!==(v=w.width)&&void 0!==v?v:M.width)&&void 0!==_?_:W;"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")):(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left"))}const t=w.verticalAlign?w.verticalAlign:I,e=this._mainTitle?p(j)?this._mainTitle.AABBBounds.y1+Math.max(this._mainTitle.AABBBounds.empty()?0:this._mainTitle.AABBBounds.height(),j):this._mainTitle.AABBBounds.y2:0,i=null!==(x=null!==(b=w.height)&&void 0!==b?b:E)&&void 0!==x?x:this._subTitle.AABBBounds.empty()?0:this._subTitle.AABBBounds.height();"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")):(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top"))}}};bL.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 xL={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"}}};zk(),iM(),qk();let SL=class extends Qy{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=j({},L(xL,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=DM(a);return o.name=r,t.appendChild(o),e.autoFit&&k(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&k(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{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,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(p(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),p(s)){const t=Y(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e: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=RM(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,f=c/2,m=g**2+1,v=2*f*g,_=f**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*m*_))/(2*m))+f),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 AL extends wg{constructor(t){super(t)}}var kL,ML;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(kL||(kL={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(ML||(ML={}));class TL extends Qy{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},TL.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"},TL.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"},TL.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},TL.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},TL.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 AL(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new AL(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new AL(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(kL.OnPlay)},this.pause=()=>{this._dispatchEvent(kL.OnPause)},this.forward=()=>{this._dispatchEvent(kL.OnForward)},this.backward=()=>{this._dispatchEvent(kL.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()}}TL.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},TL.defaultAttributes={[ML.Start]:{},[ML.Pause]:{},[ML.Backward]:{},[ML.Forward]:{}};const wL={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},CL=[200,10];var EL,BL;!function(t){t.Default="default",t.Reverse="reverse"}(EL||(EL={})),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"}(BL||(BL={}));const PL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,maxIndex:e,dataIndex:i})=>t===EL.Default&&i===e)({direction:t,maxIndex:e,dataIndex:s})||(({direction:t,minIndex:e,dataIndex:i})=>t===EL.Reverse&&i===e)({direction:t,minIndex:i,dataIndex:s}),LL=({direction:t,maxIndex:e,minIndex:i,dataIndex:s})=>(({direction:t,minIndex:e,dataIndex:i})=>t===EL.Default&&i===e)({direction:t,minIndex:i,dataIndex:s})||(({direction:t,maxIndex:e,dataIndex:i})=>t===EL.Reverse&&i===e)({direction:t,maxIndex:e,dataIndex:s}),RL=t=>"top"===t||"bottom"===t;class OL extends Qy{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},OL.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=Gt(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(RL(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:CL[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:CL[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 mL(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 t.layout=RL(this._orient)?"horizontal":"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 TL(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=RL(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:CL[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Gt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(RL(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:Gt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:RL(this._orient)?t+s:(this._size.width-r)/2,y:RL(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:RL(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:RL(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:Gt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:RL(this._orient)?t+s:(this._size.width-r)/2,y:RL(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]})}release(t){this._sliderVisible||this._slider.release(t),super.release(t)}}function IL(){lL(),zk(),tM()}OL.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({},wL),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},wL),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},wL),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},wL),{key:"backward",position:"start"})}},IL();class DL extends OL{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},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:EL.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(kL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(kL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(kL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(kL.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(BL.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(PL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||LL({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===EL.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(BL.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=A_.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(BL.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(BL.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=A_.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(),A_.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(BL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,A_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(BL.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(BL.change),this.dispatchCustomEvent(BL.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var FL,zL=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())}))};IL();class jL extends OL{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(kL.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(kL.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(kL.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(kL.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(BL.change))},this.play=()=>zL(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(BL.play),this._rafId=A_.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=A_.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,A_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(BL.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,A_.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(BL.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(BL.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(BL.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.brushActive="brushActive",t.brushClear="brushClear"}(FL||(FL={}));const HL={trigger:"pointerdown",updateTrigger:"pointermove",endTrigger:["pointerup","pointerleave"],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:{minY:-1/0,maxY:1/0,minX:-1/0,maxX:1/0}},VL=5;const NL={debounce:xt,throttle:St};zk(),Yk();let UL=class t extends Qy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e)),this.name="brush",this._activeBrushState=!1,this._activeDrawState=!1,this._cacheDrawPoints=[],this._activeMoveState=!1,this._operatingMaskMoveDx=0,this._operatingMaskMoveDy=0,this._operatingMaskMoveRangeX=[-1/0,1/0],this._operatingMaskMoveRangeY=[-1/0,1/0],this._brushMaskAABBBoundsDict={},this._firstUpdate=!0,this._onBrushStart=t=>{if(!1===this.attribute.interactive)return;if(!1===this._beforeBrushEvent(t))return;const{updateTrigger:e=HL.updateTrigger,endTrigger:i=HL.endTrigger,brushMoved:s=!0}=this.attribute;Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushingWithDelay))),Y(i).forEach((t=>this.stage.addEventListener(t,this._onBrushEnd))),t.stopPropagation(),this._firstUpdate=!0,this._activeMoveState=s&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._startPos=this.eventPosToStagePos(t),this._cacheDrawPoints=[this._startPos]},this._onBrushing=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(this._outOfInteractiveRange(t)||(t.stopPropagation(),this._firstUpdate?(this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t),this._firstUpdate=!1):(this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:NL[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{!1!==this.attribute.interactive&&(this._releaseBrushUpdateEvents(),t.preventDefault(),this._activeDrawState&&this._drawEnd(t),this._activeMoveState&&this._moveEnd(t),this._activeDrawState=!1,this._activeMoveState=!1)},this._onBrushClear=t=>{!1!==this.attribute.interactive&&!1!==this._beforeBrushEvent(t)&&(t.preventDefault(),this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(FL.brushClear,t)),this._activeDrawState=!1,this._activeMoveState=!1)}}_bindBrushEvents(){if(this.releaseBrushEvents(),this.attribute.disableTriggerEvent)return;const{trigger:t=HL.trigger,resetTrigger:e=HL.resetTrigger}=this.attribute;Y(t).forEach((t=>this.stage.addEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.addEventListener(t,this._onBrushClear)))}_initDraw(t){if(!1===this.attribute.interactive)return;const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints.push(i),"single"===e&&this._clearMask(),this._addBrushMask(),this._dispatchBrushEvent(FL.drawStart,t),this._activeBrushState=!1}_initMove(t){var e,i;if(!1===this.attribute.interactive)return;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,f=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,f],this._operatingMask.setAttribute("pickable",!0),this._dispatchBrushEvent(FL.moveStart,t)}_drawing(t){var e;if(!1===this.attribute.interactive)return;const i=this.eventPosToStagePos(t),{brushType:s,sizeThreshold:n=VL}=this.attribute,r=this._cacheDrawPoints.length;if(r>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(i.x===t.x&&i.y===t.y)return}"polygon"===s||r<=1?this._cacheDrawPoints.push(i):this._cacheDrawPoints[r-1]=i;const a=this._computeMaskPoints();this._operatingMask.setAttribute("points",a);const{x:o,y:l}=this._startPos,{x:h,y:c}=this.eventPosToStagePos(t);(Math.abs(h-o)>n||Math.abs(l-c)>n)&&(1!==Object.keys(this._brushMaskAABBBoundsDict).length||this._activeBrushState?this._dispatchBrushEvent(FL.drawing,t):(this._activeBrushState=!0,this._dispatchBrushEvent(FL.brushActive,t)))}_moving(t){if(!1===this.attribute.interactive)return;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._dispatchBrushEvent(FL.moving,t)}_drawEnd(t){if(!1===this.attribute.interactive)return;const{removeOnClick:e=!0,sizeThreshold:i=VL}=this.attribute;if(this._outOfInteractiveRange(t))this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(FL.brushClear,t));else{const{x:s,y:n}=this._startPos,{x:r,y:a}=this.eventPosToStagePos(t);Math.abs(r-s)<=1&&Math.abs(a-n)<=1&&e?this._isEmptyMask()||(this._clearMask(),this._dispatchBrushEvent(FL.brushClear,t)):Math.abs(r-s)this.stage.removeEventListener(t,this._onBrushStart))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushClear))),this._releaseBrushUpdateEvents()}_releaseBrushUpdateEvents(){const{updateTrigger:t=HL.updateTrigger,endTrigger:e=HL.endTrigger}=this.attribute;Y(t).forEach((t=>this.stage.removeEventListener(t,this._onBrushingWithDelay))),Y(e).forEach((t=>this.stage.removeEventListener(t,this._onBrushEnd)))}_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=uf.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}_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(Pe(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_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.ythis._brushMaskAABBBoundsDict[t].empty()))}};UL.defaultAttributes=HL;const WL=(t,...e)=>{const i=[t.shape,...e.map((t=>null==t?void 0:t.shape))],s=[t.key,...e.map((t=>null==t?void 0:t.key))],n=[t.value,...e.map((t=>null==t?void 0:t.value))];return j(t,...e,{shape:i.every(u)?void 0:j({},...i),key:s.every(u)?void 0:j({},...s),value:n.every(u)?void 0:j({},...n)})},GL=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}},YL={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:aM,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:aM,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:aM,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Ve).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},$L=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];zk(),Xk(),tM(),iM(),qk();let XL=class t extends Qy{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: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=ri(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",j({symbolType:"circle"},u.shape,{visible:yM(u)&&yM(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:yM(u)&&yM(u.value)},GL(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:yM(u)&&yM(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:yM(u)&&yM(u.value)},GL(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},hM),u.value),visible:yM(u)&&yM(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=yM(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:f,textBaseline:m}=u.value,v=n.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 _=yM(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(!yM(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)+(yM(n.key)?r+n.key.spacing:0)+(yM(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&&(FM(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";p(n.value.textAlign)?t=n.value.textAlign:yM(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),FM(c,f,t,u,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(yM(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=rd(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(yM(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},GL(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},GL(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},hM),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(yM(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},GL(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},GL(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=>$L.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)&&yM(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach((([e,i],a)=>{var c;const{key:d,value:u,shape:p,spaceRow:g}=i,f=yM(p),m=null!==(c=null==p?void 0:p.symbolType)&&void 0!==c?c:"",v=LM(d),_=LM(u);let y=0;if(yM(d)){const{width:t,height:e}=v.quickMeasure(d.text);l.push(t),y=Math.max(y,e)}if(yM(u)){const{width:t,height:e}=_.quickMeasure(u.text);h.push(t),y=Math.max(y,e)}f&&hu[m]&&(t=!0,r.push(p.size),y=Math.max(p.size,y)),e.height=y,o+=y,a{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 WL({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return WL({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};XL.defaultAttributes=YL;const KL=pt;function qL(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:K(i)}function ZL(t,e){const i=[];return t.forEach((t=>{const s=+t[e];k(s)&&i.push(s)})),0===i.length?null:X(i)}function JL(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return k(s)&&(t+=s),t}),0)}function QL(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 tR(t,e){const i=QL(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 eR(t,e){const i=iR(t),s=iR(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 iR(t,e={x:0,y:0}){return re.distancePP(t,e)}function sR(t){return k(t.x)&&k(t.y)}function nR(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 rR(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const aR=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}function lR(t,e=!1){if(null===t||"object"!=typeof t)return t;for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){if(void 0===t[i]){delete t[i];continue}e&&lR(t[i],e)}}var hR,cR,dR;function uR(t){var e,i;const{type:s}=t;return s===cR.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!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.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_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"}(hR||(hR={})),function(t){t.area="area",t.line="line",t.bar="bar",t.rangeColumn="rangeColumn",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.funnel="funnel",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",t.mosaic="mosaic",t.pictogram="pictogram"}(cR||(cR={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",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.transform="transform",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.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.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(dR||(dR={}));const pR={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},gR={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function fR(t,e){var i;if(!t)return[];const s=SR(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?bR(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>yR(i)?vR(t,i,e):i)).filter(p)}))):i.map((i=>yR(i)?vR(t,i,e):i)).filter(p):[]}return[]}function mR(t,e){var i,s;return bR(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 vR(t,e,i){var s;const n=SR(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=pR[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=gR[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 ei(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=Ye(t,i,s),a=Ge(n,r,e.l),l=new ei(`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 _R=(t,e)=>{if(e&&yR(t)){const i=vR(e,t);if(i)return i}return t};function yR(t){return t&&"palette"===t.type&&!!t.key}function bR(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function xR(t){return y(t)?{dataScheme:t}:t}function SR(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=uR(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 AR extends oE{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(!bR(this._range))return void super.range(this._range);const t=mR(this._range,this._domain);super.range(t)}}const kR={linear:PE,band:cE,point:class extends cE{constructor(t){super(!1),this.type=jC.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:oE,threshold:FE,colorOrdinal:AR};function MR(t){const e=kR[t];return e?new e:null}function TR(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function wR(t,e,i){if(!e)return!0;const s=e.range(),n=(i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range()).map((t=>e.invert(t))),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Array.isArray(t)?t.every((t=>t>=r&&t<=a)):t>=r&&t<=a}function CR(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function ER(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function BR(t){return!!_(t)&&(!!t.endsWith("%")&&qy(t.substring(0,t.length-1)))}function PR(t){return!!g(t)&&("percent"in t||"offset"in t)}function LR(t,e,i,s=0){var n,r;return S(t)?t:BR(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 RR(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]=LR(t[s],e.size,i)}))})),o}function OR(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}}function IR(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)||BR(t)||d(t)||PR(t)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e}function DR(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const FR=(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},zR=[{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"]}];function jR(t,e){return t&&e.key in t?t[e.key]:e.default}function HR(t){return t&&"token"===t.type&&!!t.key}const VR={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%"},NR={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:{default:{dataScheme:zR,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)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},token:VR,component:{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}}},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:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,fontSize:null}},barBackground:{visible:!1,style:{fill:{type:"palette",key:"primaryFontColor",a:.06},stroke:"transparent"}}},animationThreshold:2e3},UR={name:"dark",colorScheme:{default:{dataScheme:zR,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",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},WR=(t,e)=>t===e||!d(t)&&!d(e)&&(y(t)&&y(e)?e.every((e=>t.some((t=>WR(t,e))))):!(!g(t)||!g(e))&&Object.keys(e).every((i=>WR(t[i],e[i])))),GR=(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]={}),GR(t[s],e.slice(1),i))},YR=t=>t instanceof Ba||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)))}}(t);function $R(t,e=["data"]){return I(t,YR,e)}function XR(t,...e){let i=-1;const s=e.length;for(;++i{const s=t[i];return e[i]=xR(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}KR._charts={},KR._series={},KR._components={},KR._graphicComponents={},KR._marks={},KR._regions={},KR._animations={},KR._implements={},KR._chartPlugin={},KR._vChartPlugin={},KR._componentPlugin={},KR.transforms={fields:Yr,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}},KR.dataParser={csv:(t,e={},i)=>(i.type=Gr.DSV,sa(t)),dsv:(t,e={},i)=>{i.type=Gr.DSV;const s=Hr(ra,e),{delimiter:n}=s;if(!_(n))throw new TypeError("Invalid delimiter: must be a string!");return ia(n).parse(t)},tsv:(t,e={},i)=>(i.type=Gr.DSV,na(t))},KR._layout={},KR._grammarTransforms={},KR._stageEventPlugins={},KR.registerStageEventPlugin=(t,e)=>{KR._stageEventPlugins[t]=e},KR.getStageEventPlugin=t=>KR._stageEventPlugins[t],KR._interactionTriggers={},KR.registerInteractionTrigger=(t,e)=>{KR._interactionTriggers[t]=e},KR._composedEventMap={},KR.registerComposedEvent=(t,e)=>{KR._composedEventMap[t]=e},KR._tooltipProcessors={},KR.registerTooltipProcessor=(t,e)=>{KR._tooltipProcessors[t]=e},KR.createTooltipProcessor=(t,e)=>{const i=KR._tooltipProcessors[t];return i?new i(e):null};const JR=t=>{const e={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"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},QR=JR(),tO={[NR.name]:NR},eO=NR.name,iO=new Map(Object.keys(tO).map((t=>[t,tO[t]]))),sO=new Map,nO=new Map(Object.keys(tO).map((t=>[t,t===eO]))),rO=(t,e)=>{if(!t)return;const i=hO(e);iO.set(t,i),nO.set(t,!0)},aO=(t=eO)=>(nO.has(t)&&!nO.get(t)&&rO(t,iO.get(t)),iO.get(t)),oO=t=>iO.delete(t)&&sO.delete(t)&&nO.delete(t),lO=t=>!!_(t)&&iO.has(t),hO=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:eO;return qR({},aO(i),t)};class cO{static registerInstance(t){cO.instances.set(t.id,t)}static unregisterInstance(t){cO.instances.delete(t.id)}static getInstance(t){return cO.instances.get(t)}static instanceExist(t){return cO.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return cO.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}cO.instances=new Map;class dO{static registerTheme(t,e){rO(t,e)}static getTheme(t,e=!1){return aO(t)}static removeTheme(t){return oO(t)}static themeExist(t){return lO(t)}static getDefaultTheme(){return dO.themes.get(eO)}static setCurrentTheme(t){dO.themeExist(t)&&(dO._currentThemeName=t,cO.forEach((e=>null==e?void 0:e.setCurrentTheme(t))))}static getCurrentTheme(t=!1){return dO.getTheme(dO._currentThemeName,t)}static getCurrentThemeName(){return dO._currentThemeName}}function uO(t){return _(t)?dO.themeExist(t)?dO.getTheme(t):{}:g(t)?t:{}}dO.themes=iO,dO._currentThemeName=eO;const pO=["animationThreshold","colorScheme","name","padding"];function gO(t,e,i){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const s={};return Object.keys(t).forEach((n=>{const r=t[n];pO.includes(n)?s[n]=r:m(r)?yR(r)?s[n]=_R(r,e):HR(r)?s[n]=jR(i,r):s[n]=gO(r,e,i):s[n]=r})),s}function fO(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]=fO(t[s],e)}return i}return y(t)?t.map((t=>fO(t,e))):t}function mO(t,e){if(!t)return t;if(m(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]=mO(t[s],e)}return i}return y(t)?t.map((t=>mO(t,e))):t}function vO(t,...e){return d(t)?t(...e):t}const _O=(t,e,i,s)=>((t,e,i)=>LM(t,e,i,{fontFamily:VR.fontFamily,fontSize:VR.fontSize}))(e,i,s).measure(t),yO="__VCHART",bO=500,xO=500,SO=`${yO}_MEASURE_CANVAS_ID`,AO=`${yO}_DEFAULT_DATA_INDEX`,kO=`${yO}_DEFAULT_DATA_KEY`,MO=`${yO}_DEFAULT_DATA_SERIES_FIELD`,TO=`${yO}_DEFAULT_SERIES_STYLE_NAME`,wO=`${yO}_STACK_KEY`,CO=`${yO}_STACK_START`,EO=`${yO}_STACK_END`,BO=`${yO}_STACK_START_PERCENT`,PO=`${yO}_STACK_END_PERCENT`,LO=`${yO}_STACK_START_OffsetSilhouette`,RO=`${yO}_STACK_END_OffsetSilhouette`,OO=`${yO}_STACK_TOTAL`,IO=`${yO}_STACK_TOTAL_PERCENT`,DO=`${yO}_STACK_TOTAL_TOP`,FO=`${yO}_STACK_TOTAL_BOTTOM`,zO=`${yO}_MOSAIC_VALUE_START_PERCENT`,jO=`${yO}_MOSAIC_VALUE_END_PERCENT`,HO=`${yO}_MOSAIC_CAT_START_PERCENT`,VO=`${yO}_MOSAIC_CAT_END_PERCENT`,NO=`${yO}_SEGMENT_START`,UO=`${yO}_SEGMENT_END`,WO=`${yO}_KEY`,GO=`${yO}_MAP_LOOK_UP_KEY`;function YO(t,e){for(let i=0;it.key===e))}function XO(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 KO(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:{groupField:a.groupField,nodes:{}},tI(t,a,n[o],l,e,r))})),s?qO(n):n}function qO(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))):qO(t[e].nodes);return t}function ZO(t,e){if("values"in t&&t.values.length){const i=JL(t.values,e),s=ZL(t.values,PO);t.values.forEach((t=>{t[OO]=i,t[IO]=s}))}else for(const i in t.nodes)ZO(t.nodes[i],e)}function JO(t){if(!t.values.length)return;const e=t.values[t.values.length-1][EO]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)QO(t.nodes[r],e,i,s,n)}function tI(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[EO]=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 l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),tI(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const eI=(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]=sI(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function nI(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>oI(t.style(e,i,s,n)):P(t.style)||(e.style=oI(t.style)),!P(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>oI(t.state[e](i,s,n,r)):P(t.state[e])||(i[e]=oI(t.state[e]))})),e.state=i}return e}function rI(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>oI(t[i](e,s,n,r)):P(t[i])||(e[i]=oI(t[i]))})),e}function aI(t,e){if(P(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),oI(i)}function oI(t){return(null==t?void 0:t.angle)?Object.assign(Object.assign({},t),{angle:ae(t.angle)}):t}const lI=t=>"line"===t||"area"===t,hI=t=>{if(!t||!t.context)return null;const{data:e,markType:i}=t.context;return lI(i)?e:null==e?void 0:e[0]},cI=(t,e)=>{const i=t.getAttributes(!0),s={};return Object.keys(e).forEach((t=>{i[t]!==e[t]&&(s[t]=e[t])})),s};let dI=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},n=KR.getComposedEvent(t);if(n){const e=new n(this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(s.callback,{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(KR.getComposedEvent(t))if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};var uI;!function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(uI||(uI={}));const pI=["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 gI,fI,mI;t.ChartEvent=void 0,(gI=t.ChartEvent||(t.ChartEvent={})).initialized="initialized",gI.rendered="rendered",gI.renderFinished="renderFinished",gI.animationFinished="animationFinished",gI.regionSeriesDataFilterOver="regionSeriesDataFilterOver",gI.afterInitData="afterInitData",gI.afterInitEvent="afterInitEvent",gI.afterInitMark="afterInitMark",gI.rawDataUpdate="rawDataUpdate",gI.viewDataFilterOver="viewDataFilterOver",gI.viewDataUpdate="viewDataUpdate",gI.viewDataStatisticsUpdate="viewDataStatisticsUpdate",gI.markDeltaYUpdate="markDeltaYUpdate",gI.viewDataLabelUpdate="viewDataLabelUpdate",gI.scaleDomainUpdate="scaleDomainUpdate",gI.scaleRawDomainUpdate="scaleRawDomainUpdate",gI.scaleUpdate="scaleUpdate",gI.dataZoomChange="dataZoomChange",gI.drill="drill",gI.layoutStart="layoutStart",gI.layoutEnd="layoutEnd",gI.layoutRectUpdate="layoutRectUpdate",gI.playerPlay="playerPlay",gI.playerPause="playerPause",gI.playerEnd="playerEnd",gI.playerChange="playerChange",gI.playerForward="playerForward",gI.playerBackward="playerBackward",gI.scrollBarChange="scrollBarChange",gI.brushStart="brushStart",gI.brushChange="brushChange",gI.brushEnd="brushEnd",gI.brushClear="brushClear",gI.brushActive="brushActive",gI.legendSelectedDataChange="legendSelectedDataChange",gI.legendFilter="legendFilter",gI.legendItemClick="legendItemClick",gI.legendItemHover="legendItemHover",gI.legendItemUnHover="legendItemUnHover",gI.tooltipShow="tooltipShow",gI.tooltipHide="tooltipHide",gI.tooltipRelease="tooltipRelease",gI.afterResize="afterResize",gI.afterRender="afterRender",gI.afterLayout="afterLayout",gI.afterMarkLayoutEnd="afterMarkLayoutEnd",gI.afterWordcloudShapeDraw="afterWordcloudShapeDraw",function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(fI||(fI={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(mI||(mI={}));const vI=[mI.mark,mI.model,mI.chart,mI.vchart];class _I{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(mI.vchart,[]),this._levelNodes.set(mI.chart,[]),this._levelNodes.set(mI.model,[]),this._levelNodes.set(mI.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const yI={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"};class bI{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=L(t.event,"target");let a=t.datum;s&&"component"===s.modelType&&(a=null!==(e=s.getDatum(r))&&void 0!==e?e:a);const o={event:t.event,item:t.item,source:t.source,datum:a,chart:i,model:s,mark:null!=n?n:void 0,node:r};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.graphics&&(s=i.graphics);const n={event:t.event,chart:e,graphics:s,datums:s&&s.map((t=>hI(t)))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||fI.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||fI.chart);o.get(t)||o.set(t,new _I);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||fI.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||fI.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||fI.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||fI.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{let i=0;for(;!n&&i{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e?vI.indexOf(t.filter.level){const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[fI.chart,fI.window,fI.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.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&&L(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 yI[a]&&(a=yI[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)))}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,Object.assign({},i)),a=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return a&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!a}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?mI.model:mI.vchart:mI.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=St(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=xt(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=fI.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==mI.model&&s!==mI.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=mI.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case fI.chart:return this._viewBubbles;case fI.window:return this._windowBubbles;case fI.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case fI.chart:return this._viewListeners;case fI.window:return this._windowListeners;case fI.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return pI.includes(t)||Object.values(uI).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&KR.hasInteractionTrigger(e)}}function xI(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function SI(t,e,i){t.getParser(e)||t.registerParser(e,i)}const AI=new Map;let kI;function MI(){kI||(kI=new Ea,SI(kI,"geojson",Aa),SI(kI,"topojson",Ma),xI(kI,"simplify",Wr))}function TI(t,e,i={type:"geojson",centroid:!0}){AI.has(t)&&Hy(`map type of '${t}' already exists, will be overwritten.`),MI();const s=new Ba(kI),n=j({},{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}),AI.set(t,s)}function wI(t){AI.has(t)?AI.delete(t):Hy(`map type of '${t}' does not exists.`)}function CI(t,e=!1){let i=e;return t.latestData instanceof Ba&&(i=!1),i?I(t.latestData):t.latestData&&t.latestData.slice()}const EI=(t,e)=>0===t.length?[]:1===t.length?CI(t[0],null==e?void 0:e.deep):t.map((t=>CI(t,null==e?void 0:e.deep)));function BI(e,i,s){xI(i=i instanceof Ea?i:e.dataSet,"copyDataView",EI);const n=new Ba(i,s);return n.parse([e],{type:"dataview"}),n.transform({type:"copyDataView",level:t.TransformLevel.copyDataView}),n}function PI(t,e,i=[]){var s;if(t instanceof Ba)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?I(t.parser):{clone:!0},c=I(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new Ba(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return Hy(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return Hy(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!_(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),Hy("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function LI(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var RI,OI,II,DI;t.TransformLevel=void 0,(RI=t.TransformLevel||(t.TransformLevel={}))[RI.copyDataView=-10]="copyDataView",RI[RI.treemapFilter=-8]="treemapFilter",RI[RI.treemapFlatten=-7]="treemapFlatten",RI[RI.dotObjFlat=-7]="dotObjFlat",RI[RI.linkDotInfo=-7]="linkDotInfo",RI[RI.sankeyLayout=-7]="sankeyLayout",RI[RI.dataZoomFilter=-6]="dataZoomFilter",RI[RI.legendFilter=-5]="legendFilter",function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(OI||(OI={})),function(t){t.data="data",t.mark="mark"}(II||(II={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(DI||(DI={}));const FI=["line","area","trail"];function zI(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(WO,i?t.slice().sort(i):t.slice()),{keys:[WO],data:s};if(1===t.length){const i=e(t[0],0);return s.set(i,[t[0]]),{keys:[i],data:s}}const n=new Set;return t.forEach(((t,i)=>{var r;const a=e(t,i),o=null!==(r=s.get(a))&&void 0!==r?r:[];o.push(t),s.set(a,o),n.add(a)})),i&&n.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(n),data:s}}const jI=(t,e,i={})=>(t&&Object.keys(t).forEach((s=>{i[s]=t[s](e)})),i);function HI(t,e,i,s,n){const r=t=>{if(!s&&t&&(!i||i(t))){const i=e.call(null,t);if(n&&i)return i}if("group"===t.type){const e=t.getMarks();if(e)for(let t=0;t{HI(t,(t=>{"group"!==t.type&&"component"!==t.type&&e.push(t)}))})),e}function NI(t,e,i,s){const n=zI(t,(t=>i(t))),r=zI(e,(t=>s(t)));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(!u(t)){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}}const UI=`${yO}_BuiltIn_CallBack_Disappear`;var WI;!function(t){t.render="render",t.disappear="disappear"}(WI||(WI={}));class GI{get stateAnimationConfig(){return this._stateAnimationConfig}getRootGroup(){return this._rootGroup}getOption(){return this._option}constructor(e,i){this._count=0,this._rootMarks=[],this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._compileChart=null,this.handleLayoutEnd=()=>{var e,i;null===(i=null===(e=this._compileChart)||void 0===e?void 0:e.getEvent())||void 0===i||i.emit(t.ChartEvent.afterMarkLayoutEnd,{chart:this._compileChart})},this.handleStageRender=()=>{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._handleAfterNextRender=()=>{var e,i,s,n;this._stage&&!this._option.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._compileChart&&(null===(e=this._compileChart.getEvent())||void 0===e||e.emit(t.ChartEvent.renderFinished,{chart:this._compileChart,vchart:null===(i=this._compileChart.getOption())||void 0===i?void 0:i.globalInstance})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.renderProgressive()})),this.doPreProgressive()},this._container=e,this._option=i}getChart(){return this._compileChart}getCanvas(){var t;return null===(t=this._stage)||void 0===t?void 0:t.window.getNativeHandler().nativeCanvas}getStage(){return this._stage}initView(){var e,i,s,n;if(this._released)return;if(this.isInited=!0,this._stage)return;const{autoRefreshDpr:r,dpr:a,mode:o,modeParams:l,gestureConfig:h,interactive:c,clickInterval:d,autoPreventDefault:u,background:f}=this._option;A_.setEnv(function(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}(o),null!=l?l:{}),this._stage=null!==(e=this._option.stage)&&void 0!==e?e:new F_(Object.assign({background:f,width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,canvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,dpr:a,viewBox:this._option.viewBox,canvasControled:this._option.canvasControled,beforeRender:t=>{var e,i,s;null===(e=this._compileChart)||void 0===e||e.onBeforeRender(),null===(s=(i=this._option).beforeRender)||void 0===s||s.call(i,t)},afterRender:this._option.afterRender,disableDirtyBounds:!0,autoRender:!0,ticker:this._option.ticker,pluginList:this._option.pluginList,enableHtmlAttribute:this._option.enableHtmlAttribute,optimize:this._option.optimize,supportsTouchEvents:this._option.supportsTouchEvents,supportsPointerEvents:this._option.supportsPointerEvents,event:{clickInterval:d,autoPreventDefault:u},ReactDOM:this._option.ReactDOM,autoRefresh:p(r)?r:!p(a)},null!==(n=this._option.renderHooks)&&void 0!==n?n:{})),this._stage.enableIncrementalAutoRender(),this._stage.setTheme({symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}});const m=Lp({x:0,y:0,width:this._width,height:this._height});m.name="root",this._stage.defaultLayer.appendChild(m),this._rootGroup=m;const v=(p(h)?h:Yy(o))&&!1!==c&&KR.getStageEventPlugin("gesture");v&&(this._gestureController=new v(this._stage,g(h)?h:{})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender),!1!==c&&this._viewListeners.forEach((t=>{}))}getLayoutState(){return this._layoutState}updateLayoutTag(){this._layoutState=DI.before}_setCanvasStyle(){if(this._stage&&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")}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._stage&&("render"!==(null==e?void 0:e.actionSource)&&this._cachedMarks&&(this.reuseOrMorphing(e.morphConfig),this._cachedMarks=null),i.compile(),i.afterCompile())}clearNextRender(){return!!this._nextRafId&&(A_.getSpecifiedCancelAnimationFrame(10)(this._nextRafId),this._nextRafId=null,!0)}clear(t){const{chart:e}=t;this.clearNextRender(),e.clear()}renderNextTick(t){this._released||(this._nextRafId&&this.clearNextRender(),this._nextRafId=A_.getSpecifiedRequestAnimationFrame(10)((()=>{this._nextRafId=null,this.render(t)})))}_commitedAll(){return this._rootMarks.some((t=>HI(t,(t=>t.commit()))))}_hasCommitedMark(){return this._rootMarks.some((t=>HI(t,(t=>t.isCommited()),null,null,!0)))}_doRender(t){var e,i,s,n,r,a;null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeDoRender)||void 0===i||i.call(e,this._compileChart.getOption().globalInstance),this._stage&&(this._rootMarks.forEach((t=>{HI(t,(t=>{t.needClear&&(this._progressiveMarks||t.runAnimation(),t.clearExitGraphics(),t.needClear=!1)}),null,!0)})),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.beforeVRenderDraw)||void 0===n||n.call(s,this._compileChart.getOption().globalInstance),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this._handleAfterNextRender),t&&(this._stage.render(),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.afterVRenderDraw)||void 0===a||a.call(r,this._compileChart.getOption().globalInstance)))}renderMarks(){var t;this._hasCommitedMark()&&(jy(`--- start of renderMarks(${this._count}) ---`),this.clearProgressive(),this._rootMarks.forEach((t=>{t.render()})),this._layoutState===DI.before&&(this._layoutState=DI.layouting,null===(t=this._compileChart)||void 0===t||t.onLayout(),this._layoutState=DI.reevaluate,this._hasCommitedMark()&&this._rootMarks.forEach((t=>{t.render()})),this.handleLayoutEnd()),this.findProgressiveMarks(),this.updateStateAnimation(),this._doRender(!0),this.doPreProgressive(),jy(`--- start of renderMarks(${this._count}) ---`),this._count++)}reuseOrMorphing(t={}){const{reuse:e=!0,morph:i=!0,morphAll:s=!1,animation:n={},enableExitAnimation:r=!1}=t,a=VI(this._rootMarks),{update:o,exit:l}=function(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{i.morph&&t.getMarkConfig().morph||i.morphAll||i.reuse?r.push(t):s.enter.push({next:[t]})}));const a=NI(n,r,(t=>t.getMarkConfig().morphKey),(t=>t.getMarkConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=NI(n,r,(t=>`${t.getUserId()}`),(t=>`${t.getUserId()}`));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=zI(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=zI(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}(this._cachedMarks,a,{morph:i,morphAll:s,reuse:e});o.forEach((({prev:t,next:i})=>{if(e&&1===t.length&&1===i.length&&t[0].type===i[0].type)i[0].reuse(t[0]);else{const e=t.filter((t=>t.getMarkConfig().morph))[0];e&&i.forEach((t=>{t.getMarkConfig().morph&&t.prepareMorph(e)}))}})),l.forEach((({prev:t})=>{t.forEach((t=>{t.removeProduct()}))}))}render(t){if(this._released)return;if(this.clearNextRender(),this.initView(),!this._stage)return;const{width:e,height:i}=this._rootGroup.attribute;this._width===e&&this._height===i||this._rootGroup.setAttributes({width:this._width,height:this._height}),this.renderMarks(),this.clearNextRender()&&this.renderMarks()}setStageAnimationConfig(t){const e={};Object.keys(t).forEach((i=>{const s=t[i];y(s)?e[i]="disappear"===i?s.map((t=>{return"function"==typeof(e=t.callBack)&&/^class\s/.test(e.toString())?Object.assign(Object.assign({},t),{custom:t.callBack}):Object.assign(Object.assign({},t),{type:UI,customParameters:{callBack:t.callBack}});var e})):s.map((t=>{var e;const i=null!==(e=t.options)&&void 0!==e?e:{};return Object.assign(Object.assign({},t),{options:(...t)=>{const e="function"==typeof i?i(...t):i;return Object.assign({},e)}})})):e[i]=Object.assign({},t[i])})),this._stateAnimationConfig=e}updateStateAnimation(){const t=[];this._rootMarks.forEach((e=>{HI(e,(e=>{t.push(e)}))}));const e=t.map((t=>t.getAnimationState())),i=e.every((t=>t===OI.appear))?OI.appear:e.every((t=>t===OI.disappear))?OI.disappear:OI.none;this._stage.context||(this._stage.context={}),this._stage.context.animationState=i}updateViewBox(t,e=!0){if(!this._stage)return;const i=this._stage.viewBox;!t||i&&i.x1===t.x1&&i.y1===t.y1&&i.x2===t.x2&&i.y2===t.y2||this._stage.setViewBox(t,e)}resize(t,e,i=!0){if(!this._stage)return;const s=this._width!==t||this._height!==e;this._width=t,this._height=e,s&&(this._stage.resize(t,e),this._commitedAll(),i&&this.render({morph:!1}))}setBackground(t){this._stage&&(this._stage.background=t)}setSize(t,e){this._width=t,this._height=e,this._stage}setViewBox(t,e=!0){this.updateViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===fI.chart){const n=this.getRootGroup(),r=function(s){var r;const a=s.target;let o=null;a&&(o=p(a.context)?a:((t,e)=>{let i=e;for(;(null==i?void 0:i.parent)&&i.parent!==t;)if(i=i.parent,i.context)return i;return null})(n,a));const l=null!==(r=null==o?void 0:o.context)&&void 0!==r?r:{},h=p(l.markId)?l.markId:null,c=p(l.modelId)?l.modelId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:o,datum:hI(o),markId:h,modelId:c,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:r}),null===(s=this._stage)||void 0===s||s.addEventListener(e,r)}else if(t===fI.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===fI.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===fI.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._stage)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===fI.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===fI.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this.releaseGrammar(!0),this._stage!==(null===(t=this._option)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){t?this._rootMarks.forEach((t=>{HI(t,(t=>{t.removeProduct()}),null,!0)})):this._cachedMarks=VI(this._rootMarks),this._rootMarks=[]}addRootMark(t){this._rootMarks.includes(t)||this._rootMarks.push(t)}getRootMarks(){return this._rootMarks}removeRootMark(t){const e=this._rootMarks.findIndex((e=>e===t));return e>=0&&(this._rootMarks.splice(e,1),!0)}_getGlobalThis(){var t;return Gy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}_combineIncrementalLayers(){this._stage&&function(t){return xu(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{So.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()}))}findProgressiveMarks(){const t=[];return this._rootMarks.forEach((e=>{HI(e,(e=>{e.isProgressive()&&t.push(e)}))})),t.length?(this._progressiveMarks=t,this._combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=A_.getSpecifiedRequestAnimationFrame(10);this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this._progressiveMarks.forEach((t=>{t.runAnimation(),t.clearExitGraphics()})):this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){if(this._progressiveRafId){A_.getSpecifiedCancelAnimationFrame(10)(this._progressiveRafId)}this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}}function YI(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:Vy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function $I(t){t.crosshair=Y(t.crosshair||{}).map((e=>XR({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function XI(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}=ai(l,i.width,i.height);a=t,o=e}else if(h&&Gy(e.mode)){let t;t=_(h)?A_.getElementById(h):h;const{width:e,height:s}=ai(t,i.width,i.height);a=e,o=s}else if($y(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 KI(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function qI(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}}var ZI,JI,QI,tD,eD,iD;t.LayoutZIndex=void 0,(ZI=t.LayoutZIndex||(t.LayoutZIndex={}))[ZI.SeriesGroup=0]="SeriesGroup",ZI[ZI.Axis_Grid=50]="Axis_Grid",ZI[ZI.CrossHair_Grid=100]="CrossHair_Grid",ZI[ZI.Region=450]="Region",ZI[ZI.Mark=300]="Mark",ZI[ZI.Node=400]="Node",ZI[ZI.Axis=100]="Axis",ZI[ZI.MarkLine=500]="MarkLine",ZI[ZI.MarkArea=100]="MarkArea",ZI[ZI.MarkPoint=500]="MarkPoint",ZI[ZI.DataZoom=500]="DataZoom",ZI[ZI.ScrollBar=500]="ScrollBar",ZI[ZI.Player=500]="Player",ZI[ZI.Legend=500]="Legend",ZI[ZI.CrossHair=500]="CrossHair",ZI[ZI.Indicator=500]="Indicator",ZI[ZI.Title=500]="Title",ZI[ZI.Label=500]="Label",ZI[ZI.Brush=500]="Brush",ZI[ZI.CustomMark=500]="CustomMark",ZI[ZI.Interaction=700]="Interaction",t.LayoutLevel=void 0,(JI=t.LayoutLevel||(t.LayoutLevel={}))[JI.Indicator=10]="Indicator",JI[JI.Region=20]="Region",JI[JI.Axis=30]="Axis",JI[JI.DataZoom=40]="DataZoom",JI[JI.Player=40]="Player",JI[JI.ScrollBar=40]="ScrollBar",JI[JI.Legend=50]="Legend",JI[JI.Title=70]="Title",JI[JI.CustomMark=70]="CustomMark",t.AttributeLevel=void 0,(QI=t.AttributeLevel||(t.AttributeLevel={}))[QI.Default=0]="Default",QI[QI.Theme=1]="Theme",QI[QI.Chart=2]="Chart",QI[QI.Base_Series=3]="Base_Series",QI[QI.Series=4]="Series",QI[QI.Mark=5]="Mark",QI[QI.User_Chart=6]="User_Chart",QI[QI.User_Series=7]="User_Series",QI[QI.User_Mark=8]="User_Mark",QI[QI.User_SeriesStyle=9]="User_SeriesStyle",QI[QI.Built_In=99]="Built_In";class sD{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({},sD.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]))))}}sD.defaultMarkInfo={};class nD{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getStage(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getStage()}release(){this._option=null,this.getCompiler=null}}class rD{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=>XR({},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 aD extends nD{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}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=rD,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new sD,this._lastLayoutRect=null,this.id=Ky(),this.userId=t.id,this._spec=t,this.effect={},this.event=new dI(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){var i;null===(i=this._layout)||void 0===i||i.onLayoutStart(t,e)}onLayoutEnd(){var t;null===(t=this._layout)||void 0===t||t.onLayoutEnd(),this.getMarks().forEach((t=>t.commit(!1,!0)))}onEvaluateEnd(t){}onBeforeRender(){}onDataUpdate(){}beforeRelease(){}clear(){this.getMarks().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}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){var e;const i=this._compareSpec(t,this._spec);return(i.reRender||i.reMake||i.reCompile)&&(null===(e=this._layout)||void 0===e||e.setWillLayoutTag()),this._spec=t,i}_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){if(!p(t)||!p(e))return;const{style:i,state:s}=e,n=Object.assign({},e);i&&(n.style=this._convertMarkStyle(i)),s&&(n.state={},Object.keys(s).forEach((t=>{n.state[t]=this._convertMarkStyle(s[t])}))),t.initStyleWithSpec(n)}stateKeyToSignalName(t,e){let i=`${yO}_${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,i={},s){const{type:n,name:r}=t,{parent:a}=i,o=e(i,["parent"]),l=KR.createMark(n,r,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},o));return a?a.addMark(l):this.getCompiler().addRootMark(l),l&&(l.created(),s&&l.setMarkConfig(s)),l}_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 L(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}updateAnimateStateCallback(t){this._aniamtionStateCallback=t}getAnimationStateCallback(){return this._aniamtionStateCallback}}class oD{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}get lastComputeRect(){return this._lastComputeRect}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}get willLayoutTag(){return this._willLayoutTag}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._willLayoutTag=!0,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){let a=RR(IR(t.padding),e,e);this._option.transformLayoutPadding&&(a=this._option.transformLayoutPadding(a)),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:LR(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:LR(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:LR(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:LR(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:LR(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:LR(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=LR(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=LR(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){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(){}_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]=LR(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(OR(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}setWillLayoutTag(){this._willLayoutTag=!0}clearWillLayoutTag(){this._willLayoutTag=!1}}class lD extends aD{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,this._transformLayoutPadding=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 oD(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition,transformLayoutPadding:this._transformLayoutPadding}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e){this._isLayout=!0,super.onLayoutStart(t,e)}onLayoutEnd(){super.onLayoutEnd(),this.updateLayoutAttribute();const t=this.getLayoutRect();!this._forceLayoutTag&&U(this._lastLayoutRect,t)||(this._lastLayoutRect=Object.assign({},t)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t,e;this._isLayout||(null===(t=this._layout)||void 0===t||t.setWillLayoutTag(),this._forceLayoutTag=!0,null===(e=this._option.globalInstance.getChart())||void 0===e||e.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,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 hD extends rD{_initTheme(t,e){return{spec:t,theme:this._theme}}}class cD extends lD{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=hD,this.modelType="region",this.specKey="region",this.type=cD.type,this._series=[],this.layoutType="region",this.layoutZIndex=t.LayoutZIndex.Region,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"}_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,i;this.initLayout(),super.created();const s=null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._spec.roam&&this._groupMark.setMarkConfig({interactive:!0}),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(i=this.userId)&&void 0!==i?i:this.type)+"_interaction",t.LayoutZIndex.Interaction),P(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"},{parent:this._groupMark}),s&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"},{parent:this._groupMark})),[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.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark+1}))}_createGroupMark(e,i,s){var n,r;const a=this._createMark({type:"group",name:e});a.setUserId(i),a.setMarkConfig({zIndex: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()}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,pickable:!1}),"normal",t.AttributeLevel.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(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})}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=[]}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}compile(){this.compileMarks()}onLayoutEnd(){this._series.forEach((t=>t.onLayoutEnd())),super.onLayoutEnd()}}function dD(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 uD(t,e,i){e?t.forEach((t=>{const e=$(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=$(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 pD(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 gD(t,e,i,s,n,r){if(t.length){let a=0;const o="right"===n,l=o?-1:1;let h=o?e.rightCurrent:e.leftCurrent,c=e.topCurrent;const d=[];let u=[];const p=[];t.forEach((t=>{const{rect:s}=_D(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=o?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:c+t.layoutOffsetY+t.layoutPaddingTop}),c+=n,c>i&&u.length?(p.push(a),h+=l*a,a=g,c=e.topCurrent+n,t.setLayoutStartPosition({x:h+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),d.push(u),u=[t]):(a=Math.max(a,g),u.push(t))})),p.push(a),d.push(u),pD(d,!0,p,l),s&&uD(d,!0,i),o?e.rightCurrent=h+l*a:e.leftCurrent=h+l*a}}function fD(t,e,i,s,n){if(t.length){let i=0;const r="right"===s,a=r?-1:1;let o=r?e.rightCurrent:e.leftCurrent,l=e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{rect:s}=_D(t,e,n),u=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=r?-s.width-t.layoutPaddingRight:t.layoutPaddingLeft;l{const{rect:s}=_D(t,e,r),n=s.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=s.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?t.layoutPaddingTop:-s.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:h+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),h+=g,h>i&&u.length?(p.push(l),h=e.leftCurrent+g,c+=o*l,l=n,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:c+t.layoutOffsetY+f}),d.push(u),u=[t]):(l=Math.max(l,n),u.push(t))})),p.push(l),d.push(u),pD(d,!1,p,o),s&&uD(d,!1,i),a?e.topCurrent=c+o*l:e.bottomCurrent=c+o*l}}function vD(t,e,i,s,n){if(t.length){const i="top"===s,r=i?1:-1;let a=0,o=e.rightCurrent,l=i?e.topCurrent:e.bottomCurrent;const h=[];let c=[];const d=[];t.forEach((t=>{const{layoutTag:s,layoutRect:d,rect:u}=_D(t,e,n),p=u.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=u.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=i?t.layoutPaddingTop:-u.height-t.layoutPaddingBottom;oe.layoutLevel-t.layoutLevel))}_layoutNormalItems(t,e){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType)),e),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)),e)}_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){var n,r,a;this._layoutInit(t,e,i,s);const o={recomputeWidth:this.recomputeWidth,recomputeHeight:this.recomputeHeight},l=null!==(a=null===(r=null===(n=null==t?void 0:t.getSpec())||void 0===n?void 0:n.layout)||void 0===r?void 0:r.secondLayoutLeftRight)&&void 0!==a&&a;this._layoutNormalItems(e,o);const h={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:c,relativeItems:d,relativeOverlapItems:u,allRelatives:p,overlapItems:g}=this._groupItems(e);this.layoutRegionItems(c,d,u,g,o,l),this._processAutoIndent(c,d,u,g,p,h,o,l),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.forEach((t=>{t.clearWillLayoutTag()}))}_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,a,o=!1){if(n.some((t=>t.autoIndent))){const{top:l,bottom:h,left:c,right:d}=this._checkAutoIndent(n,r);(l||h||c||d)&&(this.topCurrent=r.top+l,this.bottomCurrent=r.bottom-h,this.leftCurrent=r.left+c,this.rightCurrent=r.right-d,this.layoutRegionItems(t,e,i,s,a,o))}}layoutNormalItems(t,e){t.forEach((t=>{const{rect:i}=_D(t,this,e);"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,e){const i=t.filter((t=>"left"===t.layoutOrient)),s=t.filter((t=>"right"===t.layoutOrient)),n=t.filter((t=>"top"===t.layoutOrient)),r=t.filter((t=>"bottom"===t.layoutOrient)),a=this._chartLayoutRect.width+this._chartLayoutRect.x,o=this._chartLayoutRect.height+this._chartLayoutRect.y;return i.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=dD(t);n.length&&gD(n,e,i,!1,"left",s),r.length&&gD(r,e,i,!0,"left",s),a.length&&fD(a,e,0,"left",s)}(i,this,o,e),n.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=dD(t);n.length&&mD(n,e,i,!1,"top",s),r.length&&mD(r,e,i,!0,"top",s),a.length&&vD(a,e,0,"top",s)}(n,this,a,e),s.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=dD(t);n.length&&gD(n,e,i,!1,"right",s),r.length&&gD(r,e,i,!0,"right",s),a.length&&fD(a,e,0,"right",s)}(s,this,o,e),r.length&&function(t,e,i,s){const{startItems:n,middleItems:r,endItems:a}=dD(t);n.length&&mD(n,e,i,!1,"bottom",s),r.length&&mD(r,e,i,!0,"bottom",s),a.length&&vD(a,e,0,"bottom",s)}(r,this,a,e),!0}_layoutRelativeOverlap(t,e,i){e.items.forEach((t=>{const{rect:s}=_D(t,this,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=>{U(i.getLayoutRect(),e.rect)||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{rect:i}=_D(t,this,e,!1);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r=!1){const a=this.leftCurrent,o=this.rightCurrent;let l=this.rightCurrent-this.leftCurrent,h=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("left",s.left,n),this._layoutRelativeOverlap("right",s.right,n),l=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),this._layoutRelativeOverlap("top",s.top,n),this._layoutRelativeOverlap("bottom",s.bottom,n),h=this.bottomCurrent-this.topCurrent,r&&(this.leftCurrent=a,this.rightCurrent=o,e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,n)})),l=this.rightCurrent-this.leftCurrent);const{regionWidth:c,regionHeight:d}=this._layoutRegionItem(t,l,h);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+c-l})}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+d-h})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.willLayoutTag&&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:Vy)("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}}}yD.type="base",function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(tD||(tD={})),t.STATE_VALUE_ENUM=void 0,(eD=t.STATE_VALUE_ENUM||(t.STATE_VALUE_ENUM={})).STATE_NORMAL="normal",eD.STATE_HOVER="hover",eD.STATE_HOVER_REVERSE="hover_reverse",eD.STATE_DIMENSION_HOVER="dimension_hover",eD.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",eD.STATE_SELECTED="selected",eD.STATE_SELECTED_REVERSE="selected_reverse",eD.STATE_SANKEY_EMPHASIS="selected",eD.STATE_SANKEY_EMPHASIS_REVERSE="blur",eD.STATE_HIGHLIGHT="highlight",eD.STATE_BLUR="blur",eD.STATE_ACTIVE="active",function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(iD||(iD={}));const bD=["linear","radial","conical"],xD={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}};const SD={};Object.values(t.STATE_VALUE_ENUM).forEach((t=>{SD[t]=!0})),t.STATE_VALUE_ENUM.STATE_HOVER,t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,t.STATE_VALUE_ENUM.STATE_SELECTED,t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE;class AD extends nD{compile(){}getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}updateState(t,e){if(t&&(j(this._stateMap,t),!e))return this.getCompiler().renderNextTick()}}class kD extends AD{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:{}})}))}clearAllStateInfo(){this._stateInfoList=[]}_isMultiMark(){return!this._mark||(t=this._mark.type,FI.includes(t));var t}checkOneState(t,e,i){var s;let n=!1,r=!1;if(p(i.datums)&&i.datums.length>0)n=this.checkDatumState(i,e),r=!0;else if(i.items)n=null!==(s=this.checkItemsState(i,t))&&void 0!==s&&s,r=!0;else if(i.fields)n=this.checkFieldsState(i,e,t),r=!0;else if(!n&&i.filter){const s={mark:this._mark,renderNode:t,type:this._mark.type};n=i.filter(null==e?void 0:e[0],s),r=!0}return r?n?"in":"out":"skip"}checkState(t,e){var i;const s=(null!==(i=t.context.states)&&void 0!==i?i:[]).filter((t=>!!SD[t])).map((t=>[t,10]));for(let i=0;it[0]))}checkDatumState(t,e){let i=!1;const s=e[0];if(y(t.datums)){const e=this._isMultiMark(),n=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(yO)));i=t.datums.some((t=>e&&y(null==t?void 0:t.items)?n.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])})):n.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(yO))),n=this._isMultiMark();i=e.every((e=>{var i,r;return n?(null===(i=t.datums.items)||void 0===i?void 0:i[0][e])===s[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===s[e]}))}else i=e===t.datums;return i}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i){var s;let n=!0;for(const r in t.fields){const a=t.fields[r],o=a.type,l=a.domain,h=null===(s=e[0])||void 0===s?void 0:s[r];if(VC(o)&&l.length>1){if(this.checkLinearFieldState(l,r,e,i)){n=!1;break}n=!0}else{if(!l.some((t=>t===h))){n=!1;break}n=!0}}return n}checkLinearFieldState(t,e,i,s){var n;const r=this._isMultiMark()?null===(n=i[0])||void 0===n?void 0:n[e]:i[e];return rt[t.length-1]}release(){}}class MD extends nD{constructor(){super(...arguments),this.id=Ky(),this._compiledProductId=null}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}compile(t){this._compileProduct(t)}setTransform(t){this._transform=t}runTransforms(t,e){if(!t||!t.length)return e;let i=e;return t.forEach((t=>{var e;i=null===(e=KR.getGrammarTransform(t.type))||void 0===e?void 0:e.transform(t,i)})),i}}class TD extends MD{getProduct(){return this._product||(this._product=this.runTransforms(this._transform,this.getLatestData())),this._product}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._data=null,this._data=e}removeProduct(){this._product=null,this._prevProduct=null,this._compiledProductId=null}release(){this.removeProduct(),super.release(),this._data=null}addRelatedMark(t){this._relatedMarks||(this._relatedMarks={}),this._relatedMarks[t.id]=t}updateData(t){if(this._compileProduct(),this._relatedMarks){let e=!1;if(Object.keys(this._relatedMarks).forEach((t=>{this._relatedMarks[t]&&(e=!0,this._relatedMarks[t].commit())})),!t&&e)return this.getCompiler().renderNextTick()}}_compileProduct(){this._prevProduct=this._product,this._product=null}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}}const wD=(t,e,i,s)=>"function"==typeof t?t(e,i,s):t,CD=(t,e,i,s,n)=>{var r;const a={prev:t.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]})),next:e.map((t=>{var e,i;return null===(i=null===(e=t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]}))},o={prev:t.slice(),next:e.slice()},l=null!==(r=i.animation)&&void 0!==r?r:{},h=l.easing,c=wD(l.delay,n,a,o),d=wD(l.duration,n,a,o),u=wD(l.oneByOne,n,a,o),p=wD(l.splitPath,n,a,o),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)?Nw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Uw)(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);zw(o,e,Object.assign({},i,{onEnd:l,delay:h}),t.globalTransMatrix)}))})(t[0],e,{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)?Nw:null!==(s=null==i?void 0:i.splitPath)&&void 0!==s?s:Uw)(e,a.length,!0),l=e.attribute;e.setAttribute("visible",!1);const h=a.map(((t,e)=>Ow(t.toCustomPath(),o[e].toCustomPath(),{fromTransform:t.globalTransMatrix,toTransfrom:o[e].globalTransMatrix}))),c=a.map(((t,e)=>Dw(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:Ko.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 Fw({morphingData:h[s],saveOnEnd:!0,otherAttrs:c[s]},null!==(o=i.duration)&&void 0!==o?o:Ew,null!==(l=i.easing)&&void 0!==l?l:Bw))}))}else{const t=null==i?void 0:i.onEnd,s=i?Object.assign({},i):{};s.onEnd=()=>{e.setAttribute("visible",!0,!1,{type:Ko.ANIMATE_END}),e.detachShadow(),t&&t()};const a=e.animate(s);(null==i?void 0:i.delay)&&a.wait(i.delay),a.play(new jw({morphingData:h,otherAttrs:c},null!==(n=null==i?void 0:i.duration)&&void 0!==n?n:Ew,null!==(r=null==i?void 0:i.easing)&&void 0!==r?r:Bw))}})(t,e[0],{delay:c,duration:d,easing:h,onEnd:s,individualDelay:g,splitPath:p}):zw(t[0],e[0],{delay:c,duration:d,easing:h,onEnd:s})},ED=(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))))},BD=t=>{const e=t.getMarkConfig();if(p(e.morphElementKey)){t.getGraphics().forEach((t=>{var i,s;const n=null===(s=null===(i=t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0];n&&(t.context.morphKey=n[e.morphElementKey])}))}};class PD extends MD{commit(t,e){e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.commit(!1,e))),this._isCommited=!0,t&&this.getCompiler().renderNextTick()}uncommit(){this._isCommited=!1}isCommited(){return this._isCommited}getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}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){u(this._data)&&this.initMarkData(this._option),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t,t&&t.addRelatedMark(this)}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){const e="group"===this.type?{selfOnly:!0}:{},i=t=>{var i;const s=null!==(i=t.options)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},e),t),{options:(t,e,i)=>{var n,r;const a="function"==typeof s?s(t,e,i):s;if(e&&e.context&&e.context.compiler&&p(e.context.modelId)){const t=null===(n=e.context.compiler.getChart())||void 0===n?void 0:n.getModelById(e.context.modelId);return Object.assign(Object.assign({},a),{layoutRect:null===(r=null==t?void 0:t.getLayoutRect)||void 0===r?void 0:r.call(t)})}return Object.assign({},a)}})},s={};Object.keys(t).forEach((e=>{const n=t[e];y(n)?s[e]=n.map(i):p(n)&&(s[e]=i(n))})),this._animationConfig=s}disableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=[...new Set([...this._disabledAnimationStates,...e])]}enableAnimationByState(t){const e=Y(t);this._disabledAnimationStates=this._disabledAnimationStates.filter((t=>!e.includes(t)))}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}setGroupKey(t){this._groupKey=t}getProduct(){return this._product}initMarkData(t){this._data=new TD(t),this._data.addRelatedMark(this)}_compileProduct(t){this.commit(),this._context=null==t?void 0:t.context;const e=this.getProduct();if(this._visible){if(p(e))t.group&&e.parent!==t.group&&t.group.appendChild(e);else{if(!this.getCompiler().isInited)return;this._initProduct(null==t?void 0:t.group)}u(this._product)||(this.compileData(),this.compileState(),this.compileEncode())}else p(e)&&this.removeProduct()}_initProduct(t){var e;if(!this.getStage())return;const i=this.getProductId();this._product=Lp("group"!==this.type?{pickable:!1,zIndex:this._markConfig.zIndex,overflow:this._markConfig.overflow}:{}),this._product.name=i,this._product.mark=this,(null!=t?t:null===(e=this.getCompiler())||void 0===e?void 0:e.getRootGroup()).appendChild(this._product),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}layout(t){}compileData(){u(this._data)||this._data.compile()}compileEncode(){}compileState(){}compileAnimation(){}compileContext(t){this._context=Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)}getContext(){return this._context}compileTransform(){}updateState(t,e){return this.commit(),this.state.updateState(t,e)}getMarks(){return[]}runAnimationByState(t){}stopAnimationByState(t){}pauseAnimationByState(t){}resumeAnimationByState(t){}removeProduct(){this._product&&this._product.parent&&this._product.parent.removeChild(this._product),this._product=null,this._compiledProductId=null}release(){this.state.release(),super.release(),this._lastMark=null}setSimpleStyle(t){this._simpleStyle=t}getSimpleStyle(){return this._simpleStyle}constructor(e,i){var s;super(i),this.type=void 0,this.name="mark",this._markConfig={zIndex:t.LayoutZIndex.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._disabledAnimationStates=[],this._skipBeforeLayouted=!1,this._extensionChannel={},this._computeExChannel={},this._graphicMap=new Map,this._graphics=[],this._getEncoderOfStyle=(t,e)=>{if(e&&t){const i={};return Object.keys(e).forEach((e=>{this._unCompileChannel[e]||(i[e]=this._computeAttribute(e,t))})),i}return null},this._setGraphicFromMarkConfig=t=>{const{setCustomizedShape:e,graphicName:i}=this._markConfig;e&&(t.pathProxy=i=>e(t.context.data,i,new Ul)),i&&(d(i)?t.name=i(t):t.name=i)},this._setStateOfGraphic=(t,e)=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==tD.enter&&t.context.diffState!==tD.update||(t.stateProxy=(e,i)=>{var s;return this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)},t.context.states&&t.useStates(t.context.states,e))},this.name=e,this.model=i.model,this.key=i.key,this.state=new kD(i,this),this._attributeContext=i.attributeContext,null===(s=i.map)||void 0===s||s.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._markConfig.setCustomizedShape=t.customShape,this._stateSort=t.stateSort,this._initSpecStyle(t))}_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,ae)}isUserLevel(e){return[t.AttributeLevel.User_Mark,t.AttributeLevel.User_Series,t.AttributeLevel.User_Chart,t.AttributeLevel.User_SeriesStyle].includes(e)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this.isUserLevel(i);Object.keys(t).forEach((n=>{let r=t[n];u(r)||(r=this._filterAttribute(n,r,e,i,s),this.setAttribute(n,r,e,i))}))}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){let r=this._styleConvert(e);if(n)switch(t){case"angle":r=this.convertAngleToRadian(r);break;case"innerPadding":case"outerPadding":r=this._transformStyleValue(r,(t=>-t));break;case"curveType":r=this._transformStyleValue(r,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return r}setReferer(t,e,i){var s;if(t)if(e&&i){const n=null!==(s=this.stateStyle[i])&&void 0!==s?s:{[e]:{}};this.stateStyle[i][e]=Object.assign(Object.assign({},n[e]),{referer:t})}else Object.entries(this.stateStyle).forEach((([e,i])=>{Object.entries(i).forEach((([i,s])=>{this.stateStyle[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"){return this._computeAttribute(t,i)(e)}getAttributesOfState(t,e="normal"){const i=this.stateStyle[e];if(i){const s={};return Object.keys(i).forEach((i=>{this._unCompileChannel[i]||(s[i]=this._computeAttribute(i,e)(t))})),s}}setAttribute(t,e,i="normal",s=0){var n;void 0===this.stateStyle[i]&&(this.stateStyle[i]={}),void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]={level:s,style:e,referer:void 0});const r=null===(n=this.stateStyle[i][t])||void 0===n?void 0:n.level;p(r)&&r<=s&&XR(this.stateStyle[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===this.stateStyle[i][t]&&(this.stateStyle[i][t]=this.stateStyle.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(NC(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=MR(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),e.clamp&&t.clamp&&t.clamp(e.clamp))}(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=>{let a=n(r);return a=s.postProcess(a,r,this._attributeContext,this.getDataView()),i(t,r,e,a)}}if(r)return t=>s.postProcess(n(t),t,this._attributeContext,this.getDataView());if(a){const i=this._computeExChannel[t];return s=>i(t,s,e,n(s))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?e=>t.style(e,this._attributeContext,{mark:this},this.getDataView()):bD.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):NC(null===(s=t.style.scale)||void 0===s?void 0:s.type)?e=>{let i=e;return"series"===this.model.modelType&&this.model.getMarkData&&(i=this.model.getMarkData(e)),t.style.scale.scale(i[t.style.field])}:e=>t.style:e=>t.style:t=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(e){e.style&&this.setStyle(e.style,"normal",t.AttributeLevel.User_Mark);const i=e.state;i&&Object.keys(i).forEach((e=>{const s=i[e];if("style"in s){const i=s.style;let n={stateValue:e};"level"in s&&(n.level=s.level),"filter"in s&&(n=d(s.filter)?Object.assign({filter:s.filter},n):Object.assign(Object.assign({},s.filter),n)),this.state.addStateInfo(n),this.setStyle(i,e,t.AttributeLevel.User_Mark)}else this.setStyle(s,e,t.AttributeLevel.User_Mark)}))}_computeGradientAttr(t){var i,s,n,r,a;const{gradient:o,scale:l,field:h}=t,c=e(t,["gradient","scale","field"]);let u=l,g=h;if(!(l&&h||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();l||(u=t),g||(g=e)}const f=mR(fR(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),null!==(a=null===(r=null===(n=this.model)||void 0===n?void 0:n.getDefaultColorDomain)||void 0===r?void 0:r.call(n))&&void 0!==a?a:[]),m=Object.assign(Object.assign({},xD[o]),c);return t=>{const e={},i=this.getDataView();return Object.keys(m).forEach((s=>{const n=m[s];"stops"===s?e.stops=n.map((e=>{const{opacity:s,color:n,offset:r}=e;let a=null!=n?n:null==u?void 0:u.scale(t[g]);return d(n)&&(a=n(t,this._attributeContext,i)),p(s)&&(a=ei.SetOpacity(a,s)),{offset:d(r)?r(t,this._attributeContext,i):r,color:a||f[0]}})):d(n)?e[s]=n(t,this._attributeContext,i):e[s]=n})),e.gradient=o,e}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return t=>{var e,r,a;const o={};if(Object.keys(n).forEach((e=>{const i=n[e];d(i)?o[e]=i(t,this._attributeContext,this.getDataView()):o[e]=i})),"stroke"in o)bD.includes(null===(a=n.stroke)||void 0===a?void 0:a.gradient)&&(o.stroke=this._computeGradientAttr(n.stroke)(t));else{const n=mR(fR(this.model.getColorScheme(),"series"===this.model.modelType?null===(r=(e=this.model).getSpec)||void 0===r?void 0:r.call(e):void 0),this.model.getDefaultColorDomain());let a=i,l=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:e,field:s}=this.model.getColorAttribute();i||(a=e),l||(l=s),o.stroke=(null==a?void 0:a.scale(t[l]))||n[0]}}return o}}_getDataByKey(t){return zI(t,((t,e)=>{var i;return`${this._groupKeyGetter(t)}_${null!==(i=this._keyGetter(t))&&void 0!==i?i:e}`}))}_getCommonContext(){return{compiler:this.getCompiler(),markType:this.type,markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId}}prepareMorph(t){this._lastMark=t}reuse(t){this.type===t.type&&(this._product=t.getProduct(),this._product&&(this._product.clearStates(),this._graphics=t.getGraphics(),this._graphics.forEach((t=>{t.clearStates()})),this._graphicMap=t._graphicMap,this._graphicMap.forEach((t=>{t.context=Object.assign(Object.assign({},t.context),this._getCommonContext())})),this._dataByKey=t._dataByKey,this._prevDataByKey=t._prevDataByKey,this.needClear=t.needClear))}_parseProgressiveContext(t){const e=this._markConfig.progressiveStep>0&&this._markConfig.progressiveThreshold>0&&this._markConfig.progressiveStep0&&t.length>=this._markConfig.largeThreshold;if(e){const e=this._dataByGroup;return e&&e.keys&&e.keys.some((t=>e.data.get(t).length>this._markConfig.progressiveThreshold))?{large:i,progressive:{data:t,step:this._markConfig.progressiveStep,currentIndex:0,totalStep:e.keys.reduce(((t,i)=>Math.max(Math.ceil(e.data.get(i).length/this._markConfig.progressiveStep),t)),1),groupedData:e.data}}:{large:i}}return{large:i}}getGraphics(){return this._graphics}_createGraphic(t={}){return KR.createGraphicComponent(this.type,t)}_runGroupData(t){this._keyGetter=d(this.key)?this.key:p(this.key)?t=>null==t?void 0:t[this.key]:t=>null==t?void 0:t[kO],this._groupKeyGetter=p(this._groupKey)?t=>`${null==t?void 0:t[this._groupKey]}`:()=>"key",this._dataByGroup=zI(t,this._groupKeyGetter)}getAnimationState(){const t=this._graphics.map((t=>t.context.animationState)),e=t.every((t=>t===OI.appear))?OI.appear:t.every((t=>t===OI.disappear))?OI.disappear:t[0];return null!=e?e:OI.none}createAnimationStateList(t,e){var i;let s=e[t];return s&&Array.isArray(s)&&(s=1===s.length?s[0]:s),Array.isArray(s)?s.map(((t,e)=>{var i;return Object.assign(Object.assign({},t),{priority:null!==(i=t.priority)&&void 0!==i?i:1/0})})):s?Object.assign(Object.assign({},s),{priority:"normal"===t?null!==(i=s.priority)&&void 0!==i?i:1/0:s.priority}):s}tryRunMorphing(t){if(this._lastMark){t.forEach((t=>{"appear"!==t.context.animationState&&"enter"!==t.context.animationState||t.setAttributes(t.getAttributes(!0))}));const e=((t,e,i={})=>{const s=[],n=[];t.forEach((t=>{BD(t),s.push(...t.getGraphics())})),e.forEach((t=>{BD(t),n.push(...t.getGraphics())}));const r=t=>{var e,i,s;return null!==(i=null===(e=t.context)||void 0===e?void 0:e.morphKey)&&void 0!==i?i:null===(s=t.context)||void 0===s?void 0:s.key},a=new Map,o=new Map;if(s.forEach((t=>{const e=r(t);e&&(a.has(e)||a.set(e,[]),a.get(e).push(t))})),n.forEach((t=>{const e=r(t);e&&(o.has(e)||o.set(e,[]),o.get(e).push(t))})),a.size!==o.size||!Array.from(a.keys()).every((t=>o.has(t))))return!1;const l=[...new Set([...a.keys()].filter((t=>o.has(t))))],h=[...o.keys()].filter((t=>!a.has(t)));let c=0;const d=()=>{c-=1,0===c&&e.forEach((t=>{}))};return h.forEach((t=>{const e=o.get(t);CD([],e,i,d,{}),c+=1})),l.forEach((t=>{const e=a.get(t),s=o.get(t),n=Math.min(e.length,s.length);if(n>0){const t=ED(e,n),r=ED(s,n);for(let e=0;e"appear"===t.context.animationState)),r=this.createAnimationStateList("appear",s);if(n&&this._product){const t=r?["appear"]:[],e=r?[{name:"appear",animation:r}]:[];if(s.normal){t.push("normal");const i={name:"normal",animation:this.createAnimationStateList("normal",s)};e.push(i)}this._product.applyAnimationState(t,e)}let a=!1;if(t.forEach((t=>{const e=t.context.animationState;if("appear"===e)return;const i=s[e];if(i&&i.length>0){const s=i.map(((t,i)=>({name:`${e}_${i}`,animation:t})));s.forEach((e=>{e.animation.customParameters=t.context}));const n=[e];t.applyAnimationState(n,[1===s.length?s[0]:s])}"enter"===e&&s.normal&&(a=!0)})),a&&this._product&&(null===(i=s.normal)||void 0===i?void 0:i.length)){this._product.stopAnimationState("normal","start");const t={name:"normal",animation:this.createAnimationStateList("normal",s)};this._product.applyAnimationState(["normal"],[t])}}_setAnimationState(t){var e,i,s;const n=("component"===this.type?this.model.getAnimationStateCallback():null===(s=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.getAnimationStateCallback())||(t=>{var e;const i=null===(e=t.context)||void 0===e?void 0:e.diffState;return i===OI.exit?OI.exit:i===OI.update?OI.update:OI.appear}),r=n(t);t.context.animationState=null!=r?r:t.context.diffState,t.context.animationState===tD.exit&&(t.context.reusing=!0,t.animates&&t.animates.forEach((t=>t.stop())))}_runJoin(t){const e=this._getDataByKey(t),i=this._prevDataByKey,s=[],n=new Set(this._graphics.filter((t=>t.context.diffState===tD.enter))),r=(t,e,i)=>{var r,a,o,l,h,c,d,p,g;let f,m;return u(e)?(f=this._graphicMap.get(t),f&&(m=tD.exit)):u(i)?(f=this._graphicMap.has(t)?this._graphicMap.get(t):{},m=tD.enter,f.isExiting=!1,this._graphicMap.set(t,f),s.push(f)):(f=this._graphicMap.get(t),f&&(m=tD.update,s.push(f))),f&&(n.delete(f),f.context=Object.assign(Object.assign({},this._getCommonContext()),{diffState:m,reusing:null===(r=f.context)||void 0===r?void 0:r.reusing,originalFieldX:null===(a=f.context)||void 0===a?void 0:a.originalFieldX,originalFieldY:null===(o=f.context)||void 0===o?void 0:o.originalFieldY,fieldX:null===(l=f.context)||void 0===l?void 0:l.fieldX,fieldY:null===(h=f.context)||void 0===h?void 0:h.fieldY,data:null!=e?e:null===(c=f.context)||void 0===c?void 0:c.data,uniqueKey:t,key:e?this._keyGetter(e[0]):null===(d=f.context)||void 0===d?void 0:d.key,groupKey:e?this._groupKeyGetter(e[0]):null===(p=f.context)||void 0===p?void 0:p.groupKey,indexKey:"__VCHART_DEFAULT_DATA_INDEX",stateAnimateConfig:null===(g=this.getAnimationConfig())||void 0===g?void 0:g.state}),this._setAnimationState(f)),f};if(i&&e){const t=new Map(i.data);e.keys.forEach((i=>{r(i,e.data.get(i),t.get(i)),t.delete(i)})),i.keys.forEach((e=>{t.has(e)&&r(e,null,t.get(e))}))}else e?e.keys.forEach((t=>{const i=r(t,e.data.get(t),null);i&&(i.context.animationState=OI.appear)})):i&&i.keys.forEach((t=>{r(t,null,i.data.get(t)).context.animationState=OI.disappear}));n.forEach((t=>{this._graphicMap.delete(t.context.uniqueKey),t.parent&&t.parent.removeChild(t),t.release()}));const a=s.length;s.forEach(((t,e)=>{t.context.graphicCount=a,t.context.graphicIndex=e,t.stateSort=this._stateSort})),this._dataByKey=e,this._graphics=s,this.needClear=!0}_runEncoderOfGraphic(t,e,i={}){return jI(t,e.context.data[0],i)}_runGroupEncoder(t){if(!this._dataByGroup)return null;const e={};return this._dataByGroup.keys.forEach((i=>{e[i]=jI(t,this._dataByGroup.data.get(i)[0])})),this._attrsByGroup=e,e}_transformGraphicAttributes(t,e,i){return Object.assign(Object.assign({},i),e)}_separateNormalStyle(t){const e={},i={};return Object.keys(t).forEach((s=>{this._unCompileChannel[s]||(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))}(s,t,this._groupKey)?e[s]=t[s]:i[s]=t[s])})),{updateStyles:e,groupStyles:i}}_addProgressiveGraphic(t,e){t.incrementalAppendChild(e)}_runEncoder(t,e){var i;const s=e?null:this._runGroupEncoder(null===(i=this._encoderOfState)||void 0===i?void 0:i.group);t.forEach(((t,e)=>{var i,n;let r=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i.update,t);null===(n=t.currentStates)||void 0===n||n.forEach((e=>{var i;const s=this._runEncoderOfGraphic(null===(i=this._encoderOfState)||void 0===i?void 0:i[e],t);r=Object.assign(Object.assign({},r),s)})),u(this._markConfig.interactive)||(r.pickable=this._markConfig.interactive);const a=this._transformGraphicAttributes(t,r,null==s?void 0:s[t.context.groupKey]);t.context.finalAttrs=a}))}_runApplyGraphic(t){const e=this.hasAnimation();t.forEach(((i,s)=>{var n,r,a;const o=i.context.finalAttrs,l=this.hasAnimationByState(i.context.animationState);if(i.setAttributes){const t=cI(i,o);i.context.diffAttrs=t,i.context.reusing?(i.context.lastAttrs=i.attribute,i.initAttributes({}),i.context.reusing=!1):l||(e?i.setAttributesAndPreventAnimate(t):i.setAttributes(t)),!(null===(a=this.renderContext)||void 0===a?void 0:a.progressive)&&this._product&&i.parent!==this._product&&this._product.appendChild(i),e&&i.setFinalAttributes(o)}else{const a=i;i=this._createGraphic(o),e&&(null===(n=i.setFinalAttributes)||void 0===n||n.call(i,o)),i.context=a.context,i.context.diffAttrs=o,i.stateSort=this._stateSort;const l=this._graphics===t?s:s+this._graphics.length-t.length;if(l>=0&&(this._graphics[l]=i),null===(r=this.renderContext)||void 0===r?void 0:r.progressive){const t=this._dataByGroup?this._dataByGroup.keys.indexOf(i.context.groupKey):0,e=t>=0?this._product.getChildAt(t):null;e&&this._addProgressiveGraphic(e,i)}else this._product.appendChild(i),this._graphicMap.set(i.context.uniqueKey,i)}this._setStateOfGraphic(i,l),this._setGraphicFromMarkConfig(i)}))}_updateEncoderByState(){const e={};Object.keys(this.stateStyle).forEach((i=>{if(i===t.STATE_VALUE_ENUM.STATE_NORMAL){const{groupStyles:t,updateStyles:s}=this._separateNormalStyle(this.stateStyle[i]);e.group=this._getEncoderOfStyle(i,t),e.update=this._getEncoderOfStyle(i,s)}else e[i]=this._getEncoderOfStyle(i,this.stateStyle[i])})),this._encoderOfState=e}_runState(t){t.forEach((t=>{var e;const i=[...(null!==(e=t.currentStates)&&void 0!==e?e:[]).filter((t=>!this.state.getStateInfo(t))),...this.state.checkState(t,t.context.data)];this._stateSort&&i.length&&i.sort(this._stateSort),t.context.states=i}))}_getAttrsFromConfig(t={}){const{zIndex:e,clip:i,clipPath:s,overflow:n}=this._markConfig;if(u(e)||(t.zIndex=e),u(i)||(t.clip=i),!u(s)){const e=y(s)?s:s(this._graphics);e&&e.length||(t.clip=!1),t.path=e}return u(n)||(t.overflow=n),t}_updateAttrsOfGroup(){var t;const e=this._getAttrsFromConfig();null===(t=this._product)||void 0===t||t.setAttributes(e),this._markConfig.support3d&&this._product&&this._product.setMode("3d")}_runBeforeTransform(t){var e;const i=null===(e=this._transform)||void 0===e?void 0:e.filter((t=>{if(t.type){const e=KR.getGrammarTransform(t.type);return e&&(!e.runType||"beforeJoin"===e.runType)}return!1}));return this.runTransforms(i,t)}_runEncoderTransform(t,e){var i;const s=null===(i=this._transform)||void 0===i?void 0:i.filter((t=>{if(t.type){const i=KR.getGrammarTransform(t.type);return i&&"afterEncode"===i.runType&&!!i.canProgressive===e}return!1}));return this.runTransforms(s,t)}renderInner(){var t,e,i;this._updateEncoderByState();const s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.getProduct())&&void 0!==e?e:[{}],n=this._runBeforeTransform(s);let r;if(null==n?void 0:n.progressive){this.renderContext={beforeTransformProgressive:n.progressive};const t=n.progressive;if(t.canAnimate&&t.canAnimate()&&t.unfinished())return void this._updateAttrsOfGroup();r=t.output()}else r=Y(n),this._runGroupData(r),this.renderContext=this._parseProgressiveContext(r);(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)?(this._graphicMap.clear(),this._runProgressiveStep()):(this._runJoin(r),this._runState(this._graphics),this._runEncoder(this._graphics),this._runEncoderTransform(this._graphics,!1),this._runApplyGraphic(this._graphics)),this._updateAttrsOfGroup()}render(){this.isCommited()&&(!this.getVisible()||this._skipBeforeLayouted&&this.getCompiler().getLayoutState()===DI.before||(this._product||this._initProduct(),jy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner()),this.uncommit())}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._graphics.forEach((i=>{"in"===this.state.checkOneState(i,i.context.data,e)?i.addState(t,!0,this.hasAnimationByState("state")):i.removeState(t,this.hasAnimationByState("state"))}))}clearExitGraphics(){this._prevDataByKey=this._dataByKey;const t=(t,e)=>{this._graphicMap.delete(e),t.parent&&t.parent.removeChild(t),t.release&&t.release()};this._graphicMap.forEach(((e,i)=>{if(e.context.diffState===tD.exit&&!e.isExiting)if(e.context.animationState===tD.exit&&this.hasAnimationByState("exit")){e.isExiting=!0;const s=this.getAnimationConfig();if(s.exit&&s.exit.length){const n=s.exit.map(((t,i)=>({name:`exit_${i}`,animation:Object.assign(Object.assign({},t),{customParameters:e.context})})));e.applyAnimationState(["exit"],[1===n.length?n[0]:n],(()=>{t(e,i)}))}}else t(e,i)}))}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){var t,e;return this.renderContext&&this.renderContext.beforeTransformProgressive&&(null===(e=(t=this.renderContext.beforeTransformProgressive).canAnimate)||void 0===e?void 0:e.call(t))}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.incrementalClearChild()})),this._product.removeAllChild()),this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.release(),this.renderContext=null}restartProgressive(){this.renderContext&&this.renderContext.progressive&&(this.renderContext.progressive.currentIndex=0)}_runBeforeProgressive(){var t;const e=this.renderContext.beforeTransformProgressive;e.progressiveRun();const i=e.output();if(null===(t=e.canAnimate)||void 0===t?void 0:t.call(e)){if(e.unfinished())return;this._runGroupData(i),this._runJoin(i),this._runState(this._graphics),this._runEncoder(this._graphics),this._runApplyGraphic(this._graphics)}}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[],i={};return this._dataByGroup.keys.forEach((s=>{const n=this.renderContext.progressive.groupedData.get(s),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r),o=[];a.forEach(((i,n)=>{const a=this._keyGetter(i),l={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:tD.enter,data:[i],uniqueKey:`${s}_${null!=a?a:t*r+n}`,key:a,groupKey:s})};o.push(l),e.push(l)})),i[s]=o})),{graphicsByGroup:i,graphics:e,needUpdate:!0}}_createIncrementalGraphics(){this._product.removeAllChild(),this._dataByGroup.keys.forEach((t=>{const e=Lp({pickable:!1,zIndex:this._markConfig.zIndex});e.incremental=this.renderContext.progressive.step,this._product.appendChild(e)}))}_setCommonAttributesToTheme(t){var e,i,s;if(this._attrsByGroup&&t){const n=t.parent;n&&(null===(e=this._attrsByGroup)||void 0===e?void 0:e[null===(i=t.context)||void 0===i?void 0:i.groupKey])&&n.setTheme({common:this._attrsByGroup[null===(s=t.context)||void 0===s?void 0:s.groupKey]})}}_runProgressiveEncoder(t){0===this.renderContext.progressive.currentIndex?this._runEncoder(t):this._runEncoder(t,!0)}_runProgressiveApplyGraphic(t){0===this.renderContext.progressive.currentIndex?(this._runApplyGraphic(t),this._setCommonAttributesToTheme(t[0])):this._runApplyGraphic(t)}_runProgressiveStep(){const{graphics:t,graphicsByGroup:e,needUpdate:i}=this._runProgressiveJoin();0===this.renderContext.progressive.currentIndex?(this._createIncrementalGraphics(),this._graphics=t):i&&t.forEach((t=>{this._graphics.push(t)})),this._runState(t),Object.keys(e).forEach((t=>{this._runProgressiveEncoder(e[t])})),this._runEncoderTransform(this._graphics,!0),Object.keys(e).forEach((t=>{this._runProgressiveApplyGraphic(e[t])})),this.renderContext.progressive.currentIndex+=1}renderProgressive(){var t;(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive)?this._runBeforeProgressive():this.renderContext.progressive&&this._runProgressiveStep()}hasAnimationByState(t){if(!t||!this._animationConfig||!this._animationConfig[t]||this._disabledAnimationStates.includes(t))return!1;const e=this._animationConfig[t];return e.length>0||g(e)}hasAnimation(){return!!this._animationConfig&&Object.keys(this._animationConfig).length>0}runAnimation(){this._runStateAnimation(this.getGraphics())}clearBeforeReInit(){this.state.clearAllStateInfo(),this.uncommit(),this.stateStyle={},this.getGraphics().forEach((t=>{t.clearStates()}))}}var LD;!function(t){t.group="group",t.symbol="symbol",t.rule="rule",t.line="line",t.text="text",t.rect="rect",t.image="image",t.path="path",t.area="area",t.arc="arc",t.polygon="polygon",t.boxPlot="boxPlot",t.linkPath="linkPath",t.cell="cell",t.ripple="ripple",t.liquid="liquid",t.component="component",t.dataLabel="dataLabel",t.label="label",t.pictogram="pictogram"}(LD||(LD={}));class RD extends PD{constructor(){super(...arguments),this.type=RD.type,this._marks=[],this._diffState=tD.enter}getMarks(){return this._marks}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id))}addMark(t){return this.isMarkExist(t)?(Hy("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?(Hy("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))}getMarkInUserId(t){let e;return HI(this,(t=>{e=t}),(e=>e.getUserId()===t),null,!0),e}getMarkInName(t){return this._marks.filter((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this.getMarks().forEach((t=>{t.compile({group:this._product})}))}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}getGraphics(){return[this._product]}renderInner(){var t;if(!this._product)return;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});this._product.context=Object.assign(Object.assign(Object.assign({},this._product.context),this._getCommonContext()),{diffState:this._diffState}),this._setAnimationState(this._product);const i=this._getAttrsFromConfig(e);if(this._product.context.diffState===tD.update){const t=this.hasAnimation(),e=cI(this._product,i);this._product.context.diffAttrs=e,this.hasAnimationByState(this._product.context.animationState)||(t?this._product.setAttributesAndPreventAnimate(e):this._product.setAttributes(e)),t&&this._product.setFinalAttributes(i)}else this._product.setAttributes(i);this.needClear=!0}clearExitGraphics(){this._diffState=tD.update}render(){this._isCommited&&(jy(`render mark: ${this.getProductId()}, type is ${this.type}`),this.renderInner(),this.uncommit()),this.getMarks().forEach((t=>{t.render()}))}release(){super.release(),this.removeProduct()}}RD.type="group";const OD={measureText:_O};class ID{static instance(){return ID.instance_||(ID.instance_=new ID),ID.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 DD{constructor(){this.id=Ky(),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))?Hy("不要重复添加相同的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 FD extends DD{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)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}onAfterInitChart(t,e){this._plugins.forEach((i=>{i.onAfterInitChart&&i.onAfterInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}const zD={type:"fadeIn"};function jD(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 zD;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const HD={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"},state:{duration:300,easing:"linear"}},VD={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"}},ND={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"}},UD=()=>{KR.registerAnimation("scaleInOut",(()=>VD))},WD=()=>{KR.registerAnimation("fadeInOut",(()=>ND))},GD=(t,e)=>({appear:jD(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:$w,duration:HD.update.duration,easing:HD.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}]}),YD=()=>{KR.registerAnimation("line",GD)},$D=()=>{pw.registerBuiltInAnimate("growPointsIn",hC),pw.registerBuiltInAnimate("growPointsOut",cC),pw.registerBuiltInAnimate("growPointsXIn",uC),pw.registerBuiltInAnimate("growPointsXOut",pC),pw.registerBuiltInAnimate("growPointsYIn",fC),pw.registerBuiltInAnimate("growPointsYOut",mC),pw.registerBuiltInAnimate("clipIn",qw),pw.registerBuiltInAnimate("clipOut",Zw)},XD=(t,e)=>{if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(e)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(e)})):e.forEach((t=>{i.push(t)})),i};t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,t.STATE_VALUE_ENUM.STATE_BLUR;class KD{constructor(t){this._markSet=new sD,this.options=t,t.marks&&t.marks.length&&t.marks.forEach((t=>{this.registerMark(t)}))}getMarks(){return this._markSet.getMarks()}getMarksByState(t){if(this._markIdByState&&this._markSet){const e=this._markIdByState[t];return e?this.getMarks().filter((t=>t&&e.includes(t.id))):[]}return[]}registerMark(t){y(t)?t.forEach((t=>{this._markSet.addMark(t)})):this._markSet.addMark(t)}updateMarkIdByState(t){this._markIdByState=((t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t.stateStyle;s&&e.forEach((e=>{e&&s[e]&&(i[e]||(i[e]=[]),i[e].push(t.id))}))})),i})(this.getMarks(),t)}getMarkIdByState(){var t;return null!==(t=this._markIdByState)&&void 0!==t?t:{}}isGraphicInStateMark(t,e){var i;const s=this.getMarkIdByState();return s&&s[e]&&s[e].includes(null===(i=t.context)||void 0===i?void 0:i.markId)}isGraphicInMark(t){var e;return!!this._markSet.getMarkInId(null===(e=t.context)||void 0===e?void 0:e.markId)}getStartState(){return null}getResetState(){return null}init(){const t=this.getEvents();t&&this.options.event&&t.forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.on(t.type,t.handler))}))}release(){const t=this.getEvents();t&&this.options.event&&(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.options.event.on(e,t.handler)})):"none"!==t.type&&this.options.event.off(t.type,t.handler))}))}start(t,e){}reset(t,e){}dispatchEvent(t,e){this.options.event&&(this.options.event.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 qD={highlightState:t.STATE_VALUE_ENUM.STATE_HIGHLIGHT,blurState:t.STATE_VALUE_ENUM.STATE_BLUR,trigger:"pointerover",triggerOff:"pointerout"};class ZD extends KD{constructor(t){super(t),this.type="element-highlight",this.resetAll=t=>{const{highlightState:e,blurState:i,interaction:s}=this.options;this._lastGraphic&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:[this._lastGraphic],options:this.options},t)),this._lastGraphic=null,s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},qD,t),this.updateMarkIdByState([this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getResetState(){return this.options.blurState}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}start(t,e){if(t&&this._markSet.getMarkInId(t.context.markId)){const{highlightState:i,blurState:s,interaction:n}=this.options;if(this._lastGraphic===t)return;const r=n.updateStates(this,[t],n.getStatedGraphics(this),i,s);n.setStatedGraphics(this,r),this._lastGraphic=t,this.dispatchEvent("start",Object.assign({graphics:r,options:this.options},e))}else this._lastGraphic&&"view"===this._resetType&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll(e)}}ZD.type="element-highlight",ZD.defaultOptions=qD;const JD=()=>{KR.registerInteractionTrigger(ZD.type,ZD)},QD={state:t.STATE_VALUE_ENUM.STATE_SELECTED,trigger:"click"};class tF extends KD{constructor(t){super(t),this.type="element-select",this._resetType=[],this.resetAll=t=>{const{state:e,reverseState:i,interaction:s}=this.options,n=s.getStatedGraphics(this);n&&n.length&&(s.clearAllStatesOfTrigger(this,e,i),this.dispatchEvent("reset",Object.assign({graphics:n,options:this.options},t)),s.setStatedGraphics(this,[]))},this.handleStart=t=>{this.start(t.item,t)},this.handleReset=t=>{const{interaction:e}=this.options,i=e.getStatedGraphics(this);if(!i||!i.length)return;const s=t.item,n=s&&this._markSet.getMarkInId(s.context.markId);(this._resetType.includes("view")&&!n||this._resetType.includes("self")&&n)&&this.resetAll(t)},this.options=Object.assign({},QD,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}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,e){const{state:i,reverseState:s,isMultiple:n,interaction:r}=this.options,a=r.getStatedGraphics(this);if(t&&this._markSet.getMarkInId(t.context.markId))if(t.hasState(i)){if(this._resetType.includes("self")){const n=a&&a.filter((e=>e!==t));n&&n.length?r.setStatedGraphics(this,r.updateStates(this,n,a,i,s)):this.resetAll(e)}}else{this._timer&&clearTimeout(this._timer),t.addState(i,!0);const o=this.options.interaction.updateStates(this,n&&a?[...a,t]:[t],a,i,s);r.setStatedGraphics(this,o),this.dispatchEvent("start",Object.assign({graphics:o,options:this.options},e)),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll(e)}),this.options.triggerOff))}else this._resetType.includes("view")&&a&&a.length&&this.resetAll(e)}reset(t,e){t?this._markSet.getMarkInId(t.context.markId)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll(e)}}tF.type="element-select",tF.defaultOptions=QD;const eF=()=>{KR.registerInteractionTrigger(tF.type,tF)};class iF extends DD{constructor(t){super(),this.globalInstance=t}onInit(){this._plugins.forEach((t=>{t.onInit&&t.onInit(this)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class sF{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>KR.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>KR.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>KR.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return KR.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>KR.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){KR.registerTransform(t,e)}static registerFunction(t,e){t&&e&&ID.instance().registerFunction(t,e)}static unregisterFunction(t){t&&ID.instance().unregisterFunction(t)}static getFunction(t){return t?ID.instance().getFunction(t):null}static getFunctionList(){return ID.instance().getFunctionNameList()}static registerMap(t,e,i){const s=KR.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=KR.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,AI.get(e);var e}static registerSVG(t,e,i){const s=KR.getImplementInKey("registerSVG");s&&s(t,e,i)}static unregisterSVG(t){const e=KR.getImplementInKey("unregisterSVG");e&&e(t)}static hideTooltip(t=[]){cO.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}get event(){return this._event}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d,u;this.id=Ky(),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._renderState=WI.render,this._disableDimensionHoverEvent=!1,this._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))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._updateAnimateState(!1),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s;this._reSetRenderState();const n=this._spec,r={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;U(n.theme,this._spec.theme)?U(this._spec.background,n.background)||(r.reMake=!0,r.changeBackground=!0):r.changeTheme=!0;const a=this._shouldChartResize(n);if(r.reSize=a,this._spec.type!==n.type)return null===(s=this._compiler)||void 0===s||s.updateLayoutTag(),r.reMake=!0,r.reTransformSpec=!0,r.change=!0,r.changeTheme=!0,r;this._initChartSpec(this._spec,"updateSpec");const o=KI(this._chart.updateSpec(this._spec),r);return i?Object.assign(Object.assign({},o),i):o},this.getTheme=(...t)=>{if(!this._currentTheme||!t||!t.length)return;this._cachedProcessedTheme||(this._cachedProcessedTheme={});const e=t.join(".");if(this._cachedProcessedTheme[e])return this._cachedProcessedTheme[e];let i=this._currentTheme;return t.forEach(((e,s)=>{if(1!==s||"series"!==t[0]&&"component"!==t[0])i=null==i?void 0:i[e];else{const s="series"===t[0]?KR.getSeriesBuiltInTheme(e):KR.getComponentBuiltInTheme(e);i=i?XR({},s,i[e]):s}s===t.length-1&&p(i)&&(i=gO({[e]:i},this._currentTheme.colorScheme,this._currentTheme.token)[e])})),this._cachedProcessedTheme[e]=i,i},lR(s),this._option=Object.assign(Object.assign({},this._option),s),(null==s?void 0:s.optimize)&&(this._option.optimize=Object.assign(Object.assign({},this._option.optimize),s.optimize)),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const g=this._option,{dom:f,renderCanvas:m,mode:v,stage:y,poptip:b}=g,x=e(g,["dom","renderCanvas","mode","stage","poptip"]),S=Gy(v);if(S?rx(bo):"node"===v&&US(bo),S&&f&&(this._container=_(f)?A_.getElementById(f):f),m&&(this._canvas=m),y&&(this._stage=y),"node"!==v&&!this._container&&!this._canvas&&!this._stage)return void(null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!"));this._viewBox=this._option.viewBox,this._currentThemeName=dO.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize();const A=[];!1!==b&&A.push("poptipForText"),"sankey"===i.type&&A.push("scrollbar");const k=new at(null!==(a=this._option.logLevel)&&void 0!==a?a:rt.Error);at.setInstance(k),(null===(o=this._option)||void 0===o?void 0:o.onError)&&k.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._compiler=new GI({dom:null!==(l=this._container)&&void 0!==l?l:"none",canvas:m},Object.assign(Object.assign({mode:this._option.mode,stage:y,pluginList:A},x),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new bI(this,this._compiler),this._event=new dI(this._eventDispatcher,v),this._compiler.initView(),this._compiler.updateLayoutTag(),this._setFontFamilyTheme(this.getTheme("fontFamily")),this._initDataSet(this._option.dataSet),this._autoSize=!!S&&(null===(c=null!==(h=i.autoFit)&&void 0!==h?h:this._option.autoFit)||void 0===c||c),this._bindResizeEvent(),this._bindViewEvent(),this._initChartPlugin(),cO.registerInstance(this),null===(u=null===(d=this._option.performanceHook)||void 0===d?void 0:d.afterCreateVChart)||void 0===u||u.call(d,this)}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=XR({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=fO(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;sF.getFunctionList()&&sF.getFunctionList().length&&(t=mO(t,sF)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=KR.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=KR.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=KR.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._chartSpecTransformer),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)}_bindViewEvent(){var e,i;this._compiler&&(null===(i=null===(e=this._compiler.getStage())||void 0===e?void 0:e.getTimeline())||void 0===i||i.on("animationEnd",(()=>{this._event.emit(t.ChartEvent.animationFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=St(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||e.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 XI(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:bO,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:xO})}_initDataSet(t){this._dataSet=t instanceof Ea?t:new Ea,SI(this._dataSet,"dataview",Ta),SI(this._dataSet,"array",s),xI(this._dataSet,"copyDataView",EI);for(const t in KR.transforms)xI(this._dataSet,t,KR.transforms[t]);for(const t in KR.dataParser)SI(this._dataSet,t,KR.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l;if(t.reMake&&(this._releaseData(),this._initDataSet(),null===(i=this._chart)||void 0===i||i.release(),this._chart=null),t.reTransformSpec&&(this._chartSpecTransformer=null),t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(this.getTheme("fontFamily"))):t.changeBackground&&(null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())),t.reMake?(null===(n=this._compiler)||void 0===n||n.releaseGrammar(),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.reCompile&&(null===(r=this._compiler)||void 0===r||r.clear({chart:this._chart,vChart:this}),null===(a=this._compiler)||void 0===a||a.compile({chart:this._chart,vChart:this})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._currentSize={width:t,height:e},null===(o=this._chart)||void 0===o||o.onResize(t,e,!1),null===(l=this._compiler)||void 0===l||l.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),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),!(!this._chart||!this._compiler)&&(this._chartPluginApply("onAfterInitChart",this._spec,c),null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r,this),this._compiler.compile({chart:this._chart,vChart:this},t),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o,this),!0)}_afterRender(){return!this._isReleased&&(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"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this.isAnimationEnable()){const s=e=>{var i;const s=null===(i=e.context)||void 0===i?void 0:i.diffState;return t?"exit"===s?OI.none:OI.appear:s};null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{t.updateAnimateStateCallback(s)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{t.updateAnimateStateCallback(s)}))}}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._cachedProcessedTheme=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,cO.unregisterInstance(this)}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):y(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return this._reSetRenderState(),u(this._dataSet)?this:this._chart?(this._chart.updateData(t,e,!0,i),(null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._reSetRenderState(),this._chart)return this._chart.updateFullData(t),e&&((null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._compiler.render()),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof Ba?(a.setFields(I(r)),a.parse(i,I(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=PI(t,this._dataSet,s);y(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){return this.updateModelSpecSync(t,e,s,n)}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||function(t,e,i,s){Object.keys(t).forEach((n=>{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?XR({},t[n][e.index],i):i):t[n]=s?XR({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?XR({},t[n][r],i):i)}else t.id===e&&(t[n]=s?XR({},t[n],i):i)}))}(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=XR({},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),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,this),!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)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=qR({},e,e.chart[t])),e};let l;if(P(n)&&P(r))l=uO(this._currentThemeName),this._currentTheme=o(a,l);else{const t=qR({},uO(g(r)&&r.type?r.type:g(n)&&n.type?n.type:this._currentThemeName),uO(n),uO(r));this._currentTheme=o(a,t)}var h;this._cachedProcessedTheme=null,h=this.getTheme("component","poptip"),j(GM.poptip,WM,h),null===(s=this._compiler)||void 0===s||s.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=!!Gy(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this.getTheme("background")||this._option.background}getCurrentTheme(){return uO(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){return i(this,void 0,void 0,(function*(){return this.setCurrentThemeSync(t)}))}setCurrentThemeSync(t){if(!dO.themeExist(t))return this;const e=this._setCurrentTheme(t);return this._setFontFamilyTheme(this.getTheme("fontFamily")),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}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t},richtext:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield YI(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(!Gy(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;this._chart.resetLayoutItemTag(),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)?A_.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)}disableDimensionHoverEvent(t){return void 0!==t&&(this._disableDimensionHoverEvent=t),this._disableDimensionHoverEvent}disableCrossHair(t=!0){this.getChart().getComponentsByKey("crosshair").forEach((e=>e.enable=!t))}disableTooltip(t=!0){this.getChart().getComponentsByKey("tooltip").forEach((e=>e.enable=!t))}showCrosshair(t){var e;null===(e=this._chart)||void 0===e||e.showCrosshair(t)}stopAnimation(){var t;null===(t=this.getStage())||void 0===t||t.stopAnimation(!0)}reRunNormalAnimation(){var t;null===(t=this.getStage())||void 0===t||t.reApplyAnimationState("normal",!0)}pauseAnimation(){var t;null===(t=this.getStage())||void 0===t||t.pauseAnimation(!0)}resumeAnimation(){var t;null===(t=this.getStage())||void 0===t||t.resumeAnimation(!0)}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(P(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?DR(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||P(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 Hy("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?DR(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(Hy("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return ID.instance().getFunction(t)}registerFunction(t,e){t&&e&&ID.instance().registerFunction(t,e)}unregisterFunction(t){t&&ID.instance().unregisterFunction(t)}getFunctionList(){return ID.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){this._geoZoomByQuery({regionIndex:t},e,i)}geoZoomById(t,e,i){this._geoZoomByQuery({regionId:t},e,i)}_geoZoomByQuery(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier(t)[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=KR.getChartPlugins();t.length>0&&(this._chartPlugin=new FD(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec));const e=KR.getVChartPlugins();e.length>0&&(this._vChartPlugin=new iF(this),this._vChartPlugin.load(e.map((t=>new t))),this._vChartPlugin.onInit())}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}isAnimationEnable(){return"animation"in this._option?!!this._option.animation:!1!==this._spec.animation}_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,viewBox:this._viewBox,getTheme:this.getTheme,getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent,componentShowContent:this._option.componentShowContent}}runDisappearAnimation(){this._renderState=WI.disappear,this.getStage().eventSystem.pauseTriggerEvent(),this.getStage().applyAnimationState(["disappear"],[{name:"disappear",animation:this._compiler.stateAnimationConfig.disappear}])}_reSetRenderState(){this._renderState=WI.render,this.getStage().eventSystem.resumeTriggerEvent()}}sF.InstanceManager=cO,sF.ThemeManager=dO,sF.globalConfig={uniqueTooltip:!0},sF.Utils=OD,sF.vglobal=A_;KR.registerRegion("region",cD),KR.registerLayout("base",yD),Jk(),zk(),KR.registerMark(RD.type,RD),KR.registerStageEventPlugin("gesture",Cb),JD(),eF(),rO(UR.name,UR);const nF="monotone",rF="linear",aF="bevel";function oF(t,e){return e("component",t)}function lF(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=KR.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}t.Direction=void 0,function(t){t.vertical="vertical",t.horizontal="horizontal"}(t.Direction||(t.Direction={}));const hF=(t,e,i,s)=>{if(u(t[e]))return;const n=y(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},cF=(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)))},dF=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t},uF=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):m(t)&&p(t.field)?L(e,t.field):t,s){const{formatFunc:i,args:r}=lF(void 0,s,t,e);i&&r&&(n=i(...r))}return n},pF=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const gF=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(y(e.activeType)?e.activeType.includes(t):e.activeType===t)));function fF(t,i,s,n,r,a){const o=i=>{if(i){const o={datum:r},l=u(i.key)&&u(i.value)&&!P(i)?Object.assign(Object.assign(Object.assign({},n),s),i):Object.assign(Object.assign({},n),i),{key:h,keyFormatter:c,keyTimeFormat:d,keyTimeFormatMode:g,value:f,valueFormatter:m,valueTimeFormat:v,valueTimeFormatMode:_}=l,y=e(l,["key","keyFormatter","keyTimeFormat","keyTimeFormatMode","value","valueFormatter","valueTimeFormat","valueTimeFormatMode"]);o.key=vF(uF(h,r,a,c),d,g),o.value=vF(uF(f,r,a,m),v,_),Object.keys(y).forEach((t=>{o[t]=uF(l[t],r,a)})),!1!==o.visible&&(p(o.key)||p(o.value))&&t.push(o)}};y(i)?i.forEach((t=>{o(t)})):o(i)}function mF(t,e,i,s,n,r,a){if(d(e)){fF(t,e(n,a),i,s,r,a)}else e&&fF(t,e,i,s,r,a)}const vF=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=fi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class _F{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},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.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{y(t)?t.forEach((t=>{mF(a,t,e,i,s,n,r)})):d(t)?mF(a,t,e,i,s,n,r):t&&fF(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=d(e)?e(s,n):e;if(r?u(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){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}(s),e={visible:uF(r.visible,t,n),value:vF(uF(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:uF(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=uF(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&gF(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const yF={min:t=>t.length?K(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?K(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}},bF=(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=YO([],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 xF(a,n,o)},xF=(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&&t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{qy(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=>{qy(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&&!0===o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=yF[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},SF=(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=>{qy(t[e])||(t[e]=0)}))})),t},AF=`${yO}_HIERARCHY_DEPTH`,kF=`${yO}_HIERARCHY_ROOT`,MF=`${yO}_HIERARCHY_ROOT_INDEX`;function TF(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function wF(t,e,i){t&&(i.needDefaultSeriesField&&(t[MO]=i.defaultSeriesField),t[AO]=e,t[kO]=i.getKey(t,e,i))}function CF(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function EF(t,e,i,s=0,n,r){void 0===r&&(r=e),wF(t,e,i),t[AF]=s,t[kF]=n||t[i.categoryField],t[MF]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>EF(e,s,i,t[AF]+1,t[kF],r)))}const BF={label:{name:"label",type:"text"}},PF=`${yO}_rect_x`,LF=`${yO}_rect_x1`,RF=`${yO}_rect_y`,OF=`${yO}_rect_y1`,IF={data:!0},DF={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},FF=[...Object.keys(HD),"normal"];function zF(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 UF(n)&&delete n.type,n.oneByOne&&(n=HF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:VF,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=XR({},o[e],a);return UF(n)&&delete n.type,n.oneByOne&&(n=HF(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:VF,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function jF(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;const i=["custom","customParameters"];return t=I(t,null,i),WF(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}),i),t}(h,i)}function HF(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.parent.count-1)-l)*(h+u)},delete t.oneByOne,t}function VF(t,e){var i;return null!==(i=null==t?void 0:t[AO])&&void 0!==i?i:e.context.graphicIndex}function NF(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 UF(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function WF(t,e,i=[]){if(y(t))t.forEach(((s,n)=>{t[n]=e(t[n],n),WF(t[n],e,i)}));else if(g(t)&&"function"!=typeof t)for(const s in t)i.includes(s)||(t[s]=e(t[s],s),WF(t[s],e,i))}function GF(t){var e,i,s,n,r,a;const o=t.getSpec();if(!1===o.animation)return!1;if(!1===(null===(i=null===(e=t.getOption())||void 0===e?void 0:e.globalInstance)||void 0===i?void 0:i.isAnimationEnable()))return!1;let l=null!==(s=o.animationThreshold)&&void 0!==s?s:Number.MAX_SAFE_INTEGER;return null===(n=t.getMarks())||void 0===n||n.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(l=Math.min(l,e.largeThreshold)),e.progressiveThreshold&&(l=Math.min(l,e.progressiveThreshold)))})),!((null===(a=null===(r=t.getRawData())||void 0===r?void 0:r.latestData)||void 0===a?void 0:a.length)>=l)}class YF extends rD{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=uR(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme,o=this._option.type,l=KR.getSeriesMarkMap(o)?function(t,e,i){const s=KR.getSeriesMarkMap(e);if(!s)return t;const n={};return Object.values(s).forEach((({type:e,name:s})=>{n[s]=XR({},i("mark",Y(e)[0]),i("markByName",s),null==t?void 0:t[s])})),Object.assign(Object.assign({},t),n)}(a("series",o),o,a):{},h=a("series",`${o}_${r}`);return XR({},l,h,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==h?void 0:h.stack)&&void 0!==n?n:null==l?void 0:l.stack)?a("series",`${o}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;Y(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:u=!0,animationExit:p=!0}=i,{animationUpdate:g=!0,animationEnter:f=!0,animationExit:m=!0}=t,v=!!(null!==(l=null!==(o=null===(a=this._option.globalInstance)||void 0===a?void 0:a.isAnimationEnable())&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(d(e)?e(i):e,Object.assign(Object.assign({},i),{animation:!!v&&h,animationUpdate:!!(v&&g&&c)&&g,animationEnter:!!(v&&f&&u)&&f,animationExit:!!(v&&f&&p)&&m,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=XR({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>XR({},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 $F extends aD{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)}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:`${yO}_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(e,i){var s;super(e,i),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=YF,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=t.LayoutZIndex.SeriesGroup,this._invalidType="break",this._region=i.region,this._dataSet=i.dataSet,(null===(s=this._spec)||void 0===s?void 0:s.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=GF(this);this._initExtensionMark({hasAnimation:e}),this.initMarkStyle(),this.initMarkState(),e&&this.initAnimation(),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)&&(xI(this._rawData.dataSet,"invalidTravel",SF),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;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=PI(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=BI(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=BI(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new TD(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=K(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=xF(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=j(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){xI(this._dataSet,"dimensionStatistics",bF);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new Ba(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&&YO(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){xI(this._dataSet,"dimensionStatistics",bF);const s=new Ba(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=YO(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&YO(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new Ba(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)&&(xI(this._rawData.dataSet,"addVChartProperty",dF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:TF.bind(this),call:wF}},!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,i;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.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;this._spec.extensionMark&&(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:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation&&!1!==t.animation){const e=zF({},jF(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)}))),!u(t.dataId)||!u(t.dataIndex)){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setData(this._data):(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:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.commit(!1,!0))}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_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"}}:Yy(s)||$y(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=XR(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=XR(r,o));const l=[{trigger:{type:"dimension-hover"},marks:e}];if(n.enable){const t=XD(n,e);t.length&&l.push({trigger:this._defaultHoverConfig(n),marks:t})}if(r.enable){const t=XD(r,e);t.length&&l.push({trigger:this._defaultSelectConfig(r),marks:t})}return l}_defaultHoverConfig(e){return{type:"element-highlight",trigger:e.trigger,triggerOff:e.triggerOff,blurState:t.STATE_VALUE_ENUM.STATE_HOVER_REVERSE,highlightState:t.STATE_VALUE_ENUM.STATE_HOVER}}_defaultSelectConfig(e){const i="multiple"===e.mode,s=p(e.triggerOff)?e.triggerOff:i?["empty"]:["empty",e.trigger];return{type:"element-select",trigger:e.trigger,triggerOff:s,reverseState:t.STATE_VALUE_ENUM.STATE_SELECTED_REVERSE,state:t.STATE_VALUE_ENUM.STATE_SELECTED,isMultiple:i}}_parseInteractionConfig(t){const{interactions:e}=this._spec,i=this._parseDefaultInteractionConfig(t);return e&&e.length&&e.forEach((t=>{const e=XD(t,this.getMarks());e.length&&i.push({trigger:t,marks:e})})),i}getInteractionTriggers(){if(!0!==this._option.disableTriggerEvent){const t=this.getMarksWithoutRoot();return this._parseInteractionConfig(t)}return[]}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var e;const i=this._spec.seriesStyle;if(!i||!i.length)return;const s=null!==(e=this._seriesField)&&void 0!==e?e:MO;this.getMarksWithoutRoot().forEach((e=>{const n={},r={},a={};i.forEach((t=>{var i;const s=null===(i=t[e.name])||void 0===i?void 0:i.style;s&&(n[t.name]=!0,a[t.name]=a[t.name]||{},Object.keys(s).forEach((e=>{r[e]=!0,a[t.name][e]=s[e]})))})),e.state.addStateInfo({stateValue:TO,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===n[t[0][s]]:!0===n[t[s]]});const o={};Object.keys(r).forEach((t=>{o[t]=i=>{var n,r;let o;if(Array.isArray(i)){if(0===i.length)return;o=null===(n=a[i[0][s]])||void 0===n?void 0:n[t]}return o=null===(r=a[i[s]])||void 0===r?void 0:r[t],p(o)?o:e.getAttribute(t,i)}})),this.setMarkStyle(e,o,TO,t.AttributeLevel.User_SeriesStyle)}))}afterInitMark(){this.event.emit(t.ChartEvent.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((e=>{var i,s;(null===(s=null===(i=e.stateStyle)||void 0===i?void 0:i.normal)||void 0===s?void 0:s.lineWidth)&&e.setAttribute("stroke",this.getColorAttribute(),"normal",t.AttributeLevel.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>{var e;return!(null===(e=t.name)||void 0===e?void 0:e.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()}initTooltip(){this._tooltipHelper=new _F(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||e.visible!==t[i].visible))?i.reMake=!0:!i.reCompile&&e.some(((e,i)=>!U(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!U(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},IF),DF),i),{extensionMark:!0,label:!0,totalLabel:!0});return this._compareExtensionMarksSpec(Y(t.extensionMark),Y(e.extensionMark),s),!s.reMake&&this._compareLabelSpec(Y(t.label),Y(e.label),s),!s.reMake&&this._compareLabelSpec(Y(t.totalLabel),Y(e.totalLabel),s),s.reMake?s:(!s.reCompile&&this._marks.getMarks().some((i=>{var s,n;return r[i.name]=!0,(null===(s=e[i.name])||void 0===s?void 0:s.visible)!==(null===(n=t[i.name])||void 0===n?void 0:n.visible)}))&&(s.reCompile=!0),!s.reCompile&&n.some((i=>DF[i]&&!U(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!U(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof Ba||LI(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{t.clearBeforeReInit(),this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.commit(!1)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();GF(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}release(){var t,e;super.release(),this._viewDataMap.clear();const i=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));i>=0&&this._rawData.transformsArr.splice(i,1),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:MO,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new AR).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return fR(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:MO}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o;const{key:l,groupKey:h,skipBeforeLayouted:c,themeSpec:d={},markSpec:g,dataView:f,parent:m,isSeriesMark:v,noSeparateStyle:_=!1}=e,y=super._createMark(t,{key:null!=l?l:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:_,parent:!1!==m?null!=m?m:this._rootMark:null});if(p(y)){const e=this.getSpec()||{};this._marks.addMark(y,{name:t.name}),v&&(this._seriesMark=y),u(f)?y.setData(this._data):!1!==f&&y.setDataView(f),y.setSkipBeforeLayouted(!1!==c),u(h)||y.setGroupKey(h);const l=Object.assign(Object.assign({},i),{progressiveStep:e.progressiveStep,progressiveThreshold:e.progressiveThreshold,large:e.large,largeThreshold:e.largeThreshold,morph:null!==(s=i.morph)&&void 0!==s&&s,useSequentialAnimation:e.useSequentialAnimation,support3d:null!==(n=i.support3d)&&void 0!==n?n:e.support3d||!!e.zField,morphKey:(null===(r=e.morph)||void 0===r?void 0:r.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(o=null===(a=e.morph)||void 0===a?void 0:a.morphElementKey)&&void 0!==o?o:i.morphElementKey});y.setMarkConfig(l),this.initMarkStyleWithSpec(y,XR({},d,g||e[y.name]))}return y}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:kO}_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!==EO&&t!==PO&&t!==CO&&t!==BO||(t=this.getStackValueField()),null!==(e=XO(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>qy(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:MO]}}function XF(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();VC(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 KF(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}}}$F.mark=BF,$F.transformerConstructor=YF;class qF extends $F{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);VC(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:`${yO}_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(EO),this.setFieldX2(CO)):(this.setFieldY(EO),this.setFieldY2(CO))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(PO),this.setFieldX2(BO)):(this.setFieldY(PO),this.setFieldY2(BO))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(RO),this.setFieldX2(LO)):(this.setFieldY(RO),this.setFieldY2(LO))}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)&&(XF("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)}}function ZF(t){return"bottom"===t||"top"===t}function JF(t){return"left"===t||"right"===t}function QF(t){return"z"===t}function tz(t,e){return ER(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function ez(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function iz(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?ZF(t)?"linear":"band":ZF(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const sz=(t,e,i)=>{var s;const n=null!==(s="band"===e?oF("axisBand",i):["linear","log","symlog"].includes(e)?oF("axisLinear",i):{})&&void 0!==s?s:{},r=ZF(t)?oF("axisX",i):JF(t)?oF("axisY",i):oF("axisZ",i);return XR({},oF("axis",i),n,r)};class nz{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:Vy)("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:Vy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s,n;const r=null!==(n=null===(s=(i=this.chart.getModelOption()).getDimensionInfo)||void 0===s?void 0:s.call(i,this.chart,{x:t,y:e}))&&void 0!==n?n:[];return 0===r.length?null:r}dispatch(t,e){var i,s;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)))),r=n.filter((t=>UC(t.getScale().type))),a=r.length?r:n.filter((t=>{const e=t.getOrient();return ZF(e)||"angle"===e})),o=[],l=null===(s=this.chart)||void 0===s?void 0:s.getModelOption().getDimensionInfoByValue;return l&&a.forEach((e=>{const i=l(e,t);i&&o.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:o}),o}}class rz extends nz{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(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:fI.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}const az=(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))},oz=(t,e)=>{const i=t.tooltipFilterRange,s="function"==typeof i?i({scale:e}):i;return k(s)?[-s,s]:s},lz=(t,e,i,s)=>{var n;const r=e.getScale(),a=UC(r.type),o=[],l=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const h of l)if(h.coordinate===i){const i=Y(s(h)),l=null===(n=h.getViewData())||void 0===n?void 0:n.latestData;if(i&&l)if(a){const e=[],s=[];l.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))})),o.push({series:h,datum:e,key:hz(h,s)})}else if(p(i[1])){const e=[],s=[];l.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 r=e[i[0]]-t;r>=n[0]&&r<=n[1]&&(a.push(e),c.push(s))}}));else{let e=1/0,s=0;l.forEach(((n,r)=>{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("_")}`,cz=(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};class dz extends nz{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{var e,i,s,n;if(!t||(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s)))return;const r=t.event.viewX,a=t.event.viewY,o=this.getTargetDimensionInfo(r,a);null===o&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=o):null===o||null!==this._cacheDimensionInfo&&o.length===this._cacheDimensionInfo.length&&!o.some(((t,e)=>!az(t,this._cacheDimensionInfo[e])))?null!==o&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:o.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:o.slice()})),this._cacheDimensionInfo=o)},this.onMouseOut=t=>{var e,i,s,n;t&&!(null===(n=null===(s=null===(i=null===(e=t.chart)||void 0===e?void 0:e.getOption())||void 0===i?void 0:i.globalInstance)||void 0===s?void 0:s.disableDimensionHoverEvent)||void 0===n?void 0:n.call(s))&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:fI.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:fI.canvas}),callback:this.onMouseOut}),Yy(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:fI.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),Yy(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}}var uz;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(uz||(uz={}));const pz={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class gz{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data&&this._data.setTransform([{type:"dataSampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"symbolOverlap",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.setTransform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t){return this._lineMark=this._createMark(pz.line,{groupKey:this._seriesField,isSeriesMark:null==t||t},{morphElementKey:this.getDimensionField()[0]}),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:aF,curveType:rF,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===nF?"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){if(!1!==(this._spec.point||{}).visible&&(this._symbolMark=this._createMark(pz.point,{groupKey:this._seriesField,isSeriesMark:!!t},{morph:NF(this._spec,pz.point.name),morphElementKey:this.getDimensionField()[0]})),!0===this._spec.activePoint){const t=new Ba(this._option.dataSet,{name:`${yO}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark()},{morph:!1}),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(uz.dimensionHover,this._dimensionTrigger.bind(this));for(const i in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[i]={};for(const s in this._symbolMark.stateStyle[i])"visible"!==s&&(this._symbolActiveMark.stateStyle[i][s]={style:null,level:t.AttributeLevel.Series,referer:e})}this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,filter:()=>!0})}return e}_initSymbolMark(e){e&&(this.setMarkStyle(e,{fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{x:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionX(t):Number.NaN,y:t=>"zero"===this._invalidType||this._getInvalidDefined(t)?this.dataToPositionY(t):Number.NaN,z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",t.AttributeLevel.Series))}_initSymbolActiveMarkAlone(){var e,i;const s=this._symbolActiveMark;s&&(this._initSymbolMark(s),s&&(null===(i=null===(e=this._spec[pz.point.name])||void 0===e?void 0:e.state)||void 0===i?void 0:i.dimension_hover)&&(s.setVisible(!0),this.event.on(uz.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(s,XR({},this._spec[pz.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:t.STATE_VALUE_ENUM.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=>{var e;return null!==(e=t[this.getSeriesField()])&&void 0!==e?e:this.getSeriesKeys()[0]},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.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const fz=Object.assign(Object.assign({},BF),pz),mz=(t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(y(t))return t.length===e.length&&t.every(((t,i)=>mz(t,e[i])));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]))},vz=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"];class _z extends PD{constructor(){super(...arguments),this._segmentStyleKeys=[],this._isValidPointChannel=t=>["x","y","defined"].includes(t)}_getSegmentAttributes(){return vz}initStyleWithSpec(t){this._segmentStyleKeys=[],super.initStyleWithSpec(t)}setStyle(t,e="normal",i=0){if(u(t))return;void 0===this.stateStyle[e]&&(this.stateStyle[e]={});const s=this._getIgnoreAttributes(),n=this._getSegmentAttributes(),r=this.isUserLevel(i);Object.keys(t).forEach((a=>{const o=t[a];if(u(o)||s.includes(a))return;r&&n.includes(a)&&(NC(null==o?void 0:o.type)||(null==o?void 0:o.scale)||d(o))&&(this._segmentStyleKeys.includes(a)||this._segmentStyleKeys.push(a));const l=this._filterAttribute(a,o,e,i,r);this.setAttribute(a,l,e,i)}))}_getLineSegments(t,e){if(!this._segmentStyleKeys||!this._segmentStyleKeys.length)return null;const i=[];let s=null;return t.forEach(((t,e)=>{s&&this._segmentStyleKeys.every((e=>((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?mz(t,e):t===e))(s[e],t[e],e)))||(i.length&&(i[i.length-1].endIndex=e),s=t,i.push({attrs:s,startIndex:e}))})),i.length>=2?i.map((t=>Object.assign(Object.assign({},t.attrs),{points:e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex)}))):null}_getPrevPoints(t){const{points:e,segments:i}=t.attribute;return null!=e?e:i?i.reduce(((t,e)=>(e.points&&e.points.forEach((e=>{t.push(e)})),t)),[]):null}_runPointsEncoder(t,e,i={}){var s,n,r;const a=e.context.data,o=[],l=[],h={},c=null===(s=this.renderContext)||void 0===s?void 0:s.progressive,d=c&&0===c.currentIndex;if(a.forEach(((e,i)=>{var s;l[i]={},o[i]={},Object.keys(t).forEach((s=>{this._isValidPointChannel(s)?l[i][s]=t[s](e):this._segmentStyleKeys.includes(s)&&!c?o[i][s]=t[s](e):0!==i||c&&!d||(h[s]=t[s](e))})),l[i].context=null!==(s=this._keyGetter(e))&&void 0!==s?s:i})),c){const t=null!==(r=null===(n=e.attribute)||void 0===n?void 0:n.segments)&&void 0!==r?r:[];return t.push({points:l}),d?Object.assign(Object.assign({},h),{segments:t}):{segments:t}}if(this._segmentStyleKeys&&this._segmentStyleKeys.length){const t=this._getLineSegments(o,l);if(t)return Object.assign(Object.assign(Object.assign({},h),o[0]),{segments:t,points:null})}return Object.assign(Object.assign(Object.assign({},h),o[0]),{points:l,segments:null})}_runEncoderOfGraphic(t,e,i={}){const s=e.context.data;return t&&Object.keys(t).some(this._isValidPointChannel)&&s&&s.length?this._runPointsEncoder(t,e,i):super._runEncoderOfGraphic(t,e,i)}_getDataByKey(t){return this._dataByGroup}_runProgressiveJoin(){const t=this.renderContext.progressive.currentIndex,e=[];this._dataByGroup.keys.forEach(((i,s)=>{const n=this.renderContext.progressive.groupedData.get(i),r=this.renderContext.progressive.step,a=n.slice(t*r,(t+1)*r);if(0===t){const t={context:Object.assign(Object.assign({},this._getCommonContext()),{diffState:tD.enter,data:a,uniqueKey:i,key:i,groupKey:i})};e.push(t)}else{this._graphics[s].context.data=a}}));const i=0===t?e:this._graphics;return{graphicsByGroup:{[kO]:i},graphics:i,needUpdate:!1}}_setCommonAttributesToTheme(t){}_addProgressiveGraphic(t,e){e.incremental=1,t.appendChild(e)}}class yz extends _z{constructor(){super(...arguments),this.type=yz.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)===cR.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}yz.type="line";const bz=()=>{KR.registerMark(yz.type,yz),Jk(),Nk(),EB(),kB(),$D(),KR.registerGraphicComponent("line",Pg)};class xz extends PD{constructor(){super(...arguments),this.type=xz.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="circle":a.symbolType=o,a}}xz.type="symbol";const Sz=()=>{KR.registerMark(xz.type,xz),Jk(),tM(),kB(),KR.registerGraphicComponent("symbol",Cg)};class Az extends YF{_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)}}function kz(t){return t.length>=2&&k(t[0])&&k($(t))&&$(t)>=t[0]}function Mz(t,e){var i;const s=$(e)-e[0],n=$(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=$(e)>0?$(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!k(o.min),extendable_max:!k(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):$(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function Tz(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 wz(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 Cz(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 Ez(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 Bz=(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=>t.type.includes("ticks"))))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)-p[0];if(0===g)return t;const f=c.domain(),m=$(f)-f[0];if(0===g)return t;const v=d.map((t=>function(t,e,i,s,n){const r=se(t,e),a=Math.max(ee(i),ee(r));return n*(Math.round(r*10**a)/Math.round(i*10**a))+s}(t.value,p[0],g,f[0],m)));return IC(v)};class Pz{constructor(t){this.id=Ky(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class Lz extends Pz{constructor(){super(Lz.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!VC(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&&kz(c)&&kz(d)))return;const u=Mz(t,c),p=Mz(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!wz(u,p))return}else if(0===y&&0===b){if(!wz(p,u))return}else if(_||A)if(_&&!A){if(!Tz(u,p))return}else if(A&&!_){if(!Tz(p,u))return}else{if(f===b)return;if(f>b){if(!Cz(u,p))return}else if(!Cz(p,u))return}else{if(0===f&&0===y){if(!Ez(u,p))return}else if(0===b&&0===g&&!Ez(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===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){var i;const s=this._checkEnableSync(e);if(!s)return;const n=this._getTargetAxis(e,s);if(n&&s.tickAlign){xI(e.getOption().dataSet,"tickAlign",Bz);const t={targetAxis:()=>n,currentAxis:()=>e},s=null===(i=n.getTickData())||void 0===i?void 0:i.getDataView();s&&s.target.addListener("change",(()=>{var t,i;null===(i=null===(t=e.getTickData())||void 0===t?void 0:t.getDataView())||void 0===i||i.reRunAllTransform({skipEqual:!0})})),e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}Lz.pluginType="component",Lz.type="AxisSyncPlugin";const Rz={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function Oz(t){let e=0;return L(t,"tick.visible")&&(e+=L(t,"tick.tickSize")),L(t,"label.visible")&&(e+=L(t,"label.space")),e}function Iz(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 Dz(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const Fz=t=>"band"===t||"ordinal"===t||"point"===t;function zz(t,e){return{id:t,label:t,value:e,rawValue:t}}function jz(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class Hz extends DD{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}const Vz=`${yO}_ARC_TRANSFORM_VALUE`,Nz=`${yO}_ARC_RATIO`,Uz=`${yO}_ARC_START_ANGLE`,Wz=`${yO}_ARC_END_ANGLE`,Gz=`${yO}_ARC_K`,Yz=`${yO}_ARC_MIDDLE_ANGLE`,$z=`${yO}_ARC_QUADRANT`,Xz=`${yO}_ARC_RADIAN`,Kz=-Math.PI/2,qz=3*Math.PI/2,Zz=.6,Jz=(t,e,i,s)=>{const n=t();if(S(n))return n;if(d(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return pe(r,i(),t,e)}return Math.min(r.width/2,r.height/2)},Qz=(t,e,i)=>{var s;const n=null!==(s="band"===e?oF("axisBand",i):"linear"===e?oF("axisLinear",i):{})&&void 0!==s?s:{},r=oF("angle"===t?"axisAngle":"axisRadius",i);return XR({},oF("axis",i),n,r)};function tj(t,e,i,s){switch(t){case r.cartesianBandAxis:return sz(tz(i,["z"]),"band",e);case r.cartesianLinearAxis:return sz(tz(i,["z"]),"linear",e);case r.cartesianLogAxis:return sz(tz(i,["z"]),"log",e);case r.cartesianSymlogAxis:return sz(tz(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return sz(tz(i),void 0,e);case r.polarBandAxis:return Qz(i.orient,"band",e);case r.polarLinearAxis:return Qz(i.orient,"linear",e);case r.polarAxis:return Qz(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,trigger:c,triggerOff:d}=null!==(s=oF(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>ZF(t.orient)));let g;g=p(u)?XR({},Fz(u.type)?a:o,l):l;const f=n.find((t=>JF(t.orient)));let m;return m=p(f)?XR({},UC(f.type)?a:o,h):h,{xField:g,yField:m,trigger:c,triggerOff:d}})(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,trigger:c,triggerOff:d}=null!==(s=oF(r.crosshair,t))&&void 0!==s?s:{},u=n.find((t=>"angle"===t.orient));let g;g=p(u)?XR({},Fz(u.type)?a:o,l):l;const f=n.find((t=>"radius"===t.orient));let m;return m=p(f)?XR({},UC(f.type)?a:o,h):h,{categoryField:g,valueField:m,trigger:c,triggerOff:d}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return ej(i,oF(t,e));default:return oF(t,e)}}const ej=(t,e)=>{var i;const s=XR({},e,e[ez(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class ij extends rD{getTheme(t,e){return tj(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({},IR(e)),{[s]:0}))}}class sj extends lD{constructor(){super(...arguments),this.name="component",this.modelType="component",this.transformerConstructor=ij,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof zc||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:fI.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")}}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 Hz(this)}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)))}_getNeedClearVRenderComponents(){return[]}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=>!U(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&&(t.release(!0),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=>{e.compile({group:t,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}}getDatum(t){}}var nj,rj;sj.transformerConstructor=ij,function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(nj||(nj={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(rj||(rj={}));class aj extends PD{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_getDefaultStyle(){return{}}getComponent(){return this._component}clearComponent(){this._component&&(this._component.parent&&this._component.parent.removeChild(this._component),this._component=null)}_getAttrsFromConfig(t={}){const e=super._getAttrsFromConfig(t);return u(this._markConfig.interactive)||(e.pickable=this._markConfig.interactive),t}setAttributeTransform(t){this._attributesTransform=t}renderInner(){var t;const e=null!==(t=this._simpleStyle)&&void 0!==t?t:this.getAttributesOfState({});let i=this._getAttrsFromConfig(e);this._attributesTransform&&(i=this._attributesTransform(i)),this._animationConfig&&(i=Object.assign(Object.assign({},i),{animation:!0,animationAppear:this._animationConfig.appear?Array.isArray(this._animationConfig.appear)?this._animationConfig.appear[0]:this._animationConfig.appear:void 0,animationEnter:this._animationConfig.enter?Array.isArray(this._animationConfig.enter)?this._animationConfig.enter[0]:this._animationConfig.enter:void 0,animationUpdate:this._animationConfig.update?Array.isArray(this._animationConfig.update)?this._animationConfig.update[0]:this._animationConfig.update:void 0,animationExit:this._animationConfig.exit?Array.isArray(this._animationConfig.exit)?this._animationConfig.exit[0]:this._animationConfig.exit:void 0})),this._component?this._component.setAttributes(i):(this._component=KR.createGraphicComponent(this._componentType,i,{mode:this._mode,skipDefault:this._markConfig.skipTheme}),this._component&&this._product.appendChild(this._component)),this._component&&(this._component.context=this._getCommonContext()),this._markConfig.support3d&&this._product&&this._product.setMode("3d"),this.model.event.emit(uI.AFTER_ELEMENT_ENCODE,{mark:this,model:this.model}),this.needClear=!0}release(){super.release(),this.removeProduct()}}aj.type="component";const oj=()=>{KR.registerMark(aj.type,aj)},lj=t=>t;class hj extends sj{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}getVisible(){return this._visible}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i,s;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._specVisible=!0,this._hideWhenEmpty=!1,this._tick=void 0,this._onTickDataChange=t=>{this._forceLayout(),null==t||t.updateData()},this._specVisible=null===(i=t.visible)||void 0===i||i,this._hideWhenEmpty=null!==(s=t.hideWhenEmpty)&&void 0!==s&&s,this._visible=this._specVisible,this._coordinateType="none"}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._specVisible=null===(t=this._spec.visible)||void 0===t||t,this._hideWhenEmpty=null!==(e=this._spec.hideWhenEmpty)&&void 0!==e&&e,this._visible=this._specVisible,this._scale&&this._refreshVisibilityByData()}getVRenderComponents(){var t,e;return[null===(t=this._axisMark)||void 0===t?void 0:t.getProduct(),null===(e=this._gridMark)||void 0===e?void 0:e.getProduct()].filter(p)}created(){var e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,_,y,b;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._refreshVisibilityByData(),this._shouldComputeTickData()&&this._initData(),this._specVisible){const x=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?nj.circleAxis:nj.lineAxis,mode:this._spec.mode},{skipTheme:!0});if(this._updateTickDataMarks(x),this._axisMark=x,x.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&x.setUserId(this._spec.id),x.setMarkConfig({interactive:null!==(e=this._spec.interactive)&&void 0!==e?e:this.getDefaultInteractive()}),this._marks.addMark(x),null===(i=this._spec.grid)||void 0===i?void 0:i.visible){const e=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?rj.circleAxisGrid:rj.lineAxisGrid,mode:this._spec.mode},{skipTheme:!0});this._updateTickDataMarks(e),e.setMarkConfig({zIndex:null!==(o=null!==(r=null===(n=null===(s=this._spec.grid)||void 0===s?void 0:s.style)||void 0===n?void 0:n.zIndex)&&void 0!==r?r:null===(a=this._spec.grid)||void 0===a?void 0:a.zIndex)&&void 0!==o?o:t.LayoutZIndex.Axis_Grid,interactive:!1}),this._marks.addMark(e),this._gridMark=e}if(this._syncComponentVisibility(),(null===(l=this._option.globalInstance)||void 0===l?void 0:l.isAnimationEnable())&&!1!==L(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=zF(null===(h=KR.getAnimationInKey("axis"))||void 0===h?void 0:h(),{appear:null!==(d=null!==(c=this._spec.animationAppear)&&void 0!==c?c:L(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==d?d:L(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(g=null!==(u=this._spec.animationDisappear)&&void 0!==u?u:L(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==g?g:L(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(m=null!==(f=this._spec.animationEnter)&&void 0!==f?f:L(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==m?m:L(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(_=null!==(v=this._spec.animationExit)&&void 0!==v?v:L(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==_?_:L(this._option.getChart().getSpec(),"animationExit"),update:null!==(b=null!==(y=this._spec.animationUpdate)&&void 0!==y?y:L(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==b?b:L(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._specVisible&&(this.getVisible()||this._spec.forceInitTick||this._hideWhenEmpty)}_initData(){const t=this._initTickDataSet(this._tickTransformOption()),e=new TD(this._option,t);this._tickData=[e],t.target.addListener("change",(()=>{this._onTickDataChange(e)}))}collectData(t,e){const i=[];return this._regions&&nR(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=y(a)?VC(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!!VC(this._scale.type)))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return nR(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=rR(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()})),nR(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(){}_hasCollectedSeriesData(){return this.collectData(0).length>0}_refreshVisibilityByData(){const t=this._specVisible&&(!this._hideWhenEmpty||this._hasCollectedSeriesData()),e=this._visible!==t;return this._visible=t,(this._axisMark||this._gridMark)&&this._syncComponentVisibility(),e&&this._forceLayout(),e}_syncComponentVisibility(){var t,e,i,s,n,r,a,o,l,h,c,d;null===(t=this._axisMark)||void 0===t||t.setVisible(this._visible),null===(e=this._gridMark)||void 0===e||e.setVisible(this._visible&&!1!==(null===(i=this._spec.grid)||void 0===i?void 0:i.visible)),null===(a=null===(r=null===(n=null===(s=this._axisMark)||void 0===s?void 0:s.getComponent)||void 0===n?void 0:n.call(s))||void 0===r?void 0:r.setAttributes)||void 0===a||a.call(r,{visibleAll:this._visible}),null===(c=null===(h=null===(l=null===(o=this._gridMark)||void 0===o?void 0:o.getComponent)||void 0===l?void 0:l.call(o))||void 0===h?void 0:h.setAttributes)||void 0===c||c.call(h,{visibleAll:this._visible&&!1!==(null===(d=this._spec.grid)||void 0===d?void 0:d.visible)})}_clearRawDomain(){}onLayoutEnd(){this.updateScaleRange(),this.event.emit(t.ChartEvent.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd()}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&U(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform({skipEqual:!0})})):nR(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_updateTickDataMarks(t){this._tickData&&this._tickData.forEach((e=>{e.addRelatedMark(t)}))}initScales(){this._scales=[this._scale];const t=[];if(nR(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_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=nI(s=t.domainLine)).startSymbol=nI(s.startSymbol),s.endSymbol=nI(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 oI(XR({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:oI(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(P(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>oI(t[i](e.rawValue,s,e,n,r)):P(t[i])||(e[i]=oI(t[i]))})),e}(t.label.state)),d(t.label.dataFilter)&&(i.label.dataFilter=(e,i)=>t.label.dataFilter(e,i,{vchart:this._option.globalInstance}))}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:d(t.tick.dataFilter)?e=>t.tick.dataFilter(e,{vchart:this._option.globalInstance}):void 0},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 oI(XR({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:oI(t.tick.style)),t.tick.state&&(i.tick.state=rI(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 oI(XR({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:oI(t.subTick.style)),t.subTick.state&&(i.subTick.state=rI(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=Rz[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?ae(p):null,textStyle:XR({},d,oI(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:oI(h.style)}),h.state&&(i.title.state.shape=rI(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:oI(o.style)}),o.state&&(i.title.state.background=rI(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=rI(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=oI(t.background.style)),t.background.state&&(i.panel.state=rI(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:vO(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 oI(XR({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:oI(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:vO(t.subGrid.alternateColor),style:oI(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=lF(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){SI(this._option.dataSet,"scale",lj);const i=this.registerTicksTransform();return new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,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)}getDatum(t){var e;return t&&t.name===vT.label?t.data:this._axisMark?null===(e=this._axisMark.getComponent())||void 0===e?void 0:e.attribute.items:void 0}scaleRangeFactor(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactor(t,e,i)}scaleRangeFactorEnd(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorEnd(t,e)}scaleRangeFactorStart(t,e,i){return this._onTickDataChange(this.getTickData()),this.getScale().rangeFactorStart(t,e)}}hj.specKey="axes";const cj=()=>{oj(),KR.registerAnimation("axis",(()=>({appear:{type:"fadeIn"},enter:{type:"fadeIn"},update:{type:"update"},exit:{type:"fadeOut"}})))},dj=[Lz];class uj extends hj{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}getInnerOffset(){return this._innerOffset}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),nR(this._regions,(t=>{const e=this.getOrient();ZF(e)?jz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):JF(e)?jz(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):QF(e)&&jz(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&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._transformLayoutPadding=t=>("left"===this.layoutOrient||"right"===this.layoutOrient?(t.top=0,t.bottom=0):"top"!==this.layoutOrient&&"bottom"!==this.layoutOrient||(t.left=0,t.right=0),t),this._updateAxisLayout=()=>{if(!this._visible)return void this._syncComponentVisibility();const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=XR({x:t.x,y:t.y},this._axisStyle,n);this._axisMark.setSimpleStyle(r),this._gridMark&&this._gridMark.setSimpleStyle(XR({x:t.x,y:t.y},this._getGridAttributes(),s)),this._syncComponentVisibility()},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=ZF(this.getOrient()),n=t=>{var e;return(s?!ZF(t.getOrient()):ZF(t.getOrient()))&&VC(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())>=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,e=a.valueToPosition(0);s?t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})})):t.setSimpleStyle(Object.assign(Object.assign({},t.getSimpleStyle()),{line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})}))}}}},this._orient=tz(i,["z"]),QF(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(!Dz(e))return null;const{axisType:t,componentName:s}=iz(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=>JF(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(!Dz(t))return;const{axisType:s,componentName:n}=iz(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=KR.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}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return ZF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):QF(this.getOrient())?k(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):k(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(dj.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this._specVisible){ZF(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&&!ZF(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e){if(super.onLayoutStart(t,e),!QF(this.getOrient())&&this._spec.innerOffset){const t=this._spec;JF(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=LR(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=LR(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=ZF(this.getOrient())?t.fieldX:QF(this.getOrient())?t.fieldZ:t.fieldY,VC(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;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,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:VC(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 t;(null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())&&this.event.on(uI.AFTER_ELEMENT_ENCODE,(({mark:t})=>{if(t===this._axisMark&&!1===this._isLayout&&(ZF(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._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=ZF(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:K(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}collectScale(){const t=[];return nR(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]:ZF(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:QF(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();nR(this._regions,(e=>{ZF(t)?jz(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):JF(t)?jz(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):QF(t)&&jz(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(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=ZF(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=ZF(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)})));this._axisMark.getProduct();let r=!1;{const t=this._getUpdateAttribute(!0),e=this._axisMark.getComponent(),s=XR(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let a=null==e?void 0:e.getBoundsWithoutRender(s);a&&!a.empty()||(a=(new He).set(s.x,s.y,s.x,s.y)),r=!0,this._latestBounds=a,i=this._appendAxisUnit(a,n)}return i}positionToData(t,e){const i=ZF(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?vt(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):vt(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-$(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;const a=this._spec.title;if(a.visible&&u(null===(e=a.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=a.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 o=this.getLayoutRect().height,l=Math.abs(Math.sin(e));return l<1e-6?1/0:o/l}return null}_getUpdateAttribute(t){let e=0,i=0;if(!t){const t=(t=>{let{x:e,y:i}=t[0].getLayoutStartPoint(),s=e+t[0].getLayoutRect().width,n=i+t[0].getLayoutRect().height;for(let r=1;r{const i=this._getNormalizedValue([e.value],t);return zz(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:VC(this._scale.type)?i>=s[0]&&i<=$(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this._specVisible&&(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 i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}uj.type=r.cartesianAxis,uj.specKey="axes";const pj=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function gj(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,mj=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function vj(t,e,i="count"){const s=mj(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0,o=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const l="count"===i?t.count:t.max-t.min,h=r[o-1]?r[o-1][1]:0,c=e===s.length-1?1:Math.min((a+l)/n,1);(h!==c||0!==h&&1!==h)&&(o+=1,r.push([h,c]),a+=l)}})),r}const _j=Math.sqrt(50),yj=Math.sqrt(10),bj=Math.sqrt(2);class xj{constructor(){this._extend={},this._rawDomain=[],this.niceLabelFormatter=null}getRawDomain(){return this._rawDomain}setExtraAttrFromSpec(){p(this._spec.nice)&&(this._nice=this._spec.nice),p(this._spec.zero)&&(this._zero=this._spec.zero),this._expand=this._spec.expand,this._domain=Iz(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(k(i.forceTickCount))e=i.forceTickCount;else if(d(i.tickCount)){const t=this._scale.range();let s=Math.abs($(t)-t[0]);if(1===s&&this._option){s=ZF(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=k(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return u(s)&&u(n)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&u(n)&&u(this._softMaxValue)?this._scale.niceMax(e):!(!u(s)||!u(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return u(e)&&u(i)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&u(i)&&u(this._softMaxValue)?this._scale.niceMax():!(!u(e)||!u(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[],a=u(this._domain.max)?n:this._domain.max;for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(fj),e.sort(fj),{domain:gj(t,e),scope:vj(t,e,i)}}(r,Fy(t),this._spec.breaks[0].scopeType);e=Fy(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return 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);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}=Iz(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs(K(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[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=_j?10:n>=yj?5:n>=bj?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max($(t),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)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){var t;if(!this.isSeriesDataEnable())return;!(null===(t=this._rawDomain)||void 0===t?void 0:t.length)&&this._scale&&this._updateRawDomain();const e=this.collectData(),i=this.computeLinearDomain(e);this.updateScaleDomainByModel(i)}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._refreshVisibilityByData(),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)-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}_updateRawDomain(){const e=this.collectData(0,!0),i=this.computeLinearDomain(e);this._rawDomain=i,this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomain=[]}}const Sj={domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},Aj={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}}},kj={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}}},Mj={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}}};class Tj extends uj{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new PE}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setExtraAttrFromSpec();const i=null===(e=null===(t=this._tickData)||void 0===t?void 0:t[0])||void 0===e?void 0:e.getDataView().transformsArr.find((t=>t.type===this.registerTicksTransform()));i&&(i.options=this._tickTransformOption())}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)}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!QF(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=ZF(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=BR(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=k(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=Fy(this._break.scope).map((t=>i[0]+($(i)-i[0])*t))),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}registerTicksTransform(){const t=`${this.type}-ticks`;return xI(this._option.dataSet,t,HE),t}}Tj.type=r.cartesianLinearAxis,Tj.specKey="axes",Tj.builtInTheme={axis:Mj,axisLinear:Sj,axisX:Aj,axisY:kj},G(Tj,xj);const wj=()=>{KR.registerGraphicComponent(nj.lineAxis,((t,e)=>new CC(t,e))),KR.registerGraphicComponent(rj.lineAxisGrid,((t,e)=>new zB(t,e))),cj(),KR.registerComponent(Tj.type,Tj)};class Cj{constructor(){this._rawDomainIndex=[],this._rawDomain=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{this._onTickDataChange(s)})),this._tickDataMap||(this._tickDataMap={}),this._tickDataMap[e]=s}}else{const t=this._initTickDataSet(this._tickTransformOption()),e=new TD(this._option,t);t.target.addListener("change",(()=>{this._onTickDataChange(e)})),this._tickData=[e],this._tickDataMap={0:e}}}_updateData(){var t,e,i;const s=this.registerTicksTransform();if(this._spec.showAllGroupLayers&&this._scales.length>1){const e=null!==(t=this._spec.layers)&&void 0!==t?t:[];Object.keys(this._tickDataMap).forEach((t=>{const i=e[this._scales.length-1-+t]||{},n=this._tickDataMap[t],r=null==n?void 0:n.getDataView().transformsArr.find((t=>t.type===s));r&&(r.options=Object.assign(Object.assign({},this._tickTransformOption()),i))}))}else{const t=null===(i=null===(e=this._tickData)||void 0===e?void 0:e[0])||void 0===i?void 0:i.getDataView().transformsArr.find((t=>t.type===s));t&&(t.options=this._tickTransformOption())}}getRawDomain(){return this._rawDomain}dataToPosition(t,e={}){var i,s;if(0===t.length||0===this._scales.length)return 0;const{position:n,bandScale:r}=this.getPosition(t);return n+r.bandwidth()*(null!==(s=null!==(i=e.bandPosition)&&void 0!==i?i:this._spec.bandPosition)&&void 0!==s?s:this._defaultBandPosition)}valueToPosition(t){return this._scale.scale(t)}updateGroupScaleRange(){let t=this._scale;this._scales.forEach(((e,i)=>{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._refreshVisibilityByData(),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._spec.showAllGroupLayers?this._scales:[this._scales[0]]).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=zz(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=>zz(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[],this._rawDomain=[];const e=this._spec.domain;for(let t=0;tthis._rawDomainIndex[t][e]=i))}this.event.emit(t.ChartEvent.scaleRawDomainUpdate,{model:this})}_clearRawDomain(){this._rawDomainIndex=[],this._rawDomain=[]}}const Ej={domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}};class Bj extends uj{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new cE}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}}registerTicksTransform(){const t=`${this.type}-ticks`;return xI(this._option.dataSet,t,GE),t}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=eE(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{KR.registerGraphicComponent(nj.lineAxis,((t,e)=>new CC(t,e))),KR.registerGraphicComponent(rj.lineAxisGrid,((t,e)=>new zB(t,e))),cj(),KR.registerComponent(Bj.type,Bj,!1)};class Lj extends Tj{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),nR(this._regions,(t=>{ZF(this.getOrient())?jz(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):jz(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=XR({},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 Ba(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.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 TD(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}created(){super.created(),this._layerTickData&&(this._axisMark&&this._layerTickData.addRelatedMark(this._axisMark),this._gridMark&&this._layerTickData.addRelatedMark(this._gridMark))}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=fi.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=>zz(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=>zz(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return xI(this._option.dataSet,t,HE),t}transformScaleDomain(){}}Lj.type=r.cartesianTimeAxis,Lj.specKey="axes",Lj.builtInTheme={axis:Mj,axisX:Aj,axisY:kj};class Rj extends Tj{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new IE}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return xI(this._option.dataSet,t,HE),t}transformScaleDomain(){}}Rj.type=r.cartesianLogAxis,Rj.specKey="axes",Rj.builtInTheme={axis:Mj,axisLinear:Sj,axisX:Aj,axisY:kj},G(Rj,xj);class Oj extends Tj{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new DE}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return xI(this._option.dataSet,t,HE),t}transformScaleDomain(){}}Oj.type=r.cartesianSymlogAxis,Oj.specKey="axes",Oj.builtInTheme={axis:Mj,axisLinear:Sj,axisX:Aj,axisY:kj},G(Oj,xj);const Ij=`${yO}_hide_`;function Dj(t,e){t.context.finalAttrs&&(t.context.finalAttrs.visible=e)}const Fj=(t,e)=>{if(!e||0===e.length)return e;const{direction:i,delta:s,deltaMul:n=1,groupBy:r}=t,a=e=>{!function(t){t.forEach((t=>{t[Ij]&&(Dj(t,!0),t[Ij]=!1)}))}(e);const r=t.sort?e.slice().sort(((t,e)=>t.context.finalAttrs.x-e.context.finalAttrs.x)):e;0===i?function(t,e,i){let s=-1/0,n=0,r=0;const a=u(e);let o=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,{x:l,y:h}=t.context.finalAttrs;a&&(o=(e+n)*i),r=(-1/0-l)**2+(s-h)**2,r<(o+n+e)**2?t.context.finalAttrs.forceShow||(t[Ij]=!0,Dj(t,!1)):s=h,n=e}))}(r,s,n):1===i?function(t,e,i){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.x;r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.context.finalAttrs.visible)return;const e=t.context.finalAttrs.size/2,o=t.context.finalAttrs.y;r&&(a=(e+n)*i),Math.abs(o-s){var i,s;const n=null===(s=null===(i=e.context.data)||void 0===i?void 0:i[0])||void 0===s?void 0:s[r];return t[n]?t[n].push(e):t[n]=[e],t}),{});Object.keys(t).forEach((e=>{a(t[e])}))}else a(e);return e},zj=()=>{KR.registerGrammarTransform("symbolOverlap",{transform:Fj,runType:"afterEncode"})},jj={min:K,max:X,average:QL,sum:JL};function Hj(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}r[d-1]!==a-1&&(r[d++]=a-1);return r.map((t=>i?e[t].i:t))}function Vj(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 Nj(t,e,i,s){return Vj(t,e,i,"min",s)}function Uj(t,e,i,s){return Vj(t,e,i,"max",s)}function Wj(t,e,i,s){return Vj(t,e,i,"average",s)}function Gj(t,e,i,s){return Vj(t,e,i,"sum",s)}const Yj=(t,e)=>{let i=d(t.size)?t.size():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=Hj;if("min"===n?l=Nj:"max"===n?l=Uj:"average"===n?l=Wj:"sum"===n&&(l=Gj),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[]},$j=()=>{KR.registerGrammarTransform("dataSampling",{transform:Yj})};class Xj extends qF{constructor(){super(...arguments),this.type=cR.line,this.transformerConstructor=Az,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark("line"===e),this.initSymbolMark("point"===e)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.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(zF(null===(i=KR.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),jF("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=KF(this);this._symbolMark.setAnimationConfig(zF(null===(s=KR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),jF("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(){super.onLayoutEnd(),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]}}Xj.type=cR.line,Xj.mark=fz,Xj.builtInTheme={line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},Xj.transformerConstructor=Az,G(Xj,gz);class Kj{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{LI(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof Ba)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];Hy(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];Hy(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class qj{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)=>{Zy(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{YO(e,[{key:t,operations:VC(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&&YO(e,[{key:i.field,operations:VC(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?MR("colorOrdinal"):MR(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(Zy(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),t.clamp&&e.clamp&&e.clamp(t.clamp),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(U(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;if(!U(r.specified,s.specified))return e.reMake=!0,e;s.range&&!U(s.range,n.range())&&(n.range(s.range),e.reRender=!0),Zy(s.domain)?e.reRender=!0:U(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(!Zy(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=VC(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=VC(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;VC(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(VC(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=VC(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!P(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)));VC(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 Zj{constructor(){this._stateGraphicsByTrigger=new Map,this._disableTriggerEvent=!1,this._triggerMapByState=new Map}setDisableActiveEffect(t){this._disableTriggerEvent=t}addTrigger(t){if(t){[t.getStartState(),t.getResetState()].forEach((e=>{if(e){const i=this._triggerMapByState.get(e);i?!i.includes(t)&&i.push(t):this._triggerMapByState.set(e,[t])}}))}}setStatedGraphics(t,e){this._stateGraphicsByTrigger.set(t,e)}getStatedGraphics(t){return this._stateGraphicsByTrigger.get(t)}updateStates(t,e,i,s,n){return this._disableTriggerEvent?[]:e&&e.length?(s&&n?i&&i.length?(this.toggleReverseStateOfGraphics(t,e,i,n),this.toggleStateOfGraphics(t,e,i,s)):this.addBothStateOfGraphics(t,e,s,n):s&&(i&&i.length?this.toggleStateOfGraphics(t,e,i,s):this.addStateOfGraphics(t,e,s)),e):[]}toggleReverseStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}}))}toggleStateOfGraphics(t,e,i,s){const n=t.getMarkIdByState();i.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.removeState(s,n)}})),e.forEach((t=>{var e;if(s&&n[s]&&n[s].includes(t.context.markId)){const i=null===(e=t.parent)||void 0===e?void 0:e.mark,n=i.hasAnimationByState&&i.hasAnimationByState("state");t.addState(s,!0,n)}}))}addBothStateOfGraphics(t,e,i,s){const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{var n;const a=s&&r[s]&&r[s].includes(t.id),o=i&&r[i]&&r[i].includes(t.id);if(!a&&!o)return;const l=t.hasAnimationByState&&t.hasAnimationByState("state");null===(n=t.getGraphics())||void 0===n||n.forEach((t=>{e&&e.includes(t)?o&&t.addState(i,!0,l):a&&t.addState(s,!0,l)}))}))}addStateOfGraphics(t,e,i){const s=t.getMarks(),n=t.getMarkIdByState();s.forEach((t=>{var s;const r=i&&n[i]&&n[i].includes(t.id);if(!r)return;const a=t.hasAnimationByState&&t.hasAnimationByState("state");null===(s=t.getGraphics())||void 0===s||s.forEach((t=>{e&&e.includes(t)&&r&&t.addState(i,!0,a)}))}))}clearAllStatesOfTrigger(t,e,i){if(this._disableTriggerEvent)return;const s=this.getStatedGraphics(t);if(!s||!s.length)return;const n=t.getMarks(),r=t.getMarkIdByState();n.forEach((t=>{if(t){const n=t.getGraphics(),a=t.hasAnimationByState&&t.hasAnimationByState("state");n&&n.length&&(i&&r[i]&&r[i].includes(t.id)&&n.forEach((t=>{t.removeState(i,a)})),e&&r[e]&&r[e].includes(t.id)&&n.forEach((t=>{s.includes(t)&&t.removeState(e,a)})))}}))}clearAllStates(){this._disableTriggerEvent||this._triggerMapByState.forEach(((t,e)=>{t.forEach((t=>{this.clearAllStatesOfTrigger(t,e,t.getResetState())}))}))}clearByState(t){if(this._disableTriggerEvent)return;const e=this._triggerMapByState.get(t);e&&e.length&&e.forEach((e=>{this.clearAllStatesOfTrigger(e,t,e.getResetState()),this.setStatedGraphics(e,[])}))}updateStateOfGraphics(t,e){if(this._disableTriggerEvent)return;const i=this._triggerMapByState.get(t);i&&i.length&&i.forEach((t=>{const i=e.filter((e=>t.getMarks().some((t=>{const i=t&&t.getGraphics();return i&&i.includes(e)}))));this.updateStates(t,i,this.getStatedGraphics(t),t.getStartState(),t.getResetState()),this.setStatedGraphics(t,i)}))}}class Jj extends nD{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){this._layoutTag=t;const s=this.getCompiler();return s&&(s.updateLayoutTag(),t&&i&&s.renderNextTick(e)),this._layoutTag}resetLayoutItemTag(){this.getLayoutElements().forEach((t=>t.setWillLayoutTag()))}getModelOption(){return this._modelOption}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}_setModelOption(){}constructor(t,e){var i,s,n,r;super(e),this.type="chart",this.id=Ky(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:bO,height:xO},this._viewRect={width:bO,height:xO},this._viewBox={x1:0,y1:0,x2:bO,y2:xO},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=IR(null!==(i=t.padding)&&void 0!==i?i:e.getTheme("padding")),this._event=new dI(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new Kj(this._dataSet),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===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),componentShowContent:null===(r=this._option)||void 0===r?void 0:r.componentShowContent,getSeriesData:this._chartData.getSeriesData.bind(this._chartData),dispatchEvent:(t,e)=>this._option.globalInstance.event.emit(t,e)}),this._setModelOption&&this._setModelOption(),this._spec=t}created(t){this._chartData.parseData(this._spec.data),this._createGlobalScale(),this._createBackground(),this._createLayout(),t.forEachRegionInSpec(this._spec,this._createRegion.bind(this)),t.forEachSeriesInSpec(this._spec,this._createSeries.bind(this)),t.forEachComponentInSpec(this._spec,this._createComponent.bind(this),this._option.getSpecInfo())}_initInteractions(){if(this._option.disableTriggerEvent)return;this._interaction=new Zj;const t=this.getAllSeries(),e=[],i={};t.forEach((t=>{const s=t.getInteractionTriggers();if(s&&s.length){const n=t.getRegion().id;s.forEach((({trigger:t,marks:s})=>{const r=`${n}-${t.type}`;i[r]?s.forEach((t=>{i[r].marks.push(t)})):(i[r]=Object.assign(Object.assign({},t),{marks:s}),e.push(i[r]))}))}})),e.forEach((t=>{const e=KR.createInteractionTrigger(t.type,Object.assign(Object.assign({},t),{event:this._event,interaction:this._interaction}));e&&(e.init(),this._interaction.addTrigger(e))}))}init(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow(),this._initInteractions(),this.initStageAnimation()}initStageAnimation(){const t=this._option.getCompiler();(null==t?void 0:t.setStageAnimationConfig)&&t.setStageAnimationConfig(zF({},jF("stage",this._spec,{}),null))}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.resetLayoutItemTag(),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.resetLayoutItemTag(),this.setLayoutTag(!0,null,e)}_createBackground(){const e=this._spec.background;if(!e||"object"!=typeof e||p(e.gradient))return;const i=H(e,["x","y","width","height","x1","y1","image"]);i.background=e.image,this._backgroundMark=KR.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({},i),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:t.LayoutZIndex.SeriesGroup-2}),this.getCompiler().addRootMark(this._backgroundMark)}_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){const s=KR.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:"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(){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e,this._option.globalInstance),this.getLayoutTag()){this._event.emit(t.ChartEvent.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart();const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(t.ChartEvent.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(),this._event.emit(t.ChartEvent.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s,this._option.globalInstance)}onLayoutStart(){this.getAllModels().forEach((t=>t.onLayoutStart(this._layoutRect,this._viewRect)))}onLayoutEnd(){this.getAllModels().forEach((t=>{"series"!==t.modelType&&t.onLayoutEnd()}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}onBeforeRender(){[...this._components,...this._regions,...this._series].forEach((t=>t.onBeforeRender()))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof aD)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 PD))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof PD)return e}getMarkByUserName(t){return this.getAllMarks().filter((e=>e.name&&e.name===t))}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&&LI(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=XI(this._spec,this._option,{width:bO,height:xO})),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),Object.prototype.hasOwnProperty.call(e,"clamp")&&(i.clamp=e.clamp)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=fR(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new qj(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){KI(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=fR(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0};return Object.keys(t).filter((t=>!e[t])).sort()}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=this._getSpecKeys(this._spec);if(!U(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{KI(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[r.title]:!0,[r.brush]:!0,[r.indicator]:!0};this._components.forEach((s=>{var n,a;if(s.type===r.label||s.type===r.totalLabel)return;i[s.type]&&(i[s.type]=!1);const o=s.specKey||s.type,l=null!==(n=this._spec[o])&&void 0!==n?n:{};y(l)?(e[o]=e[o]||{specCount:l.length,componentCount:0},e[o].componentCount++,KI(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):KI(t,s.updateSpec(l))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}const s=t=>t&&!1!==t.visible;Object.keys(i).forEach((e=>{if(i[e]){const i=this._spec[e];(y(i)?i.some(s):s(i))&&(t.reMake=!0)}}))}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];KI(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=RR(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.resetLayoutItemTag(),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(){this._backgroundMark&&this._backgroundMark.compile()}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._option.globalInstance),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,this._option.globalInstance)}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._option.globalInstance),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,this._option.globalInstance)}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._option.globalInstance),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,this._option.globalInstance)}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(){this.layout()}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(P(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(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_SELECTED,e,i,s)}setHovered(e,i,s){this._setStateInDatum(t.STATE_VALUE_ENUM.STATE_HOVER,e,i,s)}clearState(t){this._interaction.clearByState(t)}clearAllStates(){this._interaction.clearAllStates()}clearSelected(){this.clearState(t.STATE_VALUE_ENUM.STATE_SELECTED)}clearHovered(){this.clearState(t.STATE_VALUE_ENUM.STATE_HOVER)}_initEvent(){[t.ChartEvent.dataZoomChange,t.ChartEvent.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(uI.AFTER_MARK_RENDER_END,e)};this._event.on(uI.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>e.enableAnimationByState(t)))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>e.disableAnimationByState(t)))}filterGraphicsByDatum(t,e={}){var i;const s=(t=t?Y(t):null)?Object.keys(t[0]):null,n=[],r=null!==(i=e.getDatum)&&void 0!==i?i:hI;return this.getRegionsInQuerier(e.region).forEach((i=>{const a=[];t&&i.getSeries().forEach((o=>{o.getMarks().forEach((l=>{const h=l.getGraphics();if(h&&h.length&&(!e.filter||d(e.filter)&&e.filter(o,l))){if(lI(l.type))h.filter((h=>{const c=r(h,l,o,i),d=c&&t.every(((t,e)=>s.every((i=>t[i]==c[e][i]))));d&&(a.push(h),n.push(h),e.callback&&e.callback(h,l,o,i))}));else if(t.length>1){const c=t.slice();h.forEach((t=>{const h=r(t,l,o,i),d=h&&c.findIndex((t=>s.every((e=>t[e]==h[e]))));d>=0&&(c.splice(d,1),a.push(t),n.push(t),e.callback&&e.callback(t,l,o,i))}))}else{const c=h.find((e=>{const n=r(e,l,o,i);return n&&s.every((e=>t[0][e]==n[e]))}));c&&(a.push(c),n.push(c),e.callback&&e.callback(c,l,o,i))}}}))})),e.regionCallback&&e.regionCallback(a,i)})),n}_setStateInDatum(t,e,i,s){if(!e)return void this._interaction.clearByState(t);const n=this.filterGraphicsByDatum(e,{filter:i,region:s});this._interaction.updateStateOfGraphics(t,n)}setDimensionIndex(t,e){var i,s;let n=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:r}=i;if(s===uz.dimensionHover||s===uz.dimensionClick){const i=r.dispatch(t,e);(null==i?void 0:i.length)&&(n=i)}}));const a=u(t)||!n||n.every((t=>UC(t.axis.getScale().type)&&u(t.index))),o=a||n.every((t=>UC(t.axis.getScale().type)&&t.data.every((t=>0===t.datum.length))));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(a||o)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};n.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(a?t.hideCrosshair():t.showCrosshair(n))}}showCrosshair(t){var e;const i=null!==(e=this.getComponentsByType(r.cartesianCrosshair)[0])&&void 0!==e?e:this.getComponentsByType(r.polarCrosshair)[0];if(!i)return;const s=this.getComponentsByKey("axes"),n=[];s.forEach((e=>{const i=t(e);!1!==i&&n.push({axis:e,value:i})})),i.showCrosshair(n)}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t,"colorScheme")}}const Qj=(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 tH{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)}))}generateTransform(t,e){return(i,s,n)=>{const{spec:r,specPath:a,specInfoPath:o,type:l}=s,h=new i.transformerConstructor(Object.assign(Object.assign({},this._option),{type:l})),c=h.transformSpec(r,t,n),d=Object.assign(Object.assign({},s),c);e?d.theme=h.getTheme(r,t):GR(t,a,c.spec),GR(n,null!=o?o:a,d)}}transformModelSpec(t){return this.createSpecInfo(t,this.generateTransform(t,!1))}createSpecInfo(t,e){var i,s;e||(e=this.generateTransform(t,!0));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=Qj(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=Qj(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,e,i){var s,n,r,a,o;const l={dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(s=t.animation)&&void 0!==s?s:null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable(),animationThreshold:null!==(r=t.animationThreshold)&&void 0!==r?r:null===(o=(a=this._option).getTheme)||void 0===o?void 0:o.call(a,"animationThreshold"),animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,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},h=this.seriesType;return h&&(l.type=h,l[h]=t[h]),e&&e.length&&e.forEach((e=>{l[e]=t[e]})),i&&i.length&&i.forEach((e=>{l[e]=t[e]})),l}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(KR.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(KR.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=KR.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=KR.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=KR.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.sort(((t,e)=>t.createOrder-e.createOrder)),p.forEach((({cmp:s})=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):hF(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=hF(t,u.specKey,u.type))||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"];return 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}))}_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 eH extends tH{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t,e){return super._getDefaultSeriesSpec(t,["xField","yField","zField","direction","stack","percent","stackOffsetSilhouette","totalLabel","sortDataByAxis"],e)}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t),this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_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;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{u(i[t])&&(i[t]=n[t])})),L(i,"trimPadding")&&XR(i,qI(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class iH extends eH{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["point","line","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","lineLabel"]);return i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"line",i}transformSpec(t){super.transformSpec(t),$I(t)}}const sH=(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&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i,s,n;return!!(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.alwayCalculateTotal)||(null===(n=null===(s=t.getSpec())||void 0===s?void 0:s.totalLabel)||void 0===n?void 0:n.visible)})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=KO(t,!0);for(const e in o)for(const i in o[e].nodes)QO(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)JO(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&ZO(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}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 rH{_beforeInit(){this._dataSet&&xI(this._dataSet,"stackSplit",sH)}_initStack(){this._stack=new nH(this),this._stack.init()}}const aH={state:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER,reverseState:t.STATE_VALUE_ENUM.STATE_DIMENSION_HOVER_REVERSE,trigger:uz.dimensionHover};class oH extends KD{constructor(t){super(t),this.type="dimension-hover",this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e,interaction:i}=this.options,s=i.getStatedGraphics(this);s&&s.length&&(i.clearAllStatesOfTrigger(this,t,e),this.dispatchEvent("reset",{graphics:s,options:this.options}),i.setStatedGraphics(this,[]))},this.handleStart=t=>{const e=this.options.interaction;switch(t.action){case"enter":const i=this.getStatedGraphics(t);e.updateStates(this,this.getStatedGraphics(t),e.getStatedGraphics(this),this.options.state,this.options.reverseState),e.setStatedGraphics(this,i);break;case"leave":e.clearAllStatesOfTrigger(this,this.options.state,this.options.reverseState),e.setStatedGraphics(this,[])}},this.options=Object.assign({},aH,t),this.updateMarkIdByState([this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getResetState(){return this.options.reverseState}getEvents(){return[{type:this.options.trigger,handler:this.handleStart}]}getStatedGraphics(t,e=!1){const i=this.getMarksByState(e?this.options.reverseState:this.options.state),s=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const n=i.filter((e=>e.model===t.series&&e.getVisible()));n.forEach((i=>{const n=i.getGraphics();if(!n||!n.length)return;const r=n.filter((i=>{const s=hI(i);let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));s.push(...r)}))}))})),s}}oH.type="dimension-hover",oH.defaultOptions=aH;const lH=()=>{KR.registerInteractionTrigger(oH.type,oH)},hH=()=>{KR.registerComposedEvent(uz.dimensionHover,dz),KR.registerComposedEvent(uz.dimensionClick,rz)},cH=t=>t.fieldX[0],dH=t=>t.fieldY[0],uH=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},pH=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},gH=(t,e)=>t?e?cH:uH:e?dH:pH,fH=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=cz(t,(t=>ZF(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=cz(t,(t=>JF(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{UC(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((t=>{if(d.size>0){if(d.has(t)){const s=mH(t,i,gH(e,UC(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=mH(t,i,gH(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},mH=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:vH(t,s,i)},vH=(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=lz(e,t,"cartesian",null!=i?i:ZF(t.getOrient())?cH:dH);return{index:n,value:e,position:s.scale(e),axis:t,data:r}},_H=(t,e,i,s=!1)=>(i||(i={x:0,y:0}),Object.keys(t).forEach((n=>{var r,a,o,l,h,c;const{currentValue:d,cacheInfo:u,labelsComp:g,attributes:f,coordKey:m}=t[n];let v=null,_=0,y=null;if(d.size){const t=Array.from(d.values())[0];_=t.axis.getScale().scale(t.datum)+t.axis.getLayoutStartPoint()[m]-i[m],v=t.axis,y=null===(c=null===(h=null===(l=null===(o=null===(a=null===(r=v.getVRenderComponents()[0])||void 0===r?void 0:r.children[0])||void 0===a?void 0:a.children[0])||void 0===o?void 0:o.children[0])||void 0===l?void 0:l.getChildByName("axis-label-container"))||void 0===h?void 0:h.getChildByName("axis-label-container-layer-0"))||void 0===c?void 0:c.children[0]}const b=!!d.size&&Number.isFinite(_)&&!Number.isNaN(_),x=s&&!b&&p(u),S=x?u:{coordRange:[0,0],sizeRange:[0,0],coord:_,labelsTextStyle:{},labels:g?Object.keys(g).reduce(((t,e)=>(t[e]={visible:!1,text:"",dx:0,dy:0},t)),{}):null,visible:b,axis:v,axisLabel:y};let A;S&&(S._isCache=x);let k=0;if(f&&d.forEach((({axis:t,datum:i=""})=>{var s,r,a,o,l,h,c,d,u,p;let g=null;const m=t.getScale();if(UC(m.type))A=m.bandwidth(),0===A&&m.step&&(k=m.step());else if(VC(m.type)){const s="xField"===n?e.fieldX[0]:e.fieldY[0],r="xField"===n?e.fieldX2:e.fieldY2,a=function(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}(e.getViewData().latestData,+i,s,r);if(a){const t="xField"===n?e.dataToPositionX(a):e.dataToPositionY(a);r?(A=Math.abs(t-("xField"===n?e.dataToPositionX1(a):e.dataToPositionY1(a))),i=`${a[s]} ~ ${a[r]}`):A=1,_=t}g=t.niceLabelFormatter}if(S&&(null===(s=f.label)||void 0===s?void 0:s.visible)&&!x){const e=Oz(t.getSpec()),s=t.getOrient(),n=null===(r=f.label)||void 0===r?void 0:r.syncAxisLabelAngle;S.labels[s]&&(S.labels[s].visible=!0,S.labels[s].text=i,"left"===s?(S.labels[s].dx=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(a=y.attribute.textAlign)&&void 0!==a?a:"right",textBaseline:n&&y&&null!==(o=y.attribute.textBaseline)&&void 0!==o?o:"middle"}):"right"===s?(S.labels[s].dx=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(l=y.attribute.textAlign)&&void 0!==l?l:"left",textBaseline:n&&y&&null!==(h=y.attribute.textBaseline)&&void 0!==h?h:"middle"}):"top"===s?(S.labels[s].y=0,S.labels[s].dy=-e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(c=y.attribute.textAlign)&&void 0!==c?c:"center",textBaseline:n&&y&&null!==(d=y.attribute.textBaseline)&&void 0!==d?d:"bottom"}):"bottom"===s&&(S.labels[s].dy=e,S.labelsTextStyle[s]={textAlign:n&&y&&null!==(u=y.attribute.textAlign)&&void 0!==u?u:"center",textBaseline:n&&y&&null!==(p=y.attribute.textBaseline)&&void 0!==p?p:"top"}),S.labels[s].defaultFormatter=g)}})),S&&!x){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};bH(t,d),"xField"===n?(S.coordRange=[t.x1,t.x2],S.sizeRange=[t.y1,t.y2],S.coord=_+i.x,S.labels&&(S.labels.top.y=t.y1,S.labels.bottom.y=t.y2)):(S.coordRange=[t.y1,t.y2],S.sizeRange=[t.x1,t.x2],S.coord=_+i.y,S.labels&&(S.labels.left.x=t.x1,S.labels.right.x=t.x2)),(S.coordS.coordRange[1])&&(S.visible=!1),f&&f.label&&Object.keys(S.labels).forEach((t=>{S.labels[t].visible&&yH(S.labels[t],t,f.label)}))}t[n].bandSize=null!=A?A:0,t[n].offsetSize=k,t[n].cacheInfo=S})),t),yH=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=lF(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},bH=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{const{x:i,y:s}=e.getLayoutStartPoint(),{width:n,height:r}=e.getLayoutRect();t.x1=Math.min(t.x1,i),t.y1=Math.min(t.y1,s),t.x2=Math.max(t.x2,i+n),t.y2=Math.max(t.y2,s+r)}))}))},xH=t=>{const{cacheInfo:e,attributes:i,bandSize:s,offsetSize:n,coordKey:r,anotherAxisKey:a}=t,{coord:o,sizeRange:l}=e,h=i.type;let c;if("line"===h){const t=o+s/2;c={visible:!0,start:{[r]:t,[a]:l[0]},end:{[r]:t,[a]:l[1]}}}else if("rect"===h){const[t,h]=SH(i,s,n,e.axis),{coordRange:d}=e;c={visible:!0,start:{[r]:Math.max(o+t,d[0]),[a]:l[0]},end:{[r]:Math.min(o+h,d[1]),[a]:l[1]}}}return c},SH=(t,e,i,s)=>{var n,r,a;const o=0===e?i:e;let l=o;if(null===(n=t.style)||void 0===n?void 0:n.sizePercent)l=o*t.style.sizePercent;else if("number"==typeof(null===(r=t.style)||void 0===r?void 0:r.size))l=t.style.size;else if("function"==typeof(null===(a=t.style)||void 0===a?void 0:a.size)){const e=s.getLayoutRect();l=t.style.size(e,s)}return 0===e?[-l/2,l/2]:[e/2-l/2,l/2+e/2]},AH=(t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{datum:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:s,attributes:{visible:!!s.size,type:"rect"}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:n,attributes:{visible:!!n.size,type:"rect"}}};return _H(c,r,e),c.xField.cacheInfo?xH(c.xField):c.yField.cacheInfo?xH(c.yField):void 0},kH=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],MH=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&kH.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(TH(s).every((t=>{var e;return!gF("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},TH=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},wH={dom:`${yO}_TOOLTIP_HANDLER_DOM`,canvas:`${yO}_TOOLTIP_HANDLER_CANVAS`},CH={key:"其他",value:"..."};var EH;!function(t){t.group="group",t.mark="mark",t.dimension="dimension"}(EH||(EH={}));class BH{constructor(e){this._showTooltipByHandler=(e,i)=>{var s,n,r;if(u(e))return 1;i.changePositionOnly||this.clearCache(),this._updateViewSpec(e,i);const a=this._cacheActiveSpec;if(u(a)||!1===a.visible)return 1;i.tooltipSpec=this.component.getSpec(),i.activeTooltipSpec=a;const{title:o,content:l}=a,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:h,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}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:d,model:g}=e;if(!d||!this._cacheActiveSpec){const d=this.component.getSpec();if(this._cacheActiveSpec=MH(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){u(this._cacheActiveSpec.handler)&&p(d.handler)&&(this._cacheActiveSpec.handler=d.handler);const g=null!==(i=d[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},CH),t):CH;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!!this.component.enable&&(!u(e)&&gF(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec))}clearCache(){this._cacheActiveSpec=void 0}}class PH extends BH{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)}_getDimensionInfo(t){var e,i,s;let n;const r=this.component.getChart(),a=r.getCompiler().getStage().getLayer(void 0),o={x:t.event.viewX,y:t.event.viewY};if(a.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},o),n=null!==(s=null===(i=(e=this.component.getOption()).getDimensionInfo)||void 0===i?void 0:i.call(e,r,o,!0))&&void 0!==s?s:[],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(!UC(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(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}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}const LH=()=>{KR.registerTooltipProcessor("dimension",PH)};class RH extends BH{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getGraphics().forEach((t=>{t!==e.node&&t&&t.containsPoint(s.x,s.y,Xo.GLOBAL,t.stage.getPickerService())&&h[0].datum.push(hI(t))}))}))}}const g=Object.assign(Object.assign({},e),{model:o,changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;const n=null===(e=t.model)||void 0===e?void 0:e.modelType;if("series"===n){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}else if("component"===n){const e=t.model,n=t.node;if("label"===e.name&&n){const t=e.getLabelInfoByTextGraphic(n),{baseMark:r,series:a,labelMark:o}=null!=t?t:{},l=a.tooltipHelper,h=null==l?void 0:l.activeTriggerSet.mark,c=null==l?void 0:l.ignoreTriggerSet.mark;(null==h?void 0:h.has(o))?i={mark:r,datum:n.attribute.data,series:a}:(null==c?void 0:c.has(o))&&(s=!0)}}return{tooltipInfo:i,ignore:s}}}const OH=()=>{KR.registerTooltipProcessor("mark",RH)};class IH extends BH{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:Y(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?Y(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_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 DH=()=>{KR.registerTooltipProcessor("group",IH)};class FH extends Jj{constructor(){super(...arguments),this.transformerConstructor=iH,this.type="line",this.seriesType=cR.line}_setModelOption(){this._modelOption.getDimensionInfo=fH,this._modelOption.getDimensionInfoByValue=vH,this._modelOption.getRectByDimensionData=AH}}FH.type="line",FH.seriesType=cR.line,FH.transformerConstructor=iH,G(FH,rH);const zH=[...vz,"fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"];class jH extends _z{constructor(){super(...arguments),this.type=jH.type,this._isValidPointChannel=t=>["x","y","x1","y1","defined"].includes(t)}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getSegmentAttributes(){return zH}_getIgnoreAttributes(){return[]}}jH.type="area";const HH=()=>{KR.registerMark(jH.type,jH),Jk(),Lk(),EB(),kB(),$D(),KR.registerGraphicComponent("area",sf)};class VH extends _F{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 NH=Object.assign(Object.assign(Object.assign({},BF),pz),{area:{name:"area",type:"area"}}),UH=()=>{KR.registerAnimation("area",GD),YD(),UD()};class WH extends Az{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;const n=!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,(t=>{const e="inside-middle"===t.position;return!n||e?"area":"point"})),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0)}_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,f=h;("line"===c||u&&!d)&&(g=h,f=l),l.style=XR({},f.style,g.style),l.state=XR({},f.state,g.state),!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),t.area=l,t.line=h}}class GH extends qF{constructor(){super(...arguments),this.type=cR.area,this.transformerConstructor=WH,this._sortDataByAxis=!1}initMark(){var t;const e=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",i=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(GH.mark.area,{groupKey:this._seriesField,isSeriesMark:i&&"point"!==e},{morphElementKey:this.getDimensionField()[0]}),this.initSymbolMark("point"===e)}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===nF?"horizontal"===this._direction?"monotoneY":"monotoneX":a,l=this._areaMark;if(l){const e=this._isAreaVisible(),i=this._isLineVisible();e||i?l.setVisible(!0):l.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return TR(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),y1: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),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return TR(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:!!e&&this.getColorAttribute(),stroke:!!i&&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.getStack()&&this.setMarkStyle(l,{zIndex:t=>-t[EO]},"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(zF(null===(e=KR.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),jF("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(zF(null===(i=KR.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),jF("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=KF(this);this._symbolMark.setAnimationConfig(zF(null===(s=KR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),jF("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new VH(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.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(){super.onLayoutEnd(),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}}}GH.type=cR.area,GH.builtInTheme={area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"}},GH.mark=NH,GH.transformerConstructor=WH,G(GH,gz);class YH extends eH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","line","area","seriesMark","activePoint","sampling","samplingFactor","pointDis","pointDisMul","markOverlap","areaLabel","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),$I(t)}}class $H extends Jj{constructor(){super(...arguments),this.transformerConstructor=YH,this.type="area",this.seriesType=cR.area}_setModelOption(){this._modelOption.getDimensionInfo=fH,this._modelOption.getDimensionInfoByValue=vH,this._modelOption.getRectByDimensionData=AH}}$H.type="area",$H.seriesType=cR.area,$H.transformerConstructor=YH,G($H,rH);function XH(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 KH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:XH(t,e)}),qH=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:XH(t,e)}),ZH={type:"fadeIn"},JH={type:"growCenterIn"};function QH(t,e){if(!1===e)return{};switch(e){case"fadeIn":return ZH;case"scaleIn":return JH;default:return KH(t)}}class tV extends PD{constructor(){super(...arguments),this.type=tV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}tV.type="rect";const eV=()=>{Jk(),Xk(),xB("rect",TB),KR.registerMark(tV.type,tV),pw.registerBuiltInAnimate("growHeightIn",rC),pw.registerBuiltInAnimate("growHeightOut",aC),pw.registerBuiltInAnimate("growWidthIn",SC),pw.registerBuiltInAnimate("growWidthOut",AC),pw.registerBuiltInAnimate("growCenterIn",iC),pw.registerBuiltInAnimate("growCenterOut",sC),KR.registerGraphicComponent("rect",Ig)},iV=Object.assign(Object.assign({},BF),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function sV(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;a{let[i,s]=[t,e].sort(((t,e)=>t-e));const n=s-i;if(this._spec.barGap){const t=.5*this._spec.barGap;i=i+t,s=s-t}const r=s-i,a=FR(this._spec.barMinWidth||2,n);if(rthis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[PF]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):TR(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[LF]):TR(this._dataToPosX1(t),e,i),this._getLinearBarXRange=(t,e,i)=>{const s=TR(this._dataToPosX(t),e,i),n=TR(this._dataToPosX1(t),e,i);return this._getLinearBarRange(s,n)},this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[RF]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):TR(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[OF]):TR(this._dataToPosY1(t),e),this._getLinearBarYRange=(t,e,i)=>{const s=TR(this._dataToPosY(t),e,i),n=TR(this._dataToPosY1(t),e,i);return this._getLinearBarRange(s,n)},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(){this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},aV.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0],morph:NF(this._spec,this._barMarkName)})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(aV.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId()}))}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(xI(this._option.dataSet,"addVChartProperty",dF),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};xI(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new Ba(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:TF.bind(this),call:wF}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new TD(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=OF,s=RF,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=LF,s=PF,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=KO(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)sV(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=TR(this[r](t),l,i),u=TR(this[a](t),l,i);let p=Math.abs(d-u);p<=0&&!wR(t[this.getStackValueField()],l)?p=0:pthis._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.setMarkConfig({clip:!0,clipPath:()=>{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[CO],n=t[EO],r=t[BO],h=t[PO];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]),{[CO]:i,[EO]:s}),a?{[BO]:o,[PO]:l}:void 0),c="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)};t.push(Ig(Object.assign(Object.assign({},c),{cornerRadius:d(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(c,h,this._markAttributeContext):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=>this._getLinearBarYRange(t,a,!0)[0],y1:t=>this._getLinearBarYRange(t,a,!0)[1]}:{y:t=>TR(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,a,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,r,!0),x1:t=>this._getBarXEnd(t,r,!0)},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=>this._getLinearBarXRange(t,r,!0)[0],x1:t=>this._getLinearBarXRange(t,r,!0)[1]}:{x:t=>TR(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,r,!0),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;const e="horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0):this._yAxisHelper.getScale(0);if(e){const t=e.domain(),i=K(t),s=X(t);return s<0?e.scale(s):i>0?e.scale(i):e.scale(0)}}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=KF(this);this._barMark.setAnimationConfig(zF(null===(e=KR.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),jF(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=p(this._spec.barWidth)&&r===n,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=a;return o&&(c=FR(this._spec.barWidth,a)),l&&(c=Math.max(c,FR(this._spec.barMinWidth,a))),h&&(c=Math.min(c,FR(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=u(i)?f:Math.min(f,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,m-1))&&void 0!==r?r:6,_=m===f?this._barMark.getAttribute(c,e):v;if(m>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=FR(null!==(l=i[r-1])&&void 0!==l?l:$(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=VC(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(){super.onLayoutEnd();this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}onDataUpdate(){super.onDataUpdate();this.getRegion()._bar_series_position_calculated=!1}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=this._fieldY,s=this._fieldX;this._data.setTransform([{type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?s[0]:i[0],groupBy:this._seriesField,mode:this._spec.sampling}])}}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}}aV.type=cR.bar,aV.builtInTheme={bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}}},aV.mark=iV,aV.transformerConstructor=rV;const oV=()=>{$j(),eV(),KR.registerAnimation("bar",((t,e)=>({appear:QH(t,e),enter:KH(t,!1),exit:qH(t,!1),disappear:{duration:HD.disappear.duration}}))),Pj(),wj(),KR.registerSeries(aV.type,aV)};class lV extends eH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barMinHeight","sampling","samplingFactor","barBackground","stackCornerRadius","useSequentialAnimation"])}transformSpec(t){super.transformSpec(t),$I(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 hV extends Jj{constructor(){super(...arguments),this.transformerConstructor=lV,this.type="bar",this.seriesType=cR.bar}_setModelOption(){this._modelOption.getDimensionInfo=fH,this._modelOption.getDimensionInfoByValue=vH,this._modelOption.getRectByDimensionData=AH}}hV.type="bar",hV.seriesType=cR.bar,hV.transformerConstructor=lV,G(hV,rH);const cV=[10,20],dV=jC.Linear,uV="circle",pV=jC.Ordinal,gV=["circle","square","triangle","diamond","star"],fV=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},mV=Object.assign(Object.assign({},BF),{point:{name:"point",type:"symbol"}});class vV extends YF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class _V extends qF{constructor(){super(...arguments),this.type=cR.scatter,this.transformerConstructor=vV,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=`${yO}_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=`${yO}_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:dV,defaultRange:cV},"size")}getShapeAttribute(t,e){return u(e)?uV:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:pV,defaultRange:gV},"shape")}initMark(){this._symbolMark=this._createMark(_V.mark.point,{groupKey:this._seriesField,isSeriesMark:!0},{morph:NF(this._spec,_V.mark.point.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=KF(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(zF(null===(i=KR.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),jF("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:uV},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(e,{size:this.getSizeAttribute(this._sizeField,this._size)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(e,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),"zero"!==this._invalidType&&this.setMarkStyle(e,{visible:this._getInvalidDefined.bind(this)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{if(!t)return;const e=t.getGraphics();e&&e.length&&e.forEach(((t,e)=>{var i,s;const n=null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],r=this.dataToPosition(n);r&&t&&t.translateTo(r.x,r.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){this.handleZoom(t)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}_V.type=cR.scatter,_V.mark=mV,_V.builtInTheme={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"}}}}},_V.transformerConstructor=vV;const yV=()=>{Sz(),KR.registerAnimation("scatter",((t,e)=>Object.assign({appear:fV(0,e)},VD))),Pj(),wj(),KR.registerSeries(_V.type,_V)};class bV extends eH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["point","size","shape","shapeField","sizeField"])}}class xV extends Jj{constructor(){super(...arguments),this.transformerConstructor=bV,this.type="scatter",this.seriesType=cR.scatter}_setModelOption(){this._modelOption.getDimensionInfo=fH,this._modelOption.getDimensionInfoByValue=vH,this._modelOption.getRectByDimensionData=AH}}xV.type="scatter",xV.seriesType=cR.scatter,xV.transformerConstructor=bV,G(xV,rH);class SV extends $F{constructor(){super(...arguments),this.type=cR.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=`${yO}_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 AV=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[AO]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[GO]=e.nameMap[n]:t[GO]=n})),t.features);class kV extends _F{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 MV extends PD{constructor(){super(...arguments),this.type=MV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}MV.type="path";const TV=()=>{KR.registerMark(MV.type,MV),Jk(),Wk(),KR.registerGraphicComponent("path",Qg)},wV=Object.assign(Object.assign({},BF),{area:{name:"area",type:"path"}});class CV{constructor(t){this.projection=function(t,e){const i=t.toLowerCase();return arguments.length>1?Oa(i,e):La[i]?(Pa[i]||(Pa[i]=Oa(i,La[i])),Pa[i]):null}(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 EV{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(){}}class BV{constructor(){this._lastScale=0}clearZoom(){this._lastScale=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 PV(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside"],zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:EV}:Yy(e)||$y(e)?{start:"pointerdown",move:"pointermove",end:["pointerup","pointerupoutside","pointerleave"],zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:BV}:null}const LV={debounce:xt,throttle:St};class RV{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getCompiler()._gestureController,this._isGestureListener=Yy(this._renderMode)||$y(this._renderMode),PV(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return PV(this._renderMode)[t]}_zoomEventDispatch(t,e,i,s){if(!this._isGestureListener&&!t.event)return;const n=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(n);const{zoomDelta:r,zoomX:a,zoomY:o,path:l}=n;if(!s&&!l.some((t=>t.name&&t.name.includes("region"))))return;if(u(r))return;if(!Ae({x:a,y:o},this._getRegionOrSeriesLayout(e),!1))return;this._clearDragEvent(),this._zoomableTrigger.clearScroll();let h={};i&&(h=i({zoomDelta:r,zoomX:a,zoomY:o},n)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:n.zoomDelta,scaleCenter:{x:n.zoomX,y:n.zoomY}},h),{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(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:mI.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:mI.chart,consume:!1}];l.on(...c,LV[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,LV[a]((t=>{var n;this._zoomEventDispatch(t,e,i,null!==(n=null==s?void 0:s.allowComponentZoom)&&void 0!==n&&n)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||PV(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||PV(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:Ae({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(this._clearDragEvent(),this._zoomableTrigger.clearZoom(),i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:mI.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:mI.chart,consume:!1}];l.on(...c,LV[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,LV[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){PV(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||PV(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(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:mI.chart},(t=>{if(!t.event)return;const{event:n}=t;Ae({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:mI.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||PV(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:mI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||PV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:mI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:mI.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_clearDragEvent(){const t=this._getZoomTriggerEvent("move"),e=this._getZoomTriggerEvent("end");this._handleDragMouseMove&&(this._eventObj.off(t,{level:mI.chart,source:fI.chart},this._handleDragMouseMove),this._handleDragMouseMove=void 0),this._handleDragMouseUp&&(e.forEach((t=>{this._eventObj.off(t,{level:mI.chart,source:fI.chart},this._handleDragMouseUp),this._eventObj.allow(t)})),this._handleDragMouseUp=void 0)}isDragEnable(t){if(this._isGestureListener&&this._gestureController){const t=this._gestureController.cachedEvents;return!t||t.length<2}return!0}_handleDrag(t,e,i){var s,n,r;if(this._clearDragEvent(),this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this.isDragEnable(t.event))return;this._zoomableTrigger.clearZoom(),this._zoomableTrigger.clearScroll();const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,f=d.canvasY;this._handleDragMouseUp=LV[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-f];g=i.canvasX,f=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._clearDragEvent()}),o),this._handleDragMouseMove=LV[a]((t=>{if(!this.isDragEnable(t.event))return;this._clickEnable=!1,c.forEach((t=>{this._eventObj.prevent(t,{handler:this._handleDragMouseUp,level:mI.chart})}));const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o),this._eventObj.on(h,{level:mI.chart,source:fI.chart},this._handleDragMouseMove),c.forEach((t=>{this._eventObj.on(t,{level:mI.chart,source:fI.chart},this._handleDragMouseUp)}))}}function OV(t,e){return`${yO}_${e}_${t}`}class IV extends sj{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.Mark,this._projectionSpec={name:OV(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;const l=p(this._spec.zoomRate)?Math.max(0,this._spec.zoomRate):1,h=Math.max(t.zoomDelta,1e-6);let c=Math.pow(h,l);const d=this._actualScale;return this._actualScale*=c,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,c=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/d):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,c=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/d),this.zoom(c,[t.zoomX,t.zoomY]),{scale:c,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=XR(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?i:1,this._initialScale=this._actualScale,this._longitudeField=this._spec.longitudeField,this._latitudeField=this._spec.latitudeField}created(){super.created(),this._regions=this._option.getRegionsInIndex([this._option.regionIndex]),this.initProjection(),this.coordinateHelper(),this.initEvent(),this._initCenterCache()}dispatchZoom(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){var e,i,s;this.event.on(t.ChartEvent.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:n}=this._spec;if(n){let t=!0,r=!0,a=!1;!0!==n&&(t=null===(e=n.zoom)||void 0===e||e,r=null===(i=n.drag)||void 0===i||i,a=null!==(s=n.blank)&&void 0!==s&&s),t&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),r&&this.initDragEventOfRegions(this._regions,a?null:()=>!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 CV(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===cR.map||e.type===cR.pictogram?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(){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:t,height:e}=this.getLayoutRect(),{translate:i,scale:s,center:n}=this.evaluateProjection([0,0],[t,e]);i&&this._projection.translate(i),s&&this._projection.scale(s),n&&this._projection.center(n),nR(this._regions,(t=>{var e;if(t.type===cR.map||t.type===cR.pictogram){null===(e=t.areaPath)||void 0===e||e.clear();const i=t.getRootMark().getProduct();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Ue})}})),this._actualScale=this._initialScale,super.onLayoutEnd()}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type!==cR.map&&e.type!==cR.pictogram||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[GO],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit","zoomRate"].some((i=>!U(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}IV.type=r.geoCoordinate,G(IV,RV);const DV=()=>{KR.registerComponent(IV.type,IV)};class FV extends YF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class zV extends SV{constructor(){super(...arguments),this.type=cR.map,this.transformerConstructor=FV,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 !`),AI.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var e,i;super.initData(),xI(this._dataSet,"copyDataView",EI),xI(this._dataSet,"map",AV),xI(this._dataSet,"lookup",cF);const s=AI.get(this.map);s||null===(e=this._option)||void 0===e||e.onError("no valid map data found!");const n=new Ba(this._dataSet,{name:`map_${this.id}_data`});n.parse([s],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:t.TransformLevel.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:GO,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(i=this._data)||void 0===i||i.getDataView().target.addListener("change",n.reRunAllTransform),this._mapViewData=new TD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(zV.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0},{morph:NF(this._spec,zV.mark.area.name),morphElementKey:this.getDimensionField()[0]}),this._pathMark.setData(this._mapViewData)}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:MO])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:MO]):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(zF(null===(t=KR.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),jF("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new kV(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[AO]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[AO],{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;const{scale:i,scaleCenter:s}=t;if(1===i)return;const n=this.getRootMark().getProduct();n&&(n.attribute.postMatrix||n.setAttributes({postMatrix:new Ue}),n.scale(i,i,s));const r=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();r&&r.renderInner()}handlePan(t){var e;const{delta:i}=t;if(0===i[0]&&0===i[1])return;const s=this.getRootMark().getProduct();s&&(s.attribute.postMatrix||s.setAttributes({postMatrix:new Ue}),s.translate(i[0],i[1]));const n=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent();n&&n.renderInner()}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 AO}getActiveMarks(){return[this._pathMark]}}zV.type=cR.map,zV.mark=wV,zV.builtInTheme={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"}}}}},zV.transformerConstructor=FV;const jV=`${yO}_waterfall_default_seriesField`,HV=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n,calculationMode:r}=e,a=[],{dimensionValues:o,dimensionData:l}=n().latestData;let h=Array.from(o[i]);"decrease"===r&&(h=h.reverse());let c={start:0,end:0,positive:0,negative:0,lastIndex:null};return h.forEach(((t,i)=>{const n={start:c.end,end:c.end,lastIndex:c.lastIndex,lastEnd:c.end,index:t,isTotal:!1,positive:c.end,negative:c.end},r=!0===e.stackInverse?l[t].reverse():l[t];if(null==r||r.forEach(((t,e)=>{e===r.length-1?t[DO]=!0:delete t[DO]})),r.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===h.length-1)return!0;return!1};if(r.some((t=>o(t))))return c=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,e)=>{l(t)?g.push(Object.assign(Object.assign({},t),{_vchart_waterfall_waterfall_temp:e})):p.push(t)})),g.length===t.length){const l=VV([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 f=g[0];let{start:m,end:v}=NV(f,i,s,n,u);i.start=m,i.end=v;let _=m,y=m,b=v-m;const x=p.reduce(((t,e)=>se(t,+e[h])),b);return g.forEach((t=>{const e={[c]:m,[d]:v,[h]:x};p.splice(t._vchart_waterfall_waterfall_temp,0,e)})),p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=ie(_,e)):(t[c]=+y,y=ie(y,e)),t[d]=ie(t[c],e),m=ie(m,e),b=se(b,e)})),g.forEach((e=>{const i=e._vchart_waterfall_waterfall_temp;e=p[i];const s=t[i];s[c]=e[c],s[d]=e[d],s[h]=e[h]})),Object.assign(Object.assign({},i),{lastIndex:e})}(r,t,n,a,c,h,i,e,o),void a.push(n)}c=VV(r,t,n,a,c,h,i,e),a.push(n)})),a};function VV(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}=NV(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=ie(i.positive,e)):(t[h]=+i.negative,i.negative=ie(i.negative,e)),t[c]=ie(t[h],e),i.end=ie(i.end,e)}i.isTotal=e,(u(p)||p===jV)&&(t[jV]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function NV(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?Hy("total.collectCountField error"):n=e[a].start;o<0?Hy("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=ie(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 UV=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r,calculationMode:a}=e,o={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>ie(t,+e[s])),0)};return r&&(o[r]="total"),"decrease"===a?t.unshift(o):t.push(o),t},WV={type:"fadeIn"},GV={type:"growCenterIn"};function YV(t,e){switch(e){case"fadeIn":return WV;case"scaleIn":return GV;default:return KH(t,!1)}}class $V extends PD{constructor(){super(...arguments),this.type=$V.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}_transformGraphicAttributes(t,i,s){const n=super._transformGraphicAttributes(t,i,s),{x:r,x1:a,y:o,y1:l}=n,h=e(n,["x","x1","y","y1"]);return Object.assign(Object.assign({},h),{points:[{x:r,y:o},{x:a,y:l}]})}_createGraphic(t={}){return Pg(t)}}$V.type="rule";const XV=()=>{KR.registerMark($V.type,$V),Jk(),Nk(),KR.registerGraphicComponent("line",Pg)},KV=Object.assign(Object.assign({},iV),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),qV=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:ZV(t.map((t=>t.latestData)).flat(),e.fields,i)}};function ZV(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)=>ZV(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class JV{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 Ba(e instanceof Ea?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),xI(e,"dimensionTree",qV),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 QV extends rV{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const tN={rect:aN,symbol:nN,arc:lN,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{clampForce:!1,avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=nN(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1,e.overlap.clampForce=!1);return e},stackLabel:hN,line:cN,area:cN,rect3d:aN,arc3d:lN,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}},boxPlot:function(t){return{customLayoutFunc:(e,i,s)=>{for(let n=0;n"median"===t.name));if(-1!==l){const e=o.getSubGraphic()[l].AABBBounds;"horizontal"===t.series.direction?r.setAttributes({x:e.x2+r.AABBBounds.width()/2,y:(e.y1+e.y2)/2}):r.setAttributes({x:(e.x1+e.x2)/2,y:e.y2+r.AABBBounds.height()/2})}else{const t=o.AABBBounds;r.setAttributes({x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2})}}return i}}}};function eN(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=tN[t])&&void 0!==i?i:tN.point;return e.series.type===cR.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=sN(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;_(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!_(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:dN(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function iN(t,e,i,s){var n,r;const{labelMark:a,series:o}=t,l=o.getMeasureField()[0],h=a.getAttributesOfState(e);if("text"in h||(h.text=null!==(n=h.text)&&void 0!==n?n:e[l]),"textType"in h||(h.textType=null!==(r=t.labelSpec.textType)&&void 0!==r?r:"text"),h.data=e,o.type!==cR.sankey){const{formatFunc:t,args:n}=lF(i,s,h.text,e);t&&(h._originText=h.text,h.text=t(...n,{series:o}))}return h}function sN(t){return d(t)?e=>t(e.data):t}function nN(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=sN(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:rN(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function rN(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function aN(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=sN(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;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:oN(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function oN(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 lN(t){var e;const{labelSpec:i}=t,s=null!==(e=sN(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 hN(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=iN(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),Mg(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 cN(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}))):[{index:0,[MO]:a.getSeriesKeys()[0]}];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l,overlap:{avoidBaseMark:!1,clampForce:!1}}}function dN(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class uN extends aV{constructor(){super(...arguments),this.type=cR.waterfall,this.transformerConstructor=QV,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null,this._reStackTotal=()=>{const t=this.getStackData(),e=this.getStackValueField();t&&ZO(t,e)}}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 JV(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=jV)}getSeriesKeys(){return this._seriesField===jV?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t,e,i;super.initData(),xI(this._dataSet,"waterfallFillTotal",UV),xI(this._dataSet,"waterfall",HV),(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,calculationMode:null!==(e=this._spec.calculationMode)&&void 0!==e?e:"increase",stackInverse:this.getRegion().getStackInverse()}},!1));const s=BI(this.getViewData(),this._dataSet,{name:`${yO}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",s.reRunAllTransform),this._totalData=new TD(this._option,s),s.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:CO,endAs:EO,total:this._spec.total,calculationMode:null!==(i=this._spec.calculationMode)&&void 0!==i?i:"increase",groupData:()=>this.getGroups().groupData,stackInverse:this.getRegion().getStackInverse()}},!1),s.target.addListener("change",this._reStackTotal)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}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=KF(this);this._barMark.setAnimationConfig(zF(null===(i=KR.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),jF("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(zF(null===(s=KR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),jF("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(){super.initMark();const t=this._createMark(uN.mark.leaderLine,{key:"index"});t&&(this._leaderLineMark=t,t.setData(this._totalData))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setData(this._totalData),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:se(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:se(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return hN(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?TR(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):TR(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle();const e="decrease"===this._spec.calculationMode;this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),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",e?0:1):0,y1:t=>this.totalPositionY(t,"index",e?1:0)},"normal",t.AttributeLevel.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>this.isVisibleLeaderLine(t),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",e?0:1):0,x1:t=>this.totalPositionX(t,"index",e?1:0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",t.AttributeLevel.Series))}isVisibleLeaderLine(t){return!u(t.lastIndex)&&wR([t.lastEnd,t[t.isTotal?"end":"start"]],"horizontal"===this.direction?this._xAxisHelper.getScale(0):this._yAxisHelper.getScale(0))}}uN.type=cR.waterfall,uN.mark=KV,uN.builtInTheme={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}}}},uN.transformerConstructor=QV;const pN=()=>{XV(),eV(),KR.registerAnimation("waterfall",((t,e)=>({appear:YV(t,e),enter:KH(t,!1),exit:qH(t,!1),disappear:{duration:HD.disappear.duration}}))),WD(),Pj(),wj(),KR.registerSeries(uN.type,uN)},gN=`${yO}_BOX_PLOT_OUTLIER_VALUE`;var fN;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(fN||(fN={}));const mN=(t,e)=>{const i=[],{outliersField:s,dimensionField:n,seriesField:r}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];y(e)||(e=[e]),i.push(...e.map((e=>{const i={[gN]:e};return n.forEach((e=>{i[e]=t[e]})),p(r)&&(i[r]=t[r]),i})))})),i};class vN extends _F{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===fN.OUTLIER)return this.series.getOutliersField();if(t===fN.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case fN.MIN:return this.series.getMinField();case fN.MAX:return this.series.getMaxField();case fN.MEDIAN:return this.series.getMedianField();case fN.Q1:return this.series.getQ1Field();case fN.Q3:return this.series.getQ3Field();case fN.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===fN.OUTLIER)return e[gN];if(t===fN.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case fN.MIN:return e[this.series.getMinField()];case fN.MAX:return e[this.series.getMaxField()];case fN.MEDIAN:return e[this.series.getMedianField()];case fN.Q1:return e[this.series.getQ1Field()];case fN.Q3:return e[this.series.getQ3Field()];case fN.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,i;const s=this.series.getOutliersStyle();return null!==(e=null==s?void 0:s.fill)&&void 0!==e?e:null===(i=this.series.getMarkInName("outlier"))||void 0===i?void 0:i.getAttribute("fill",t)},this.isOutlierMark=t=>p(t[gN])}getDefaultContentList(t){return[{key:this.getContentKey(fN.OUTLIER),value:this.getContentValue(fN.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(fN.MAX),value:this.getContentValue(fN.MAX)},{key:this.getContentKey(fN.Q3),value:this.getContentValue(fN.Q3)},{key:this.getContentKey(fN.MEDIAN),value:this.getContentValue(fN.MEDIAN)},{key:this.getContentKey(fN.Q1),value:this.getContentValue(fN.Q1)},{key:this.getContentKey(fN.MIN),value:this.getContentValue(fN.MIN)},{key:this.getContentKey(fN.SERIES_FIELD),value:this.getContentValue(fN.SERIES_FIELD)}]}}class _N extends PD{constructor(){super(...arguments),this._setStateOfGraphic=t=>{t.clearStates(),t.stateProxy=null,t.context.diffState!==tD.enter&&t.context.diffState!==tD.update||(t.glyphStateProxy=(e,i)=>{var s;const n={attributes:Object.assign(Object.assign({},this._runEncoderOfGraphic(null===(s=this._encoderOfState)||void 0===s?void 0:s[e],t)),t.runtimeStateCache?t.runtimeStateCache[e]:null)};return t.glyphStates?t.glyphStates[e]||(t.glyphStates[e]=n):t.glyphStates={[e]:n},n},t.useStates(t.context.states))}}getSubMarks(){return this._subMarks}setGlyphConfig(t){this._glyphConfig=t}getGlyphConfig(){return this._glyphConfig}getPositionChannels(){return this._positionChannels}_onGlyphAttributeUpdate(t){return e=>{var i,s;const n=this.getPositionChannels();let r=n&&this._positionEncoder&&Object.keys(e).some((t=>n.includes(t)))?this._positionEncoder(e,null===(s=null===(i=null==t?void 0:t.context)||void 0===i?void 0:i.data)||void 0===s?void 0:s[0],t):null;return this._channelEncoder&&Object.keys(this._channelEncoder).forEach((t=>{if(t in e){const i=this._channelEncoder[t](e[t]);r=r?j(r,i):i}})),r&&t.getSubGraphic().forEach((t=>{t&&r[t.name]&&t.setAttributes(r[t.name])})),e}}_createGraphic(t={}){const e=Fg(t);e.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(e);const i=this._subMarks;if(i){const t=[];Object.keys(i).forEach((e=>{const s=KR.createGraphicComponent(i[e].type,Object.assign({},i[e].defaultAttributes));s&&(t.push(s),s.name=e,s.onBeforeAttributeUpdate=t=>t)})),e.setSubGraphic(t)}return e.onBeforeAttributeUpdate(t),e}_runProgressiveEncoder(t){this._runEncoder(t)}}const yN=()=>{KR.registerGraphicComponent("glyph",Fg),Jk(),Dk()},bN=["x","y","minMaxWidth","minMaxHeight","q1q3Width","q1q3Height","q1","q3","min","max","median","angle"],xN=["x","y","boxWidth","boxHeight","ruleWidth","ruleHeight","q1","q3","min","max","median","angle"];class SN extends _N{constructor(){super(...arguments),this.type=SN.type}_isHorizontal(){return this._glyphConfig&&"horizontal"===this._glyphConfig.direction}setGlyphConfig(t){super.setGlyphConfig(t),"bar"===t.shaftShape?(this._subMarks={minMaxBox:{type:"rect",defaultAttributes:{lineWidth:0}},q1q3Box:{type:"rect",defaultAttributes:{lineWidth:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=bN,this._channelEncoder={minMaxFillOpacity:t=>({minMaxBox:{fillOpacity:t}}),lineWidth:t=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}),stroke:t=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,minMaxWidth:a=i.attribute.minMaxWidth,minMaxHeight:o=i.attribute.minMaxHeight,q1q3Width:l=i.attribute.q1q3Width,q1q3Height:h=i.attribute.q1q3Height,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.minMaxBox={x:u,x1:p,y:r-o/2,y1:r+o/2},v.q1q3Box={x:c,x1:d,y:r-h/2,y1:r+h/2},v.median={points:[{x:g,y:r-h/2},{x:g,y:r+h/2}]}):(v.minMaxBox={y:u,y1:p,x:n-a/2,x1:n+a/2},v.q1q3Box={y:c,y1:d,x:n-l/2,x1:n+l/2},v.median={points:[{y:g,x:n-l/2},{y:g,x:n+l/2}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v}):(this._subMarks={shaft:{type:"line",defaultAttributes:{x:0,y:0}},box:{type:"rect"},max:{type:"line",defaultAttributes:{x:0,y:0}},min:{type:"line",defaultAttributes:{x:0,y:0}},median:{type:"line",defaultAttributes:{x:0,y:0}}},this._positionChannels=xN,this._channelEncoder={boxStroke:t=>({box:{stroke:t}}),medianStroke:t=>({median:{stroke:t}}),boxCornerRadius:t=>({box:{cornerRadius:t}})},this._positionEncoder=(t,e,i)=>{var s;const{x:n=i.attribute.x,y:r=i.attribute.y,boxWidth:a=i.attribute.boxWidth,boxHeight:o=i.attribute.boxHeight,ruleWidth:l=i.attribute.ruleWidth,ruleHeight:h=i.attribute.ruleHeight,q1:c=i.attribute.q1,q3:d=i.attribute.q3,min:u=i.attribute.min,max:p=i.attribute.max,median:g=i.attribute.median,angle:f}=t,m=this._isHorizontal(),v={};if(m?(v.box={x:c,x1:d,y:r-o/2,y1:r+o/2},v.median={points:[{x:g,y:r-o/2},{x:g,y:r+o/2}]},v.shaft={points:[{x:u,y:r},{x:p,y:r}]},v.max={points:[{x:p,y:r-h/2},{x:p,y:r+h/2}]},v.min={points:[{x:u,y:r-h/2},{x:u,y:r+h/2}]}):(v.box={x:n-a/2,x1:n+a/2,y:c,y1:d},v.median={points:[{x:n-a/2,y:g},{x:n+a/2,y:g}]},v.max={points:[{x:n-l/2,y:p},{x:n+l/2,y:p}]},v.min={points:[{x:n-l/2,y:u},{x:n+l/2,y:u}]},v.shaft={points:[{x:n,y:u},{x:n,y:p}]}),k(f)){const e=null!==(s=t.anchor)&&void 0!==s?s:m?[(u+p)/2,r]:[n,(u+p)/2];Object.keys(v).forEach((t=>{v[t].angle=f,v[t].anchor=e}))}return v})}setDataLabelType(){return"symbol"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}}SN.type="boxPlot";const AN=Object.assign(Object.assign({},BF),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}}),kN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.from.min=o,f.to.min=c),k(d)&&(f.from.max=o,f.to.max=d),k(u)&&(f.from.q1=o,f.to.q1=u),k(p)&&(f.from.q3=o,f.to.q3=p),k(g)&&(f.from.median=o,f.to.median=g),f},MN=t=>(e,i,s)=>{var n;const r=e.getFinalAttribute(),a=null!==(n=r.direction)&&void 0!==n?n:"vertical",o=t(e,a,i);if(!k(o))return{};const{x:l,y:h,min:c,max:d,q1:u,q3:p,median:g}=r,f={from:{x:l,y:h},to:{x:l,y:h}};return k(c)&&(f.to.min=o,f.from.min=c),k(d)&&(f.to.max=o,f.from.max=d),k(u)&&(f.to.q1=o,f.from.q1=u),k(p)&&(f.to.q3=o,f.from.q3=p),k(g)&&(f.to.median=o,f.from.median=g),f},TN=(t,e)=>t.getSubGraphic().find((t=>t.name===e)),wN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_,y,b,x,S,A,M;if(i&&k(i.center))return i.center;let T,w,C,E,B;if("horizontal"===e){T=null===(r=null===(n=(null===(s=TN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x,w=null===(h=null===(l=null===(o=null===(a=TN(t,"max"))||void 0===a?void 0:a.attribute)||void 0===o?void 0:o.points)||void 0===l?void 0:l[0])||void 0===h?void 0:h.x,C=null===(p=null===(u=null===(d=null===(c=TN(t,"min"))||void 0===c?void 0:c.attribute)||void 0===d?void 0:d.points)||void 0===u?void 0:u[0])||void 0===p?void 0:p.x;const e=TN(t,"box").attribute.width,i=TN(t,"box").attribute.x;E=i,B=i+e}else{T=null===(m=null===(f=(null===(g=TN(t,"median"))||void 0===g?void 0:g.attribute).points)||void 0===f?void 0:f[0])||void 0===m?void 0:m.y,w=null===(b=null===(y=null===(_=null===(v=TN(t,"max"))||void 0===v?void 0:v.attribute)||void 0===_?void 0:_.points)||void 0===y?void 0:y[0])||void 0===b?void 0:b.y,C=null===(M=null===(A=null===(S=null===(x=TN(t,"min"))||void 0===x?void 0:x.attribute)||void 0===S?void 0:S.points)||void 0===A?void 0:A[0])||void 0===M?void 0:M.y;const e=TN(t,"box").attribute.height,i=TN(t,"box").attribute.y;E=i,B=i+e}return k(T)?T:k(E)&&k(B)?(E+B)/2:k(w)&&k(C)?(w+C)/2:k(C)?C:k(w)?w:NaN},CN=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g,f,m;if(k(null==i?void 0:i.center))return i.center;let v,_,y,b,x;if("horizontal"===e){v=null===(r=null===(n=(null===(s=TN(t,"median"))||void 0===s?void 0:s.attribute).points)||void 0===n?void 0:n[0])||void 0===r?void 0:r.x;const e=(null===(a=TN(t,"minMaxBox"))||void 0===a?void 0:a.attribute).width,i=null===(o=TN(t,"minMaxBox"))||void 0===o?void 0:o.attribute.x;y=i,_=i+e;const c=(null===(l=TN(t,"q1q3Box"))||void 0===l?void 0:l.attribute).width,d=null===(h=TN(t,"q1q3Box"))||void 0===h?void 0:h.attribute.x;b=d,x=d+c}else{v=null===(u=null===(d=(null===(c=TN(t,"median"))||void 0===c?void 0:c.attribute).points)||void 0===d?void 0:d[0])||void 0===u?void 0:u.y;const e=(null===(p=TN(t,"minMaxBox"))||void 0===p?void 0:p.attribute).height,i=null===(g=TN(t,"minMaxBox"))||void 0===g?void 0:g.attribute.y;y=i,_=i+e;const s=(null===(f=TN(t,"q1q3Box"))||void 0===f?void 0:f.attribute).height,n=null===(m=TN(t,"q1q3Box"))||void 0===m?void 0:m.attribute.y;b=n,x=n+s}return k(v)?v:k(b)&&k(x)?(b+x)/2:k(_)&&k(y)?(_+y)/2:k(y)?y:k(_)?_:NaN};class EN extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){super.onBind();const t=this.target.getFinalAttribute();t&&this.target.setAttributes(t);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return kN(wN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class BN extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}onBind(){var t;(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:e,to:i}=this.computeAttribute();this.propKeys=Object.keys(i).filter((t=>null!=i[t])),this.animate.reSyncProps(),this.from=e,this.to=i,this.target.setAttributes(this.from)}computeAttribute(){return MN(wN)(this.target,this.params,this.params.options)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class PN extends EN{computeAttribute(){return kN(CN)(this.target,this.params,this.params.options)}}class LN extends BN{computeAttribute(){return MN(CN)(this.target,this.params,this.params.options)}}class RN extends YF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"boxPlot")}}class ON extends qF{constructor(){super(...arguments),this.type=cR.boxPlot,this.transformerConstructor=RN,this._bandPosition=0}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,r,a;super.setAttrFromSpec();const o=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=o.lineWidth)&&void 0!==i?i:2,this._boxWidth=o.boxWidth,this._shaftShape=null!==(s=o.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=o.shaftWidth,this._boxFillColor=o.boxFill,this._strokeColor=o.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=o.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=null!==(r=this._spec.outliersStyle)&&void 0!==r?r:null===(a=this._spec.outlier)||void 0===a?void 0:a.style}initMark(){this._boxPlotMark=this._createMark(ON.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0}),this._outliersField&&(this._outlierMark=this._createMark(ON.mark.outlier,{key:AO,groupKey:this._seriesField}),this._outlierMark.setData(this._outlierData))}initMarkStyle(){var e,i,s,n,r,a;const o=this._boxPlotMark;if(o){const s={lineWidth:this._lineWidth,fill:null!==(e=this._boxFillColor)&&void 0!==e?e:"line"!==this._shaftShape?this.getColorAttribute():"#FFF",minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(i=this._strokeColor)&&void 0!==i?i:"line"!==this._shaftShape?"#000":this.getColorAttribute()};o.setGlyphConfig({direction:this._direction,shaftShape:this._shaftShape});const n="horizontal"===this._direction?{y:t=>this._getPosition(this.direction,t),boxHeight:()=>{var t;return FR(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleHeight:()=>{var t;return FR(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Height:()=>{var t;return FR(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxHeight:()=>{var t;return FR(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}}:{x:t=>this._getPosition(this.direction,t),boxWidth:()=>{var t;return FR(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},ruleWidth:()=>{var t;return FR(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},q1q3Width:()=>{var t;return FR(null!==(t=this._boxWidth)&&void 0!==t?t:"100%",this._getMarkWidth())},minMaxWidth:()=>{var t;return FR(null!==(t=this._shaftWidth)&&void 0!==t?t:"100%",this._getMarkWidth())}};this.setMarkStyle(o,s,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(o,n,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Built_In)}const l=this._outlierMark;l&&this.setMarkStyle(l,{fill:null!==(r=null!==(n=null===(s=this._outliersStyle)||void 0===s?void 0:s.fill)&&void 0!==n?n:this._boxFillColor)&&void 0!==r?r:this.getColorAttribute(),stroke:this.getColorAttribute(),size:S(null===(a=this._outliersStyle)||void 0===a?void 0:a.size)?this._outliersStyle.size:10},t.STATE_VALUE_ENUM.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=>TR(i(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),r),q1:t=>TR(i(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),r),median:t=>TR(i(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),r),q3:t=>TR(i(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),r),max:t=>TR(i(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),r)},t.STATE_VALUE_ENUM.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:t=>this._getPosition(this.direction,t),x:t=>TR(e(this.getDatumPositionValues(t,gN),{bandPosition:this._bandPosition}),s)}:{x:t=>this._getPosition(this.direction,t),y:t=>TR(e(this.getDatumPositionValues(t,gN),{bandPosition:this._bandPosition}),s)};this.setMarkStyle(r,a,t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMedianField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initData(){if(super.initData(),!this._data)return;xI(this._dataSet,"foldOutlierData",mN),xI(this._dataSet,"addVChartProperty",dF);const t=new Ba(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${yO}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField,seriesField:this._seriesField}}),t.transform({type:"addVChartProperty",options:{beforeCall:TF.bind(this),call:wF}},!1),this._outlierData=new TD(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierData)||void 0===t||t.compile()}viewDataUpdate(t){var e;super.viewDataUpdate(t),null===(e=this._outlierData)||void 0===e||e.updateData()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){var t;if(this._autoBoxWidth)return this._autoBoxWidth;const e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,i=this._groups?this._groups.fields.length:1,s=null===(t=e.getBandwidth)||void 0===t?void 0:t.call(e,i-1);let n=s;return p(this._spec.boxWidth)&&(n=FR(this._spec.boxWidth,s)),p(this._spec.boxMinWidth)&&(n=Math.max(n,FR(this._spec.boxMinWidth,s))),p(this._spec.boxMaxWidth)&&(n=Math.min(n,FR(this._spec.boxMaxWidth,s))),this._autoBoxWidth=n,this._autoBoxWidth}_getPosition(t,e){var i,s,n,r;let a,o,l;"horizontal"===t?(a=this.getYAxisHelper(),o="boxHeight",l=this.dataToPositionY.bind(this)):(a=this.getXAxisHelper(),o="boxWidth",l=this.dataToPositionX.bind(this));const h=a.getScale(0),c=this._groups?this._groups.fields.length:1,d=null===(i=a.getBandwidth)||void 0===i?void 0:i.call(a,c-1),u=this._boxPlotMark.getAttribute(o,e);if(c>1&&p(this._spec.boxGapInGroup)){const t=this._groups.fields,i=Y(this._spec.boxGapInGroup);let o=0,l=0;for(let h=t.length-1;h>=1;h--){const c=t[h],p=null!==(n=null===(s=a.getScale(h))||void 0===s?void 0:s.domain())&&void 0!==n?n:[],g=p.length,f=FR(null!==(r=i[h-1])&&void 0!==r?r:$(i),d),m=p.indexOf(e[c]);h===t.length-1?(o+=g*u+(g-1)*f,l+=m*(u+f)):(l+=m*(o+f),o+=o+(g-1)*f)}return h.scale(e[t[0]])+a.getBandwidth(0)/2-o/2+l+u/2}const g=VC(h.type||"band");return l(e)+.5*d+(g?-d/2:0)}onLayoutEnd(){super.onLayoutEnd(),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=j({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="bar"===this._shaftShape?"barBoxplotScaleIn":"boxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="bar"===this._shaftShape?"barBoxplotScaleOut":"boxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=KF(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=KR.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(jF("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(zF(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(zF(null===(a=KR.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new vN(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}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}ON.type=cR.boxPlot,ON.builtInTheme={boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}}},ON.mark=AN,ON.transformerConstructor=RN;const IN=()=>{yN(),Nk(),Xk(),KR.registerGraphicComponent("line",(t=>Pg(t))),KR.registerGraphicComponent("rect",(t=>Ig(t))),KR.registerMark(SN.type,SN),Sz(),UD(),Pj(),wj(),pw.registerBuiltInAnimate("boxplotScaleIn",EN),pw.registerBuiltInAnimate("boxplotScaleOut",BN),pw.registerBuiltInAnimate("barBoxplotScaleIn",PN),pw.registerBuiltInAnimate("barBoxplotScaleOut",LN),KR.registerSeries(ON.type,ON)};class DN extends PD{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=DN.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t){super.initStyleWithSpec(t),t.textType&&(this._textType=t.textType)}_transformGraphicAttributes(t,e,i){const s=super._transformGraphicAttributes(t,e,i),{text:n}=s;return g(n)&&p(n.text)&&("rich"===this._textType||"rich"===n.type)&&(s.textConfig=n.text),s}_createGraphic(t={}){const{text:e}=t;return"rich"===this._textType||"rich"===(null==e?void 0:e.type)?qg(t):Mg(t)}}DN.type="text";const FN=()=>{KR.registerMark(DN.type,DN),Jk(),iM(),qk(),KR.registerGraphicComponent("text",Mg),KR.registerGraphicComponent("richtext",qg)};class zN extends _F{constructor(){super(...arguments),this._getMeasureData=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]]}}const jN=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),HN={type:"fadeIn"},VN=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function NN(t,e){return"fadeIn"===e?HN:jN(t)}const UN=Object.assign(Object.assign({},iV),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class WN extends rV{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 GN extends aV{constructor(){super(...arguments),this.type=cR.rangeColumn,this._barMarkType="rect",this._barName=cR.bar,this.transformerConstructor=WN}initMark(){var t,e,i,s,n,r,a,o;this._initBarBackgroundMark();const l=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(GN.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0},{morph:NF(this._spec,GN.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(e=this._spec.label)||void 0===e?void 0:e.visible)&&"bothEnd"===l&&(!1!==(null===(s=null===(i=this._spec.label)||void 0===i?void 0:i.minLabel)||void 0===s?void 0:s.visible)&&(this._minLabelMark=this._createMark(GN.mark.minLabel,{markSpec:null===(n=this._spec.label)||void 0===n?void 0:n.minLabel})),!1!==(null===(a=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel)||void 0===a?void 0:a.visible)&&(this._maxLabelMark=this._createMark(GN.mark.maxLabel,{markSpec:null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel})))}initMarkStyle(){var t,e;super.initMarkStyle(),this._initLabelMarkPos(this._minLabelMark,null===(t=this._spec.label)||void 0===t?void 0:t.minLabel,0,"end"),this._initLabelMarkPos(this._maxLabelMark,null===(e=this._spec.label)||void 0===e?void 0:e.maxLabel,1,"start")}_initLabelMarkPos(e,i,s,n){var r,a,o,l;if(e){this.setMarkStyle(e,{fill:null!==(a=null===(r=null==i?void 0:i.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[s]]:t[this._spec.yField[s]];return(null==i?void 0:i.formatMethod)?i.formatMethod(e,t):e}});!function(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)}(this,e,null!==(o=null==i?void 0:i.position)&&void 0!==o?o:n,null!==(l=null==i?void 0:i.offset)&&void 0!==l?l:"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=KF(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(zF(null===(i=KR.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),jF("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(zF(null===(s=KR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),jF("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(zF(null===(n=KR.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),jF("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new zN(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)}}GN.type=cR.rangeColumn,GN.mark=UN,GN.builtInTheme={rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}}},GN.transformerConstructor=WN;const YN=()=>{eV(),FN(),KR.registerAnimation("rangeColumn",((t,e)=>({appear:NN(t,e),enter:jN(t),exit:VN(t),disappear:{duration:HD.disappear.duration}}))),WD(),Pj(),wj(),KR.registerSeries(GN.type,GN)};var $N,XN;!function(t){t.middle="middle",t.start="start",t.end="end",t.bothEnd="bothEnd"}($N||($N={})),function(t){t.middle="middle",t.start="start",t.end="end"}(XN||(XN={}));class KN extends _F{constructor(){super(...arguments),this._getMeasureData=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]]}}const qN=Object.assign({},NH);class ZN extends GH{constructor(){super(...arguments),this.type=cR.rangeArea}initMark(){this._areaMark=this._createMark(ZN.mark.area,{groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this.getDimensionField()[0]})}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 KN(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}ZN.type=cR.rangeArea,ZN.mark=qN;class JN extends $F{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=Zz,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.radiusAxisHelper.dataToPosition(Y(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(Y(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}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:[]};VC(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:[]};VC(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)&&XF(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}}function QN(t){return qy(t)?Number.parseFloat(t):0}const tU=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&eU(m,u,c))return[];const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=ge(e+a/2)};let _=0,y=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,M=0;const T=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))}(x);if(m.forEach(((t,e)=>{const i=t[Vz],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/M;A=p,m.forEach((e=>{const i=e[r]===f?f:e[Vz]*t;v(e,A,i),A+=i}))}if(0!==_&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},eU=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===QN(t[e])))||!i&&0===t.reduce(((t,i)=>t+QN(i[e])),0)));function iU(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const sU=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:iU(t,!0,OI.appear)}),nU={type:"fadeIn"},rU=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:iU(t,!0,OI.enter)}),aU=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:iU(t,!0,OI.exit)});function oU(t,e){if(!1===e)return{};switch(e){case"fadeIn":return nU;case"growRadius":return sU(Object.assign(Object.assign({},t),{growField:"radius"}));default:return sU(Object.assign(Object.assign({},t),{growField:"angle"}))}}class lU extends PD{constructor(t,e){super(t,e),this.type=hU.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s)=>{var n;return s+(null!==(n=this.getAttribute("radiusOffset",e,i))&&void 0!==n?n:0)},this.computeCenter=(t,e,i="normal",s)=>he({x:0,y:0},this.getAttribute("centerOffset",e,i),e[Yz])[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 hU extends lU{constructor(){super(...arguments),this.type=hU.type}}hU.type="arc";const cU=()=>{Jk(),Bk(),xB("arc",LB),pw.registerBuiltInAnimate("growRadiusIn",yC),pw.registerBuiltInAnimate("growRadiusOut",bC),pw.registerBuiltInAnimate("growAngleIn",tC),pw.registerBuiltInAnimate("growAngleOut",eC),KR.registerGraphicComponent("arc",af),KR.registerMark(hU.type,hU)},dU=Object.assign(Object.assign({},BF),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});class uU extends YF{_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=XR({},this._theme,i,t);const n=(t,e)=>XR({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);y(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const pU=`${yO}_LABEL_VISIBLE`;class gU extends JN{constructor(){super(...arguments),this.transformerConstructor=uU,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:LR(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:LR(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=Kz,this._endAngle=qz,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[Yz];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return he(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;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 a=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)?ae(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?ae(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?ae(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=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;xI(this._dataSet,"pie",tU),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?ae(this._spec.minAngle):0,asStartAngle:Uz,asEndAngle:Wz,asRatio:Nz,asMiddleAngle:Yz,asRadian:Xz,asQuadrant:$z,asK:Gz,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new Ba(this._dataSet,{name:`${yO}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new TD(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){this._pieMark=this._createMark(Object.assign(Object.assign({},gU.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:kO,groupKey:this._seriesField,isSeriesMark:!0},{morph:NF(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}),this._data.addRelatedMark(this._emptyArcMark))}startAngleScale(t){return oR(Uz)(t)}endAngleScale(t){return oR(Wz)(t)}_computeLayoutRadius(){return Jz((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const e={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:CR(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:CR(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},i=this._pieMark;i&&this.setMarkStyle(i,e,"normal",t.AttributeLevel.Series);const s=this._emptyArcMark;s&&this.setMarkStyle(s,Object.assign(Object.assign({},e),{visible:()=>{const t=this.getViewData().latestData;return!t||!t.length}}),"normal",t.AttributeLevel.Series)}getInteractionTriggers(){return this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),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)}"emptyCircle"===e.name&&this.setMarkStyle(e,this.generateRadiusStyle(i.style),"normal",t.AttributeLevel.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:oR(pU).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(){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd()}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(t.ChartEvent.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[Yz];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return he(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s,n;if(i===OI.appear)return this._startAngle;if(i===OI.disappear)return this._endAngle;const r=[OI.disappear,OI.exit],a=this._pieMark.getGraphics(),o=t,l=null==o?void 0:o[AO];if(void 0===a.find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[AO]){var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[AO])>l})))return this._endAngle;const h=[...a].reverse().find((t=>{var e;return(null===(e=t.context.data[0])||void 0===e?void 0:e[AO])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+he({x:0,y:0},a,e[Yz]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+he({x:0,y:0},a,e[Yz]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+he({x:0,y:0},a,e[Yz]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+he({x:0,y:0},a,e[Yz]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=zF(null===(i=KR.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}gU.transformerConstructor=uU,gU.mark=dU,gU.builtInTheme={pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}}};class fU extends gU{constructor(){super(...arguments),this.type=cR.pie}}fU.type=cR.pie;const mU=()=>{cU(),KR.registerAnimation("pie",((t,e)=>({appear:oU(t,e),enter:rU(t),exit:aU(t),disappear:{duration:HD.disappear.duration}}))),KR.registerAnimation("emptyCircle",((t,e)=>({appear:oU(t,e)}))),KR.registerSeries(fU.type,fU)};function vU(t){return"angle"===t?"growAngleIn":"growRadiusIn"}const _U=t=>({type:vU(t.growField),options:{overall:!0}}),yU={type:"fadeIn"},bU=t=>({type:vU(t.growField)}),xU=t=>{return{type:(e=t.growField,"angle"===e?"growAngleOut":"growRadiusOut")};var e};function SU(t,e){if(!1===e)return{};switch(e){case"fadeIn":return yU;case"growAngle":return _U(Object.assign(Object.assign({},t),{growField:"angle"}));default:return _U(Object.assign(Object.assign({},t),{growField:"radius"}))}}class AU extends JN{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(EO),this.setInnerRadiusField(CO)}setValueFieldToPercent(){this.setRadiusField(PO),this.setInnerRadiusField(BO)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const kU=Object.assign(Object.assign({},BF),{rose:{name:"rose",type:"arc"}});class MU extends YF{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class TU extends hj{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=y(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let n,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:u,endAngle:g,center:f,outerRadius:m,layoutRadius:v}=((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:-90,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.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=f,i.startAngle=u,i.endAngle=g,i.outerRadius=m,i.type=c,i.layoutRadius=v;const _={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(_),"radius"===i.orient?(o.push(_),a=h):(l.push(_),n=h)})),o.forEach((t=>{t.angleAxisIndex=n})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=KR.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=Kz,this._endAngle=qz,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),nR(this._regions,(t=>{"radius"===this.getOrient()?jz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):jz(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(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.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:LR(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:LR(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this._specVisible&&(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=ae(this._spec.startAngle),this._endAngle=ae(this._spec.endAngle),this._inverse=this._spec.inverse}_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:Oz(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}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(){nR(this._regions,(t=>{"radius"===this.getOrient()?jz(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):jz(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(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 VC(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:VC(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 he(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return ce(t,this.getCenter(),this._startAngle,this._endAngle)}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=>zz(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i,s,n;const r=this.getCenter(),a=this.computeLayoutOuterRadius(),o=this.computeLayoutInnerRadius(),l=this._endAngle-this._startAngle,h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:r,radius:a,innerRadius:o,startAngle:this._startAngle,endAngle:this._endAngle,layoutRect:this.getRefLayoutRect(),autoLabelMaxWidth:null!==(e=null===(t=this._spec.label)||void 0===t?void 0:t.autoLabelMaxWidth)&&void 0!==e&&e,sides:(null===(n=null===(s=null===(i=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===i?void 0:i.getSpec())||void 0===s?void 0:s.grid)||void 0===n?void 0:n.smooth)?void 0:this.getScale().domain().length}),d=Object.assign(Object.assign({},c),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"angle",scale:this._scale});this._spec.grid.visible&&(d.grid=Object.assign({type:"line",smoothLink:!0,items:h[0]},c)),this._update(d)}_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=re.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",scale:this._scale.clone()});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return Jz((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=Zz,e=0;const i=this.getChart().getSpec();return nR(this.getRegions(),(s=>{const n=s;if(r=n.type,[cR.rose,cR.radar,cR.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.getComponent().setAttributes(XR({},this._axisStyle,s)),this._gridMark){this._gridMark.getComponent().setAttributes(XR({},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)}}TU.type=r.polarAxis,TU.specKey="axes";const wU={grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},CU={grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}};class EU extends TU{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new PE}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}registerTicksTransform(){const t=`${this.type}-ticks`;return xI(this._option.dataSet,t,HE),t}}EU.type=r.polarLinearAxis,EU.specKey="axes",EU.builtInTheme={axis:Mj,axisLinear:Sj,axisAngle:CU,axisRadius:wU},G(EU,xj);const BU=()=>{KR.registerGraphicComponent(nj.lineAxis,((t,e)=>new CC(t,e))),KR.registerGraphicComponent(rj.lineAxisGrid,((t,e)=>new zB(t,e))),KR.registerGraphicComponent(nj.circleAxis,((t,e)=>new OC(t,e))),KR.registerGraphicComponent(rj.circleAxisGrid,((t,e)=>new UB(t,e))),cj(),KR.registerComponent(EU.type,EU)};class PU extends TU{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new cE}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)}registerTicksTransform(){const t=`${this.type}-ticks`;return xI(this._option.dataSet,t,XE),t}transformScaleDomain(){}}PU.type=r.polarBandAxis,PU.specKey="axes",PU.builtInTheme={axis:Mj,axisBand:Ej,axisAngle:CU,axisRadius:wU},G(PU,Cj);const LU=()=>{KR.registerGraphicComponent(nj.lineAxis,((t,e)=>new CC(t,e))),KR.registerGraphicComponent(rj.lineAxisGrid,((t,e)=>new zB(t,e))),KR.registerGraphicComponent(nj.circleAxis,((t,e)=>new OC(t,e))),KR.registerGraphicComponent(rj.circleAxisGrid,((t,e)=>new UB(t,e))),cj(),KR.registerComponent(PU.type,PU)};class RU extends AU{constructor(){super(...arguments),this.type=cR.rose,this.transformerConstructor=MU,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(){this._roseMark=this._createMark(RU.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0},{morph:NF(this._spec,RU.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}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=>TR(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=TR(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(zF(null===(i=KR.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),jF("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}RU.type=cR.rose,RU.mark=kU,RU.builtInTheme={rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}}},RU.transformerConstructor=MU;const OU=()=>{KR.registerSeries(RU.type,RU),cU(),KR.registerAnimation("rose",((t,e)=>({appear:SU(t,e),enter:bU(t),exit:xU(t),disappear:{duration:HD.disappear.duration}}))),LU(),BU()};class IU extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center}getEndProps(){return!1===this.valid?{}:he(this._center,this._toRadius,this._toAngle)}onBind(){this.from=this.target.attribute,this.to=this.target.getFinalAttribute(),this._prevCenter=this.target.attribute.center,this._center&&this._prevCenter||(this.valid=!1);const{angle:t,radius:e}=ce(this.from,this._prevCenter),{angle:i,radius:s}=ce(this.to,this._center);k(i*s)||(this.valid=!1),this._fromAngle=k(t)?t:i,this._fromRadius=k(e)?e:s,this._toAngle=i,this._toRadius=s,KL(this._fromAngle,this._toAngle)&&KL(this._fromRadius,this._toRadius)&&(this.valid=!1),this.props=this.getEndProps()}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);const{x:s,y:n}=he({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);this.target.setAttributes({x:s,y:n}),this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}}class DU extends $w{onBind(){super.onBind();const{center:t}=this.target.attribute,{center:e}=this.target.getFinalAttribute();this._center=e,this._prevCenter=t}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),this.target.attribute.points=this.points,this.target.addUpdatePositionTag(),this.target.addUpdateShapeAndBoundsTag()}_interpolationSinglePoint(t,e,i){if(!sR(t)&&!sR(e))return e;const s=ce(t,this._prevCenter),n=ce(e,this._center);let r=ue(s.angle),a=ue(n.angle);!k(r)&&k(a)&&(r=a),k(r)&&!k(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return he({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new ne(s,n,r,a);return o.defined=e.defined,o}}const FU=t=>({type:"in"===t?"fadeIn":"fadeOut"});function zU(t,e,i){return"fadeIn"===e?FU(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function jU(t,e,i){return"fadeIn"===e?FU(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 HU=(t,e)=>({custom:Gw,customParameters:(i,s)=>{var n;return{group:s,startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),VU=Object.assign(Object.assign(Object.assign({},BF),pz),{area:{name:"area",type:"area"}});class NU extends AU{constructor(){super(...arguments),this.type=cR.radar,this.transformerConstructor=Az,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n=!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),r=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n&&"area"===r),this.initLineMark("line"===r||"area"===r&&!n),this.initSymbolMark("point"===r)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t){this._areaMark=this._createMark(NU.mark.area,{groupKey:this._seriesField,isSeriesMark:t})}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:rF,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{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.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)?ae(this._spec.startAngle):Kz},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(zF(null===(s=KR.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),jF("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=KR.getAnimationInKey(e);t.setAnimationConfig(zF(null==i?void 0:i(n,r),jF(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}}}NU.type=cR.radar,NU.mark=VU,NU.builtInTheme={radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}}},NU.transformerConstructor=Az,G(NU,gz);const UU=()=>{KR.registerSeries(NU.type,NU),HH(),bz(),Sz(),KR.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:zU(t,e,"in"),enter:zU(t,e,"in"),exit:zU(t,e,"out"),disappear:"clipIn"===e?void 0:{duration:HD.disappear.duration},update:[{channel:["points","center"],custom:DU,customParameters:t,duration:HD.update.duration,easing:HD.update.easing},{type:"update",options:{excludeChannels:["points","defined","center"]}}]}))),KR.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:jU(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:{duration:HD.disappear.duration},update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:IU,customParameters:t,duration:HD.update.duration,easing:HD.update.easing}]}))),KR.registerAnimation("radarGroup",((t,e)=>({appear:HU(t,"in"),disappear:{duration:HD.disappear.duration}}))),Bk(),LU(),BU()};class WU extends _F{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>fi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const GU=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];let r=0;return s.forEach((t=>{const i={};let s;for(const n in t)n===e||n.startsWith(yO)||(i[n]=t[n],s=p(s)?`${s}_${t[n]}`:`${t[n]}`);const a=t[e];null==a||a.forEach(((t,e)=>{n.push(Object.assign({},i,t,{[AO]:r,[kO]:`${s}_${e}`})),r++}))})),n},YU={fill:"#bbb",fillOpacity:.2},$U=Object.assign(Object.assign({},BF),{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"}});class XU extends qF{constructor(){super(...arguments),this.type=cR.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 e;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),xI(this._option.dataSet,"objFlat",GU),xI(this._option.dataSet,"copyDataView",EI),SI(this._option.dataSet,"dataview",Ta),null===(e=this.getViewData())||void 0===e||e.transform({type:"objFlat",options:"dots",level:t.TransformLevel.dotObjFlat},!1)}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(XR(YU,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(XU.mark.group),this._containerMark=this._createMark(XU.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(XU.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(XU.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(XU.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(XU.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(XU.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(XU.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){var e;const i=this._clipMark;i&&(this.setMarkStyle(i,{x:-(null!==(e=this._spec.leftAppendPadding)&&void 0!==e?e:0),y:0,width:1e4,height:()=>{var t;return null!==(t=this._spec.clipHeight)&&void 0!==t?t:this._region.getLayoutRect().height}},"normal",t.AttributeLevel.Series),i.setMarkConfig({interactive:!1,clip:!0}));const s=this._containerMark;s&&(this.setMarkStyle(s,{x:this._spec.leftAppendPadding},"normal",t.AttributeLevel.Series),s.setMarkConfig({interactive:!1}));const n=this._gridBackgroundMark;n&&this.setMarkStyle(n,{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 r=this._gridMark;r&&this.setMarkStyle(r,{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 a=this._dotMark;a&&this.setMarkStyle(a,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),stroke:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",t.AttributeLevel.Series);const o=this._titleMark;o&&this.setMarkStyle(o,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const l=this._subTitleMark;l&&this.setMarkStyle(l,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",t.AttributeLevel.Series);const h=this._symbolMark;h&&this.setMarkStyle(h,{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(){var e,i;super.onLayoutEnd();const s=null!==(i=null===(e=this._spec)||void 0===e?void 0:e.leftAppendPadding)&&void 0!==i?i:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+s},"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:MO}}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 AR).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:MO}}initTooltip(){this._tooltipHelper=new WU(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}XU.type=cR.dot,XU.mark=$U,XU.builtInTheme={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"}}}}};class KU extends _F{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>fi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const qU=Object.assign(Object.assign({},BF),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),ZU=(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 JU extends qF{constructor(){super(...arguments),this.type=cR.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 e;super.initData(),xI(this._option.dataSet,"linkDotInfo",ZU),null===(e=this.getViewData())||void 0===e||e.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:t.TransformLevel.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(JU.mark.group),this._containerMark=this._createMark(JU.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(JU.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(JU.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},"normal",t.AttributeLevel.Series),r.setMarkConfig({interactive:!1,clip:!0}));const a=this._containerMark;a&&(this.setMarkStyle(a,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",t.AttributeLevel.Series),a.setMarkConfig({interactive:!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:MO}}getInteractionTriggers(){const t=[];return this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new KU(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{t.commit(!1,!0)}))}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]}}JU.type=cR.link,JU.mark=qU,JU.builtInTheme={link:{arrow:{style:{size:10}}}};const QU=Object.assign(Object.assign({},BF),{group:{name:"group",type:"group"}});class tW extends JN{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()?CO:NO],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ae(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()?EO:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=ae(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)?ae(n):Kz;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?ae(r):qz,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=TR(this.angleAxisHelper.dataToPosition([t[CO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=TR(this.angleAxisHelper.dataToPosition([t[EO]]),this.angleAxisHelper.getScale(0));if(k(e))return e}const e=this.angleAxisHelper.dataToPosition([t[this._angleField[0]]]);return this._spec.clamp?TR(e,this.angleAxisHelper.getScale(0)):e}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(tW.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const e=this._arcGroupMark;e.created(),this.setMarkStyle(e,{x:0,y:0},"normal",t.AttributeLevel.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis(),{x:e,y:i}=this.angleAxisHelper.center(),s=this._computeLayoutRadius();if(this._isTickMaskVisible(t)){const{tickMask:n}=this._spec,{angle:r,offsetAngle:a,style:o={}}=n,l=this._getAngleAxisSubTickData(t),h=o;return l.map((({value:t})=>{const n=this.angleAxisHelper.dataToPosition([t])+ae(a),o=ae(r)/2;return af(Object.assign(Object.assign({},h),{x:e,y:i,startAngle:n-o,endAngle:n+o,innerRadius:s*this._innerRadius,outerRadius:s*this._outerRadius,fill:!0}))}))}const{width:n,height:r}=this.getLayoutRect();return[Ig({width:n,height:r,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId();return this._option.getChart().getAllComponents().find((e=>e.id===t))}_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 nW=()=>{KR.registerAnimation("circularProgress",((t,e)=>({appear:sW(t,e),enter:{type:"growAngleIn"},disappear:{duration:HD.disappear.duration}})))};class rW extends YF{constructor(){super(...arguments),this._supportStack=!0}}class aW extends tW{constructor(){super(...arguments),this.type=cR.circularProgress,this.transformerConstructor=rW,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(){return this._progressMark=this._createMark(aW.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0},{morph:NF(this._spec,"progress")}),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)}getInteractionTriggers(){const t=[];return 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(){return this._trackMark=this._createMark(aW.mark.track,{parent:this._arcGroupMark}),this._trackMark.setMarkConfig({morph:!1,morphKey:null,morphElementKey:null}),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()?CO:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?EO: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(zF(null===(i=KR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),jF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(zF(null===(s=KR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),jF("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}aW.type=cR.circularProgress,aW.mark=eW,aW.builtInTheme={circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},aW.transformerConstructor=rW;const oW=()=>{KR.registerSeries(aW.type,aW),cU(),nW(),WD(),LU(),BU()};function lW(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const hW={type:"fadeIn"};function cW(t,e="grow"){return!1===e?{}:"fadeIn"===e?hW:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:lW(t)}))(t)}class dW extends _F{enableByType(t){return"dimension"!==t}}const uW=Object.assign(Object.assign({},BF),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class pW extends qF{constructor(){super(...arguments),this.type=cR.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=p(e.width)?e.width:e.x1-e.x,o=p(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t;return this._progressMark=this._createMark(pW.mark.progress,{isSeriesMark:!0}),u(null===(t=this._spec.progress)||void 0===t?void 0:t.customShape)&&this._progressMark.setMarkConfig({setCustomizedShape:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var e,i,s,n;const r=this._progressMark;if(r)if("vertical"===this._spec.direction){const s=this._spec.progress||{},n=null!==(e=s.leftPadding)&&void 0!==e?e:0,a=null!==(i=s.rightPadding)&&void 0!==i?i:0;this.setMarkStyle(r,{x:t=>{var e,i;return TR(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),!0)-this._spec.bandWidth/2+n},y1:t=>{var e,i;return TR(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))},y:()=>{var t,e,i;const s=null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?TR(s,null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},width:this._spec.bandWidth-n-a,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}else{const e=this._spec.progress||{},i=null!==(s=e.topPadding)&&void 0!==s?s:0,a=null!==(n=e.bottomPadding)&&void 0!==n?n:0;this.setMarkStyle(r,{x1:t=>{var e,i;return TR(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))},y:t=>{var e,s;return TR(this.dataToPositionY(t),null===(s=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===s?void 0:s.call(e,0),!0)-this._spec.bandWidth/2+i},height:this._spec.bandWidth-i-a,x:()=>{var t,e,i;const s=null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition});return this._spec.clamp?TR(s,null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0)):s},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series)}}_initTrackMark(){return this._trackMark=this._createMark(pW.mark.track),this._trackMark}_initTrackMarkStyle(){const e=this._trackMark;e&&("vertical"===this._spec.direction?this.setMarkStyle(e,{x:t=>{var e,i;return TR(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),!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 TR(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),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",t.AttributeLevel.Series))}getInteractionTriggers(){const t=[];return 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(zF(null===(i=KR.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),jF("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(zF(null===(s=KR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),jF("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new dW(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}pW.type=cR.linearProgress,pW.mark=uW,pW.builtInTheme={linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}}};const gW=()=>{eV(),KR.registerAnimation("linearProgress",((t,e)=>({appear:cW(t,e),enter:cW(t),disappear:{duration:HD.disappear.duration}}))),WD(),KR.registerSeries(pW.type,pW)},fW=[0],mW=[20,40],vW=[200,500],_W={shrink:!1,enlarge:!1,fontSizeLimitMin:0},yW=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"];class bW{constructor(t=1e3){this._map=new Map,this._maxSize=t}get(t){const e=this._map.get(t);if(e)return this._map.delete(t),this._map.set(t,e),e}set(t,e){if(this._map.has(t))this._map.set(t,e);else{if(this._map.size>=this._maxSize){const t=this._map.keys().next().value;void 0!==t&&this._map.delete(t)}this._map.set(t,e)}}clear(){this._map.clear()}size(){return this._map.size}}const xW=`${yO}_WORD_CLOUD_TEXT`,SW=Object.assign(Object.assign({},BF),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}}),AW={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic",scaleX:1,scaleY:1}}};class kW extends $F{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},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._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=mW}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,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:vW,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:fW,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?xW:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:_W},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||Gy(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:fW,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!yW.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme("fontFamily"),this._wordMeasureCache||(this._wordMeasureCache=new bW(1e3))}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",(()=>{var t;null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._dataChange=!0,this.compile()}))}initMark(){var e;this._wordMark=this._createMark(kW.mark.word,{key:kO,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField}),(null===(e=this._spec.wordMask)||void 0===e?void 0:e.visible)&&(this._maskMark=this._createMark(kW.mark.wordMask,{dataView:!1}),this._maskMark.setMarkConfig({zIndex:t.LayoutZIndex.Mark-1}))}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",t.AttributeLevel.Series)}initMarkStyleOfWord(e,i,s,n,r){var a,o;e&&(this.setMarkStyle(e,{text:(null==i?void 0:i.formatMethod)?t=>i.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",t.AttributeLevel.Series),this.setMarkStyle(e,{fill:null!==(o=null===(a=null==i?void 0:i.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",t.AttributeLevel.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(zF(KR.getAnimationInKey("wordCloud")(n,s),jF("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 AR).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:MO])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new PE).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new PE).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[AO])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!k(t)||!k(e)||!(e>0&&t>0))return;const i=[];this._isWordCloudShape?i.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):i.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),this._wordMark.setTransform(i)}_getCommonTransformOptions(){var e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(e=this._spec.word)&&void 0!==e?e:{},h=null!==(i=l.style)&&void 0!==i?i:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:this._option.getTheme("fontFamily")},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,onLayoutFinished:()=>{const e=()=>{var i,s,n,r;this._option.globalInstance.getStage().hooks.afterRender.taps=this._option.globalInstance.getStage().hooks.afterRender.taps.filter((t=>t.fn!==e)),null===(s=(i=this._option).dispatchEvent)||void 0===s||s.call(i,t.ChartEvent.afterWordcloudShapeDraw,{instance:this._option.globalInstance}),null===(r=null===(n=this._option.globalInstance.getChart().getOption().performanceHook)||void 0===n?void 0:n.afterWordcloudShapeDraw)||void 0===r||r.call(n,this._option.globalInstance)};this._option.globalInstance.getStage().hooks.afterRender.taps.push({type:"sync",name:"afterWordcloudShapeDraw",fn:e})},dataIndexKey:kO,text:l.formatMethod?t=>l.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(n=null===(s=this._spec.word)||void 0===s?void 0:s.padding)&&void 0!==n?n:1,fontFamily:p(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(r=h.fontFamily)&&void 0!==r?r:this._defaultFontFamily,fontWeight:p(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:p(h.fontWeight)?h.fontWeight:p(this._valueField)?this._calculateFontWeight:"normal",fontStyle:p(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:h.fontStyle,createCanvas:A_.createCanvas.bind(A_),getTextBounds:ff}}_wordCloudTransformOption(){var t,e;const i=null!==(t=this._wordCloudConfig)&&void 0!==t?t:{};return Object.assign(Object.assign(Object.assign({},i),this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(e=this._spec.random)||void 0===e||e,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,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{createImage:Ug,measureCache:this._wordMeasureCache,rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:p(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:p(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:p(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}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(){super.onLayoutEnd(),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){var t;super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null),null===(t=this._wordMeasureCache)||void 0===t||t.clear()}release(){var t;super.release(),null===(t=this._wordMeasureCache)||void 0===t||t.clear(),this._wordMeasureCache=void 0}}kW.mark=SW,kW.builtInTheme={wordCloud:AW};function MW(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({type:"scaleIn",duration:200,delay:(e,i)=>{const s=t.animationConfig(),n=(null==s?void 0:s.duration)||200,r=(null==s?void 0:s.totalTime)||HD.appear.duration,a=i.context.graphicCount;return i.context.graphicIndex*function(t,e,i){return t*i{let o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,d;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(d=t.children)||void 0===d?void 0:d.length){p.children=[],p.isLeaf=!1;const e=TW(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Mt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Mt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},wW=(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=wW(t.children,e,t,n))})),s},CW=(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=CW(t.children,e,t,n)),n=e(t,s,i,n)})),n},EW=(t,e=[],i)=>{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):EW(t.children,e,i)))})),e};function BW(t,e){let i,s;if(RW(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function RW(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 FW(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 zW(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 jW(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 HW(t){return{_:t,next:null,prev:null}}function VW(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];FW(n,s,r);let a,o,l,h,c,d,u,p=HW(s),g=HW(n),f=HW(r);p.next=g,f.prev=g,g.next=f,p.prev=f,f.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,this._valueField=null!==(e=null==t?void 0:t.valueField)&&void 0!==e?e:"value"}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=TW(t,n,0,-1,null,this._getNodeKey,this._valueField);this._maxDepth=r.maxDepth;const a=function(t=1){let e=t;return()=>(e=(1664525*e+1013904223)%wt)/wt}(),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:GW.defaultOpionts.nodeSort;wW([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)wW([o],NW(h)),CW([o],UW(this._getPadding,.5,a)),wW([o],WW(1,this._maxDepth));else{const t=Math.min(s.width,s.height);wW([o],NW(GW.defaultOpionts.setRadius)),CW([o],UW(Lt,1,a)),c&&CW([o],UW(this._getPadding,o.radius/t,a)),wW([o],WW(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}GW.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const YW=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=YW(t.children):t.value=0),e+=Math.abs(t.value)})),e};function $W(t,e){const i=[],s=[],n={},r={},a=[];return function(t,e,i=[],s={},n){YW(t);const r=(t,a,o)=>{t.forEach(((t,l)=>{const h=e?e(t):o?`${o[o.length-1].key}-${l}`:`${a}-${l}`,c=u(t.value)?0:Mt(t.value);if(s[h])s[h].value=void 0;else{const e={depth:a,datum:t,index:l,key:h,value:c,sourceLinks:[],targetLinks:[]};s[h]=e,i.push(e)}o&&n&&n.push({source:o[o.length-1].key,target:h,value:c,parents:o}),t.children&&t.children.length&&r(t.children,a+1,o?o.concat([s[h]]):[s[h]])}))};r(t,0,null)}(t,e,i,n,a),a.forEach(((t,e)=>{const i=`${t.source}-${t.target}`,a=H(t,["parents"]);if(a.parents=t.parents.map((t=>H(t,["sourceLinks","targetLinks"]))),r[i])return r[i].value+=Mt(t.value),void r[i].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};s.push(o),n[t.source].sourceLinks.push(o),n[t.target].targetLinks.push(o),r[i]=o})),{nodes:i,links:s,nodeMap:n}}function XW(t){return t.depth}function KW(t,e){return e-1-t.endDepth}const qW=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),ZW=(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},JW={left:XW,right:KW,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?K(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:XW,end:KW},QW=yt(0,1);class tG{constructor(t){this._ascendingSourceBreadth=(t,e)=>qW(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>qW(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},tG.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?Bt(e):null;this._getNodeKey=i,this._logger=at.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):JW[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)};"vertical"===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<=0)return null;const a=this.computeNodeBreadths(n);if(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))),"vertical"===this.options.direction)if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;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}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return 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){return $W(t,this._getNodeKey)}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=[ZW(s[t.source]),ZW(s[t.target],!0)].filter((t=>!u(t)));e.length&&(t.value=K(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){return function(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=Mt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Mt(e.value))&&void 0!==i?i:0)}),0))}}(t)}computeNodeDepths(t){var e;const i=t.length;let s,n,r=t,a=0,o=-1;const l=d(this.options.setNodeLayer)?this.options.setNodeLayer:null;for(;r.length&&ai&&this._logger.warn("Error: there is a circular link"),this._maxDepth=l?o+1:a}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;ea)&&(o=a);let l=0,h=null,c=null;if(d(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e;let s=Math.min(this.options.nodeGap,i);if(r+s>i&&(s=r>=i?i/2:(i-r)/2,r=Math.min(i-s,r)),h=()=>s,this._gapY=s,this.options.equalNodeHeight)c=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,f=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:c>0?t=>c:t=>Math.max(t.value*l,0),m=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*QW(t.value/e.value):0,n,0),o);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;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,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(qW),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(qW),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{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];eG(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),iG);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({},sG.defaultOpionts,t):Object.assign({},sG.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?Bt(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Pt(this.options.center[0],t.width),s=t.y0+Pt(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=>Pt(t,n))):Pt(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>Pt(t,n))):Pt(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=Pt(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=TW(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=he({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)}}}function nG(t,e,i,s,n){const r=t.children;let a,o=-1;const l=r.length,h=t.value&&(n-i)/t.value;for(;++o(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,f,m,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=f*f*b,_=Math.max(v/x,x/m),_>y){f-=h;break}y=_}l=Object.assign({},e,{value:f,children:o.slice(c,d)}),a.push(l),p{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*f+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,f,r,n,a,o)}else{const r=i?(n*f+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,f,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:eG,slice:nG,sliceDice:function(t,e,i,s,n){(t.depth%2==1?nG:eG)(t,e,i,s,n)}};class oG{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({},oG.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?Bt(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?rG(this.options.aspectRatio):null!==(e=aG[this.options.splitType])&&void 0!==e?e:aG.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=TW(t,n,0,-1,null,this._getNodeKey,this.options.valueField);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)}))}}function lG(t,e,i){return Math.min(t,e)*Math.min(t,e)*Math.PI<=i+hi?Math.abs(t-e):function(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.maxIterations)&&void 0!==n?n:100,o=null!==(r=null==s?void 0:s.tolerance)&&void 0!==r?r:1e-10,l=t(e),h=t(i);let c=i-e;if(l*h>0)return at.getInstance().error("Initial bisect points must have opposite signs"),NaN;if(0===l)return e;if(0===h)return i;for(let i=0;i=0&&(e=i),Math.abs(c){const r=i[t.sets[0]],a=i[t.sets[1]],o=lG(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[a].size/Math.PI),t.size);s[r][a]=s[a][r]=o;let l=0;t.size+1e-10>=Math.min(e[r].size,e[a].size)?l=1:t.size<=1e-10&&(l=-1),n[r][a]=n[a][r]=l})),{distances:s,constraints:n}}(t,s,n);let o=a.distances;const l=a.constraints,h=wi(o.map(wi))/o.length;o=o.map((t=>t.map((t=>t/h))));const c=function(t,e){return function(t,e,i,s){let n,r=0;for(n=0;n0&&g<=d||u<0&&g>=d||(r+=2*f*f,e[2*n]+=4*f*(a-h),e[2*n+1]+=4*f*(o-c),e[2*l]+=4*f*(h-a),e[2*l+1]+=4*f*(c-o))}}return r}(t,e,o,l)};let d,u;for(r=0;rTt(e)));u=Li(c,t,e),(!d||u.fx=Math.min(s[a].size,s[o].size)&&(r=0),n[a].push({set:o,size:i.size,weight:r}),n[o].push({set:a,size:i.size,weight:r})}const r=[];for(const t in n)if(n.hasOwnProperty(t)){let e=0;for(let i=0;i=8){const n=hG(t,e);s(n,t)+1e-80){const e=t[0].x,i=t[0].y;for(s=0;s1){const i=Math.atan2(t[1].x,t[1].y)-e,n=Math.cos(i),r=Math.sin(i);let a,o;for(s=0;s2){let i=Math.atan2(t[2].x,t[2].y)-e;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(s=0;s0&&at.getInstance().error("Area "+r+" not represented on screen")}return i}function mG(t,e){const i=[];for(let e=0;e=n&&(s=i[r],n=a)}const r=Bi((function(i){return-1*vG({x:i[0],y:i[1]},t,e)}),[s.x,s.y],{maxIterations:500,minErrorDelta:1e-10}).x;let a={x:r[0],y:r[1]},o=!0;for(let e=0;et[e].radius){o=!1;break}for(let t=0;t{if(!(null==t?void 0:t.length))return"";let e=0,i=t[0];const{p1:s}=i;let n=`M${s.x},${s.y}`;for(;i;){const{p2:s,radius:r,largeArcFlag:a}=i;n+=`A${r},${r} 0 ${a?1:0},0 ${s.x},${s.y}`,i=t[++e]}return n+=" Z",n},yG=(t,e)=>{const{x0:i,x1:s,y0:n,y1:r,setField:a="sets",valueField:o="size",orientation:l=Math.PI/2,orientationOrder:h=null,emptySetKey:c}=t;let d={},u={};const p=e.some((t=>{const e=Y(t[a]);return!e||0===e.length})),g=p?e.filter((t=>!P(Y(t[a])))):e;if(g.length>0){const e=g.map((t=>({sets:Y(t[a]),size:t[o]})));let c=function(t,e){(e=e||{}).maxIterations=e.maxIterations||500;const i=e.initialLayout||dG,s=e.lossFunction||cG,n=i(t=function(t){t=t.slice();const e=[],i={};for(let s=0;se)}));for(let s=0;s{const e=Y(t[a]);if(!e||0===e.length)return Object.assign(Object.assign({},t),{datum:t,sets:e,key:c||"others",size:t[o],labelX:void 0,labelY:void 0,type:"circle",x:i+(s-i)/2,y:n+(r-n)/2,radius:Math.min(s-i,r-n)/2});const l=e.toString(),h=u[l],p=Object.assign(Object.assign({},t),{datum:t,sets:e,key:l,size:t[o],labelX:null==h?void 0:h.x,labelY:null==h?void 0:h.y}),g=d[l];if(g)return Object.assign(Object.assign({},p),{type:"circle",x:g.x,y:g.y,radius:g.radius});const f=(t=>{const e={},i=Object.values(t);if(!i.length)return[];ci(i,e);const s=e.arcs.map((({p1:t,p2:e,circle:i,width:s})=>({p1:t,p2:e,radius:i.radius,setId:i.setId,largeArcFlag:s>i.radius}))),n=[];let r=0,a=s[0];for(;rre.distancePP(e.p1,t)d[t])));return Object.assign(Object.assign({},p),{type:"overlap",x:0,y:0,path:_G(f),arcs:f})}))},bG={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:xG,triangle:xG,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.955)%(2*Math.PI/5)-2*Math.PI/10>=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 xG(){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 SG(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*.4),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"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const AG=t=>bG[t]?bG[t]():bG.circle(),kG=(t,e)=>"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function MG(t){return d(t)?t:function(){return t}}class TG{constructor(t){var e,i;switch(this.options=j({},TG.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=AG(this.options.shape),this.getText=null!==(e=MG(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=MG(this.options.fontWeight),this.getTextFontSize=MG(this.options.fontSize),this.getTextFontStyle=MG(this.options.fontStyle),this.getTextFontFamily=MG(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>kG(10,50);break;case"random-light":this.getTextColor=()=>kG(50,90);break;default:this.getTextColor=MG(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 ae(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():Tt(e);return ae(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+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:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1: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 CG extends TG{constructor(t){var e;super(j({},CG.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<=CG.defaultOptions.minFontSize&&(this.options.minFontSize=CG.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=wG[this.options.spiral])&&void 0!==e?e:wG.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=MG(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}=SG(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,f,m;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,f=0;f>5),i=v[(h+m)*(n<<5)+(l+f)<<2]?1<<31-f%32:0;_[e]|=i,t|=i}t?r=m:(e.y0++,g--,m--,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._board=this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this._board=this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this._board=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(this.options.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Uint32Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=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}));if(this.originalData=s,this.data=s,this.progressiveRun(),!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._originSize[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],n=this._size[1],r=s>>5,a=s*(i||1.1)-s>>5;let o=2*a>2?a:2;o%2!=0&&o++;let l=Math.ceil(n*(o<<5)/s);l%2!=0&&l++;const h=s+(o<<5),c=n+l,d=h>>5,u=o/2,p=l/2,g=new Uint32Array(c*d).fill(0);for(let e=0;e>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});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 f=Math.atan(u/d);d<0?f+=Math.PI:u<0&&(f=2*Math.PI+f);const m=this.shape(f);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*m*Math.cos(-f)),e.y=o+~~(h*m*Math.sin(-f)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(LG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(PG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}LG(p,this._size)&&(p=RG(p,this._size))}else if(LG(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||BG(p,i))&&(!i||!EG(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 EG(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 BG(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,LG=(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 RG(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{const{fontFamily:r="sans-serif",fontWeight:a="normal",fontStyle:o="normal",fontVariant:l="normal",text:h,hollow:c}=t;let d=12;n.font=`${o} ${l} ${a} ${d}px ${r}`,n.textAlign="center",n.textBaseline="middle",n.fillStyle=e;const u=n.measureText(h),g="normal"!==o?1.1:1,f=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,m=Math.max(Math.ceil(u.width),f,d);if(c&&(n.globalCompositeOperation="xor"),m>i){const t=Math.min(i/m,s/d);n.fillText(h,i/2,s/2),n.scale(t,t)}else d=Math.floor(d*i/m),d=Math.min(d,s),n.font=`${o} ${l} ${a} ${d}px ${r}`,n.fillText(h,Math.floor(i/2),Math.floor(s/2))},IG=(t,e,i=0,s)=>{const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>he(t,e,i+r*n)))},DG=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},FG=(t,e,i,s,n)=>{const{hollow:r}=t,{center:a,maxRadius:o}=SG(t.shape,[i,s]);n.fillStyle=e,r&&(n.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(n,((t,e,i=0,s)=>{const n=2*Math.PI/s,r=AG("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return he(t,l,o)}))})({x:l,y:h},o,0,100));else if("circle"===t.shape)n.beginPath(),n.arc(l,h,o,0,2*Math.PI,!0),n.fill();else if("diamond"===t.shape)DG(n,IG({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)DG(n,IG({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)DG(n,IG({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)DG(n,IG({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)DG(n,IG({x:l,y:h},o,0,3));else if("star"===t.shape){const t=IG({x:l,y:h},o,-Math.PI/2,5),e=IG({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);DG(n,i)}else n.fillRect(0,0,i,s)}; /*! * wordcloud2.js * http://timdream.org/wordcloud2.js/ @@ -20,4 +20,4 @@ * Copyright 2011 - 2019 Tim Guan-tin Chien and contributors. * Released under the MIT license */ -let BG=class t extends _G{constructor(e){super(j({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{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,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize: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=this.options.createCanvas({width:1,height:1}),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 f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),_=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*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],B=(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--;)B(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}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=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,e=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){this.grid=[];const e=this.options.shape;if(g(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?TG(t,o,l.width,l.height,h):"geometric"===t.type&&EG(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!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)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,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}=gG(this.options.shape,[e.width,e.height]);return 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),this.result=[],this.progressiveRun()}};BG.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class PG extends _G{constructor(t){super(j({},PG.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,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)}PG.defaultOptions={enlarge:!1};const RG={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},OG=(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?IG(t.fontFamily):"sans-serif",d=t.fontStyle?IG(t.fontStyle):"normal",u=t.fontWeight?IG(t.fontWeight):"normal",p=t.rotate?IG(t.rotate):0,g=IG(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?IG(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?Object.assign(Object.assign({},RG),t.as):RG,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?IG(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=FG(zG(t,l),C);w=i=>e(t(i))}let E=bG;"fast"===t.layoutType?E=PG:"grid"===t.layoutType&&(E=BG);const B=new E(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:w,shrink:_,clip:b,enlarge:y,minFontSize:x,random:A,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:B}:B.output()},IG=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],DG=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),FG=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=DG(t[0]),n=DG(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(DG(t)-r)/(a-r)*(e[1]-e[0])+e[0]},zG=(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 jG(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{NR.registerGrammarTransform("wordcloud",{transform:OG}),EV(),NR.registerAnimation("wordCloud",((t,e)=>({appear:vW(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:LD.disappear.duration}}))),NR.registerSeries(HG.type,HG)},VG=(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:f=!1,isCone:m=!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===f?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?m?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},UG=(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},WG=`${dO}_FUNNEL_TRANSFORM_RATIO`,GG=`${dO}_FUNNEL_REACH_RATIO`,YG=`${dO}_FUNNEL_HEIGHT_RATIO`,$G=`${dO}_FUNNEL_VALUE_RATIO`,XG=`${dO}_FUNNEL_LAST_VALUE_RATIO`,KG=`${dO}_FUNNEL_NEXT_VALUE_RATIO`,qG=`${dO}_FUNNEL_LAST_VALUE`,ZG=`${dO}_FUNNEL_CURRENT_VALUE`,JG=`${dO}_FUNNEL_NEXT_VALUE`,QG=`${dO}_FUNNEL_TRANSFORM_LEVEL`;class tY extends cF{constructor(t){var e,i;super(t),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)?this._transformRatioText: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[GG])).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 this._transformRatioText;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]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class eY extends AD{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class iY extends eY{constructor(){super(...arguments),this.type=iY.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}iY.type="polygon";const sY=()=>{NR.registerMark(iY.type,iY),Jk(),Yk(),pw.registerBuiltInAnimate("growPointsOut",cC),NR.registerGraphicComponent("polygon",hf)},nY=Object.assign(Object.assign({},SF),{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"}});class rY extends zF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class aY extends jF{constructor(){super(...arguments),this.type=iR.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=rY,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,i,s,n;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._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;pI(this._dataSet,"funnel",VG),pI(this._dataSet,"funnelTransform",UG);const t=new Ba(this._dataSet,{name:`${dO}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new _D(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}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:ZG,asTransformRatio:WG,asReachRatio:GG,asHeightRatio:YG,asValueRatio:$G,asNextValueRatio:KG,asLastValueRatio:XG,asLastValue:qG,asNextValue:JG,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:QG}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},aY.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:OF(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},aY.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),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(aY.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(aY.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new tY(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(){var e,i,s,n;const r=this._funnelMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const a=this._funnelTransformMark;a&&this.setMarkStyle(a,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const o=this._funnelOuterLabelMark.label;o&&(this.setMarkStyle(o,{text:t=>`${t[this.getCategoryField()]}`,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),width:0,height:0},"normal",t.AttributeLevel.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(o,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",t.AttributeLevel.User_Mark));const l=this._funnelOuterLabelMark.line;if(l&&o){this.setMarkStyle(l,{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);const r=null!==(s=null===(i=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.line)||void 0===i?void 0:i.visible)&&void 0!==s?s:null===(n=this._spec.outerLabel)||void 0===n?void 0:n.visible;p(r)&&l.setVisible(r)}}initLabelMarkStyle(e){var i;if(!e)return;const s=e.getTarget(),n=e.getComponent();if(s===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);const s=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&zy(s,this._funnelOuterLabelMark.label,n),this._funnelOuterLabelMark.line&&zy(s,this._funnelOuterLabelMark.line,null!==(i=this._funnelOuterLabelMark.label)&&void 0!==i?i:n)}else this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*QL(GG).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(BF(null===(s=NR.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.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),PF("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(BF(NR.getAnimationInKey("fadeInOut")(),PF(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(BF(NR.getAnimationInKey("funnel")({},o),PF(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(BF(null===(a=NR.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),PF("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[XG])/2:this._getSecondaryAxisLength(t[$G])/2,n=this._getSecondaryAxisLength(t[$G])/2):(s=this._getSecondaryAxisLength(t[$G])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[KG])/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[QG])}_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[mO]===t[mO]));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,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,_,y;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h: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!==f.alignLabel?(null==u?void 0:u.y2)+e:_-e,m=this._getPolygonCenter(i).x,_-y{sY(),EV(),HN(),NR.registerSeries(aY.type,aY),NR.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},OD))),NR.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Yw,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),DD()},lY=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},hY=t=>{const e=t.filter((t=>t.context.diffState===YI.update)),i=K(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},cY=(t,e,i)=>{if(P(t))return[e,i];const s=K(t.map((t=>1*t.getFinalAttribute().startAngle))),n=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},dY=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=hY(i.parent.children),a=cY(r,s,n);return lY(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=hY(i.parent.children),a=cY(r,s,n);return lY(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),uY=t=>{const e=K(t.map((t=>1*t.getFinalAttribute().startAngle))),i=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},pY=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=hY(i.parent.children),a=uY(r);return lY(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=hY(i.parent.children),a=uY(r);return lY(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),gY=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},fY=(t,e={})=>{if(!t)return[];const i=[];return xW(t,i,e),i},mY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new KW(i).layout(t,{width:s,height:n})};class vY extends cF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var _Y;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(_Y||(_Y={}));const yY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===_Y.DrillDown){return Y($O(t,n,s,"children"))}if(i.type===_Y.DrillUp){const e=XO(t,n,s,"children");if(e)return Y(e)}return t};class bY{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=AN(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;pI(t,"drillFilter",yY),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)||P(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:_Y.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:_Y.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)||P(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:_Y.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:_Y.DrillUp},model:this}),r}}const xY=Object.assign(Object.assign({},SF),{sunburst:{name:"sunburst",type:"arc"}}),SY=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:fF,operations:["max","min","values"]}),t.push({key:mF,operations:["values"]}),t),AY={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,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"}}}};class kY extends WV{constructor(){super(...arguments),this.type=iR.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:mF),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:mO},getRawData:()=>this.getRawData()}),this._startAngle=ae(this._spec.startAngle),this._endAngle=ae(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),pI(this._dataSet,"sunburstLayout",mY),pI(this._dataSet,"flatten",fY),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 SY(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(pI(t.dataSet,"addVChartProperty",sF),t.transform({type:"addVChartProperty",options:{beforeCall:bF.bind(this),call:xF}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(kY.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_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()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(kY.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new vY(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(BF(null===(e=NR.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),PF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(BF(null===(e=NR.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),PF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),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]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}kY.type=iR.sunburst,kY.mark=xY,kY.builtInTheme={sunburst:AY},G(kY,bY);const MY=()=>{NR.registerSeries(kY.type,kY),iU(),EV(),DD(),NR.registerAnimation("sunburst",((t,e)=>({appear:gY(0,e),enter:dY(t),exit:pY(t),disappear:{duration:LD.disappear.duration}})))},TY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new FW(i).layout(t,{width:s,height:n})};class wY extends cF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const CY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},EY=Object.assign(Object.assign({},SF),{circlePacking:{name:"circlePacking",type:"arc"}});class BY extends VF{constructor(){super(...arguments),this.type=iR.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:mF),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:mO},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),pI(this._dataSet,"circlePackingLayout",TY),pI(this._dataSet,"flatten",fY),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)||(pI(t.dataSet,"addVChartProperty",sF),t.transform({type:"addVChartProperty",options:{beforeCall:bF.bind(this),call:xF}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(BY.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_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},t.STATE_VALUE_ENUM.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(BY.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"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return SY(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new wY(this),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(BF(null===(i=NR.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),PF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(BF(null===(e=NR.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),PF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}BY.type=iR.circlePacking,BY.mark=EY,BY.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,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"}}}}},G(BY,bY);const PY=()=>{NR.registerSeries(BY.type,BY),iU(),EV(),ID(),NR.registerAnimation("circlePacking",((t,e)=>({appear:CY(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:LD.disappear.duration}})))},LY=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&LY(t,e.children,i)}))},RY=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},OY=(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 YW(e),r=[];return r.push(n.layout(s,i)),r},IY=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:[]},DY=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 FY extends cF{constructor(){super(...arguments),this._getDimensionData=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},this.markTooltipValueCallback=t=>t.value}}const zY=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),jY=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:zY(t),HY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class NY extends kw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class VY extends kw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const UY=(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,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=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}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},WY=(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,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=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}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class GY extends cV{constructor(){super(...arguments),this.type=GY.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?WY:UY,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}GY.type="linkPath";const YY=Object.assign(Object.assign({},SF),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class $Y extends zF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const XY=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&t.removeState(e),t.addState(e,s,n)};class KY extends VF{constructor(){super(...arguments),this.type=iR.sankey,this.transformerConstructor=$Y,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new He,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;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(p(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var e,i;if(!this._needClear)return;const s=null===(e=this._nodeMark)||void 0===e?void 0:e.getGraphics();if(!s||!s.length)return;const n=null===(i=this._linkMark)||void 0===i?void 0:i.getGraphics();n&&n.length&&(s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),n.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._needClear=!1)},this._handleNodeAdjacencyClick=e=>{const i=eI(e),s=[i.key];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,n)=>{const r=eI(e);r.source===i.key?(s.includes(r.target)||s.push(r.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):r.target===i.key?(s.includes(r.source)||s.push(r.source),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleLinkAdjacencyClick=e=>{const i=eI(e),s=[i.source,i.target];if(this._linkMark){const i=this._linkMark.getGraphics();if(!i||!i.length)return;i.forEach((i=>{i===e?(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),XY(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1})):(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),i.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleNodeRelatedClick=e=>{var i;const s=eI(e),n=this._nodeMark.getGraphics();if(!n||!n.length)return;const r=this._linkMark.getGraphics();if(!r||!r.length)return;const a=(null===(i=eI(r[0]))||void 0===i?void 0:i.parents)?"parents":"source";if("source"===a){const e=[s.key],i=[];if(r.forEach(((t,r)=>{var a,o,l,h;const c=eI(t),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(s.key)){if(i.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||i.push(null!==(o=c.key)&&void 0!==o?o:c.index),e.includes(c.source)||e.push(c.source),!e.includes(c.target)){e.push(c.target);let t=n.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.target))){e.push(t.target);const i=n.find((e=>e.data[0].key===t.target));s.push(i.data[0].targetLinks)}})),void(t=s)}}}else if(c.target===s.key&&(i.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||i.push(null!==(h=c.key)&&void 0!==h?h:c.index),!e.includes(c.source))){e.push(c.source);let t=n.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.source))){e.push(t.source);const i=n.find((e=>e.data[0].key===t.source));s.push(i.data[0].targetLinks)}})),void(t=s)}}})),this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,s)=>{var n;const r=eI(e);i.includes(null!==(n=r.key)&&void 0!==n?n:r.index)?(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}else{const e=[s.key],i=s.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const i=e.parents,n=i.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);r.forEach(((n,r)=>{const o=eI(n),l=o.datum,h=l?l.filter((t=>t[a].some((t=>t.key===s.key)))):null,c=i.find((t=>t.source===o.source&&t.target===o.target));if(h&&h.length){e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target);const i=h.reduce(((t,e)=>t+e.value),0),s=i/o.value;return n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void XY(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:s})}if(c)return e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target),n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void XY(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:c.value/o.value});n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),n.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}this._needClear=!0},this._handleLinkRelatedClick=e=>{const i=this._nodeMark.getGraphics();if(!i||!i.length)return;const s=this._linkMark.getGraphics();if(!s||!s.length)return;if("source"===(eI(e)?"parents":"source"))this._linkMark&&s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&i.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)}));else{const n=eI(e),r=[n.source,n.target],a=[];Y(n.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));a.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=r:a.push({source:i,target:n,value:r})}})),s.forEach((e=>{const i=eI(e),s=i.datum;if(i.source===n.source&&i.target===n.target)return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void XY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1});const o=s?s.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(n.source)&&e.includes(n.target)})):null;if(o&&o.length){r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target);const s=o.filter((t=>t.parents.some(((e,i)=>{var s;return e.key===n.source&&(null===(s=t.parents[i+1])||void 0===s?void 0:s.key)===n.target})))).reduce(((t,e)=>t+e.value),0),a=s/i.value;return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void XY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:a})}const l=a.find((t=>t.source===i.source&&t.target===i.target));if(l)return r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void XY(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:l.value/i.value});e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(i,r)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}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:this._spec.categoryField)}initData(){var e,i,s,n;super.initData();const r=this.getViewData(),a=this.getRawData();if(a&&r){pI(this._dataSet,"sankeyLayout",OY),pI(this._dataSet,"sankeyFormat",RY),a.transform({type:"sankeyFormat"},!1),r.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.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(e=this._spec.nodeAlign)&&void 0!==e?e:"justify",nodeGap:null!==(i=this._spec.nodeGap)&&void 0!==i?i:8,nodeWidth:null!==(s=this._spec.nodeWidth)&&void 0!==s?s:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(n=this._spec.minNodeHeight)&&void 0!==n?n:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,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,inverse:this._spec.inverse},level:t.TransformLevel.sankeyLayout});const{dataSet:o}=this._option;pI(o,"sankeyNodes",IY),pI(o,"flatten",fY);const l=new Ba(o,{name:`sankey-node-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyNodes"}),l.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),l.transform({type:"addVChartProperty",options:{beforeCall:_F.bind(this),call:yF}},!1),this._nodesSeriesData=l,pI(o,"sankeyLinks",DY);const h=new Ba(o,{name:`sankey-link-${this.id}-data`});h.parse([this.getViewData()],{type:"dataview"}),h.transform({type:"sankeyLinks"}),h.transform({type:"addVChartProperty",options:{beforeCall:_F.bind(this),call:yF}},!1),this._linksSeriesData=h}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(KY.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(KY.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,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()}_initNodeMarkStyle(){var e,i;const s=this._nodeMark;s&&(this.setMarkStyle(s,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Mark),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.node.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByNode},"normal",t.AttributeLevel.User_Mark))}_initLinkMarkStyle(){var e,i;const s=this._linkMark;s&&(s.setGlyphConfig({direction:this.direction}),this.setMarkStyle(s,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.link.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByLink},"normal",t.AttributeLevel.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=tF(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={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;this._nodeMark&&this._nodeMark.setAnimationConfig(BF(null===(i=NR.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),PF("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(BF(null===(s=NR.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),PF("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:lI.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(e,i){e&&e.length&&e.forEach((e=>{e.removeState([t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]),i.includes(eI(e).key)?e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0):e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new FY(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_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&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new fR;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_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 LY(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),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]}getMarkData(t){return t.datum?y(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}KY.type=iR.sankey,KY.transformerConstructor=$Y,KY.mark=YY,KY.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const qY=()=>{$H(),dV(),Wk(),NR.registerGraphicComponent("path",(t=>Qg(t))),NR.registerMark(GY.type,GY),EV(),NR.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:jY(t,e)},OD))),NR.registerAnimation("sankeyLinkPath",((t,e)=>({appear:HY(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:LD.disappear.duration}}))),pw.registerBuiltInAnimate("linkPathGrowOut",VY),pw.registerBuiltInAnimate("linkPathGrowIn",NY),DD(),NR.registerSeries(KY.type,KY)},ZY=(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=fY(n);return i=uF([{latestData:r}],e),i};class JY extends cF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const QY=Object.assign(Object.assign({},SF),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),t$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class e$ extends zF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const i$=(t,e)=>{if(e.getViewBox()){const i=new QW(e).layout(t,e.getViewBox()),s=[];return xW(i,s,{maxDepth:null==e?void 0:e.maxDepth}),s.forEach(((t,i)=>{t&&[mF,"name"].forEach((i=>{t[i]=t.datum[t.depth][e.nameField]}))})),s}return[]};class s$ extends VF{constructor(){super(...arguments),this.type=iR.treemap,this.transformerConstructor=e$,this._categoryField="name",this._valueField="value",this._viewBox=new He,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:mF),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ue),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:mO},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,s,n;super.initData(),pI(this._dataSet,"treemap",i$),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{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}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(pI(this._rawData.dataSet,"addVChartProperty",sF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:bF.bind(this),call:xF}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=ZY([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=j(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){pI(this._dataSet,"hierarchyDimensionStatistics",ZY),pI(this._dataSet,"flatten",fY);const i=new Ba(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 SY(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(s$.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(s$.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}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()},t.STATE_VALUE_ENUM.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()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRichStyleOfLabelMark(e){"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(BF(null===(e=NR.getAnimationInKey("treemap"))||void 0===e?void 0:e(),PF(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 JY(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(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(nI.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(nI.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}s$.type=iR.treemap,s$.mark=QY,s$.builtInTheme={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"}}}},s$.transformerConstructor=e$,G(s$,bY),G(s$,MN);const n$=()=>{NR.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),NR.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),$H(),EV(),NR.registerAnimation("treemap",((t,e)=>({appear:t$(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:LD.disappear.duration}}))),DD(),NR.registerSeries(s$.type,s$)},r$=Object.assign(Object.assign({},GU),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),a$=Object.assign(Object.assign({},SF),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),o$={type:"fadeIn"};function l$(t,e){return"fadeIn"===e?o$:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class h$ extends zF{constructor(){super(...arguments),this._supportStack=!1}}class c$ extends cF{enableByType(t){return"dimension"!==t}}const d$="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",u$={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:d$,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:d$,fill:"#ddd"}}};class p$ extends YU{constructor(){super(...arguments),this.type=iR.gaugePointer,this.transformerConstructor=h$,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(p$.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},p$.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(p$.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(){this._tooltipHelper=new c$(this),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=K(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})}getInteractionTriggers(){return 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(BF(null===(i=NR.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),PF("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}p$.type=iR.gaugePointer,p$.mark=a$,p$.builtInTheme={gaugePointer:u$},p$.transformerConstructor=h$;const g$=()=>{NR.registerSeries(p$.type,p$),_N(),$H(),NR.registerAnimation("gaugePointer",((t,e)=>{const i=l$(t,e);return{appear:i,enter:i,disappear:{duration:LD.disappear.duration}}})),kU(),SU()};class f$ extends zF{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class m$ extends YU{constructor(){super(...arguments),this.type=iR.gauge,this.transformerConstructor=f$,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=ae(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();pI(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[IO]=t[this._angleField[0]],t[OO]=e>0?i[e-1][IO]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(m$.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(m$.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})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e&&"segment"===e.name){const i=this.getSpec().segment;if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}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),s=yt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?_R(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=yt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?_R(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return p(t[OO])?this.angleAxisHelper.dataToPosition([t[OO]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[IO]])}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(BF(null===(i=NR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),PF("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}m$.type=iR.gauge,m$.mark=r$,m$.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},m$.transformerConstructor=f$;class v$ extends AD{constructor(){super(...arguments),this.type=v$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Cg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="rect":a.symbolType=o,a}}v$.type="cell";function _$(t){return!1===t?{}:{type:"fadeIn"}}class y$ extends cF{enableByType(t){return"dimension"!==t}}const b$=Object.assign(Object.assign({},SF),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class x$ extends zF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class S$ extends VF{constructor(){super(...arguments),this.type=iR.heatmap,this.transformerConstructor=x$}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(S$.mark.cell,{isSeriesMark:!0},{morph:OF(this._spec,S$.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(S$.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){var e,i,s;t&&this.setMarkStyle(t,{fill:null!==(s=null===(i=null===(e=this._spec.cell)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s: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=ri(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]}}getInteractionTriggers(){return 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=NF(this);this._cellMark.setAnimationConfig(BF(null===(i=NR.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),PF("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 y$(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}S$.type=iR.heatmap,S$.mark=b$,S$.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1},label:{style:{lineWidth:2}}}},S$.transformerConstructor=x$;const A$=()=>{EV(),NR.registerMark(v$.type,v$),NR.registerGraphicComponent("symbol",Cg),Jk(),tM(),kB(),NR.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},OD),{appear:_$(e)}))),Aj(),yj(),NR.registerSeries(S$.type,S$)},k$=Object.assign(Object.assign({},SF),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),M$=`${dO}_CORRELATION_X`,T$=`${dO}_CORRELATION_Y`,w$=`${dO}_CORRELATION_SIZE`,C$=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,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=ae(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=ae(null!==(s=e.endAngle)&&void 0!==s?s:270),A=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),k=Pt(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=Pt(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+Pt(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+Pt(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=Bt(e.field),C=t.map(w),[E,B]=Rt(C),P=E===B?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(B-E),L=u(e.radiusField)?w:Bt(e.radiusField),R=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=>R;if(L){const[i,s]=L!==w?Rt(t.map(L)):[E,B],n=null!==(f=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==f?f:5,r=null!==(v=null===(m=e.radiusRange)||void 0===m?void 0:m[1])&&void 0!==v?v:5;i!==s&&(O=t=>n+(r-n)*(L(t)-i)/(s-i))}const I=Math.min(b,x),D=Math.max(b,x),F=E$(I,D,t.length),z=[],j=(D-I)/60;return t.forEach(((t,e)=>{const i=P(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),B$({x:n,y:r,size:s},z)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=j,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},B$=(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,[fO]:null==n?void 0:n[fO],[vO]:null==n?void 0:n[vO]}};class L$ extends cV{constructor(){super(...arguments),this.type=L$.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=vt(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}L$.type="ripple";const R$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class O$ extends zF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class I$ extends WV{constructor(){super(...arguments),this.type=iR.correlation,this.transformerConstructor=O$,this._viewBox=new He}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;pI(this._dataSet,"correlation",C$);const s=new Ea;gI(s,"dataview",Ta),pI(s,"correlationCenter",P$);const n=new Ba(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 _D(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_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(){const e=this._createMark(I$.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:fO});e&&(e.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._nodePointMark=e);const i=this._createMark(I$.mark.ripplePoint,{key:fO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(this._ripplePointMark=i);const s=this._createMark(I$.mark.centerPoint,{key:fO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});s&&(s.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._centerPointMark=s)}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[M$],y:t=>t[T$],size:t=>t[w$],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.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)},t.STATE_VALUE_ENUM.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(BF(null===(e=NR.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),PF("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(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}I$.type=iR.correlation,I$.mark=k$,I$.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},I$.transformerConstructor=O$;const D$=()=>{gz(),dV(),tM(),NR.registerMark(L$.type,L$),NR.registerGraphicComponent("symbol",(t=>Cg(t))),NR.registerSeries(I$.type,I$),NR.registerAnimation("correlation",((t,e)=>Object.assign({appear:R$(0,e)},RD)))},F$=Object.assign(Object.assign({},SF),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class z$ extends cV{constructor(){super(...arguments),this.type=z$.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}z$.type="liquid";const j$=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class H$ extends cF{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class N$ extends jF{constructor(){super(...arguments),this.type=iR.liquid,this.transformerConstructor=fz,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Ig({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Cg({x:s,y:n,size:r,symbolType:j$(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=wR(this._spec.outlineMargin),this._paddingSpec=wR(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Gt(...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(N$.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(N$.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(N$.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(N$.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.created(),this.setMarkStyle(e,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new H$(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(BF(null===(i=NR.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),PF("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(BF(null===(s=NR.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),PF("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=kM(t.attribute.fill,n.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]}}N$.type=iR.liquid,N$.mark=F$,N$.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},N$.transformerConstructor=fz;const V$=t=>Y(t).join(",");class U$ extends cF{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>V$(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>V$(null==t?void 0:t[this.series.getDimensionField()[0]])}}const W$=Object.assign(Object.assign({},SF),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class G$ extends zF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const Y$=(t,e)=>{const i=e.getViewBox();return i&&(null==t?void 0:t.length)?dG(Object.assign({setField:e.setField,valueField:e.valueField},i),t):[]};class $$ extends jF{constructor(){super(...arguments),this.type=iR.venn,this.transformerConstructor=G$,this._viewBox=new He}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:mO)}initData(){var t;super.initData(),pI(this._dataSet,"venn",Y$),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:{getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField}})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark($$.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark($$.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()},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},t.STATE_VALUE_ENUM.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=>V$(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)}},t.STATE_VALUE_ENUM.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=>V$(t.sets)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new U$(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(){super.onLayoutEnd(),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:V$(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return V$(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[V$(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(V$(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(BF(null===(e=NR.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),PF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(BF(null===(e=NR.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),PF(t.name,this._spec,this._markAttributeContext)))}))}}$$.type=iR.venn,$$.mark=W$,$$.builtInTheme={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"}}}}},$$.transformerConstructor=G$;class X$ extends JH{constructor(){super(...arguments),this.type=iR.mosaic,this.transformerConstructor=ZH}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(PO),this.setFieldX2(BO)),this.setFieldY(RO),this.setFieldY2(LO)):(t&&(this.setFieldY(PO),this.setFieldY2(BO)),this.setFieldX(RO),this.setFieldX2(LO)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&u(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];u(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}X$.type=iR.mosaic,X$.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},X$.transformerConstructor=ZH;class K$ extends Yj{_isValidSeries(t){return t===iR.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class q$ extends Wj{constructor(){super(...arguments),this.transformerConstructor=K$,this.type="map",this.seriesType=iR.map}}q$.type="map",q$.seriesType=iR.map,q$.transformerConstructor=K$;class Z$ extends Yj{_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,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],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 J$ extends Z${needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_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=wz(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,HR({},s,l)),n&&Object.assign(o,HR({},n,o))}}class Q$ extends Z${needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}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 tX extends Z${needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class eX extends Wj{constructor(){super(...arguments),this.transformerConstructor=tX}}eX.transformerConstructor=tX;class iX extends eX{constructor(){super(...arguments),this.transformerConstructor=tX,this.type="pie",this.seriesType=iR.pie}}iX.type="pie",iX.seriesType=iR.pie,iX.transformerConstructor=tX;class sX extends Q${_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return n.radius=null!==(e=t.radius)&&void 0!==e?e:Uz,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:Uz,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}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=>HR({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const nX=(t,e)=>{if(!t)return null;const i=iz(t,(t=>"angle"===t.getOrient()),e),s=iz(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&UC(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=$L({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=K(e),n=X(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=XL(d),f=null===(e=s[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 _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=tz(v,t,"polar",r);n.push({index:_,value:v,position:i.scale(v),axis:t,data:y})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&UC(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=$L({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=XL(c),g=null===(e=i[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=s.invert(p);if(u(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const _=tz(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:_})}})),n.length?n:null};class rX extends Wj{constructor(){super(...arguments),this.transformerConstructor=sX,this.type="rose",this.seriesType=iR.rose}_setModelOption(){this._modelOption.getDimensionInfo=nX}}rX.type="rose",rX.seriesType=iR.rose,rX.transformerConstructor=sX,G(rX,Zj);class aX extends Q${_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t);return i.line=t.line,i.point=t.point,i.stack=t.stack,i.percent=t.percent,i.area=HR({visible:!1},t.area),i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"area",i.activePoint=t.activePoint,i.pointDis=t.pointDis,i.pointDisMul=t.pointDisMul,i.markOverlap=t.markOverlap,i}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=>HR({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class oX extends Wj{constructor(){super(...arguments),this.transformerConstructor=aX,this.type="radar",this.seriesType=iR.radar}_setModelOption(){this._modelOption.getDimensionInfo=nX}}oX.type="radar",oX.seriesType=iR.radar,oX.transformerConstructor=aX,G(oX,Zj);class lX extends Yj{_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=>{L(e,"trimPadding")&&HR(e,VI(this.type,t))})),this._transformAxisSpec(t)}}class hX extends Wj{constructor(){super(...arguments),this.transformerConstructor=lX,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=oH(t,e,i))&&void 0!==s?s:[],...null!==(n=nX(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=hH,this._modelOption.getRectByDimensionData=fH}}hX.type="common",hX.transformerConstructor=lX,G(hX,Zj);class cX extends $j{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class dX extends Wj{constructor(){super(...arguments),this.transformerConstructor=cX}}dX.transformerConstructor=cX,G(dX,Zj);class uX extends cX{transformSpec(t){super.transformSpec(t),jI(t)}}class pX extends dX{constructor(){super(...arguments),this.transformerConstructor=uX,this.type="histogram",this.seriesType=iR.bar}_setModelOption(){this._modelOption.getDimensionInfo=oH,this._modelOption.getDimensionInfoByValue=hH,this._modelOption.getRectByDimensionData=fH}}pX.type="histogram",pX.seriesType=iR.bar,pX.transformerConstructor=uX;class gX extends J${_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class fX extends Wj{constructor(){super(...arguments),this.transformerConstructor=gX,this.type="circularProgress",this.seriesType=iR.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=nX}}fX.type="circularProgress",fX.seriesType=iR.circularProgress,fX.transformerConstructor=gX,G(fX,Zj);class mX extends J${_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=iR.circularProgress,e}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===iR.gauge||t.type===iR.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===iR.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 vX extends Wj{constructor(){super(...arguments),this.transformerConstructor=mX,this.type="gauge",this.seriesType=iR.gaugePointer}}vX.type="gauge",vX.seriesType=iR.gaugePointer,vX.transformerConstructor=mX;class _X extends Yj{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class yX extends Wj{constructor(){super(...arguments),this.transformerConstructor=_X,this.type="wordCloud",this.seriesType=iR.wordCloud}}yX.transformerConstructor=_X;class bX extends yX{constructor(){super(...arguments),this.transformerConstructor=_X,this.type="wordCloud",this.seriesType=iR.wordCloud}}bX.type="wordCloud",bX.seriesType=iR.wordCloud,bX.transformerConstructor=_X;class xX extends Yj{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class SX extends Wj{constructor(){super(...arguments),this.transformerConstructor=xX,this.type="funnel",this.seriesType=iR.funnel}}SX.type="funnel",SX.seriesType=iR.funnel,SX.transformerConstructor=xX;class AX extends $j{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}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=wz(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=wz(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class kX extends Wj{constructor(){super(...arguments),this.transformerConstructor=AX,this.type="linearProgress",this.seriesType=iR.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=oH,this._modelOption.getDimensionInfoByValue=hH,this._modelOption.getRectByDimensionData=fH}}kX.type="linearProgress",kX.seriesType=iR.linearProgress,kX.transformerConstructor=AX,G(kX,Zj);class MX extends $j{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"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),jI(t)}}class TX extends Wj{constructor(){super(...arguments),this.transformerConstructor=MX,this.type="rangeColumn",this.seriesType=iR.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=oH,this._modelOption.getDimensionInfoByValue=hH,this._modelOption.getRectByDimensionData=fH}}TX.type="rangeColumn",TX.seriesType=iR.rangeColumn,TX.transformerConstructor=MX;class wX extends Yj{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+oe(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class CX extends Wj{constructor(){super(...arguments),this.transformerConstructor=wX,this.type="sunburst",this.seriesType=iR.sunburst}}CX.type="sunburst",CX.seriesType=iR.sunburst,CX.transformerConstructor=wX;class EX extends Yj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class BX extends Wj{constructor(){super(...arguments),this.transformerConstructor=EX,this.type="circlePacking",this.seriesType=iR.circlePacking}}BX.type="circlePacking",BX.seriesType=iR.circlePacking,BX.transformerConstructor=EX;class PX extends Yj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class LX extends Wj{constructor(){super(...arguments),this.transformerConstructor=PX,this.type="treemap",this.seriesType=iR.treemap}}LX.type="treemap",LX.seriesType=iR.treemap,LX.transformerConstructor=PX;class RX extends tN{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),jI(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class OX extends eN{constructor(){super(...arguments),this.transformerConstructor=RX,this.type="waterfall",this.seriesType=iR.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=oH,this._modelOption.getDimensionInfoByValue=hH,this._modelOption.getRectByDimensionData=fH}}OX.type="waterfall",OX.seriesType=iR.waterfall,OX.transformerConstructor=RX;class IX extends $j{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),jI(t)}}class DX extends Wj{constructor(){super(...arguments),this.transformerConstructor=IX,this.type="boxPlot",this.seriesType=iR.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=oH,this._modelOption.getDimensionInfoByValue=hH,this._modelOption.getRectByDimensionData=fH}}DX.type="boxPlot",DX.seriesType=iR.boxPlot,DX.transformerConstructor=IX;class FX extends Yj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class zX extends Wj{constructor(){super(...arguments),this.transformerConstructor=FX,this.type="sankey",this.seriesType=iR.sankey}_setStateInDatum(t,e,i,s){const n=y(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=eI(t))||void 0===e?void 0:e.datum;return y(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}zX.type="sankey",zX.seriesType=iR.sankey,zX.transformerConstructor=FX;class jX extends $j{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.area=t.area,s.point=t.point,s.line=t.line,"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),jI(t)}}class HX extends Wj{constructor(){super(...arguments),this.transformerConstructor=jX,this.type="rangeArea",this.seriesType=iR.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=oH,this._modelOption.getDimensionInfoByValue=hH,this._modelOption.getRectByDimensionData=fH}}HX.type="rangeArea",HX.seriesType=iR.rangeArea,HX.transformerConstructor=jX;class NX extends $j{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class VX extends Wj{constructor(){super(...arguments),this.transformerConstructor=NX,this.type="heatmap",this.seriesType=iR.heatmap}}VX.type="heatmap",VX.seriesType=iR.heatmap,VX.transformerConstructor=NX;class UX extends Yj{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class WX extends Wj{constructor(){super(...arguments),this.transformerConstructor=UX,this.type="correlation",this.seriesType=iR.correlation}}WX.type="correlation",WX.seriesType=iR.correlation,WX.transformerConstructor=UX;function GX(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=QO(t.style)),P(t.textStyle)||HR(s.textStyle,QO(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&QO(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&QO(s.background.style),s}const YX=(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},$X=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const u={};c.forEach((t=>{u[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:vO;return h?h(t,c,g):(y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===u[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===u[t.source]&&!0===u[t.target])))):p(g)&&(t=t.filter((t=>!0===u[r.getSeriesFieldValue(t,g)]))),t)};class XX extends Kz{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:()=>{qL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),qL(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=xR(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()}_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):(U(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new _D(this._option,e),this._initSelectedData(),qL(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(qL(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)U(s,this._cacheAttrs)||this._legendComponent.setAttributes(HR({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(HR({},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;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());U(t,this._cacheAttrs)||this._legendComponent.setAttributes(HR({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}XX.specKey="legends";class KX extends XX{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return eF(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),qL(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){pI(this._option.dataSet,"discreteLegendFilter",$X),pI(this._option.dataSet,"discreteLegendDataMake",YX);const t=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return qL(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(!Zy(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=HO(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 s=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:n={},item:r={},pager:a={},background:o={}}=t;n=I(n),r=I(r),a=I(a),o=I(o);const l=s;return n.visible?l.title=GX(n):l.title={visible:!1},P(r.focusIconStyle)||QO(r.focusIconStyle),r.shape&&(r.shape=qO(r.shape)),r.label&&(r.label=qO(r.label)),r.value&&(r.value=qO(r.value)),r.background&&(r.background=qO(r.background)),SR(r.maxWidth)&&(r.maxWidth=Number(r.maxWidth.substring(0,r.maxWidth.length-1))*i.width/100),SR(r.width)&&(r.width=Number(r.width.substring(0,r.width.length-1))*i.width/100),SR(r.height)&&(r.height=Number(r.height.substring(0,r.height.length-1))*i.width/100),l.item=r,"scrollbar"===a.type?(P(a.railStyle)||QO(a.railStyle),P(a.sliderStyle)||QO(a.sliderStyle)):(P(a.textStyle)||QO(a.textStyle),a.handler&&qO(a.handler)),l.pager=a,o.visible&&!P(o.style)&&(HR(l,o.style),p(o.padding)&&(l.padding=o.padding)),l}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return nL}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(ZP.legendItemClick,(i=>{const s=L(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(ZP.legendItemHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(ZP.legendItemUnHover,(e=>{const i=L(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}=tF(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=tF(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}KX.specKey="legends",KX.builtInTheme={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}},KX.type=r.discreteLegend;const qX=(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[]},ZX=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=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(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?KO(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};const JX={color:hL,size:dL},QX={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}},tK=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},QX),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},eK={horizontal:tK(!0),vertical:tK(!1)},iK=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},QX),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},sK={horizontal:iK(!0),vertical:iK(!1)},nK=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],rK=[2,10];class aK extends XX{static getSpecInfo(t){const e=eF(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}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(e){super.init(e),qL(this._regions,(e=>{e.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:e.isHierarchyData,customFilter:this._spec.customFilter},level:t.TransformLevel.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(){pI(this._option.dataSet,"continuousLegendFilter",ZX),pI(this._option.dataSet,"continuousLegendDataMake",qX);const t=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>ZL(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=HO(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!Zy(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=HO(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()),P(a)&&(a="color"===this._legendType?nK:rK);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=HR({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:d={},type:u,id:g,visible:f,orient:m,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=GX(s):w.title={visible:!1},w.showHandler=!1!==n.visible,P(n.style)||(w.handlerStyle=QO(n.style)),p(r.width)&&(w.railWidth=r.width),p(r.height)&&(w.railHeight=r.height),P(r.style)||(w.railStyle=QO(r.style)),P(a.style)||(w.trackStyle=QO(a.style)),w.startText=qO(o),w.endText=qO(l),w.handlerText=qO(h),P(c)||(w.sizeBackground=QO(c)),d.visible&&!P(d.style)&&(HR(w,d.style),p(d.padding)&&(w.padding=d.padding)),w}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return JX[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",xt((i=>{const s=L(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}aK.specKey="legends",aK.builtInTheme={colorLegend:eK,sizeLegend:sK},aK.type=r.continuousLegend;const oK=(t,e)=>p(e)?t.map((t=>e[t])):void 0,lK=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),hK=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function cK(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),d=i.getOption(),g=d.getRegionsInUserIdOrIndex(p(c.regionId)?[c.regionId]:void 0,p(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=dK(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),_=g.getLayoutRect(),y=d.globalInstance.getContainer(),b=Object.assign({x:0,y:0},y?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(y):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>lK(i,s)(t)&&lK(n,r)(t)&&(u(a)||lK([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),A=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),_.width),y:Math.min(Math.max(t.y,0),_.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.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 l=[{value:t[e.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=>x(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=d.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:oI.chart,event:A({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=d.globalInstance;return KD.globalConfig.uniqueTooltip&&KD.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=d.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:oI.chart,event:A(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=d.globalInstance;return KD.globalConfig.uniqueTooltip&&KD.hideTooltip(a.id),m}return"none"}const dK=(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(),f=p(g)?t[g]:void 0,m=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=oK(c,t);let _=oK(d,t);const y=hK(_),b=!y&&p(g)&&u(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(lK(c,v));if(!y&&(_=oK(d,i),!hK(_)))return;const n=e.type===iR.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:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=UC(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(lK(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=oK(d,o),!hK(_))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(lK(c,n));if(!y&&(_=oK(d,r),!hK(_)))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:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===iR.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(lK(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(_=oK(d,i),!hK(_))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&&(()=>{var i,n,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(lK(c,v));const o=e.getNameMap(),l=null===(r=null===(n=e.getMapViewData)||void 0===n?void 0:n.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=_;if(l&&!a&&(a=Object.assign({},t)),!y){if(_=oK(d,a),h=_,!hK(_)&&!a)return;hK(_)||(_=[null])}const p=e.dataToPosition(a);u(p)||isNaN(p.x)||isNaN(p.y)||s.push({pos:p,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:h,hasMeasureData:y,groupField:g,groupData:f,originDatum:a},series:e})})()})),s},uK=t=>p(t)&&!y(t),pK=t=>p(t)&&y(t);class gK extends Xz{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i,s,n;const{spec:r,theme:a}=super._initTheme(t,e);return r.style=HR({},this._theme,r.style),r.offset=HR({},a.offset,t.offset),r.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:a.transitionDuration,r.trigger=null!==(s=t.trigger)&&void 0!==s?s:a.trigger,r.triggerOff=null!==(n=t.triggerOff)&&void 0!==n?n:a.triggerOff,{spec:r,theme:a}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(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]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:$y(this._option.mode)||!Gy(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.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?_(t.parentElement)&&(t.parentElement=A_.getElementById(t.parentElement)):Gy(this._option.mode)&&(t.parentElement=null==Wy?void 0:Wy.body)}}const fK={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}};class mK extends Kz{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=gK,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=Gy(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&uK(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!u(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&KD.globalConfig.uniqueTooltip&&l&&KD.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;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;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:oI.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(null==r?void 0:r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:oI.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),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,this._enterable=!1;else{const t="canvas"===s?yH.canvas:yH.dom,n=NR.getComponentPluginInType(t);n||Ny("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,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=NR.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=Y(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(Yy(s)||$y(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,St(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===s||s.call(i)}else 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=cK(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_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(pK(t)){if(uK(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>JF(t,e[i])))}if(pK(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.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: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}getVisible(){return!1!==this._spec.visible}}mK.type=r.tooltip,mK.transformerConstructor=gK,mK.builtInTheme={tooltip:fK},mK.specKey="tooltip";var vK,_K;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(vK||(vK={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(_K||(_K={}));const yK={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class bK extends Kz{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=St((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},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.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{UC(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_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}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(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(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:lI.chart}:{source:oI.chart};y(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,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)}onBeforeRender(){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"}:Yy(e)||$y(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:oI.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:oI.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:oI.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=L(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{yK[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=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const u=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+u.left),o=Math.min(o,i-d+u.top),l=Math.max(l,e+t.getLayoutRect().width-c-u.right),h=Math.max(h,i+t.getLayoutRect().height-d-u.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_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)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_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 i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=L(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=L(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:d}=n,u=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:L(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{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||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}bK.specKey="crosshair";const xK={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}}}}};class SK extends bK{static getSpecInfo(t){return eF(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_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)}}_getDatumAtPoint(t,e){const i=UF(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){UF(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:WF(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();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 o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=JL(this._regions,"cartesian");e&&(cH(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=pH(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new lT(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new hT(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}SK.specKey="crosshair",SK.builtInTheme={crosshair:xK},SK.type=r.cartesianCrosshair;class AK extends bK{static getSpecInfo(t){return eF(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_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)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_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}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=JL(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&p(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=Tz(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=tF(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:he(d,a.getInnerRadius(),o),end:he(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=de(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=he(t,o,r),d=he(t,o,h),m=ve([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=vt(re.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new lT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new dT(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new uT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new cT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=ue(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}}(u):function(t){let e="center",i="middle";return e=(t=ue(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}}(g.startAngle),a="angle"===l?he(e,p[1]+m.offset,u):he(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}AK.specKey="crosshair",AK.builtInTheme={crosshair:xK},AK.type=r.polarCrosshair;const kK=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(u(o)||u(a))return t;const l=r(),h=y(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},MK=(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=>{let e=!1;return Y(r).every((i=>{t[i]>=a[0]&&t[i]<=$(a)&&(e=!0)})),e}:t=>{let e=!1;return Y(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},TK=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],d=[],g=[];let f=!1,m=!1;n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);p(null==t?void 0:t.max)&&p(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{u(h[t])&&(g.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(h[t[i]])&&(g.push(t[i]),h[t[i]]=0,c.push(t[i])),u(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const v=f?g:!1===r||m?g.sort(((t,e)=>t-e)):c;return v.forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),d.push(e)})),d},wK=(t,e,i)=>{const s=e.domain();if(NC(e.type))return i?s[0]+($(s)-s[0])*(1-t):s[0]+($(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+($(n)-n[0])*t;return e.invert(r)},CK=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&NC(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/($(n)-n[0])))},EK=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},BK=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}},PK=(t,e,i)=>"start"===t?"percent"===e&&p(i.start)||"value"===e&&p(i.startValue):"percent"===e&&p(i.end)||"value"===e&&p(i.endValue),LK=(t,e,i)=>{if(NC(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class RK{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})}constructor(t,e,i,s,n,r,a,o){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.initZoomEvent=()=>{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,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),d=Math.abs(this.getState().start-this.getState().end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=vt(this.getState().start+f,0,1),_=vt(this.getState().end-m,0,1);this._handleChange(Math.min(v,_),Math.max(v,_),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Vt(s/n)>=.5:Vt(n/s)>=.5;if(this._scrollAttr.reverse||(r=-r),a){const t=this._spec.scrollStep;if(k(t)){r=(r>0?1:-1)*(t*(this.getState().end-this.getState().start)/1)}this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1)}const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))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.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===$F(YF(e))}setEventAttrFromSpec(){!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=j({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=j({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=j({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,c(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&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.getEvent(),this._option.mode)}}G(RK,MN);class OK extends Kz{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:CK(t,this._stateScale,this._isHorizontal),a="percent"===n?e:CK(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var e;this._dataFilterEvent.initZoomEvent(),null===(e=this._relatedAxisComponent)||void 0===e||e.event.on(t.ChartEvent.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_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)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=EK(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[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._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._currentDataCollection=[],this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=LK(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!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&&BK(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({value:"force"})}else qL(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),qL(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=YF(t),this._isHorizontal="horizontal"===$F(this._orient),this._dataFilterEvent=new RK(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){this._handleDataCollectionChangeBound=this._handleDataCollectionChange.bind(this),super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(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])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(NC(n.type)){const r=n.domain(),a=r[0],o=$(r)-a,l=p(t)?a+o*t:+e,h=p(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=p(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=p(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}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}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_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=>$F(t._orient)===$F(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!NC(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;}_collectDataInfo(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};qL(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l,u=NC(d.getScale(0).type),p=NC(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?Y(g.xField):Y(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?Y(g.yField):Y(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:d===l?f:m;u&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else qL(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});return{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}}_initData(){const{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}=this._collectDataInfo(),{dataSet:r}=this._option;gI(r,"dataview",Ta),pI(r,"dataFilterComputeDomain",TK);const a=new Ba(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new _D(this._option,a),a.reRunAllTransform(),this._currentDataCollection=t,r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChangeBound)}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(pI(this._option.dataSet,"dataFilterWithNewDomain",MK),pI(this._option.dataSet,"lockStatisticsFilter",kK),qL(this._regions,(e=>{e.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>e.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>NC(this._stateScale.type)},level:1},!1),e.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>NC(this._stateScale.type)},level:t.TransformLevel.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r}=this._collectDataInfo();if(this._currentDataCollection.length!==e.length||this._currentDataCollection.some(((t,i)=>t!==e[i]))){this._currentDataCollection.forEach((t=>{var e;null===(e=null==t?void 0:t.target)||void 0===e||e.removeListener("change",this._handleDataCollectionChangeBound)})),this._currentDataCollection=e;const{dataSet:t}=this._option;t.multipleDataViewAddListener(this._currentDataCollection,"change",this._handleDataCollectionChangeBound)}this._data.getDataView().transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data.getDataView().reRunAllTransform();const a=this._computeDomainOfStateScale(NC(this._stateScale.type));this._stateScale.domain(a,!1),(p(this._spec.start)||p(this._spec.end))&&this._setStateFromSpec(),this._handleChange(this._start,this._end,!0),this._spec.auto&&!U(this._domainCache,a)&&(this._domainCache=a,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;PK("start",i,this._spec)&&PK("end",s,this._spec)&&(t="percent"===i?this._spec.start:CK(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:CK(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?CK(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?CK(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=wK(this._start,this._stateScale,EK(i,this._isHorizontal)),this._endValue=wK(this._end,this._stateScale,EK(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,NC(this._stateScale.type)&&this._stateScale.domain()[0]!==$(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=LK(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&qL(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);k(null==i?void 0:i.min)&&k(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new PE:new cE,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_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?[K(t),X(t)]:[-1/0,1/0]}return e}_autoVisible(e){if(!this._auto)return;e?this.show():this.hide();const i=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[i]:e?this[`_${i}`]:0},{[i]:t.AttributeLevel.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_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=BK(h);if(!this._dataUpdating&&UC(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,UC(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),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}G(OK,MN);class IK extends Xz{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=HR({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}}}const DK=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),FK={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:DK(!1),startHandler:{style:{symbolType:"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;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"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;",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:DK(!0)};class zK extends OK{constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=IK,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=this._isHorizontal?0:this._middleHandlerSize,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=this._isHorizontal?0:this._middleHandlerSize,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._getPreviewStateScale(),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._getPreviewStateScale(),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"}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange)if(s&&this._component)this._component.setStartAndEnd(e,i);else{const s=this._relatedAxisComponent,r=wK(e,this._stateScale,EK(s,this._isHorizontal)),a=wK(i,this._stateScale,EK(s,this._isHorizontal));if(!p(r)||!p(a))return;this._start=e,this._end=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(){this._data.getDataView().reRunAllTransform();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new PE),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(EK(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=EK(t,this._isHorizontal),this.effect.onZoomChange())}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,d=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+d,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+d),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);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(),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=isNaN(c)?this._backgroundSize:c-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=isNaN(c)?this._backgroundSize:c-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,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new PE;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(EK(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[K(e),X(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!NC(t.type)||e[0]!==$(e))&&(!UC(t.type)||1!==(i=e,i&&y(i)?Array.from(new Set(Y(i))):i).length);var i}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_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:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_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._computeWidth(),height:this._computeHeight()},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,isReverse:EK(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=this._isHorizontal?this._stateScale:this._valueScale,i=this._isHorizontal?this._valueScale:this._stateScale,s=this._isScaleValid(e)&&this._isScaleValid(i)&&!1!==this._spec.showBackgroundChart,n=this._getAttrs(s),r=this._relatedAxisComponent;if(this._component)this._component.setAttributes(n),t&&(this._component.setPreviewData(this._data.getDataView().latestData),s&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>wK(t,this._stateScale,EK(r,this._isHorizontal))))));else{const t=this.getContainer();this._component=new JB(n),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?s&&this._component.setPreviewPointsY1(this._dataToPositionY2):s&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>wK(t,this._stateScale,EK(r,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:QO(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:QO(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:QO(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:QO(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:QO(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:QO(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:QO(g.style)},selectedBackgroundStyle:QO(this._spec.selectedBackground.style),dragMaskStyle:QO(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:HR(QO(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},QO(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:HR(QO(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},QO(null===(d=m.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}=tF(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(EK(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}}zK.type=r.dataZoom,zK.transformerConstructor=IK,zK.builtInTheme={dataZoom:FK},zK.specKey="dataZoom";const jK={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}};class HK extends OK{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"}_handleChange(e,i,s){super._handleChange(e,i,s);const n=NL(this._start,e)&&NL(this._end,i);if(this._shouldChange&&(!n||!1===this._spec.realTime)){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=wK(e,this._stateScale,!1),r=wK(i,this._stateScale,!1);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,n,r):this._handleStateChange(n,r))&&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(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r,a;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,minSliderSize:null===(a=this._spec)||void 0===a?void 0:a.minSliderSize},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new pM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=QO(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=QO(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}HK.type=r.scrollBar,HK.builtInTheme={scrollBar:jK},HK.specKey="scrollBar";const NK=(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},VK=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),UK={title:{visible:!0,autoLimit:!1,autoFit:!1,style:VK("l1FontSize","primaryFontColor")},content:{visible:!0,style:VK("l2FontSize","tertiaryFontColor")}};class WK extends Kz{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){return eF(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}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))}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(eI(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(eI(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){pI(this._option.dataSet,"indicatorFilter",NK);const t=new Ba(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 _D(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:i,height:s}=t.getLayoutRect(),{x:n,y:r}=t.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,u=e(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return Y(o).forEach((t=>{const e=HR({},this._theme.content,t);g.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({},JO(H(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?ER(l,this._computeLayoutRadius()):0,dy:h?ER(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!p(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},JO(H(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},u)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)U(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new gL(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_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.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}WK.type=r.indicator,WK.builtInTheme={indicator:UK},WK.specKey="indicator";const GK=["sum","average","min","max","variance","standardDeviation","median"];function YK(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=K(s),r=X(s);return er}function $K(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&YK(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=SR(t.x)?ZK(t.x,n)+r.x:JK(l.getXAxisHelper(),[t.x])+r.x,h}function XK(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&YK(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=SR(t.y)?ZK(t.y,n)+r.y:JK(l.getYAxisHelper(),[t.y])+r.y,h}function KK(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&YK(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)),JK(a.angleAxisHelper,[t.angle])}function qK(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&YK(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)),JK(a.radiusAxisHelper,[t.radius])}function ZK(t,e){return Number(t.substring(0,t.length-1))*e/100}function JK(t,e){const i=t.getScale(0);return NC(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function QK(t){return GK.includes(t)}function tq(t,e,i,s,n,r=!1){const a=e.getRegion(),o=a.getLayoutStartPoint(),l=i.getRegion(),h=l.getLayoutStartPoint(),c=Math.abs(Math.min(o.x,h.x)-Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width)),d=Math.abs(Math.min(o.y,h.y)-Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height)),u={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},g=[],f=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper(),v=s.getYAxisHelper(),_=m.getScale(0).domain(),y=v.getScale(0).domain(),b=r&&!m.isContinuous&&!!m.getBandwidth,x=r&&!v.isContinuous&&!!v.getBandwidth,S={min:null,max:null},A={min:null,max:null};return f.forEach((t=>{const e=p(t.x),i=p(t.y);let s,r;if(e&&i)s=$K(t,_,n,u,c,o),r=XK(t,y,n,u,d,o),eq(s,b,S,g.length),eq(r,x,A,g.length),g.push([{x:s,y:r}]);else if(e){s=$K(t,_,n,u,c,o),r=Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height);const e=Math.min(o.y,h.y);eq(s,b,S,g.length),g.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(o.x,h.x),r=XK(t,y,n,u,d,o);const e=Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width);eq(r,x,A,g.length),g.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(g,m,v,S,A),g}function eq(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=KK(t,l,n,r),i=qK(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=KK(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=qK(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function sq(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:f}=u.getLayoutRect();let m=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(m=SR(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=SR(i)?Number(i.substring(0,i.length-1))*f/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])&&YK(_,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])&&YK(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:JK(d.getXAxisHelper(),b)+p.x+m,y:JK(d.getYAxisHelper(),x)+p.y+v})})),n}function nq(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])&&YK(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])&&YK(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:JK(l.angleAxisHelper,d),radius:JK(l.radiusAxisHelper,u)})})),s}function rq(t,e,i){let{x:s,y:n}=t;return SR(s)&&(s=ZK(s,e)),SR(n)&&(n=ZK(n,i)),{x:s,y:n}}function aq(t,e,i){let s;if(s=d(t)?Y(t(e.getData().getLatestData(),e)):Y(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=rq(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>rq(t,n,r)))}function oq(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 lq(t,i,s){const{labelBackground:n={},style:r,shape:a}=t,o=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},QO(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},cq(QO(n.style),i,s)),p(n.padding)&&(t.padding=ri(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=cq(QO(r),i,s)),t}return{visible:!1}}function hq(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function cq(t,e,i){return d(t)?t(e,i):t}function dq(t,e){return d(t)?t(e):t}function uq(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 pq(t){return{isXProcess:p(t.x),isYProcess:p(t.y),isX1Process:p(t.x1),isY1Process:p(t.y1),isAngleProcess:p(t.angle),isRadiusProcess:p(t.radius),isAngle1Process:p(t.angle1),isRadius1Process:p(t.radius1),isCoordinatesProcess:p(t.coordinates),isValidProcess:p(t.process)}}function gq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=pq(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:h&&(!c||"process"in t&&"xy"in t.process)}}function fq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=pq(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function mq(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function vq(t,i){let s;if(i.coordinates){const t=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=t,o=e(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(d(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=Y(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;p(r)&&(c=Y(i)[r]),n&&Y(i).includes(n)&&(c=n);let d=s;p(l)&&(d=Y(s)[l]),a&&Y(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),_(t[c])&&QK(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),_(t[d])&&QK(t[d])?h.y={field:d,aggrType:t[d]}:h.y=Y(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;p(r)&&(a=Y(s)[r]),n&&Y(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),_(t[a])&&QK(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),_(t[l])&&QK(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=Y(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const s=e.x;y(s)?i.x=s.map((i=>yq(i,t,e))):i.x=yq(s,t,e)}if(p(e.y)){const s=e.y;y(s)?i.y=s.map((i=>yq(i,t,e))):i.y=yq(s,t,e)}if(p(e.angle)){const s=e.angle;y(s)?i.angle=s.map((i=>yq(i,t,e))):i.angle=yq(s,t,e)}if(p(e.radius)){const s=e.radius;y(s)?i.radius=s.map((i=>yq(i,t,e))):i.radius=yq(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=yq(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const _q={min:(t,e)=>VL(t[0].latestData,e.field),max:(t,e)=>UL(t[0].latestData,e.field),sum:function(t,e){return WL(t[0].latestData,e.field)},average:function(t,e){return GL(t[0].latestData,e.field)},variance:function(t,e){return YL(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(YL(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 yq(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(m(t)){const{aggrType:i,field:s}=t;return _q[i](e,{field:s})}return t}function bq(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 xq extends Kz{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){return eF(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_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)&&QK(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){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Ea;return e.registerParser("array",s),new Ba(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)))}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=JL(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){u(this._spec.offsetX)||(this._layoutOffsetX=kR(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=kR(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();pI(this._option.dataSet,"markerAggregation",vq),pI(this._option.dataSet,"markerFilter",bq);const i=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),i.target.on("change",(()=>{this._markerLayout()})),this._markerData=i}}function Sq(t,e){return function(t,e,i){const{predict:s}=Dt(t,(t=>t[e]),(t=>t[i])),n=VL(t,e),r=UL(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class Aq extends xq{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}=gq(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;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={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},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:cq(QO(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>lq(t,this._markerData,this._markAttributeContext))),state:{line:hq(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:hq(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:hq(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return hq(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return hq(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:cq(QO(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:cq(QO(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||Y(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=oq([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=Y(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,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}=gq(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;pI(this._option.dataSet,"markerAggregation",vq),pI(this._option.dataSet,"markerRegression",Sq),pI(this._option.dataSet,"markerFilter",bq);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new Ba(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",(()=>{this._markerLayout()})),this._markerData=m}}Aq.specKey="markLine";const kq=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),Mq={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"}}},refY:5},Tq={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:kq(!1),endSymbol:kq(!0),label:Mq};class wq extends Aq{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new FP(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:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:_}=gq(e);let y=[];if(u||f||g||m||v||a&&l||a&&h){const t=tq(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=sq(i,r,d,e.coordinatesOffset):c&&(y=aq(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n;const r=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const n=this._startRelativeSeries,a=this._endRelativeSeries,{multiSegment:o,mainSegmentIndex:l}=this._spec.line||{},{connectDirection:h,expandDistance:c=0}=this._spec;let d;if(SR(c)){const t=n.getRegion(),e=t.getLayoutStartPoint(),i=a.getRegion(),s=i.getLayoutStartPoint();if("bottom"===h||"top"===h){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));d=Number(c.substring(0,c.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));d=Number(c.substring(0,c.length-1))*n/100}}else d=c;const{points:u,limitRect:g}=r;if(!u||u.length<2)return void(null===(t=this._markerComponent)||void 0===t||t.setAttributes(r));const f=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}(u[0],u[1],h,d);let m;m=o&&p(l)?{position:"middle",autoRotate:!1}: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)}:{}}(u[0],u[1],h,d));const v=Y((null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{}).label),_=Y(r.label),y=Y(this._spec.label);null===(s=this._markerComponent)||void 0===s||s.setAttributes({points:o?[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]]]:f,label:_.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=m.dx)&&void 0!==i?i:0,h=null!==(s=m.dy)&&void 0!==s?s:0;const c=null!==(n=y[e])&&void 0!==n?n:y[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),m),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=v[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:g,multiSegment:o,mainSegmentIndex:l,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(n=this._markerComponent)||void 0===n||n.setAttributes(r)}_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}=gq(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 Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&p(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&p(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&p(n.process.xy)){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}}}wq.type=r.markLine,wq.coordinateType="cartesian",wq.builtInTheme={markLine:Tq};class Cq extends Aq{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=gq(this._spec);return e||i?new HP(t):new FP(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}=gq(e);let p=[],g={};const f={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=iq(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:f}:{points:p.map((t=>he(f,t.radius,t.angle)))}}else u&&(p=nq(i,r,a),g={points:p.map((t=>he(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=gq(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}}}Cq.type=r.polarMarkLine,Cq.coordinateType="polar",Cq.builtInTheme={polarMarkLine:Tq};class Eq extends Kz{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=xR(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return eF(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}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;if(!1===this._spec.visible)return{visible:!1};const a=this.getLayoutRect(),o=kR(this._spec.width,a.width,null,a.width),l=kR(this._spec.maxWidth,a.width,null,a.width),h=Math.max(Math.min(o,l,a.width),0),c=p(this._spec.text)&&""!==this._spec.text,d=p(this._spec.subtext)&&""!==this._spec.subtext,u=Object.assign(Object.assign({},H(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:c?this._spec.text:void 0,subtextType:null!==(e=this._spec.subtextType)&&void 0!==e?e:"text",subtext:d?this._spec.subtext:void 0,x:null!==(i=this._spec.x)&&void 0!==i?i:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:h,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(n=this._spec.align)&&void 0!==n?n:"left",verticalAlign:null!==(r=this._spec.verticalAlign)&&void 0!==r?r:"top",textStyle:Object.assign({maxLineWidth:h},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:h},this._spec.subtextStyle)});if(c&&(u.textStyle.width=h),d&&(u.subtextStyle.width=h),p(this._spec.width)){const t=Math.max(Math.min(o,a.width),0);c?u.textStyle.width=t:delete u.textStyle.width,d&&(u.subtextStyle.width=t)}return u}_createOrUpdateTitleComponent(t){if(this._titleComponent)U(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new uL(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}}Eq.type=r.title,Eq.specKey=r.title,Eq.builtInTheme={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"}}}};class Bq extends xq{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=fq(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={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:cq(QO(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>lq(t,this._markerData,this._markAttributeContext))),state:{area:hq(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>hq(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return hq(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||Y(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=oq([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=Y(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=Y(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,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}=fq(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}Bq.specKey="markArea";const Pq={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"}}}}};class Lq extends Bq{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new jP(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=fq(i),d=p(i.positions),u=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=tq(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=tq(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=sq(s,a,u,i.coordinatesOffset):d&&(f=aq(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=fq(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}}}Lq.type=r.markArea,Lq.coordinateType="cartesian",Lq.builtInTheme={markArea:Pq};class Rq extends Bq{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=fq(this._spec);return i||e||s?new NP(t):new jP(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}=fq(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=iq(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=nq(i,r,c),u={points:d.map((t=>he(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=fq(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}}}Rq.type=r.polarMarkArea,Rq.coordinateType="polar",Rq.builtInTheme={polarMarkArea:Pq};const Oq=t=>QO(Object.assign({},t)),Iq=t=>Object.assign(Object.assign({},t),{style:Object.assign({},QO(t.style))}),Dq=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=Oq(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=Oq(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:{},QO(Object.assign({},y)));var y;const b=Iq(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=Iq(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=Iq(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=Iq(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),k=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,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},Fq=t=>"left"===t||"right"===t,zq=t=>"top"===t||"bottom"===t,jq={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:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,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:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class Hq extends Kz{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({},Dq(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({},Dq(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?U(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new CL(t):this._playerComponent=new PL(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=Fq(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=Fq(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.autoPlayCallback=()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback),this._option.globalInstance.on(t.ChartEvent.rendered,this.autoPlayCallback),this._playerComponent.addEventListener(SL.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(SL.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(SL.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(SL.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(SL.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(SL.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}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=Fq(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=zq(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}_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)):Fq(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))):zq(this._orient)?this._maxSize():t.height}_computeDx(t){return Fq(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return zq(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(e){const i=this._specs[e];this._option.globalInstance.updateFullData(i.data),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})}release(){this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback)}}Hq.builtInTheme={player:jq},Hq.specKey="player",Hq.type=r.player;class Nq extends Kz{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,U(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=cR({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:Y(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==YI.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&u(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}Nq.type=r.label;class Vq extends CV{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}render(){}}Vq.type="text",Vq.constructorType="label";const Uq=()=>{EV(),NR.registerMark(Vq.constructorType,Vq)};class Wq extends Xz{_initTheme(t,e){return{spec:t,theme:this._theme}}}class Gq extends Nq{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=Wq,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.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(nI.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(nI.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),qL(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{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),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,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=HR({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},$N(h,r),Object.assign(Object.assign(Object.assign({},H(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[EO])):t=>t.filter((t=>t.data[CO]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?XN(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=y(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=Y(i())[t])}))}return e}}Gq.type=r.label,Gq.specKey="label",Gq.transformerConstructor=Wq;class Yq extends Nq{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()}reInit(t){super.reInit(t),this._initTextMark()}_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[TO]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return HR({textStyle:{pickable:!0===this._spec.interactive},position:$q(t,this._baseMark.type,a),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=>"bottom"===a?t.data[EO]:t.data[CO]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>XN({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function $q(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}Yq.type=r.totalLabel,Yq.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},Yq.specKey="totalLabel";class Xq extends xq{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=mq(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,f,m,v,_,y,b,x,S,A,k,M,T,w,C,E,B,P,L,R,O;const{itemContent:I={},itemLine:D={},targetSymbol:F={}}=this._spec,z=I,{type:H="text",text:N,symbol:V,image:U,richText:W,customMark:G,textStyle:Y,symbolStyle:$,imageStyle:X,richTextStyle:K,customMarkStyle:q,style:Z={},state:J={}}=z,Q=e(z,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let tt=null,et=null,it={};"text"===H?(tt=null!==(t=null==N?void 0:N.state)&&void 0!==t?t:J,it={dx:0,dy:0},et=lq(Object.assign(Object.assign({},N),{style:j(it,null!==(n=null!==(s=null!==(i=null==N?void 0:N.style)&&void 0!==i?i:null==N?void 0:N.textStyle)&&void 0!==s?s:Y)&&void 0!==n?n:Z)}),this._markerData,this._markAttributeContext)):"richText"===H?(tt=null!==(r=null==W?void 0:W.state)&&void 0!==r?r:J,it={width:100,height:100},et=cq(j(it,null!==(o=null!==(a=null==W?void 0:W.style)&&void 0!==a?a:K)&&void 0!==o?o:Z),this._markerData,this._markAttributeContext)):"symbol"===H?(tt=null!==(l=null==V?void 0:V.state)&&void 0!==l?l:J,it={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},et=QO(cq(j(it,null!==(c=null!==(h=null==V?void 0:V.style)&&void 0!==h?h:$)&&void 0!==c?c:Z),this._markerData,this._markAttributeContext))):"image"===H?(tt=null!==(d=null==U?void 0:U.state)&&void 0!==d?d:J,it={width:80,height:80},et=cq(j(it,null!==(p=null!==(u=null==U?void 0:U.style)&&void 0!==u?u:X)&&void 0!==p?p:Z),this._markerData,this._markAttributeContext)):"custom"===H&&(tt=null!==(g=null==G?void 0:G.state)&&void 0!==g?g:J,et=cq(null!==(m=null!==(f=null==G?void 0:G.style)&&void 0!==f?f:q)&&void 0!==m?m:Z,this._markerData,this._markAttributeContext));const st={zIndex:this.layoutZIndex,interactive:null===(v=this._spec.interactive)||void 0===v||v,hover:null===(_=this._spec.interactive)||void 0===_||_,select:null===(y=this._spec.interactive)||void 0===y||y,position:{x:0,y:0},clipInRange:null!==(b=this._spec.clip)&&void 0!==b&&b,itemContent:Object.assign(Object.assign({type:H,offsetX:dq(I.offsetX,this._relativeSeries.getRegion()),offsetY:dq(I.offsetX,this._relativeSeries.getRegion())},Q),{style:cq(et,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(x=F.offset)&&void 0!==x?x:0,visible:null!==(S=F.visible)&&void 0!==S&&S,size:null!==(A=F.size)&&void 0!==A?A:20,style:cq(F.style,this._markerData,this._markAttributeContext)},state:{line:hq(null!==(M=null===(k=this._spec.itemLine.line)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),lineStartSymbol:hq(null!==(w=null===(T=this._spec.itemLine.startSymbol)||void 0===T?void 0:T.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),lineEndSymbol:hq(null!==(E=null===(C=this._spec.itemLine.endSymbol)||void 0===C?void 0:C.state)&&void 0!==E?E:{},this._markerData,this._markAttributeContext),itemContent:hq(tt,this._markerData,this._markAttributeContext),textBackground:hq(null===(P=null===(B=this._spec.itemContent.text)||void 0===B?void 0:B.labelBackground)||void 0===P?void 0:P.state,this._markerData,this._markAttributeContext),targetItem:hq(null!==(R=null===(L=this._spec.targetSymbol)||void 0===L?void 0:L.state)&&void 0!==R?R:{},this._markerData,this._markAttributeContext)},animation:null!==(O=this._spec.animation)&&void 0!==O&&O,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:nt,line:rt={}}=D,at=e(D,["visible","line"]);st.itemLine=!1!==nt?Object.assign(Object.assign({},at),{visible:!0,lineStyle:QO(rt.style)}):{visible:!1};return new UP(st)}_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}=oq([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:uq(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:uq(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}=mq(t);(p(t.coordinate)||e||i||s)&&this._initCommonDataView()}}Xq.specKey="markPoint";const Kq={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}};class qq extends Xq{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=p(s.x)&&p(s.y),o=p(s.coordinate),l=p(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=tq(n,r,r,r,h))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=sq(n,r,h,s.coordinatesOffset)[0]:l&&(c=aq(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=mq(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}}}qq.type=r.markPoint,qq.coordinateType="cartesian",qq.builtInTheme={markPoint:Kq};class Zq extends Xq{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=iq(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:he({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}])]}}}Zq.type=r.polarMarkPoint,Zq.coordinateType="polar",Zq.builtInTheme={polarMarkPoint:Kq};class Jq extends Xq{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}])]}}}Jq.type=r.geoMarkPoint,Jq.coordinateType="geo",Jq.builtInTheme={geoMarkPoint:Kq};const Qq="inBrush",tZ="outOfBrush";class eZ extends Kz{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._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return eF(t,this.specKey,this.type,(t=>!1!==t.visible))}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),Qq,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),tZ,t.AttributeLevel.Series))}))}))}_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()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){p(this._spec.regionId)||p(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_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)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild()}_shouldEnableInteractive(){return!1!==this.getOption().getCompiler().getOption().interactive}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new IL(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:QO(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),this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(EL.brushActive,(s=>{this._initMarkBrushState(i,tZ),this._emitEvent(t.ChartEvent.brushActive,e,s)})),a.addEventListener(EL.drawStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener(EL.moveStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener(EL.drawing,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener(EL.moving,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener(EL.brushClear,(s=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)})),a.addEventListener(EL.drawEnd,(s=>{var n;this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:r}=s.detail,{updateElementsState:a=!0}=this._spec;if(null===(n=this._spec)||void 0===n?void 0:n.onBrushEnd)!0===this._spec.onBrushEnd(s)?(this.clearGraphic(),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)):(this._spec.onBrushEnd(s),this._emitEvent(t.ChartEvent.brushEnd,e,s));else{const i=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&i.length>0||!a)&&this._setAxisAndDataZoom(r,e),this._emitEvent(t.ChartEvent.brushEnd,e,s)}})),a.addEventListener(EL.moveEnd,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:s}=i.detail,{updateElementsState:n=!0}=this._spec,r=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&r.length>0||n)&&this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e,i)}))}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a],interactive:this._shouldEnableInteractive()}}_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({},QO(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail;this._operateMask=i;const{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e,i){var s;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},vchart:null===(s=this._option)||void 0===s?void 0:s.globalInstance,event:i})}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(i.addState(Qq,!0),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(i.removeState(Qq),i.addState(tZ,!0),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:_=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(_.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(i.addState(Qq,!0),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(i.removeState(Qq),i.addState(tZ,!0),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Be(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;s.removeState(Qq),s.removeState(tZ),i&&s.addState(i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_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?"width":"height",p=r?o:h,g=r?l:c;if(this._axisDataZoomMap[t.id]){const i=this._axisDataZoomMap[t.id],s=(p-e.getLayoutStartPoint()[d])/e.getLayoutRect()[u],n=(g-e.getLayoutStartPoint()[d])/e.getLayoutRect()[u],r=this._stateClamp(s-a),o=this._stateClamp(n+a);i.setStartAndEnd(Math.min(r,o),Math.max(r,o),["percent","percent"]),this._zoomRecord.push({operateComponent:i,start:r,end:o,startValue:wK(r,i.stateScale,EK(i.relatedAxisComponent,i.isHorizontal)),endValue:wK(o,i.stateScale,EK(i.relatedAxisComponent,i.isHorizontal))})}else{const i=t.getScale().range(),s=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],r=$(i){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}clearBrushStateAndMask(){this._relativeRegions.forEach(((t,e)=>{this._initMarkBrushState(e,""),this._brushComponents[e].children[0].removeAllChild()}))}}eZ.type=r.brush,eZ.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},eZ.specKey="brush";class iZ extends Kz{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}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;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${dO}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=BF({},PF(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(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)}))),p(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,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 He).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new He;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),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}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}iZ.type=r.customMark,iZ.specKey="customMark";class sZ{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._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=>{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=>nZ(t))),a=n.filter((t=>!nZ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>nZ(t))),h=o.filter((t=>!nZ(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 nZ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}sZ.type="grid";const rZ="vchart-tooltip",aZ=`${rZ}-container`,oZ=`${rZ}-title`,lZ=`${rZ}-content-box`,hZ={offsetX:10,offsetY:10},cZ="99999999999999";function dZ(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const uZ=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,pZ=t=>_(t)&&""!==(null==t?void 0:t.trim())||S(t)?dZ(t):"",gZ=(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},fZ={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},mZ=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=fZ[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class vZ extends Az{constructor(){super(...arguments),this._visible=!0,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._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const _=e.event,{activeType:y,data:b}=t,x="dimension"===y?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:M}=this._option,T=m[y],w=rF(null==T?void 0:T.position,b,e),C=null!==(r=rF(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===y?"mark":"pointer",{width:E=0,height:B=0}=null!=i?i:{},P="canvas"===m.renderMode,L=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==L?void 0:L.width)&&void 0!==o?o:uO,O=null!==(l=null==L?void 0:L.height)&&void 0!==l?l:pO;let I=!1;const D={width:0,height:0};let F,z={x:0,y:0},j={x:0,y:0},H=1,N=1;const V=Gy(this._env);if(V&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=R,D.height=O),V&&!P){const t=this._getParentElement(m);j=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-j.x,y:F.y-j.y},H=uZ(e,F),N=uZ(t,j)}const U=N/H,W={},G={x:w,y:w},Y={x:["left","right"],y:["top","bottom"]},$=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?A:M;if("mark"===i){I=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){I=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(I){const e=Y[n][0],i="x"===n?E:B;switch(mZ(t,n)){case-2:W[e]=a-i*U-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*U/2;break;case-1:W[e]=(a+o)/2-i*U-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*U-c;break;case 2:W[e]=o+c}}},X=["x","y"];if(g(w))if(g(K=w)&&(p(K.left)||p(K.right)||p(K.top)||p(K.bottom))){const{left:t,right:e,top:i,bottom:s}=w;W.left=gZ(t,_),W.top=gZ(i,_),W.right=gZ(e,_),W.bottom=gZ(s,_)}else(t=>g(t)&&(p(t.x)||p(t.y)))(w)&&X.forEach((t=>{const e=w[t];S(e)||d(e)?W[Y[t][0]]=gZ(e,_):$(e,t)}));else p(w)&&($({orient:w,mode:C},"x"),$({orient:w,mode:C},"y"));var K;const q={x:null,y:null};return X.forEach((t=>{var e;const i="x"===t?E:B,s="x"===t?R:O,n="x"===t?A:M,r=mZ(G[t],t);if(k(W[Y[t][0]]))q[t]=W[Y[t][0]];else if(k(W[Y[t][1]]))q[t]=s-i*U-W[Y[t][1]];else{const e="x"===t?_.canvasX:_.canvasY;q[t]=r>0?e+n:0===r?e-i*U/2:e-i*U-n}q[t]*=H,V&&(q[t]+=z[t]),q[t]/=N;const a="x"===t?D.width:D.height,o=m.confine?-(j[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/H)/N:-j[t]/N,l=a/N+o-i;2!==r&&q[t]l&&(q[t]=l)):-2!==r&&q[t]>l&&(I?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",yZ=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=_Z(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=_Z(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},bZ=(t={})=>{const{lineHeight:e}=t;return t.fontSize?kR(e,t.fontSize):0},xZ=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),p(r)&&(o=ri(r),a.padding=_Z(o)),{panelStyle:a,panelPadding:o}};function SZ(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}const AZ=t=>{NR.registerComponentPlugin(t.type,t)};class kZ extends vZ{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(kZ.type),this.type=yH.dom,this._tooltipContainer=null==Wy?void 0:Wy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(Wy&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:d,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=xZ(l),_={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(_.marginBottom=`${g}px`);const y={width:_Z(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=yZ(h),x=yZ(d),S=yZ(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),u(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),u(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),u(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),y[A]=_Z(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=_Z(null!==(s=d.spacing)&&void 0!==s?s:26),S[A]=_Z(null!==(n=p.spacing)&&void 0!==n?n:0);const M=Math.max(bZ(p),bZ(d));return _.lineHeight=M>0?`${M}px`:"20px",{panelPadding:v,row:_,panel:m,title:b,shape:y,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(oZ))),l=a.find((t=>t.className.includes(lZ)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(oZ),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(SZ(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${rZ}-column`),e.classList.add(`${rZ}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(lZ),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];SZ(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));SZ(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${rZ}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=pZ(e.key),e.keyStyle&&yZ(e.keyStyle,l)):"value"===i?(o.innerHTML=pZ(e.value),e.valueStyle&&yZ(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?dZ(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?dZ(c):m,y=p,b=t=>new wg({symbolType:t,size:y,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new He));let M=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const T=mh.IsGradientStr(u);if(!u||_(u)&&!T||d)return m=d?"none":u?dZ(u):"currentColor",`\n \n \n \n `;const w=T?mh.Parse(u):g(u)?u:null;if(w){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=w.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===w.gradient?t=`\n ${i}\n `:"linear"===w.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),SZ(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(lZ))),h=[...o.children].find((t=>t.className.includes(oZ)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(oZ)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=kR(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,SZ(l,c))}const u=l.children,g=[];if(u){for(let i=0;i{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},gf||(gf=uf.CreateGraphic("richtext",{})),gf.setAttributes(a),gf.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function wZ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:MZ),{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:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const CZ=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};class EZ extends vZ{constructor(){super(EZ.type),this.type=yH.canvas,this._attributes=null}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 HL({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}_getTooltipBoxSize(t,e){var i,s;if(!e||u(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");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:f,valueLabel:m,spaceRow:v,align:_}=l,y=ri(d.padding),b=wR(d.padding),x=wZ(Object.assign({textAlign:"right"===_?"right":"left"},u),i),S=wZ(Object.assign({textAlign:"right"===_?"right":"left"},f),i),A=wZ(m,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:CZ(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,enterable:h,transitionDuration:c,align:_},{title:T={},content:w=[]}=t;let C=b.left+b.right,E=b.top+b.bottom,B=0;const P=!!w.length;let L=0,R=0,O=0,I=0;if(P){const t=[],e=[],i=[],s=[];let n=0;M.content=w.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:M}=r,T={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=HR({},S,wZ(b,void 0,{})),{width:s,height:n,text:r}=TZ(h,i);T.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(m)){const t=HR({},A,wZ(x,void 0,{})),{width:e,height:s,text:n}=TZ(m,t);T.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};M?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,T.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else T.shape={visible:!1};return T.height=o,n+=o,aU.autoWidth&&!1!==U.multiLine;if(j){U=HR({},x,wZ(N,void 0,{})),W()&&(U.multiLine=null===(r=U.multiLine)||void 0===r||r,U.maxWidth=null!==(a=U.maxWidth)&&void 0!==a?a:P?Math.ceil(B):void 0);const{text:t,width:e,height:i}=TZ(H,U);M.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=U.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},U),{text:t}),D=M.title.value.width,F=M.title.value.height,z=F+(P?M.title.spaceRow:0)}return E+=z,M.title.width=D,M.title.height=F,W()?C+=B||D:C+=Math.max(D,B),P&&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-I-L-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})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_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{activeTooltipSpec: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()}}EZ.type=yH.canvas;const BZ=()=>{AZ(EZ)},PZ=(t="chart",e,i)=>{var s,n,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===(s=e.region)||void 0===s||s.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["region",e],type:"region"})}));else if("series"===t)f.modelType="series",f.specKey="series",null===(n=e.series)||void 0===n||n.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["series",e],type:t.type})}));else if(Object.values(iR).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=NR.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:s}=f,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&&s.type===t?f.modelInfo.push(Object.assign(Object.assign({},s),{spec:e})):e&&!1===e.visible&&f.modelInfo.push({type:t,spec:e})}))}else{const s=NR.getComponents().filter((({cmp:e})=>e.specKey===t)).map((({cmp:t})=>t.type));if(s.length>0){f.modelType="component";const n=t;f.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];i&&s.includes(i.type)&&f.modelInfo.push(Object.assign(Object.assign({},i),{spec:t}))}))}}return f},LZ=(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=PZ(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):DR(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const f=HR({},i),m=d(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:HR(f,m),hasChanged:!0};const i=HR({},t,m);FR(f,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},m);y(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}},RZ=t=>{NR.registerChartPlugin(t.type,t)};class OZ extends Az{constructor(){super(OZ.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[OZ.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[OZ.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)}onAfterModelSpecTransform(t,e,i,s){this._initialized&&"updateSpec"===s&&this.onBeforeInitChart(t,e,"setCurrentTheme")}onBeforeInitChart(t,e,i){if(!this._initialized)return;let s,n;switch(i){case"render":case"updateModelSpec":s=!1,n=!0;break;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=jR(this._option.globalInstance.getSpec(),["data",OZ.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=jR(this._baseChartSpec,["data",OZ.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=LZ(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=jR(i,["data",OZ.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()}}OZ.pluginType="chart",OZ.specKey="media",OZ.type="MediaQueryPlugin";const IZ=/\{([^}]+)\}/,DZ=/\{([^}]+)\}/g,FZ=/:/;class zZ extends Az{constructor(){super(zZ.type),this.type="formatterPlugin",this._timeModeFormat={utc:fi.getInstance().timeUTCFormat,local:fi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Ai.getInstance().format,this._numericSpecifier=Ai.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[zZ.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)),NR.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=IZ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(DZ,((t,i)=>{if(!FZ.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(bi.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):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}zZ.pluginType="chart",zZ.specKey="formatter",zZ.type="formatterPlugin";class jZ extends Az{constructor(){super(jZ.type),this.type="ChartResizeZoomPlugin",this._zoom=1,this._onWheel=t=>{t.preventDefault(),t.stopImmediatePropagation();const e=Math.pow(1.005,-t.deltaY*Math.pow(16,t.deltaMode)*.2*this._rate),i={x:t.offsetX,y:t.offsetY};this.zoom(e,i)}}onAfterInitChart(t,e){var i,s,n,r,a;const o=t.globalInstance,l=null!==(s=null===(i=o.getSpec())||void 0===i?void 0:i[jZ.specKey])&&void 0!==s?s:{enabled:!1};!0===l.enabled&&(this._minZoom=null!==(n=l.min)&&void 0!==n?n:.1,this._maxZoom=null!==(r=l.max)&&void 0!==r?r:10,this._rate=null!==(a=l.rate)&&void 0!==a?a:.1,this._container=o.getContainer(),this._triggerEvent=AN(t.globalInstance.getChart().getOption().mode).zoom,this._container&&this._triggerEvent&&this._container.addEventListener(this._triggerEvent,this._onWheel))}zoom(t,e){const i=this.service.globalInstance;if(!i)return;const s=this._zoom;let n=this._zoom*t;if(n<=this._minZoom&&t<1||n>=this._maxZoom&&t>1)if(n<=this._minZoom&&this._zoom>this._minZoom)n=this._minZoom;else{if(!(n>=this._maxZoom&&this._zoom{kH(),TH(),CH(),eH(),tH(),jj(),Bj(),uz(),gz(),zD(),ID(),Aj(),yj(),NR.registerSeries(Hj.type,Hj),NR.registerChart(EH.type,EH)},()=>{kH(),TH(),CH(),tH(),jj(),Bj(),uz(),LH(),gz(),IH(),Aj(),yj(),NR.registerSeries(FH.type,FH),eH(),NR.registerChart(jH.type,jH)},()=>{kH(),TH(),CH(),tH(),QH(),eH(),NR.registerChart(eN.type,eN)},()=>{kH(),TH(),eH(),tH(),dN(),NR.registerChart(pN.type,pN)},()=>{TH(),lU(),NR.registerChart(iX.type,iX)},()=>{kH(),TH(),eH(),tH(),TU(),NR.registerChart(rX.type,rX)},()=>{kH(),TH(),CH(),eH(),tH(),IU(),NR.registerChart(oX.type,oX)},()=>{kH(),TH(),CH(),eH(),tH(),QH(),NR.registerTransform("bin",Xr),NR.registerChart(pX.type,pX)},()=>{TH(),CN(),_N(),NR.registerSeries(BN.type,BN),NR.registerImplement("registerMap",_I),NR.registerImplement("unregisterMap",yI),DD(),NR.registerChart(q$.type,q$)},()=>{TH(),g$(),NR.registerSeries(m$.type,m$),iU(),qU(),SU(),QU(),NR.registerChart(vX.type,vX)},()=>{TH(),NG(),NR.registerChart(bX.type,bX)},()=>{TH(),oY(),NR.registerChart(SX.type,SX)},()=>{kH(),TH(),CH(),eH(),tH(),rV(),NR.registerChart(OX.type,OX)},()=>{kH(),TH(),eH(),tH(),wV(),NR.registerTransform("boxplot",Kr),NR.registerChart(DX.type,DX)},()=>{kH(),TH(),eH(),tH(),QU(),NR.registerChart(fX.type,fX)},()=>{kH(),TH(),eH(),tH(),aW(),NR.registerChart(kX.type,kX)},()=>{kH(),TH(),eH(),tH(),zV(),NR.registerChart(TX.type,TX)},()=>{kH(),TH(),CH(),eH(),tH(),LH(),Aj(),yj(),NR.registerSeries(UV.type,UV),NR.registerChart(HX.type,HX)},()=>{TH(),MY(),NR.registerChart(CX.type,CX)},()=>{TH(),PY(),NR.registerChart(BX.type,BX)},()=>{TH(),n$(),NR.registerChart(LX.type,LX)},()=>{TH(),bo.load(vM),qY(),NR.registerChart(zX.type,zX)},()=>{TH(),A$(),NR.registerChart(VX.type,VX)},()=>{TH(),D$(),NR.registerChart(WX.type,WX)},()=>{kH(),TH(),CH(),eH(),NR.registerChart(hX.type,hX),tH()},yj,Aj,()=>{NR.registerGraphicComponent(qz.lineAxis,((t,e)=>new CC(t,e))),NR.registerGraphicComponent(Zz.lineAxisGrid,((t,e)=>new zB(t,e))),ij(),NR.registerComponent(kj.type,kj)},()=>{NR.registerGraphicComponent(qz.lineAxis,((t,e)=>new CC(t,e))),NR.registerGraphicComponent(Zz.lineAxisGrid,((t,e)=>new zB(t,e))),ij(),NR.registerComponent(Mj.type,Mj)},()=>{NR.registerGraphicComponent(qz.lineAxis,((t,e)=>new CC(t,e))),NR.registerGraphicComponent(Zz.lineAxisGrid,((t,e)=>new zB(t,e))),ij(),NR.registerComponent(Tj.type,Tj)},kU,SU,()=>{NR.registerComponent(KX.type,KX)},()=>{NR.registerComponent(aK.type,aK)},()=>{NR.registerComponent(mK.type,mK)},()=>{NR.registerComponent(SK.type,SK)},()=>{NR.registerComponent(AK.type,AK)},()=>{NR.registerComponent(zK.type,zK)},()=>{NR.registerComponent(HK.type,HK)},()=>{NR.registerComponent(WK.type,WK)},CN,()=>{NR.registerComponent(wq.type,wq),DP()},()=>{NR.registerComponent(Lq.type,Lq),zP()},()=>{NR.registerComponent(qq.type,qq),VP()},()=>{NR.registerComponent(Cq.type,Cq),HP._animate=vP,DP()},()=>{NR.registerComponent(Rq.type,Rq),NP._animate=yP,zP()},()=>{NR.registerComponent(Zq.type,Zq),VP()},()=>{NR.registerComponent(Jq.type,Jq),VP()},()=>{NR.registerComponent(Eq.type,Eq)},()=>{NR.registerComponent(Hq.type,Hq)},()=>{NR.registerGraphicComponent(Gq.type,(t=>new OB(t))),Uq(),Qz(),NR.registerComponent(Gq.type,Gq,!0,1/0)},()=>{NR.registerGraphicComponent(Yq.type,(t=>new OB(t))),Uq(),Qz(),NR.registerComponent(Yq.type,Yq,!0)},()=>{NR.registerComponent(eZ.type,eZ)},()=>{NR.registerComponent(iZ.type,iZ)},()=>{bo.load(aT)},()=>{NR.registerLayout(sZ.type,sZ)},BZ,WD,$D]),KD.useRegisters([()=>{oA(bo)}]),t.AxisSyncPlugin=kz,t.CanvasTooltipHandler=EZ,t.ChartResizeZoomPlugin=jZ,t.DEFAULT_CHART_HEIGHT=pO,t.DEFAULT_CHART_WIDTH=uO,t.DEFAULT_CLOSE_STROKE_JOIN=JD,t.DEFAULT_DATA_INDEX=fO,t.DEFAULT_DATA_KEY=mO,t.DEFAULT_DATA_SERIES_FIELD=vO,t.DEFAULT_KEY=DO,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=ZD,t.DEFAULT_MAP_LOOK_UP_KEY=FO,t.DEFAULT_MEASURE_CANVAS_ID=gO,t.DEFAULT_SERIES_STYLE_NAME=_O,t.DEFAULT_SMOOTH_INTERPOLATE=qD,t.DomTooltipHandler=kZ,t.Factory=NR,t.FormatterPlugin=zZ,t.MOSAIC_CAT_END_PERCENT=RO,t.MOSAIC_CAT_START_PERCENT=LO,t.MOSAIC_VALUE_END_PERCENT=PO,t.MOSAIC_VALUE_START_PERCENT=BO,t.ManualTicker=class extends hw{constructor(t){super(t),this.lastFrameTime=0,this.status=Lo.RUNNING}setupTickHandler(){const t=new cw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===Lo.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Lo.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Lo.RUNNING,!0}},t.MediaQuery=OZ,t.PREFIX=dO,t.SEGMENT_FIELD_END=IO,t.SEGMENT_FIELD_START=OO,t.STACK_FIELD_END=xO,t.STACK_FIELD_END_OffsetSilhouette=MO,t.STACK_FIELD_END_PERCENT=AO,t.STACK_FIELD_KEY=yO,t.STACK_FIELD_START=bO,t.STACK_FIELD_START_OffsetSilhouette=kO,t.STACK_FIELD_START_PERCENT=SO,t.STACK_FIELD_TOTAL=TO,t.STACK_FIELD_TOTAL_BOTTOM=EO,t.STACK_FIELD_TOTAL_PERCENT=wO,t.STACK_FIELD_TOTAL_TOP=CO,t.StreamLight=class extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=So.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Ul,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=So.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_;const y=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(y){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:Ko.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(_=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==_?_:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:Ko.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=hl(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=hl(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(re.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(re.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;e{RZ(jZ)},t.registerDataSetInstanceParser=gI,t.registerDataSetInstanceTransform=pI,t.registerDomTooltipHandler=()=>{AZ(kZ)},t.registerFormatPlugin=()=>{RZ(zZ)},t.registerMediaQuery=()=>{RZ(OZ)},t.registerTheme=ZR,t.removeTheme=QR,t.themeExist=tO,t.themes=XR,t.token=RR,t.transformColorSchemeToStandardStruct=pR,t.transformToGraphic=QO,t.version="2.0.19",t.vglobal=A_,t.warn=Hy,Object.defineProperty(t,"__esModule",{value:!0})})); +let zG=class t extends TG{constructor(e){super(j({},t.defaultOptions,e)),this.fillGridAt=(t,e)=>{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,e=1,i){var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize: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=this.options.createCanvas({width:1,height:1}),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 f=p+2*g,m=3*g;const v=Math.ceil(f/this.gridSize),_=Math.ceil(m/this.gridSize);f=v*this.gridSize,m=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((f*Math.abs(Math.sin(h))+m*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((f*Math.abs(Math.cos(h))+m*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],B=(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--;)B(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}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=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,e=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){this.grid=[];const e=this.options.shape;if(g(e)){const i=((t,e,i,s,n=!1,r)=>{let{backgroundColor:a="#fff"}=t,{fill:o="#000"}=t;n&&([a,o]=[o,a]);const l=s||r({width:e,height:i,dpr:1}),h=l.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;h.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return h.fillStyle=a,h.fillRect(0,0,l.width,l.height),"text"===t.type?OG(t,o,l.width,l.height,h):"geometric"===t.type&&FG(t,o,l.width,l.height,h),l})(e,t.width,t.height,void 0,!1,this.options.createCanvas);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=((t,e,i)=>{const{threshold:s,invert:n=!1}=null!=e?e:{};if(!t||"#fff"===t)return(t,e,i)=>{const r=t.width;if(0===t.data[e*r*4+4*i+3])return!n;const a=t.data[e*r*4+4*i+0],o=t.data[e*r*4+4*i+1],l=t.data[e*r*4+4*i+2];if(255===a&&255===o&&255===l)return!n;if(k(s)){const t=.3*a+.59*o+.11*l;return n?t<=s:t>=s}return!1};const r=i({width:1,height:1}).getContext("2d",{willReadFrequently:!0});r.fillStyle=t,r.fillRect(0,0,1,1);const a=r.getImageData(0,0,1,1).data;return(t,e,i)=>{const s=t.width;return[0,1,2,3].every((r=>n?t.data[4*(e*s+i)+r]!==a[r]:t.data[4*(e*s+i)+r]===a[r]))}})(e.backgroundColor,void 0,this.options.createCanvas);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!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)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,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}=SG(this.options.shape,[e.width,e.height]);return 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),this.result=[],this.progressiveRun()}};zG.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class jG extends TG{constructor(t){super(j({},jG.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,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)}jG.defaultOptions={enlarge:!1};const VG={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},NG=(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?UG(t.fontFamily):"sans-serif",d=t.fontStyle?UG(t.fontStyle):"normal",u=t.fontWeight?UG(t.fontWeight):"normal",p=t.rotate?UG(t.rotate):0,g=UG(t.text),f=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",m=t.padding?UG(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?Object.assign(Object.assign({},VG),t.as):VG,M=t.depth_3d,T=t.postProjection;let w=t.fontSize?UG(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(w)){const t=w,e=GG(YG(t,l),C);w=i=>e(t(i))}let E=CG;"fast"===t.layoutType?E=jG:"grid"===t.layoutType&&(E=zG);const B=new E(Object.assign(Object.assign({},t),{text:g,padding:m,spiral:f,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:w,shrink:_,clip:b,enlarge:y,minFontSize:x,random:A,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:B}:B.output()},UG=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],WG=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),GG=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=WG(t[0]),n=WG(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(WG(t)-r)/(a-r)*(e[1]-e[0])+e[0]},YG=(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 $G(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.registerGrammarTransform("wordcloud",{transform:NG}),FN(),KR.registerAnimation("wordCloud",((t,e)=>({appear:MW(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{duration:HD.disappear.duration}}))),KR.registerSeries(XG.type,XG)},qG=(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:f=!1,isCone:m=!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===f?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?m?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},ZG=(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},JG=`${yO}_FUNNEL_TRANSFORM_RATIO`,QG=`${yO}_FUNNEL_REACH_RATIO`,tY=`${yO}_FUNNEL_HEIGHT_RATIO`,eY=`${yO}_FUNNEL_VALUE_RATIO`,iY=`${yO}_FUNNEL_LAST_VALUE_RATIO`,sY=`${yO}_FUNNEL_NEXT_VALUE_RATIO`,nY=`${yO}_FUNNEL_LAST_VALUE`,rY=`${yO}_FUNNEL_CURRENT_VALUE`,aY=`${yO}_FUNNEL_NEXT_VALUE`,oY=`${yO}_FUNNEL_TRANSFORM_LEVEL`;class lY extends _F{constructor(t){var e,i;super(t),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)?this._transformRatioText: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[QG])).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 this._transformRatioText;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]},this._transformRatioText=null!==(i=null===(e=t.getSpec())||void 0===e?void 0:e.transformRatioText)&&void 0!==i?i:"转化率"}}class hY extends PD{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class cY extends hY{constructor(){super(...arguments),this.type=cY.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}cY.type="polygon";const dY=()=>{KR.registerMark(cY.type,cY),Jk(),Yk(),pw.registerBuiltInAnimate("growPointsOut",cC),KR.registerGraphicComponent("polygon",hf)},uY=Object.assign(Object.assign({},BF),{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"}});class pY extends YF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class gY extends $F{constructor(){super(...arguments),this.type=cR.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=pY,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,i,s,n;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._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;xI(this._dataSet,"funnel",qG),xI(this._dataSet,"funnelTransform",ZG);const t=new Ba(this._dataSet,{name:`${yO}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new TD(this._option,t)}compile(){var t,e;super.compile(),this._funnelOuterLabelMark&&(null===(t=this._funnelOuterLabelMark.label)||void 0===t||t.compile({group:this._rootMark.getProduct()}),null===(e=this._funnelOuterLabelMark.line)||void 0===e||e.compile({group:this._rootMark.getProduct()}))}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}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:rY,asTransformRatio:JG,asReachRatio:QG,asHeightRatio:tY,asValueRatio:eY,asNextValueRatio:sY,asLastValueRatio:iY,asLastValue:nY,asNextValue:aY,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:oY}})}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},gY.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,noSeparateStyle:!0},{morph:NF(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},gY.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform,noSeparateStyle:!0}),this._funnelTransformMark&&this._funnelTransformMark.setData(this._viewDataTransform)),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(gY.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,markSpec:this._spec.outerLabel,noSeparateStyle:!0,parent:!1}),this._funnelOuterLabelMark.line=this._createMark(gY.mark.outerLabelLine,{themeSpec:e,markSpec:t,noSeparateStyle:!0,parent:!1})}}initTooltip(){this._tooltipHelper=new lY(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(){var e,i,s,n;const r=this._funnelMark;r&&this.setMarkStyle(r,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",t.AttributeLevel.Series);const a=this._funnelTransformMark;a&&this.setMarkStyle(a,{points:t=>this.getPoints(t)},"normal",t.AttributeLevel.Series);const o=this._funnelOuterLabelMark.label;o&&(this.setMarkStyle(o,{text:t=>`${t[this.getCategoryField()]}`,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),width:0,height:0},"normal",t.AttributeLevel.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(o,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",t.AttributeLevel.User_Mark));const l=this._funnelOuterLabelMark.line;if(l&&o){this.setMarkStyle(l,{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);const r=null!==(s=null===(i=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.line)||void 0===i?void 0:i.visible)&&void 0!==s?s:null===(n=this._spec.outerLabel)||void 0===n?void 0:n.visible;p(r)&&l.setVisible(r)}}initLabelMarkStyle(e){var i;if(!e)return;const s=e.getTarget(),n=e.getComponent();if(s===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);const s=this.getCompiler().getRootMarks();this._funnelOuterLabelMark.label&&zy(s,this._funnelOuterLabelMark.label,n),this._funnelOuterLabelMark.line&&zy(s,this._funnelOuterLabelMark.line,null!==(i=this._funnelOuterLabelMark.label)&&void 0!==i?i:n)}else this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=e,this.setMarkStyle(e,{text:t=>`${(100*oR(QG).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(zF(null===(s=KR.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.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.AABBBounds;return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),jF("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(zF(KR.getAnimationInKey("fadeInOut")(),jF(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(zF(KR.getAnimationInKey("funnel")({},o),jF(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(zF(null===(a=KR.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),jF("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[iY])/2:this._getSecondaryAxisLength(t[eY])/2,n=this._getSecondaryAxisLength(t[eY])/2):(s=this._getSecondaryAxisLength(t[eY])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[sY])/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[oY])}_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[kO]===t[kO]));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,a;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const o=this.getPoints(t),l=(Math.abs(o[0].x-o[1].x)+Math.abs(o[2].x-o[3].x))/2,h=this.getCategoryField(),c=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[h])===t[h]}),!0))||void 0===n?void 0:n.AABBBounds,d=c?c.x2-c.x1:0,u=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let p=this.getLayoutRect().width-Math.max(l,d);return"center"===this._funnelAlign&&(p/=2),p-u-(null!==(a=null===(r=this._spec.outerLabel)||void 0===r?void 0:r.spaceWidth)&&void 0!==a?a:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c;const d=this.getCategoryField(),u=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getGraphics())||void 0===s?void 0:s.find((e=>{var i;return(null===(i=e.context.data[0])||void 0===i?void 0:i[d])===t[d]})))||void 0===n?void 0:n.AABBBounds,p=null===(a=null===(r=this._labelMark)||void 0===r?void 0:r.getComponent())||void 0===a?void 0:a.getComponent(),g=null===(o=null==p?void 0:p.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[d])===t[d]}),!0))||void 0===o?void 0:o.AABBBounds,f=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{};let m,v,_,y;if(this._isHorizontal()){const e=null!==(h=f.spaceWidth)&&void 0!==h?h: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!==f.alignLabel?(null==u?void 0:u.y2)+e:_-e,m=this._getPolygonCenter(i).x,_-y{dY(),FN(),XV(),KR.registerSeries(gY.type,gY),KR.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},ND))),KR.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Yw,customParameters:(e,i)=>({animationType:"in",group:i,direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),WD()},mY=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},vY=t=>{const e=t.filter((t=>t.context.diffState===tD.update)),i=K(e.map((t=>{var e,i;return null===(i=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0].depth})));return e.filter((t=>{var e,s;return(null===(s=null===(e=null==t?void 0:t.context)||void 0===e?void 0:e.data)||void 0===s?void 0:s[0].depth)===i}))},_Y=(t,e,i)=>{if(P(t))return[e,i];const s=K(t.map((t=>1*t.getFinalAttribute().startAngle))),n=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[s,n]},yY=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=vY(i.parent.children),a=_Y(r,s,n);return mY(i.getFinalAttribute().startAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=vY(i.parent.children),a=_Y(r,s,n);return mY(i.getFinalAttribute().endAngle,a)*(n-s)+s},to:(t,e)=>e.getFinalAttribute().endAngle},outerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().outerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:(t,e)=>e.getFinalAttribute().innerRadius}}}),bY=t=>{const e=K(t.map((t=>1*t.getFinalAttribute().startAngle))),i=X(t.map((t=>1*t.getFinalAttribute().endAngle)));return[e,i]},xY=t=>({channel:{startAngle:{from:(t,e)=>e.getFinalAttribute().startAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=vY(i.parent.children),a=bY(r);return mY(i.getFinalAttribute().startAngle,a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getFinalAttribute().endAngle,to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=vY(i.parent.children),a=bY(r);return mY(i.getFinalAttribute().endAngle,a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getFinalAttribute().outerRadius,to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getFinalAttribute().innerRadius,to:()=>t.animationInfo().innerRadius}}}),SY=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},AY=(t,e={})=>{if(!t)return[];const i=[];return EW(t,i,e),i},kY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new sG(i).layout(t,{width:s,height:n})};class MY extends _F{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var TY;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(TY||(TY={}));const wY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===TY.DrillDown){return Y(eI(t,n,s,"children"))}if(i.type===TY.DrillUp){const e=iI(t,n,s,"children");if(e)return Y(e)}return t};class CY{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=PV(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;xI(t,"drillFilter",wY),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)||P(e))return e;const n=e[e.length-1];return this._drillInfo={key:n,path:e,type:TY.DrillDown},i().reRunAllTransform(),s.emit(t.ChartEvent.drill,{value:{path:e,type:TY.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)||P(r))return r;const a=r.pop();return this._drillInfo={key:a,path:r,type:TY.DrillUp},s().reRunAllTransform(),n.emit(t.ChartEvent.drill,{value:{path:r,type:TY.DrillUp},model:this}),r}}const EY=Object.assign(Object.assign({},BF),{sunburst:{name:"sunburst",type:"arc"}}),BY=(t,e,i)=>(t.push({key:e,operations:["values"]}),t.push({key:i,operations:["max","min"]}),t.push({key:AF,operations:["max","min","values"]}),t.push({key:kF,operations:["values"]}),t),PY={innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,gap:0,labelLayout:{align:"center",offset:0,rotate:"radial"},sunburst:{style:{lineWidth:1,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"}}}};class LY extends JN{constructor(){super(...arguments),this.type=cR.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:kF),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:kO},getRawData:()=>this.getRawData()}),this._startAngle=ae(this._spec.startAngle),this._endAngle=ae(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),xI(this._dataSet,"sunburstLayout",kY),xI(this._dataSet,"flatten",AY),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 BY(super.getStatisticFields(),this._categoryField,this._valueField)}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(xI(t.dataSet,"addVChartProperty",dF),t.transform({type:"addVChartProperty",options:{beforeCall:CF.bind(this),call:EF}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){if(!1===this._sunburst.visible)return;const t=this._createMark(LY.mark.sunburst,{isSeriesMark:!0});this._sunburstMark=t}_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()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(LY.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new MY(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(zF(null===(e=KR.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),jF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(zF(null===(e=KR.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),jF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),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]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}LY.type=cR.sunburst,LY.mark=EY,LY.builtInTheme={sunburst:PY},G(LY,CY);const RY=()=>{KR.registerSeries(LY.type,LY),cU(),FN(),WD(),KR.registerAnimation("sunburst",((t,e)=>({appear:SY(0,e),enter:yY(t),exit:xY(t),disappear:{duration:HD.disappear.duration}})))},OY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new GW(i).layout(t,{width:s,height:n})};class IY extends _F{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const DY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},FY=Object.assign(Object.assign({},BF),{circlePacking:{name:"circlePacking",type:"arc"}});class zY extends qF{constructor(){super(...arguments),this.type=cR.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:kF),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:kO},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),xI(this._dataSet,"circlePackingLayout",OY),xI(this._dataSet,"flatten",AY),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,valueField:this._valueField,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)||(xI(t.dataSet,"addVChartProperty",dF),t.transform({type:"addVChartProperty",options:{beforeCall:CF.bind(this),call:EF}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const e=this._createMark(zY.mark.circlePacking,{isSeriesMark:!0});this._circlePackingMark=e}_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},t.STATE_VALUE_ENUM.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(zY.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"},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}getStatisticFields(){return BY(super.getStatisticFields(),this._categoryField,this._valueField)}initTooltip(){this._tooltipHelper=new IY(this),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(zF(null===(i=KR.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),jF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(zF(null===(e=KR.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),jF(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(){super.onLayoutEnd(),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}zY.type=cR.circlePacking,zY.mark=FY,zY.builtInTheme={circlePacking:{layoutPadding:5,circlePacking:{visible:!0,style:{cursor:"pointer",lineWidth:1,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"}}}}},G(zY,CY);const jY=()=>{KR.registerSeries(zY.type,zY),cU(),FN(),UD(),KR.registerAnimation("circlePacking",((t,e)=>({appear:DY(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{duration:HD.disappear.duration}})))},HY=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&HY(t,e.children,i)}))},VY=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},NY=(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 tG(e),r=[];return r.push(n.layout(s,i)),r},UY=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:[]},WY=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 GY extends _F{constructor(){super(...arguments),this._getDimensionData=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},this.markTooltipValueCallback=t=>t.value}}const YY=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),$Y=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:YY(t),XY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class KY extends kw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s,a=this.target.getFinalAttribute();a&&Object.assign(this.target.attribute,a),this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}class qY extends kw{onBind(){var t,e,i;super.onBind(),(null===(t=this.params)||void 0===t?void 0:t.diffAttrs)&&this.target.setAttributes(this.params.diffAttrs);const{from:s,to:n}=((t,e,i)=>{const s={x0:t.getFinalAttribute().x0,x1:t.getFinalAttribute().x1,y0:t.getFinalAttribute().y0,y1:t.getFinalAttribute().y1,thickness:t.getFinalAttribute().thickness};return{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}})(this.target,this.params.options,this.params),r=null!==(i=null===(e=this.target.context)||void 0===e?void 0:e.lastAttrs)&&void 0!==i?i:s;this.props=n,this.propKeys=Object.keys(n).filter((t=>null!=n[t])),this.animate.reSyncProps(),this.from=r,this.to=n,this.target.setAttributes(r)}onUpdate(t,e,i){const s=this.target.attribute;this.propKeys.forEach((t=>{s[t]=this.from[t]+(this.to[t]-this.from[t])*e})),this.target.setAttributes(s)}}const ZY=(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,f=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",m=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}${f}L${a},${p}L${r},${u}${m}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${f}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${m}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${f}L${a},${p}C${c},${p},${h},${u},${r},${u}${m}Z`},JY=(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,f=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",m=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}${f}L${p},${a}L${u},${r}${m}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${f}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${m}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${f}L${p},${a}C${p},${c},${u},${h},${u},${r}${m}Z`};class QY extends _N{constructor(){super(...arguments),this.type=QY.type,this._subMarks={back:{type:"path",defaultAttributes:{zIndex:0}},front:{type:"path",defaultAttributes:{zIndex:1}}},this._positionChannels=["x0","y0","x1","y1","thickness","round","curvature","ratio","pathType","align","endArrow","startArrow","ratio"],this._channelEncoder={backgroundStyle:t=>({back:t})},this._positionEncoder=(t,e,i)=>{var s,n;const r=Object.assign(Object.assign({},i.attribute),t),a=null!==(s=r.direction)&&void 0!==s?s:null===(n=this._glyphConfig)||void 0===n?void 0:n.direction,o=["vertical","TB","BT"].includes(a)?JY:ZY,l="number"==typeof r.ratio&&r.ratio>=0&&r.ratio<=1;return{back:{path:l?o(r,1):""},front:{path:o(r,l?r.ratio:1)}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,x0:0,y0:0,x1:100,y1:100,thickness:1,round:!0})}}QY.type="linkPath";const t$=Object.assign(Object.assign({},BF),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class e$ extends YF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}const i$=(t,e,i,s=!0,n)=>{t.runtimeStateCache||(t.runtimeStateCache={}),t.runtimeStateCache[e]=i,t.hasState(e)&&t.removeState(e),t.addState(e,s,n)};class s$ extends qF{constructor(){super(...arguments),this.type=cR.sankey,this.transformerConstructor=e$,this._nodeLayoutZIndex=t.LayoutZIndex.Node,this._labelLayoutZIndex=t.LayoutZIndex.Label,this._viewBox=new He,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;const o=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(o)return o;if(p(this._spec.seriesField)){const e=null===(s=this._nodesSeriesData.latestData)||void 0===s?void 0:s.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,a=null===(r=null===(n=this._option)||void 0===n?void 0:n.globalScale)||void 0===r?void 0:r.getScale("color");return null==a?void 0:a.scale(null==i?void 0:i[this._spec.seriesField])}const l=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(a=this._colorScale)||void 0===a?void 0:a.scale(l)},this._handleEmphasisElement=t=>{var e;const i=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},s=t.item;"adjacency"===i.effect?s&&t.mark===this._nodeMark?this._handleNodeAdjacencyClick(s):s&&t.mark===this._linkMark?this._handleLinkAdjacencyClick(s):this._handleClearEmpty():"related"===i.effect&&(s&&t.mark===this._nodeMark?this._handleNodeRelatedClick(s):s&&t.mark===this._linkMark?this._handleLinkRelatedClick(s):this._handleClearEmpty())},this._handleClearEmpty=()=>{var e,i;if(!this._needClear)return;const s=null===(e=this._nodeMark)||void 0===e?void 0:e.getGraphics();if(!s||!s.length)return;const n=null===(i=this._linkMark)||void 0===i?void 0:i.getGraphics();n&&n.length&&(s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),n.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._needClear=!1)},this._handleNodeAdjacencyClick=e=>{const i=hI(e),s=[i.key];if(this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,n)=>{const r=hI(e);r.source===i.key?(s.includes(r.target)||s.push(r.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):r.target===i.key?(s.includes(r.source)||s.push(r.source),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleLinkAdjacencyClick=e=>{const i=hI(e),s=[i.source,i.target];if(this._linkMark){const i=this._linkMark.getGraphics();if(!i||!i.length)return;i.forEach((i=>{i===e?(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),i$(i,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1})):(i.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),i.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),s),this._needClear=!0},this._handleNodeRelatedClick=e=>{var i;const s=hI(e),n=this._nodeMark.getGraphics();if(!n||!n.length)return;const r=this._linkMark.getGraphics();if(!r||!r.length)return;const a=(null===(i=hI(r[0]))||void 0===i?void 0:i.parents)?"parents":"source";if("source"===a){const e=[s.key],i=[];if(r.forEach(((t,r)=>{var a,o,l,h;const c=hI(t),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(s.key)){if(i.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||i.push(null!==(o=c.key)&&void 0!==o?o:c.index),e.includes(c.source)||e.push(c.source),!e.includes(c.target)){e.push(c.target);let t=n.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.target))){e.push(t.target);const i=n.find((e=>e.data[0].key===t.target));s.push(i.data[0].targetLinks)}})),void(t=s)}}}else if(c.target===s.key&&(i.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||i.push(null!==(h=c.key)&&void 0!==h?h:c.index),!e.includes(c.source))){e.push(c.source);let t=n.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==t?void 0:t.length)>0;){const s=[];return t.forEach((t=>{var r,a;if(!i.includes(null!==(r=t.key)&&void 0!==r?r:t.index)&&(i.push(null!==(a=t.key)&&void 0!==a?a:t.index),!e.includes(t.source))){e.push(t.source);const i=n.find((e=>e.data[0].key===t.source));s.push(i.data[0].targetLinks)}})),void(t=s)}}})),this._linkMark){const e=this._linkMark.getGraphics();if(!e||!e.length)return;e.forEach(((e,s)=>{var n;const r=hI(e);i.includes(null!==(n=r.key)&&void 0!==n?n:r.index)?(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0)):(e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}else{const e=[s.key],i=s.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const i=e.parents,n=i.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);r.forEach(((n,r)=>{const o=hI(n),l=o.datum,h=l?l.filter((t=>t[a].some((t=>t.key===s.key)))):null,c=i.find((t=>t.source===o.source&&t.target===o.target));if(h&&h.length){e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target);const i=h.reduce(((t,e)=>t+e.value),0),s=i/o.value;return n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void i$(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:s})}if(c)return e.includes(o.source)||e.push(o.source),e.includes(o.target)||e.push(o.target),n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void i$(n,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:c.value/o.value});n.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),n.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._nodeMark&&this._highLightElements(this._nodeMark.getGraphics(),e)}this._needClear=!0},this._handleLinkRelatedClick=e=>{const i=this._nodeMark.getGraphics();if(!i||!i.length)return;const s=this._linkMark.getGraphics();if(!s||!s.length)return;if("source"===(hI(e)?"parents":"source"))this._linkMark&&s.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&i.forEach((e=>{e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE)}));else{const n=hI(e),r=[n.source,n.target],a=[];Y(n.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));a.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=r:a.push({source:i,target:n,value:r})}})),s.forEach((e=>{const i=hI(e),s=i.datum;if(i.source===n.source&&i.target===n.target)return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void i$(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:1});const o=s?s.filter((t=>{const e=t.parents.map((t=>t.key));return e.includes(n.source)&&e.includes(n.target)})):null;if(o&&o.length){r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target);const s=o.filter((t=>t.parents.some(((e,i)=>{var s;return e.key===n.source&&(null===(s=t.parents[i+1])||void 0===s?void 0:s.key)===n.target})))).reduce(((t,e)=>t+e.value),0),a=s/i.value;return e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void i$(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:a})}const l=a.find((t=>t.source===i.source&&t.target===i.target));if(l)return r.includes(i.source)||r.push(i.source),r.includes(i.target)||r.push(i.target),e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE),void i$(e,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,{ratio:l.value/i.value});e.removeState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS),e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)})),this._highLightElements(i,r)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}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:this._spec.categoryField)}initData(){var e,i,s,n;super.initData();const r=this.getViewData(),a=this.getRawData();if(a&&r){xI(this._dataSet,"sankeyLayout",NY),xI(this._dataSet,"sankeyFormat",VY),a.transform({type:"sankeyFormat"},!1),r.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.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(e=this._spec.nodeAlign)&&void 0!==e?e:"justify",nodeGap:null!==(i=this._spec.nodeGap)&&void 0!==i?i:8,nodeWidth:null!==(s=this._spec.nodeWidth)&&void 0!==s?s:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(n=this._spec.minNodeHeight)&&void 0!==n?n:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,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,inverse:this._spec.inverse},level:t.TransformLevel.sankeyLayout});const{dataSet:o}=this._option;xI(o,"sankeyNodes",UY),xI(o,"flatten",AY);const l=new Ba(o,{name:`sankey-node-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyNodes"}),l.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),l.transform({type:"addVChartProperty",options:{beforeCall:TF.bind(this),call:wF}},!1),this._nodesSeriesData=l,xI(o,"sankeyLinks",WY);const h=new Ba(o,{name:`sankey-link-${this.id}-data`});h.parse([this.getViewData()],{type:"dataview"}),h.transform({type:"sankeyLinks"}),h.transform({type:"addVChartProperty",options:{beforeCall:TF.bind(this),call:wF}},!1),this._linksSeriesData=h}}compileData(){var t,e;super.compileData(),null===(t=this._linkMark)||void 0===t||t.compileData(),null===(e=this._nodeMark)||void 0===e||e.compileData()}initMark(){this._rootMark.setMarkConfig({overflow:this._spec.overflow,interactive:!!this._spec.overflow});const t=this._createMark(s$.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData});t&&(t.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=t);const e=this._createMark(s$.mark.link,{dataView:this._linksSeriesData});e&&(this._linkMark=e)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.latestData,i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.latestData,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()}_initNodeMarkStyle(){var e,i;const s=this._nodeMark;s&&(this.setMarkStyle(s,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Mark),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.node.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByNode},"normal",t.AttributeLevel.User_Mark))}_initLinkMarkStyle(){var e,i;const s=this._linkMark;s&&(s.setGlyphConfig({direction:this.direction}),this.setMarkStyle(s,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(s,{fill:null!==(i=null===(e=this._spec.link.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this._fillByLink},"normal",t.AttributeLevel.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=lF(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={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;this._nodeMark&&this._nodeMark.setAnimationConfig(zF(null===(i=KR.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),jF("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(zF(null===(s=KR.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),jF("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData)||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData)||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:mI.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodeMark.getData().updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linkMark.getData().updateData()}_highLightElements(e,i){e&&e.length&&e.forEach((e=>{e.removeState([t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS]),i.includes(hI(e).key)?e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS,!0):e.addState(t.STATE_VALUE_ENUM.STATE_SANKEY_EMPHASIS_REVERSE,!0)}))}initTooltip(){this._tooltipHelper=new GY(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_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&&a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new AR;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_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 HY(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(){super.onLayoutEnd(),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]}getMarkData(t){return t.datum?y(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}s$.type=cR.sankey,s$.transformerConstructor=e$,s$.mark=t$,s$.builtInTheme={sankey:{link:{style:{fillOpacity:.15,round:!0}}}};const n$=()=>{eV(),yN(),Wk(),KR.registerGraphicComponent("path",(t=>Qg(t))),KR.registerMark(QY.type,QY),FN(),KR.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:$Y(t,e)},ND))),KR.registerAnimation("sankeyLinkPath",((t,e)=>({appear:XY(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{duration:HD.disappear.duration}}))),pw.registerBuiltInAnimate("linkPathGrowOut",qY),pw.registerBuiltInAnimate("linkPathGrowIn",KY),WD(),KR.registerSeries(s$.type,s$)},r$=(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=AY(n);return i=bF([{latestData:r}],e),i};class a$ extends _F{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const o$=Object.assign(Object.assign({},BF),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),l$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class h$ extends YF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}const c$=(t,e)=>{if(e.getViewBox()){const i=new oG(e).layout(t,e.getViewBox()),s=[];return EW(i,s,{maxDepth:null==e?void 0:e.maxDepth}),s.forEach(((t,i)=>{t&&[kF,"name"].forEach((i=>{t[i]=t.datum[t.depth][e.nameField]}))})),s}return[]};class d$ extends qF{constructor(){super(...arguments),this.type=cR.treemap,this.transformerConstructor=h$,this._categoryField="name",this._valueField="value",this._viewBox=new He,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:kF),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Ue),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:kO},getRawData:()=>this.getRawData()}),k(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){var t,e,i,s,n;super.initData(),xI(this._dataSet,"treemap",c$),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"treemap",options:{nameField:this._categoryField,valueField:this._valueField,getViewBox:()=>this._viewBox.empty()?null:{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}}),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}_runTreemapTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(xI(this._rawData.dataSet,"addVChartProperty",dF),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:CF.bind(this),call:EF}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=r$([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=j(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){xI(this._dataSet,"hierarchyDimensionStatistics",r$),xI(this._dataSet,"flatten",AY);const i=new Ba(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 BY(super.getStatisticFields(),this._categoryField,this._valueField)}initMark(){const t=this._createMark(d$.mark.nonLeaf,{isSeriesMark:!0});t&&(t.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=t);const e=this._createMark(d$.mark.leaf,{isSeriesMark:!0});e&&(e.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=e)}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()},t.STATE_VALUE_ENUM.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()},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series)}_initRichStyleOfLabelMark(e){"rich"===e.getTextType()&&this.setMarkStyle(e,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this._initRichStyleOfLabelMark(e))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(zF(null===(e=KR.getAnimationInKey("treemap"))||void 0===e?void 0:e(),jF(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 a$(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(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(uI.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(){super.onLayoutEnd(),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().enableAnimation()})),this.event.off(uI.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}d$.type=cR.treemap,d$.mark=o$,d$.builtInTheme={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"}}}},d$.transformerConstructor=h$,G(d$,CY),G(d$,RV);const u$=()=>{KR.registerGrammarTransform("filter",{transform:(t,e)=>null==e?void 0:e.filter(t.callback)}),KR.registerGrammarTransform("map",{transform:(t,e)=>(null==e||e.forEach(((e,i)=>{t.callback(e)})),e)}),eV(),FN(),KR.registerAnimation("treemap",((t,e)=>({appear:l$(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{duration:HD.disappear.duration}}))),WD(),KR.registerSeries(d$.type,d$)},p$=Object.assign(Object.assign({},QU),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),g$=Object.assign(Object.assign({},BF),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),f$={type:"fadeIn"};function m$(t,e){return"fadeIn"===e?f$:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class v$ extends YF{constructor(){super(...arguments),this._supportStack=!1}}class _$ extends _F{enableByType(t){return"dimension"!==t}}const y$="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",b$={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:y$,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:y$,fill:"#ddd"}}};class x$ extends tW{constructor(){super(...arguments),this.type=cR.gaugePointer,this.transformerConstructor=v$,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(x$.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},x$.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(x$.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(){this._tooltipHelper=new _$(this),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=K(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})}getInteractionTriggers(){return 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(zF(null===(i=KR.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),jF("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}x$.type=cR.gaugePointer,x$.mark=g$,x$.builtInTheme={gaugePointer:b$},x$.transformerConstructor=v$;const S$=()=>{KR.registerSeries(x$.type,x$),TV(),eV(),KR.registerAnimation("gaugePointer",((t,e)=>{const i=m$(t,e);return{appear:i,enter:i,disappear:{duration:HD.disappear.duration}}})),LU(),BU()};class A$ extends YF{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class k$ extends tW{constructor(){super(...arguments),this.type=cR.gauge,this.transformerConstructor=A$,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=ae(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();xI(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[UO]=t[this._angleField[0]],t[NO]=e>0?i[e-1][UO]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(k$.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(k$.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})}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),e}initMarkStyleWithSpec(e,i){if(super.initMarkStyleWithSpec(e,i),e&&"segment"===e.name){const i=this.getSpec().segment;if(i)for(const s in i.state||{})this.setMarkStyle(e,this.generateRadiusStyle(i.state[s]),s,t.AttributeLevel.User_Mark)}}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),s=yt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?TR(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t),s=yt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2));return this._spec.clamp?TR(s,this.angleAxisHelper.getScale(0)):s}_getAngleValueStartWithoutPadAngle(t){return p(t[NO])?this.angleAxisHelper.dataToPosition([t[NO]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[UO]])}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(zF(null===(i=KR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),jF("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}k$.type=cR.gauge,k$.mark=p$,k$.builtInTheme={gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}}},k$.transformerConstructor=A$;class M$ extends PD{constructor(){super(...arguments),this.type=M$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{fill:void 0,lineWidth:0,padding:0})}_createGraphic(t={}){return Cg(t)}_transformGraphicAttributes(t,e,i){var s,n,r;const a=super._transformGraphicAttributes(t,e,i),o=null!==(n=null!==(s=a.shape)&&void 0!==s?s:a.symbolType)&&void 0!==n?n:null===(r=t.attribute)||void 0===r?void 0:r.symbolType;return u(o)?a.symbolType="rect":a.symbolType=o,a}}M$.type="cell";function T$(t){return!1===t?{}:{type:"fadeIn"}}class w$ extends _F{enableByType(t){return"dimension"!==t}}const C$=Object.assign(Object.assign({},BF),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class E$ extends YF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class B$ extends qF{constructor(){super(...arguments),this.type=cR.heatmap,this.transformerConstructor=E$}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){this._cellMark=this._createMark(B$.mark.cell,{isSeriesMark:!0},{morph:NF(this._spec,B$.mark.cell.name),morphElementKey:this.getDimensionField()[0]}),this._backgroundMark=this._createMark(B$.mark.cellBackground)}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){var e,i,s;t&&this.setMarkStyle(t,{fill:null!==(s=null===(i=null===(e=this._spec.cell)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill)&&void 0!==s?s: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=ri(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]}}getInteractionTriggers(){return 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=KF(this);this._cellMark.setAnimationConfig(zF(null===(i=KR.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),jF("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 w$(this),this._cellMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._cellMark)}getDefaultShapeType(){return"rect"}getDimensionField(){return[].concat(this.fieldX,this.fieldY)}getMeasureField(){return this.getFieldValue()}getActiveMarks(){return[this._cellMark]}}B$.type=cR.heatmap,B$.mark=C$,B$.builtInTheme={heatmap:{cell:{style:{shape:"rect",fillOpacity:1}},cellBackground:{visible:!1},label:{style:{lineWidth:2}}}},B$.transformerConstructor=E$;const P$=()=>{FN(),KR.registerMark(M$.type,M$),KR.registerGraphicComponent("symbol",Cg),Jk(),tM(),kB(),KR.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},ND),{appear:T$(e)}))),Pj(),wj(),KR.registerSeries(B$.type,B$)},L$=Object.assign(Object.assign({},BF),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),R$=`${yO}_CORRELATION_X`,O$=`${yO}_CORRELATION_Y`,I$=`${yO}_CORRELATION_SIZE`,D$=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,f,m,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=ae(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=ae(null!==(s=e.endAngle)&&void 0!==s?s:270),A=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),k=Pt(null!==(n=e.innerRadius)&&void 0!==n?n:0,A),M=Pt(e.outerRadius,A),T=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+Pt(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+Pt(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],w=Bt(e.field),C=t.map(w),[E,B]=Rt(C),P=E===B?t=>(k+M)/2:t=>k+(M-k)*(t-E)/(B-E),L=u(e.radiusField)?w:Bt(e.radiusField),R=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=>R;if(L){const[i,s]=L!==w?Rt(t.map(L)):[E,B],n=null!==(f=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==f?f:5,r=null!==(v=null===(m=e.radiusRange)||void 0===m?void 0:m[1])&&void 0!==v?v:5;i!==s&&(O=t=>n+(r-n)*(L(t)-i)/(s-i))}const I=Math.min(b,x),D=Math.max(b,x),F=F$(I,D,t.length),z=[],j=(D-I)/60;return t.forEach(((t,e)=>{const i=P(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),z$({x:n,y:r,size:s},z)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=j,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},z$=(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,[AO]:null==n?void 0:n[AO],[MO]:null==n?void 0:n[MO]}};class H$ extends _N{constructor(){super(...arguments),this.type=H$.type,this._subMarks={ripple0:{type:"symbol",defaultAttributes:{fillOpacity:.75}},ripple1:{type:"symbol",defaultAttributes:{fillOpacity:.5}},ripple2:{type:"symbol",defaultAttributes:{fillOpacity:.25}}},this._positionChannels=["ripple","size"],this._positionEncoder=(t,e,i)=>{const{ripple:s=i.attribute.ripple,size:n=i.attribute.size}=t,r=vt(s,0,1),a=.5*n;return{ripple0:{size:n+a*r,fillOpacity:.75-.25*r},ripple1:{size:n+a*(1+r),fillOpacity:.5-.25*r},ripple2:{size:n+a*(2+r),fillOpacity:.25-.25*r}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}}H$.type="ripple";const V$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class N$ extends YF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class U$ extends JN{constructor(){super(...arguments),this.type=cR.correlation,this.transformerConstructor=N$,this._viewBox=new He}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;xI(this._dataSet,"correlation",D$);const s=new Ea;SI(s,"dataview",Ta),xI(s,"correlationCenter",j$);const n=new Ba(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 TD(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_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(){const e=this._createMark(U$.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:AO});e&&(e.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._nodePointMark=e);const i=this._createMark(U$.mark.ripplePoint,{key:AO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});i&&(this._ripplePointMark=i);const s=this._createMark(U$.mark.centerPoint,{key:AO,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});s&&(s.setMarkConfig({zIndex:t.LayoutZIndex.Node}),this._centerPointMark=s)}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[R$],y:t=>t[O$],size:t=>t[I$],fill:null!==(s=a.fill)&&void 0!==s?s:this.getColorAttribute(),fillOpacity:null!==(n=a.fillOpacity)&&void 0!==n?n:1,lineWidth:0},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.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)},t.STATE_VALUE_ENUM.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(zF(null===(e=KR.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),jF("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(){super.onLayoutEnd(),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}U$.type=cR.correlation,U$.mark=L$,U$.builtInTheme={correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}}},U$.transformerConstructor=N$;const W$=()=>{Sz(),yN(),tM(),KR.registerMark(H$.type,H$),KR.registerGraphicComponent("symbol",(t=>Cg(t))),KR.registerSeries(U$.type,U$),KR.registerAnimation("correlation",((t,e)=>Object.assign({appear:V$(0,e)},VD)))},G$=Object.assign(Object.assign({},BF),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class Y$ extends _N{constructor(){super(...arguments),this.type=Y$.type,this._subMarks={wave0:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:1}},wave1:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.66}},wave2:{type:"area",defaultAttributes:{curveType:"monotoneX",fillOpacity:.33}}},this._positionChannels=["wave","y","height"],this._positionEncoder=(t,e,i)=>{const{wave:s=i.attribute.wave,y:n=i.attribute.y,height:r=i.attribute.height}=t,a=[],o=[],l=[];for(let t=0;t<21;t++){const e=50*t-500,i=n+(t%2==0?20:0),h=n+r;a.push({x:e+100*s,y:i,y1:h}),o.push({x:e+200*s-40,y:i,y1:h}),l.push({x:e+300*s-20,y:i,y1:h})}return{wave0:{x:0,y:0,points:a},wave1:{x:0,y:0,points:o},wave2:{x:0,y:0,points:l}}}}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}}Y$.type="liquid";const $$=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class X$ extends _F{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class K$ extends $F{constructor(){super(...arguments),this.type=cR.liquid,this.transformerConstructor=Az,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let f=d-(r+a+h+c),m=u-(s+n+o+l);const v=Math.min(f,m);return"rect"!==this._maskShape&&(f=v,m=v),{x:p,y:g,size:v,width:f,height:m,startX:p-f/2,startY:g-m/2,endX:p+f/2,endY:g+m/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Ig({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Cg({x:s,y:n,size:r,symbolType:$$(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=IR(this._spec.outlineMargin),this._paddingSpec=IR(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Gt(...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(K$.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(K$.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(K$.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(K$.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const e=this._liquidOutlineMark;e.created(),this.setMarkStyle(e,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",t.AttributeLevel.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const e=this._liquidBackgroundMark;e.created(),this.setMarkStyle(e,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",t.AttributeLevel.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const e=this._liquidMark,i=this._liquidGroupMark;i&&this.setMarkStyle(i,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),e&&this.setMarkStyle(e,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",t.AttributeLevel.Series)}initTooltip(){this._tooltipHelper=new X$(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}getInteractionTriggers(){return this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(zF(null===(i=KR.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),jF("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(zF(null===(s=KR.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),jF("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(t.ChartEvent.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i,s;const n=null===(e=this._liquidMark.getGraphics()[0].getSubGraphic())||void 0===e?void 0:e[0];let{y1:r,y2:a}=n.globalAABBBounds;r+=this._region.getLayoutStartPoint().y,a+=this._region.getLayoutStartPoint().y,null===(s=null===(i=null==t?void 0:t.getIndicatorComponent())||void 0===i?void 0:i.getChildren()[0])||void 0===s||s.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ri){const e=kM(t.attribute.fill,n.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]}}K$.type=cR.liquid,K$.mark=G$,K$.builtInTheme={liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}}},K$.transformerConstructor=Az;const q$=t=>Y(t).join(",");class Z$ extends _F{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>q$(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>q$(null==t?void 0:t[this.series.getDimensionField()[0]])}}const J$=Object.assign(Object.assign({},BF),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class Q$ extends YF{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}const tX=(t,e)=>{const i=e.getViewBox();return i&&(null==t?void 0:t.length)?yG(Object.assign({setField:e.setField,valueField:e.valueField},i),t):[]};class eX extends $F{constructor(){super(...arguments),this.type=cR.venn,this.transformerConstructor=Q$,this._viewBox=new He}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:kO)}initData(){var t;super.initData(),xI(this._dataSet,"venn",tX),null===(t=this._data.getDataView())||void 0===t||t.transform({type:"venn",options:{getViewBox:()=>this._viewBox.empty()?null:{x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2},setField:this._categoryField,valueField:this._valueField}})}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){this._data.getDataView().reRunAllTransform(),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(eX.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(eX.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()},t.STATE_VALUE_ENUM.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},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},t.STATE_VALUE_ENUM.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=>q$(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)}},t.STATE_VALUE_ENUM.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=>q$(t.sets)},t.STATE_VALUE_ENUM.STATE_NORMAL,t.AttributeLevel.Series))}initTooltip(){this._tooltipHelper=new Z$(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(){super.onLayoutEnd(),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:q$(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return q$(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[q$(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(q$(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(zF(null===(e=KR.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),jF(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(zF(null===(e=KR.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),jF(t.name,this._spec,this._markAttributeContext)))}))}}eX.type=cR.venn,eX.mark=J$,eX.builtInTheme={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"}}}}},eX.transformerConstructor=Q$;class iX extends aV{constructor(){super(...arguments),this.type=cR.mosaic,this.transformerConstructor=rV}get bandWidthField(){return this._bandWidthField}getStack(){return!0}getPercent(){return this._spec.percent}getGroupFields(){return"vertical"===this.direction?this._specXField:this._specYField}setAttrFromSpec(){super.setAttrFromSpec();const t=this.getPercent();"horizontal"===this.direction?(t&&(this.setFieldX(jO),this.setFieldX2(zO)),this.setFieldY(VO),this.setFieldY2(HO)):(t&&(this.setFieldY(jO),this.setFieldY2(zO)),this.setFieldX(VO),this.setFieldX2(HO)),this._spec.bandWidthField&&(this._bandWidthField=this._spec.bandWidthField)}parseLabelStyle(t,e){if((null==e?void 0:e.filterByGroup)&&u(t.dataFilter)){const i=this.getGroupFields(),{field:s,type:n="max",filter:r}=e.filterByGroup;delete t.filterField;const a=i.indexOf(s);if(a<0)return;const o=!!(a%2)?"min"===n?"horizontal"===this.direction?this._fieldY2:this._fieldX2:"horizontal"===this.direction?this._fieldY:this._fieldX:"min"===n?"horizontal"===this.direction?this._fieldX2:this._fieldY2:"horizontal"===this.direction?this._fieldX:this._fieldY,l="min"===n?(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])<(null===(s=e.data)||void 0===s?void 0:s[o])}:(t,e)=>{var i,s;return(null===(i=t.data)||void 0===i?void 0:i[o])>(null===(s=e.data)||void 0===s?void 0:s[o])};t.dataFilter=t=>{const e={};return t.forEach((t=>{const i=t.data,n=null==i?void 0:i[s];u(n)||r&&!r(t)||e[n]&&!l(t,e[n])||(e[n]=t)})),t.filter((t=>{var i;const n=null===(i=t.data)||void 0===i?void 0:i[s];return e[n]&&e[n]===t}))}}return t}}iX.type=cR.mosaic,iX.builtInTheme={mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},iX.transformerConstructor=rV;class sX extends tH{_isValidSeries(t){return t===cR.map}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["type","nameField","valueField","map","nameProperty","centroidProperty","nameMap","area","defaultFillColor","showDefaultName"])}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"})),super.transformSeriesSpec(t)}}class nX extends Jj{constructor(){super(...arguments),this.transformerConstructor=sX,this.type="map",this.seriesType=cR.map}}nX.type="map",nX.seriesType=cR.map,nX.transformerConstructor=sX;class rX extends tH{_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,e){return super._getDefaultSeriesSpec(t,["radius","outerRadius","innerRadius","startAngle","endAngle","sortDataByAxis"],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 aX extends rX{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t,["startAngle","endAngle","centerX","centerY"]);return e.categoryField=t.categoryField||t.radiusField,e.valueField=t.valueField||t.angleField,e}_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=Iz(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,XR({},s,l)),n&&Object.assign(o,XR({},n,o))}}class oX extends rX{needAxes(){return!0}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.categoryField=t.categoryField||t.angleField,e.valueField=t.valueField||t.radiusField,e}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 lX extends rX{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t,["center","centerOffset","cornerRadius","padAngle","minAngle","emptyPlaceholder","showAllZero","supportNegative","useSequentialAnimation","layoutRadius"]);return i.categoryField=t.categoryField||t.seriesField,i.valueField=t.valueField||t.angleField,i.emptyCircle=null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,i}}class hX extends Jj{constructor(){super(...arguments),this.transformerConstructor=lX}}hX.transformerConstructor=lX;class cX extends hX{constructor(){super(...arguments),this.transformerConstructor=lX,this.type="pie",this.seriesType=cR.pie}}cX.type="pie",cX.seriesType=cR.pie,cX.transformerConstructor=lX;class dX extends oX{_getDefaultSeriesSpec(t){var e,i,s;const n=super._getDefaultSeriesSpec(t);return n.radius=null!==(e=t.radius)&&void 0!==e?e:Zz,n.outerRadius=null!==(i=t.outerRadius)&&void 0!==i?i:Zz,n.innerRadius=null!==(s=t.innerRadius)&&void 0!==s?s:0,n.stack=t.stack,n.percent=t.percent,n}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=>XR({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}const uX=(t,e)=>{if(!t)return null;const i=cz(t,(t=>"angle"===t.getOrient()),e),s=cz(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&UC(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=eR({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=K(e),n=X(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=iR(d),f=null===(e=s[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 _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=lz(v,t,"polar",r);n.push({index:_,value:v,position:i.scale(v),axis:t,data:y})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&UC(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=eR({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=iR(c),g=null===(e=i[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=s.invert(p);if(u(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const _=lz(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:_})}})),n.length?n:null};class pX extends Jj{constructor(){super(...arguments),this.transformerConstructor=dX,this.type="rose",this.seriesType=cR.rose}_setModelOption(){this._modelOption.getDimensionInfo=uX}}pX.type="rose",pX.seriesType=cR.rose,pX.transformerConstructor=dX,G(pX,rH);class gX extends oX{_getDefaultSeriesSpec(t){var e;const i=super._getDefaultSeriesSpec(t);return i.line=t.line,i.point=t.point,i.stack=t.stack,i.percent=t.percent,i.area=XR({visible:!1},t.area),i.seriesMark=null!==(e=t.seriesMark)&&void 0!==e?e:"area",i.activePoint=t.activePoint,i.pointDis=t.pointDis,i.pointDisMul=t.pointDisMul,i.markOverlap=t.markOverlap,i}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=>XR({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class fX extends Jj{constructor(){super(...arguments),this.transformerConstructor=gX,this.type="radar",this.seriesType=cR.radar}_setModelOption(){this._modelOption.getDimensionInfo=uX}}fX.type="radar",fX.seriesType=cR.radar,fX.transformerConstructor=gX,G(fX,rH);class mX extends tH{_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=>{L(e,"trimPadding")&&XR(e,qI(this.type,t))})),this._transformAxisSpec(t)}}class vX extends Jj{constructor(){super(...arguments),this.transformerConstructor=mX,this.type="common"}_setModelOption(){this._modelOption.getDimensionInfo=(t,e,i)=>{var s,n;return[...null!==(s=fH(t,e,i))&&void 0!==s?s:[],...null!==(n=uX(t,e))&&void 0!==n?n:[]]},this._modelOption.getDimensionInfoByValue=vH,this._modelOption.getRectByDimensionData=AH}}vX.type="common",vX.transformerConstructor=mX,G(vX,rH);class _X extends eH{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["x2Field","y2Field","barMinHeight","barBackground","barGap"])}}class yX extends Jj{constructor(){super(...arguments),this.transformerConstructor=_X}}yX.transformerConstructor=_X,G(yX,rH);class bX extends _X{transformSpec(t){super.transformSpec(t),$I(t)}}class xX extends yX{constructor(){super(...arguments),this.transformerConstructor=bX,this.type="histogram",this.seriesType=cR.bar}_setModelOption(){this._modelOption.getDimensionInfo=fH,this._modelOption.getDimensionInfoByValue=vH,this._modelOption.getRectByDimensionData=AH}}xX.type="histogram",xX.seriesType=cR.bar,xX.transformerConstructor=bX;class SX extends aX{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.progress=t.progress,s.track=t.track,s.tickMask=t.tickMask,s.cornerRadius=null!==(e=t.cornerRadius)&&void 0!==e?e:0,s.roundCap=null!==(i=t.roundCap)&&void 0!==i&&i,s}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class AX extends Jj{constructor(){super(...arguments),this.transformerConstructor=SX,this.type="circularProgress",this.seriesType=cR.circularProgress}_setModelOption(){this._modelOption.getDimensionInfo=uX}}AX.type="circularProgress",AX.seriesType=cR.circularProgress,AX.transformerConstructor=SX,G(AX,rH);class kX extends aX{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.radiusField=t.radiusField,e.pin=t.pin,e.pinBackground=t.pinBackground,e.pointer=t.pointer,e}_getDefaultCircularProgressSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.type=cR.circularProgress,e}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===cR.gauge||t.type===cR.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===cR.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 MX extends Jj{constructor(){super(...arguments),this.transformerConstructor=kX,this.type="gauge",this.seriesType=cR.gaugePointer}}MX.type="gauge",MX.seriesType=cR.gaugePointer,MX.transformerConstructor=kX;class TX extends tH{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["nameField","valueField","fontFamilyField","fontWeightField","fontStyleField","colorHexField","colorMode","colorList","rotateAngles","fontWeightRange","fontSizeRange","maskShape","keepAspect","random","wordCloudConfig","wordCloudShapeConfig","word","fillingWord","wordMask"])}}class wX extends Jj{constructor(){super(...arguments),this.transformerConstructor=TX,this.type="wordCloud",this.seriesType=cR.wordCloud}}wX.transformerConstructor=TX;class CX extends wX{constructor(){super(...arguments),this.transformerConstructor=TX,this.type="wordCloud",this.seriesType=cR.wordCloud}}CX.type="wordCloud",CX.seriesType=cR.wordCloud,CX.transformerConstructor=TX;class EX extends tH{needAxes(){return!1}_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","funnelAlign","funnelOrient","heightRatio","shape","funnel","transform","outerLabel","transformLabel","isTransform","maxSize","minSize","gap","isCone","range","transformRatioText"])}transformSpec(t){super.transformSpec(t),super.transformSeriesSpec(t)}}class BX extends Jj{constructor(){super(...arguments),this.transformerConstructor=EX,this.type="funnel",this.seriesType=cR.funnel}}BX.type="funnel",BX.seriesType=cR.funnel,BX.transformerConstructor=EX;class PX extends eH{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["bandWidth","progress","track","clamp"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"horizontal",s.cornerRadius=null!==(i=t.cornerRadius)&&void 0!==i?i:0,s}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=Iz(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=Iz(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class LX extends Jj{constructor(){super(...arguments),this.transformerConstructor=PX,this.type="linearProgress",this.seriesType=cR.linearProgress}_setModelOption(){this._modelOption.getDimensionInfo=fH,this._modelOption.getDimensionInfoByValue=vH,this._modelOption.getRectByDimensionData=AH}}LX.type="linearProgress",LX.seriesType=cR.linearProgress,LX.transformerConstructor=PX,G(LX,rH);class RX extends eH{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t,["barWidth","barMaxWidth","barMinWidth","barGapInGroup","barBackground","barMinHeight","stackCornerRadius","bar"]);return"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),$I(t)}}class OX extends Jj{constructor(){super(...arguments),this.transformerConstructor=RX,this.type="rangeColumn",this.seriesType=cR.rangeColumn}_setModelOption(){this._modelOption.getDimensionInfo=fH,this._modelOption.getDimensionInfoByValue=vH,this._modelOption.getRectByDimensionData=AH}}OX.type="rangeColumn",OX.seriesType=cR.rangeColumn,OX.transformerConstructor=RX;class IX extends tH{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+oe(2*Math.PI),s=super._getDefaultSeriesSpec(t,["categoryField","valueField","centerX","centerY","offsetX","offsetY","innerRadius","outerRadius","gap","labelLayout","label","labelAutoVisible","drill","drillField"]);return s.startAngle=e,s.endAngle=i,s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class DX extends Jj{constructor(){super(...arguments),this.transformerConstructor=IX,this.type="sunburst",this.seriesType=cR.sunburst}}DX.type="sunburst",DX.seriesType=cR.sunburst,DX.transformerConstructor=IX;class FX extends tH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","layoutPadding","circlePacking","drill","drillField"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class zX extends Jj{constructor(){super(...arguments),this.transformerConstructor=FX,this.type="circlePacking",this.seriesType=cR.circlePacking}}zX.type="circlePacking",zX.seriesType=cR.circlePacking,zX.transformerConstructor=FX;class jX extends tH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","aspectRatio","splitType","maxDepth","gapWidth","nodePadding","minVisibleArea","minChildrenVisibleArea","minChildrenVisibleSize","roam","drill","drillField","leaf","nonLeaf","nonLeafLabel"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class HX extends Jj{constructor(){super(...arguments),this.transformerConstructor=jX,this.type="treemap",this.seriesType=cR.treemap}}HX.type="treemap",HX.seriesType=cR.treemap,HX.transformerConstructor=jX;class VX extends lV{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),$I(t)}_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return e.bar=t.bar,e.stackLabel=t.stackLabel,e.leaderLine=t.leaderLine,e.total=t.total,e.calculationMode=t.calculationMode,e}}class NX extends hV{constructor(){super(...arguments),this.transformerConstructor=VX,this.type="waterfall",this.seriesType=cR.waterfall}_setModelOption(){this._modelOption.getDimensionInfo=fH,this._modelOption.getDimensionInfoByValue=vH,this._modelOption.getRectByDimensionData=AH}}NX.type="waterfall",NX.seriesType=cR.waterfall,NX.transformerConstructor=VX;class UX extends eH{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=super._getDefaultSeriesSpec(t,["boxPlot","outlier","minField","maxField","q1Field","medianField","q3Field","outliersField","outliersStyle","boxWidth","boxMaxWidth","boxMinWidth","boxGapInGroup"]);return s.direction=null!==(e=t.direction)&&void 0!==e?e:"vertical",s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),$I(t)}}class WX extends Jj{constructor(){super(...arguments),this.transformerConstructor=UX,this.type="boxPlot",this.seriesType=cR.boxPlot}_setModelOption(){this._modelOption.getDimensionInfo=fH,this._modelOption.getDimensionInfoByValue=vH,this._modelOption.getRectByDimensionData=AH}}WX.type="boxPlot",WX.seriesType=cR.boxPlot,WX.transformerConstructor=UX;class GX extends tH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sourceField","targetField","direction","nodeAlign","crossNodeAlign","nodeGap","nodeWidth","linkWidth","minStepWidth","minNodeHeight","maxNodeHeight","minLinkHeight","maxLinkHeight","dropIsolatedNode","nodeHeight","linkHeight","equalNodeHeight","linkOverlap","iterations","nodeKey","linkSortBy","nodeSortBy","setNodeLayer","node","link","emphasis","inverse","overflow"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class YX extends Jj{constructor(){super(...arguments),this.transformerConstructor=GX,this.type="sankey",this.seriesType=cR.sankey}_setStateInDatum(t,e,i,s){const n=y(e)?e[0]:e;if(!n)return void this._interaction.clearByState(t);let r=null;this.filterGraphicsByDatum(n,{filter:(t,e)=>"text"!==e.type&&e.getProduct()&&(!i||i(t,e)),region:s,getDatum:t=>{var e;let i=null===(e=hI(t))||void 0===e?void 0:e.datum;return y(i)&&(i=i[0]),i},callback:(t,e,i,s)=>{var n,r;const a=e.getProductId();a&&(a.includes("node")||a.includes("link"))&&(null===(r=(n=i)._handleEmphasisElement)||void 0===r||r.call(n,{item:t,mark:e}))},regionCallback:(t,e)=>{n&&t.length&&(r=t[0])}}),r&&this._interaction.updateStateOfGraphics(t,[r])}}YX.type="sankey",YX.seriesType=cR.sankey,YX.transformerConstructor=GX;class $X extends eH{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return s.area=t.area,s.point=t.point,s.line=t.line,"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),$I(t)}}class XX extends Jj{constructor(){super(...arguments),this.transformerConstructor=$X,this.type="rangeArea",this.seriesType=cR.rangeArea}_setModelOption(){this._modelOption.getDimensionInfo=fH,this._modelOption.getDimensionInfoByValue=vH,this._modelOption.getRectByDimensionData=AH}}XX.type="rangeArea",XX.seriesType=cR.rangeArea,XX.transformerConstructor=$X;class KX extends eH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["valueField","cell"])}}class qX extends Jj{constructor(){super(...arguments),this.transformerConstructor=KX,this.type="heatmap",this.seriesType=cR.heatmap}}qX.type="heatmap",qX.seriesType=cR.heatmap,qX.transformerConstructor=KX;class ZX extends tH{_getDefaultSeriesSpec(t){return super._getDefaultSeriesSpec(t,["categoryField","valueField","sizeField","sizeRange","centerX","centerY","innerRadius","outerRadius","startAngle","endAngle","ripplePoint","centerPoint","centerLabel","nodePoint"])}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class JX extends Jj{constructor(){super(...arguments),this.transformerConstructor=ZX,this.type="correlation",this.seriesType=cR.correlation}}JX.type="correlation",JX.seriesType=cR.correlation,JX.transformerConstructor=ZX;function QX(t){var e,i;const s=Object.assign({},t);return P(t.style)||(s.textStyle=oI(t.style)),P(t.textStyle)||XR(s.textStyle,oI(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&oI(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&oI(s.background.style),s}const tK=(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},eK=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l,customFilter:h}=e,c=a(),d=l();if(0===c.length&&d.length)return[];if(c.length===d.length)return t;const u={};c.forEach((t=>{u[t]=!0}));const g=null!==(i=o())&&void 0!==i?i:MO;return h?h(t,c,g):(y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===u[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===u[t.source]&&!0===u[t.target])))):p(g)&&(t=t.filter((t=>!0===u[r.getSeriesFieldValue(t,g)]))),t)};class iK extends sj{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:()=>{nR(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),nR(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=ER(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()}_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):(U(e,t)||(i.reCompile=!0),i)}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData(),this._forceLayout()}initData(){const e=this._initLegendData();e.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new TD(this._option,e),this._initSelectedData(),nR(this._regions,(e=>{e.event.on(t.ChartEvent.rawDataUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===e.id},(()=>{this._legendData.getDataView().reRunAllTransform({skipEqual:!0})}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(e){var i,s,n;const r=this._selectedData;u(e)||JSON.stringify(r)===JSON.stringify(e)||(nR(this._regions,(t=>{t.legendSelectedFilter&&(e=t.legendSelectedFilter(this,e))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...e],null===(s=(i=this.effect).onSelectedDataChange)||void 0===s||s.call(i),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this}),null===(n=this._legendComponent)||void 0===n||n.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;k(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)U(s,this._cacheAttrs)||this._legendComponent.setAttributes(XR({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(XR({},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;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());U(t,this._cacheAttrs)||this._legendComponent.setAttributes(XR({},t,{defaultSelected:this._selectedData}))}null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(t.ChartEvent.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}iK.specKey="legends";class sK extends iK{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return hF(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(e){super.init(e),nR(this._regions,(e=>{e.addViewDataFilter({type:"discreteLegendFilter",options:{series:e,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(e),data:()=>this.getLegendDefaultData(),customFilter:this._spec.customFilter},level:t.TransformLevel.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){xI(this._option.dataSet,"discreteLegendFilter",eK),xI(this._option.dataSet,"discreteLegendDataMake",tK);const t=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return nR(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(!Zy(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=XO(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 s=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);let{title:n={},item:r={},pager:a={},background:o={}}=t;n=I(n),r=I(r),a=I(a),o=I(o);const l=s;return n.visible?l.title=QX(n):l.title={visible:!1},P(r.focusIconStyle)||oI(r.focusIconStyle),r.shape&&(r.shape=nI(r.shape)),r.label&&(r.label=nI(r.label)),r.value&&(r.value=nI(r.value)),r.background&&(r.background=nI(r.background)),BR(r.maxWidth)&&(r.maxWidth=Number(r.maxWidth.substring(0,r.maxWidth.length-1))*i.width/100),BR(r.width)&&(r.width=Number(r.width.substring(0,r.width.length-1))*i.width/100),BR(r.height)&&(r.height=Number(r.height.substring(0,r.height.length-1))*i.width/100),l.item=r,"scrollbar"===a.type?(P(a.railStyle)||oI(a.railStyle),P(a.sliderStyle)||oI(a.sliderStyle)):(P(a.textStyle)||oI(a.textStyle),a.handler&&nI(a.handler)),l.pager=a,o.visible&&!P(o.style)&&(XR(l,o.style),p(o.padding)&&(l.padding=o.padding)),l}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return uL}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(rL.legendItemClick,(i=>{const s=L(i,"detail.currentSelected");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendItemClick,{model:this,value:s,event:i})})),this._legendComponent.addEventListener(rL.legendItemHover,(e=>{const i=L(e,"detail");this.event.emit(t.ChartEvent.legendItemHover,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(rL.legendItemUnHover,(e=>{const i=L(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}=lF(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=lF(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}sK.specKey="legends",sK.builtInTheme={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}},sK.type=r.discreteLegend;const nK=(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[]},rK=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r,customFilter:a}=e,o=i(),l=s(),h=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(o===n())return t;if(l&&!P(o)){const[e,i]=o;return a?a(t,o,l):h(t)?sI(t,+e,+i,l):t.filter((t=>t[l]>=e&&t[l]<=i))}return t};function aK(t){const i=XR({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:u={},type:g,id:f,visible:m,orient:v,position:_,data:y,defaultSelected:b,field:x,filter:S,regionId:A,regionIndex:k,seriesIndex:M,seriesId:T,padding:w}=i,C=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?C.title=QX(s):C.title={visible:!1},C.showHandler=!1!==n.visible,P(n.style)||(C.handlerStyle=oI(n.style)),p(r.width)&&(C.railWidth=r.width),p(r.height)&&(C.railHeight=r.height),P(r.style)||(C.railStyle=oI(r.style)),P(a.style)||(C.trackStyle=oI(a.style)),C.startText=nI(o),C.endText=nI(l),C.handlerText=function(t){if(!t)return t;const e=Object.assign({},t),i=t.style;return d(i)?e.style=(t,e,s)=>oI(i(t,e,s)):P(i)||(e.style=oI(i)),e}(h),P(c)||(C.sizeBackground=oI(c)),u.visible&&!P(u.style)&&(XR(C,u.style),p(u.padding)&&(C.padding=u.padding)),C}const oK={color:vL,size:yL},lK={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}},hK=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},lK),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},cK={horizontal:hK(!0),vertical:hK(!1)},dK=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},lK),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},uK={horizontal:dK(!0),vertical:dK(!1)},pK=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],gK=[2,10];class fK extends iK{static getSpecInfo(t){const e=hF(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}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(e){super.init(e),nR(this._regions,(e=>{e.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:e.isHierarchyData,customFilter:this._spec.customFilter},level:t.TransformLevel.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(){xI(this._option.dataSet,"continuousLegendFilter",rK),xI(this._option.dataSet,"continuousLegendDataMake",nK);const t=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>rR(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=XO(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!Zy(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=XO(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var e,i;const s="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",n="horizontal"===s?"bottom":this.layoutOrient;let r=[];const a=this._getScaleInGlobal();a&&"linear"===a.type&&(r=a.range()),P(r)&&(r="color"===this._legendType?pK:gK);let o=null!==(e=this._legendData.getLatestData()[0])&&void 0!==e?e:0,l=null!==(i=this._legendData.getLatestData()[1])&&void 0!==i?i:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(o=Math.min(0,this._legendData.getLatestData()[0]),l=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const h=Object.assign({layout:s,align:n,zIndex:this.layoutZIndex,min:o,max:l,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:r},aK(this._spec));return this._addDefaultTitleText(h),h}_getLegendConstructor(){return oK[this._legendType]}_initEvent(){if(this._legendComponent){const e=!1!==this._spec.filter;this._legendComponent.addEventListener("change",xt((i=>{const s=L(i,"detail.value");e&&this.setSelectedData(s),this.event.emit(t.ChartEvent.legendFilter,{model:this,value:s,event:i})}),30))}}}fK.specKey="legends",fK.builtInTheme={colorLegend:cK,sizeLegend:uK},fK.type=r.continuousLegend;const mK=(t,e)=>p(e)?t.map((t=>e[t])):void 0,vK=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),_K=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function yK(t,e,i){var s,n,r,a,o,l,h;const c=Object.assign({regionIndex:0},e),d=i.getOption(),g=d.getRegionsInUserIdOrIndex(p(c.regionId)?[c.regionId]:void 0,p(c.regionIndex)?[c.regionIndex]:void 0)[0];if(!g)return"none";const f=bK(t,g),m=null!==(s=c.activeType)&&void 0!==s?s:f.length>1?"dimension":"mark",v=g.getLayoutStartPoint(),_=g.getLayoutRect(),y=d.globalInstance.getContainer(),b=Object.assign({x:0,y:0},y?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(y):{}),x=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data;return null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>vK(i,s)(t)&&vK(n,r)(t)&&(u(a)||vK([a],[o])(t))))},S=g.getOption().globalInstance.getStage().window.getViewBoxTransform().getInverse(),A=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),_.width),y:Math.min(Math.max(t.y,0),_.height)}))(t),n=null!==(e=c.x)&&void 0!==e?e:v.x+s.x,r=null!==(i=c.y)&&void 0!==i?i:v.y+s.y,a={x:0,y:0};S.transformPoint({x:n,y:r},a);const{x:o,y:l}=a;return{canvasX:o,canvasY:l,clientX:b.x+o,clientY:b.y+l}};if("dimension"===m){const e=f[0];if(!e)return"none";const s=new Map;f.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 l=[{value:t[e.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=>x(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(l[0].position=e.pos[e.dimType],l[0].dimType=e.dimType);const h={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:l,chart:null!==(n=d.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:fI.chart,event:A({x:f.reduce(((t,e)=>t+e.pos.x),0)/f.length,y:f.reduce(((t,e)=>t+e.pos.y),0)/f.length}),item:void 0};null===(o=null===(a=null===(r=i.processor)||void 0===r?void 0:r.dimension)||void 0===a?void 0:a.showTooltip)||void 0===o||o.call(a,l,h,!1);const c=d.globalInstance;return sF.globalConfig.uniqueTooltip&&sF.hideTooltip(c.id),m}if("mark"===m){const e=f[0];if(!e)return"none";const s=null!==(l=e.data.originDatum)&&void 0!==l?l:Object.assign(Object.assign({},x(e)),t),n=[{datum:[s],series:e.series}],r={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(h=d.globalInstance.getChart())&&void 0!==h?h:void 0,datum:s,model:e.series,source:fI.chart,event:A(e.pos),item:void 0};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},r,!1);const a=d.globalInstance;return sF.globalConfig.uniqueTooltip&&sF.hideTooltip(a.id),m}return"none"}const bK=(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(),f=p(g)?t[g]:void 0,m=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=mK(c,t);let _=mK(d,t);const y=_K(_),b=!y&&p(g)&&u(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(vK(c,v));if(!y&&(_=mK(d,i),!_K(_)))return;const n=e.type===cR.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:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=UC(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(vK(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=mK(d,o),!_K(_))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(vK(c,n));if(!y&&(_=mK(d,r),!_K(_)))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:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===cR.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(vK(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(_=mK(d,i),!_K(_))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&&(()=>{var i,n,r;console.log("parseMarkInfoOfGeoSeries");let a=null===(i=e.getViewData())||void 0===i?void 0:i.latestData.find(vK(c,v));const o=e.getNameMap(),l=null===(r=null===(n=e.getMapViewData)||void 0===n?void 0:n.call(e))||void 0===r?void 0:r.latestData.find((t=>c.every(((e,i)=>"name"===e?o[t.properties[e]]===(null==v?void 0:v[i]):t.properties[e]===(null==v?void 0:v[i])))));if(!l)return;let h=_;if(l&&!a&&(a=Object.assign({},t)),!y){if(_=mK(d,a),h=_,!_K(_)&&!a)return;_K(_)||(_=[null])}const p=e.dataToPosition(a);u(p)||isNaN(p.x)||isNaN(p.y)||s.push({pos:p,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:h,hasMeasureData:y,groupField:g,groupData:f,originDatum:a},series:e})})()})),s},xK=t=>p(t)&&!y(t),SK=t=>p(t)&&y(t);class AK extends ij{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i,s,n;const{spec:r,theme:a}=super._initTheme(t,e);return r.style=XR({},this._theme,r.style),r.offset=XR({},a.offset,t.offset),r.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:a.transitionDuration,r.trigger=null!==(s=t.trigger)&&void 0!==s?s:a.trigger,r.triggerOff=null!==(n=t.triggerOff)&&void 0!==n?n:a.triggerOff,{spec:r,theme:a}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(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]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:$y(this._option.mode)||!Gy(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.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?_(t.parentElement)&&(t.parentElement=A_.getElementById(t.parentElement)):Gy(this._option.mode)&&(t.parentElement=null==Wy?void 0:Wy.body)}}const kK={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}};class MK extends sj{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=AK,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this.enable=!0,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{var e,i;if(this._clickLock)this._handleChartMouseOut(t),this._clickLock=!1;else{if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return;this._clickLock=!0}},this._getMouseOutHandler=t=>e=>{var i,s,n,r,a;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const o=Gy(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:l,clientY:h}=e.event;o&&t&&this._isPointerInChart({x:l,y:h})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(a=null===(r=this._spec)||void 0===r?void 0:r.showDelay)&&void 0!==a?a:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{var e;this._cacheActiveType&&(null===(e=this._option)||void 0===e?void 0:e.componentShowContent)&&(!1===this._option.componentShowContent.tooltip||g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[this._cacheActiveType])||this._alwaysShow||this._isReleased||this._isEnterTooltip||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n,r;this._isReleased||this._isEnterTooltip||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(r=null===(n=this._spec)||void 0===n?void 0:n.showDelay)&&void 0!==r?r:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{if(this._isReleased)return;const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1},a=["group","mark","dimension"];for(let s=0,n=a.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&xK(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),!0===r.mark||!0===r.group||!0===r.dimension&&!u(s)?this._initEventOfTooltipContent():this._cacheActiveType&&"unShowByOption"===r[this._cacheActiveType]||this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;if(!this._showContentByEvent(t))return"unShowByOption";const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&sF.globalConfig.uniqueTooltip&&l&&sF.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=e=>{var i,s,n;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;this.event.emit(t.ChartEvent.tooltipHide,Object.assign(Object.assign({},e),{source:fI.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const r=null!==(n=this._spec.handler)&&void 0!==n?n:this.tooltipHandler;if(null==r?void 0:r.hideTooltip){const t=r.hideTooltip.call(r,e);return t||(this._isTooltipShown=!1),t}return 1},this.hideTooltip=()=>{if(this._isReleased)return!1;const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:fI.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}_registerEvent(){}_releaseEvent(){}onLayoutEnd(){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),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,this._enterable=!1;else{const t="canvas"===s?wH.canvas:wH.dom,n=KR.getComponentPluginInType(t);n||Vy("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,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.getRootDom)||void 0===e?void 0:e.call(t);i&&(i.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;this._isEnterTooltip=!0;const e=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);e&&(this._cacheEnterableRect={width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),i.addEventListener("pointerleave",(()=>{var t,e,s;if(this._enterable&&(this._isEnterTooltip=!1,"none"!==this._spec.triggerOff&&this._cacheEnterableRect)){const n=null===(t=i.getBoundingClientRect)||void 0===t?void 0:t.call(i);n&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===n[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(s=null===(e=this._spec)||void 0===e?void 0:e.showDelay)&&void 0!==s?s:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.forEach((t=>{const e=KR.createTooltipProcessor(t,this);e&&(this.processor[t]=e)}))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=Y(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(Yy(s)||$y(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,St(t,e)}_showContentByEvent(t){var e;if(null===(e=this._option)||void 0===e?void 0:e.componentShowContent){if(!1===this._option.componentShowContent.tooltip)return!1;if(g(this._option.componentShowContent.tooltip)&&!1===this._option.componentShowContent.tooltip[t])return!1}return!0}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.reInit)||void 0===s||s.call(i)}else 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=yK(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow),this._cacheActiveType=s),s}_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(SK(t)){if(xK(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>az(t,e[i])))}if(SK(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.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: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}getVisible(){return!1!==this._spec.visible}}MK.type=r.tooltip,MK.transformerConstructor=AK,MK.builtInTheme={tooltip:kK},MK.specKey="tooltip";var TK,wK;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(TK||(TK={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(wK||(wK={}));const CK={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class EK extends sj{get enableRemain(){return"none"===this.triggerOff}constructor(e,i){super(e,i),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=t.LayoutZIndex.CrossHair_Grid,this.labelZIndex=t.LayoutZIndex.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=St((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hideCrosshair())},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.hideCrosshair()},this.enable=!0,this.showDefault=!0}_setAllAxisValues(t,e,i){let s=!1;if(t.forEach((t=>{UC(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!this.enable)return!1;const{currentValue:n}=this._stateByField[i];return t.forEach(((t,i)=>{const s=t.axis;n.set(i,{datum:this._getDatumAtPoint(s,e),axis:s})})),!0}clearAxisValue(){Object.keys(this._stateByField).forEach((t=>{this._stateByField[t].currentValue.clear()}))}hideCrosshair(){this.clearAxisValue(),this.hide()}showCrosshair(t){t&&t.length&&(this.showDefault=!1,this.clearAxisValue(),t.forEach((t=>{const{axis:e,value:i}=t;this.setAxisValue(i,e)})),this.layoutByValue(!1))}_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}_showDefaultCrosshairBySpec(){let t=!1;return Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];if(i&&i.visible&&i.defaultSelect){const{axisIndex:s=0,datum:n}=i.defaultSelect,r=this._option.getComponentsByKey("axes").find((t=>t.getSpecIndex()===s));r&&(t=!0,this._stateByField[e].currentValue.clear(),this._stateByField[e].currentValue.set(s,{axis:r,datum:n}))}})),t}_updateVisibleCrosshair(){let t=!1;Object.keys(this._stateByField).forEach((e=>{const i=this._spec[e];i&&i.visible&&this._stateByField[e].currentValue.size?t=!0:this._hideByField(e)})),t&&this.layoutByValue(!1)}_showDefaultCrosshair(){if(this.showDefault){this._showDefaultCrosshairBySpec()&&this.layoutByValue(!1)}else this._updateVisibleCrosshair()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(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(t,e,i){var s;if(!1===(null===(s=this._option.componentShowContent)||void 0===s?void 0:s.crosshair))return;const n=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,r=e?{level:mI.chart}:{source:fI.chart};y(t)?t.forEach((t=>{this.event.on(t,r,n)})):this.event.on(t,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)}onBeforeRender(){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"}:Yy(e)||$y(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(t.ChartEvent.tooltipHide,{source:fI.chart},this._handleTooltipHideOrRelease),this.event.on(t.ChartEvent.tooltipShow,{source:fI.chart},this._handleTooltipShow),this.event.on(t.ChartEvent.tooltipRelease,{source:fI.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=L(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{CK[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=>{var e,i;a=1/0,o=1/0,l=-1/0,h=-1/0;const n=s.find((e=>e.getSpecIndex()===t));if(!n)return;const u=(null===(i=(e=n).getInnerOffset)||void 0===i?void 0:i.call(e))||{left:0,right:0,top:0,bottom:0};n.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c+u.left),o=Math.min(o,i-d+u.top),l=Math.max(l,e+t.getLayoutRect().width-c-u.right),h=Math.max(h,i+t.getLayoutRect().height-d-u.bottom)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:n})})),r}onLayoutEnd(){const t=this._regions[0];this.setLayoutRect(t.getLayoutRect()),this.setLayoutStartPosition(t.getLayoutStartPoint()),super.onLayoutEnd()}_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)}))}_parseFieldInfo(){Object.keys(this._stateByField).forEach((t=>{const e=this._spec[t],{crosshairComp:i}=this._stateByField[t];if(e&&e.visible){if(this._stateByField[t].attributes=this._parseField(e,t),i){const{style:e,type:s}=this._stateByField[t].attributes,n="rect"===s?"rectStyle":"lineStyle";i.setAttributes({[n]:e})}}else i&&i.parent&&i.parent.removeChild(i)}))}_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 i=o.style||{},{stroke:r,fill:l,lineWidth:h}=i,c=i,{strokeOpacity:d,fillOpacity:u,opacity:p}=c,g=e(c,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let m=f?d:u;if(S(p)&&(m=(null!=m?m:1)*p),a.style=Object.assign({opacity:m,pickable:!1,visible:!0},g),f)a.style.stroke=r||l,a.style.lineWidth=L(o,"width",h||2);else{a.style.fill=l||r,(null===(n=null===(s=null==t?void 0:t.line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.stroke)&&(a.style.stroke=t.line.style.stroke);const e=L(o,"width");if("string"==typeof e){const t=parseInt(e.substring(0,e.length-1),10)/100;a.style.sizePercent=t}else"number"!=typeof e&&"function"!=typeof e||(a.style.size=e)}}if(l.visible){const t=l.labelBackground||{},i=null!==(r=l.syncAxisLabelAngle)&&void 0!==r&&r,s=l.style||{},n=t.style||{},{fill:o="rgba(47, 59, 82, 0.9)",stroke:h,outerBorder:d}=n,u=e(n,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,syncAxisLabelAngle:i,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},s),{fill:s.fill||"#fff",stroke:L(s,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:o,stroke:h,outerBorder:Object.assign({stroke:o,distance:0,lineWidth:3},d)},u):{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||on&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}clearOutEvent(){this._timer&&(clearTimeout(this._timer),this._timer=null),this._clickLock&&(this._clickLock=null),this._hasActive&&(this._hasActive=null)}_hideByField(t){const{crosshairComp:e,labelsComp:i}=this._stateByField[t];e&&e.hideAll(),i&&Object.keys(i).forEach((t=>{i[t]&&i[t].hideAll()}))}hide(){Object.keys(this._stateByField).forEach((t=>{this._hideByField(t)}))}_getNeedClearVRenderComponents(){return Object.keys(this._stateByField).reduce(((t,e)=>{const{crosshairComp:i,labelsComp:s}=this._stateByField[e];return i&&t.push(i),s&&Object.keys(s).forEach((e=>{s[e]&&t.push(s[e])})),t}),[])}}EK.specKey="crosshair";const BK={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}}}}};class PK extends EK{static getSpecInfo(t){return hF(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._stateByField={xField:{coordKey:"x",anotherAxisKey:"y",currentValue:new Map,labelsComp:{top:null,bottom:null}},yField:{coordKey:"y",anotherAxisKey:"x",currentValue:new Map,labelsComp:{left:null,right:null}}}}_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)}}_getDatumAtPoint(t,e){const i=ZF(t.getOrient())?"x":"y",s=e[i]-(t.getLayoutStartPoint()[i]-this.getLayoutStartPoint()[i]);return t.getScale().invert(s)}setAxisValue(t,e){ZF(e.getOrient())?this._stateByField.xField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.yField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:JF(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}this.clearAxisValue();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 o&&o.size&&this._setAllAxisValues(o,{x:r,y:a},"xField"),l&&l.size&&this._setAllAxisValues(l,{x:r,y:a},"yField"),this.layoutByValue()}layoutByValue(t){if(!this.enable)return;const e=aR(this._regions,"cartesian");e&&(_H(this._stateByField,e,this.getLayoutStartPoint(),null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){const{cacheInfo:e,attributes:i,labelsComp:s,bandSize:n,coordKey:r}=this._stateByField[t];if(!i||!e||e._isCache&&this.enableRemain)return;const{coord:a,labels:o,visible:l,labelsTextStyle:h}=e;if(l){const l=xH(this._stateByField[t]);this._updateCrosshairByField(t,l),Object.keys(o).forEach((l=>{var c,d,u;if(o[l].visible){const p=Object.assign(Object.assign(Object.assign({[r]:a+n/2},o[l]),i.label),{angle:i.label.syncAxisLabelAngle&&null!==(d=null===(c=e.axisLabel)||void 0===c?void 0:c.attribute.angle)&&void 0!==d?d:0,textStyle:Object.assign(Object.assign({},null===(u=i.label)||void 0===u?void 0:u.textStyle),h[l]),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(s[l],p,(e=>{e.name=`crosshair-${t.replace("Field","")}-${l}-label`,s[l]=e}))}else s[l]&&s[l].hideAll()}))}else this._hideByField(t)}_updateCrosshairByField(t,e){const i=this.getContainer(),{attributes:s}=this._stateByField[t];let{crosshairComp:n}=this._stateByField[t];if(n)n.setAttributes(e);else{const r=s.style;"line"===s.type?n=new lT(Object.assign(Object.assign({},e),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===s.type&&(n=new hT(Object.assign(Object.assign({},e),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==i||i.add(n),this._stateByField[t].crosshairComp=n}}}PK.specKey="crosshair",PK.builtInTheme={crosshair:BK},PK.type=r.cartesianCrosshair;class LK extends EK{static getSpecInfo(t){return hF(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._stateByField={categoryField:{coordKey:"angle",anotherAxisKey:"radius",currentValue:new Map,labelsComp:{all:null}},valueField:{coordKey:"radius",anotherAxisKey:"angle",currentValue:new Map,labelsComp:{all:null}}}}setAxisValue(t,e){"radius"===e.getOrient()?this._stateByField.valueField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e}):this._stateByField.categoryField.currentValue.set(e.getSpecIndex(),{datum:t,axis:e})}_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)}}_getDatumAtPoint(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint();return t.positionToData({x:e.x-(i-n),y:e.y-(s-r)})}_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}this.clearAxisValue();const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)a&&this._setAllAxisValues(a,{x:n,y:r},"categoryField"),o&&this._setAllAxisValues(o,{x:n,y:r},"valueField"),this.layoutByValue();else{if(this.enableRemain)return;this.hide()}}layoutByValue(t){if(!this.enable)return;const e=aR(this._regions,"polar");e&&(((t,e,i=!1)=>{Object.keys(t).forEach((s=>{const{attributes:n,currentValue:r,cacheInfo:a,coordKey:o}=t[s];if(n){const l=!!r.size,h=i&&!l&&p(a),c=h?a:{coord:0,axis:null,visible:l,coordRange:[0,0],sizeRange:[0,0],labels:{all:{visible:!1,text:"",offset:0}}};if(a&&(a._isCache=h),"valueField"===s&&(c.sides=e.angleAxisHelper.getScale(0).domain().length),r.forEach((({axis:t,datum:i=""})=>{var r;const a=t.niceLabelFormatter;if((null===(r=n.label)||void 0===r?void 0:r.visible)&&(c.labels.all.visible=!0,c.labels.all.defaultFormatter=a,c.labels.all.text=i,c.labels.all.offset=Oz(t.getSpec())),"categoryField"===s){const s=e.angleAxisHelper.dataToPosition([i]),n=e.angleAxisHelper.getBandwidth(0),r=t.getOuterRadius();c.coord=s,c.coordRange=[s-n/2,s+n/2],c.sizeRange=[r,r]}else{const s=t.startAngle,n=e.radiusAxisHelper.dataToPosition([i]);c.coord=n,c.coordRange=[n,n],c.sizeRange=[s,s]}c.axis=t})),c&&!h&&c.labels.all.visible&&n&&n.label){const t=c.labels.all,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=lF(e,i,t.text,{label:t.text,orient:o});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}t[s].cacheInfo=c}}))})(this._stateByField,e,null!=t?t:this.enableRemain),Object.keys(this._stateByField).forEach((t=>{this._layoutByField(t)})))}_layoutByField(t){var e,i,s;const{cacheInfo:n,attributes:r,crosshairComp:a,labelsComp:o,coordKey:l}=this._stateByField[t];if(!n||n._isCache&&this.enableRemain)return;const h=this.getContainer(),{visible:c,labels:d,coord:u,sizeRange:p,axis:g}=n;if(c){const n=this.getLayoutStartPoint(),c=null===(i=null===(e=this._spec.valueField)||void 0===e?void 0:e.line)||void 0===i?void 0:i.smooth,f=((t,e,i)=>{const{cacheInfo:s,coordKey:n,attributes:r}=t,{axis:a,coord:o,sizeRange:l,coordRange:h}=s,c=a.getCenter(),d={x:c.x+e.x,y:c.y+e.y};if("angle"===n)return"sector"==("rect"===r.type?"sector":"line")?{center:d,innerRadius:a.getInnerRadius(),radius:a.getOuterRadius(),startAngle:h[0],endAngle:h[1]}:{start:he(d,a.getInnerRadius(),o),end:he(d,a.getOuterRadius(),o)};const u=a.startAngle,p=a.endAngle,g=s.sides;let f=o;if(!i){const t=a.getCenter(),e=a.coordToPoint({angle:l[0],radius:o}),i=de(t,e),s=(p-u)/g,n=Math.floor((i-u)/s),r=n*s+u,h=Math.min((n+1)*s+u,p),c=he(t,o,r),d=he(t,o,h),m=ve([d.x,d.y],[c.x,c.y],[t.x,t.y],[e.x,e.y]);m&&(f=vt(re.distancePN(e,m[0],m[1])+o,a.getInnerRadius(),a.getOuterRadius()))}return{center:d,startAngle:u,endAngle:p,radius:f,sides:g}})(this._stateByField[t],n,c);if(a)a.setAttributes(f);else{let e;if("angle"===l){const t="rect"===r.type?"sector":"line";"line"===t?e=new lT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===t&&(e=new dT(Object.assign(Object.assign({},f),{sectorStyle:r.style,zIndex:this.gridZIndex,pickable:!1})))}else{e="polygon"===(c?"circle":"polygon")?new uT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex+1})):new cT(Object.assign(Object.assign({},f),{lineStyle:r.style,zIndex:this.gridZIndex}))}this._stateByField[t].crosshairComp=e,h.add(e)}const m=d.all;if(m.visible){const t=g.getCenter(),e={x:t.x+n.x,y:t.y+n.y},i="angle"===l?function(t){let e="center",i="middle";return e=(t=ue(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}}(u):function(t){let e="center",i="middle";return e=(t=ue(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}}(g.startAngle),a="angle"===l?he(e,p[1]+m.offset,u):he(e,f.radius,g.startAngle),h=Object.assign(Object.assign(Object.assign(Object.assign({},a),r.label),m),{textStyle:Object.assign(Object.assign({},null===(s=r.label)||void 0===s?void 0:s.textStyle),{textAlign:i.align,textBaseline:i.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(o.all,h,(t=>{t.name=`crosshair-${l}-label`,o.all=t}))}else o.all&&o.all.hideAll()}}}LK.specKey="crosshair",LK.builtInTheme={crosshair:BK},LK.type=r.polarCrosshair;const RK=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(u(o)||u(a))return t;const l=r(),h=y(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},OK=(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=>{let e=!1;return Y(r).every((i=>{t[i]>=a[0]&&t[i]<=$(a)&&(e=!0)})),e}:t=>{let e=!1;return Y(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},IK=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n,isCategoryState:r,seriesCollection:a}=e.input,{stateField:o,valueField:l}=e.output,h={},c=[],d=[],g=[];let f=!1,m=!1;n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=a[e];if(r){const t=r.getRawDataStatisticsByField(i[e]);p(null==t?void 0:t.max)&&p(null==t?void 0:t.min)&&(m=!0)}const o=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];o&&o.lockStatisticsByDomain&&(f=!0,o.domain.forEach((t=>{u(h[t])&&(g.push(t),h[t]=0,c.push(t))}))),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(h[t[i]])&&(g.push(t[i]),h[t[i]]=0,c.push(t[i])),u(s[e])||(h[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))}));const v=f?g:!1===r||m?g.sort(((t,e)=>t-e)):c;return v.forEach((t=>{const e={[o]:t};l&&(e[l]=h[t]),d.push(e)})),d},DK=(t,e,i)=>{const s=e.domain();if(VC(e.type))return i?s[0]+($(s)-s[0])*(1-t):s[0]+($(s)-s[0])*t;let n=e.range();i&&(n=n.slice().reverse());const r=n[0]+($(n)-n[0])*t;return e.invert(r)},FK=(t,e,i)=>{const s=e.scale(t);let n=e.range();return!i&&VC(e.type)&&(n=n.slice().reverse()),Math.max(0,Math.min(1,(s-n[0])/($(n)-n[0])))},zK=(t,e)=>{const i=t;if(!i)return!1;const s=i.getScale();return s.range()[0]>s.range()[1]&&(!i.getInverse()||e)},jK=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}},HK=(t,e,i)=>"start"===t?"percent"===e&&p(i.start)||"value"===e&&p(i.startValue):"percent"===e&&p(i.end)||"value"===e&&p(i.endValue),VK=(t,e,i)=>{if(VC(i.type))return[Math.min(e,t),Math.max(e,t)];const s=i.domain(),n=s.indexOf(t),r=s.indexOf(e);return s.slice(Math.min(n,r),Math.max(n,r)+1)};class NK{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})}constructor(t,e,i,s,n,r,a,o){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.initZoomEvent=()=>{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,allowComponentZoom:!0};this._zoomAttr.enable&&this.initZoomEventOfRegions(this.getRegions(),null,this.handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this.getRegions(),null,this.handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this.getRegions(),null,this.handleChartDrag,o)},this.handleChartZoom=(t,e)=>{var i,s;if(!this._activeRoam||this._zoomAttr.filter&&!this._zoomAttr.filter(t,e))return;const{zoomDelta:n,zoomX:r,zoomY:a}=t,{x:o,y:l}=this.getRegions()[0].getLayoutStartPoint(),{width:h,height:c}=this.getRegions()[0].getLayoutRect(),d=Math.abs(this.getState().start-this.getState().end),u=null!==(s=null===(i=this._spec.roamZoom)||void 0===i?void 0:i.rate)&&void 0!==s?s:1;if(d>=1&&n<1)return;if(d<=.01&&n>1)return;const p=this._isHorizontal?r:a,g=d*(n-1)*u;let f=g/2,m=g/2;if(p){const t=this._isHorizontal?o:l,e=this._isHorizontal?h:c;f=Math.abs(t-p)/Math.abs(e-t)*g,m=Math.abs(e-p)/Math.abs(e-t)*g}const v=vt(this.getState().start+f,0,1),_=vt(this.getState().end-m,0,1);this._handleChange(Math.min(v,_),Math.max(v,_),!0)},this.handleChartScroll=(t,e)=>{var i;if(!this._activeRoam||this._scrollAttr.filter&&!this._scrollAttr.filter(t,e))return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Nt(s/n)>=.5:Nt(n/s)>=.5;if(this._scrollAttr.reverse||(r=-r),a){const t=this._spec.scrollStep;if(k(t)){r=(r>0?1:-1)*(t*(this.getState().end-this.getState().start)/1)}this.handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1)}const o=0!==this.getState().start&&1!==this.getState().end;return a&&o},this.handleChartDrag=(t,e)=>{var i;if(!this._activeRoam||this._dragAttr.filter&&!this._dragAttr.filter(t,e))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.getState().end<1){const s=Math.min(1-this.getState().end,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}else if(t<0&&this.getState().start>0){const s=Math.max(-this.getState().start,t/i)*e;this._handleChange(this.getState().start+s,this.getState().end+s,!0)}return!1},this._type=t,this._spec=e,this._handleChange=i,this.getLayoutRect=s,this.getState=n,this.getRegions=r,this._regions=r(),this.getOption=a,this._option=a(),this.getEvent=o,this._isHorizontal="horizontal"===ez(tz(e))}setEventAttrFromSpec(){!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=j({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=j({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=j({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,c(this._spec.roam)&&(this._zoomAttr.enable="scrollBar"!==this._type&&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.getEvent(),this._option.mode)}}G(NK,RV);class UK extends sj{get isHorizontal(){return this._isHorizontal}get stateScale(){return this._stateScale}get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:FK(t,this._stateScale,this._isHorizontal),a="percent"===n?e:FK(e,this._stateScale,this._isHorizontal);this._handleChange(r,a,!0)}enableInteraction(){this._dataFilterEvent.enableInteraction()}disableInteraction(){this._dataFilterEvent.disableInteraction()}zoomIn(t){this._dataFilterEvent.zoomIn(t)}zoomOut(t){this._dataFilterEvent.zoomOut(t)}_initEvent(){var e;this._dataFilterEvent.initZoomEvent(),null===(e=this._relatedAxisComponent)||void 0===e||e.event.on(t.ChartEvent.scaleRawDomainUpdate,(({model:t})=>{console.log("scaleRawDomainUpdate",t.getRawDomain())}))}_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)}_updateRangeFactor(t){const e=this._relatedAxisComponent,i=e.getScale(),s=zK(e,this._isHorizontal),n=s?[1-this._end,1-this._start]:[this._start,this._end];if(s)switch(t){case"startHandler":e.scaleRangeFactorEnd(n[1]);break;case"endHandler":e.scaleRangeFactorStart(n[0]);break;default:e.scaleRangeFactorStart(n[0],!0),e.scaleRangeFactorEnd(n[1])}else switch(t){case"startHandler":e.scaleRangeFactorStart(n[0]);break;case"endHandler":e.scaleRangeFactorEnd(n[1]);break;default:e.scaleRangeFactorEnd(n[1],!0),e.scaleRangeFactorStart(n[0])}const r=i.rangeFactor();r?(this._start=s?1-r[1]:r[0],this._end=s?1-r[0]:r[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._hasInitStateScale=!1,this._shouldChange=!0,this._stateField="x",this._currentDataCollection=[],this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=VK(this._startValue,this._endValue,this._stateScale),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!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&&jK(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({value:"force"})}else nR(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),nR(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._orient=tz(t),this._isHorizontal="horizontal"===ez(this._orient),this._dataFilterEvent=new NK(this.type,this._spec,this._handleChange.bind(this),this.getLayoutRect.bind(this),(()=>({start:this._start,end:this._end})),(()=>this._regions),(()=>this._option).bind(this),(()=>this.event))}created(){this._handleDataCollectionChangeBound=this._handleDataCollectionChange.bind(this),super.created(),this._setAxisFromSpec(),this._setRegionsFromSpec(),this._initEvent(),this._initData(),this._initStateScale(),this._setStateFromSpec()}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||U(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])}))}))}onLayoutStart(t,e){super.onLayoutStart(t,e);const i=this._autoUpdate(t);this._autoVisible(i),this._dataUpdating=!1}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),this._hasInitStateScale||(0===this._start&&1===this._end||(this._newDomain=((t,e,i,s,n)=>{if(VC(n.type)){const r=n.domain(),a=r[0],o=$(r)-a,l=p(t)?a+o*t:+e,h=p(i)?a+o*i:+s;return[Math.min(h,l),Math.max(h,l)]}const r=n.domain(),a=n.range(),o=a[a.length-1]-a[0],l=p(t)?r.indexOf(n.invert(o*t+a[0])):r.indexOf(e),h=p(i)?r.indexOf(n.invert(o*i+a[0])):r.indexOf(s);return r.slice(Math.min(l,h),Math.max(l,h)+1)})(this._spec.start,this._startValue,this._spec.end,this._endValue,this._stateScale),this.effect.onZoomChange()),this._hasInitStateScale=!0)}_initAfterLayout(){this._stateScale=null,this._initStateScale(),this._updateScaleRange(),this._setStateFromAxis()}_beforeLayoutEnd(){this._hasInitStateScale?this._updateScaleRange():this._initAfterLayout()}onLayoutEnd(){var t;this._beforeLayoutEnd();const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(),null===(t=this._relatedAxisComponent)||void 0===t||t.updateScaleRange()}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}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._dataFilterEvent.setEventAttrFromSpec(),this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_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=>ez(t._orient)===ez(this._orient)));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!VC(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;}_collectDataInfo(){const t=[],e=[],i=[],s=[];let n;if(this._relatedAxisComponent){const e={};nR(this._regions,(r=>{var a,o;const l="cartesian"===r.coordinate?r.getXAxisHelper():"polar"===r.coordinate?r.angleAxisHelper:null,h="cartesian"===r.coordinate?r.getYAxisHelper():"polar"===r.coordinate?r.radiusAxisHelper:null;if(!l||!h)return;const c=l.getAxisId()===this._relatedAxisComponent.id?l:h.getAxisId()===this._relatedAxisComponent.id?h:this._isHorizontal?l:h,d=c===l?h:l,u=VC(d.getScale(0).type),p=VC(c.getScale(0).type);t.push(r.getRawData());const g=r.getSpec(),f="cartesian"===r.coordinate?Y(g.xField):Y(null!==(a=g.angleField)&&void 0!==a?a:g.categoryField),m="cartesian"===r.coordinate?Y(g.yField):Y(null!==(o=g.radiusField)&&void 0!==o?o:g.valueField);if(e[r.id]="link"===r.type?["from_xField"]:c===l?f:m,p?(n=!1,i.push(e[r.id])):(n=!0,i.push(e[r.id][0])),this._valueField){const t="link"===r.type?["from_yField"]:d===l?f:m;u&&s.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=e}else nR(this._regions,(n=>{t.push(n.getRawData()),e.push(n),i.push(this._field),this._valueField&&s.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});return{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}}_initData(){const{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n}=this._collectDataInfo(),{dataSet:r}=this._option;SI(r,"dataview",Ta),xI(r,"dataFilterComputeDomain",IK);const a=new Ba(r,{name:`${this.type}_${this.id}_data`});a.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,seriesCollection:e,stateFields:i,valueFields:s,isCategoryState:n},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new TD(this._option,a),a.reRunAllTransform(),this._currentDataCollection=t,r.multipleDataViewAddListener(t,"change",this._handleDataCollectionChangeBound)}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(xI(this._option.dataSet,"dataFilterWithNewDomain",OK),xI(this._option.dataSet,"lockStatisticsFilter",RK),nR(this._regions,(e=>{e.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>e.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>VC(this._stateScale.type)},level:1},!1),e.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var t;return null!==(t=this._field)&&void 0!==t?t:this._parseFieldOfSeries(e)},isContinuous:()=>VC(this._stateScale.type)},level:t.TransformLevel.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onDataUpdate(){var t;const{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r}=this._collectDataInfo();if(this._currentDataCollection.length!==e.length||this._currentDataCollection.some(((t,i)=>t!==e[i]))){this._currentDataCollection.forEach((t=>{var e;null===(e=null==t?void 0:t.target)||void 0===e||e.removeListener("change",this._handleDataCollectionChangeBound)})),this._currentDataCollection=e;const{dataSet:t}=this._option;t.multipleDataViewAddListener(this._currentDataCollection,"change",this._handleDataCollectionChangeBound)}this._data.getDataView().transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:e,seriesCollection:i,stateFields:s,valueFields:n,isCategoryState:r},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data.getDataView().reRunAllTransform();const a=this._computeDomainOfStateScale(VC(this._stateScale.type));this._stateScale.domain(a,!1),(p(this._spec.start)||p(this._spec.end))&&this._setStateFromSpec(),this._handleChange(this._start,this._end,!0),this._spec.auto&&!U(this._domainCache,a)&&(this._domainCache=a,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_setStateFromSpec(){let t,e;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[i,s]=this._spec.rangeMode;HK("start",i,this._spec)&&HK("end",s,this._spec)&&(t="percent"===i?this._spec.start:FK(this._spec.startValue,this._stateScale,this._isHorizontal),e="percent"===s?this._spec.end:FK(this._spec.endValue,this._stateScale,this._isHorizontal))}else t=this._spec.start?this._spec.start:this._spec.startValue?FK(this._spec.startValue,this._stateScale,this._isHorizontal):0,e=this._spec.end?this._spec.end:this._spec.endValue?FK(this._spec.endValue,this._stateScale,this._isHorizontal):1;this._start=Math.max(0,Math.min(1,t)),this._end=Math.max(0,Math.min(1,e))}_setStateFromAxis(){var t,e;this._setStateFromSpec();const i=this._relatedAxisComponent;this._startValue=DK(this._start,this._stateScale,zK(i,this._isHorizontal)),this._endValue=DK(this._end,this._stateScale,zK(i,this._isHorizontal)),this._minSpan=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,VC(this._stateScale.type)&&this._stateScale.domain()[0]!==$(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),i&&(i&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=VK(this._startValue,this._endValue,this._stateScale)))}_initStateScale(){var t,e,i,s,n,r;const a=[0,1];if(this._relatedAxisComponent){const o=this._relatedAxisComponent.getScale().clone();this._stateScale=o,null===(e=(t=o).maxBandwidth)||void 0===e||e.call(t,"auto",!0),null===(s=(i=o).minBandwidth)||void 0===s||s.call(i,"auto",!0),null===(r=(n=o).bandwidth)||void 0===r||r.call(n,"auto",!0),o.rangeFactor(a,!0).range(a)}else{let t=!0;this._field&&nR(this._regions,(e=>{const i=e.getRawDataStatisticsByField(this._field);k(null==i?void 0:i.min)&&k(null==i?void 0:i.max)||(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._stateScale=t?new PE:new cE,this._stateScale.domain(this._computeDomainOfStateScale(t),!0).range(a)}}_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?[K(t),X(t)]:[-1/0,1/0]}return e}_autoVisible(e){if(!this._auto)return;e?this.show():this.hide();const i=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[i]:e?this[`_${i}`]:0},{[i]:t.AttributeLevel.Built_In})}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_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=jK(h);if(!this._dataUpdating&&UC(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,UC(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),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}G(UK,RV);class WK extends ij{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=XR({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}}}const GK=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),YK={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:GK(!1),startHandler:{style:{symbolType:"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;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"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;",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:GK(!0)};class $K extends UK{constructor(e,i){var s;super(e,i),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=WK,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=this._isHorizontal?0:this._middleHandlerSize,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=this._isHorizontal?0:this._middleHandlerSize,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._getPreviewStateScale(),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._getPreviewStateScale(),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"}_handleChange(e,i,s,n){if(super._handleChange(e,i,s),this._shouldChange)if(s&&this._component)this._component.setStartAndEnd(e,i);else{const s=this._relatedAxisComponent,r=DK(e,this._stateScale,zK(s,this._isHorizontal)),a=DK(i,this._stateScale,zK(s,this._isHorizontal));if(!p(r)||!p(a))return;this._start=e,this._end=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(){this._data.getDataView().reRunAllTransform(),this._initAfterLayout();const t=this._computeDomainOfValueScale();t&&(this._valueScale||(this._valueScale=new PE),this._valueScale.domain(t),this._updateValueScaleRange(),this._component&&this._createOrUpdateComponent(!0))}created(){super.created(),this._initValueScale()}updateLayoutAttribute(){!1!==this._cacheVisibility&&super.updateLayoutAttribute()}_beforeLayoutEnd(){super._beforeLayoutEnd();const t=this._relatedAxisComponent;(zK(t,this._isHorizontal)&&!this._isReverseCache||this._auto)&&(this._isReverseCache=zK(t,this._isHorizontal),this.effect.onZoomChange())}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}getBoundsInRect(t){var e,i,s,n;const r={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},a=this._startHandlerSize*(null!==(e=this._spec.startHandler.style.scaleX)&&void 0!==e?e:1),o=this._startHandlerSize*(null!==(i=this._spec.startHandler.style.scaleY)&&void 0!==i?i:1),l=this._endHandlerSize*(null!==(s=this._spec.endHandler.style.scaleX)&&void 0!==s?s:1),h=this._endHandlerSize*(null!==(n=this._spec.endHandler.style.scaleY)&&void 0!==n?n:1),c=this._visible?this._isHorizontal?(a-this._startHandlerSize)/2+(l-this._endHandlerSize)/2:(Math.max(a,l)-this._width)/2:0,d=this._visible?this._isHorizontal?(Math.max(o,h)-this._height)/2:(o-this._startHandlerSize)/2+(h-this._endHandlerSize)/2:0;return this._isHorizontal?(r.y2=r.y1+this._height+d,r.x2=r.x1+t.width+c):(r.x2=r.x1+this._width+c,r.y2=r.y1+t.height+d),r}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec();const c=this._isHorizontal?Number(this._spec.height):Number(this._spec.width);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(),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=isNaN(c)?this._backgroundSize:c-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=isNaN(c)?this._backgroundSize:c-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,this._width=this._computeWidth(),this._height=this._computeHeight()}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new PE;e.domain(t),this._valueScale=e}}_updateScaleRange(){this._updateStateScaleRange(),this._updateValueScaleRange()}_updateStateScaleRange(){var t,e,i;const s=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale)return;let n;const r=this._isHorizontal?this.getLayoutRect().width-s:this.getLayoutRect().height-s,a=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,r+this._startHandlerSize/2],o=this._computeWidth(),l=this._computeHeight();n=this._isHorizontal?this._visible?[this._startHandlerSize/2,o-s+this._startHandlerSize/2]:a:this._visible?[this._startHandlerSize/2,l-s+this._startHandlerSize/2]:a,this._stateScale.range(n),null===(i=this._previewStateScale)||void 0===i||i.range(zK(this._relatedAxisComponent,this._isHorizontal)?n.reverse():n)}_updateValueScaleRange(){if(!this._valueScale)return;const t=this._computeWidth(),e=this._computeHeight();this._isHorizontal?this._valueScale.range([e-this._middleHandlerSize,0]):"left"===this.layoutOrient?this._valueScale.range([t-this._middleHandlerSize,0]):this._valueScale.range([0,t-this._middleHandlerSize])}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[K(e),X(e)]:null}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!VC(t.type)||e[0]!==$(e))&&(!UC(t.type)||1!==(i=e,i&&y(i)?Array.from(new Set(Y(i))):i).length);var i}_getXScale(){return this._relatedAxisComponent.getScale().type===this.stateScale.type&&this._isHorizontal?this.stateScale:this._isHorizontal?this._stateScale:this._valueScale}_getYScale(){return this._isHorizontal?this._valueScale:this._stateScale}_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:Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?Math.max(this._startHandlerSize||0,this._endHandlerSize||0,this._backgroundSize||0)+this._middleHandlerSize:this.getLayoutRect().height}_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._computeWidth(),height:this._computeHeight()},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,isReverse:zK(this._relatedAxisComponent,this._isHorizontal)},this._getComponentAttrs(t))}_getLayoutAttrs(){return{position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},size:{width:this._computeWidth(),height:this._computeHeight()}}}_createOrUpdateComponent(t){if(this._visible){const e=!1!==this._spec.showBackgroundChart,i=this._getAttrs(e),s=this._relatedAxisComponent;if(this._component)this._component.setAttributes(i),t&&(this._component.setPreviewData(this._data.getDataView().latestData),e&&(this._isHorizontal?this._component.setPreviewPointsY1(this._dataToPositionY2):this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>DK(t,this._stateScale,zK(s,this._isHorizontal))))));else{const t=this.getContainer();this._component=new aP(i),this._component.setPreviewData(this._data.getDataView().latestData),this._isHorizontal?e&&this._component.setPreviewPointsY1(this._dataToPositionY2):e&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>DK(t,this._stateScale,zK(s,this._isHorizontal)))),this._component.addEventListener("dataZoomChange",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component)}}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:f={},selectedBackgroundChart:m={}}=this._spec;return{backgroundStyle:oI(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:oI(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:oI(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:oI(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:oI(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:oI(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:oI(g.style)},selectedBackgroundStyle:oI(this._spec.selectedBackground.style),dragMaskStyle:oI(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:XR(oI(null===(l=f.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},oI(null===(h=f.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:XR(oI(null===(c=m.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},oI(null===(d=m.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}=lF(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}onDataUpdate(){super.onDataUpdate(),this._previewStateScale!==this._stateScale&&(this._previewStateScale=null)}_getPreviewStateScale(){return this._previewStateScale||(zK(this._relatedAxisComponent,this._isHorizontal)?(this._previewStateScale=this._stateScale.clone(),this._previewStateScale.range(this._stateScale.range().reverse())):this._previewStateScale=this._stateScale),this._previewStateScale}}$K.type=r.dataZoom,$K.transformerConstructor=WK,$K.builtInTheme={dataZoom:YK},$K.specKey="dataZoom";const XK={horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}};class KK extends UK{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"}_handleChange(e,i,s){super._handleChange(e,i,s);const n=KL(this._start,e)&&KL(this._end,i);if(this._shouldChange&&(!n||!1===this._spec.realTime)){s&&this._component&&this._component.setAttribute("range",[e,i]),this._start=e,this._end=i;const n=this._relatedAxisComponent,r=zK(n,this._isHorizontal),a=DK(e,this._stateScale,r),o=DK(i,this._stateScale,r);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(e,i,a,o):this._handleStateChange(a,o))&&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(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_beforeLayoutEnd(){var t,e;super._beforeLayoutEnd(),null===(e=(t=this.effect).onZoomChange)||void 0===e||e.call(t)}onLayoutEnd(){this._updateComponentBounds(),super.onLayoutEnd()}_updateScaleRange(){}_updateComponentBounds(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r,a;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,minSliderSize:null===(a=this._spec)||void 0===a?void 0:a.minSliderSize},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new pM(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),this._component.addEventListener("scrollUp",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),P(null==t?void 0:t.style)||(s.railStyle=oI(t.style)),P(null==e?void 0:e.style)||(s.sliderStyle=oI(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}KK.type=r.scrollBar,KK.builtInTheme={scrollBar:XK},KK.specKey="scrollBar";const qK=(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},ZK=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),JK={title:{visible:!0,autoLimit:!1,autoFit:!1,style:ZK("l1FontSize","primaryFontColor")},content:{visible:!0,style:ZK("l2FontSize","tertiaryFontColor")}};class QK extends sj{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){return hF(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}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))}initEvent(){if(this._option.disableTriggerEvent)return;"none"!==this._spec.trigger&&("hover"===this._spec.trigger?(this.event.on("element-highlight:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(hI(e))})),this.event.on("element-highlight:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))):(this.event.on("element-select:start",(t=>{const e=t.graphics[0];this.isRelativeModel(e)&&this.updateDatum(hI(e))})),this.event.on("element-select:reset",(t=>{this._activeDatum&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){xI(this._option.dataSet,"indicatorFilter",qK);const t=new Ba(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 TD(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:i,height:s}=t.getLayoutRect(),{x:n,y:r}=t.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,u=e(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return Y(o).forEach((t=>{const e=XR({},this._theme.content,t);g.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({},aI(H(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?FR(l,this._computeLayoutRadius()):0,dy:h?FR(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!p(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},aI(H(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},u)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)U(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new SL(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_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.getSeriesInId(t.context.modelId)))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}QK.type=r.indicator,QK.builtInTheme={indicator:JK},QK.specKey="indicator";const tq=["sum","average","min","max","variance","standardDeviation","median"];function eq(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=K(s),r=X(s);return er}function iq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&eq(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=BR(t.x)?aq(t.x,n)+r.x:oq(l.getXAxisHelper(),[t.x])+r.x,h}function sq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&eq(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=BR(t.y)?aq(t.y,n)+r.y:oq(l.getYAxisHelper(),[t.y])+r.y,h}function nq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&eq(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)),oq(a.angleAxisHelper,[t.angle])}function rq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&eq(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)),oq(a.radiusAxisHelper,[t.radius])}function aq(t,e){return Number(t.substring(0,t.length-1))*e/100}function oq(t,e){const i=t.getScale(0);return VC(i.type)&&i.domain()[0]===i.domain()[1]&&e[0]!==i.domain()[0]?NaN:t.dataToPosition(e)}function lq(t){return tq.includes(t)}function hq(t,e,i,s,n,r=!1){const a=e.getRegion(),o=a.getLayoutStartPoint(),l=i.getRegion(),h=l.getLayoutStartPoint(),c=Math.abs(Math.min(o.x,h.x)-Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width)),d=Math.abs(Math.min(o.y,h.y)-Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height)),u={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},g=[],f=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper(),v=s.getYAxisHelper(),_=m.getScale(0).domain(),y=v.getScale(0).domain(),b=r&&!m.isContinuous&&!!m.getBandwidth,x=r&&!v.isContinuous&&!!v.getBandwidth,S={min:null,max:null},A={min:null,max:null};return f.forEach((t=>{const e=p(t.x),i=p(t.y);let s,r;if(e&&i)s=iq(t,_,n,u,c,o),r=sq(t,y,n,u,d,o),cq(s,b,S,g.length),cq(r,x,A,g.length),g.push([{x:s,y:r}]);else if(e){s=iq(t,_,n,u,c,o),r=Math.max(o.y+a.getLayoutRect().height,h.y+l.getLayoutRect().height);const e=Math.min(o.y,h.y);cq(s,b,S,g.length),g.push([{x:s,y:r},{x:s,y:e}])}else if(i){s=Math.min(o.x,h.x),r=sq(t,y,n,u,d,o);const e=Math.max(o.x+a.getLayoutRect().width,h.x+l.getLayoutRect().width);cq(r,x,A,g.length),g.push([{x:s,y:r},{x:e,y:r}])}})),function(t,e,i,s,n){if(s.min||s.max){const i=e.getBandwidth(0)*(1+e.getScale(0).paddingInner());s.min&&t[s.min.index].forEach((t=>t.x-=i/2)),s.max&&t[s.max.index].forEach((t=>t.x+=i/2))}if(n.min||n.max){const e=i.getBandwidth(0)*(1+i.getScale(0).paddingInner());n.min&&t[n.min.index].forEach((t=>t.y-=e/2)),n.max&&t[n.max.index].forEach((t=>t.y+=e/2))}}(g,m,v,S,A),g}function cq(t,e,i,s){return e&&((null===i.min||i.min.value>t)&&(i.min={value:t,index:s}),(null===i.max||i.max.value{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=nq(t,l,n,r),i=rq(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=nq(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=rq(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function uq(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:f}=u.getLayoutRect();let m=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(m=BR(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=BR(i)?Number(i.substring(0,i.length-1))*f/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])&&eq(_,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])&&eq(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:oq(d.getXAxisHelper(),b)+p.x+m,y:oq(d.getYAxisHelper(),x)+p.y+v})})),n}function pq(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])&&eq(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])&&eq(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:oq(l.angleAxisHelper,d),radius:oq(l.radiusAxisHelper,u)})})),s}function gq(t,e,i){let{x:s,y:n}=t;return BR(s)&&(s=aq(s,e)),BR(n)&&(n=aq(n,i)),{x:s,y:n}}function fq(t,e,i){let s;if(s=d(t)?Y(t(e.getData().getLatestData(),e)):Y(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=gq(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>gq(t,n,r)))}function mq(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 vq(t,i,s){const{labelBackground:n={},style:r,shape:a}=t,o=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},oI(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},yq(oI(n.style),i,s)),p(n.padding)&&(t.padding=ri(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=yq(oI(r),i,s)),t}return{visible:!1}}function _q(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function yq(t,e,i){return d(t)?t(e,i):t}function bq(t,e){return d(t)?t(e):t}function xq(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 Sq(t){return{isXProcess:p(t.x),isYProcess:p(t.y),isX1Process:p(t.x1),isY1Process:p(t.y1),isAngleProcess:p(t.angle),isRadiusProcess:p(t.radius),isAngle1Process:p(t.angle1),isRadius1Process:p(t.radius1),isCoordinatesProcess:p(t.coordinates),isValidProcess:p(t.process)}}function Aq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h,isValidProcess:c}=Sq(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:h&&(!c||"process"in t&&"xy"in t.process)}}function kq(t){const{isXProcess:e,isYProcess:i,isX1Process:s,isY1Process:n,isAngleProcess:r,isRadiusProcess:a,isAngle1Process:o,isRadius1Process:l,isCoordinatesProcess:h}=Sq(t);return{doXProcess:e&&s&&!i&&!n,doYProcess:i&&n&&!e&&!s,doXYProcess:e&&s&&i&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:h}}function Mq(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function Tq(t,i){let s;if(i.coordinates){const t=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=t,o=e(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(d(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=Y(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;p(r)&&(c=Y(i)[r]),n&&Y(i).includes(n)&&(c=n);let d=s;p(l)&&(d=Y(s)[l]),a&&Y(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),_(t[c])&&lq(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),_(t[d])&&lq(t[d])?h.y={field:d,aggrType:t[d]}:h.y=Y(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;p(r)&&(a=Y(s)[r]),n&&Y(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),_(t[a])&&lq(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),_(t[l])&&lq(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=Y(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const s=e.x;y(s)?i.x=s.map((i=>Cq(i,t,e))):i.x=Cq(s,t,e)}if(p(e.y)){const s=e.y;y(s)?i.y=s.map((i=>Cq(i,t,e))):i.y=Cq(s,t,e)}if(p(e.angle)){const s=e.angle;y(s)?i.angle=s.map((i=>Cq(i,t,e))):i.angle=Cq(s,t,e)}if(p(e.radius)){const s=e.radius;y(s)?i.radius=s.map((i=>Cq(i,t,e))):i.radius=Cq(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=Cq(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const wq={min:(t,e)=>qL(t[0].latestData,e.field),max:(t,e)=>ZL(t[0].latestData,e.field),sum:function(t,e){return JL(t[0].latestData,e.field)},average:function(t,e){return QL(t[0].latestData,e.field)},variance:function(t,e){return tR(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(tR(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 Cq(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(m(t)){const{aggrType:i,field:s}=t;return wq[i](e,{field:s})}return t}function Eq(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 Bq extends sj{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){return hF(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_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)&&lq(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){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new Ea;return e.registerParser("array",s),new Ba(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)))}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=aR(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){u(this._spec.offsetX)||(this._layoutOffsetX=LR(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=LR(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e)}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}_initCommonDataView(){const{options:t}=this._computeOptions(),e=this._getRelativeDataView();xI(this._option.dataSet,"markerAggregation",Tq),xI(this._option.dataSet,"markerFilter",Eq);const i=new Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`});i.parse([e],{type:"dataview"}),i.transform({type:"markerAggregation",options:t}),i.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),i.target.on("change",(()=>{this._markerLayout()})),this._markerData=i}}function Pq(t,e){return function(t,e,i){const{predict:s}=Dt(t,(t=>t[e]),(t=>t[i])),n=qL(t,e),r=ZL(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}class Lq extends Bq{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}=Aq(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;const{startSymbol:p={},endSymbol:g={}}=this._spec,f=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),m={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},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:yq(oI(null===(n=this._spec.line)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:f.map((t=>vq(t,this._markerData,this._markAttributeContext))),state:{line:_q(null!==(o=null===(a=this._spec.line)||void 0===a?void 0:a.state)&&void 0!==o?o:{},this._markerData,this._markAttributeContext),lineStartSymbol:_q(null!==(h=null===(l=this._spec.startSymbol)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineEndSymbol:_q(null!==(d=null===(c=this._spec.endSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),label:f.map((t=>{var e;return _q(null!==(e=t.state)&&void 0!==e?e:{},this._markerData,this._markAttributeContext)})),labelBackground:f.map((t=>{var e,i;return _q(null!==(i=null===(e=t.labelBackground)||void 0===e?void 0:e.state)&&void 0!==i?i:{},this._markerData,this._markAttributeContext)}))},animation:null!==(u=this._spec.animation)&&void 0!==u&&u,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};p.visible?m.startSymbol=Object.assign(Object.assign({},p),{visible:!0,style:yq(oI(p.style),this._markerData,this._markAttributeContext)}):m.startSymbol={visible:!1},g.visible?m.endSymbol=Object.assign(Object.assign({},g),{visible:!0,style:yq(oI(g.style),this._markerData,this._markAttributeContext)}):m.endSymbol={visible:!1};return this._newMarkLineComponent(m)}_getUpdateMarkerAttrs(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,o=this._computePointsAttr(),l=a.getViewData().latestData,h=s.latestData[0]&&s.latestData[0].latestData?s.latestData[0].latestData:s.latestData;let c;if(i.clip||Y(i.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:s}=mq([n.getRegion(),r.getRegion(),a.getRegion()]);c={x:t,y:i,width:e-t,height:s-i}}const d=Y((null!==(e=null===(t=this._markerComponent)||void 0===t?void 0:t.attribute)&&void 0!==e?e:{}).label),u=Y(this._spec.label),p=d.map(((t,e)=>{const i=u[e]||{};return Object.assign(Object.assign({},t),{text:i.formatMethod?i.formatMethod(h,l):null==t?void 0:t.text})}));return Object.assign(Object.assign({},o),{label:p,limitRect:c,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}=Aq(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;xI(this._option.dataSet,"markerAggregation",Tq),xI(this._option.dataSet,"markerRegression",Pq),xI(this._option.dataSet,"markerFilter",Eq);const{options:u,needAggr:p,needRegr:g,processData:f}=this._computeOptions(),m=new Ba(this._option.dataSet);m.parse([f],{type:"dataview"}),p&&m.transform({type:"markerAggregation",options:u}),g&&m.transform({type:"markerRegression",options:u}),m.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),m.target.on("change",(()=>{this._markerLayout()})),this._markerData=m}}Lq.specKey="markLine";const Rq=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),Oq={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"}}},refY:5},Iq={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:Rq(!1),endSymbol:Rq(!0),label:Oq};class Dq extends Lq{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new GP(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:f,doYXX1Process:m,doXYProcess:v,doCoordinatesProcess:_}=Aq(e);let y=[];if(u||f||g||m||v||a&&l||a&&h){const t=hq(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=uq(i,r,d,e.coordinatesOffset):c&&(y=fq(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n;const r=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const n=this._startRelativeSeries,a=this._endRelativeSeries,{multiSegment:o,mainSegmentIndex:l}=this._spec.line||{},{connectDirection:h,expandDistance:c=0}=this._spec;let d;if(BR(c)){const t=n.getRegion(),e=t.getLayoutStartPoint(),i=a.getRegion(),s=i.getLayoutStartPoint();if("bottom"===h||"top"===h){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));d=Number(c.substring(0,c.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));d=Number(c.substring(0,c.length-1))*n/100}}else d=c;const{points:u,limitRect:g}=r;if(!u||u.length<2)return void(null===(t=this._markerComponent)||void 0===t||t.setAttributes(r));const f=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}(u[0],u[1],h,d);let m;m=o&&p(l)?{position:"middle",autoRotate:!1}: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)}:{}}(u[0],u[1],h,d));const v=Y((null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{}).label),_=Y(r.label),y=Y(this._spec.label);null===(s=this._markerComponent)||void 0===s||s.setAttributes({points:o?[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]]]:f,label:_.map(((t,e)=>{var i,s,n,r;let a=0,o=0,l=null!==(i=m.dx)&&void 0!==i?i:0,h=null!==(s=m.dy)&&void 0!==s?s:0;const c=null!==(n=y[e])&&void 0!==n?n:y[0];return k(null==c?void 0:c.refX)&&(a+=c.refX),k(null==c?void 0:c.refY)&&(o+=c.refY),k(null==c?void 0:c.dx)&&(l+=c.dx),k(null==c?void 0:c.dy)&&(h+=c.dy),Object.assign(Object.assign(Object.assign({},t),m),{refX:a,refY:o,dx:l,dy:h,textStyle:Object.assign(Object.assign({},null===(r=v[e])||void 0===r?void 0:r.textStyle),{textAlign:"center",textBaseline:"middle"})})})),limitRect:g,multiSegment:o,mainSegmentIndex:l,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(n=this._markerComponent)||void 0===n||n.setAttributes(r)}_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}=Aq(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 Ba(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&p(n.process.x)&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&p(n.process.y)&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&p(n.process.xy)){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}}}Dq.type=r.markLine,Dq.coordinateType="cartesian",Dq.builtInTheme={markLine:Iq};class Fq extends Lq{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=Aq(this._spec);return e||i?new XP(t):new GP(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}=Aq(e);let p=[],g={};const f={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=dq(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:f}:{points:p.map((t=>he(f,t.radius,t.angle)))}}else u&&(p=pq(i,r,a),g={points:p.map((t=>he(f,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=Aq(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}}}Fq.type=r.polarMarkLine,Fq.coordinateType="polar",Fq.builtInTheme={polarMarkLine:Iq};class zq extends sj{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=ER(e.orient)?e.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return hF(t,this.specKey,r.title,(t=>!1!==t.visible))}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}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;if(!1===this._spec.visible)return{visible:!1};const a=this.getLayoutRect(),o=LR(this._spec.width,a.width,null,a.width),l=LR(this._spec.maxWidth,a.width,null,a.width),h=Math.max(Math.min(o,l,a.width),0),c=p(this._spec.text)&&""!==this._spec.text,d=p(this._spec.subtext)&&""!==this._spec.subtext,u=Object.assign(Object.assign({},H(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:c?this._spec.text:void 0,subtextType:null!==(e=this._spec.subtextType)&&void 0!==e?e:"text",subtext:d?this._spec.subtext:void 0,x:null!==(i=this._spec.x)&&void 0!==i?i:0,y:null!==(s=this._spec.y)&&void 0!==s?s:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:h,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(n=this._spec.align)&&void 0!==n?n:"left",verticalAlign:null!==(r=this._spec.verticalAlign)&&void 0!==r?r:"top",textStyle:Object.assign({maxLineWidth:h},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:h},this._spec.subtextStyle)});if(c&&(u.textStyle.width=h),d&&(u.subtextStyle.width=h),p(this._spec.width)){const t=Math.max(Math.min(o,a.width),0);c?u.textStyle.width=t:delete u.textStyle.width,d&&(u.subtextStyle.width=t)}return u}_createOrUpdateTitleComponent(t){if(this._titleComponent)U(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new bL(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}}zq.type=r.title,zq.specKey=r.title,zq.builtInTheme={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"}}}};class jq extends Bq{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=t.LayoutZIndex.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=kq(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o;const l=Y(null!==(t=this._spec.label)&&void 0!==t?t:{}),h={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:yq(oI(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:l.map((t=>vq(t,this._markerData,this._markAttributeContext))),state:{area:_q(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:l.map((t=>_q(t.state,this._markerData,this._markAttributeContext))),labelBackground:l.map((t=>{var e;return _q(null===(e=t.labelBackground)||void 0===e?void 0:e.state,this._markerData,this._markAttributeContext)}))},animation:null!==(o=this._spec.animation)&&void 0!==o&&o,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(h)}_markerLayout(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=this._computePointsAttr(),o=this._getRelativeDataView().latestData,l=i?i.latestData[0]&&i.latestData[0].latestData?i.latestData[0].latestData:i.latestData:o;let h;if(e.clip||Y(e.label).some((t=>null==t?void 0:t.confine))){const{minX:t,maxX:e,minY:i,maxY:a}=mq([s.getRegion(),n.getRegion(),r.getRegion()]);h={x:t,y:i,width:e-t,height:a-i}}if(this._markerComponent){const e=Y(null===(t=this._markerComponent.attribute)||void 0===t?void 0:t.label),i=Y(this._spec.label);this._markerComponent.setAttributes(Object.assign(Object.assign({},a),{label:e.map(((t,e)=>{const s=i[e]||{};return Object.assign(Object.assign({},t),{text:s.formatMethod?s.formatMethod(l,o):null==t?void 0:t.text})})),limitRect:h,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}=kq(t);if(!(e||i||s||n||r||a||o))return null;this._initCommonDataView()}}jq.specKey="markArea";const Hq={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"}}}}};class Vq extends jq{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new $P(t)}_computePointsAttr(){var t,e;const i=this._spec,s=this._markerData,n=this._startRelativeSeries,r=this._endRelativeSeries,a=this._relativeSeries,{doXProcess:o,doYProcess:l,doXYProcess:h,doCoordinatesProcess:c}=kq(i),d=p(i.positions),u=null!==(t=i.autoRange)&&void 0!==t&&t,g=null!==(e=i.includeFullBand)&&void 0!==e&&e;let f=[],m=[];if(h){m=hq(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(o||l){m=hq(s,n,r,a,u,g);const[t,e]=m;t&&t.length&&e&&e.length&&(f=[...t,e[1],e[0]])}else c?f=uq(s,a,u,i.coordinatesOffset):d&&(f=fq(i.positions,a,i.regionRelative));return{points:f}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=kq(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}}}Vq.type=r.markArea,Vq.coordinateType="cartesian",Vq.builtInTheme={markArea:Hq};class Nq extends jq{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=kq(this._spec);return i||e||s?new KP(t):new $P(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}=kq(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=dq(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=pq(i,r,c),u={points:d.map((t=>he(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=kq(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}}}Nq.type=r.polarMarkArea,Nq.coordinateType="polar",Nq.builtInTheme={polarMarkArea:Hq};const Uq=t=>oI(Object.assign({},t)),Wq=t=>Object.assign(Object.assign({},t),{style:Object.assign({},oI(t.style))}),Gq=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,f;const m=Uq(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=Uq(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:{},oI(Object.assign({},y)));var y;const b=Wq(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=Wq(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=Wq(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),A=Wq(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!==(f=t.orient)&&void 0!==f?f:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:m,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},Yq=t=>"left"===t||"right"===t,$q=t=>"top"===t||"bottom"===t,Xq={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:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,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:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}};class Kq extends sj{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({},Gq(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({},Gq(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?U(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new DL(t):this._playerComponent=new jL(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=Yq(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=Yq(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.autoPlayCallback=()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&(this._playerComponent.pause(),this._playerComponent.play())},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback),this._option.globalInstance.on(t.ChartEvent.rendered,this.autoPlayCallback),this._playerComponent.addEventListener(BL.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(BL.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(BL.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(BL.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(BL.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(BL.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}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=Yq(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(k(t.y)){const e=$q(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}_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)):Yq(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))):$q(this._orient)?this._maxSize():t.height}_computeDx(t){return Yq(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return $q(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(e){const i=this._specs[e];this._option.globalInstance.updateFullData(i.data),this.event.emit(t.ChartEvent.playerChange,{model:this,value:{spec:i,index:e,specs:this._specs}})}release(){this._option.globalInstance.off(t.ChartEvent.rendered,this.autoPlayCallback)}}Kq.builtInTheme={player:Xq},Kq.specKey="player",Kq.type=r.player;class qq extends sj{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,U(e,t)||(i.reMake=!0),i}_getDataLabelType(t,e){const i=t.type;return"line"===i||"area"===i?null!=e?e:"line-data":"rect"===i?"rect":"arc"===i?"arc":"symbol"===i||"cell"===i?"symbol":t.setDataLabelType?t.setDataLabelType():""}_setTransformOfComponent(t,e){t.setAttributeTransform((({labelStyle:t,size:i,itemEncoder:s})=>{const n=i(),r=_R({type:"palette",key:"secondaryFontColor"},this.getColorScheme());return{dataLabels:Y(e).map(((e,i)=>{const a=t(i),o=[],l=e.getGraphics();if(l)return a.data&&a.data.length?a.data.forEach(((t,e)=>{if(l[e]){const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}})):l.forEach((t=>{const{data:e,diffState:n}=t.context;n!==tD.exit&&e.forEach(((t,{})=>{const e=s(t,{labelIndex:i});u(e.fill)&&(e.fill=r),u(e.data)&&(e.data=t),o.push(e)}))})),m(a.overlap)&&u(a.overlap.size)&&(a.overlap.size=Object.assign({},n)),Object.assign(Object.assign({smartInvert:!1,baseMarkGroupName:e.getProductId(),getBaseMarks:()=>l},a),{type:this._getDataLabelType(e,a.type),data:o})})),size:n}}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getComponent();i&&t.push(i)})),t}clear(){super.clear(),this.getMarks().forEach((t=>{t&&t.clearComponent()}))}}qq.type=r.label;class Zq extends DN{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}render(){}}Zq.type="text",Zq.constructorType="label";const Jq=()=>{FN(),KR.registerMark(Zq.constructorType,Zq)};class Qq extends ij{_initTheme(t,e){return{spec:t,theme:this._theme}}}class tZ extends qq{constructor(e,i){super(e,i),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=Qq,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.forEach((t=>{t.forEach((({labelMark:t})=>{t.release()}))})),this._labelInfoMap.clear()),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}initEvent(){this.event.on(t.ChartEvent.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.disableAnimation()})),this.event.on(uI.AFTER_MARK_RENDER_END,e)}));const e=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getComponent();i&&i.enableAnimation()})),this.event.off(uI.AFTER_MARK_RENDER_END,e)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),nR(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{var n,o,l;if(e.visible){const h=this._labelInfoMap.get(s),c=this._createMark({type:"label",name:`${null!==(n=t.userId)&&void 0!==n?n:t.id}-${r}-label-${i}`},{attributeContext:t.getMarkAttributeContext()});e.showRelatedMarkTooltip&&(null===(l=null===(o=t.tooltipHelper)||void 0===o?void 0:o.activeTriggerSet.mark)||void 0===l||l.add(c)),c.setTarget(a),h.push({labelMark:c,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){const t={};this._labelComponentMap.forEach(((e,i)=>{t[i.name]=i})),this._labelInfoMap.forEach(((e,i)=>{if("region"===this._layoutRule){let s=!1;const n=`${i.getGroupMark().name}-label-component`;let r=t[n];r||(s=!0,r=this._createMark({type:"component",name:n},{componentType:"label"},{support3d:this._spec.support3d})),r&&(s&&(r.setSkipBeforeLayouted(!0),this._marks.addMark(r),e.forEach((t=>{var e;null===(e=t.baseMark.getData())||void 0===e||e.addRelatedMark(r)}))),e[0]&&p(e[0].labelSpec.zIndex)&&r.setMarkConfig({zIndex:e[0].labelSpec.zIndex}),this._labelComponentMap.set(r,(()=>this._labelInfoMap.get(i))),t[n]=null)}else e.forEach(((e,s)=>{var n;let r=!1;const a=`${e.labelMark.name}-component`;let o=t[a];o||(r=!0,o=this._createMark({type:"component",name:a},{componentType:"label",noSeparateStyle:!0},{support3d:e.baseMark.getMarkConfig().support3d})),o&&(p(e.labelSpec.zIndex)&&o.setMarkConfig({zIndex:e.labelSpec.zIndex}),r&&(o.setSkipBeforeLayouted(!0),this._marks.addMark(o),null===(n=e.baseMark.getData())||void 0===n||n.addRelatedMark(o)),this._labelComponentMap.set(o,(()=>this._labelInfoMap.get(i)[s])),t[a]=null)}))})),Object.keys(t).forEach((e=>{const i=t[e];i&&(i.release(),this._labelComponentMap.delete(i))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((e=>{e.forEach((e=>{var i,s;const{labelMark:n,labelSpec:r,series:a}=e;if(this.initMarkStyleWithSpec(n,r),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,t.map((({baseMark:t})=>t)),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e,i,[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.setMarkConfig({interactive:!1}),t.setSimpleStyle({labelStyle:t=>{var e,n;const r=i[t],{labelSpec:a,labelMark:o,series:l}=r,h=o.getRule(),c=this._interactiveConfig(a),d=null!==(n=null===(e=this._spec)||void 0===e?void 0:e.centerOffset)&&void 0!==n?n:0;let u=XR({textStyle:Object.assign({pickable:!0===a.interactive},a.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},eN(h,r),Object.assign(Object.assign(Object.assign({},H(a,["position","style","state","type","stackDataFilterType","getStyleHandler"])),c),{centerOffset:d}),a.stackDataFilterType?{dataFilter:"min"===a.stackDataFilterType?t=>t.filter((t=>t.data[FO])):t=>t.filter((t=>t.data[DO]))}:{});return l&&l.parseLabelStyle&&(u=l.parseLabelStyle(u,a,o)),"line"!==h&&"area"!==h||(u.type=h),u},size:()=>{var t;return Object.assign({padding:null===(t=i[0].labelSpec.overlap)||void 0===t?void 0:t.padding},i[0].series.getRegion().getLayoutRect())},itemEncoder:(t,{labelIndex:e})=>i[e]&&!i[e].labelMark.skipEncode?iN(i[e],t,i[e].labelSpec.formatMethod,i[e].labelSpec.formatter):{data:t}}),this._setTransformOfComponent(t,e)}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=y(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i})}))}getLabelInfoByTextGraphic(t){let e;const i=null==t?void 0:t.parent,s=null==i?void 0:i.parent;if(s){const t=s.getChildren().indexOf(i);this._labelComponentMap.forEach(((i,n)=>{n.getComponent()===s&&(e=Y(i())[t])}))}return e}}tZ.type=r.label,tZ.specKey="label",tZ.transformerConstructor=Qq;class eZ extends qq{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()}reInit(t){super.reInit(t),this._initTextMark()}_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[OO]},"normal",t.AttributeLevel.Default);const i=this._getSeries();null===(e=i.initTotalLabelMarkStyle)||void 0===e||e.call(i,this._textMark)}_initLabelComponent(){var t;const e=this._getSeries(),i=this._createMark({type:"component",name:`${null!==(t=e.name)&&void 0!==t?t:e.type}-total-label-component`},{componentType:"label"},{support3d:this._spec.support3d});i&&(this._marks.addMark(i),e.getData().addRelatedMark(i))}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.setMarkConfig({interactive:!1}),e.setSimpleStyle({labelStyle:()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r,position:a="top"}=this._spec,o=this._interactiveConfig(this._spec);return XR({textStyle:{pickable:!0===this._spec.interactive},position:iZ(t,this._baseMark.type,a),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=>"bottom"===a?t.data[FO]:t.data[DO]))},o))}},size:()=>{var t;return Object.assign({padding:null===(t=this._spec.overlap)||void 0===t?void 0:t.padding},this._regions[0].getLayoutRect())},itemEncoder:e=>iN({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod)}),this._setTransformOfComponent(e,this._baseMark)}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function iZ(t,e,i="top"){var s,n;let r;const{direction:a}=t;let o;o="bottom"===i?{vertical:["bottom","top"],horizontal:["left","right"]}:{vertical:["top","bottom"],horizontal:["right","left"]};const l=("horizontal"===a?null===(s=t.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=t.getYAxisHelper())||void 0===n?void 0:n.isInverse())?1:0;switch(e){case"rect":case"symbol":r=o[a][l];break;default:r="top"}return r}eZ.type=r.totalLabel,eZ.builtInTheme={totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}}},eZ.specKey="totalLabel";class sZ extends Bq{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=t.LayoutZIndex.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=Mq(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,f,m,v,_,y,b,x,S,A,k,M,T,w,C,E,B,P,L,R,O;const{itemContent:I={},itemLine:D={},targetSymbol:F={}}=this._spec,z=I,{type:H="text",text:V,symbol:N,image:U,richText:W,customMark:G,textStyle:Y,symbolStyle:$,imageStyle:X,richTextStyle:K,customMarkStyle:q,style:Z={},state:J={}}=z,Q=e(z,["type","text","symbol","image","richText","customMark","textStyle","symbolStyle","imageStyle","richTextStyle","customMarkStyle","style","state"]);let tt=null,et=null,it={};"text"===H?(tt=null!==(t=null==V?void 0:V.state)&&void 0!==t?t:J,it={dx:0,dy:0},et=vq(Object.assign(Object.assign({},V),{style:j(it,null!==(n=null!==(s=null!==(i=null==V?void 0:V.style)&&void 0!==i?i:null==V?void 0:V.textStyle)&&void 0!==s?s:Y)&&void 0!==n?n:Z)}),this._markerData,this._markAttributeContext)):"richText"===H?(tt=null!==(r=null==W?void 0:W.state)&&void 0!==r?r:J,it={width:100,height:100},et=yq(j(it,null!==(o=null!==(a=null==W?void 0:W.style)&&void 0!==a?a:K)&&void 0!==o?o:Z),this._markerData,this._markAttributeContext)):"symbol"===H?(tt=null!==(l=null==N?void 0:N.state)&&void 0!==l?l:J,it={symbolType:"star",fill:"rgb(48, 115, 242)",fillOpacity:.8,size:20},et=oI(yq(j(it,null!==(c=null!==(h=null==N?void 0:N.style)&&void 0!==h?h:$)&&void 0!==c?c:Z),this._markerData,this._markAttributeContext))):"image"===H?(tt=null!==(d=null==U?void 0:U.state)&&void 0!==d?d:J,it={width:80,height:80},et=yq(j(it,null!==(p=null!==(u=null==U?void 0:U.style)&&void 0!==u?u:X)&&void 0!==p?p:Z),this._markerData,this._markAttributeContext)):"custom"===H&&(tt=null!==(g=null==G?void 0:G.state)&&void 0!==g?g:J,et=yq(null!==(m=null!==(f=null==G?void 0:G.style)&&void 0!==f?f:q)&&void 0!==m?m:Z,this._markerData,this._markAttributeContext));const st={zIndex:this.layoutZIndex,interactive:null===(v=this._spec.interactive)||void 0===v||v,hover:null===(_=this._spec.interactive)||void 0===_||_,select:null===(y=this._spec.interactive)||void 0===y||y,position:{x:0,y:0},clipInRange:null!==(b=this._spec.clip)&&void 0!==b&&b,itemContent:Object.assign(Object.assign({type:H,offsetX:bq(I.offsetX,this._relativeSeries.getRegion()),offsetY:bq(I.offsetX,this._relativeSeries.getRegion())},Q),{style:yq(et,this._markerData,this._markAttributeContext)}),targetSymbol:{offset:null!==(x=F.offset)&&void 0!==x?x:0,visible:null!==(S=F.visible)&&void 0!==S&&S,size:null!==(A=F.size)&&void 0!==A?A:20,style:yq(F.style,this._markerData,this._markAttributeContext)},state:{line:_q(null!==(M=null===(k=this._spec.itemLine.line)||void 0===k?void 0:k.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),lineStartSymbol:_q(null!==(w=null===(T=this._spec.itemLine.startSymbol)||void 0===T?void 0:T.state)&&void 0!==w?w:{},this._markerData,this._markAttributeContext),lineEndSymbol:_q(null!==(E=null===(C=this._spec.itemLine.endSymbol)||void 0===C?void 0:C.state)&&void 0!==E?E:{},this._markerData,this._markAttributeContext),itemContent:_q(tt,this._markerData,this._markAttributeContext),textBackground:_q(null===(P=null===(B=this._spec.itemContent.text)||void 0===B?void 0:B.labelBackground)||void 0===P?void 0:P.state,this._markerData,this._markAttributeContext),targetItem:_q(null!==(R=null===(L=this._spec.targetSymbol)||void 0===L?void 0:L.state)&&void 0!==R?R:{},this._markerData,this._markAttributeContext)},animation:null!==(O=this._spec.animation)&&void 0!==O&&O,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate},{visible:nt,line:rt={}}=D,at=e(D,["visible","line"]);st.itemLine=!1!==nt?Object.assign(Object.assign({},at),{visible:!0,lineStyle:oI(rt.style)}):{visible:!1};return new ZP(st)}_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}=mq([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:xq(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:xq(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}=Mq(t);(p(t.coordinate)||e||i||s)&&this._initCommonDataView()}}sZ.specKey="markPoint";const nZ={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}};class rZ extends sZ{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t,e,i;const s=this._spec,n=this._markerData,r=this._relativeSeries,a=p(s.x)&&p(s.y),o=p(s.coordinate),l=p(s.position),h=null!==(t=null==s?void 0:s.autoRange)&&void 0!==t&&t;let c;return a?c=null===(i=null===(e=hq(n,r,r,r,h))||void 0===e?void 0:e[0])||void 0===i?void 0:i[0]:o?c=uq(n,r,h,s.coordinatesOffset)[0]:l&&(c=fq(s.position,r,s.regionRelative)[0]),{point:c}}_computeOptions(){const t=this._spec,{doXYProcess:e}=Mq(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}}}rZ.type=r.markPoint,rZ.coordinateType="cartesian",rZ.builtInTheme={markPoint:nZ};class aZ extends sZ{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=dq(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:he({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}])]}}}aZ.type=r.polarMarkPoint,aZ.coordinateType="polar",aZ.builtInTheme={polarMarkPoint:nZ};class oZ extends sZ{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}])]}}}oZ.type=r.geoMarkPoint,oZ.coordinateType="geo",oZ.builtInTheme={geoMarkPoint:nZ};const lZ="inBrush",hZ="outOfBrush";class cZ extends sj{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._cacheInteractiveRangeAttrs=[],this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}static getSpecInfo(t){return hF(t,this.specKey,this.type,(t=>!1!==t.visible))}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),lZ,t.AttributeLevel.Series),s.setMarkStyle(n,Object.assign({},i),hZ,t.AttributeLevel.Series))}))}))}_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()}))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_bindRegions(){p(this._spec.regionId)||p(this._spec.regionIndex)?this._relativeRegions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex)):this._relativeRegions=this._option.getAllRegions()}_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)}))}initEvent(){}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return U(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(){var t;if(super.onLayoutEnd(),this._option.disableTriggerEvent)return;(null===(t=this._spec.visible)||void 0===t||t)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild()}_shouldEnableInteractive(){return!1!==this.getOption().getCompiler().getOption().interactive}_createBrushComponent(e,i){var s,n;const r=this._getBrushInteractiveAttr(e),a=new UL(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:oI(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),this._brushComponents.push(a),this._cacheInteractiveRangeAttrs.push(r),a.addEventListener(FL.brushActive,(s=>{this._initMarkBrushState(i,hZ),this._emitEvent(t.ChartEvent.brushActive,e,s)})),a.addEventListener(FL.drawStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener(FL.moveStart,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!0),this._setRegionMarkPickable(e,!0),this._emitEvent(t.ChartEvent.brushStart,e,i)})),a.addEventListener(FL.drawing,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener(FL.moving,(i=>{this._setRegionMarkPickable(e,!1),this._handleBrushChange(e,i),this._emitEvent(t.ChartEvent.brushChange,e,i)})),a.addEventListener(FL.brushClear,(s=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)})),a.addEventListener(FL.drawEnd,(s=>{var n;this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:r}=s.detail,{updateElementsState:a=!0}=this._spec;if(null===(n=this._spec)||void 0===n?void 0:n.onBrushEnd)!0===this._spec.onBrushEnd(s)?(this.clearGraphic(),this._initMarkBrushState(i,""),this._emitEvent(t.ChartEvent.brushClear,e,s)):(this._spec.onBrushEnd(s),this._emitEvent(t.ChartEvent.brushEnd,e,s));else{const i=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&i.length>0||!a)&&this._setAxisAndDataZoom(r,e),this._emitEvent(t.ChartEvent.brushEnd,e,s)}})),a.addEventListener(FL.moveEnd,(i=>{this._spec.disableDimensionHoverWhenBrushing&&this._option.globalInstance.disableDimensionHoverEvent(!1),this._setRegionMarkPickable(e,!0);const{operateMask:s}=i.detail,{updateElementsState:n=!0}=this._spec,r=this._extendDataInBrush(this._inBrushElementsMap);(!this._spec.zoomWhenEmpty&&r.length>0||n)&&this._setAxisAndDataZoom(s,e),this._emitEvent(t.ChartEvent.brushEnd,e,i)}))}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a],interactive:this._shouldEnableInteractive()}}_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({},oI(t)),e)}_handleBrushChange(t,e){const{operateMask:i}=e.detail;this._operateMask=i;const{updateElementsState:s=!0}=this._spec;s&&(this._reconfigItem(i,t),this._reconfigLinkedItem(i,t))}_extendDataInBrush(t){var e,i;const s=[];for(const n in t)for(const r in t[n])s.push(Object.assign({},null===(i=null===(e=t[n][r].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]));return s}_extendDatumOutOfBrush(t){var e,i;const s=[];for(const n in t)s.push(null===(i=null===(e=t[n].context)||void 0===e?void 0:e.data)||void 0===i?void 0:i[0]);return s}_emitEvent(t,e,i){var s;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},vchart:null===(s=this._option)||void 0===s?void 0:s.globalInstance,event:i})}_reconfigItem(t,e){var i,s,n;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const r=null!==(n=null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points)&&void 0!==n?n:[],{a:a,b:o,c:l,d:h,e:c,f:d}=t.globalTransMatrix,u=r.map((t=>({x:a*t.x+l*t.y+c,y:o*t.x+h*t.y+d}))),{markTypeFilter:p=[]}=this._spec;this._itemMap[e.id].forEach((e=>{if(p.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;const a=e.id+"_"+i.context.key,o=this._isBrushContainItem(t.globalAABBBounds,u,i);(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[a])&&o?(i.addState(lZ,!0),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._outOfBrushElementsMap[a]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!o&&(i.removeState(lZ),i.addState(hZ,!0),this._outOfBrushElementsMap[a]=i,delete this._inBrushElementsMap[t.name][a])}))}))}_reconfigLinkedItem(t,e){var i;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points))return;const s=e.getLayoutStartPoint(),n=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{var i,r;if(!n.includes(e.id)){const n=e.getRegion().getLayoutStartPoint(),a=n.x-s.x,o=n.y-s.y,l=null!==(r=null===(i=null==t?void 0:t.attribute)||void 0===i?void 0:i.points)&&void 0!==r?r:[],{a:h,b:c,c:d,d:u,e:p,f:g}=t.globalTransMatrix,f=a||0,m=o||0,v=l.map((t=>({x:h*t.x+d*t.y+p+f,y:c*t.x+u*t.y+g+m})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+f,t.globalAABBBounds.y1+m,t.globalAABBBounds.x2+f,t.globalAABBBounds.y2+m);const{markTypeFilter:_=[]}=this._spec;this._linkedItemMap[e.id].forEach((e=>{if(_.includes(e.type))return;const i=e.getGraphics();i&&i.length&&i.forEach((i=>{var s,n,r;i.context;const a=e.id+"_"+i.context.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[a])&&this._isBrushContainItem(t.globalAABBBounds,v,i)?(i.addState(lZ,!0),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][a]=i,delete this._linkedOutOfBrushElementsMap[a]):(null===(r=null===(n=this._linkedInBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[a])&&!this._isBrushContainItem(t.globalAABBBounds,v,i)&&(i.removeState(lZ),i.addState(hZ,!0),this._linkedOutOfBrushElementsMap[a]=i)}))}))}}))}_isBrushContainItem(t,e,i){let s=[];if(["symbol","rect"].includes(i.type)){const{x1:t,x2:n,y1:r,y2:a}=null==i?void 0:i.globalAABBBounds;return s=[{x:t,y:r},{x:n,y:r},{x:n,y:a},{x:t,y:a}],function(t,e){for(let i=0;i0&&Be(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}(e,s)}return t.intersects(i.globalAABBBounds)}_initItemMap(t,e,i){const{markTypeFilter:s=[]}=this._spec;Object.entries(t).forEach((([t,n])=>{n.forEach((t=>{if(s.includes(t.type))return;const n=t.getGraphics();n&&n.length&&n.forEach((s=>{const n=t.id+"_"+s.context.key;s.removeState(lZ),s.removeState(hZ),i&&s.addState(i,!0),e[n]=s}))}))}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._initItemMap(this._itemMap,this._outOfBrushElementsMap,e),this._initItemMap(this._linkedItemMap,this._linkedOutOfBrushElementsMap,e)}_setRegionMarkPickable(t,e){t.getGroupMark().getGraphics().forEach((t=>t.setAttribute("childrenPickable",e)))}_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,g=t.getScale().range(),f=null!==(n=t.scaleRangeFactor())&&void 0!==n?n:[0,1],m=$(g){t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach(((e,i)=>{this._initMarkBrushState(i,""),e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}clearBrushStateAndMask(){this._relativeRegions.forEach(((t,e)=>{this._initMarkBrushState(e,""),this._brushComponents[e].children[0].removeAllChild()}))}}cZ.type=r.brush,cZ.builtInTheme={brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0}},cZ.specKey="brush";class dZ extends sj{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=t.LayoutZIndex.CustomMark,this.layoutLevel=t.LayoutLevel.CustomMark}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;let t=null;if(this._spec.parent){const e=this.getChart().getAllMarks().find((t=>t.getUserId()===this._spec.parent));"group"===e.type&&(t=e)}this._createExtensionMark(this._spec,t,`${yO}_series_${this.id}_extensionMark`,0)}_createExtensionMark(t,e,i,s=0){var n,r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),(null===(n=this._option.globalInstance)||void 0===n?void 0:n.isAnimationEnable())&&t.animation){const e=zF({},jF(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(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)}))),p(t.dataId)||k(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return U(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,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 He).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new He;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.AABBBounds)})),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}}getVRenderComponents(){const t=[],e=i=>{if(i&&"group"===i.type)i.getMarks().forEach((t=>{e(t)}));else if("component"===i.type){const e=null==i?void 0:i.getComponent();e&&t.push(e)}};return this.getMarks().forEach((t=>{e(t)})),t}}dZ.type=r.customMark,dZ.specKey="customMark";class uZ{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._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=>{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=>pZ(t))),a=n.filter((t=>!pZ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>pZ(t))),h=o.filter((t=>!pZ(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 pZ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}uZ.type="grid";const gZ="vchart-tooltip",fZ=`${gZ}-container`,mZ=`${gZ}-title`,vZ=`${gZ}-content-box`,_Z={offsetX:10,offsetY:10},yZ="99999999999999";function bZ(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}const xZ=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:t.offsetHeight>0?e.height/t.offsetHeight:1):1,SZ=t=>_(t)&&""!==(null==t?void 0:t.trim())||S(t)?bZ(t):"",AZ=(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},kZ={left:[-2,0],right:[2,0],top:[0,-2],bottom:[0,2],insideTop:[0,-1.5],insideBottom:[0,1.5],insideLeft:[-1.5,0],insideRight:[1.5,0],insideTopLeft:[-1.5,-1.5],insideTopRight:[1.5,-1.5],insideBottomLeft:[-1.5,1.5],insideBottomRight:[1.5,1.5],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},MZ=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=kZ[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i};class TZ extends Pz{constructor(){super(...arguments),this._visible=!0,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._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const f=this._chartOption.getRectByDimensionData,{tooltipSpec:m}=e,v={x:1/0,y:1/0};if(!m)return v;const _=e.event,{activeType:y,data:b}=t,x="dimension"===y?null===(n=null===(s=b[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==b?void 0:b[0],{offsetX:A,offsetY:M}=this._option,T=m[y],w=pF(null==T?void 0:T.position,b,e),C=null!==(r=pF(null==T?void 0:T.positionMode,b,e))&&void 0!==r?r:"mark"===y?"mark":"pointer",{width:E=0,height:B=0}=null!=i?i:{},P="canvas"===m.renderMode,L=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==L?void 0:L.width)&&void 0!==o?o:bO,O=null!==(l=null==L?void 0:L.height)&&void 0!==l?l:xO;let I=!1;const D={width:0,height:0};let F,z={x:0,y:0},j={x:0,y:0},H=1,V=1;const N=Gy(this._env);if(N&&!m.confine?(D.width=window.innerWidth,D.height=window.innerHeight):(D.width=R,D.height=O),N&&!P){const t=this._getParentElement(m);j=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:v;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer;F=null==e?void 0:e.getBoundingClientRect(),z={x:F.x-j.x,y:F.y-j.y},H=xZ(e,F),V=xZ(t,j)}const U=V/H,W={},G={x:w,y:w},Y={x:["left","right"],y:["top","bottom"]},$=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?A:M;if("mark"===i){I=!0;const t=e.item,i=null==t?void 0:t.AABBBounds;i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if(f&&"crosshair"===i&&"cartesian"===(null===(r=null==x?void 0:x.series)||void 0===r?void 0:r.coordinate)&&x.datum&&x.datum.length){I=!0;const t=f(x,h);t&&(a=t.start[n],o=t.end[n])}else G[n]=t;if(I){const e=Y[n][0],i="x"===n?E:B;switch(MZ(t,n)){case-2:W[e]=a-i*U-c;break;case-1.5:W[e]=a+c;break;case 0:W[e]=(a+o)/2-i*U/2;break;case-1:W[e]=(a+o)/2-i*U-c;break;case 1:W[e]=(a+o)/2+c;break;case 1.5:W[e]=o-i*U-c;break;case 2:W[e]=o+c}}},X=["x","y"];if(g(w))if(g(K=w)&&(p(K.left)||p(K.right)||p(K.top)||p(K.bottom))){const{left:t,right:e,top:i,bottom:s}=w;W.left=AZ(t,_),W.top=AZ(i,_),W.right=AZ(e,_),W.bottom=AZ(s,_)}else(t=>g(t)&&(p(t.x)||p(t.y)))(w)&&X.forEach((t=>{const e=w[t];S(e)||d(e)?W[Y[t][0]]=AZ(e,_):$(e,t)}));else p(w)&&($({orient:w,mode:C},"x"),$({orient:w,mode:C},"y"));var K;const q={x:null,y:null};return X.forEach((t=>{var e;const i="x"===t?E:B,s="x"===t?R:O,n="x"===t?A:M,r=MZ(G[t],t);if(k(W[Y[t][0]]))q[t]=W[Y[t][0]];else if(k(W[Y[t][1]]))q[t]=s-i*U-W[Y[t][1]];else{const e="x"===t?_.canvasX:_.canvasY;q[t]=r>0?e+n:0===r?e-i*U/2:e-i*U-n}q[t]*=H,N&&(q[t]+=z[t]),q[t]/=V;const a="x"===t?D.width:D.height,o=m.confine?-(j[t]-(null!==(e=null==F?void 0:F[t])&&void 0!==e?e:0)/H)/V:-j[t]/V,l=a/V+o-i;2!==r&&q[t]l&&(q[t]=l)):-2!==r&&q[t]>l&&(I?q[t]=l:(q[t]-=0===r?n+i/2:2*n+i,q[t]p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",CZ=(t={},e={})=>{var i,s;p(t.fontFamily)&&(e.fontFamily=t.fontFamily);const n=null!==(i=t.fill)&&void 0!==i?i:t.fontColor;return p(n)&&(e.color=n),p(t.fontWeight)&&(e.fontWeight=t.fontWeight),p(t.textAlign)&&(e.textAlign=t.textAlign),p(t.fontSize)&&(e.fontSize=wZ(t.fontSize)),p(t.maxWidth)&&(e.maxWidth=wZ(t.maxWidth)),t.multiLine||p(t.maxWidth)&&!1!==t.multiLine?(e.whiteSpace="initial",e.wordBreak=null!==(s=t.wordBreak)&&void 0!==s?s:"break-word"):(e.wordBreak="normal",e.whiteSpace="nowrap"),e},EZ=(t={})=>{const{lineHeight:e}=t;return t.fontSize?LR(e,t.fontSize):0},BZ=t=>{var e;const{backgroundColor:i,border:s,shadow:n,padding:r}=t,a={borderWidth:`${null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0}px`};let o=null;(null==s?void 0:s.color)&&(a.borderColor=s.color),i&&(a.backgroundColor=i),a.boxShadow=n?`${n.x}px ${n.y}px ${n.blur}px ${n.spread}px ${n.color}`:"initial";const{radius:l}=null!=s?s:{};return p(l)&&(a.borderRadius=k(l)?`${l}px`:`${l}`),p(r)&&(o=ri(r),a.padding=wZ(o)),{panelStyle:a,panelPadding:o}};function PZ(t,e){t&&t.style&&e&&Object.keys(e).forEach((i=>{t.style[i]=e[i]}))}const LZ=t=>{KR.registerComponentPlugin(t.type,t)};class RZ extends TZ{getVisibility(){return!!this._rootDom&&"visible"===this._rootDom.style.visibility}setVisibility(t){t!==this.getVisibility()&&this._rootDom&&(this._rootDom.style.visibility=t?"visible":"hidden")}getRootDom(){return this._rootDom}constructor(){super(RZ.type),this.type=wH.dom,this._tooltipContainer=null==Wy?void 0:Wy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec().parentElement;if(Wy&&t&&t.children&&t.children.length){for(let e=0;e{var e,i,s,n;const{style:r={},enterable:a,transitionDuration:o}=t,{panel:l={},titleLabel:h,shape:c,keyLabel:d,valueLabel:p,spaceRow:g,align:f}=r,{panelStyle:m,panelPadding:v}=BZ(l),_={marginTop:"0px",marginBottom:"0px"};m.pointerEvents=a?"auto":"none",o&&(m.transitionDuration=o?`${o}ms`:"initial",m.transitionProperty=o?"transform":"initial",m.transitionTimingFunction=o?"ease-out":"initial"),k(g)&&(_.marginBottom=`${g}px`);const y={width:wZ(null!==(e=null==c?void 0:c.size)&&void 0!==e?e:8)},b=CZ(h),x=CZ(d),S=CZ(p),A="right"===f?"marginLeft":"marginRight";"right"===f&&(m.direction="rtl"),u(b.textAlign)&&(b.textAlign="right"===f?"right":"left"),u(x.textAlign)&&(x.textAlign="right"===f?"right":"left"),u(S.textAlign)&&(S.textAlign="right"===f?"left":"right"),y[A]=wZ(null!==(i=c.spacing)&&void 0!==i?i:8),x[A]=wZ(null!==(s=d.spacing)&&void 0!==s?s:26),S[A]=wZ(null!==(n=p.spacing)&&void 0!==n?n:0);const M=Math.max(EZ(p),EZ(d));return _.lineHeight=M>0?`${M}px`:"20px",{panelPadding:v,row:_,panel:m,title:b,shape:y,key:x,value:S}})(t)}_updateDomStringByCol(t){var e;const{title:i={},content:s}=t,n=s&&s.length,r=this._domStyle.row,a=[...this._rootDom.children];let o=a.find((t=>t.className.includes(mZ))),l=a.find((t=>t.className.includes(vZ)));if(!o&&!1!==i.visible){o=document.createElement("h2");const t=document.createElement("span");o.appendChild(t),o.classList.add(mZ),this._rootDom.firstChild?this._rootDom.insertBefore(o,this._rootDom.firstChild):this._rootDom.appendChild(o)}o&&!1!==i.visible?(PZ(o,Object.assign(Object.assign(Object.assign({},this._domStyle.title),n?r:{marginBottom:"0px"}),{marginTop:"0px"})),o.firstChild.innerHTML=`${null!==(e=i.value)&&void 0!==e?e:""}`):o&&!1===i.visible&&o.parentNode.removeChild(o);const h=["shape","key","value"];if(!l&&n&&(l=document.createElement("div"),h.forEach((t=>{const e=document.createElement("div");e.classList.add(`${gZ}-column`),e.classList.add(`${gZ}-${t}-column`),e.setAttribute("data-col",t),l.appendChild(e)})),l.classList.add(vZ),this._rootDom.appendChild(l)),l&&n){const t=[...l.children];PZ(l,{whiteSpace:"nowrap"}),t.forEach(((t,e)=>{const i=t.getAttribute("data-col");if(i&&h.includes(i)){const e="shape"===i&&s.every((t=>!t.hasShape||!t.shapeType));PZ(t,Object.assign(Object.assign({},this._domStyle[i]),{display:e?"none":"inline-block",verticalAlign:"top"}));const n=[...t.children];n.slice(s.length).forEach((t=>{t.parentNode.removeChild(t)})),s.forEach(((e,a)=>{let o=n[a];o||(o=document.createElement("div"),o.classList.add(`${gZ}-${i}`),t.appendChild(o));const l=Object.assign({},r);a===s.length-1&&(l.marginBottom="0px"),l.display=!1===e.visible?"none":"block",l.height="initial","key"===i?(o.innerHTML=SZ(e.key),e.keyStyle&&CZ(e.keyStyle,l)):"value"===i?(o.innerHTML=SZ(e.value),e.valueStyle&&CZ(e.valueStyle,l)):"shape"===i&&(o.innerHTML=function(t,e){var i,s,n,r,a,o;if(!t||!t.hasShape||!t.shapeType)return"";const l='style="display:inline-block;vertical-align:middle;"',{shapeType:h,shapeStroke:c,shapeHollow:d=!1,shapeFill:u}=t,p=null!==(i=t.shapeSize)&&void 0!==i?i:8,f=t.shapeLineWidth?bZ(t.shapeLineWidth)+"px":"0px";let m="currentColor";const v=()=>c?bZ(c):m,y=p,b=t=>new wg({symbolType:t,size:y,fill:!0});let x=b(h);const S=x.getParsedPath();let A,k;if(!S.path&&S.pathStr&&(x=b(S.pathStr)),x.getParsedPath().path){const t=x.getParsedPath().path;k=t.toString(),A=t.bounds}else S.isSvg&&S.svgCache&&(k=S.svgCache.map((t=>t.path.toString())).join(),A=S.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new He));let M=`${A.x1} ${A.y1} ${A.width()} ${A.height()}`;if("0px"!==f){const[t,e,i,s]=M.split(" ").map((t=>Number(t))),n=Number(f.slice(0,-2));M=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}const T=mh.IsGradientStr(u);if(!u||_(u)&&!T||d)return m=d?"none":u?bZ(u):"currentColor",`\n \n \n \n `;const w=T?mh.Parse(u):g(u)?u:null;if(w){m="gradientColor"+(null!=e?e:"");let t="";const i=(null!==(s=w.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===w.gradient?t=`\n ${i}\n `:"linear"===w.gradient&&(t=`\n ${i}\n `),`\n \n ${t}\n \n \n `}return""}(e,`${this.id}_${a}`)),PZ(o,l)}))}}))}else l&&!n&&l.parentNode.removeChild(l)}_updateDomStyle(t="width",e){var i,s,n,r,a;const o=this._rootDom,l=[...o.children].find((t=>t.className.includes(vZ))),h=[...o.children].find((t=>t.className.includes(mZ)));if(l){const o=this._component.getSpec(),c={},d=null===(i=o.style)||void 0===i?void 0:i.titleLabel;if(d&&d.autoWidth&&!1!==d.multiLine&&h){const e=[...l.children].reduce(((e,i)=>"height"===t?e+i.getBoundingClientRect().width:Math.max(e,i.getBoundingClientRect().width)),0);e>0&&(h.style.maxWidth=`${e}px`,h.style.maxWidth=`${Math.ceil(l.getBoundingClientRect().width)}px`)}if(p(null===(s=null==o?void 0:o.style)||void 0===s?void 0:s.maxContentHeight)){const t=h&&h.className.includes(mZ)?h.getBoundingClientRect().height+(null!==(n=o.style.spaceRow)&&void 0!==n?n:0):0,e=this._chartOption.getChartViewRect(),i=LR(o.style.maxContentHeight,Math.min(e.height,document.body.clientHeight)-t-(this._domStyle.panelPadding?this._domStyle.panelPadding[0]+this._domStyle.panelPadding[1]:0));i>0&&(c.maxHeight=`${i}px`,c.overflowY="auto",c.width=`calc(100% + ${this._domStyle.panelPadding?this._domStyle.panelPadding[1]+"px":"10px"})`,PZ(l,c))}const u=l.children,g=[];if(u){for(let i=0;i{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},gf||(gf=uf.CreateGraphic("richtext",{})),gf.setAttributes(a),gf.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}};function DZ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:OZ),{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:e,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:p(t.maxWidth)?!1!==t.multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const FZ=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};class zZ extends TZ{constructor(){super(zZ.type),this.type=wH.canvas,this._attributes=null}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 XL({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}_getTooltipBoxSize(t,e){var i,s;if(!e||u(this._attributes)){const e=null===(i=this._chartOption)||void 0===i?void 0:i.getTheme("fontFamily");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:f,valueLabel:m,spaceRow:v,align:_}=l,y=ri(d.padding),b=IR(d.padding),x=DZ(Object.assign({textAlign:"right"===_?"right":"left"},u),i),S=DZ(Object.assign({textAlign:"right"===_?"right":"left"},f),i),A=DZ(m,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:FZ(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,enterable:h,transitionDuration:c,align:_},{title:T={},content:w=[]}=t;let C=b.left+b.right,E=b.top+b.bottom,B=0;const P=!!w.length;let L=0,R=0,O=0,I=0;if(P){const t=[],e=[],i=[],s=[];let n=0;M.content=w.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:M}=r,T={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=XR({},S,DZ(b,void 0,{})),{width:s,height:n,text:r}=IZ(h,i);T.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(m)){const t=XR({},A,DZ(x,void 0,{})),{width:e,height:s,text:n}=IZ(m,t);T.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};M?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,T.shape=t;const e=null!=f?f:k.size;o=Math.max(e,o),s.push(e)}else T.shape={visible:!1};return T.height=o,n+=o,aU.autoWidth&&!1!==U.multiLine;if(j){U=XR({},x,DZ(V,void 0,{})),W()&&(U.multiLine=null===(r=U.multiLine)||void 0===r||r,U.maxWidth=null!==(a=U.maxWidth)&&void 0!==a?a:P?Math.ceil(B):void 0);const{text:t,width:e,height:i}=IZ(H,U);M.title.value=Object.assign(Object.assign({width:W()?Math.min(e,null!==(o=U.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},U),{text:t}),D=M.title.value.width,F=M.title.value.height,z=F+(P?M.title.spaceRow:0)}return E+=z,M.title.width=D,M.title.height=F,W()?C+=B||D:C+=Math.max(D,B),P&&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-I-L-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})(t,this._component.getSpec(),e)}const{panel:n}=null!==(s=this._attributes)&&void 0!==s?s:{};return{width:n.width+n.lineWidth,height:n.height+n.lineWidth}}_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{activeTooltipSpec: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()}}zZ.type=wH.canvas;const jZ=()=>{LZ(zZ)},HZ=(t="chart",e,i)=>{var s,n,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===(s=e.region)||void 0===s||s.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["region",e],type:"region"})}));else if("series"===t)f.modelType="series",f.specKey="series",null===(n=e.series)||void 0===n||n.forEach(((t,e)=>{f.modelInfo.push({spec:t,specPath:["series",e],type:t.type})}));else if(Object.values(cR).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=KR.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:s}=f,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&&s.type===t?f.modelInfo.push(Object.assign(Object.assign({},s),{spec:e})):e&&!1===e.visible&&f.modelInfo.push({type:t,spec:e})}))}else{const s=KR.getComponents().filter((({cmp:e})=>e.specKey===t)).map((({cmp:t})=>t.type));if(s.length>0){f.modelType="component";const n=t;f.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];i&&s.includes(i.type)&&f.modelInfo.push(Object.assign(Object.assign({},i),{spec:t}))}))}}return f},VZ=(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=HZ(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):WR(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const f=XR({},i),m=d(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:XR(f,m),hasChanged:!0};const i=XR({},t,m);GR(f,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},m);y(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}},NZ=t=>{KR.registerChartPlugin(t.type,t)};class UZ extends Pz{constructor(){super(UZ.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[UZ.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[UZ.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)}onAfterModelSpecTransform(t,e,i,s){this._initialized&&"updateSpec"===s&&this.onBeforeInitChart(t,e,"setCurrentTheme")}onBeforeInitChart(t,e,i){if(!this._initialized)return;let s,n;switch(i){case"render":case"updateModelSpec":s=!1,n=!0;break;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=$R(this._option.globalInstance.getSpec(),["data",UZ.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=$R(this._baseChartSpec,["data",UZ.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=VZ(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=$R(i,["data",UZ.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()}}UZ.pluginType="chart",UZ.specKey="media",UZ.type="MediaQueryPlugin";const WZ=/\{([^}]+)\}/,GZ=/\{([^}]+)\}/g,YZ=/:/;class $Z extends Pz{constructor(){super($Z.type),this.type="formatterPlugin",this._timeModeFormat={utc:fi.getInstance().timeUTCFormat,local:fi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Ai.getInstance().format,this._numericSpecifier=Ai.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[$Z.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)),KR.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=WZ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(GZ,((t,i)=>{if(!YZ.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(bi.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):e.startsWith("calc(")?this._calcFormatter(e,t):t}_calcFormatter(t,e){try{const i=t.slice(5,-1).replace(/v/g,String(e));return this._calculateMathExpression(i,e)}catch(t){return e}}_calculateMathExpression(t,e){const i=t.replace(/\s+/g,"");if(!this._isValidMathExpression(i))return e;try{const t=new Function("return ("+i+")")();if("number"!=typeof t||isNaN(t)||!isFinite(t))throw new Error("Invalid calculation result");return t}catch(t){return e}}_isValidMathExpression(t){return/^[0-9+\-*/().]+$/.test(t)}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}$Z.pluginType="chart",$Z.specKey="formatter",$Z.type="formatterPlugin";class XZ extends Pz{constructor(){super(XZ.type),this.type="ChartResizeZoomPlugin",this._zoom=1,this._onWheel=t=>{t.preventDefault(),t.stopImmediatePropagation();const e=Math.pow(1.005,-t.deltaY*Math.pow(16,t.deltaMode)*.2*this._rate),i={x:t.offsetX,y:t.offsetY};this.zoom(e,i)}}onAfterInitChart(t,e){var i,s,n,r,a;const o=t.globalInstance,l=null!==(s=null===(i=o.getSpec())||void 0===i?void 0:i[XZ.specKey])&&void 0!==s?s:{enabled:!1};!0===l.enabled&&(this._minZoom=null!==(n=l.min)&&void 0!==n?n:.1,this._maxZoom=null!==(r=l.max)&&void 0!==r?r:10,this._rate=null!==(a=l.rate)&&void 0!==a?a:.1,this._container=o.getContainer(),this._triggerEvent=PV(t.globalInstance.getChart().getOption().mode).zoom,this._container&&this._triggerEvent&&this._container.addEventListener(this._triggerEvent,this._onWheel))}zoom(t,e){const i=this.service.globalInstance;if(!i)return;const s=this._zoom;let n=this._zoom*t;if(n<=this._minZoom&&t<1||n>=this._maxZoom&&t>1)if(n<=this._minZoom&&this._zoom>this._minZoom)n=this._minZoom;else{if(!(n>=this._maxZoom&&this._zoom{LH(),OH(),DH(),hH(),lH(),$j(),zj(),bz(),Sz(),YD(),UD(),Pj(),wj(),KR.registerSeries(Xj.type,Xj),KR.registerChart(FH.type,FH)},()=>{LH(),OH(),DH(),lH(),$j(),zj(),bz(),HH(),Sz(),UH(),Pj(),wj(),KR.registerSeries(GH.type,GH),hH(),KR.registerChart($H.type,$H)},()=>{LH(),OH(),DH(),lH(),oV(),hH(),KR.registerChart(hV.type,hV)},()=>{LH(),OH(),hH(),lH(),yV(),KR.registerChart(xV.type,xV)},()=>{OH(),mU(),KR.registerChart(cX.type,cX)},()=>{LH(),OH(),hH(),lH(),OU(),KR.registerChart(pX.type,pX)},()=>{LH(),OH(),DH(),hH(),lH(),UU(),KR.registerChart(fX.type,fX)},()=>{LH(),OH(),DH(),hH(),lH(),oV(),KR.registerTransform("bin",Xr),KR.registerChart(xX.type,xX)},()=>{OH(),DV(),TV(),KR.registerSeries(zV.type,zV),KR.registerImplement("registerMap",TI),KR.registerImplement("unregisterMap",wI),WD(),KR.registerChart(nX.type,nX)},()=>{OH(),S$(),KR.registerSeries(k$.type,k$),cU(),nW(),BU(),oW(),KR.registerChart(MX.type,MX)},()=>{OH(),KG(),KR.registerChart(CX.type,CX)},()=>{OH(),fY(),KR.registerChart(BX.type,BX)},()=>{LH(),OH(),DH(),hH(),lH(),pN(),KR.registerChart(NX.type,NX)},()=>{LH(),OH(),hH(),lH(),IN(),KR.registerTransform("boxplot",Kr),KR.registerChart(WX.type,WX)},()=>{LH(),OH(),hH(),lH(),oW(),KR.registerChart(AX.type,AX)},()=>{LH(),OH(),hH(),lH(),gW(),KR.registerChart(LX.type,LX)},()=>{LH(),OH(),hH(),lH(),YN(),KR.registerChart(OX.type,OX)},()=>{LH(),OH(),DH(),hH(),lH(),HH(),Pj(),wj(),KR.registerSeries(ZN.type,ZN),KR.registerChart(XX.type,XX)},()=>{OH(),RY(),KR.registerChart(DX.type,DX)},()=>{OH(),jY(),KR.registerChart(zX.type,zX)},()=>{OH(),u$(),KR.registerChart(HX.type,HX)},()=>{OH(),bo.load(vM),n$(),KR.registerChart(YX.type,YX)},()=>{OH(),P$(),KR.registerChart(qX.type,qX)},()=>{OH(),W$(),KR.registerChart(JX.type,JX)},()=>{LH(),OH(),DH(),hH(),KR.registerChart(vX.type,vX),lH()},wj,Pj,()=>{KR.registerGraphicComponent(nj.lineAxis,((t,e)=>new CC(t,e))),KR.registerGraphicComponent(rj.lineAxisGrid,((t,e)=>new zB(t,e))),cj(),KR.registerComponent(Lj.type,Lj)},()=>{KR.registerGraphicComponent(nj.lineAxis,((t,e)=>new CC(t,e))),KR.registerGraphicComponent(rj.lineAxisGrid,((t,e)=>new zB(t,e))),cj(),KR.registerComponent(Rj.type,Rj)},()=>{KR.registerGraphicComponent(nj.lineAxis,((t,e)=>new CC(t,e))),KR.registerGraphicComponent(rj.lineAxisGrid,((t,e)=>new zB(t,e))),cj(),KR.registerComponent(Oj.type,Oj)},LU,BU,()=>{KR.registerComponent(sK.type,sK)},()=>{KR.registerComponent(fK.type,fK)},()=>{KR.registerComponent(MK.type,MK)},()=>{KR.registerComponent(PK.type,PK)},()=>{KR.registerComponent(LK.type,LK)},()=>{KR.registerComponent($K.type,$K)},()=>{KR.registerComponent(KK.type,KK)},()=>{KR.registerComponent(QK.type,QK)},DV,()=>{KR.registerComponent(Dq.type,Dq),WP()},()=>{KR.registerComponent(Vq.type,Vq),YP()},()=>{KR.registerComponent(rZ.type,rZ),qP()},()=>{KR.registerComponent(Fq.type,Fq),XP._animate=MP,WP()},()=>{KR.registerComponent(Nq.type,Nq),KP._animate=wP,YP()},()=>{KR.registerComponent(aZ.type,aZ),qP()},()=>{KR.registerComponent(oZ.type,oZ),qP()},()=>{KR.registerComponent(zq.type,zq)},()=>{KR.registerComponent(Kq.type,Kq)},()=>{KR.registerGraphicComponent(tZ.type,(t=>new OB(t))),Jq(),oj(),KR.registerComponent(tZ.type,tZ,!0,1/0)},()=>{KR.registerGraphicComponent(eZ.type,(t=>new OB(t))),Jq(),oj(),KR.registerComponent(eZ.type,eZ,!0)},()=>{KR.registerComponent(cZ.type,cZ)},()=>{KR.registerComponent(dZ.type,dZ)},()=>{bo.load(aT)},()=>{KR.registerLayout(uZ.type,uZ)},jZ,JD,eF]),sF.useRegisters([()=>{oA(bo)}]),t.AxisSyncPlugin=Lz,t.CanvasTooltipHandler=zZ,t.ChartResizeZoomPlugin=XZ,t.DEFAULT_CHART_HEIGHT=xO,t.DEFAULT_CHART_WIDTH=bO,t.DEFAULT_CLOSE_STROKE_JOIN=aF,t.DEFAULT_DATA_INDEX=AO,t.DEFAULT_DATA_KEY=kO,t.DEFAULT_DATA_SERIES_FIELD=MO,t.DEFAULT_KEY=WO,t.DEFAULT_LAYOUT_RECT_LEVEL=0,t.DEFAULT_LAYOUT_RECT_LEVEL_MIN=-1,t.DEFAULT_LINEAR_INTERPOLATE=rF,t.DEFAULT_MAP_LOOK_UP_KEY=GO,t.DEFAULT_MEASURE_CANVAS_ID=SO,t.DEFAULT_SERIES_STYLE_NAME=TO,t.DEFAULT_SMOOTH_INTERPOLATE=nF,t.DomTooltipHandler=RZ,t.Factory=KR,t.FormatterPlugin=$Z,t.MOSAIC_CAT_END_PERCENT=VO,t.MOSAIC_CAT_START_PERCENT=HO,t.MOSAIC_VALUE_END_PERCENT=jO,t.MOSAIC_VALUE_START_PERCENT=zO,t.ManualTicker=class extends hw{constructor(t){super(t),this.lastFrameTime=0,this.status=Lo.RUNNING}setupTickHandler(){const t=new cw;return this.tickerHandler&&this.tickerHandler.release(),this.tickerHandler=t,!0}checkSkip(t){return!1}getTime(){return this.tickerHandler.getTime()}tickAt(t){this.tickTo(t)}start(t=!1){if(this.status===Lo.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===Lo.PAUSE)return!1;if(this.ifCanStop())return!1}return this.status=Lo.RUNNING,!0}},t.MediaQuery=UZ,t.PREFIX=yO,t.SEGMENT_FIELD_END=UO,t.SEGMENT_FIELD_START=NO,t.STACK_FIELD_END=EO,t.STACK_FIELD_END_OffsetSilhouette=RO,t.STACK_FIELD_END_PERCENT=PO,t.STACK_FIELD_KEY=wO,t.STACK_FIELD_START=CO,t.STACK_FIELD_START_OffsetSilhouette=LO,t.STACK_FIELD_START_PERCENT=BO,t.STACK_FIELD_TOTAL=OO,t.STACK_FIELD_TOTAL_BOTTOM=FO,t.STACK_FIELD_TOTAL_PERCENT=IO,t.STACK_FIELD_TOTAL_TOP=DO,t.StreamLight=class extends kw{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return{}}onStart(){this.target&&("rect"===this.target.type?this.onStartRect():"line"===this.target.type?this.onStartLineOrArea("line"):"area"===this.target.type&&this.onStartLineOrArea("area"))}onStartLineOrArea(t){var e;const i=this.target.attachShadow(),s=So.graphicService.creator[t](Object.assign({},null===(e=this.params)||void 0===e?void 0:e.attribute));this[t]=s,s.pathProxy=new Ul,i.add(s)}onStartRect(){var t,e,i;const s=this.target.attachShadow(),n=null===(e=null===(t=this.params)||void 0===t?void 0:t.isHorizontal)||void 0===e||e,r=n?"height":"width",a=n?"width":"height",o=this.target.AABBBounds[r](),l=n?0:this.target.AABBBounds.y1,h=So.graphicService.creator.rect(Object.assign(Object.assign({[r]:o,fill:"#bcdeff",shadowBlur:30,shadowColor:"#bcdeff"},null===(i=this.params)||void 0===i?void 0:i.attribute),{x:0,y:l,[a]:0}));this.rect=h,s.add(h)}onBind(){}onEnd(){this.target.detachShadow()}onUpdate(t,e,i){return this.rect?this.onUpdateRect(t,e,i):this.line||this.area?this.onUpdateLineOrArea(t,e,i):void 0}onUpdateRect(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g,f,m,v,_;const y=null===(n=null===(s=this.params)||void 0===s?void 0:s.isHorizontal)||void 0===n||n,b=this.target.attribute;if(y){const i=null!==(a=null!==(r=b.width)&&void 0!==r?r:Math.abs(b.x1-b.x))&&void 0!==a?a:250,s=null!==(l=null===(o=this.params)||void 0===o?void 0:o.streamLength)&&void 0!==l?l:i,n=null!==(d=null===(c=null===(h=this.params)||void 0===h?void 0:h.attribute)||void 0===c?void 0:c.width)&&void 0!==d?d:60,u=-n,p=u+(s-u)*e,g=Math.max(p,0),f=Math.min(Math.min(p+n,n),s-p),m=f+g>i?Math.max(i-g,0):f;this.rect.setAttributes({x:g+Math.min(b.x1-b.x,0),width:m},!1,{type:Ko.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}else{const i=null!==(p=null!==(u=b.height)&&void 0!==u?u:Math.abs(b.y1-b.y))&&void 0!==p?p:250,s=null!==(f=null===(g=this.params)||void 0===g?void 0:g.streamLength)&&void 0!==f?f:i,n=null!==(_=null===(v=null===(m=this.params)||void 0===m?void 0:m.attribute)||void 0===v?void 0:v.height)&&void 0!==_?_:60,r=i-(s+n)*e;let a=Math.min(r,i);const o=Math.min(i-r,n);let l;a<=0?(l=Math.max(a+o,0),a=0):l=o,this.rect.setAttributes({y:a+Math.min(b.y1-b.y,0),height:l},!1,{type:Ko.ANIMATE_PLAY,animationState:{ratio:e,end:t}})}}onUpdateLineOrArea(t,e,i){const s=this.line||this.area;if(!s)return;const n=s.pathProxy,r=this.target;r.cache||r.cacheArea?this._onUpdateLineOrAreaWithCache(n,r,t,e,i):this._onUpdateLineWithoutCache(n,r,t,e,i);const a=r.attribute;s.setAttributes(Object.assign({stroke:a.stroke},s.attribute)),s.addUpdateBoundTag()}_onUpdateLineOrAreaWithCache(t,e,i,s,n){var r,a;if(t.clear(),"line"===e.type){let i=e.cache;Array.isArray(i)||(i=[i]);const n=i.reduce(((t,e)=>t+e.getLength()),0),r=[];return i.forEach((t=>{t.curves.forEach((t=>r.push(t)))})),this._updateCurves(t,r,n,s)}if("area"===e.type&&(null===(a=null===(r=e.cacheArea)||void 0===r?void 0:r.top)||void 0===a?void 0:a.curves)){const i=e.cacheArea,n=i.top.curves.reduce(((t,e)=>t+e.getLength()),0);return this._updateCurves(t,i.top.curves,n,s)}}_updateCurves(t,e,i,s){var n,r;const a=i*s,o=Math.min(a+(null!==(r=null===(n=this.params)||void 0===n?void 0:n.streamLength)&&void 0!==r?r:10),i);let l=0,h=!1;for(let i=0;ia)if(h=!0,s.p2&&s.p3){const[e,i]=hl(s,r);t.moveTo(i.p0.x,i.p0.y),c=i}else{const e=s.getPointAt(r);t.moveTo(e.x,e.y)}if(lo){if(s.p2&&s.p3){c&&(d=(o-a)/c.getLength());const[e]=hl(c||s,d);t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else{const e=s.getPointAt(d);t.lineTo(e.x,e.y)}break}if(h)if(s.p2&&s.p3){const e=c||s;t.bezierCurveTo(e.p1.x,e.p1.y,e.p2.x,e.p2.y,e.p3.x,e.p3.y)}else t.lineTo(s.p1.x,s.p1.y);l+=n}}_onUpdateLineWithoutCache(t,e,i,s,n){var r,a;const{points:o,curveType:l}=e.attribute;if(!o||o.length<2||"linear"!==l)return;let h=0;for(let t=1;tc&&u.push(re.pointAtPP(o[t-1],o[t],1-(p+e-c)/e)),pd){u.push(re.pointAtPP(o[t-1],o[t],1-(p+e-d)/e));break}u.length&&u.push(o[t]),p+=e}if(u.length&&!(u.length<2)){t.clear(),t.moveTo(u[0].x,u[0].y);for(let e=1;e{NZ(XZ)},t.registerDataSetInstanceParser=SI,t.registerDataSetInstanceTransform=xI,t.registerDomTooltipHandler=()=>{LZ(RZ)},t.registerFormatPlugin=()=>{NZ($Z)},t.registerMediaQuery=()=>{NZ(UZ)},t.registerTheme=rO,t.removeTheme=oO,t.themeExist=lO,t.themes=iO,t.token=VR,t.transformColorSchemeToStandardStruct=xR,t.transformToGraphic=oI,t.version="2.0.20",t.vglobal=A_,t.warn=Hy,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/wx-vchart/package.json b/packages/wx-vchart/package.json index 728bba9136..3cd0098c45 100644 --- a/packages/wx-vchart/package.json +++ b/packages/wx-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/wx-vchart", - "version": "2.0.19", + "version": "2.0.20", "description": "", "main": "index.js", "miniprogram": ".", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9899e062d1..209a043bdd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,32 +1,39 @@ -lockfileVersion: '6.0' +lockfileVersion: '9.0' settings: autoInstallPeers: true excludeLinksFromLockfile: false -dependencies: - js-yaml: - specifier: ^4.1.0 - version: 4.1.0 +importers: -devDependencies: - '@types/js-yaml': - specifier: ^4.0.9 - version: 4.0.9 + .: + dependencies: + js-yaml: + specifier: ^4.1.0 + version: 4.1.1 + devDependencies: + '@types/js-yaml': + specifier: ^4.0.9 + version: 4.0.9 packages: - /@types/js-yaml@4.0.9: + '@types/js-yaml@4.0.9': resolution: {integrity: sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==} - dev: true - /argparse@2.0.1: + argparse@2.0.1: resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} - dev: false - /js-yaml@4.1.0: - resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} + js-yaml@4.1.1: + resolution: {integrity: sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==} hasBin: true + +snapshots: + + '@types/js-yaml@4.0.9': {} + + argparse@2.0.1: {} + + js-yaml@4.1.1: dependencies: argparse: 2.0.1 - dev: false diff --git a/skills/vchart-development-assistant/README.md b/skills/vchart-development-assistant/README.md new file mode 100644 index 0000000000..dc8d0f3b02 --- /dev/null +++ b/skills/vchart-development-assistant/README.md @@ -0,0 +1,66 @@ +# VChart Development Assistant - 用户使用说明 + +## 这个助手适合什么场景 + +- 从 0 到 1 生成图表(柱状图、折线图、饼图等) +- 修改已有图表样式(颜色、标签、图例、tooltip、坐标轴) +- 排查图表问题(不显示、报错、交互不生效、数据映射错误) +- 从截图/Figma 还原图表 +- 增加交互能力(点击事件、动态更新、联动高亮、导出图片、主题切换) + +## 如何提问效果最好 + +建议一次性提供以下信息: + +- 使用环境:原生 JS / React-VChart(`@visactor/react-vchart`)/ 其他框架 +- 目标:你想实现什么图表或效果 +- 数据:至少给 5~10 条样例数据(或字段结构) +- 当前代码:如果是改造/排错,贴出当前 spec 或关键代码 +- 期望与现状:预期效果 + 实际问题(报错信息/截图) + +推荐提问模板: + +```text +请用 VChart 帮我实现一个[图表类型]。 +技术栈:[JS / React-VChart] +数据样例:[粘贴数据] +需求:[例如:显示标签、点击柱子后打印数据、支持主题切换] +当前代码(可选):[粘贴 spec/组件代码] +问题(可选):[例如:图表空白、tooltip 不显示] +请给我可直接运行的完整 HTML(或 React 组件)并解释关键配置。 +``` + +## 可直接使用的示例 Prompt + +```text +用 VChart 生成一个基础柱状图,包含 xField、yField,并给出最小可运行示例。 +``` + +```text +在我现有柱状图基础上优化颜色、标签样式和图例可读性,保持数据结构不变。 +``` + +```text +帮我检查当前 VChart spec 的配置错误,指出问题位置并给出可直接替换的修复版本。 +``` + +## 你会得到什么输出 + +- 可直接运行的完整代码(默认包含完整 HTML) +- 关键配置说明(为什么这么配) +- 如果是排错场景:问题定位 + 修复建议 + 修复后代码 +- 如果有交互需求:同时给出 API 事件/状态/数据更新代码 + +## 常见问题建议 + +- 图表空白时,先检查 `xField` / `yField` 是否与数据字段名完全一致 +- 检查数据结构是否符合 VChart 要求(尤其是 `data` 和 `values`) +- 如果是 React 场景,确认依赖版本和组件导入方式正确 +- 问题无法复现时,优先提供最小复现代码和报错截图 + +## 参考文档 + +- VChart Skill Usage:`https://www.visactor.io/vchart/guide/tutorial_docs/VChart_Skill_Usage` +- VChart Quick Start:`https://www.visactor.io/vchart/guide/tutorial_docs/Getting_Started` +- VChart 配置项文档:`https://www.visactor.io/vchart/option` +- VChart API 文档:`https://www.visactor.io/vchart/api/API/vchart` diff --git a/skills/vchart-development-assistant/SKILL.md b/skills/vchart-development-assistant/SKILL.md index 378824164b..b7d068f7c0 100644 --- a/skills/vchart-development-assistant/SKILL.md +++ b/skills/vchart-development-assistant/SKILL.md @@ -5,6 +5,42 @@ description: VChart图表库专家助手,擅长创建、配置和调试VChart # VChart 图表开发助手 Skill +## 自我介绍策略 + +当用户询问本助手的能力范围(如"你能做什么"、"这个助手是什么"、"有什么功能")时,用第一人称简要概括: + +> 我是 VChart 图表开发助手,基于 VChart 2.0.0+ 版本,可以帮你: +> +> - 从零生成图表配置(柱状图、折线图、饼图等) +> - 诊断和修复图表问题(不显示、报错、交互不生效) +> - 从截图或 Figma 设计稿还原图表样式 +> - 实现交互功能(点击事件、动态更新、联动高亮、导出图片、主题切换) +> - 支持原生 JS 和 React-VChart(`@visactor/react-vchart`) + +如用户需要更详细的入门指引,推荐查阅官方教程:https://www.visactor.io/vchart/guide/tutorial_docs/Getting_Started + +**不要**在用户未询问时主动输出上述介绍。 + +--- + +## 信息不足时的引导策略 + +当用户首次提问信息不足时(缺少技术栈、数据样例、当前代码等),用一句话自然地引导补充,优先询问最关键的 1-2 个缺失信息,不要一次罗列所有问题。 + +引导优先级: + +1. **技术栈**(JS / React-VChart)— 影响模板选择和代码风格 +2. **数据样例或字段结构** — 影响字段映射,是最高频错误源 +3. **当前代码**(如果是排错/改造场景)— 影响诊断准确性 +4. **期望效果与实际问题** — 影响场景识别 + +示例引导话术: + +- "请问您是用原生 JS 还是 React-VChart?另外能否提供一份数据样例?" +- "方便贴一下当前的 spec 配置吗?我来帮您定位问题。" + +--- + ## 角色定义 你是一位 VChart 图表库专家助手,专门帮助用户解决 VChart 2.0.0+ 版本的图表开发问题。你具备以下能力: @@ -18,6 +54,8 @@ description: VChart图表库专家助手,擅长创建、配置和调试VChart - **主动发现问题**:生成代码后主动自检,提前预警潜在风险(如字段映射错误) - **快速响应反馈**:当用户反馈问题时,立即切换到诊断模式而非继续生成 +--- + ## 核心知识库 本 Skill 依赖以下结构化知识库: @@ -134,14 +172,14 @@ python3 scripts/generate_diagnosis_react_html.py \ **API 能力分类**: -| 能力类型 | 典型需求 | API 文档 | -|---------|---------|---------| -| 事件监听 | 点击响应、hover 效果 | `references/api/event-api.md` | -| 数据操作 | 动态更新、实时刷新 | `references/api/data-api.md` | -| 状态管理 | 高亮、选中 | `references/api/state-api.md` | -| 交互控制 | 手动触发 tooltip | `references/api/interaction-api.md` | -| 导出功能 | 下载图片 | `references/api/export-api.md` | -| 主题切换 | 深色模式 | `references/api/theme-api.md` | +| 能力类型 | 典型需求 | API 文档 | +| -------- | -------------------- | ----------------------------------- | +| 事件监听 | 点击响应、hover 效果 | `references/api/event-api.md` | +| 数据操作 | 动态更新、实时刷新 | `references/api/data-api.md` | +| 状态管理 | 高亮、选中 | `references/api/state-api.md` | +| 交互控制 | 手动触发 tooltip | `references/api/interaction-api.md` | +| 导出功能 | 下载图片 | `references/api/export-api.md` | +| 主题切换 | 深色模式 | `references/api/theme-api.md` | --- @@ -163,13 +201,13 @@ python3 scripts/generate_diagnosis_react_html.py \ **在当前场景中检测到 API 需求时,不切换场景,而是增强输出**: -| 当前场景 | 检测到 API 需求 | 增强动作 | -| -------- | ------------------- | ------------------------------ | -| 场景2 | "点击后获取数据" | 输出 Spec + 事件监听代码 | -| 场景2 | "动态更新数据" | 输出 Spec + 数据更新函数 | -| 场景3 | "联动高亮" | 输出 Spec + 状态管理代码 | -| 场景3 | "导出图片" | 输出 Spec + 导出按钮和函数 | -| 场景1 | API 代码报错 | 同时诊断 Spec 和 API 代码 | +| 当前场景 | 检测到 API 需求 | 增强动作 | +| -------- | ---------------- | -------------------------- | +| 场景2 | "点击后获取数据" | 输出 Spec + 事件监听代码 | +| 场景2 | "动态更新数据" | 输出 Spec + 数据更新函数 | +| 场景3 | "联动高亮" | 输出 Spec + 状态管理代码 | +| 场景3 | "导出图片" | 输出 Spec + 导出按钮和函数 | +| 场景1 | API 代码报错 | 同时诊断 Spec 和 API 代码 | #### 切换要点 @@ -192,7 +230,7 @@ python3 scripts/generate_diagnosis_react_html.py \ ### 主动提示 -发现风险��告知用户: +发现风险时告知用户: ``` 已生成配置 @@ -262,18 +300,18 @@ python3 scripts/generate_diagnosis_react_html.py \ **快速索引**:`references/api/API_INDEX.md` -| 用户需求 | 查询文档 | -| ---------------- | -------------------------------------- | -| 更新图表数据 | `references/api/data-api.md` | -| 响应点击/hover | `references/api/event-api.md` | -| 高亮/选中图元 | `references/api/state-api.md` | -| 手动触发tooltip | `references/api/interaction-api.md` | -| 切换主题 | `references/api/theme-api.md` | -| 导出图片 | `references/api/export-api.md` | -| 控制动画 | `references/api/animation-api.md` | -| 坐标位置转换 | `references/api/coordinate-api.md` | -| 控制图例 | `references/api/legend-api.md` | -| 调整尺寸 | `references/api/layout-api.md` | +| 用户需求 | 查询文档 | +| --------------- | ----------------------------------- | +| 更新图表数据 | `references/api/data-api.md` | +| 响应点击/hover | `references/api/event-api.md` | +| 高亮/选中图元 | `references/api/state-api.md` | +| 手动触发tooltip | `references/api/interaction-api.md` | +| 切换主题 | `references/api/theme-api.md` | +| 导出图片 | `references/api/export-api.md` | +| 控制动画 | `references/api/animation-api.md` | +| 坐标位置转换 | `references/api/coordinate-api.md` | +| 控制图例 | `references/api/legend-api.md` | +| 调整尺寸 | `references/api/layout-api.md` | **API 查询流程**: diff --git a/skills/vchart-development-assistant/references/type-details/ICartesianAxisSpec-Type-Definition.md b/skills/vchart-development-assistant/references/type-details/ICartesianAxisSpec-Type-Definition.md index 219a0b5fef..3e73037f01 100644 --- a/skills/vchart-development-assistant/references/type-details/ICartesianAxisSpec-Type-Definition.md +++ b/skills/vchart-development-assistant/references/type-details/ICartesianAxisSpec-Type-Definition.md @@ -18,6 +18,7 @@ All axis types are based on `ICartesianAxisCommonSpec`: ```typescript type ICartesianAxisCommonSpec = ICommonAxisSpec & { // Core configuration + hideWhenEmpty?: boolean; // Hide axis when bound series collect no axis data grid?: IGrid; // Grid line configuration subGrid?: IGrid; // Sub grid line configuration domainLine?: ICartesianDomainLine; // Axis line configuration @@ -32,6 +33,21 @@ type ICartesianAxisCommonSpec = ICommonAxisSpec & { } & (ICartesianVertical | ICartesianHorizontal | ICartesianZ); ``` +## Runtime Visibility + +`hideWhenEmpty` is a cartesian-axis-only opt-in flag that works together with the existing `visible` property. + +```typescript +type ICartesianAxisCommonSpec = ICommonAxisSpec & { + hideWhenEmpty?: boolean; // @default false +}; +``` + +Behavior notes: +- If `visible` is `false`, the axis stays hidden regardless of `hideWhenEmpty`. +- If `hideWhenEmpty` is `true`, the axis hides when its bound series do not collect any axis data. +- When later data updates make the bound series non-empty, the axis shows again automatically. + ## Orientation Configuration ### Vertical Axis @@ -335,6 +351,7 @@ const linearAxis: ICartesianLinearAxisSpec = { type: 'linear', min: 0, max: 100, + hideWhenEmpty: true, nice: true, grid: { visible: true }, label: { formatMethod: text => `${text}%` }, diff --git a/skills/vchart-development-assistant/references/type-details/ILegendSpec-Type-Definition.md b/skills/vchart-development-assistant/references/type-details/ILegendSpec-Type-Definition.md index e9caf08047..61f17a13fa 100644 --- a/skills/vchart-development-assistant/references/type-details/ILegendSpec-Type-Definition.md +++ b/skills/vchart-development-assistant/references/type-details/ILegendSpec-Type-Definition.md @@ -298,7 +298,14 @@ interface ILegendSpec { precision?: number; formatter?: (text: string | number) => string | number; space?: number; - style?: ITextMarkSpec; + style?: ITextMarkSpec | ((value: string | number, position: 'start' | 'end', context: { + layout?: 'horizontal' | 'vertical' | string; + align?: 'top' | 'bottom' | 'left' | 'right'; + railWidth: number; + railHeight: number; + handlerSize?: number; + slidable?: boolean; + }) => ITextMarkSpec | undefined); }; // Size legend specific @@ -404,7 +411,11 @@ const sizeLegend: ILegendSpec = { handlerText: { visible: true, precision: 0, - formatter: (value) => `${value}K` + formatter: (value) => `${value}K`, + style: (value, position) => ({ + dx: position === 'start' ? -6 : 6, + fill: Number(value) > 50 ? '#d03050' : '#666' + }) } }; ``` @@ -542,4 +553,4 @@ const multiLegendChart = { } ] }; -``` \ No newline at end of file +``` diff --git a/specs/008-fix-size-legend-handler-text/checklists/requirements.md b/specs/008-fix-size-legend-handler-text/checklists/requirements.md new file mode 100644 index 0000000000..8f75ef9e7b --- /dev/null +++ b/specs/008-fix-size-legend-handler-text/checklists/requirements.md @@ -0,0 +1,34 @@ +# Specification Quality Checklist: Size Legend Handler Text Layout + +**Purpose**: Validate specification completeness and quality before proceeding to planning +**Created**: 2026-03-20 +**Feature**: [/data00/home/lixuefei.1313/github/VChart/specs/008-fix-size-legend-handler-text/spec.md](/data00/home/lixuefei.1313/github/VChart/specs/008-fix-size-legend-handler-text/spec.md) + +## Content Quality + +- [x] No implementation details (languages, frameworks, APIs) +- [x] Focused on user value and business needs +- [x] Written for non-technical stakeholders +- [x] All mandatory sections completed + +## Requirement Completeness + +- [x] No [NEEDS CLARIFICATION] markers remain +- [x] Requirements are testable and unambiguous +- [x] Success criteria are measurable +- [x] Success criteria are technology-agnostic (no implementation details) +- [x] All acceptance scenarios are defined +- [x] Edge cases are identified +- [x] Scope is clearly bounded +- [x] Dependencies and assumptions identified + +## Feature Readiness + +- [x] All functional requirements have clear acceptance criteria +- [x] User scenarios cover primary flows +- [x] Feature meets measurable outcomes defined in Success Criteria +- [x] No implementation details leak into specification + +## Notes + +- Assumption: The issue scope is limited to the size legend `handlerText` behavior described in GitHub issue #4489 and does not change unrelated legend layout behavior. diff --git a/specs/008-fix-size-legend-handler-text/contracts/handler-text-style.md b/specs/008-fix-size-legend-handler-text/contracts/handler-text-style.md new file mode 100644 index 0000000000..735483e162 --- /dev/null +++ b/specs/008-fix-size-legend-handler-text/contracts/handler-text-style.md @@ -0,0 +1,14 @@ +# Contract: Continuous Legend Handler Text Style + +## Public Configuration Contract + +The `handlerText.style` field on continuous legends must accept: + +- A static text style object. +- A callback receiving continuous legend item context and returning a text style object. + +## Behavioral Guarantees + +- Static style values remain backward compatible. +- Callback return values are transformed with the same graphic conversion rules as static styles. +- Missing or partial callback return objects do not prevent handler text rendering. diff --git a/specs/008-fix-size-legend-handler-text/data-model.md b/specs/008-fix-size-legend-handler-text/data-model.md new file mode 100644 index 0000000000..2299be49e2 --- /dev/null +++ b/specs/008-fix-size-legend-handler-text/data-model.md @@ -0,0 +1,35 @@ +# Data Model: Size Legend Handler Text Layout + +## Entities + +### Continuous Legend Handler Text Config + +- Purpose: Represents the public `handlerText` configuration supplied in a continuous legend spec. +- Fields: + - `visible`: optional boolean toggle + - `precision`: optional numeric precision for displayed value + - `formatter`: optional text formatter + - `space`: optional spacing between handler and text + - `style`: either a static text style object or a callback returning a text style object +- Relationships: + - Belongs to `IContinuousLegendSpec` + - Is transformed into vrender continuous legend attributes by `getContinuousLegendAttributes` + +### Continuous Legend Render Attributes + +- Purpose: Runtime attributes passed from VChart to `@visactor/vrender-components`. +- Fields: + - `handlerText`: transformed handler text config + - `startText` / `endText`: sibling text configs using the same transformation helper + - `handlerStyle`, `railStyle`, `trackStyle`: other transformed style attributes +- Relationships: + - Derived from the legend spec + - Consumed by `SizeContinuousLegend` and `ColorContinuousLegend` + +## State Transitions + +1. User provides a continuous legend spec with `handlerText.style`. +2. VChart merges theme defaults and user spec. +3. `getContinuousLegendAttributes` transforms `handlerText` through `transformComponentStyle`. +4. The resulting static object or callback is passed to the continuous legend component. +5. During render or interaction updates, the component evaluates the style and applies it to the handler text. diff --git a/specs/008-fix-size-legend-handler-text/plan.md b/specs/008-fix-size-legend-handler-text/plan.md new file mode 100644 index 0000000000..5795facee4 --- /dev/null +++ b/specs/008-fix-size-legend-handler-text/plan.md @@ -0,0 +1,70 @@ +# Implementation Plan: Size Legend Handler Text Layout + +**Branch**: `008-fix-size-legend-handler-text` | **Date**: 2026-03-20 | **Spec**: [/data00/home/lixuefei.1313/github/VChart/specs/008-fix-size-legend-handler-text/spec.md](/data00/home/lixuefei.1313/github/VChart/specs/008-fix-size-legend-handler-text/spec.md) +**Input**: Feature specification from `/specs/008-fix-size-legend-handler-text/spec.md` + +## Summary + +Allow size legend `handlerText.style` to accept function-based values in the same way other legend style hooks already do, and add regression coverage proving the style callback is preserved through continuous legend attribute transformation. This gives chart authors a supported way to adjust handler text positioning dynamically and avoid overlap during handler movement. + +## Technical Context + +**Language/Version**: TypeScript 4.9.x +**Primary Dependencies**: `@visactor/vutils`, `@visactor/vutils-extension`, `@visactor/vrender-components` +**Storage**: N/A +**Testing**: Jest 26 unit tests under `packages/vchart/__tests__` +**Target Platform**: Cross-platform chart runtime for browser and mini-app wrappers +**Project Type**: Monorepo charting library package (`packages/vchart`) +**Performance Goals**: Preserve existing continuous legend interaction performance and stay within the constitution target for high-frequency interactions (<16ms budget) +**Constraints**: Keep backward compatibility for existing static `handlerText` config; avoid changing unrelated legend layout behavior; keep type/schema generation compatible with current public spec model +**Scale/Scope**: One public legend configuration path, one transformation utility, and focused unit regression coverage in `packages/vchart` + +## Constitution Check + +*GATE: Must pass before Phase 0 research. Re-check after Phase 1 design.* + +- Pass: Change is specification-driven and limited to the bug scope documented in the feature spec. +- Pass: Work stays inside `@visactor/vchart` package boundaries and does not introduce new cross-package coupling. +- Pass: The fix is a backward-compatible bug fix, aligned with patch-level behavior. +- Pass: A regression test will be added for the transformed continuous legend attributes, satisfying the constitution requirement for bug-fix coverage. +- Pass: No new runtime dependency or license review is required. + +## Project Structure + +### Documentation (this feature) + +```text +specs/008-fix-size-legend-handler-text/ +├── plan.md +├── research.md +├── data-model.md +├── quickstart.md +├── contracts/ +│ └── handler-text-style.md +└── tasks.md +``` + +### Source Code (repository root) + +```text +packages/vchart/ +├── src/ +│ ├── component/legend/continuous/ +│ │ ├── interface.ts +│ │ └── util.ts +│ └── util/ +│ └── style.ts +└── __tests__/ + └── unit/ + └── component/ + └── legend/ + └── continuous-legend.test.ts +``` + +**Structure Decision**: Implement the fix in `packages/vchart/src/component/legend/continuous/interface.ts` and verify behavior with a focused unit test under `packages/vchart/__tests__/unit/component/legend/`. Existing transformation logic in `packages/vchart/src/util/style.ts` is reused rather than duplicated. + +## Complexity Tracking + +| Violation | Why Needed | Simpler Alternative Rejected Because | +|-----------|------------|-------------------------------------| +| None | N/A | N/A | diff --git a/specs/008-fix-size-legend-handler-text/quickstart.md b/specs/008-fix-size-legend-handler-text/quickstart.md new file mode 100644 index 0000000000..62b70abe53 --- /dev/null +++ b/specs/008-fix-size-legend-handler-text/quickstart.md @@ -0,0 +1,14 @@ +# Quickstart: Verify Size Legend Handler Text Layout + +## Manual Verification + +1. Prepare a chart using the size legend demo referenced in issue #4489. +2. Configure `legend.size.handlerText.style` with a callback that changes text alignment or offset near the slider bounds. +3. Render the chart and drag the legend handler across the full range. +4. Confirm the handler text updates from the callback and remains readable near both ends of the slider. + +## Automated Verification + +1. Run the focused Jest test for the continuous legend regression. +2. Confirm that static `handlerText.style` still transforms as before. +3. Confirm that callback-based `handlerText.style` is preserved and its returned style is converted to graphic attributes. diff --git a/specs/008-fix-size-legend-handler-text/research.md b/specs/008-fix-size-legend-handler-text/research.md new file mode 100644 index 0000000000..70a2afdc38 --- /dev/null +++ b/specs/008-fix-size-legend-handler-text/research.md @@ -0,0 +1,25 @@ +# Research: Size Legend Handler Text Layout + +## Decision 1: Treat this as a VChart spec/type support gap, not a new layout engine feature + +- Decision: Extend the size legend `handlerText.style` contract so function-based style values are accepted and passed through the existing continuous legend transformation path. +- Rationale: `transformComponentStyle` already preserves `style` callbacks by wrapping them and converting returned values with `transformToGraphic`. The continuous legend path already calls `transformComponentStyle(handlerText)`, so the missing support is in the public type contract rather than the transform implementation itself. +- Alternatives considered: + - Modify continuous legend layout defaults to auto-avoid overlap in all cases. Rejected because the issue explicitly asks for function style support, and a generic layout rewrite is broader than the reported bug. + - Patch only documentation without changing the type contract. Rejected because TypeScript users would still be blocked from supplying the supported runtime shape. + +## Decision 2: Reuse the existing legend style callback signature pattern + +- Decision: Model the new `handlerText.style` callback after other legend callback-based style APIs that receive legend item context and return a style object. +- Rationale: Discrete legend already exposes callback-capable style values for legend item subparts, and `transformComponentStyle` is written against the `LegendItemDatum` callback shape expected by vrender components. +- Alternatives considered: + - Introduce a new callback signature specific to continuous legends. Rejected because it would add public API inconsistency and require additional transformation logic without evidence that vrender needs a different shape. + - Accept only full `handlerText` object callbacks. Rejected because the issue scope is narrower: `handlerText.style` should support function values. + +## Decision 3: Add a focused unit regression around attribute transformation + +- Decision: Add a unit test that verifies `getContinuousLegendAttributes` preserves function-based `handlerText.style` and transforms returned style values correctly. +- Rationale: This directly guards the bug path inside VChart without requiring browser-level screenshot infrastructure in this change. It also validates backward compatibility for static values in the same transformation layer. +- Alternatives considered: + - Add only end-to-end demo verification. Rejected because the constitution strongly prefers regression coverage for bug fixes. + - Test `transformComponentStyle` in isolation. Rejected because the user-facing contract is the continuous legend spec, and the regression should exercise the actual legend attribute assembly path. diff --git a/specs/008-fix-size-legend-handler-text/spec.md b/specs/008-fix-size-legend-handler-text/spec.md new file mode 100644 index 0000000000..cc16e69d49 --- /dev/null +++ b/specs/008-fix-size-legend-handler-text/spec.md @@ -0,0 +1,68 @@ +# Feature Specification: Size Legend Handler Text Layout + +**Feature Branch**: `008-fix-size-legend-handler-text` +**Created**: 2026-03-20 +**Status**: Draft +**Input**: User description: "Fix VChart issue #4489: size legend handlerText style should support function values and avoid overlapping text when sliding the handler" + +## User Scenarios & Testing *(mandatory)* + +### User Story 1 - Render Handler Text Without Overlap (Priority: P1) + +As a chart author using a size legend with a draggable handler, I want the handler text to stay readable while the handler moves so that the legend remains understandable during interaction. + +**Why this priority**: The reported bug is a visual regression in the primary interaction path for the size legend. Fixing readability during dragging is the direct user value of this issue. + +**Independent Test**: Open a chart with a size legend and drag the handler across its range. The handler text remains readable and does not overlap surrounding legend content throughout the interaction. + +**Acceptance Scenarios**: + +1. **Given** a size legend configured with handler text enabled, **When** the user drags the handler, **Then** the handler text remains visually separated from adjacent legend labels and marks. +2. **Given** a size legend with default handler text styling, **When** the handler is moved to either end of the slider range, **Then** the rendered text still stays readable and does not collide with neighboring content. + +--- + +### User Story 2 - Use Dynamic Handler Text Styling (Priority: P2) + +As a chart author, I want handler text style options to accept dynamic values so that I can tailor the text presentation to the active legend value and layout context. + +**Why this priority**: Supporting dynamic styling resolves the missing capability named in the bug report and enables authors to prevent layout problems in charts with varying content. + +**Independent Test**: Configure handler text style with value-dependent settings, render the chart, and verify that the handler text updates according to the current legend value while preserving legibility. + +**Acceptance Scenarios**: + +1. **Given** a size legend whose handler text style is configured with functions, **When** the legend renders or updates, **Then** the evaluated style is applied to the handler text for the current handler state. +2. **Given** a size legend whose handler text style mixes static values and functions, **When** the handler position changes, **Then** both static and dynamic style settings are honored without breaking rendering. + +### Edge Cases + +- What happens when the handler is dragged to the minimum or maximum extent of the size legend range? +- How does the system handle handler text style functions that return partial style objects or omit optional fields? +- What happens when the evaluated handler text content becomes longer than typical labels in the same legend? + +## Requirements *(mandatory)* + +### Functional Requirements + +- **FR-001**: The system MUST render size legend handler text in a way that remains readable while the handler is dragged across the legend range. +- **FR-002**: The system MUST prevent handler text from visually overlapping adjacent size legend content in normal dragging scenarios, including when the handler is at either range boundary. +- **FR-003**: Chart authors MUST be able to provide function-based values for size legend `handlerText` style settings. +- **FR-004**: The system MUST evaluate function-based `handlerText` style values against the current legend context whenever the handler text is rendered or updated. +- **FR-005**: The system MUST continue to support existing static `handlerText` style values without requiring configuration changes from current users. +- **FR-006**: The system MUST ignore unsupported or missing dynamic style fields gracefully and continue rendering the handler text. + +### Key Entities *(include if feature involves data)* + +- **Size Legend Handler**: The draggable control on a size legend that represents the active position within the legend range. +- **Handler Text Style**: The set of presentation properties applied to the size legend handler label, including both static and function-derived values. +- **Legend Render Context**: The runtime state used to resolve handler text appearance, such as current handler position or legend value. + +## Success Criteria *(mandatory)* + +### Measurable Outcomes + +- **SC-001**: In the reproduction for issue #4489, dragging the size legend handler no longer produces visible overlap between handler text and neighboring legend content. +- **SC-002**: Charts that already use static size legend `handlerText` styles continue to render without required option changes. +- **SC-003**: Charts configured with function-based size legend `handlerText` style values apply those values during initial render and after handler movement. +- **SC-004**: The bug fix can be verified with automated coverage or scripted examples that exercise both static and dynamic `handlerText` styling behavior. diff --git a/specs/008-fix-size-legend-handler-text/tasks.md b/specs/008-fix-size-legend-handler-text/tasks.md new file mode 100644 index 0000000000..7727625217 --- /dev/null +++ b/specs/008-fix-size-legend-handler-text/tasks.md @@ -0,0 +1,89 @@ +# Tasks: Size Legend Handler Text Layout + +**Input**: Design documents from `/specs/008-fix-size-legend-handler-text/` +**Prerequisites**: plan.md, spec.md, research.md, data-model.md, contracts/ + +**Tests**: Include focused unit regression coverage because this is a bug fix. + +**Organization**: Tasks are grouped by user story to enable independent implementation and testing. + +## Phase 1: Setup (Shared Infrastructure) + +**Purpose**: Confirm the feature scope and target files before code changes + +- [x] T001 Inspect continuous legend interfaces and existing style transformation flow in packages/vchart/src/component/legend/continuous/interface.ts and packages/vchart/src/component/legend/continuous/util.ts + +--- + +## Phase 2: Foundational (Blocking Prerequisites) + +**Purpose**: Establish the callback contract reused by the implementation and tests + +- [x] T002 Inspect existing callback-capable legend style types for reuse in packages/vchart/src/component/legend/discrete/interface.ts + +**Checkpoint**: Callback contract choice is settled and user story work can proceed + +--- + +## Phase 3: User Story 1 - Render Handler Text Without Overlap (Priority: P1) 🎯 MVP + +**Goal**: Preserve a supported path for dynamic handler text positioning so authors can keep size legend handler text readable during drag interactions + +**Independent Test**: Build continuous legend attributes from a size legend spec whose `handlerText.style` is a callback and confirm the callback survives transformation with returned offsets/styles converted correctly + +### Tests for User Story 1 + +- [x] T003 [P] [US1] Add continuous legend regression tests for static and callback `handlerText.style` in packages/vchart/__tests__/unit/component/legend/continuous-legend.test.ts + +### Implementation for User Story 1 + +- [x] T004 [US1] Extend continuous legend handler text style typings to accept callbacks in packages/vchart/src/component/legend/continuous/interface.ts +- [x] T005 [US1] Verify continuous legend attribute transformation preserves callback-based handler text styles in packages/vchart/src/component/legend/continuous/util.ts + +**Checkpoint**: Size legend handler text supports callback styling and the regression test proves the transform path + +--- + +## Phase 4: User Story 2 - Use Dynamic Handler Text Styling (Priority: P2) + +**Goal**: Keep the public configuration contract explicit and documented for function-based handler text styles + +**Independent Test**: Review the feature contract and ensure the public type now matches the supported runtime behavior + +### Implementation for User Story 2 + +- [x] T006 [US2] Update the feature contract notes to reflect callback-based `handlerText.style` support in specs/008-fix-size-legend-handler-text/contracts/handler-text-style.md + +**Checkpoint**: Public contract and implementation are aligned + +--- + +## Phase 5: Polish & Cross-Cutting Concerns + +**Purpose**: Validate the finished change and sync task tracking + +- [ ] T007 Run the focused Jest regression for continuous legend handler text support +- [x] T008 Mark completed tasks in specs/008-fix-size-legend-handler-text/tasks.md after implementation and verification + +--- + +## Dependencies & Execution Order + +- T001 -> T002 -> T003/T004/T005 +- T003 should be written before or alongside T004/T005 and must validate the user-facing behavior +- T006 depends on implementation decisions from T004/T005 +- T007 depends on T003-T006 +- T008 depends on all prior tasks completing + +## Parallel Opportunities + +- T003 can be prepared while T004 is being implemented, but both touch the same feature and should stay tightly coordinated + +## Implementation Strategy + +### MVP First + +1. Complete T001-T002 to lock the callback contract. +2. Complete T003-T005 to support callback-based `handlerText.style`. +3. Run T007 to verify the regression path. +4. Complete T006 and T008 to finish documentation and task tracking. diff --git a/specs/009-fix-heatmap-scrollbar-axis-direction/plan.md b/specs/009-fix-heatmap-scrollbar-axis-direction/plan.md new file mode 100644 index 0000000000..44a3a2dbf6 --- /dev/null +++ b/specs/009-fix-heatmap-scrollbar-axis-direction/plan.md @@ -0,0 +1,44 @@ +# Implementation Plan: Fix Heatmap Scrollbar Axis Direction + +**Branch**: `009-fix-heatmap-scrollbar-axis-direction` | **Date**: 2026-03-23 | **Spec**: [/data00/home/lixuefei.1313/github/VChart/specs/009-fix-heatmap-scrollbar-axis-direction/spec.md](/data00/home/lixuefei.1313/github/VChart/specs/009-fix-heatmap-scrollbar-axis-direction/spec.md) +**Input**: Feature specification from `/specs/009-fix-heatmap-scrollbar-axis-direction/spec.md` + +## Summary + +Fix the heatmap scrollbar and left-axis direction mismatch by aligning `ScrollBar` with `DataZoom` when converting scrollbar state percentages back into domain values. Add a focused regression test covering a vertical reversed discrete axis, which is the path exercised by the heatmap reproduction. + +## Technical Context + +**Language/Version**: TypeScript 4.9.x +**Primary Dependencies**: `@visactor/vscale`, `@visactor/vutils`, `@visactor/vrender-components` +**Testing**: Jest 26 unit tests under `packages/vchart/__tests__` +**Target Platform**: Browser and cross-platform cartesian chart runtime +**Project Type**: Monorepo charting library package (`packages/vchart`) +**Constraints**: Preserve existing `dataZoom` behavior; avoid changing axis range calculation; keep the fix scoped to scrollbar state-domain conversion + +## Constitution Check + +- Pass: The work is narrowly scoped to the documented bug. +- Pass: The change reuses an existing shared utility instead of introducing a new behavior branch. +- Pass: Regression coverage will be added for the user-visible bug path. + +## Project Structure + +```text +specs/009-fix-heatmap-scrollbar-axis-direction/ +├── plan.md +├── spec.md +└── tasks.md +``` + +```text +packages/vchart/ +├── src/component/data-zoom/scroll-bar/scroll-bar.ts +└── __tests__/unit/component/data-zoom/scroll-bar/scroll-bar.test.ts +``` + +## Implementation Strategy + +1. Update `ScrollBar._handleChange` to derive `startValue` and `endValue` with `isReverse(axis, this._isHorizontal)`. +2. Add a regression test that mocks a reversed vertical band axis and asserts scrollbar state `0 -> 0.5` maps to the top half of the domain. +3. Run the focused Jest test file and inspect the diff for unintended churn. diff --git a/specs/009-fix-heatmap-scrollbar-axis-direction/spec.md b/specs/009-fix-heatmap-scrollbar-axis-direction/spec.md new file mode 100644 index 0000000000..f9cc36423c --- /dev/null +++ b/specs/009-fix-heatmap-scrollbar-axis-direction/spec.md @@ -0,0 +1,41 @@ +# Feature Specification: Fix Heatmap Scrollbar Axis Direction + +**Feature Branch**: `009-fix-heatmap-scrollbar-axis-direction` +**Created**: 2026-03-23 +**Status**: Draft +**Input**: User description: "Fix VChart issue #4320: heatmap right scrollbar scroll direction is opposite to the left band axis order" + +## User Scenarios & Testing *(mandatory)* + +### User Story 1 - Keep Vertical Scroll Direction Consistent (Priority: P1) + +As a chart author using a heatmap with a right-side vertical scrollbar, I want the visible left-axis labels to move in the same direction as the scrollbar thumb so that the viewport behaves consistently with bar charts and user expectations. + +**Why this priority**: The reported bug breaks the primary interaction for scrolling long heatmap category axes and makes the chart feel inverted. + +**Independent Test**: Render a heatmap with a left `band` axis and a right `scrollBar` bound to the same Y field. Move the scrollbar to the top and verify the axis viewport shows the first categories rather than the last categories. + +**Acceptance Scenarios**: + +1. **Given** a heatmap whose Y axis is a vertical band axis and whose `scrollBar.orient` is `right`, **When** the scrollbar range starts at `0`, **Then** the left axis viewport shows the earliest/top categories in the axis domain. +2. **Given** the same chart, **When** the scrollbar is dragged downward, **Then** the visible Y-axis categories advance downward in the same direction as the scrollbar thumb. + +### Edge Cases + +- Vertical discrete axes whose internal scale range is reversed because of cartesian axis layout should still map scrollbar state to domain values correctly. +- Horizontal scrollbars and already-correct dataZoom behavior must remain unchanged. + +## Requirements *(mandatory)* + +### Functional Requirements + +- **FR-001**: The scrollbar component MUST resolve discrete axis domain values using the same reverse-axis logic as other data-filter components. +- **FR-002**: For vertical cartesian band axes, a scrollbar state near `start = 0` MUST map to the top of the visible axis domain instead of the bottom when the axis scale range is reversed by layout. +- **FR-003**: Existing scrollbar behavior for non-reversed or horizontal axes MUST remain backward compatible. + +## Success Criteria *(mandatory)* + +### Measurable Outcomes + +- **SC-001**: In the issue #4320 reproduction, placing the right scrollbar thumb at the top shows the top portion of the heatmap Y-axis domain. +- **SC-002**: A focused automated regression test proves scrollbar state-to-domain conversion respects reversed vertical axis ranges. diff --git a/specs/009-fix-heatmap-scrollbar-axis-direction/tasks.md b/specs/009-fix-heatmap-scrollbar-axis-direction/tasks.md new file mode 100644 index 0000000000..7e9c6ea518 --- /dev/null +++ b/specs/009-fix-heatmap-scrollbar-axis-direction/tasks.md @@ -0,0 +1,27 @@ +# Tasks: Heatmap Scrollbar Axis Direction + +**Input**: Design documents from `/specs/009-fix-heatmap-scrollbar-axis-direction/` +**Prerequisites**: plan.md, spec.md + +**Tests**: Include focused unit regression coverage for the reversed vertical axis path. + +## Phase 1: Setup + +- [x] T001 Inspect scrollbar reverse-mapping logic and compare it with `dataZoom` + +## Phase 2: User Story 1 - Keep Vertical Scroll Direction Consistent (Priority: P1) + +**Goal**: Make right-side heatmap scrollbar movement and left-axis viewport order move in the same direction + +### Tests for User Story 1 + +- [x] T002 [US1] Add a scrollbar regression test for reversed vertical axis mapping in `packages/vchart/__tests__/unit/component/data-zoom/scroll-bar/scroll-bar.test.ts` + +### Implementation for User Story 1 + +- [x] T003 [US1] Reuse shared reverse-axis detection in `packages/vchart/src/component/data-zoom/scroll-bar/scroll-bar.ts` + +## Phase 3: Polish + +- [ ] T004 Run the focused Jest test for scrollbar regressions +- [x] T005 Update task tracking after implementation diff --git a/specs/009-fix-issue-of-mark-state-when-updateSpec/plan.md b/specs/009-fix-issue-of-mark-state-when-updateSpec/plan.md new file mode 100644 index 0000000000..d25d86b062 --- /dev/null +++ b/specs/009-fix-issue-of-mark-state-when-updateSpec/plan.md @@ -0,0 +1,25 @@ +# Implementation Plan: Fix mark state issue during updateSpec + +## Summary +Fix an issue where mark states were not properly cleared when `updateSpec` was called, causing incorrect state persistence. + +## Technical Context +The `updateSpec` process re-initializes marks but previous state information was lingering. +Changes include: +- Added `clearAllStateInfo` method to `IMarkStateManager` interface and implementation. +- Added `clearBeforeReInit` method to `IMarkRaw` interface and implementation. +- Invoked `clearBeforeReInit` in `BaseMark` during re-initialization. +- Updated `BaseSeries` to handle state cleanup during spec updates. + +### Source Code (repository root) +``` +packages/vchart/src/compile/mark/interface.ts +packages/vchart/src/compile/mark/mark-state-manager.ts +packages/vchart/src/mark/base/base-mark.ts +packages/vchart/src/mark/interface/common.ts +packages/vchart/src/series/base/base-series.ts +``` + +## Verification Plan +- Verify that mark states (e.g., hover, select) are reset correctly after `updateSpec`. +- Ensure no regression in normal state interactions. diff --git a/specs/010-hide-empty-axes/checklists/requirements.md b/specs/010-hide-empty-axes/checklists/requirements.md new file mode 100644 index 0000000000..f78d857b97 --- /dev/null +++ b/specs/010-hide-empty-axes/checklists/requirements.md @@ -0,0 +1,34 @@ +# Specification Quality Checklist: Hide Axes For Empty Series + +**Purpose**: Validate specification completeness and quality before proceeding to planning +**Created**: 2026-03-20 +**Feature**: [spec.md](/data00/home/lixuefei.1313/github/VChart/specs/010-hide-empty-axes/spec.md) + +## Content Quality + +- [x] No implementation details (languages, frameworks, APIs) +- [x] Focused on user value and business needs +- [x] Written for non-technical stakeholders +- [x] All mandatory sections completed + +## Requirement Completeness + +- [x] No [NEEDS CLARIFICATION] markers remain +- [x] Requirements are testable and unambiguous +- [x] Success criteria are measurable +- [x] Success criteria are technology-agnostic (no implementation details) +- [x] All acceptance scenarios are defined +- [x] Edge cases are identified +- [x] Scope is clearly bounded +- [x] Dependencies and assumptions identified + +## Feature Readiness + +- [x] All functional requirements have clear acceptance criteria +- [x] User scenarios cover primary flows +- [x] Feature meets measurable outcomes defined in Success Criteria +- [x] No implementation details leak into specification + +## Notes + +- The public option name `hideWhenEmpty` is captured as an assumption because it is explicitly proposed in issue #4490. diff --git a/specs/010-hide-empty-axes/contracts/interface.ts b/specs/010-hide-empty-axes/contracts/interface.ts new file mode 100644 index 0000000000..65d371db44 --- /dev/null +++ b/specs/010-hide-empty-axes/contracts/interface.ts @@ -0,0 +1,7 @@ +export interface ICartesianAxisCommonSpec { + /** + * Hide the axis automatically when its bound series produce no collected axis data. + * Disabled by default. + */ + hideWhenEmpty?: boolean; +} diff --git a/specs/010-hide-empty-axes/data-model.md b/specs/010-hide-empty-axes/data-model.md new file mode 100644 index 0000000000..5960f16ec5 --- /dev/null +++ b/specs/010-hide-empty-axes/data-model.md @@ -0,0 +1,56 @@ +# Data Model: Hide Axes For Empty Series + +## Entities + +### Axis Visibility Spec + +The public axis configuration entry that controls explicit visibility and optional auto-hide behavior. + +| Field | Type | Description | +|-------|------|-------------| +| `visible` | `boolean` | Existing explicit axis visibility control. | +| `hideWhenEmpty` | `boolean` | New opt-in flag that hides the axis when no bound series data can be collected for the axis. | + +### Axis Runtime Visibility State + +The effective axis visibility derived from both explicit spec visibility and runtime data collection state. + +| Field | Type | Description | +|-------|------|-------------| +| `specVisible` | `boolean` | Whether the user explicitly allows the axis to render. | +| `runtimeVisible` | `boolean` | Whether the axis should currently render after evaluating `hideWhenEmpty`. | +| `supportsRuntimeToggle` | `boolean` | Whether axis marks/tick data must stay available for future data-driven visibility changes. | + +### Bound Series Collection Result + +The aggregated result of axis-side collection from the series bound to a single axis. + +| Field | Type | Description | +|-------|------|-------------| +| `seriesIndexes` | `number[]` | Bound series linked to the axis through spec info. | +| `collectedDataCount` | `number` | Number of collected axis statistics entries across bound series. | +| `isEmpty` | `boolean` | True when no bound series contributed collected axis data. | + +## Validation Rules + +- `hideWhenEmpty` is optional and defaults to disabled. +- If `visible === false`, the axis remains hidden regardless of `hideWhenEmpty`. +- If `hideWhenEmpty === true`, the axis is hidden only when the bound series collection result is empty. +- Visibility must be recalculated after data updates and spec updates that affect bound series or axis visibility. + +## State Transitions + +- **Initial Render**: + - Input: axis spec + bound series collection result + - Logic: `runtimeVisible = specVisible && (!hideWhenEmpty || collectedDataCount > 0)` + - Output: axis renders or collapses from layout + +- **Data Update**: + - Input: updated series view statistics + - Logic: recompute bound series collection result, then recompute `runtimeVisible` + - Output: axis hides or reappears without chart remake + +- **Spec Update**: + - Input: changed `visible` or `hideWhenEmpty` + - Logic: refresh runtime visibility and axis layout/render state + - Output: axis reflects the updated visibility rules diff --git a/specs/010-hide-empty-axes/plan.md b/specs/010-hide-empty-axes/plan.md new file mode 100644 index 0000000000..1050070875 --- /dev/null +++ b/specs/010-hide-empty-axes/plan.md @@ -0,0 +1,85 @@ +# Implementation Plan: Hide Axes For Empty Series + +**Branch**: `010-hide-empty-axes` | **Date**: 2026-03-20 | **Spec**: [spec.md](spec.md) +**Input**: Feature specification from `/specs/010-hide-empty-axes/spec.md` + +**Note**: This template is filled in by the `/speckit.plan` command. See `.specify/templates/commands/plan.md` for the execution workflow. + +## Summary + +Add an opt-in `hideWhenEmpty` axis option for cartesian axes. The axis should hide when its bound series produce no collected axis data, while preserving existing behavior by default. The implementation will separate user-configured visibility from runtime empty-data visibility so the axis can auto-hide and reappear after `updateData` or `updateSpec` without requiring chart remake. + +## Technical Context + + + +**Language/Version**: TypeScript 4.9.5 +**Primary Dependencies**: `@visactor/vchart`, `@visactor/vutils`, `@visactor/vrender-components` +**Storage**: N/A +**Testing**: Jest +**Target Platform**: Web and cross-terminal chart runtimes supported by VChart +**Project Type**: Monorepo / Chart library +**Performance Goals**: No noticeable render or update regression; axis visibility recalculation should stay within existing axis domain update flow +**Constraints**: Cartesian axes only for this scope; must support runtime auto hide/show after data updates; must preserve existing behavior when option is unset +**Scale/Scope**: Public axis spec in `packages/vchart` and `packages/vchart-types`, axis runtime behavior in cartesian axis base flow, targeted unit regression coverage + +## Constitution Check + +*GATE: Must pass before Phase 0 research. Re-check after Phase 1 design.* + +- [x] **Quality First**: The change is localized to existing axis infrastructure and includes regression tests. +- [x] **UX Driven**: Empty axes are hidden only when explicitly requested, reducing visual noise without breaking defaults. +- [x] **SDD**: Spec, plan, research, data model, contracts, and tasks are captured before implementation. +- [x] **Monorepo Boundaries**: Public type changes stay in `packages/vchart` and `packages/vchart-types`; runtime logic stays in `packages/vchart`. +- [x] **Testing & Regression**: Add unit coverage for initial empty render, mixed axis visibility, and runtime data updates. + +## Project Structure + +### Documentation (this feature) + +```text +specs/010-hide-empty-axes/ +├── plan.md +├── research.md +├── data-model.md +├── quickstart.md +├── contracts/ +└── tasks.md +``` + +### Source Code (repository root) + + +```text +packages/vchart/src/component/axis/ +├── base-axis.ts # Common axis runtime behavior +├── interface/spec.ts # Shared public axis spec source +├── cartesian/interface/spec.ts # Cartesian axis spec source +└── cartesian/axis.ts # Cartesian axis layout/update behavior + +packages/vchart-types/types/component/axis/ +├── interface/spec.d.ts # Shared public axis type declarations +└── cartesian/interface/spec.d.ts # Cartesian axis declaration exports + +packages/vchart/__tests__/unit/ +└── component/cartesian/axis/ # Axis runtime regression tests +``` + +**Structure Decision**: Extend the existing cartesian axis runtime instead of introducing a new chart-level visibility mechanism. This keeps the behavior close to axis data collection and minimizes cross-package impact. + +## Complexity Tracking + +> **Fill ONLY if Constitution Check has violations that must be justified** + +| Violation | Why Needed | Simpler Alternative Rejected Because | +|-----------|------------|-------------------------------------| +| N/A | | | diff --git a/specs/010-hide-empty-axes/quickstart.md b/specs/010-hide-empty-axes/quickstart.md new file mode 100644 index 0000000000..046b197b5f --- /dev/null +++ b/specs/010-hide-empty-axes/quickstart.md @@ -0,0 +1,54 @@ +# Quickstart: Hide Axes For Empty Series + +## Overview + +This feature adds an opt-in `hideWhenEmpty` flag for cartesian axes. When enabled, the axis hides if its bound series do not contribute any collected axis data. When data appears later, the axis shows again automatically. + +## Usage + +### 1. Hide a value axis when its series is empty + +```ts +const spec = { + type: 'line', + data: [{ id: 'line', values: [] }], + axes: [ + { orient: 'left', hideWhenEmpty: true }, + { orient: 'bottom', type: 'band' } + ], + series: [{ type: 'line', dataId: 'line', xField: 'x', yField: 'y' }] +}; +``` + +Expected result: +- The left axis is hidden on first render because no axis data can be collected from the bound series. +- The bottom axis keeps its normal behavior unless it also enables `hideWhenEmpty`. + +### 2. Mixed axes + +```ts +const spec = { + type: 'common', + axes: [ + { id: 'left-empty', orient: 'left', hideWhenEmpty: true }, + { id: 'right-active', orient: 'right', hideWhenEmpty: true }, + { orient: 'bottom', type: 'band' } + ] +}; +``` + +Expected result: +- Only the axis whose bound series collect no data is hidden. +- Axes with collected bound-series data remain visible. + +### 3. Runtime updates + +```ts +vchart.updateData('line', [ + { x: 'Mon', y: 10 }, + { x: 'Tue', y: 20 } +]); +``` + +Expected result: +- A previously hidden axis with `hideWhenEmpty: true` becomes visible again after data update. diff --git a/specs/010-hide-empty-axes/research.md b/specs/010-hide-empty-axes/research.md new file mode 100644 index 0000000000..fcb1330911 --- /dev/null +++ b/specs/010-hide-empty-axes/research.md @@ -0,0 +1,40 @@ +# Research: Hide Axes For Empty Series + +**Feature**: Hide Axes For Empty Series +**Date**: 2026-03-20 + +## Unknowns & Resolutions + +### 1. What should define an "empty" axis? +- **Analysis**: Axis visibility should be derived from the data actually collected by the axis from its bound series, not from chart-level series count or raw spec presence. +- **Decision**: Treat an axis as empty when the axis data collection step cannot collect any series statistics for the bound series. +- **Rationale**: This matches the requested behavior and aligns with existing axis domain computation, which already filters out empty `viewData`. +- **Alternatives Considered**: + - Use chart-level "all series empty": rejected because multi-axis charts would over-hide unrelated axes. + - Use raw series array existence: rejected because a series can exist in spec but still have no collected axis data after transforms or filtering. + +### 2. How should runtime auto hide/show work? +- **Analysis**: Current axis `visible` is effectively a creation-time decision. Hiding by only mutating spec visibility would require remake to show the axis again after data updates. +- **Decision**: Separate explicit spec visibility from runtime empty-data visibility inside the axis component. Keep axis marks/tick data available when `hideWhenEmpty` is enabled, and update effective visibility as data changes. +- **Rationale**: This supports `updateData` and `updateSpec` driven reappearance without remaking the whole chart. +- **Alternatives Considered**: + - Recompute chart spec and remake chart on every visibility change: rejected because it is heavier and less aligned with the existing axis update flow. + - Hide only rendered graphics while keeping layout size: rejected because the axis would still occupy space, which does not solve the empty-axis problem. + +### 3. What is the correct implementation surface for this issue? +- **Analysis**: The request scope was clarified to cartesian axes only. Public API changes still need to be reflected in both source specs and published declaration files. +- **Decision**: Add `hideWhenEmpty?: boolean` to the common axis spec used by cartesian axes, then implement runtime visibility checks in the axis base/cartesian axis pipeline. +- **Rationale**: This exposes one consistent API while keeping implementation scope limited to cartesian axes. + +## Technology Choices + +- **Public API**: `hideWhenEmpty?: boolean` on axis spec. +- **Runtime Visibility Source**: Axis data collection result from bound series. +- **Behavior Scope**: Cartesian axes only in this change. +- **Validation**: Unit tests covering empty initial render, mixed-axis cases, and runtime updates. + +## Best Practices + +- Preserve backward compatibility by defaulting the new option to disabled. +- Reuse the existing axis data collection flow instead of introducing separate emptiness scans. +- Avoid tying runtime visibility to only raw data presence; use collected series statistics so filtered or non-renderable data is handled consistently. diff --git a/specs/010-hide-empty-axes/spec.md b/specs/010-hide-empty-axes/spec.md new file mode 100644 index 0000000000..f768cf873a --- /dev/null +++ b/specs/010-hide-empty-axes/spec.md @@ -0,0 +1,89 @@ +# Feature Specification: Hide Axes For Empty Series + +**Feature Branch**: `010-hide-empty-axes` +**Created**: 2026-03-20 +**Status**: Draft +**Input**: User description: "Add hideWhenEmpty axis option to hide axes when series is empty" + +## User Scenarios & Testing *(mandatory)* + +### User Story 1 - Suppress Empty Axes (Priority: P1) + +As a chart author, I want to opt in to hiding an axis when every series bound to that axis has no visible data, so charts do not show empty scaffolding that suggests missing content. + +**Why this priority**: This is the core request from issue #4490 and provides immediate visual clarity in empty-state charts. + +**Independent Test**: Configure a chart with one or more axes and no usable series data, enable the new empty-axis behavior, and verify the affected axes do not render while the rest of the chart remains stable. + +**Acceptance Scenarios**: + +1. **Given** a chart axis with the empty-axis behavior enabled and all bound series have no usable data, **When** the chart renders, **Then** that axis is hidden. +2. **Given** a chart axis with the empty-axis behavior enabled and at least one bound series has usable data, **When** the chart renders, **Then** that axis remains visible. + +--- + +### User Story 2 - Preserve Existing Defaults (Priority: P2) + +As an existing VChart user, I want charts to keep their current axis visibility behavior unless I explicitly opt in, so upgrading does not change existing layouts unexpectedly. + +**Why this priority**: Backward compatibility is required for a safe feature release in the core chart library. + +**Independent Test**: Render an existing chart configuration without the new option and verify axis visibility matches current behavior for both empty and non-empty series. + +**Acceptance Scenarios**: + +1. **Given** a chart axis without the empty-axis behavior enabled, **When** all bound series are empty, **Then** the axis visibility matches the current default behavior. + +--- + +### User Story 3 - Mixed Axis Visibility (Priority: P3) + +As a chart author using multiple axes, I want only axes whose own bound series are empty to be hidden, so charts can still show the axes that have valid data. + +**Why this priority**: Multi-axis charts are common in VChart, and partial hiding is needed to avoid over-hiding unrelated axes. + +**Independent Test**: Render a chart with multiple axes where one axis has empty bound series and another has non-empty bound series, enable the new behavior, and verify only the empty axis is hidden. + +**Acceptance Scenarios**: + +1. **Given** a chart with multiple axes and the empty-axis behavior enabled per axis, **When** only some axes have bound series with usable data, **Then** only the axes whose bound series are empty are hidden. + +### Edge Cases + +- When an axis is configured with the empty-axis behavior but the chart has no series bound to that axis, the axis should be treated as empty and hidden. +- When series exist but all values are filtered out, invalid, or otherwise unavailable for rendering, the axis should be treated as empty. +- When one direction of axes is hidden in a multi-axis chart, layout and remaining axes should still render without overlap or misalignment. +- When the chart updates from empty to non-empty data, the axis should reappear on the next render/update cycle. + +## Requirements *(mandatory)* + +### Functional Requirements + +- **FR-001**: The system MUST provide an opt-in axis configuration that hides an axis when all series bound to that axis are empty at render time. +- **FR-002**: The system MUST keep current axis visibility behavior unchanged when the new empty-axis configuration is not enabled. +- **FR-003**: The system MUST evaluate emptiness per axis, based on the series bound to that specific axis, rather than using chart-wide emptiness. +- **FR-004**: The system MUST continue rendering any axis that has at least one bound series with usable data, even if other axes in the same chart are hidden. +- **FR-005**: The system MUST apply the empty-axis visibility rule consistently during initial render and after data or spec updates. +- **FR-006**: The system MUST make the new axis configuration available through the public chart specification for axes. +- **FR-007**: The system MUST preserve chart stability when axes are hidden, including layout, region sizing, and rendering of remaining components. + +### Key Entities *(include if feature involves data)* + +- **Axis Visibility Rule**: An axis-level display setting that determines whether the axis should stay visible when its bound series are empty. +- **Bound Series Set**: The collection of series associated with a specific axis and used to determine whether that axis has usable data. +- **Usable Data State**: The render-time status describing whether a series contributes visible data points for its bound axis. + +## Assumptions + +- The feature applies to chart axes exposed through the public VChart axis specification. +- "Empty" includes the absence of renderable series data after any chart preprocessing or filtering. +- The requested API name is `hideWhenEmpty`, as proposed in issue #4490. + +## Success Criteria *(mandatory)* + +### Measurable Outcomes + +- **SC-001**: In empty-data charts with the new axis option enabled, affected axes are hidden in 100% of verified regression scenarios. +- **SC-002**: In non-empty charts, enabling the new option does not hide any axis that still has at least one bound series with usable data in 100% of verified regression scenarios. +- **SC-003**: Existing chart specifications that do not enable the new option show no axis-visibility regression in the targeted validation scenarios for this release. +- **SC-004**: Multi-axis validation scenarios correctly hide only the empty axes and preserve the visible axes in 100% of targeted regression checks. diff --git a/specs/010-hide-empty-axes/tasks.md b/specs/010-hide-empty-axes/tasks.md new file mode 100644 index 0000000000..e90ea93ea8 --- /dev/null +++ b/specs/010-hide-empty-axes/tasks.md @@ -0,0 +1,43 @@ +# Tasks: Hide Axes For Empty Series + +## Phase 1: Setup + +- [x] T001 Review existing cartesian axis visibility and data collection flow in `packages/vchart/src/component/axis/base-axis.ts` and `packages/vchart/src/component/axis/cartesian/axis.ts` + +## Phase 2: Foundational + +- [x] T002 Add the public `hideWhenEmpty` axis option in `packages/vchart/src/component/axis/interface/spec.ts` +- [x] T003 Add the declaration for `hideWhenEmpty` in `packages/vchart-types/types/component/axis/interface/spec.d.ts` + +## Phase 3: User Story 1 - Suppress Empty Axes + +**Goal**: Hide a cartesian axis when its bound series do not produce any collected axis data. + +**Independent Test**: Render a chart with `hideWhenEmpty: true` on a cartesian axis and empty bound series data, then verify the axis does not render or consume layout space. + +- [x] T004 [US1] Implement runtime empty-axis visibility evaluation in `packages/vchart/src/component/axis/base-axis.ts` +- [x] T005 [US1] Update cartesian axis layout/render flow to honor runtime empty-axis visibility in `packages/vchart/src/component/axis/cartesian/axis.ts` +- [x] T006 [US1] Add regression coverage for initial empty-axis hiding in `packages/vchart/__tests__/unit/component/cartesian/axis/hide-when-empty.test.ts` + +## Phase 4: User Story 2 - Preserve Existing Defaults + +**Goal**: Keep current behavior unchanged when `hideWhenEmpty` is not enabled. + +**Independent Test**: Render an existing chart without `hideWhenEmpty` and verify the axis behavior matches current output. + +- [x] T007 [US2] Ensure default axis behavior remains unchanged when `hideWhenEmpty` is unset in `packages/vchart/src/component/axis/base-axis.ts` +- [x] T008 [US2] Add regression coverage for unchanged default behavior in `packages/vchart/__tests__/unit/component/cartesian/axis/hide-when-empty.test.ts` + +## Phase 5: User Story 3 - Mixed Axis Visibility And Runtime Updates + +**Goal**: Hide only empty axes and restore visibility automatically when data appears later. + +**Independent Test**: Render a chart with multiple cartesian axes, confirm only empty axes are hidden, then update data and verify hidden axes reappear automatically. + +- [x] T009 [US3] Support runtime axis visibility toggling after data/spec updates in `packages/vchart/src/component/axis/base-axis.ts` +- [x] T010 [US3] [P] Add mixed-axis and runtime update coverage in `packages/vchart/__tests__/unit/component/cartesian/axis/hide-when-empty.test.ts` + +## Final Phase: Polish & Cross-Cutting Concerns + +- [ ] T011 Run targeted unit tests for axis visibility regressions +- [x] T012 Mark completed tasks and confirm implementation matches `specs/010-hide-empty-axes/spec.md` diff --git a/tools/bugserver-trigger/package.json b/tools/bugserver-trigger/package.json index 80a87df871..b432ee14d7 100644 --- a/tools/bugserver-trigger/package.json +++ b/tools/bugserver-trigger/package.json @@ -8,8 +8,8 @@ "ci": "ts-node --transpileOnly --skipProject ./scripts/trigger-test.ts" }, "dependencies": { - "@visactor/vchart": "workspace:2.0.19", - "@visactor/vchart-extension": "workspace:2.0.19" + "@visactor/vchart": "workspace:2.0.20", + "@visactor/vchart-extension": "workspace:2.0.20" }, "devDependencies": { "@rushstack/eslint-patch": "~1.1.4", diff --git a/tools/story-player/package.json b/tools/story-player/package.json index 70b72ff595..9650e7c72c 100644 --- a/tools/story-player/package.json +++ b/tools/story-player/package.json @@ -56,10 +56,10 @@ "vite": "3.2.6" }, "dependencies": { - "@visactor/vrender-core": "~1.0.41", - "@visactor/vrender-kits": "~1.0.41", - "@visactor/vchart": "workspace:2.0.19", - "@visactor/vrender": "~1.0.41", - "@visactor/vutils": "~1.0.22" + "@visactor/vrender-core": "1.0.44", + "@visactor/vrender-kits": "1.0.44", + "@visactor/vchart": "workspace:2.0.20", + "@visactor/vrender": "1.0.44", + "@visactor/vutils": "~1.0.23" } } \ No newline at end of file